A Discrete-Event Network Simulator
API
half-duplex-ideal-phy.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 CTTC
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Nicola Baldo <nbaldo@cttc.es>
18  */
19 
20 #ifndef HALF_DUPLEX_IDEAL_PHY_H
21 #define HALF_DUPLEX_IDEAL_PHY_H
22 
23 #include <ns3/data-rate.h>
24 #include <ns3/event-id.h>
25 #include <ns3/generic-phy.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/net-device.h>
28 #include <ns3/nstime.h>
29 #include <ns3/packet.h>
30 #include <ns3/spectrum-channel.h>
31 #include <ns3/spectrum-interference.h>
32 #include <ns3/spectrum-phy.h>
33 #include <ns3/spectrum-signal-parameters.h>
34 #include <ns3/spectrum-value.h>
35 
36 namespace ns3
37 {
38 
78 {
79  public:
81  ~HalfDuplexIdealPhy() override;
82 
86  enum State
87  {
88  IDLE,
89  TX,
90  RX
91  };
92 
97  static TypeId GetTypeId();
98 
99  // inherited from SpectrumPhy
100  void SetChannel(Ptr<SpectrumChannel> c) override;
101  void SetMobility(Ptr<MobilityModel> m) override;
102  void SetDevice(Ptr<NetDevice> d) override;
103  Ptr<MobilityModel> GetMobility() const override;
104  Ptr<NetDevice> GetDevice() const override;
106  Ptr<Object> GetAntenna() const override;
108 
116 
123 
133  bool StartTx(Ptr<Packet> p);
134 
140  void SetRate(DataRate rate);
141 
147  DataRate GetRate() const;
148 
156 
164 
172 
180 
187 
188  private:
189  void DoDispose() override;
190 
195  void ChangeState(State newState);
199  void EndTx();
203  void AbortRx();
207  void EndRx();
208 
210 
215 
220 
223 
230 
235 
237 };
238 
239 } // namespace ns3
240 
241 #endif /* HALF_DUPLEX_IDEAL_PHY_H */
Class for representing data rates.
Definition: data-rate.h:90
An identifier for simulation events.
Definition: event-id.h:55
This PHY layer implementation realizes an ideal OFDM PHY which transmits half-duplex (i....
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
Trace - Tx end (ok)
void SetGenericPhyTxEndCallback(GenericPhyTxEndCallback c)
Set the callback for the end of a TX, as part of the interconnections between the PHY and the MAC.
Ptr< const SpectrumValue > m_rxPsd
Rx power spectral density.
GenericPhyTxEndCallback m_phyMacTxEndCallback
Callback - Tx end.
void SetGenericPhyRxEndErrorCallback(GenericPhyRxEndErrorCallback c)
set the callback for the end of a RX in error, as part of the interconnections between the PHY and th...
void SetRate(DataRate rate)
Set the PHY rate to be used by this PHY.
SpectrumInterference m_interference
Received interference.
DataRate GetRate() const
Get the PHY rate to be used by this PHY.
Ptr< MobilityModel > m_mobility
Mobility model.
void SetChannel(Ptr< SpectrumChannel > c) override
Set the channel attached to this device.
TracedCallback< Ptr< const Packet > > m_phyRxStartTrace
Trace - Rx start.
Ptr< AntennaModel > m_antenna
Antenna model.
TracedCallback< Ptr< const Packet > > m_phyRxAbortTrace
Trace - Rx abort.
Ptr< const SpectrumModel > GetRxSpectrumModel() const override
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
Trace - Tx start.
Ptr< Object > GetAntenna() const override
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
void SetGenericPhyRxEndOkCallback(GenericPhyRxEndOkCallback c)
set the callback for the successful end of a RX, as part of the interconnections between the PHY and ...
GenericPhyRxStartCallback m_phyMacRxStartCallback
Callback - Rx start.
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
Ptr< SpectrumChannel > m_channel
Channel.
EventId m_endRxEventId
End Rx event.
void ChangeState(State newState)
Change the PHY state.
void EndRx()
End current Rx.
Ptr< Packet > m_rxPacket
Rx packet.
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Set the Noise Power Spectral Density in power units (Watt, Pascal...) per Hz.
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback
Callback - Rx error.
Ptr< NetDevice > m_netDevice
NetDevice connected to this phy.
Ptr< NetDevice > GetDevice() const override
Get the associated NetDevice instance.
Ptr< Packet > m_txPacket
Tx packet.
void EndTx()
End the current Tx.
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
Trace - Rx end (error)
void SetDevice(Ptr< NetDevice > d) override
Set the associated NetDevice instance.
Ptr< MobilityModel > GetMobility() const override
Get the associated MobilityModel instance.
void AbortRx()
About current Rx.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
Set the Power Spectral Density of outgoing signals in power units (Watt, Pascal......
bool StartTx(Ptr< Packet > p)
Start a transmission.
void SetMobility(Ptr< MobilityModel > m) override
Set the mobility model associated with this device.
Ptr< SpectrumValue > m_txPsd
Tx power spectral density.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
Trace - Tx end.
void SetGenericPhyRxStartCallback(GenericPhyRxStartCallback c)
Set the callback for the start of RX, as part of the interconnections between the PHY and the MAC.
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback
Callback - Rx end.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.