Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends

PhyLayerUWBIR Class Reference
[IEEE 802.15.4A - Classes that implement the IEEE 802.15.4A UWB PHY.phyLayer - physical layer modulesPower consumption - Classes using/defining power consumption]

Physical layer that models an Ultra Wideband Impulse Radio wireless communication system. More...

#include <PhyLayerUWBIR.h>

Inherits BasePhyLayer.

Collaboration diagram for PhyLayerUWBIR:
Collaboration graph
[legend]

List of all members.

Public Types

typedef cDynamicExpression::Value(* fptr )(cComponent *context, cDynamicExpression::Value argv[], int argc)

Public Member Functions

void initialize (int stage)
 OMNeT++ initialization function.
void finish ()
 Only calls the deciders finish method.

Static Public Member Functions

static cDynamicExpression::Value ghassemzadehNLOSFunc (cComponent *context, cDynamicExpression::Value argv[], int argc)

Static Public Attributes

static fptr ghassemzadehNLOSFPtr

Protected Types

enum  Activities {
  SLEEP_ACCT = 0, RX_ACCT, TX_ACCT, SWITCHING_ACCT,
  SYNC_ACCT
}
 

Defines the power consuming activities (accounts) of the NIC. Should be the same as defined in the decider.


enum  ProtocolIds { IEEE_802154_UWB = 3200 }

Protected Member Functions

virtual AirFrame * encapsMsg (cPacket *msg)
 This function encapsulates messages from the upper layer into an AirFrame and sets all necessary attributes.
virtual AnalogueModelgetAnalogueModelFromName (std::string name, ParameterMap &params)
 Creates and returns an instance of the AnalogueModel with the specified name.
AnalogueModelcreateUWBIRStochasticPathlossModel (ParameterMap &params)
AnalogueModelcreateUWBIRIEEE802154APathlossModel (ParameterMap &params)
AnalogueModelcreateIntensityModel (ParameterMap &params)
virtual DecidergetDeciderFromName (std::string name, ParameterMap &params)
 Creates and returns an instance of the Decider with the specified name.
virtual RadioinitializeRadio ()
 Initializes and returns the radio class to use.
virtual void receiveBBItem (int category, const BBItem *details, int scopeModuleId)
virtual void handleAirFrame (cMessage *msg)
 Handles messages received from the channel (probably AirFrames).
virtual void switchRadioToRX ()
virtual void switchRadioToSync ()
virtual simtime_t setRadioState (int rs)
 Tells the BasePhyLayer to switch to the specified radio state.
virtual void setRadioCurrent (int rs)
virtual void setSwitchingCurrent (int from, int to)
virtual void handleHostState (const HostState &state)
 Captures changes in host state.
virtual void finishRadioSwitching ()
 Captures radio switches to adjust power consumption.

Protected Attributes

UWBIRStochasticPathlossModeluwbpathloss
UWBIRIEEE802154APathlossModelieee802154AChannel
DeciderUWBIREDuwbdecider
RadioUWBIRuwbradio
int numActivities
 Number of power consuming activities (accounts).
double sleepCurrent
 The different currents in mA.
double rxCurrent
double decodingCurrentDelta
double txCurrent
double syncCurrent
double setupRxCurrent
 The differnet switching state currents in mA.
double setupTxCurrent
double rxTxCurrent
double txRxCurrent

Friends

class DeciderUWBIRED

Detailed Description

Physical layer that models an Ultra Wideband Impulse Radio wireless communication system.

This class loads channel models and deliver frames to an UWB Decider. It is independent of the modulation technique, as long as the frames are represented using the same approach as in IEEE802154A.h (Maximum Pulse Amplitude Estimation).

Several channel models are possible: Ghassemzadeh-LOS, Ghassemadeh-NLOS (see UWBIRStochasticPathlossModel.h) and the IEEE 802.15.4A UWB channel models that use the default power delay profile (see UWBIRIEEE802154APathlossModel.h).

