22 #include "ns3/simulator.h"
23 #include "ns3/callback.h"
24 #include "ns3/nstime.h"
25 #include "ns3/event-id.h"
26 #include "ns3/assert.h"
27 #include "ns3/net-device.h"
29 #include "wimax-phy.h"
30 #include "simple-ofdm-wimax-phy.h"
31 #include "simple-ofdm-wimax-channel.h"
32 #include "ns3/mobility-model.h"
33 #include "ns3/cost231-propagation-loss-model.h"
34 #include "simple-ofdm-send-param.h"
42 SimpleOfdmWimaxChannel::SimpleOfdmWimaxChannel (
void)
47 SimpleOfdmWimaxChannel::~SimpleOfdmWimaxChannel (
void)
52 SimpleOfdmWimaxChannel::SimpleOfdmWimaxChannel (PropModel propModel)
56 case RANDOM_PROPAGATION:
57 m_loss = CreateObject<RandomPropagationLossModel> ();
60 case FRIIS_PROPAGATION:
61 m_loss = CreateObject<FriisPropagationLossModel> ();
63 case LOG_DISTANCE_PROPAGATION:
64 m_loss = CreateObject<LogDistancePropagationLossModel> ();
67 case COST231_PROPAGATION:
68 m_loss = CreateObject<Cost231PropagationLossModel> ();
83 case RANDOM_PROPAGATION:
84 m_loss = CreateObject<RandomPropagationLossModel> ();
87 case FRIIS_PROPAGATION:
88 m_loss = CreateObject<FriisPropagationLossModel> ();
90 case LOG_DISTANCE_PROPAGATION:
91 m_loss = CreateObject<LogDistancePropagationLossModel> ();
94 case COST231_PROPAGATION:
95 m_loss = CreateObject<Cost231PropagationLossModel> ();
108 m_phyList.push_back (o_phy);
112 SimpleOfdmWimaxChannel::DoGetNDevices (
void)
const
114 return m_phyList.size ();
118 SimpleOfdmWimaxChannel::DoGetDevice (uint32_t index)
const
121 for (std::list<Ptr<SimpleOfdmWimaxPhy> >::const_iterator iter = m_phyList.begin (); iter != m_phyList.end (); ++iter)
125 return (*iter)->GetDevice ();
141 WimaxPhy::ModulationType modulationType,
146 double rxPowerDbm = 0;
149 senderMobility = phy->GetDevice ()->GetNode ()->GetObject<
MobilityModel> ();
151 for (std::list<
Ptr<SimpleOfdmWimaxPhy> >::iterator iter = m_phyList.begin (); iter != m_phyList.end (); ++iter)
158 if (receiverMobility != 0 && senderMobility != 0 && m_loss != 0)
161 delay =
Seconds (distance/300000000.0);
162 rxPowerDbm = m_loss->
CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
174 if (dstNetDevice == 0)
176 dstNode = 0xffffffff;
184 &SimpleOfdmWimaxChannel::EndSendDummyBlock,
209 int64_t currentStream = stream;
210 typedef std::list<Ptr<SimpleOfdmWimaxPhy> > PhyList;
211 for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++)
214 currentStream += simpleOfdm->AssignStreams (currentStream);
216 return (currentStream - stream);
smart pointer class similar to boost::intrusive_ptr
double GetDistanceFrom(Ptr< const MobilityModel > position) const
int64_t AssignStreams(int64_t stream)
bool GetIsFirstBlock(void)
#define NS_LOG_COMPONENT_DEFINE(name)
#define NS_FATAL_ERROR(msg)
fatal error handling
Keep track of the current position and velocity of an object.
void Send(Time BlockTime, uint32_t burstSize, Ptr< WimaxPhy > phy, bool isFirstBlock, bool isLastBlock, uint64_t frequency, WimaxPhy::ModulationType modulationType, uint8_t direction, double txPowerDbm, Ptr< PacketBurst > burst)
Sends a dummy fec block to all connected physical devices.
WimaxPhy::ModulationType GetModulationType(void)
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
static void ScheduleWithContext(uint32_t context, Time const &time, MEM mem_ptr, OBJ obj)
double GetRxPowerDbm(void)
uint32_t GetBurstSize(void)
void SetPropagationModel(PropModel propModel)
sets the propagation model
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Network layer to device interface.
uint8_t GetDirection(void)
uint64_t GetFrequency(void)
Ptr< PacketBurst > GetBurst(void)
Ptr< T > GetObject(void) const