A Discrete-Event Network Simulator
API
half-duplex-ideal-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef HALF_DUPLEX_IDEAL_PHY_H
22 #define HALF_DUPLEX_IDEAL_PHY_H
23 
24 
25 #include <ns3/spectrum-value.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/packet.h>
28 #include <ns3/nstime.h>
29 #include <ns3/net-device.h>
30 #include <ns3/spectrum-phy.h>
31 #include <ns3/spectrum-channel.h>
32 #include <ns3/spectrum-interference.h>
33 #include <ns3/data-rate.h>
34 #include <ns3/generic-phy.h>
35 #include <ns3/event-id.h>
36 #include <ns3/spectrum-signal-parameters.h>
37 
38 namespace ns3 {
39 
79 {
80 
81 public:
83  virtual ~HalfDuplexIdealPhy ();
84 
88  enum State
89  {
90  IDLE,
91  TX,
92  RX
93  };
94 
99  static TypeId GetTypeId (void);
100 
101  // inherited from SpectrumPhy
104  void SetDevice (Ptr<NetDevice> d);
106  Ptr<NetDevice> GetDevice () const;
110 
111 
119 
126 
127 
137  bool StartTx (Ptr<Packet> p);
138 
144  void SetRate (DataRate rate);
145 
151  DataRate GetRate () const;
152 
160 
168 
176 
184 
190  void SetAntenna (Ptr<AntennaModel> a);
191 
192 private:
193  virtual void DoDispose (void);
194 
199  void ChangeState (State newState);
203  void EndTx ();
207  void AbortRx ();
211  void EndRx ();
212 
214 
219 
224 
227 
234 
239 
241 
242 };
243 
244 }
245 
246 
247 #endif /* HALF_DUPLEX_IDEAL_PHY_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::HalfDuplexIdealPhy::m_phyRxEndErrorTrace
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
Trace - Rx end (error)
Definition: half-duplex-ideal-phy.h:233
ns3::HalfDuplexIdealPhy::m_rate
DataRate m_rate
Datarate.
Definition: half-duplex-ideal-phy.h:225
ns3::HalfDuplexIdealPhy::SetChannel
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Definition: half-duplex-ideal-phy.cc:177
ns3::HalfDuplexIdealPhy::m_phyRxEndOkTrace
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
Trace - Tx end (ok)
Definition: half-duplex-ideal-phy.h:232
ns3::HalfDuplexIdealPhy::EndRx
void EndRx()
End current Rx.
Definition: half-duplex-ideal-phy.cc:421
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::Callback< void, Ptr< const Packet > >
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::HalfDuplexIdealPhy::IDLE
@ IDLE
Idle state.
Definition: half-duplex-ideal-phy.h:90
ns3::HalfDuplexIdealPhy::EndTx
void EndTx()
End the current Tx.
Definition: half-duplex-ideal-phy.cc:321
ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndErrorCallback
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...
Definition: half-duplex-ideal-phy.cc:244
ns3::HalfDuplexIdealPhy::SetMobility
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
Definition: half-duplex-ideal-phy.cc:169
ns3::HalfDuplexIdealPhy::m_phyMacTxEndCallback
GenericPhyTxEndCallback m_phyMacTxEndCallback
Callback - Tx end.
Definition: half-duplex-ideal-phy.h:235
ns3::HalfDuplexIdealPhy::GetRxAntenna
Ptr< AntennaModel > GetRxAntenna() const
Get the AntennaModel used by the NetDevice for reception.
Definition: half-duplex-ideal-phy.cc:259
ns3::HalfDuplexIdealPhy::m_interference
SpectrumInterference m_interference
Received interference.
Definition: half-duplex-ideal-phy.h:240
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
ns3::HalfDuplexIdealPhy::StartRx
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Definition: half-duplex-ideal-phy.cc:341
ns3::HalfDuplexIdealPhy::SetTxPowerSpectralDensity
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
Set the Power Spectral Density of outgoing signals in power units (Watt, Pascal......
Definition: half-duplex-ideal-phy.cc:197
ns3::HalfDuplexIdealPhy::m_rxPsd
Ptr< const SpectrumValue > m_rxPsd
Rx power spectral density.
Definition: half-duplex-ideal-phy.h:221
ns3::HalfDuplexIdealPhy::m_netDevice
Ptr< NetDevice > m_netDevice
NetDevice connected to theis phy.
Definition: half-duplex-ideal-phy.h:217
ns3::HalfDuplexIdealPhy::GetRxSpectrumModel
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Definition: half-duplex-ideal-phy.cc:184
ns3::HalfDuplexIdealPhy::m_rxPacket
Ptr< Packet > m_rxPacket
Rx packet.
Definition: half-duplex-ideal-phy.h:223
ns3::HalfDuplexIdealPhy::m_endRxEventId
EventId m_endRxEventId
End Rx event.
Definition: half-duplex-ideal-phy.h:213
ns3::HalfDuplexIdealPhy::m_txPsd
Ptr< SpectrumValue > m_txPsd
Tx power spectral density.
Definition: half-duplex-ideal-phy.h:220
ns3::HalfDuplexIdealPhy::m_phyRxAbortTrace
TracedCallback< Ptr< const Packet > > m_phyRxAbortTrace
Trace - Rx abort.
Definition: half-duplex-ideal-phy.h:231
ns3::HalfDuplexIdealPhy::m_phyMacRxEndOkCallback
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback
Callback - Rx end.
Definition: half-duplex-ideal-phy.h:238
ns3::HalfDuplexIdealPhy::RX
@ RX
Receiving state.
Definition: half-duplex-ideal-phy.h:92
ns3::SpectrumPhy
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
ns3::HalfDuplexIdealPhy::TX
@ TX
Transmitting state.
Definition: half-duplex-ideal-phy.h:91
ns3::HalfDuplexIdealPhy::StartTx
bool StartTx(Ptr< Packet > p)
Start a transmission.
Definition: half-duplex-ideal-phy.cc:280
ns3::HalfDuplexIdealPhy::GetMobility
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
Definition: half-duplex-ideal-phy.cc:153
ns3::HalfDuplexIdealPhy::SetGenericPhyRxStartCallback
void SetGenericPhyRxStartCallback(GenericPhyRxStartCallback c)
Set the callback for the start of RX, as part of the interconnections between the PHY and the MAC.
Definition: half-duplex-ideal-phy.cc:236
ns3::HalfDuplexIdealPhy::SetDevice
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Definition: half-duplex-ideal-phy.cc:161
ns3::HalfDuplexIdealPhy::m_antenna
Ptr< AntennaModel > m_antenna
Antenna model.
Definition: half-duplex-ideal-phy.h:216
ns3::HalfDuplexIdealPhy::m_phyMacRxEndErrorCallback
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback
Callback - Rx error.
Definition: half-duplex-ideal-phy.h:237
ns3::HalfDuplexIdealPhy::SetNoisePowerSpectralDensity
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Set the Noise Power Spectral Density in power units (Watt, Pascal...) per Hz.
Definition: half-duplex-ideal-phy.cc:206
ns3::HalfDuplexIdealPhy::m_phyTxEndTrace
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
Trace - Tx end.
Definition: half-duplex-ideal-phy.h:229
ns3::HalfDuplexIdealPhy::HalfDuplexIdealPhy
HalfDuplexIdealPhy()
Definition: half-duplex-ideal-phy.cc:41
ns3::HalfDuplexIdealPhy::m_phyMacRxStartCallback
GenericPhyRxStartCallback m_phyMacRxStartCallback
Callback - Rx start.
Definition: half-duplex-ideal-phy.h:236
ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndOkCallback
void SetGenericPhyRxEndOkCallback(GenericPhyRxEndOkCallback c)
set the callback for the successful end of a RX, as part of the interconnections between the PHY and ...
Definition: half-duplex-ideal-phy.cc:252
ns3::HalfDuplexIdealPhy::State
State
PHY states.
Definition: half-duplex-ideal-phy.h:89
ns3::HalfDuplexIdealPhy::m_phyTxStartTrace
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
Trace - Tx start.
Definition: half-duplex-ideal-phy.h:228
ns3::HalfDuplexIdealPhy::GetRate
DataRate GetRate() const
Get the PHY rate to be used by this PHY.
Definition: half-duplex-ideal-phy.cc:221
ns3::HalfDuplexIdealPhy
This PHY layer implementation realizes an ideal OFDM PHY which transmits half-duplex (i....
Definition: half-duplex-ideal-phy.h:79
ns3::HalfDuplexIdealPhy::SetGenericPhyTxEndCallback
void SetGenericPhyTxEndCallback(GenericPhyTxEndCallback c)
Set the callback for the end of a TX, as part of the interconnections between the PHY and the MAC.
Definition: half-duplex-ideal-phy.cc:229
ns3::HalfDuplexIdealPhy::m_phyRxStartTrace
TracedCallback< Ptr< const Packet > > m_phyRxStartTrace
Trace - Rx start.
Definition: half-duplex-ideal-phy.h:230
ns3::HalfDuplexIdealPhy::SetRate
void SetRate(DataRate rate)
Set the PHY rate to be used by this PHY.
Definition: half-duplex-ideal-phy.cc:214
ns3::HalfDuplexIdealPhy::m_mobility
Ptr< MobilityModel > m_mobility
Mobility model.
Definition: half-duplex-ideal-phy.h:215
ns3::HalfDuplexIdealPhy::ChangeState
void ChangeState(State newState)
Change the PHY state.
Definition: half-duplex-ideal-phy.cc:273
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::HalfDuplexIdealPhy::SetAntenna
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
Definition: half-duplex-ideal-phy.cc:266
ns3::HalfDuplexIdealPhy::~HalfDuplexIdealPhy
virtual ~HalfDuplexIdealPhy()
Definition: half-duplex-ideal-phy.cc:52
ns3::HalfDuplexIdealPhy::AbortRx
void AbortRx()
About current Rx.
Definition: half-duplex-ideal-phy.cc:406
ns3::SpectrumInterference
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
Definition: spectrum-interference.h:47
ns3::HalfDuplexIdealPhy::m_channel
Ptr< SpectrumChannel > m_channel
Channel.
Definition: half-duplex-ideal-phy.h:218
ns3::HalfDuplexIdealPhy::m_txPacket
Ptr< Packet > m_txPacket
Tx packet.
Definition: half-duplex-ideal-phy.h:222
ns3::HalfDuplexIdealPhy::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: half-duplex-ideal-phy.cc:102
ns3::HalfDuplexIdealPhy::m_state
State m_state
PHY state.
Definition: half-duplex-ideal-phy.h:226
ns3::HalfDuplexIdealPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: half-duplex-ideal-phy.cc:57
ns3::HalfDuplexIdealPhy::GetDevice
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
Definition: half-duplex-ideal-phy.cc:145