Currently, an energy detection receiver is modeled in UWBIRED.h. Several synchronization logics have been implemented in derived classes: see DeciderUWBIREDSync.h and and DeciderUWBIREDSyncOnAddress.h.

If you want to add a novel receiver (e.g. coherent demodulation), either derive UWBIRED or write your own, then add functionality in this module to load your decider. The same apply for new channel models.

To change the modulation, refer to UWBIRMac.h, IEEE802154A.h and UWBIRED.h. To implement optional modes of IEEE802154A, refer to IEEE802154A.h.

Refer to the following publications for more information: [1] An Ultra Wideband Impulse Radio PHY Layer Model for Network Simulation, J. Rousselot, J.-D. Decotignie, Simulation: Transactions of the Society for Computer Simulation, 2010 (to appear). [2] A High-Precision Ultra Wideband Impulse Radio Physical Layer Model for Network Simulation, Jérôme Rousselot, Jean-Dominique Decotignie, Second International Omnet++ Workshop,Simu'TOOLS, Rome, 6 Mar 09. http://portal.acm.org/citation.cfm?id=1537714

Definition at line 118 of file PhyLayerUWBIR.h.


Member Function Documentation

AnalogueModel * PhyLayerUWBIR::getAnalogueModelFromName ( std::string  name,
ParameterMap params 
) [protected, virtual]

Creates and returns an instance of the AnalogueModel with the specified name.

The returned AnalogueModel has to be generated with the "new" command. The BasePhyLayer keeps the ownership of the returned AnalogueModel.

This method is used by the BasePhyLayer during initialisation to load the AnalogueModels which has been specified in the ned file.

This method has to be overridden if you want to be able to load your own AnalogueModels.

Reimplemented from BasePhyLayer.

Definition at line 76 of file PhyLayerUWBIR.cc.

References Radio::getAnalogueModel().

                          {
  if (name == "UWBIRStochasticPathlossModel")
    return createUWBIRStochasticPathlossModel(params);

  if (name == "UWBIRIEEE802154APathlossModel")
    return createUWBIRIEEE802154APathlossModel(params);

  if (name == "RadioStateAnalogueModel")
    return uwbradio->getAnalogueModel();

  return 0;
}

Decider * PhyLayerUWBIR::getDeciderFromName ( std::string  name,
ParameterMap params 
) [protected, virtual]

Creates and returns an instance of the Decider with the specified name.

The returned Decider has to be generated with the "new" command. The BasePhyLayer keeps the ownership of the returned Decider.

This method is used by the BasePhyLayer during initialisation to load the Decider which has been specified in the ned file.

This method has to be overridden if you want to be able to load your own Decider.

Reimplemented from BasePhyLayer.

