21 #include <ns3/object-factory.h>
24 #include <ns3/simulator.h>
25 #include <ns3/trace-source-accessor.h>
26 #include <ns3/packet-burst.h>
27 #include <ns3/callback.h>
28 #include <ns3/antenna-model.h>
100 .AddConstructor<HalfDuplexIdealPhy> ()
101 .AddAttribute (
"Rate",
102 "The PHY rate used by this device",
106 MakeDataRateChecker ())
107 .AddTraceSource (
"TxStart",
108 "Trace fired when a new transmission is started",
110 .AddTraceSource (
"TxEnd",
111 "Trace fired when a previosuly started transmission is finished",
113 .AddTraceSource (
"RxStart",
114 "Trace fired when the start of a signal is detected",
116 .AddTraceSource (
"RxAbort",
117 "Trace fired when a previously started RX is aborted before time",
119 .AddTraceSource (
"RxEndOk",
120 "Trace fired when a previosuly started RX terminates successfully",
122 .AddTraceSource (
"RxEndError",
123 "Trace fired when a previosuly started RX terminates with an error (packet is corrupted)",
175 return m_txPsd->GetSpectrumModel ();
286 txParams->duration = Seconds (txTimeSeconds);
287 txParams->txPhy = GetObject<SpectrumPhy> ();
292 NS_LOG_LOGIC (
this <<
" tx power: " << 10 * std::log10 (
Integral (*(txParams->psd))) + 30 <<
" dBm");
332 NS_LOG_LOGIC (
this <<
" rx power: " << 10 * std::log10 (
Integral (*(spectrumParams->psd))) + 30 <<
" dBm");
368 NS_LOG_LOGIC (
this <<
" calling m_phyMacRxStartCallback");
373 NS_LOG_LOGIC (
this <<
" m_phyMacRxStartCallback is NULL");
376 NS_LOG_LOGIC (
this <<
" scheduling EndRx with delay " << rxParams->duration);
422 NS_LOG_LOGIC (
this <<
" calling m_phyMacRxEndOkCallback");
427 NS_LOG_LOGIC (
this <<
" m_phyMacRxEndOkCallback is NULL");
435 NS_LOG_LOGIC (
this <<
" calling m_phyMacRxEndErrorCallback");
440 NS_LOG_LOGIC (
this <<
" m_phyMacRxEndErrorCallback is NULL");
void SetRate(DataRate rate)
void SetGenericPhyTxEndCallback(GenericPhyTxEndCallback c)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
Ptr< MobilityModel > m_mobility
double Integral(const SpectrumValue &arg)
bool StartTx(Ptr< Packet > p)
#define NS_ASSERT(condition)
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
void SetGenericPhyRxStartCallback(GenericPhyRxStartCallback c)
#define NS_LOG_COMPONENT_DEFINE(name)
SpectrumInterference m_interference
uint32_t GetSize(void) const
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback
virtual void DoDispose(void)
void AddSignal(Ptr< const SpectrumValue > spd, const Time duration)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Ptr< MobilityModel > GetMobility()
Ptr< const SpectrumValue > m_rxPsd
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
void StartRx(Ptr< SpectrumSignalParameters > params)
void StartRx(Ptr< const Packet > p, Ptr< const SpectrumValue > rxPsd)
TracedCallback< Ptr< const Packet > > m_phyRxStartTrace
TracedCallback< Ptr< const Packet > > m_phyRxAbortTrace
Class for representing data rates.
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
double CalculateTxTime(uint32_t bytes) const
Calculate transmission time.
void SetDevice(Ptr< NetDevice > d)
void SetAntenna(Ptr< AntennaModel > a)
Ptr< SpectrumValue > m_txPsd
void SetGenericPhyRxEndOkCallback(GenericPhyRxEndOkCallback c)
virtual ~HalfDuplexIdealPhy()
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback
virtual void DoDispose(void)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
Ptr< AntennaModel > GetRxAntenna()
Ptr< SpectrumChannel > m_channel
#define NS_LOG_LOGIC(msg)
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Ptr< NetDevice > GetDevice()
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
void ChangeState(State newState)
Ptr< NetDevice > m_netDevice
void SetGenericPhyRxEndErrorCallback(GenericPhyRxEndErrorCallback c)
Ptr< AntennaModel > m_antenna
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
hold objects of type ns3::DataRate
GenericPhyRxStartCallback m_phyMacRxStartCallback
static TypeId GetTypeId(void)
void SetChannel(Ptr< SpectrumChannel > c)
void SetErrorModel(Ptr< SpectrumErrorModel > e)
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
void SetMobility(Ptr< MobilityModel > m)
GenericPhyTxEndCallback m_phyMacTxEndCallback
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
a unique identifier for an interface.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
TypeId SetParent(TypeId tid)