27 #include <ns3/spectrum-phy.h>
28 #include <ns3/traced-callback.h>
29 #include <ns3/traced-value.h>
30 #include <ns3/event-id.h>
36 class LrWpanErrorModel;
37 struct LrWpanSpectrumSignalParameters;
39 class SpectrumChannel;
43 class UniformRandomVariable;
122 namespace TracedValueCallback
490 (
Time time, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState);
566 void CancelEd (LrWpanPhyEnumeration state);
Simulation virtual time values and global simulation resolution.
void SetPlmeSetTRXStateConfirmCallback(PlmeSetTRXStateConfirmCallback c)
set the callback for the end of an SetTRXState, as part of the interconnections betweenthe PHY and th...
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
Abstract base class for Spectrum-aware PHY layers.
Make LrWpanPhy a SpectrumPhy so we can enable the eventual modeling of device interference.
static const uint32_t aTurnaroundTime
The turnaround time for switching the transceiver from RX to TX or vice versa.
void(* StateTracedCallback)(Time time, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
TracedCallback signature for Trx state change events.
void SetPdDataConfirmCallback(PdDataConfirmCallback c)
set the callback for the end of a TX, as part of the interconnections betweenthe PHY and the MAC...
LrWpanPhyOption GetMyPhyOption(void)
Get the currently configured PHY option.
Ptr< UniformRandomVariable > m_random
Uniform random variable stream.
PdDataConfirmCallback m_pdDataConfirmCallback
This callback is used to report packet transmission status to the MAC layer.
LrWpanPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
TracedValue< LrWpanPhyEnumeration > m_trxState
The current transceiver state.
void SetPdDataIndicationCallback(PdDataIndicationCallback c)
set the callback for the end of a RX, as part of the interconnections betweenthe PHY and the MAC...
uint32_t phyCurrentPage
Current channel page.
Callback< void, LrWpanPhyEnumeration > PlmeCcaConfirmCallback
This method implements the PD SAP: PlmeCcaConfirm.
Forward calls to a chain of Callback.
void SetPlmeCcaConfirmCallback(PlmeCcaConfirmCallback c)
set the callback for the end of a CCA, as part of the interconnections betweenthe PHY and the MAC...
PlmeEdConfirmCallback m_plmeEdConfirmCallback
This callback is used to report ED status to the MAC.
void SetDevice(Ptr< NetDevice > d)
set the associated NetDevice instance
void SetPlmeEdConfirmCallback(PlmeEdConfirmCallback c)
set the callback for the end of an ED, as part of the interconnections betweenthe PHY and the MAC...
LrWpanEdPower m_edPower
Helper value for tracking the average power during ED.
Time measurementLength
Total measuremement period.
Ptr< NetDevice > GetDevice(void) const
get the associated NetDevice instance
void ChangeTrxState(LrWpanPhyEnumeration newState)
Change the PHY state to the given new state, firing the state change trace.
bool PhyIsBusy(void) const
Check if the PHY is busy, which is the case if the PHY is currently sending or receiving a frame...
PacketAndStatus m_currentTxPacket
Statusinformation of the currently transmitted packet.
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
uint8_t phyCCAMode
CCA mode.
PlmeGetAttributeConfirmCallback m_plmeGetAttributeConfirmCallback
This callback is used to report requested attribute values back to the MAC.
void EndSetTRXState(void)
Called after applying a deferred transceiver state switch.
Ptr< SpectrumValue > m_txPsd
The transmit power spectral density.
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
IEEE802.15.4-2006 PHY PIB Attributes Table 23 in section 6.4.2.
static const LrWpanPhyPpduHeaderSymbolNumber ppduHeaderSymbolNumbers[7]
The preamble, SFD, and PHR lengths in symbols for the different PHY options.
double m_rxSensitivity
The receiver sensitivity.
double GetDataOrSymbolRate(bool isData)
implement PLME SetAttribute confirm SAP
TracedCallback< Time, LrWpanPhyEnumeration, LrWpanPhyEnumeration > m_trxStateLogger
The trace source fired when the phy layer changes the transceiver state.
PlmeSetTRXStateConfirmCallback m_plmeSetTRXStateConfirmCallback
This callback is used to report transceiver state change status to the MAC.
static const uint32_t aMaxPhyPacketSize
The maximum packet size accepted by the PHY.
static TypeId GetTypeId(void)
Get the type ID.
void SetPlmeSetAttributeConfirmCallback(PlmeSetAttributeConfirmCallback c)
set the callback for the end of an SetAttribute, as part of the interconnections betweenthe PHY and t...
Ptr< SpectrumChannel > m_channel
The channel attached to this transceiver.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Time lastUpdate
Last update time.
static const LrWpanPhyDataAndSymbolRates dataSymbolRates[7]
The data and symbol rates for the different PHY options.
void SetPlmeGetAttributeConfirmCallback(PlmeGetAttributeConfirmCallback c)
set the callback for the end of an GetAttribute, as part of the interconnections betweenthe PHY and t...
LrWpanPhyEnumeration m_trxStatePending
The next pending state to applied after the current action of the PHY is completed.
void SetErrorModel(Ptr< LrWpanErrorModel > e)
set the error model to use
double m_ccaPeakPower
Helper value for the peak power value during CCA.
Ptr< LrWpanErrorModel > GetErrorModel(void) const
get the error model in use
Time GetPpduHeaderTxTime(void)
Calculate the time required for sending the PPDU header, that is the preamble, SFD and PHR...
uint32_t phyMaxFrameDuration
The maximum number of symbols in a frame.
Ptr< const SpectrumValue > GetNoisePowerSpectralDensity(void)
Get the noise power spectral density.
Ptr< LrWpanInterferenceHelper > m_signal
The accumulated signals currently received by the transceiver, including the signal of a possibly rec...
void SetMyPhyOption(void)
Configure the PHY option according to the current channel and channel page.
Callback< void, uint32_t, Ptr< Packet >, uint8_t > PdDataIndicationCallback
This method implements the PD SAP: PdDataIndication.
virtual Ptr< const SpectrumModel > GetRxSpectrumModel(void) const
Ptr< AntennaModel > m_antenna
The antenna used by the transceiver.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
Set the Power Spectral Density of outgoing signals in W/Hz.
Time m_rxLastUpdate
Timestamp of the last calculation of the PER of a packet currently received.
uint8_t phyTransmitPower
Transmit power.
void SetAntenna(Ptr< AntennaModel > a)
Set the attached antenna.
Ptr< const SpectrumValue > m_noise
The spectral density for for the noise.
EventId m_setTRXState
Scheduler event of a currently running deferred transceiver state switch.
Callback< void, LrWpanPhyEnumeration, LrWpanPibAttributeIdentifier > PlmeSetAttributeConfirmCallback
This method implements the PD SAP: PlmeSetAttributeConfirm.
Ptr< NetDevice > m_device
The configured net device.
double phySymbolsPerOctet
The number of symbols per octet.
void PlmeGetAttributeRequest(LrWpanPibAttributeIdentifier id)
IEEE 802.15.4-2006 section 6.2.2.5 PLME-GET.request Get attributes per definition from Table 23 in se...
LrWpanPhy(void)
Default constructor.
Ptr< SpectrumChannel > GetChannel(void)
Get the currently attached channel.
Ptr< MobilityModel > GetMobility(void)
get the associated MobilityModel instance
EventId m_edRequest
Scheduler event of a currently running ED request.
std::pair< Ptr< Packet >, bool > PacketAndStatus
The second is true if the first is flagged as error/invalid.
std::pair< Ptr< LrWpanSpectrumSignalParameters >, bool > m_currentRxPacket
Statusinformation of the currently received packet.
Ptr< MobilityModel > m_mobility
The mobility model used by the PHY.
LrWpanPhyOption m_phyOption
The currently configured PHY type.
void EndCca(void)
Called at the end of the CCA.
void PlmeSetTRXStateRequest(LrWpanPhyEnumeration state)
IEEE 802.15.4-2006 section 6.2.2.7 PLME-SET-TRX-STATE.request Set PHY state.
bool ChannelSupported(uint8_t channel)
Check if the given channel is supported by the PHY.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
PdDataIndicationCallback m_pdDataIndicationCallback
This callback is used to notify incoming packets to the MAC layer.
double symbolRate
symbol rate
double averagePower
Average measured power.
PlmeSetAttributeConfirmCallback m_plmeSetAttributeConfirmCallback
This callback is used to report attribute set results back to the MAC.
Callback< void, LrWpanPhyEnumeration > PlmeSetTRXStateConfirmCallback
This method implements the PD SAP: PlmeSetTRXStateConfirm.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
Ptr< AntennaModel > GetRxAntenna(void)
get the AntennaModel used by the NetDevice for reception
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
void EndTx(void)
Finish the transmission of a frame.
uint32_t phySHRDuration
The duration of the synchronization header (SHR) in symbols.
EventId m_ccaRequest
Scheduler event of a currently running CCA request.
Helper structure to manage the power measurement during ED.
void CheckInterference(void)
Check if the interference destroys a frame currently received.
double GetPhySymbolsPerOctet(void) const
Get the number of symbols per octet, depending on the currently selected channel. ...
EventId m_pdDataRequest
Scheduler event of a currently running data transmission request.
PlmeCcaConfirmCallback m_plmeCcaConfirmCallback
This callback is used to report CCA status to the MAC or CSMA/CA.
An identifier for simulation events.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Set the noise power spectral density.
LrWpanPhyPibAttributes m_phyPIBAttributes
The current PHY PIB attributes.
virtual void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming waveform.
TracedCallback< Ptr< const Packet >, double > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
void EndEd(void)
Called at the end of the ED procedure.
void PlmeSetAttributeRequest(LrWpanPibAttributeIdentifier id, LrWpanPhyPibAttributes *attribute)
IEEE 802.15.4-2006 section 6.2.2.9 PLME-SET.request Set attributes per definition from Table 23 in se...
void PdDataRequest(const uint32_t psduLength, Ptr< Packet > p)
IEEE 802.15.4-2006 section 6.2.1.1 PD-DATA.request Request to transfer MPDU from MAC (transmitting) ...
uint8_t phyCurrentChannel
The RF channel to use.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Callback< void, LrWpanPhyEnumeration > PdDataConfirmCallback
This method implements the PD SAP: PdDataConfirm.
Time CalculateTxTime(Ptr< const Packet > packet)
Calculate the time required for sending the given packet, including preamble, SFD and PHR...
void PlmeCcaRequest(void)
IEEE 802.15.4-2006 section 6.2.2.1 PLME-CCA.request Perform a CCA per section 6.9.9.
void PlmeEdRequest(void)
IEEE 802.15.4-2006 section 6.2.2.3 PLME-ED.request Perform an ED per section 6.9.7.
void CancelEd(LrWpanPhyEnumeration state)
Cancel an ongoing ED procedure.
virtual void DoDispose(void)
Destructor implementation.
LrWpanPhyOption
This Phy option will be used to index various Tables in IEEE802.15.4-2006.
This data structure provides the Bit rate and Symbol rate for a given channel See IEEE802...
uint64_t GetPhySHRDuration(void) const
Get the duration of the SHR (preamble and SFD) in symbols, depending on the currently selected channe...
Callback< void, LrWpanPhyEnumeration, LrWpanPibAttributeIdentifier, LrWpanPhyPibAttributes * > PlmeGetAttributeConfirmCallback
This method implements the PD SAP: PlmeGetAttributeConfirm.
Ptr< LrWpanErrorModel > m_errorModel
The error model describing the bit and packet error rates.
a unique identifier for an interface.
Callback< void, LrWpanPhyEnumeration, uint8_t > PlmeEdConfirmCallback
This method implements the PD SAP: PlmeEdConfirm.
void EndRx(Ptr< SpectrumSignalParameters > params)
Finish the reception of a frame.