Definition at line 172 of file PhyLayerUWBIR.cc.

                                                                               {
  double syncThreshold;
  bool stats;
  bool trace;
  bool syncAlwaysSucceeds;
  ParameterMap::iterator it;

  protocolId = IEEE_802154_UWB;

  it = params.find("syncThreshold");
  if (it == params.end()) {
    error(
        "Could not find required double parameter <syncThreshold> in the decider xml configuration file.");
  }
  syncThreshold = it->second.doubleValue();

  it = params.find("stats");
  if (it == params.end()) {
    error(
        "Could not find required boolean parameter <stats> in the decider xml configuration file.");
  }
  stats = it->second.boolValue();

  it = params.find("trace");
  if (it == params.end()) {
    error(
        "Could not find required boolean parameter <trace> in the decider xml configuration file.");
  }
  trace = it->second.boolValue();

  it = params.find("syncAlwaysSucceeds");
  if (it == params.end()) {
    error(
        "Could not find required boolean parameter <syncAlwaysSucceeds> in the decider xml configuration file.");
  }
  syncAlwaysSucceeds = it->second.boolValue();

  bool alwaysFailOnDataInterference;
  it = params.find("alwaysFailOnDataInterference");
  if (it == params.end()) {
    alwaysFailOnDataInterference = false;
  } else {
    alwaysFailOnDataInterference = it->second.boolValue();
  }

  if (name == "DeciderUWBIREDSyncOnAddress") {
    int addr;
    it = params.find("addr");
    if (it == params.end()) {
      error(
          "Could not find required int parameter <addr> in the decider xml configuration file.");
    }
    addr = it->second.longValue();
    uwbdecider = new DeciderUWBIREDSyncOnAddress(this, this, syncThreshold,
        syncAlwaysSucceeds, stats, trace, addr, alwaysFailOnDataInterference);
  }

  if (name == "DeciderUWBIREDSync") {
    double tmin;
    it = params.find("syncMinDuration");
    if (it == params.end()) {
      error(
          "Could not find required double parameter <syncMinDuration> in the decider xml configuration file.");
    }
    tmin = it->second.doubleValue();
    uwbdecider = new DeciderUWBIREDSync(this, this, syncThreshold, syncAlwaysSucceeds, stats, trace, tmin, alwaysFailOnDataInterference);
  }

  if (name=="DeciderUWBIRED") {
      uwbdecider = new DeciderUWBIRED(this, this, syncThreshold, syncAlwaysSucceeds, stats, trace, alwaysFailOnDataInterference);
  }
  return uwbdecider;
}

void PhyLayerUWBIR::handleHostState ( const HostState state  )  [protected, virtual]

Captures changes in host state.

Note: Does not yet cancel any ongoing transmissions if the state changes to off.

Definition at line 270 of file PhyLayerUWBIR.cc.

References HostState::FAILED, and HostState::get().

                                                          {
  // handles only battery consumption

  HostState::States hostState = state.get();

  switch (hostState) {
  case HostState::FAILED:
    EV<< "t = " << simTime() << " host state FAILED" << endl;
    // it would be good to create a radioState OFF, as well
    break;
  default:
    break;
  }
}

void PhyLayerUWBIR::initialize ( int  stage  )  [virtual]

OMNeT++ initialization function.

Read simple parameters. Read and parse xml file for decider and analogue models configuration.

Reimplemented from BasePhyLayer.

Definition at line 12 of file PhyLayerUWBIR.cc.

References Radio::getCurrentState(), numActivities, BatteryAccess::registerWithBattery(), setupRxCurrent, and sleepCurrent.

                                        {
  BasePhyLayer::initialize(stage);
  if (stage == 0) {


    numActivities = 6;

    // Power consumption (from PhyLayerBattery)
    /* parameters belong to the NIC, not just phy layer
     *
     * if/when variable transmit power is supported, txCurrent
     * should be specified as an xml table of available transmit
     * power levels and corresponding txCurrent */
    sleepCurrent = rxCurrent = decodingCurrentDelta = txCurrent = 0;
    setupRxCurrent = setupTxCurrent = rxTxCurrent = txRxCurrent = 0;
    sleepCurrent = getParentModule()->par( "sleepCurrent" );
    rxCurrent = getParentModule()->par( "rxCurrent" );
//    decodingCurrentDelta = getParentModule()->par( "decodingCurrentDelta" );
    txCurrent = getParentModule()->par( "txCurrent" );
    setupRxCurrent = getParentModule()->par( "setupRxCurrent" );
    setupTxCurrent = getParentModule()->par( "setupTxCurrent" );
    rxTxCurrent = getParentModule()->par( "rxTxCurrent" );
    txRxCurrent = getParentModule()->par( "txRxCurrent" );
    syncCurrent = getParentModule()->par( "syncCurrent" ); // assume instantaneous transitions between rx and sync
  } else if (stage == 1) {
    registerWithBattery("physical layer", numActivities);
    setRadioCurrent(uwbradio->getCurrentState());
  }

}

Radio * PhyLayerUWBIR::initializeRadio (  )  [protected, virtual]

Initializes and returns the radio class to use.

Can be overridden by sub-classing phy layers to use their own Radio implementations.

