MPhy Class Reference

Inheritance diagram for MPhy:

Inheritance graph
[legend]
Collaboration diagram for MPhy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MPhy ()
virtual ~MPhy ()
virtual void recv (Packet *p)
virtual int recvSyncClMsg (ClMessage *m)
virtual double getTxDuration (Packet *p)=0
virtual double getTxPower (Packet *p)
virtual double getRxPower (Packet *p)
virtual double getNoisePower (Packet *p)
virtual MAntennagetTxAntenna (Packet *p)
virtual MAntennagetRxAntenna (Packet *p)
virtual MSpectralMaskgetTxSpectralMask (Packet *p)
virtual MSpectralMaskgetRxSpectralMask (Packet *p)
virtual int getModulationType (Packet *p)=0
virtual int command (int argc, const char *const *argv)

Static Public Member Functions

static int registerModulationType (const char *name)
static const char * getModulationName (int modtype)

Protected Member Functions

virtual void startTx (Packet *p)=0
virtual void endTx (Packet *p)=0
virtual void startRx (Packet *p)=0
virtual void endRx (Packet *p)=0
void turnOn ()
void turnOff ()
void Phy2MacEndTx (const Packet *p)
void Phy2MacStartRx (const Packet *p)
void Phy2MacCCA (bool cca)

Protected Attributes

MPhyTxTimer txtimer
 timer handling end of transmissions
MPhyRxTimer rxtimer
 timer handling end of receptions
MInterferenceinterference_
MPropagationpropagation_
MAntennaantenna_
MSpectralMaskspectralmask_
MCorrelationcorrelation_
double TxPower_
double NoiseSPD_
bool isOn

Friends

class MPhyRxTimer
class MPhyTxTimer

Detailed Description

Definition at line 51 of file mphy.h.


Member Function Documentation

void MPhy::recv ( Packet *  p  )  [virtual]

Abstract method which has to be filled with the ad-hoc operations that the module has to do to the packet received

Parameters:
p pointer to the packet will be received
See also:
SAP, ChSAP

Implements Module.

Definition at line 199 of file mphy.cc.

References MInterference::addToInterference(), hdr_MPhy::dstAntenna, hdr_MPhy::dstPosition, hdr_MPhy::dstSpectralMask, hdr_MPhy::duration, getModulationType(), getNoisePower(), PlugIn::getPosition(), getRxAntenna(), getRxPower(), getRxSpectralMask(), getTxAntenna(), getTxDuration(), getTxPower(), getTxSpectralMask(), interference_, isOn, hdr_MPhy::modulationType, hdr_MPhy::Pi, hdr_MPhy::Pn, hdr_MPhy::Pr, hdr_MPhy::Pt, hdr_MPhy::rxtime, rxtimer, hdr_MPhy::srcAntenna, hdr_MPhy::srcPosition, hdr_MPhy::srcSpectralMask, startRx(), startTx(), hdr_MPhy::txtime, txtimer, UP, and hdr_MPhy::worth_tracing.

Here is the call graph for this function:

int MPhy::recvSyncClMsg ( ClMessage m  )  [virtual]

Cross-Layer messages synchronous interpreter. It has to be properly extended in order to interpret custom cross-layer messages used by this particular plug-in. This type of communication need to be directly answered in the message exchanged in order to be synchronous with the source.

Parameters:
m an instance of ClMessage that represent the message received and used for the answer
Returns:
zero if successful
See also:
NodeCore, ClMessage, ClSAP, ClTracer

Reimplemented from PlugIn.

Definition at line 319 of file mphy.cc.

References CLMSG_MAC2PHY_GETTXDURATION, CLMSG_PHY_ON_OFF_SWITCH, CLMSG_PHY_ON_OFF_SWITCH_STATUS, getTxDuration(), getTxSpectralMask(), isOn, PlugIn::recvSyncClMsg(), hdr_MPhy::srcSpectralMask, turnOff(), turnOn(), and ClMessage::type().

Here is the call graph for this function:

virtual double MPhy::getTxDuration ( Packet *  p  )  [pure virtual]

Returns the duration of the transmission for the packet being transmitted. Should account for modulation type, PHY overhead, and so on. This method is not implemented in the MPhy class, it must be implemented by each derived PHY class

The MPhy class evaluates this method just prior to starting the transmission of a packet.

Parameters:
p the packet being transmitted
Returns:
duration in s

Implemented in MPhy_Bpsk, and UmtsPhy.

Referenced by recv(), and recvSyncClMsg().

virtual double MPhy::getTxPower ( Packet *  p  )  [inline, virtual]

Returns the transmission power for the packet being transmitted.

The MPhy class evaluates this method just prior to starting the transmission of a packet.

Parameters:
p packet being transmitted
Returns:
the transmission power in W

Reimplemented in UmtsPhy.

Definition at line 89 of file mphy.h.

References TxPower_.

Referenced by recv().

double MPhy::getRxPower ( Packet *  p  )  [virtual]

Returns the signal power for the packet being received. Signal power is calculated evaluating the TX power of the packet, TX and RX antenna gains, propagation gain and the spectral overlapping of the transmission with the receiver spectral mask.

The MPhy class evaluates this method when reception of a packet begins.

Parameters:
p the packet being received
Returns:
the received signal power

Definition at line 348 of file mphy.cc.

References correlation_, hdr_MPhy::dstAntenna, hdr_MPhy::dstSpectralMask, hdr_MPhy::duration, MCorrelation::getGain(), MPropagation::getGain(), MAntenna::getGain(), MSpectralMask::getOverlap(), propagation_, hdr_MPhy::Pt, hdr_MPhy::srcAntenna, and hdr_MPhy::srcSpectralMask.

Referenced by recv().

Here is the call graph for this function:

double MPhy::getNoisePower ( Packet *  p  )  [virtual]

Returns the noise power at the receiver. This noise power should NOT include interference power, which is handled independently. By default, in the parent MPhy class, noise power is calculated with respect to a given noise spectral power density which is multiplied by the spectral mask of the receiver. In derived PHY classes, this method can be overridden and the result may be computed as a function of the packet being received.

The MPhy class evaluates this method when reception of a packet begins.

Parameters:
p the packet being received.
Returns:

Definition at line 402 of file mphy.cc.

References MSpectralMask::getBandwidth(), getRxSpectralMask(), and NoiseSPD_.

Referenced by recv().

Here is the call graph for this function:

virtual MAntenna* MPhy::getTxAntenna ( Packet *  p  )  [inline, virtual]

Returns the antenna to be used for the transmission of a given packet.

The MPhy class evaluates this method just prior to starting the transmission of a packet.

Parameters:
p the packet being transmitted
Returns:
a pointer to the antenna instance to be used for transmission.

Definition at line 134 of file mphy.h.

References antenna_.

Referenced by recv().

virtual MAntenna* MPhy::getRxAntenna ( Packet *  p  )  [inline, virtual]

Returns the antenna to be used for the reception of a given packet.

The MPhy class evaluates this method when reception of a packet begins.

Parameters:
p the packet being received
Returns:
a pointer to the antenna instance to be used for reception

Definition at line 147 of file mphy.h.

References antenna_.

Referenced by recv().

virtual MSpectralMask* MPhy::getTxSpectralMask ( Packet *  p  )  [inline, virtual]

Returns the spectral mask to be used for the transmission of a given packet.

Parameters:
p the packet being transmitted
Returns:
a pointer to the spectral mask to be used for transmission

Reimplemented in UmtsPhyBS, and UmtsPhyME.

Definition at line 157 of file mphy.h.

References spectralmask_.

Referenced by recv(), and recvSyncClMsg().

virtual MSpectralMask* MPhy::getRxSpectralMask ( Packet *  p  )  [inline, virtual]

Returns the spectral mask to be used for reception

Parameters:
p the packet being received
Returns:
a pointer to the spectral mask to be used for reception

Reimplemented in UmtsPhyBS, and UmtsPhyME.

Definition at line 167 of file mphy.h.

References spectralmask_.

Referenced by getNoisePower(), and recv().

int MPhy::registerModulationType ( const char *  name  )  [static]

Method used to register new modulation types. Should be called ONCE for each modulation type implemented by a MPhy-derived class; the obtained modulation id(s) should be shared among all implementations of such class.

Parameters:
name the name of the new modulation type registered
Returns:
the id of the new modulation type registered

Definition at line 173 of file mphy.cc.

Referenced by MPhy_Bpsk::MPhy_Bpsk(), and UmtsPhy::UmtsPhy().

const char * MPhy::getModulationName ( int  modtype  )  [static]

Returns the name of the corresponding modulation id. Useful e.g. for tracing purposes.

Parameters:
modtype modulation type id
Returns:
the name

Definition at line 186 of file mphy.cc.

Referenced by MPhyTracer::format().

virtual int MPhy::getModulationType ( Packet *  p  )  [pure virtual]

Get the modulation type to be used for the packet being transmitted. This method should be implemented by all derived classes

Parameters:
p the packet being transmitted
Returns:

Implemented in MPhy_Bpsk, and UmtsPhy.

Referenced by recv().

int MPhy::command ( int  argc,
const char *const *  argv 
) [virtual]

TCL command parser

Parameters:
argc 
argv 
Returns:
TCL_OK or TCL_ERROR

Reimplemented from Module.

Reimplemented in UmtsPhy, and UmtsPhyME.

Definition at line 57 of file mphy.cc.

References antenna_, Module::command(), correlation_, interference_, propagation_, and spectralmask_.

Referenced by UmtsPhy::command().

Here is the call graph for this function:

virtual void MPhy::startTx ( Packet *  p  )  [protected, pure virtual]

Method invoked at the beginning of the transmission of a given packet. This method must be implemented by each class inheriting from the MPhy class. It should be used to set specific header fields of the particular PHY technology being implemented, such as the ModulationType in the MPhy packet header. Furthermore, each implementation of this method must take care of calling sendDown(p)

Parameters:
p the given packet

Implemented in MPhy_Bpsk, UmtsPhy, UmtsPhyBS, and UmtsPhyME.

Referenced by recv().

virtual void MPhy::endTx ( Packet *  p  )  [protected, pure virtual]

Method invoked at the end of the transmission of a given packet. This method must be implemented by each class inheriting from the MPhy class. No idea what this method might be useful for, however... probably most implementations will be fine with an empty body for it.

Parameters:
p the given packet

Implemented in MPhy_Bpsk, and UmtsPhy.

Referenced by MPhyTxTimer::handle().

virtual void MPhy::startRx ( Packet *  p  )  [protected, pure virtual]

Method invoked at the beginning of the reception of a given packet. This method must be implemented by each class inheriting from the MPhy class. It should be used to check synchronization on the transmission. The ModulationType is probably useful also for this purpose.

Parameters:
p the given packet

Implemented in MPhy_Bpsk, and UmtsPhy.

Referenced by recv().

virtual void MPhy::endRx ( Packet *  p  )  [protected, pure virtual]

Method invoked at the end of the reception of a given packet. This method must be implemented by each class inheriting from the MPhy class.

Please note that this method is called for ALL incoming transmissions, that is even if the receiver was actually not synchronized on packet p. As a consequence, each implementation of this method should check if the receiver was actually synchronized on packet p.

Furthermore, reception errors should be evaluated within this method, and the appropriate action should be taken. It is left to the implementer to decide whether the packet should be dropped in case of errors, or whether some error flag (e.g., ch->error) should be set instead to let some upper layer (e.g., MAC) drop the packet by itself. The ModulationType is probably to be checked for, since even if SNIR is high it is not likely we can decode a modulation other the ones each Phy implementation was designed to decode.

Finally, each implementation of this method should take care to call sendUp(p) in case the reception of the packet was successful.

Parameters:
p the given packet

Implemented in MPhy_Bpsk, UmtsPhy, UmtsPhyBS, and UmtsPhyME.

Referenced by MPhyRxTimer::handle().

void MPhy::turnOn (  )  [inline, protected]

Turns the PHY on

Definition at line 291 of file mphy.h.

References isOn.

Referenced by recvSyncClMsg().

void MPhy::turnOff (  )  [inline, protected]

Turns the PHY off

Definition at line 297 of file mphy.h.

References isOn.

Referenced by recvSyncClMsg().

void MPhy::Phy2MacEndTx ( const Packet *  p  )  [protected]

Notify the MAC that transmission of a packet has ended

Note:
this method is never called in the base MPhy class, it should be called whenever appropriate within a class inheriting from MPhy
Parameters:
p pointer to the packet whose transmission has ended

Definition at line 453 of file mphy.cc.

References Module::sendSyncClMsgUp().

Referenced by MPhy_Bpsk::endTx().

Here is the call graph for this function:

void MPhy::Phy2MacStartRx ( const Packet *  p  )  [protected]

Notify the MAC that reception of a packet has begun, e.g. when the PHY preamble of an incoming transmission has been detected

Note:
this method is never called in the base MPhy class, it should be called whenever appropriate within a class inheriting from MPhy
Parameters:
p pointer to the packet whose reception has begun

Definition at line 460 of file mphy.cc.

References Module::sendSyncClMsgUp().

Referenced by MPhy_Bpsk::startRx().

Here is the call graph for this function:

void MPhy::Phy2MacCCA ( bool  cca  )  [protected]

Notify the MAC that the value of the Clear Channel Assessment variable has changed

Note:
this method is never called in the base MPhy class, it should be called whenever appropriate within a class inheriting from MPhy
Parameters:
cca the new value for the CCA variable (true = channel clear, false = channel busy)

Definition at line 468 of file mphy.cc.

References Module::sendSyncClMsgUp().

Here is the call graph for this function:


Member Data Documentation

MInterference* MPhy::interference_ [protected]

pointer to the interference model plugged via tcl

Definition at line 342 of file mphy.h.

Referenced by command(), MPhyRxTimer::handle(), and recv().

MPropagation* MPhy::propagation_ [protected]

pointer to the propagation model plugged via tcl

Definition at line 345 of file mphy.h.

Referenced by command(), and getRxPower().

MAntenna* MPhy::antenna_ [protected]

pointer to the antenna model plugged via tcl. Note that the base MPhy class uses a single antenna both for TX and RX. This can be changed in derived implementations by overriding the getTxAntenna() and getRxAntenna() methods.

Definition at line 348 of file mphy.h.

Referenced by command(), getRxAntenna(), and getTxAntenna().

MSpectralMask* MPhy::spectralmask_ [protected]

pointer to the receiver spectral mask plugged via tcl. Note that the base MPhy class uses a single spectral mask for Tx and Rx. Smarter implementations derived from MPhy (e.g., cognitive radio implementations) might be able to use different spectral mask both for TX and RX. This can be achieved by overriding the getTxSpectralMask() and getRxSpectralMask() methods.

Definition at line 357 of file mphy.h.

Referenced by command(), getRxSpectralMask(), and getTxSpectralMask().

MCorrelation* MPhy::correlation_ [protected]

Pointer to the correlation module plugged via tcl.

Definition at line 370 of file mphy.h.

Referenced by command(), and getRxPower().

double MPhy::NoiseSPD_ [protected]

Tx Power in W. Simple adaptations of the transmission power might be carried out just by re-setting this value. More complex strategies (e.g., packet-specific transmission power) can be implemented by overriding the getTxPower() method.

Definition at line 385 of file mphy.h.

Referenced by getNoisePower(), and MPhy().

bool MPhy::isOn [protected]

Noise Spectral Power Density in W/Hz. If you need to make this time- or packet-dependent (e.g. as required when simulating underwater acoustic communications) you can either modify the value of this variable or re-implement the getNoisePower() method.

Definition at line 392 of file mphy.h.

Referenced by recv(), recvSyncClMsg(), turnOff(), and turnOn().


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 15:50:32 2008 for NS-MIRACLE library by  doxygen 1.5.2