Reimplemented from BasePhyLayer.

Definition at line 44 of file PhyLayerUWBIR.cc.

References BasePhyLayer::readPar(), BasePhyLayer::recordStats, Radio::RX, Radio::setSwitchTime(), Radio::SLEEP, and Radio::TX.

                                      {
  int initialRadioState = par("initialRadioState"); //readPar("initalRadioState", (int) RadioUWBIR::SYNC);
  double radioMinAtt = readPar("radioMinAtt", 1.0);
  double radioMaxAtt = readPar("radioMaxAtt", 0.0);

  uwbradio = RadioUWBIR::createNewUWBIRRadio(initialRadioState, recordStats, radioMinAtt, radioMaxAtt);

  //  - switch times to TX
  simtime_t rxToTX = readPar("timeRXToTX", 0.0);
  simtime_t sleepToTX = readPar("timeSleepToTX", 0.0);

  // Radio timers
  // From Sleep mode
  uwbradio->setSwitchTime(RadioUWBIR::SLEEP, RadioUWBIR::RX, par("timeSleepToRX"));
  uwbradio->setSwitchTime(RadioUWBIR::SLEEP, RadioUWBIR::TX, par("timeSleepToTX"));
  uwbradio->setSwitchTime(RadioUWBIR::SLEEP, RadioUWBIR::SLEEP, 0);

  // From TX mode
  uwbradio->setSwitchTime(RadioUWBIR::TX, RadioUWBIR::SYNC, par("timeTXToRX"));
  uwbradio->setSwitchTime(RadioUWBIR::TX, RadioUWBIR::RX, par("timeTXToRX"));

  // From RX mode
  uwbradio->setSwitchTime(RadioUWBIR::RX, RadioUWBIR::TX, par("timeRXToTX"));
  uwbradio->setSwitchTime(RadioUWBIR::RX, RadioUWBIR::SYNC, 0.000000001);
  uwbradio->setSwitchTime(RadioUWBIR::SYNC, RadioUWBIR::TX, par("timeRXToTX"));

  // From SYNC mode
  uwbradio->setSwitchTime(RadioUWBIR::SYNC, RadioUWBIR::RX, 0.000000001);

  return uwbradio;
}

void PhyLayerUWBIR::receiveBBItem ( int  category,
const BBItem details,
int  scopeModuleId 
) [protected, virtual]

called by Blackboard to inform of changes

Definition at line 246 of file PhyLayerUWBIR.cc.

References ChannelAccess::catMove.

                       {
  Enter_Method_Silent();
  ChannelAccess::receiveBBItem(category, details, scopeModuleId);
  if (category == catMove) {
    coreEV<< "Received move information in uwbphylayer." << endl;

  }
}

simtime_t PhyLayerUWBIR::setRadioState ( int  rs  )  [protected, virtual]

Tells the BasePhyLayer to switch to the specified radio state.

The switching process can take some time depending on the specified switching times in the ned file.

Returns:
-1: Error code if the Radio is currently switching else: switching time from the current RadioState to the new RadioState

Reimplemented from BasePhyLayer.

Definition at line 364 of file PhyLayerUWBIR.cc.

References Radio::getCurrentState(), BasePhyLayer::radio, and Radio::RX.

                                             {
  int prevState = radio->getCurrentState();

  if(rs==Radio::RX) {
    coreEV << "this is my breakpoint" << endl;
  }
  if(radio->getCurrentState()==RadioUWBIR::RX && rs != RadioUWBIR::RX && rs!= RadioUWBIR::SYNC) {
    uwbdecider->cancelReception();
  }

  simtime_t endSwitch = BasePhyLayer::setRadioState(rs);

  if(endSwitch >= 0) {
    if(radio->getCurrentState() == Radio::SWITCHING) {
            setSwitchingCurrent(prevState, rs);
    } else {
      setRadioCurrent(radio->getCurrentState());
    }
  }

  return endSwitch;
}


The documentation for this class was generated from the following files: