1.1 --- a/.project Thu Oct 29 15:22:25 2009 +0100
1.2 +++ b/.project Tue Nov 10 14:36:17 2009 +0100
1.3 @@ -5,7 +5,74 @@
1.4 <projects>
1.5 </projects>
1.6 <buildSpec>
1.7 + <buildCommand>
1.8 + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
1.9 + <triggers>clean,full,incremental,</triggers>
1.10 + <arguments>
1.11 + <dictionary>
1.12 + <key>?name?</key>
1.13 + <value></value>
1.14 + </dictionary>
1.15 + <dictionary>
1.16 + <key>org.eclipse.cdt.make.core.append_environment</key>
1.17 + <value>true</value>
1.18 + </dictionary>
1.19 + <dictionary>
1.20 + <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
1.21 + <value>all</value>
1.22 + </dictionary>
1.23 + <dictionary>
1.24 + <key>org.eclipse.cdt.make.core.buildArguments</key>
1.25 + <value></value>
1.26 + </dictionary>
1.27 + <dictionary>
1.28 + <key>org.eclipse.cdt.make.core.buildCommand</key>
1.29 + <value>make</value>
1.30 + </dictionary>
1.31 + <dictionary>
1.32 + <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
1.33 + <value>clean</value>
1.34 + </dictionary>
1.35 + <dictionary>
1.36 + <key>org.eclipse.cdt.make.core.contents</key>
1.37 + <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
1.38 + </dictionary>
1.39 + <dictionary>
1.40 + <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
1.41 + <value>false</value>
1.42 + </dictionary>
1.43 + <dictionary>
1.44 + <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
1.45 + <value>true</value>
1.46 + </dictionary>
1.47 + <dictionary>
1.48 + <key>org.eclipse.cdt.make.core.enableFullBuild</key>
1.49 + <value>true</value>
1.50 + </dictionary>
1.51 + <dictionary>
1.52 + <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
1.53 + <value>all</value>
1.54 + </dictionary>
1.55 + <dictionary>
1.56 + <key>org.eclipse.cdt.make.core.stopOnError</key>
1.57 + <value>true</value>
1.58 + </dictionary>
1.59 + <dictionary>
1.60 + <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
1.61 + <value>true</value>
1.62 + </dictionary>
1.63 + </arguments>
1.64 + </buildCommand>
1.65 + <buildCommand>
1.66 + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
1.67 + <arguments>
1.68 + </arguments>
1.69 + </buildCommand>
1.70 </buildSpec>
1.71 <natures>
1.72 + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
1.73 + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
1.74 + <nature>org.eclipse.cdt.core.cnature</nature>
1.75 + <nature>org.eclipse.cdt.core.ccnature</nature>
1.76 </natures>
1.77 </projectDescription>
2.1 --- a/examples/wimax/wimax-ipv4.cc Thu Oct 29 15:22:25 2009 +0100
2.2 +++ b/examples/wimax/wimax-ipv4.cc Tue Nov 10 14:36:17 2009 +0100
2.3 @@ -64,8 +64,7 @@
2.4
2.5 using namespace ns3;
2.6
2.7 -int
2.8 -main (int argc, char *argv[])
2.9 +int main (int argc, char *argv[])
2.10 {
2.11 //default values
2.12 int nbSS = 6, duration = 10, nbBS = 1, schedType = 0;
2.13 @@ -94,6 +93,7 @@
2.14 }
2.15
2.16 #ifndef WIMAX_TEST
2.17 + //LogComponentEnableAll(LOG_LEVEL_INFO);
2.18 LogComponentEnable ("UdpClientApplication", LOG_LEVEL_INFO);
2.19 LogComponentEnable ("UdpServerApplication", LOG_LEVEL_INFO);
2.20 #endif
2.21 @@ -213,7 +213,7 @@
2.22 wimax.ClassifierConfig (ss[i + (nbSS / 2)], ss[i], bs[0],
2.23 SSinterfaces.GetAddress (i + (nbSS / 2)),
2.24 SSinterfaces.GetAddress (i), 0, 100 + (i * 10), 17,
2.25 - ServiceFlow::SFID_TYPE_RTPS);
2.26 + ServiceFlow::SFID_TYPE_BE);
2.27
2.28 }
2.29
3.1 --- a/src/applications/udp-client-server/udp-server.cc Thu Oct 29 15:22:25 2009 +0100
3.2 +++ b/src/applications/udp-client-server/udp-server.cc Tue Nov 10 14:36:17 2009 +0100
3.3 @@ -53,6 +53,7 @@
3.4 NS_LOG_FUNCTION_NOARGS ();
3.5 m_lost = 0;
3.6 m_lastSequenceNumber = ~((uint32_t) 0);
3.7 + m_received=0;
3.8 }
3.9
3.10 UdpServer::~UdpServer ()
4.1 --- a/src/devices/wimax/bandwidth-manager.cc Thu Oct 29 15:22:25 2009 +0100
4.2 +++ b/src/devices/wimax/bandwidth-manager.cc Tue Nov 10 14:36:17 2009 +0100
4.3 @@ -33,7 +33,8 @@
4.4
4.5 NS_LOG_COMPONENT_DEFINE ("BandwidthManager");
4.6
4.7 -namespace ns3 {
4.8 +namespace ns3
4.9 +{
4.10
4.11 BandwidthManager::BandwidthManager (Ptr<WimaxNetDevice> device) :
4.12 m_device (device), m_nrBwReqsSent (0)
4.13 @@ -45,8 +46,7 @@
4.14 m_device = 0;
4.15 }
4.16
4.17 -uint32_t
4.18 -BandwidthManager::CalculateAllocationSize (const SSRecord *ssRecord,
4.19 +uint32_t BandwidthManager::CalculateAllocationSize (const SSRecord *ssRecord,
4.20 const ServiceFlow *serviceFlow)
4.21 {
4.22 Time currentTime = Simulator::Now ();
4.23 @@ -142,8 +142,8 @@
4.24 return serviceFlow;
4.25 }
4.26
4.27 -void
4.28 -BandwidthManager::SendBandwidthRequest (uint8_t uiuc, uint16_t allocationSize)
4.29 +void BandwidthManager::SendBandwidthRequest (uint8_t uiuc,
4.30 + uint16_t allocationSize)
4.31 {
4.32 Ptr<WimaxSubscriberStationNetDevice> ss = m_device->GetObject<
4.33 WimaxSubscriberStationNetDevice> ();
4.34 @@ -186,8 +186,7 @@
4.35
4.36 }
4.37
4.38 -void
4.39 -BandwidthManager::ProcessBandwidthRequest (
4.40 +void BandwidthManager::ProcessBandwidthRequest (
4.41 const BandwidthRequestHeader &bwRequestHdr)
4.42 {
4.43 Ptr<WimaxBaseStationNetDevice> bs = m_device->GetObject<
4.44 @@ -200,8 +199,7 @@
4.45 {
4.46 serviceFlow->GetRecord ()->UpdateRequestedBandwidth (
4.47 bwRequestHdr.GetBr ());
4.48 - }
4.49 - else
4.50 + } else
4.51 {
4.52 serviceFlow->GetRecord ()->SetRequestedBandwidth (bwRequestHdr.GetBr ());
4.53 }
4.54 @@ -210,12 +208,11 @@
4.55
4.56 // update backlogged
4.57 serviceFlow->GetRecord ()->IncreaseBacklogged (bwRequestHdr.GetBr ());
4.58 - std::cout << "\tGP_DEBUG: ProcessBandwidthRequest\n\t\ttGetBr() = "
4.59 - << bwRequestHdr.GetBr() << std::endl;
4.60 + NS_LOG_DEBUG ("\tProcessBandwidthRequest\n\t\ttGetBr() = "
4.61 + << bwRequestHdr.GetBr () << std::endl);
4.62 }
4.63
4.64 -void
4.65 -BandwidthManager::SetSubframeRatio (void)
4.66 +void BandwidthManager::SetSubframeRatio (void)
4.67 {
4.68 //sets ratio of the DL and UL subframes
4.69
4.70 @@ -224,13 +221,12 @@
4.71
4.72 uint32_t symbolsPerFrame = bs->GetPhy ()->GetSymbolsPerFrame ();
4.73
4.74 - /*XXX, temporarily divided in half (360 symbols each), shall actually be determined based on UL and DL traffic*/
4.75 + /* temporarily divided in half (360 symbols each), shall actually be determined based on UL and DL traffic*/
4.76 bs->SetNrDlSymbols (symbolsPerFrame / 2);
4.77 bs->SetNrUlSymbols (symbolsPerFrame / 2);
4.78 }
4.79
4.80 -uint32_t
4.81 -BandwidthManager::GetSymbolsPerFrameAllocated (void)
4.82 +uint32_t BandwidthManager::GetSymbolsPerFrameAllocated (void)
4.83 {
4.84 Ptr<WimaxBaseStationNetDevice> bs = m_device->GetObject<
4.85 WimaxBaseStationNetDevice> ();
5.1 --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Oct 29 15:22:25 2009 +0100
5.2 +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc Tue Nov 10 14:36:17 2009 +0100
5.3 @@ -33,12 +33,12 @@
5.4 #include <math.h>
5.5 NS_LOG_COMPONENT_DEFINE ("SimpleOfdmWimaxPhy");
5.6
5.7 -namespace ns3 {
5.8 +namespace ns3
5.9 +{
5.10
5.11 NS_OBJECT_ENSURE_REGISTERED ( SimpleOfdmWimaxPhy);
5.12
5.13 -TypeId
5.14 -SimpleOfdmWimaxPhy::GetTypeId (void)
5.15 +TypeId SimpleOfdmWimaxPhy::GetTypeId (void)
5.16 {
5.17 static TypeId
5.18 tid =
5.19 @@ -91,57 +91,46 @@
5.20
5.21 }
5.22
5.23 -
5.24 -void
5.25 -SimpleOfdmWimaxPhy::ActivateLoss (bool loss)
5.26 +void SimpleOfdmWimaxPhy::ActivateLoss (bool loss)
5.27 {
5.28 m_snrToBlockErrorRateManager->ActivateLoss (loss);
5.29 }
5.30
5.31 -void
5.32 -SimpleOfdmWimaxPhy::SetSNRToBlockErrorRateTracesPath (char * tracesPath)
5.33 +void SimpleOfdmWimaxPhy::SetSNRToBlockErrorRateTracesPath (char * tracesPath)
5.34 {
5.35 m_snrToBlockErrorRateManager->SetTraceFilePath (tracesPath);
5.36 m_snrToBlockErrorRateManager->ReLoadTraces ();
5.37 }
5.38
5.39 -double
5.40 -SimpleOfdmWimaxPhy::GetBandwidth (void)
5.41 +double SimpleOfdmWimaxPhy::GetBandwidth (void)
5.42 {
5.43 return m_bandWidth;
5.44 }
5.45
5.46 -void
5.47 -SimpleOfdmWimaxPhy::SetBandwidth (double BW)
5.48 +void SimpleOfdmWimaxPhy::SetBandwidth (double BW)
5.49 {
5.50 m_bandWidth = BW;
5.51 }
5.52
5.53 -double
5.54 -SimpleOfdmWimaxPhy::GetTxPower (void)
5.55 +double SimpleOfdmWimaxPhy::GetTxPower (void)
5.56 {
5.57 return m_txPower;
5.58 }
5.59 -void
5.60 -SimpleOfdmWimaxPhy::SetTxPower (double txPower)
5.61 +void SimpleOfdmWimaxPhy::SetTxPower (double txPower)
5.62 {
5.63 m_txPower = txPower;
5.64 }
5.65
5.66 -double
5.67 -SimpleOfdmWimaxPhy::GetNoiseFigure (void)
5.68 +double SimpleOfdmWimaxPhy::GetNoiseFigure (void)
5.69 {
5.70 return m_noiseFigure;
5.71 }
5.72 -void
5.73 -SimpleOfdmWimaxPhy::SetNoiseFigure (double noiseFigure)
5.74 +void SimpleOfdmWimaxPhy::SetNoiseFigure (double noiseFigure)
5.75 {
5.76 m_noiseFigure = noiseFigure;
5.77 }
5.78
5.79 -
5.80 -void
5.81 -SimpleOfdmWimaxPhy::DoDispose (void)
5.82 +void SimpleOfdmWimaxPhy::DoDispose (void)
5.83 {
5.84 delete m_receivedFecBlocks;
5.85 delete m_fecBlocks;
5.86 @@ -151,14 +140,12 @@
5.87 WimaxPhy::DoDispose ();
5.88 }
5.89
5.90 -void
5.91 -SimpleOfdmWimaxPhy::DoAttach (Ptr<WimaxChannel> channel)
5.92 +void SimpleOfdmWimaxPhy::DoAttach (Ptr<WimaxChannel> channel)
5.93 {
5.94 GetChannel ()->Attach (this);
5.95 }
5.96
5.97 -void
5.98 -SimpleOfdmWimaxPhy::Send (SendParams *params)
5.99 +void SimpleOfdmWimaxPhy::Send (SendParams *params)
5.100 {
5.101 OfdmSendParams *o_params = dynamic_cast<OfdmSendParams*> (params);
5.102 Send (o_params->GetBurst (),
5.103 @@ -166,14 +153,12 @@
5.104 o_params->GetDirection (), o_params->GetSymbolIndex ());
5.105 }
5.106
5.107 -WimaxPhy::PhyType
5.108 -SimpleOfdmWimaxPhy::GetPhyType (void) const
5.109 +WimaxPhy::PhyType SimpleOfdmWimaxPhy::GetPhyType (void) const
5.110 {
5.111 return WimaxPhy::simpleOfdmWimaxPhy;
5.112 }
5.113
5.114 -void
5.115 -SimpleOfdmWimaxPhy::Send (Ptr<PacketBurst> burst,
5.116 +void SimpleOfdmWimaxPhy::Send (Ptr<PacketBurst> burst,
5.117 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.118 uint32_t symbolIndex)
5.119 {
5.120 @@ -193,9 +178,7 @@
5.121 StartSendFecBlock (true, modulationType, direction, symbolIndex);
5.122 }
5.123
5.124 -
5.125 -void
5.126 -SimpleOfdmWimaxPhy::StartSendFecBlock (bool isFirstBlock,
5.127 +void SimpleOfdmWimaxPhy::StartSendFecBlock (bool isFirstBlock,
5.128 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.129 uint32_t symbolIndex)
5.130 {
5.131 @@ -210,13 +193,14 @@
5.132 SimpleOfdmWimaxChannel *channel =
5.133 dynamic_cast<SimpleOfdmWimaxChannel*> (PeekPointer (GetChannel ()));
5.134
5.135 - channel->Send (m_blockTime, fecBlock, m_burstCopy->Copy (), this, isFirstBlock,
5.136 - GetTxFrequency (), modulationType, direction, symbolIndex, m_txPower);
5.137 + channel->Send (m_blockTime, fecBlock, m_burstCopy->Copy (), this,
5.138 + isFirstBlock, GetTxFrequency (), modulationType, direction, symbolIndex,
5.139 + m_txPower);
5.140 }
5.141
5.142 -void
5.143 -SimpleOfdmWimaxPhy::EndSendFecBlock (WimaxPhy::ModulationType modulationType,
5.144 - uint8_t direction, uint32_t symbolIndex)
5.145 +void SimpleOfdmWimaxPhy::EndSendFecBlock (
5.146 + WimaxPhy::ModulationType modulationType, uint8_t direction,
5.147 + uint32_t symbolIndex)
5.148 {
5.149 m_nrFecBlocksSent++;
5.150
5.151 @@ -227,28 +211,26 @@
5.152 NS_ASSERT_MSG (m_fecBlocks->size () == 0,
5.153 "Error while sending a fec block: size of the fec bloc !=0");
5.154 Simulator::Schedule (Seconds (0), &SimpleOfdmWimaxPhy::EndSend, this);
5.155 - }
5.156 - else
5.157 + } else
5.158 {
5.159 Simulator::Schedule (Seconds (0), &SimpleOfdmWimaxPhy::StartSendFecBlock,
5.160 this, false, modulationType, direction, symbolIndex);
5.161 }
5.162 }
5.163
5.164 -void
5.165 -SimpleOfdmWimaxPhy::EndSend (void)
5.166 +void SimpleOfdmWimaxPhy::EndSend (void)
5.167 {
5.168 SetState (PHY_STATE_IDLE);
5.169 }
5.170
5.171 -void
5.172 -SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock,
5.173 +void SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock,
5.174 bool isFirstBlock, uint64_t frequency,
5.175 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.176 uint32_t symbolIndex)
5.177 {
5.178 double distance = 10; //double distance = CalculateDistance (position, m_node->GetPosition ());
5.179
5.180 +
5.181 switch (GetState ())
5.182 {
5.183 case PHY_STATE_SCANNING:
5.184 @@ -294,14 +276,12 @@
5.185 }
5.186 }
5.187
5.188 -void
5.189 -SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock,
5.190 - Ptr<PacketBurst> burst, bool isFirstBlock, uint64_t frequency,
5.191 +void SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock, Ptr<
5.192 + PacketBurst> burst, bool isFirstBlock, uint64_t frequency,
5.193 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.194 uint32_t symbolIndex)
5.195 {
5.196 double distance = 10; //double distance = CalculateDistance (position, m_node->GetPosition ());
5.197 -
5.198 switch (GetState ())
5.199 {
5.200 case PHY_STATE_SCANNING:
5.201 @@ -345,9 +325,8 @@
5.202 }
5.203 }
5.204
5.205 -void
5.206 -SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock,
5.207 - Ptr<PacketBurst> burst, bool isFirstBlock, uint64_t frequency,
5.208 +void SimpleOfdmWimaxPhy::StartReceive (const itpp::bvec &fecBlock, Ptr<
5.209 + PacketBurst> burst, bool isFirstBlock, uint64_t frequency,
5.210 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.211 uint32_t symbolIndex, double rxPower)
5.212 {
5.213 @@ -391,12 +370,11 @@
5.214 drop = 0;
5.215 }
5.216 delete record;
5.217 -#ifdef DEBUG_WIMAX_PHY
5.218 +
5.219 NS_LOG_INFO ("AI_TEST:PHY: Receive rxPower=" << rxPower << ", Nwb=" << Nwb
5.220 << ", SNR=" << SNR << ", Modulation=" << modulationType
5.221 - << ", BlocErrorRate=" << blockErrorRate << ", drop=" << (int)drop
5.222 - << std::endl;
5.223 -#endif
5.224 + << ", BlocErrorRate=" << blockErrorRate << ", drop=" << (int) drop
5.225 + << std::endl);
5.226
5.227 switch (GetState ())
5.228 {
5.229 @@ -421,7 +399,7 @@
5.230 SetBlockParameters (burst, modulationType);
5.231 m_blockTime = GetBlockTransmissionTime (modulationType);
5.232 }
5.233 - Simulator::Schedule (Seconds(0),
5.234 + Simulator::Schedule (Seconds (0),
5.235 &SimpleOfdmWimaxPhy::EndReceiveFecBlock3, this, fecBlock, burst,
5.236 modulationType, direction, drop);
5.237
5.238 @@ -439,8 +417,7 @@
5.239 }
5.240 }
5.241
5.242 -void
5.243 -SimpleOfdmWimaxPhy::EndReceiveFecBlock2 (itpp::bvec fecBlock,
5.244 +void SimpleOfdmWimaxPhy::EndReceiveFecBlock2 (itpp::bvec fecBlock,
5.245 WimaxPhy::ModulationType modulationType, uint8_t direction,
5.246 uint32_t symbolIndex)
5.247 {
5.248 @@ -462,9 +439,8 @@
5.249 }
5.250 }
5.251
5.252 -void
5.253 -SimpleOfdmWimaxPhy::EndReceiveFecBlock3 (itpp::bvec fecBlock,
5.254 - Ptr<PacketBurst> burst, WimaxPhy::ModulationType modulationType,
5.255 +void SimpleOfdmWimaxPhy::EndReceiveFecBlock3 (itpp::bvec fecBlock, Ptr<
5.256 + PacketBurst> burst, WimaxPhy::ModulationType modulationType,
5.257 uint8_t direction, uint8_t drop)
5.258 {
5.259 NS_ASSERT_MSG ((uint32_t) fecBlock.size ()
5.260 @@ -494,16 +470,14 @@
5.261 }
5.262 }
5.263
5.264 -void
5.265 -SimpleOfdmWimaxPhy::EndReceive (Ptr<const PacketBurst> burst)
5.266 +void SimpleOfdmWimaxPhy::EndReceive (Ptr<const PacketBurst> burst)
5.267 {
5.268 Ptr<PacketBurst> b = burst->Copy ();
5.269 m_traceRx (burst);
5.270 GetReceiveCallback () (b);
5.271 }
5.272
5.273 -itpp::bvec
5.274 -SimpleOfdmWimaxPhy::ConvertBurstToBits (Ptr<const PacketBurst> burst)
5.275 +itpp::bvec SimpleOfdmWimaxPhy::ConvertBurstToBits (Ptr<const PacketBurst> burst)
5.276 {
5.277 itpp::bvec buffer (burst->GetSize () * 8);
5.278 buffer.zeros ();
5.279 @@ -542,8 +516,7 @@
5.280 Function could also be named DeserializeBurst because actually it
5.281 copying to the burst's byte buffer.
5.282 */
5.283 -Ptr<PacketBurst>
5.284 -SimpleOfdmWimaxPhy::ConvertBitsToBurst (itpp::bvec buffer)
5.285 +Ptr<PacketBurst> SimpleOfdmWimaxPhy::ConvertBitsToBurst (itpp::bvec buffer)
5.286 {
5.287 uint8_t init[buffer.size () / 8];
5.288 uint8_t *pstart = init;
5.289 @@ -557,7 +530,7 @@
5.290 for (int l = 0; l < 8; l++)
5.291 {
5.292 bool bin = buffer.get (i + l);
5.293 - temp |= (bin << (7-l));
5.294 + temp |= (bin << (7 - l));
5.295 }
5.296
5.297 *(pstart + j) = temp;
5.298 @@ -576,8 +549,7 @@
5.299 return m_burstCopy;
5.300 }
5.301
5.302 -Ptr<PacketBurst>
5.303 -SimpleOfdmWimaxPhy::ConvertBitsToBurst (itpp::bvec buffer,
5.304 +Ptr<PacketBurst> SimpleOfdmWimaxPhy::ConvertBitsToBurst (itpp::bvec buffer,
5.305 Ptr<PacketBurst> burst)
5.306 {
5.307 uint8_t init[buffer.size () / 8];
5.308 @@ -588,7 +560,6 @@
5.309 for (int32_t i = 0; i < buffer.size (); i += 8)
5.310 {
5.311
5.312 -
5.313 temp = 0;
5.314 for (int l = 0; l < 8; l++)
5.315 {
5.316 @@ -612,8 +583,7 @@
5.317 return burst;
5.318 }
5.319
5.320 -void
5.321 -SimpleOfdmWimaxPhy::CreateFecBlocks (const itpp::bvec &buffer,
5.322 +void SimpleOfdmWimaxPhy::CreateFecBlocks (const itpp::bvec &buffer,
5.323 WimaxPhy::ModulationType modulationType)
5.324 {
5.325
5.326 @@ -636,8 +606,8 @@
5.327 The recreated buffer contains padding bits or not is determined using the copy of original burst stored. Shall
5.328 actually be determined using the burst size information from DL-MAP/UL-MAP.
5.329 */
5.330 -itpp::bvec
5.331 -SimpleOfdmWimaxPhy::RecreateBuffer (WimaxPhy::ModulationType modulationType)
5.332 +itpp::bvec SimpleOfdmWimaxPhy::RecreateBuffer (
5.333 + WimaxPhy::ModulationType modulationType)
5.334 {
5.335
5.336 itpp::bvec buffer (m_blockSize * m_nrBlocks);
5.337 @@ -660,9 +630,8 @@
5.338 return buffer;
5.339 }
5.340
5.341 -itpp::bvec
5.342 -SimpleOfdmWimaxPhy::RecreateBuffer (WimaxPhy::ModulationType modulationType,
5.343 - Ptr<PacketBurst> burst)
5.344 +itpp::bvec SimpleOfdmWimaxPhy::RecreateBuffer (
5.345 + WimaxPhy::ModulationType modulationType, Ptr<PacketBurst> burst)
5.346 {
5.347
5.348 itpp::bvec buffer (m_blockSize * m_nrBlocks);
5.349 @@ -685,8 +654,7 @@
5.350 return buffer;
5.351 }
5.352
5.353 -void
5.354 -SimpleOfdmWimaxPhy::DoSetDataRates (void)
5.355 +void SimpleOfdmWimaxPhy::DoSetDataRates (void)
5.356 {
5.357 m_dataRateBpsk12 = CalculateDataRate (MODULATION_TYPE_BPSK_12); //6912000 bps
5.358 m_dataRateQpsk12 = CalculateDataRate (MODULATION_TYPE_QPSK_12); //13824000
5.359 @@ -697,8 +665,7 @@
5.360 m_dataRateQam64_34 = CalculateDataRate (MODULATION_TYPE_QAM64_34); //62208000
5.361 }
5.362
5.363 -void
5.364 -SimpleOfdmWimaxPhy::GetModulationFecParams (
5.365 +void SimpleOfdmWimaxPhy::GetModulationFecParams (
5.366 WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol,
5.367 double &fecCode) const
5.368 {
5.369 @@ -735,8 +702,8 @@
5.370 }
5.371 }
5.372
5.373 -uint32_t
5.374 -SimpleOfdmWimaxPhy::CalculateDataRate (WimaxPhy::ModulationType modulationType) const
5.375 +uint32_t SimpleOfdmWimaxPhy::CalculateDataRate (
5.376 + WimaxPhy::ModulationType modulationType) const
5.377 {
5.378 uint8_t bitsPerSymbol = 0;
5.379 double fecCode = 0;
5.380 @@ -749,8 +716,8 @@
5.381 return (uint32_t) symbolsPerSecond * bitsTransmittedPerSymbol;
5.382 }
5.383
5.384 -uint32_t
5.385 -SimpleOfdmWimaxPhy::DoGetDataRate (WimaxPhy::ModulationType modulationType) const
5.386 +uint32_t SimpleOfdmWimaxPhy::DoGetDataRate (
5.387 + WimaxPhy::ModulationType modulationType) const
5.388 {
5.389 switch (modulationType)
5.390 {
5.391 @@ -789,15 +756,14 @@
5.392 Note: first parameter could have been burst size if there was no problem of
5.393 overloading (there is some problem when calls to overloaded functions are scheduled)
5.394 */
5.395 -Time
5.396 -SimpleOfdmWimaxPhy::GetBlockTransmissionTime (
5.397 +Time SimpleOfdmWimaxPhy::GetBlockTransmissionTime (
5.398 WimaxPhy::ModulationType modulationType) const
5.399 {
5.400 - return Seconds ((double) GetFecBlockSize (modulationType) / DoGetDataRate (modulationType));
5.401 + return Seconds ((double) GetFecBlockSize (modulationType) / DoGetDataRate (
5.402 + modulationType));
5.403 }
5.404
5.405 -Time
5.406 -SimpleOfdmWimaxPhy::DoGetTransmissionTime (uint32_t size,
5.407 +Time SimpleOfdmWimaxPhy::DoGetTransmissionTime (uint32_t size,
5.408 WimaxPhy::ModulationType modulationType) const
5.409 {
5.410 /*adding one extra femto second to cope with the loss of precision problem.
5.411 @@ -807,29 +773,27 @@
5.412 * GetSymbolDuration ().GetSeconds ()) + FemtoSeconds (1);
5.413 }
5.414
5.415 -uint64_t
5.416 -SimpleOfdmWimaxPhy::DoGetNrSymbols (uint32_t size,
5.417 +uint64_t SimpleOfdmWimaxPhy::DoGetNrSymbols (uint32_t size,
5.418 WimaxPhy::ModulationType modulationType) const
5.419 {
5.420 Time transmissionTime = Seconds ((double) (GetNrBlocks (size, modulationType)
5.421 - * GetFecBlockSize(modulationType)) / DoGetDataRate (modulationType));
5.422 + * GetFecBlockSize (modulationType)) / DoGetDataRate (modulationType));
5.423 return (uint64_t) ceil (transmissionTime.GetSeconds ()
5.424 / GetSymbolDuration ().GetSeconds ());
5.425 }
5.426 //Add by G. Piro
5.427 -uint64_t
5.428 -SimpleOfdmWimaxPhy::DoGetNrBytes (uint32_t symbols,
5.429 +uint64_t SimpleOfdmWimaxPhy::DoGetNrBytes (uint32_t symbols,
5.430 WimaxPhy::ModulationType modulationType) const
5.431 {
5.432 Time transmissionTime =
5.433 Seconds (symbols * GetSymbolDuration ().GetSeconds ());
5.434 return (uint64_t) floor ((transmissionTime.GetSeconds () * DoGetDataRate (
5.435 - modulationType))/ 8);
5.436 + modulationType)) / 8);
5.437 }
5.438
5.439 //Channel coding block size, Table 215, page 434
5.440 -uint32_t
5.441 -SimpleOfdmWimaxPhy::GetFecBlockSize (WimaxPhy::ModulationType modulationType) const
5.442 +uint32_t SimpleOfdmWimaxPhy::GetFecBlockSize (
5.443 + WimaxPhy::ModulationType modulationType) const
5.444 {
5.445 uint32_t blockSize = 0;
5.446 switch (modulationType)
5.447 @@ -862,10 +826,9 @@
5.448 return blockSize * 8; //in bits
5.449 }
5.450
5.451 -
5.452 //Channel coding block size, Table 215, page 434
5.453 -uint32_t
5.454 -SimpleOfdmWimaxPhy::GetCodedFecBlockSize (WimaxPhy::ModulationType modulationType) const
5.455 +uint32_t SimpleOfdmWimaxPhy::GetCodedFecBlockSize (
5.456 + WimaxPhy::ModulationType modulationType) const
5.457 {
5.458 uint32_t blockSize = 0;
5.459 switch (modulationType)
5.460 @@ -898,9 +861,7 @@
5.461 return blockSize * 8; //in bits
5.462 }
5.463
5.464 -
5.465 -void
5.466 -SimpleOfdmWimaxPhy::SetBlockParameters (Ptr<const PacketBurst> burst,
5.467 +void SimpleOfdmWimaxPhy::SetBlockParameters (Ptr<const PacketBurst> burst,
5.468 WimaxPhy::ModulationType modulationType)
5.469 {
5.470 m_blockSize = GetFecBlockSize (modulationType);
5.471 @@ -910,8 +871,7 @@
5.472 NS_ASSERT_MSG (m_paddingBits >= 0, "Size of padding bytes < 0");
5.473 }
5.474
5.475 -void
5.476 -SimpleOfdmWimaxPhy::SetBlockParameters (uint32_t size,
5.477 +void SimpleOfdmWimaxPhy::SetBlockParameters (uint32_t size,
5.478 WimaxPhy::ModulationType modulationType)
5.479 {
5.480 m_blockSize = GetFecBlockSize (modulationType);
5.481 @@ -921,49 +881,40 @@
5.482 NS_ASSERT_MSG (m_paddingBits >= 0, "Size of padding bytes < 0");
5.483 }
5.484
5.485 -uint16_t
5.486 -SimpleOfdmWimaxPhy::DoGetTtg (void) const
5.487 +uint16_t SimpleOfdmWimaxPhy::DoGetTtg (void) const
5.488 {
5.489 //assumed equal to 2 symbols, see Question 134
5.490 return 2 * GetPsPerSymbol ();
5.491 }
5.492
5.493 -uint16_t
5.494 -SimpleOfdmWimaxPhy::DoGetRtg (void) const
5.495 +uint16_t SimpleOfdmWimaxPhy::DoGetRtg (void) const
5.496 {
5.497 //assumed equal to 2 symbols, see Question 134
5.498 return 2 * GetPsPerSymbol ();
5.499 }
5.500
5.501 -uint8_t
5.502 -SimpleOfdmWimaxPhy::DoGetFrameDurationCode (void) const
5.503 +uint8_t SimpleOfdmWimaxPhy::DoGetFrameDurationCode (void) const
5.504 {
5.505 - double duration = GetFrameDuration ().GetMilliSeconds (); //to milliseconds
5.506 + double duration = GetFrameDuration ().GetSeconds () * 1000; //to milliseconds
5.507 if (duration == 2.5)
5.508 {
5.509 return FRAME_DURATION_2_POINT_5_MS;
5.510 - }
5.511 - else if (duration == 4)
5.512 + } else if (duration == 4)
5.513 {
5.514 return FRAME_DURATION_4_MS;
5.515 - }
5.516 - else if (duration == 5)
5.517 + } else if (duration == 5)
5.518 {
5.519 return FRAME_DURATION_5_MS;
5.520 - }
5.521 - else if (duration == 8)
5.522 + } else if (duration == 8)
5.523 {
5.524 return FRAME_DURATION_8_MS;
5.525 - }
5.526 - else if (duration == 10)
5.527 + } else if (duration == 10)
5.528 {
5.529 return FRAME_DURATION_10_MS;
5.530 - }
5.531 - else if (duration == 12.5)
5.532 + } else if (duration == 12.5)
5.533 {
5.534 return FRAME_DURATION_12_POINT_5_MS;
5.535 - }
5.536 - else if (duration == 20)
5.537 + } else if (duration == 20)
5.538 {
5.539 return FRAME_DURATION_20_MS;
5.540 }
5.541 @@ -972,8 +923,7 @@
5.542 return 0;
5.543 }
5.544
5.545 -Time
5.546 -SimpleOfdmWimaxPhy::DoGetFrameDuration (uint8_t frameDurationCode) const
5.547 +Time SimpleOfdmWimaxPhy::DoGetFrameDuration (uint8_t frameDurationCode) const
5.548 {
5.549 switch (frameDurationCode)
5.550 {
5.551 @@ -1008,8 +958,7 @@
5.552 Retruns number of blocks (FEC blocks) the burst will be splitted in.
5.553 The size of the block is specific for each modulation type.
5.554 */
5.555 -uint16_t
5.556 -SimpleOfdmWimaxPhy::GetNrBlocks (uint32_t burstSize,
5.557 +uint16_t SimpleOfdmWimaxPhy::GetNrBlocks (uint32_t burstSize,
5.558 WimaxPhy::ModulationType modulationType) const
5.559 {
5.560 uint32_t blockSize = GetFecBlockSize (modulationType);
5.561 @@ -1021,8 +970,7 @@
5.562 return nrBlocks;
5.563 }
5.564
5.565 -void
5.566 -SimpleOfdmWimaxPhy::PrintBurstBuffer (Ptr<const PacketBurst> burst) const
5.567 +void SimpleOfdmWimaxPhy::PrintBurstBuffer (Ptr<const PacketBurst> burst) const
5.568 {
5.569 uint8_t *pstart = 0;
5.570 std::list<Ptr<Packet> > packets = burst->GetPackets ();
5.571 @@ -1040,12 +988,10 @@
5.572
5.573 /*---------------------PHY parameters functions-----------------------*/
5.574
5.575 -void
5.576 -SimpleOfdmWimaxPhy::DoSetPhyParameters (void)
5.577 +void SimpleOfdmWimaxPhy::DoSetPhyParameters (void)
5.578 {
5.579 SetNrCarriers (192);
5.580
5.581 - //320 as in Fabio's OFDM PHY, found no reference/verification in the specification
5.582 m_fecBlockSize = 320;
5.583
5.584 /*Calculations as per section 8.3.2.
5.585 @@ -1076,14 +1022,12 @@
5.586 SetSymbolsPerFrame (symbolsPerFrame);
5.587 }
5.588
5.589 -uint16_t
5.590 -SimpleOfdmWimaxPhy::DoGetNfft (void) const
5.591 +uint16_t SimpleOfdmWimaxPhy::DoGetNfft (void) const
5.592 {
5.593 return 256; //Nfft, see pages 429 and 812
5.594 }
5.595
5.596 -double
5.597 -SimpleOfdmWimaxPhy::DoGetSamplingFactor (void) const
5.598 +double SimpleOfdmWimaxPhy::DoGetSamplingFactor (void) const
5.599 {
5.600 //sampling factor (n), see Table 213, page 429
5.601
5.602 @@ -1092,24 +1036,19 @@
5.603 if (channelBandwidth % 1750000 == 0)
5.604 {
5.605 return (double) 8 / 7;
5.606 - }
5.607 - else if (channelBandwidth % 1500000 == 0)
5.608 + } else if (channelBandwidth % 1500000 == 0)
5.609 {
5.610 return (double) 86 / 75;
5.611 - }
5.612 - else if (channelBandwidth % 1250000 == 0)
5.613 + } else if (channelBandwidth % 1250000 == 0)
5.614 {
5.615 return (double) 144 / 125;
5.616 - }
5.617 - else if (channelBandwidth % 2750000 == 0)
5.618 + } else if (channelBandwidth % 2750000 == 0)
5.619 {
5.620 return (double) 316 / 275;
5.621 - }
5.622 - else if (channelBandwidth % 2000000 == 0)
5.623 + } else if (channelBandwidth % 2000000 == 0)
5.624 {
5.625 return (double) 57 / 50;
5.626 - }
5.627 - else
5.628 + } else
5.629 {
5.630 NS_LOG_DEBUG ("Oops may be wrong channel bandwidth for OFDM PHY!");
5.631 NS_FATAL_ERROR ("wrong channel bandwidth for OFDM PHY");
5.632 @@ -1118,16 +1057,14 @@
5.633 return (double) 8 / 7;
5.634 }
5.635
5.636 -double
5.637 -SimpleOfdmWimaxPhy::DoGetSamplingFrequency (void) const
5.638 +double SimpleOfdmWimaxPhy::DoGetSamplingFrequency (void) const
5.639 {
5.640 //sampling frequency (Fs), see 8.3.2.2
5.641
5.642 return (DoGetSamplingFactor () * GetChannelBandwidth () / 8000) * 8000;
5.643 }
5.644
5.645 -double
5.646 -SimpleOfdmWimaxPhy::DoGetGValue (void) const
5.647 +double SimpleOfdmWimaxPhy::DoGetGValue (void) const
5.648 {
5.649 //G, see 8.3.2.1 and Table 213, page 429
5.650 //taking highest of the four values, may be user shall be allowed to specify
6.1 --- a/src/devices/wimax/simple-ofdm-wimax-phy.h Thu Oct 29 15:22:25 2009 +0100
6.2 +++ b/src/devices/wimax/simple-ofdm-wimax-phy.h Tue Nov 10 14:36:17 2009 +0100
6.3 @@ -1,4 +1,4 @@
6.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6.5 + /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6.6 /*
6.7 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
6.8 *
7.1 --- a/src/devices/wimax/simple-wimax-channel.cc Thu Oct 29 15:22:25 2009 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,85 +0,0 @@
7.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
7.5 -/*
7.6 - * Copyright (c) 2007,2008 INRIA
7.7 - *
7.8 - * This program is free software; you can redistribute it and/or modify
7.9 - * it under the terms of the GNU General Public License version 2 as
7.10 - * published by the Free Software Foundation;
7.11 - *
7.12 - * This program is distributed in the hope that it will be useful,
7.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.15 - * GNU General Public License for more details.
7.16 - *
7.17 - * You should have received a copy of the GNU General Public License
7.18 - * along with this program; if not, write to the Free Software
7.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7.20 - *
7.21 - * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7.22 - */
7.23 -
7.24 -#include "ns3/assert.h"
7.25 -#include "ns3/net-device.h"
7.26 -#include "simple-wimax-channel.h"
7.27 -#include "wimax-phy.h"
7.28 -#include "simple-wimax-phy.h"
7.29 -
7.30 -NS_LOG_COMPONENT_DEFINE ("SimpleWimaxChannel");
7.31 -
7.32 -namespace ns3 {
7.33 -
7.34 -SimpleWimaxChannel::SimpleWimaxChannel (void)
7.35 -{
7.36 -}
7.37 -
7.38 -SimpleWimaxChannel::~SimpleWimaxChannel (void)
7.39 -{
7.40 - m_phyList.clear ();
7.41 -}
7.42 -
7.43 -void
7.44 -SimpleWimaxChannel::DoAttach (Ptr<WimaxPhy> phy)
7.45 -{
7.46 - Ptr<SimpleWimaxPhy> s_phy = phy->GetObject<SimpleWimaxPhy> ();
7.47 - m_phyList.push_back (s_phy);
7.48 -}
7.49 -
7.50 -uint32_t
7.51 -SimpleWimaxChannel::DoGetNDevices (void) const
7.52 -{
7.53 - return m_phyList.size ();
7.54 -}
7.55 -
7.56 -Ptr<NetDevice>
7.57 -SimpleWimaxChannel::DoGetDevice (uint32_t index) const
7.58 -{
7.59 - uint32_t j = 0;
7.60 - for (std::list<Ptr<SimpleWimaxPhy> >::const_iterator iter =
7.61 - m_phyList.begin (); iter != m_phyList.end (); ++iter)
7.62 - {
7.63 - if (j == index)
7.64 - {
7.65 - return (*iter)->GetDevice ();
7.66 - }
7.67 - j++;
7.68 - }
7.69 -
7.70 - NS_FATAL_ERROR ("Unable to get device");
7.71 - return 0;
7.72 -}
7.73 -
7.74 -void
7.75 -SimpleWimaxChannel::Send (Ptr<const PacketBurst> burst, Ptr<WimaxPhy> phy,
7.76 - uint64_t frequency, WimaxPhy::ModulationType modulationType)
7.77 -{
7.78 - for (std::list<Ptr<SimpleWimaxPhy> >::iterator iter = m_phyList.begin (); iter
7.79 - != m_phyList.end (); ++iter)
7.80 - {
7.81 - if (phy != *iter)
7.82 - {
7.83 - (*iter)->StartReceive (burst, frequency, modulationType);
7.84 - }
7.85 - }
7.86 -}
7.87 -
7.88 -}//namespace ns3
8.1 --- a/src/devices/wimax/simple-wimax-channel.h Thu Oct 29 15:22:25 2009 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,57 +0,0 @@
8.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
8.5 -/*
8.6 - * Copyright (c) 2007,2008 INRIA
8.7 - *
8.8 - * This program is free software; you can redistribute it and/or modify
8.9 - * it under the terms of the GNU General Public License version 2 as
8.10 - * published by the Free Software Foundation;
8.11 - *
8.12 - * This program is distributed in the hope that it will be useful,
8.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
8.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.15 - * GNU General Public License for more details.
8.16 - *
8.17 - * You should have received a copy of the GNU General Public License
8.18 - * along with this program; if not, write to the Free Software
8.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8.20 - *
8.21 - * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
8.22 - */
8.23 -
8.24 -#ifndef SIMPLE_WIMAX_CHANNEL_H
8.25 -#define SIMPLE_WIMAX_CHANNEL_H
8.26 -
8.27 -#include <list>
8.28 -#include "wimax-channel.h"
8.29 -#include "wimax-phy.h"
8.30 -
8.31 -namespace ns3 {
8.32 -
8.33 -class Packet;
8.34 -class Position;
8.35 -class PacketBurst;
8.36 -class SimpleWimaxPhy;
8.37 -
8.38 -class SimpleWimaxChannel : public WimaxChannel
8.39 -{
8.40 -public:
8.41 - SimpleWimaxChannel (void);
8.42 - ~SimpleWimaxChannel (void);
8.43 -
8.44 - void
8.45 - Send (Ptr<const PacketBurst> burst, Ptr<WimaxPhy> phy, uint64_t frequency,
8.46 - WimaxPhy::ModulationType modulationType);
8.47 -private:
8.48 - void
8.49 - DoAttach (Ptr<WimaxPhy> phy);
8.50 -
8.51 - std::list<Ptr<SimpleWimaxPhy> > m_phyList;
8.52 - uint32_t
8.53 - DoGetNDevices (void) const;
8.54 - Ptr<NetDevice>
8.55 - DoGetDevice (uint32_t i) const;
8.56 -};
8.57 -
8.58 -} // namespace ns3
8.59 -
8.60 -#endif /* SIMPLE_WIMAX_CHANNEL_H */
9.1 --- a/src/devices/wimax/simple-wimax-phy.cc Thu Oct 29 15:22:25 2009 +0100
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,362 +0,0 @@
9.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
9.5 -/*
9.6 - * Copyright (c) 2007,2008 INRIA
9.7 - *
9.8 - * This program is free software; you can redistribute it and/or modify
9.9 - * it under the terms of the GNU General Public License version 2 as
9.10 - * published by the Free Software Foundation;
9.11 - *
9.12 - * This program is distributed in the hope that it will be useful,
9.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.15 - * GNU General Public License for more details.
9.16 - *
9.17 - * You should have received a copy of the GNU General Public License
9.18 - * along with this program; if not, write to the Free Software
9.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9.20 - *
9.21 - * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
9.22 - */
9.23 -
9.24 -#include "ns3/simulator.h"
9.25 -#include "ns3/packet.h"
9.26 -#include "ns3/node.h"
9.27 -#include "wimax-net-device.h"
9.28 -#include "simple-wimax-phy.h"
9.29 -#include "wimax-channel.h"
9.30 -#include "packet-burst.h"
9.31 -#include "simple-wimax-channel.h"
9.32 -#include "ns3/trace-source-accessor.h"
9.33 -
9.34 -NS_LOG_COMPONENT_DEFINE ("SimpleWimaxPhy");
9.35 -
9.36 -namespace ns3 {
9.37 -
9.38 -NS_OBJECT_ENSURE_REGISTERED ( SimpleWimaxPhy);
9.39 -
9.40 -TypeId
9.41 -SimpleWimaxPhy::GetTypeId (void)
9.42 -{
9.43 - static TypeId tid =
9.44 - TypeId ("ns3::SimpleWimaxPhy") .SetParent<WimaxPhy> () .AddTraceSource (
9.45 - "Rx", "Receive trace", MakeTraceSourceAccessor (
9.46 - &SimpleWimaxPhy::m_traceRx)) .AddTraceSource ("Tx",
9.47 - "Transmit trace",
9.48 - MakeTraceSourceAccessor (&SimpleWimaxPhy::m_traceTx));
9.49 - return tid;
9.50 -}
9.51 -
9.52 -WimaxPhy::PhyType
9.53 -SimpleWimaxPhy::GetPhyType (void) const
9.54 -{
9.55 - return WimaxPhy::SimpleWimaxPhy;
9.56 -
9.57 -}
9.58 -
9.59 -SimpleWimaxPhy::SimpleWimaxPhy (void) :
9.60 - m_dataRateBpsk12 (0), m_dataRateQpsk12 (0), m_dataRateQpsk34 (0),
9.61 - m_dataRateQam16_12 (0), m_dataRateQam16_34 (0), m_dataRateQam64_23 (0),
9.62 - m_dataRateQam64_34 (0)
9.63 -{
9.64 -}
9.65 -
9.66 -SimpleWimaxPhy::~SimpleWimaxPhy (void)
9.67 -{
9.68 -}
9.69 -
9.70 -void
9.71 -SimpleWimaxPhy::DoDispose (void)
9.72 -{
9.73 -}
9.74 -
9.75 -void
9.76 -SimpleWimaxPhy::DoAttach (Ptr<WimaxChannel> channel)
9.77 -{
9.78 - GetChannel ()->Attach (this);
9.79 -}
9.80 -
9.81 -void
9.82 -SimpleWimaxPhy::Send (SendParams *params)
9.83 -{
9.84 -
9.85 - Time t;
9.86 - uint32_t dr2 = 0;
9.87 - SimpleSendParams *s_params = dynamic_cast<SimpleSendParams*> (params);
9.88 - DoSetDataRates ();
9.89 - dr2 = CalculateDataRate (
9.90 - (WimaxPhy::ModulationType) s_params->GetModulationType ());
9.91 - t = DoGetTransmissionTime (s_params->GetBurst ()->GetSize (),
9.92 - (WimaxPhy::ModulationType) s_params->GetModulationType ());
9.93 - NS_LOG_INFO ("size:" << s_params->GetBurst ()->GetSize () << "TransTime: "
9.94 - << t << " DataRate: " << dr2 << "\n");
9.95 -
9.96 - Send (s_params->GetBurst (),
9.97 - (WimaxPhy::ModulationType) s_params->GetModulationType ());
9.98 -}
9.99 -
9.100 -void
9.101 -SimpleWimaxPhy::Send (Ptr<const PacketBurst> burst,
9.102 - WimaxPhy::ModulationType modulationType)
9.103 -{
9.104 -
9.105 - NS_ASSERT_MSG (GetState () != PHY_STATE_TX,
9.106 - "Error while sending a burst: PHY state is not TX");
9.107 -
9.108 - Simulator::Schedule (
9.109 - DoGetTransmissionTime (burst->GetSize (), modulationType),
9.110 - &SimpleWimaxPhy::EndSend, this);
9.111 -
9.112 - SimpleWimaxChannel *channel = dynamic_cast<SimpleWimaxChannel*> (PeekPointer (
9.113 - GetChannel ()));
9.114 - channel->Send (burst, this, GetTxFrequency (), modulationType);
9.115 -
9.116 - SetState (PHY_STATE_TX);
9.117 -}
9.118 -
9.119 -void
9.120 -SimpleWimaxPhy::EndSend (void)
9.121 -{
9.122 - SetState (PHY_STATE_IDLE);
9.123 -}
9.124 -
9.125 -void
9.126 -SimpleWimaxPhy::StartReceive (Ptr<const PacketBurst> burst, uint64_t frequency,
9.127 - WimaxPhy::ModulationType modulationType)
9.128 -{
9.129 - double distance = 10;
9.130 -
9.131 - switch (GetState ())
9.132 - {
9.133 - case PHY_STATE_SCANNING:
9.134 - if (frequency == GetScanningFrequency () && distance
9.135 - <= GetDistanceThreshold ())
9.136 - {
9.137 - //PHY frame detected (see Figure 56)
9.138 - //will start synchronization next
9.139 -
9.140 - Simulator::Cancel (GetChnlSrchTimeoutEvent ());
9.141 - SetScanningCallback ();
9.142 - SetSimplex (frequency);
9.143 - SetState (PHY_STATE_IDLE);
9.144 - }
9.145 - break;
9.146 - case PHY_STATE_IDLE:
9.147 - if (frequency == GetRxFrequency () && distance <= GetDistanceThreshold ())
9.148 - {
9.149 - Simulator::Schedule (DoGetTransmissionTime (burst->GetSize (),
9.150 - modulationType), &SimpleWimaxPhy::EndReceive, this, burst);
9.151 - SetState (PHY_STATE_RX);
9.152 - }
9.153 - break;
9.154 - case PHY_STATE_RX:
9.155 - //drop
9.156 - break;
9.157 - case PHY_STATE_TX:
9.158 - if (IsDuplex () && frequency == GetRxFrequency () && distance
9.159 - <= GetDistanceThreshold ())
9.160 - {
9.161 -
9.162 - }
9.163 - break;
9.164 - default:
9.165 - NS_FATAL_ERROR ("Invalid physical state");
9.166 - }
9.167 -}
9.168 -
9.169 -void
9.170 -SimpleWimaxPhy::EndReceive (Ptr<const PacketBurst> burst)
9.171 -{
9.172 - SetState (PHY_STATE_IDLE);
9.173 - Ptr<PacketBurst> b = burst->Copy ();
9.174 - GetReceiveCallback () (b);
9.175 -}
9.176 -
9.177 -void
9.178 -SimpleWimaxPhy::DoSetDataRates (void)
9.179 -{
9.180 - m_dataRateBpsk12 = CalculateDataRate (MODULATION_TYPE_BPSK_12); //6912000 bps
9.181 - m_dataRateQpsk12 = CalculateDataRate (MODULATION_TYPE_QPSK_12); //13824000
9.182 - m_dataRateQpsk34 = CalculateDataRate (MODULATION_TYPE_QPSK_34); //20736000
9.183 - m_dataRateQam16_12 = CalculateDataRate (MODULATION_TYPE_QAM16_12); //27648000
9.184 - m_dataRateQam16_34 = CalculateDataRate (MODULATION_TYPE_QAM16_34); //41472000
9.185 - m_dataRateQam64_23 = CalculateDataRate (MODULATION_TYPE_QAM64_23); //55224000
9.186 - m_dataRateQam64_34 = CalculateDataRate (MODULATION_TYPE_QAM64_34); //62208000
9.187 -}
9.188 -
9.189 -void
9.190 -SimpleWimaxPhy::GetModulationFecParams (
9.191 - WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol,
9.192 - double &fecCode) const
9.193 -{
9.194 - switch (modulationType)
9.195 - {
9.196 - case MODULATION_TYPE_BPSK_12:
9.197 - bitsPerSymbol = 1;
9.198 - fecCode = (double) 1 / 2;
9.199 - break;
9.200 - case MODULATION_TYPE_QPSK_12:
9.201 - bitsPerSymbol = 2;
9.202 - fecCode = (double) 1 / 2;
9.203 - break;
9.204 - case MODULATION_TYPE_QPSK_34:
9.205 - bitsPerSymbol = 2;
9.206 - fecCode = (double) 3 / 4;
9.207 - break;
9.208 - case MODULATION_TYPE_QAM16_12:
9.209 - bitsPerSymbol = 4;
9.210 - fecCode = (double) 1 / 2;
9.211 - break;
9.212 - case MODULATION_TYPE_QAM16_34:
9.213 - bitsPerSymbol = 4;
9.214 - fecCode = (double) 3 / 4;
9.215 - break;
9.216 - case MODULATION_TYPE_QAM64_23:
9.217 - bitsPerSymbol = 6;
9.218 - fecCode = (double) 2 / 3;
9.219 - break;
9.220 - case MODULATION_TYPE_QAM64_34:
9.221 - bitsPerSymbol = 6;
9.222 - fecCode = 0.75;
9.223 - break;
9.224 - default:
9.225 - NS_FATAL_ERROR ("Invalid modulation type");
9.226 - }
9.227 -}
9.228 -
9.229 -uint32_t
9.230 -SimpleWimaxPhy::CalculateDataRate (WimaxPhy::ModulationType modulationType) const
9.231 -{
9.232 - uint8_t bitsPerSymbol = 0;
9.233 - double fecCode = 0;
9.234 - GetModulationFecParams (modulationType, bitsPerSymbol, fecCode);
9.235 - double symbolsPerSecond = 1 / GetSymbolDuration ().GetSeconds ();
9.236 - uint16_t bitsTransmittedPerSymbol =
9.237 - (uint16_t) (bitsPerSymbol * 192 * fecCode);
9.238 - //96, 192, 288, 384, 576, 767 and 864 bits per symbol for the seven modulations, respectively
9.239 -
9.240 -
9.241 - return (uint32_t) symbolsPerSecond * bitsTransmittedPerSymbol;
9.242 -}
9.243 -
9.244 -uint32_t
9.245 -SimpleWimaxPhy::DoGetDataRate (WimaxPhy::ModulationType modulationType) const
9.246 -{
9.247 -
9.248 - switch (modulationType)
9.249 - {
9.250 - case MODULATION_TYPE_BPSK_12:
9.251 - return m_dataRateBpsk12;
9.252 - break;
9.253 - case MODULATION_TYPE_QPSK_12:
9.254 - return m_dataRateQpsk12;
9.255 - break;
9.256 - case MODULATION_TYPE_QPSK_34:
9.257 - return m_dataRateQpsk34;
9.258 - break;
9.259 - case MODULATION_TYPE_QAM16_12:
9.260 - return m_dataRateQam16_12;
9.261 - break;
9.262 - case MODULATION_TYPE_QAM16_34:
9.263 - return m_dataRateQam16_34;
9.264 - break;
9.265 - case MODULATION_TYPE_QAM64_23:
9.266 - return m_dataRateQam64_23;
9.267 - break;
9.268 - case MODULATION_TYPE_QAM64_34:
9.269 - return m_dataRateQam64_34;
9.270 - break;
9.271 - }
9.272 - NS_FATAL_ERROR ("Invalid modulation type");
9.273 - return 0;
9.274 -}
9.275 -
9.276 -Time
9.277 -SimpleWimaxPhy::DoGetTransmissionTime (uint32_t size,
9.278 - WimaxPhy::ModulationType modulationType) const
9.279 -{
9.280 - return Seconds (0);
9.281 - return Seconds (((double) (size * 8) / DoGetDataRate (modulationType)))
9.282 - + FemtoSeconds (1);
9.283 -}
9.284 -
9.285 -uint64_t
9.286 -SimpleWimaxPhy::DoGetNrSymbols (uint32_t size,
9.287 - WimaxPhy::ModulationType modulationType) const
9.288 -{
9.289 - return 0;
9.290 -}
9.291 -
9.292 -//Add by G. Piro
9.293 -uint64_t
9.294 -SimpleWimaxPhy::DoGetNrBytes (uint32_t symbols,
9.295 - WimaxPhy::ModulationType modulationType) const
9.296 -{
9.297 - return 0;
9.298 -}
9.299 -
9.300 -uint16_t
9.301 -SimpleWimaxPhy::DoGetTtg (void) const
9.302 -{
9.303 - //NA with this PHY
9.304 - return 0;
9.305 -}
9.306 -
9.307 -uint16_t
9.308 -SimpleWimaxPhy::DoGetRtg (void) const
9.309 -{
9.310 - //NA with this PHY
9.311 - return 0;
9.312 -}
9.313 -
9.314 -uint8_t
9.315 -SimpleWimaxPhy::DoGetFrameDurationCode (void) const
9.316 -{
9.317 - //NA with this PHY
9.318 - return 0;
9.319 -}
9.320 -
9.321 -Time
9.322 -SimpleWimaxPhy::DoGetFrameDuration (uint8_t frameDurationCode) const
9.323 -{
9.324 - //NA with this PHY
9.325 - return Seconds (0);
9.326 -}
9.327 -
9.328 -/*---------------------PHY parameters functions-----------------------*/
9.329 -
9.330 -void
9.331 -SimpleWimaxPhy::DoSetPhyParameters (void)
9.332 -{
9.333 -
9.334 - //NA with this PHY, nothing to set
9.335 -}
9.336 -
9.337 -uint16_t
9.338 -SimpleWimaxPhy::DoGetNfft (void) const
9.339 -{
9.340 - //NA with this PHY
9.341 - return 0;
9.342 -}
9.343 -
9.344 -double
9.345 -SimpleWimaxPhy::DoGetSamplingFactor (void) const
9.346 -{
9.347 - //NA with this PHY
9.348 - return 0;
9.349 -}
9.350 -
9.351 -double
9.352 -SimpleWimaxPhy::DoGetSamplingFrequency (void) const
9.353 -{
9.354 - //NA with this PHY
9.355 - return 0;
9.356 -}
9.357 -
9.358 -double
9.359 -SimpleWimaxPhy::DoGetGValue (void) const
9.360 -{
9.361 - //NA with this PHY
9.362 - return 0;
9.363 -}
9.364 -
9.365 -}//namespace ns3
10.1 --- a/src/devices/wimax/simple-wimax-phy.h Thu Oct 29 15:22:25 2009 +0100
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,120 +0,0 @@
10.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
10.5 -/*
10.6 - * Copyright (c) 2007,2008 INRIA
10.7 - *
10.8 - * This program is free software; you can redistribute it and/or modify
10.9 - * it under the terms of the GNU General Public License version 2 as
10.10 - * published by the Free Software Foundation;
10.11 - *
10.12 - * This program is distributed in the hope that it will be useful,
10.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.15 - * GNU General Public License for more details.
10.16 - *
10.17 - * You should have received a copy of the GNU General Public License
10.18 - * along with this program; if not, write to the Free Software
10.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10.20 - *
10.21 - * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
10.22 - */
10.23 -
10.24 -#ifndef SIMPLE_WIMAX_PHY_H
10.25 -#define SIMPLE_WIMAX_PHY_H
10.26 -
10.27 -#include <stdint.h>
10.28 -#include <list>
10.29 -#include "ns3/callback.h"
10.30 -#include "ns3/nstime.h"
10.31 -#include "ns3/event-id.h"
10.32 -#include "wimax-phy.h"
10.33 -
10.34 -namespace ns3 {
10.35 -
10.36 -class WimaxChannel;
10.37 -class WimaxNetDevice;
10.38 -class NetDevice;
10.39 -class Packet;
10.40 -class SimpleWimaxChannel;
10.41 -
10.42 -class SimpleWimaxPhy : public WimaxPhy
10.43 -{
10.44 -public:
10.45 - static TypeId
10.46 - GetTypeId (void);
10.47 - SimpleWimaxPhy (void);
10.48 - ~SimpleWimaxPhy (void);
10.49 - void
10.50 - DoAttach (Ptr<WimaxChannel> channel);
10.51 -
10.52 - void
10.53 - SetReceiveCallback (Callback<void, Ptr<const PacketBurst> , Ptr<
10.54 - WimaxConnection> > callback);
10.55 -
10.56 - void
10.57 - Send (Ptr<const PacketBurst> burst, WimaxPhy::ModulationType modulationType);
10.58 - void
10.59 - Send (SendParams *params);
10.60 - void
10.61 - StartReceive (Ptr<const PacketBurst> burst, uint64_t frequency,
10.62 - WimaxPhy::ModulationType modulationType);
10.63 -
10.64 - Time
10.65 - DoGetTransmissionTime (uint32_t size,
10.66 - WimaxPhy::ModulationType modulationType) const;
10.67 - uint64_t
10.68 - DoGetNrSymbols (uint32_t size, WimaxPhy::ModulationType modulationType) const;
10.69 - //Add by G. Piro
10.70 - uint64_t
10.71 - DoGetNrBytes (uint32_t symbols, WimaxPhy::ModulationType modulationType) const;
10.72 -
10.73 - WimaxPhy::PhyType
10.74 - GetPhyType (void) const;
10.75 -
10.76 -private:
10.77 - void
10.78 - DoDispose (void);
10.79 - void
10.80 - EndSend (void);
10.81 - void
10.82 - EndReceive (Ptr<const PacketBurst> burst);
10.83 - void
10.84 - DoSetDataRates (void);
10.85 - void
10.86 - GetModulationFecParams (WimaxPhy::ModulationType modulationType,
10.87 - uint8_t &bitsPerSymbol, double &fecCode) const;
10.88 - uint32_t
10.89 - CalculateDataRate (WimaxPhy::ModulationType modulationType) const;
10.90 - uint32_t
10.91 - DoGetDataRate (WimaxPhy::ModulationType modulationType) const;
10.92 - uint16_t
10.93 - DoGetTtg (void) const;
10.94 - uint16_t
10.95 - DoGetRtg (void) const;
10.96 - uint8_t
10.97 - DoGetFrameDurationCode (void) const;
10.98 - Time
10.99 - DoGetFrameDuration (uint8_t frameDurationCode) const;
10.100 - void
10.101 - DoSetPhyParameters (void);
10.102 - uint16_t
10.103 - DoGetNfft (void) const;
10.104 - double
10.105 - DoGetSamplingFactor (void) const;
10.106 - double
10.107 - DoGetSamplingFrequency (void) const;
10.108 - double
10.109 - DoGetGValue (void) const;
10.110 -
10.111 - //currently not used
10.112 - TracedCallback<WimaxPhy::ModulationType> m_traceRx;
10.113 - TracedCallback<Ptr<const PacketBurst> , WimaxPhy::ModulationType> m_traceTx;
10.114 -
10.115 - //data rates for this Phy
10.116 - uint32_t m_dataRateBpsk12, m_dataRateQpsk12, m_dataRateQpsk34,
10.117 - m_dataRateQam16_12, m_dataRateQam16_34, m_dataRateQam64_23,
10.118 - m_dataRateQam64_34;
10.119 -};
10.120 -
10.121 -}//namespace ns3
10.122 -
10.123 -#endif /* SIMPLE_WIMAX_PHY_H */
11.1 --- a/src/devices/wimax/ss-link-manager.cc Thu Oct 29 15:22:25 2009 +0100
11.2 +++ b/src/devices/wimax/ss-link-manager.cc Tue Nov 10 14:36:17 2009 +0100
11.3 @@ -399,7 +399,7 @@
11.4 bool
11.5 SSLinkManager::IsUlChannelUsable (void)
11.6 {
11.7 - //dont know how to check if usable, see see Figure 58.
11.8 + //dont know how to check if usable, see Figure 58.
11.9 return true; //temporarily assuming usable
11.10 }
11.11
12.1 --- a/src/devices/wimax/ss-record.cc Thu Oct 29 15:22:25 2009 +0100
12.2 +++ b/src/devices/wimax/ss-record.cc Tue Nov 10 14:36:17 2009 +0100
12.3 @@ -259,6 +259,8 @@
12.4 void
12.5 SSRecord::AddServiceFlow (ServiceFlow *serviceFlow)
12.6 {
12.7 +
12.8 +
12.9 switch (serviceFlow->GetSchedulingType ())
12.10 {
12.11 case QoSParameterSet::SCHEDULING_TYPE_UGS:
12.12 @@ -319,7 +321,11 @@
12.13 switch (schedulingType)
12.14 {
12.15 case QoSParameterSet::SCHEDULING_TYPE_UGS:
12.16 - iter_service = m_serviceFlowsUgs->begin ();
12.17 + if (m_serviceFlowsUgs->size () > 0)
12.18 + {
12.19 + iter_service = m_serviceFlowsUgs->begin ();
12.20 + return *iter_service;
12.21 + }
12.22
12.23 break;
12.24 case QoSParameterSet::SCHEDULING_TYPE_RTPS:
12.25 @@ -331,12 +337,18 @@
12.26
12.27 break;
12.28 case QoSParameterSet::SCHEDULING_TYPE_NRTPS:
12.29 - iter_service = m_serviceFlowsNrtps->begin ();
12.30 -
12.31 + if (m_serviceFlowsNrtps->size () > 0)
12.32 + {
12.33 + iter_service = m_serviceFlowsNrtps->begin ();
12.34 + return *iter_service;
12.35 + }
12.36 break;
12.37 case QoSParameterSet::SCHEDULING_TYPE_BE:
12.38 - iter_service = m_serviceFlowsBe->begin ();
12.39 -
12.40 + if (m_serviceFlowsBe->size () > 0)
12.41 + {
12.42 + iter_service = m_serviceFlowsBe->begin ();
12.43 + return *iter_service;
12.44 + }
12.45 break;
12.46 default:
12.47 NS_FATAL_ERROR ("Invalid scheduling type");
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/src/devices/wimax/wimax-bs-mac-test.cc Tue Nov 10 14:36:17 2009 +0100
13.3 @@ -0,0 +1,267 @@
13.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
13.5 +/*
13.6 + * Copyright (c) 2007,2008, 2009 INRIA, UDcast
13.7 + *
13.8 + * This program is free software; you can redistribute it and/or modify
13.9 + * it under the terms of the GNU General Public License version 2 as
13.10 + * published by the Free Software Foundation;
13.11 + *
13.12 + * This program is distributed in the hope that it will be useful,
13.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.15 + * GNU General Public License for more details.
13.16 + *
13.17 + * You should have received a copy of the GNU General Public License
13.18 + * along with this program; if not, write to the Free Software
13.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13.20 + *
13.21 + * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
13.22 + * <amine.ismail@udcast.com>
13.23 + */
13.24 +#include "ns3/log.h"
13.25 +#include "ns3/abort.h"
13.26 +#include "ns3/test.h"
13.27 +#include "ns3/config.h"
13.28 +#include "ns3/string.h"
13.29 +#include "ns3/uinteger.h"
13.30 +#include "ns3/inet-socket-address.h"
13.31 +#include "ns3/point-to-point-helper.h"
13.32 +#include "ns3/internet-stack-helper.h"
13.33 +#include "ns3/ipv4-address-helper.h"
13.34 +#include "ns3/ipv4-header.h"
13.35 +#include "ns3/packet-sink-helper.h"
13.36 +#include "ns3/udp-helper.h"
13.37 +#include "ns3/udp-header.h"
13.38 +#include "ns3/simulator.h"
13.39 +#include "ns3/wimax-helper.h"
13.40 +#include "ns3/mobility-helper.h"
13.41 +#include <iostream>
13.42 +#include "ns3/global-route-manager.h"
13.43 +
13.44 +using namespace ns3;
13.45 +
13.46 +/*
13.47 + * Test the IP packet classifier of base station
13.48 + *
13.49 + */
13.50 +
13.51 +class Ns3WimaxBSClassifierTestCase : public TestCase
13.52 +{
13.53 +public:
13.54 + Ns3WimaxBSClassifierTestCase ();
13.55 + virtual
13.56 + ~Ns3WimaxBSClassifierTestCase ();
13.57 +
13.58 +private:
13.59 + virtual bool
13.60 + DoRun (void);
13.61 +
13.62 +};
13.63 +
13.64 +Ns3WimaxBSClassifierTestCase::Ns3WimaxBSClassifierTestCase () :
13.65 + TestCase ("Test the IP packet classifier of the base station")
13.66 +{
13.67 +}
13.68 +
13.69 +Ns3WimaxBSClassifierTestCase::~Ns3WimaxBSClassifierTestCase ()
13.70 +{
13.71 +}
13.72 +
13.73 +bool
13.74 +Ns3WimaxBSClassifierTestCase::DoRun (void)
13.75 +{
13.76 +
13.77 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
13.78 + TimeStepPrecision::Set (TimeStepPrecision::FS);
13.79 + NodeContainer ssNodes;
13.80 + NodeContainer bsNodes;
13.81 + ssNodes.Create (10);
13.82 + bsNodes.Create (1);
13.83 +
13.84 + WimaxHelper wimax;
13.85 +
13.86 + NetDeviceContainer ssDevs, bsDevs;
13.87 +
13.88 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
13.89 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
13.90 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
13.91 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
13.92 +
13.93 + QoSParameterSet* UGSparameterSet[10];
13.94 + QoSParameterSet* RTPSparameterSet[10];
13.95 + QoSParameterSet* BEparameterSet[10];
13.96 +
13.97 + Ptr<WimaxBaseStationNetDevice> bs = bsDevs.Get (0)->GetObject<
13.98 + WimaxBaseStationNetDevice> ();
13.99 + Ptr<WimaxSubscriberStationNetDevice> ss[10];
13.100 +
13.101 + for (int i = 0; i < 10; i++)
13.102 + {
13.103 + ss[i] = ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ();
13.104 + ss[i]->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
13.105 +
13.106 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 1000, 100);
13.107 + RTPSparameterSet[i] = wimax.CreateRtpsParameterSet (12176, 2000000, 700,
13.108 + 20);
13.109 + BEparameterSet[i] = wimax.CreateBeParameterSet (100);
13.110 +
13.111 + wimax.SetupConnection (ss[i], bs, UGSparameterSet[i],
13.112 + QoSParameterSet::SCHEDULING_TYPE_UGS);
13.113 + wimax.SetupConnection (ss[i], bs, RTPSparameterSet[i],
13.114 + QoSParameterSet::SCHEDULING_TYPE_RTPS);
13.115 + wimax.SetupConnection (ss[i], bs, BEparameterSet[i],
13.116 + QoSParameterSet::SCHEDULING_TYPE_BE);
13.117 +
13.118 + }
13.119 +
13.120 + Ipv4Address srcUGS, dstUGS, srcRTPS, dstRTPS, srcBE, dstBE;
13.121 + uint16_t portUGS = 1000, portRTPS = 2000, portBE = 3000;
13.122 + srcUGS.Set ("10.10.10.10");
13.123 + dstUGS.Set ("20.20.20.20");
13.124 + srcRTPS.Set ("11.11.11.11");
13.125 + dstRTPS.Set ("21.21.21.21");
13.126 + srcBE.Set ("12.12.12.12");
13.127 + dstBE.Set ("22.22.22.22");
13.128 +
13.129 + wimax.BsClassifierConfig (ss[5], bs, srcUGS, dstUGS, 0, portUGS, 17,
13.130 + ServiceFlow::SFID_TYPE_UGS);
13.131 + wimax.BsClassifierConfig (ss[5], bs, srcUGS, dstRTPS, 0, portRTPS, 17,
13.132 + ServiceFlow::SFID_TYPE_RTPS);
13.133 + wimax.BsClassifierConfig (ss[6], bs, srcBE, dstBE, 0, portBE, 17,
13.134 + ServiceFlow::SFID_TYPE_BE);
13.135 +
13.136 + Simulator::Stop (Seconds (0.5));
13.137 + Simulator::Run ();
13.138 +
13.139 + Ptr<Packet> packet = new Packet (1200);
13.140 +
13.141 + UdpHeader UDP_Header;
13.142 + UDP_Header.SetDestinationPort (portUGS);
13.143 + UDP_Header.SetSourcePort (7878);
13.144 + packet->AddHeader (UDP_Header);
13.145 +
13.146 + Ipv4Header IPV4_Header;
13.147 + IPV4_Header.SetPayloadSize (packet->GetSize ());
13.148 + IPV4_Header.SetProtocol (17);
13.149 + IPV4_Header.SetSource (srcUGS);
13.150 + IPV4_Header.SetDestination (dstUGS);
13.151 + packet->AddHeader (IPV4_Header);
13.152 +
13.153 + LlcSnapHeader llc;
13.154 + packet->AddHeader (llc);
13.155 +
13.156 + ServiceFlow * sf = bs->GetBsClassifier ()->DoClassify (packet,
13.157 + ss[5]->GetMacAddress ());
13.158 +
13.159 + if (sf->GetSchedulingType () != QoSParameterSet::SCHEDULING_TYPE_UGS)
13.160 + {
13.161 + return true;
13.162 + }
13.163 +
13.164 + Simulator::Destroy ();
13.165 + return (false);
13.166 +
13.167 +}
13.168 +
13.169 +/*
13.170 + * Test that an BS can send a packet correctly
13.171 + *
13.172 + */
13.173 +
13.174 +class Ns3WimaBSSendTestCase : public TestCase
13.175 +{
13.176 +public:
13.177 + Ns3WimaBSSendTestCase ();
13.178 + virtual
13.179 + ~Ns3WimaBSSendTestCase ();
13.180 +
13.181 +private:
13.182 + virtual bool
13.183 + DoRun (void);
13.184 +
13.185 +};
13.186 +
13.187 +Ns3WimaBSSendTestCase::Ns3WimaBSSendTestCase () :
13.188 + TestCase ("Check that an BS can send a packet correctly")
13.189 +{
13.190 +}
13.191 +
13.192 +Ns3WimaBSSendTestCase::~Ns3WimaBSSendTestCase ()
13.193 +{
13.194 +}
13.195 +
13.196 +bool
13.197 +Ns3WimaBSSendTestCase::DoRun (void)
13.198 +{
13.199 +
13.200 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
13.201 + TimeStepPrecision::Set (TimeStepPrecision::FS);
13.202 + NodeContainer ssNodes;
13.203 + NodeContainer bsNodes;
13.204 + ssNodes.Create (1);
13.205 + bsNodes.Create (1);
13.206 +
13.207 + WimaxHelper wimax;
13.208 + NetDeviceContainer ssDevs, bsDevs;
13.209 +
13.210 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
13.211 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
13.212 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
13.213 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
13.214 +
13.215 + QoSParameterSet* UGSparameterSet;
13.216 +
13.217 + Ptr<WimaxBaseStationNetDevice> bs = bsDevs.Get (0)->GetObject<
13.218 + WimaxBaseStationNetDevice> ();
13.219 + Ptr<WimaxSubscriberStationNetDevice> ss = ssDevs.Get (0)->GetObject<
13.220 + WimaxSubscriberStationNetDevice> ();
13.221 +
13.222 + ss->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
13.223 + UGSparameterSet = wimax.CreateUgsParameterSet (1000000, 1000, 100);
13.224 + wimax.SetupConnection (ss, bs, UGSparameterSet,
13.225 + QoSParameterSet::SCHEDULING_TYPE_UGS);
13.226 +
13.227 + Ipv4Address src, dst;
13.228 + uint16_t port = 1000;
13.229 + src.Set ("10.10.10.10");
13.230 + dst.Set ("20.20.20.20");
13.231 + wimax.BsClassifierConfig (ss, bs, src, dst, 0, port, 17,ServiceFlow::SFID_TYPE_UGS);
13.232 +
13.233 + Simulator::Stop (Seconds (0.5));
13.234 + Simulator::Run ();
13.235 +
13.236 + Ptr<Packet> packet = new Packet (1200);
13.237 +
13.238 + UdpHeader UDP_Header;
13.239 + UDP_Header.SetDestinationPort (port);
13.240 + UDP_Header.SetSourcePort (7878); //any
13.241 + packet->AddHeader (UDP_Header);
13.242 +
13.243 + Ipv4Header IPV4_Header;
13.244 + IPV4_Header.SetPayloadSize (packet->GetSize ());
13.245 + IPV4_Header.SetProtocol (17); //UDP
13.246 + IPV4_Header.SetSource (src);
13.247 + IPV4_Header.SetDestination (dst);
13.248 + packet->AddHeader (IPV4_Header);
13.249 + bool res = false;
13.250 + res = bs->Send (packet, ss->GetMacAddress (), 2048);
13.251 +
13.252 + Simulator::Destroy ();
13.253 + return (!res);
13.254 +
13.255 +}
13.256 +
13.257 +class Ns3WimaxBSMacTestSuite : public TestSuite
13.258 +{
13.259 +public:
13.260 + Ns3WimaxBSMacTestSuite ();
13.261 +};
13.262 +
13.263 +Ns3WimaxBSMacTestSuite::Ns3WimaxBSMacTestSuite () :
13.264 + TestSuite ("wimax-bs-mac-layer", UNIT)
13.265 +{
13.266 + AddTestCase (new Ns3WimaxBSClassifierTestCase);
13.267 + AddTestCase (new Ns3WimaBSSendTestCase);
13.268 +}
13.269 +
13.270 +Ns3WimaxBSMacTestSuite ns3WimaxBSMacTestSuite;
14.1 --- a/src/devices/wimax/wimax-bs-net-device.cc Thu Oct 29 15:22:25 2009 +0100
14.2 +++ b/src/devices/wimax/wimax-bs-net-device.cc Tue Nov 10 14:36:17 2009 +0100
14.3 @@ -688,8 +688,8 @@
14.4 source = m_ssManager->GetMacAddress (&cid);
14.5 m_traceBSRx (packet, source, &cid);
14.6
14.7 - //perhaps shall be done by ARP
14.8 Mac48Address dest = GetConnectionManager ()->GetDestAddress (cid);
14.9 +
14.10 ForwardUp (packet->Copy (), source, dest);
14.11 }
14.12 }
14.13 @@ -845,8 +845,8 @@
14.14 }
14.15
14.16 OfdmDlMapIe dlMapIeEnd;
14.17 - Ptr <ConnectionIdentifier> tmpcid= CreateObject<ConnectionIdentifier> (0);
14.18 - tmpcid->SetIdentifier(0);
14.19 + Ptr<ConnectionIdentifier> tmpcid = CreateObject<ConnectionIdentifier> (0);
14.20 + tmpcid->SetIdentifier (0);
14.21
14.22 dlMapIeEnd.SetCid (*tmpcid);
14.23 dlMapIeEnd.SetDiuc (OfdmDlBurstProfile::DIUC_END_OF_MAP);
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/src/devices/wimax/wimax-phy-test.cc Tue Nov 10 14:36:17 2009 +0100
15.3 @@ -0,0 +1,191 @@
15.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
15.5 +/*
15.6 + * Copyright (c) 2007,2008, 2009 INRIA, UDcast
15.7 + *
15.8 + * This program is free software; you can redistribute it and/or modify
15.9 + * it under the terms of the GNU General Public License version 2 as
15.10 + * published by the Free Software Foundation;
15.11 + *
15.12 + * This program is distributed in the hope that it will be useful,
15.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.15 + * GNU General Public License for more details.
15.16 + *
15.17 + * You should have received a copy of the GNU General Public License
15.18 + * along with this program; if not, write to the Free Software
15.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15.20 + *
15.21 + * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
15.22 + * <amine.ismail@udcast.com>
15.23 + */
15.24 +#include "ns3/log.h"
15.25 +#include "ns3/abort.h"
15.26 +#include "ns3/test.h"
15.27 +#include "ns3/config.h"
15.28 +#include "ns3/string.h"
15.29 +#include "ns3/uinteger.h"
15.30 +#include "ns3/inet-socket-address.h"
15.31 +#include "ns3/point-to-point-helper.h"
15.32 +#include "ns3/internet-stack-helper.h"
15.33 +#include "ns3/ipv4-address-helper.h"
15.34 +#include "ns3/ipv4-header.h"
15.35 +#include "ns3/packet-sink-helper.h"
15.36 +#include "ns3/udp-helper.h"
15.37 +#include "ns3/udp-header.h"
15.38 +#include "ns3/simulator.h"
15.39 +#include "ns3/wimax-helper.h"
15.40 +#include "ns3/mobility-helper.h"
15.41 +#include <iostream>
15.42 +#include "ns3/global-route-manager.h"
15.43 +#include "snr-to-block-error-rate-manager.h"
15.44 +
15.45 +
15.46 +using namespace ns3;
15.47 +
15.48 +/*
15.49 + * Configure a network with 10 SS and 1 BS
15.50 + * Install a SIMPLE OFDM PHY layer on all nodes and check that all SSs
15.51 + * could register with the BS
15.52 + *
15.53 + */
15.54 +
15.55 +class Ns3WimaxSimpleOFDMTestCase: public TestCase
15.56 +{
15.57 +public:
15.58 + Ns3WimaxSimpleOFDMTestCase ();
15.59 + virtual ~Ns3WimaxSimpleOFDMTestCase ();
15.60 +
15.61 +private:
15.62 + virtual bool DoRun (void);
15.63 + bool DoRunOnce (double);
15.64 +
15.65 +};
15.66 +
15.67 +Ns3WimaxSimpleOFDMTestCase::Ns3WimaxSimpleOFDMTestCase () :
15.68 + TestCase ("Test the Phy model with different frame durations")
15.69 +{
15.70 +}
15.71 +
15.72 +Ns3WimaxSimpleOFDMTestCase::~Ns3WimaxSimpleOFDMTestCase ()
15.73 +{
15.74 +}
15.75 +
15.76 +bool Ns3WimaxSimpleOFDMTestCase::DoRunOnce (double FrameDuration)
15.77 +{
15.78 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
15.79 + TimeStepPrecision::Set (TimeStepPrecision::FS);
15.80 + NodeContainer ssNodes;
15.81 + NodeContainer bsNodes;
15.82 + ssNodes.Create (3);
15.83 + bsNodes.Create (1);
15.84 +
15.85 + WimaxHelper wimax;
15.86 +
15.87 + NetDeviceContainer ssDevs, bsDevs;
15.88 +
15.89 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
15.90 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler, FrameDuration);
15.91 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
15.92 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler, FrameDuration);
15.93 +
15.94 + Simulator::Stop (Seconds (1));
15.95 + Simulator::Run ();
15.96 + for (int i = 0; i < 3; i++)
15.97 + {
15.98 + if (ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ()->IsRegistered ()
15.99 + == false)
15.100 + {
15.101 + return true; // Test fail because SS[i] is not registered
15.102 + }
15.103 + }
15.104 + Simulator::Destroy ();
15.105 + return (false); // Test was ok, all the SSs are registered
15.106 +
15.107 +}
15.108 +
15.109 +bool Ns3WimaxSimpleOFDMTestCase::DoRun (void)
15.110 +{
15.111 +
15.112 + double
15.113 + frameDuratioTab[7] = { 0.0025, 0.004, 0.005, 0.008, 0.01, 0.0125, 0.02 };
15.114 + for (int i = 0; i < 7; i++)
15.115 + {
15.116 +
15.117 + if (DoRunOnce (frameDuratioTab[i]) != false)
15.118 + {
15.119 +
15.120 + return true;
15.121 + }
15.122 + }
15.123 + return false;
15.124 +}
15.125 +
15.126 +/*
15.127 + * Test the SNr tom block error rate module
15.128 + */
15.129 +
15.130 +class Ns3WimaxSNRtoBLERTestCase: public TestCase
15.131 +{
15.132 +public:
15.133 + Ns3WimaxSNRtoBLERTestCase ();
15.134 + virtual ~Ns3WimaxSNRtoBLERTestCase ();
15.135 +
15.136 +private:
15.137 + virtual bool DoRun (void);
15.138 + bool DoRunOnce (uint8_t);
15.139 +
15.140 +};
15.141 +
15.142 +Ns3WimaxSNRtoBLERTestCase::Ns3WimaxSNRtoBLERTestCase () :
15.143 + TestCase ("Test the SNR to block error rate module")
15.144 +{
15.145 +}
15.146 +
15.147 +Ns3WimaxSNRtoBLERTestCase::~Ns3WimaxSNRtoBLERTestCase ()
15.148 +{
15.149 +}
15.150 +
15.151 +bool Ns3WimaxSNRtoBLERTestCase::DoRunOnce (uint8_t modulationType)
15.152 +{
15.153 +
15.154 + SNRToBlockErrorRateManager l_SNRToBlockErrorRateManager;
15.155 + l_SNRToBlockErrorRateManager.LoadTraces ();
15.156 + SNRToBlockErrorRateRecord * BLERRec;
15.157 +
15.158 + for (double i = -5; i < 40; i += 0.1)
15.159 + {
15.160 + BLERRec = l_SNRToBlockErrorRateManager.GetSNRToBlockErrorRateRecord (i,
15.161 + modulationType);
15.162 +
15.163 + delete BLERRec;
15.164 + }
15.165 + return false;
15.166 +}
15.167 +
15.168 +bool Ns3WimaxSNRtoBLERTestCase::DoRun (void)
15.169 +{
15.170 + for (int i = 0; i < 7; i++)
15.171 + {
15.172 + DoRunOnce(i);
15.173 + }
15.174 +
15.175 + return false;
15.176 +}
15.177 +
15.178 +
15.179 +/*
15.180 + * The test suite
15.181 + */
15.182 +class Ns3WimaxPhyTestSuite: public TestSuite
15.183 +{
15.184 +public:
15.185 + Ns3WimaxPhyTestSuite ();
15.186 +};
15.187 +Ns3WimaxPhyTestSuite::Ns3WimaxPhyTestSuite () :
15.188 + TestSuite ("wimax-phy-layer", UNIT)
15.189 +{
15.190 + AddTestCase (new Ns3WimaxSimpleOFDMTestCase);
15.191 + AddTestCase (new Ns3WimaxSNRtoBLERTestCase);
15.192 +}
15.193 +
15.194 +Ns3WimaxPhyTestSuite ns3WimaxPhyTestSuite;
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/src/devices/wimax/wimax-qos-test.cc Tue Nov 10 14:36:17 2009 +0100
16.3 @@ -0,0 +1,517 @@
16.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
16.5 +/*
16.6 + * Copyright (c) 2007,2008, 2009 INRIA, UDcast
16.7 + *
16.8 + * This program is free software; you can redistribute it and/or modify
16.9 + * it under the terms of the GNU General Public License version 2 as
16.10 + * published by the Free Software Foundation;
16.11 + *
16.12 + * This program is distributed in the hope that it will be useful,
16.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.15 + * GNU General Public License for more details.
16.16 + *
16.17 + * You should have received a copy of the GNU General Public License
16.18 + * along with this program; if not, write to the Free Software
16.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16.20 + *
16.21 + * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
16.22 + * <amine.ismail@udcast.com>
16.23 + */
16.24 +#include "ns3/log.h"
16.25 +#include "ns3/abort.h"
16.26 +#include "ns3/test.h"
16.27 +#include "ns3/config.h"
16.28 +#include "ns3/string.h"
16.29 +#include "ns3/uinteger.h"
16.30 +#include "ns3/inet-socket-address.h"
16.31 +#include "ns3/point-to-point-helper.h"
16.32 +#include "ns3/internet-stack-helper.h"
16.33 +#include "ns3/ipv4-address-helper.h"
16.34 +#include "ns3/ipv4-header.h"
16.35 +#include "ns3/packet-sink-helper.h"
16.36 +#include "ns3/udp-helper.h"
16.37 +#include "ns3/simulator.h"
16.38 +#include "ns3/wimax-helper.h"
16.39 +#include "ns3/mobility-helper.h"
16.40 +#include <iostream>
16.41 +#include "ns3/global-route-manager.h"
16.42 +
16.43 +using namespace ns3;
16.44 +
16.45 +class Ns3WimaxSchedulingTestCase: public TestCase
16.46 +{
16.47 +public:
16.48 + Ns3WimaxSchedulingTestCase ();
16.49 + virtual ~Ns3WimaxSchedulingTestCase ();
16.50 +
16.51 +private:
16.52 + virtual bool DoRun (void);
16.53 + virtual bool RunOnce (WimaxHelper::SchedulerType scheduler);
16.54 +
16.55 +};
16.56 +
16.57 +Ns3WimaxSchedulingTestCase::Ns3WimaxSchedulingTestCase () :
16.58 + TestCase ("Test the 3 different schedulers")
16.59 +{
16.60 +}
16.61 +
16.62 +Ns3WimaxSchedulingTestCase::~Ns3WimaxSchedulingTestCase ()
16.63 +{
16.64 +}
16.65 +
16.66 +bool Ns3WimaxSchedulingTestCase::RunOnce (WimaxHelper::SchedulerType scheduler)
16.67 +{
16.68 + //default values
16.69 + int duration = 2;
16.70 + //WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
16.71 + TimeStepPrecision::Set (TimeStepPrecision::FS);
16.72 +
16.73 + NodeContainer ssNodes;
16.74 + NodeContainer bsNodes;
16.75 +
16.76 + ssNodes.Create (2);
16.77 + bsNodes.Create (1);
16.78 +
16.79 + WimaxHelper wimax;
16.80 +
16.81 + NetDeviceContainer ssDevs, bsDevs;
16.82 +
16.83 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
16.84 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
16.85 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
16.86 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
16.87 +
16.88 + ssDevs.Get (0)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.89 + WimaxPhy::MODULATION_TYPE_QAM16_12);
16.90 + ssDevs.Get (1)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.91 + WimaxPhy::MODULATION_TYPE_QAM16_12);
16.92 +
16.93 + bsDevs.Get (0)->GetObject<WimaxBaseStationNetDevice> ();
16.94 +
16.95 + InternetStackHelper stack;
16.96 + stack.Install (bsNodes);
16.97 + stack.Install (ssNodes);
16.98 +
16.99 + Ipv4AddressHelper address;
16.100 + address.SetBase ("10.1.1.0", "255.255.255.0");
16.101 +
16.102 + Ipv4InterfaceContainer SSinterfaces = address.Assign (ssDevs);
16.103 + Ipv4InterfaceContainer BSinterface = address.Assign (bsDevs);
16.104 +
16.105 + /*------------------------------*/
16.106 + UdpServerHelper * udpServer;
16.107 + ApplicationContainer serverApps;
16.108 + UdpClientHelper * udpClient;
16.109 + ApplicationContainer clientApps;
16.110 +
16.111 + // set server port to 100+(i*10)
16.112 + udpServer = new UdpServerHelper (100);
16.113 +
16.114 + serverApps = udpServer->Install (ssNodes.Get (0));
16.115 + serverApps.Start (Seconds (1));
16.116 + serverApps.Stop (Seconds (duration));
16.117 +
16.118 + udpClient = new UdpClientHelper (SSinterfaces.GetAddress (0), 100);
16.119 +
16.120 + clientApps = udpClient->Install (ssNodes.Get (1));
16.121 + clientApps.Start (Seconds (1));
16.122 + clientApps.Stop (Seconds (duration));
16.123 +
16.124 + Simulator::Stop (Seconds (duration + 0.1));
16.125 + QoSParameterSet* RTPSparameterSet[2];
16.126 + QoSParameterSet* BEparameterSet[2];
16.127 + QoSParameterSet* UGSparameterSet[2];
16.128 + for (int i = 0; i < 2; i++)
16.129 + {
16.130 + RTPSparameterSet[i] = wimax.CreateRtpsParameterSet (12176, 2000000, 700,
16.131 + 20);
16.132 +
16.133 + // For MBQOS scheduler we need 2 more connections
16.134 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 1000, 100);
16.135 + BEparameterSet[i] = wimax.CreateBeParameterSet (100);
16.136 +
16.137 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.138 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.139 + WimaxBaseStationNetDevice> (), RTPSparameterSet[i],
16.140 + QoSParameterSet::SCHEDULING_TYPE_RTPS);
16.141 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.142 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.143 + WimaxBaseStationNetDevice> (), UGSparameterSet[i],
16.144 + QoSParameterSet::SCHEDULING_TYPE_UGS);
16.145 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.146 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.147 + WimaxBaseStationNetDevice> (), BEparameterSet[i],
16.148 + QoSParameterSet::SCHEDULING_TYPE_BE);
16.149 +
16.150 + }
16.151 +
16.152 + /*
16.153 + * configure the classifier of the sender SS (1) and the classifier of the BS.
16.154 + * set the source port to any (0)
16.155 + * set the protocol to UDP (17)
16.156 + * and the serviceFlow to UGS
16.157 + */
16.158 +
16.159 + wimax.ClassifierConfig (ssDevs.Get (1)->GetObject<
16.160 + WimaxSubscriberStationNetDevice> (), ssDevs.Get (0)->GetObject<
16.161 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.162 + WimaxBaseStationNetDevice> (), SSinterfaces.GetAddress (1),
16.163 + SSinterfaces.GetAddress (0), 0, 100, 17, ServiceFlow::SFID_TYPE_RTPS);
16.164 +
16.165 + Simulator::Run ();
16.166 + if ((udpServer->GetServer ()->GetLost () != 0)
16.167 + || (udpServer->GetServer ()->GetReceived () == 0))
16.168 + {
16.169 + return true; // there was an error
16.170 + }
16.171 +
16.172 + Simulator::Destroy ();
16.173 + return (false);
16.174 +
16.175 +}
16.176 +
16.177 +bool Ns3WimaxSchedulingTestCase::DoRun ()
16.178 +{
16.179 +
16.180 + if (RunOnce (WimaxHelper::SCHED_TYPE_MBQOS) != false)
16.181 + {
16.182 + return true;
16.183 + }
16.184 + if (RunOnce (WimaxHelper::SCHED_TYPE_SIMPLE) != false)
16.185 + {
16.186 + return true;
16.187 + }
16.188 + if (RunOnce (WimaxHelper::SCHED_TYPE_RTPS) != false)
16.189 + {
16.190 + return true;
16.191 + }
16.192 + return false;
16.193 +}
16.194 +
16.195 +//=============================================================================
16.196 +class Ns3WimaxMCSTestCase: public TestCase
16.197 +{
16.198 +public:
16.199 + Ns3WimaxMCSTestCase ();
16.200 + virtual ~Ns3WimaxMCSTestCase ();
16.201 +
16.202 +private:
16.203 + virtual bool DoRun (void);
16.204 + virtual bool RunOnce (WimaxPhy::ModulationType modulationType);
16.205 +
16.206 +};
16.207 +
16.208 +Ns3WimaxMCSTestCase::Ns3WimaxMCSTestCase () :
16.209 + TestCase ("Test the 6 different Modulation and coding schemes")
16.210 +{
16.211 +}
16.212 +
16.213 +Ns3WimaxMCSTestCase::~Ns3WimaxMCSTestCase ()
16.214 +{
16.215 +}
16.216 +
16.217 +bool Ns3WimaxMCSTestCase::RunOnce (WimaxPhy::ModulationType modulationType)
16.218 +{
16.219 + //default values
16.220 + int duration = 2;
16.221 + //WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
16.222 + TimeStepPrecision::Set (TimeStepPrecision::FS);
16.223 +
16.224 + NodeContainer ssNodes;
16.225 + NodeContainer bsNodes;
16.226 +
16.227 + ssNodes.Create (2);
16.228 + bsNodes.Create (1);
16.229 +
16.230 + WimaxHelper wimax;
16.231 +
16.232 + NetDeviceContainer ssDevs, bsDevs;
16.233 +
16.234 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
16.235 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, WimaxHelper::SCHED_TYPE_SIMPLE);
16.236 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
16.237 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, WimaxHelper::SCHED_TYPE_SIMPLE);
16.238 +
16.239 + ssDevs.Get (0)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.240 + modulationType);
16.241 + ssDevs.Get (1)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.242 + modulationType);
16.243 +
16.244 + bsDevs.Get (0)->GetObject<WimaxBaseStationNetDevice> ();
16.245 +
16.246 + InternetStackHelper stack;
16.247 + stack.Install (bsNodes);
16.248 + stack.Install (ssNodes);
16.249 +
16.250 + Ipv4AddressHelper address;
16.251 + address.SetBase ("10.1.1.0", "255.255.255.0");
16.252 +
16.253 + Ipv4InterfaceContainer SSinterfaces = address.Assign (ssDevs);
16.254 + Ipv4InterfaceContainer BSinterface = address.Assign (bsDevs);
16.255 +
16.256 + /*------------------------------*/
16.257 + UdpServerHelper * udpServer;
16.258 + ApplicationContainer serverApps;
16.259 + UdpClientHelper * udpClient;
16.260 + ApplicationContainer clientApps;
16.261 +
16.262 + // set server port to 100+(i*10)
16.263 + udpServer = new UdpServerHelper (100);
16.264 +
16.265 + serverApps = udpServer->Install (ssNodes.Get (0));
16.266 + serverApps.Start (Seconds (1));
16.267 + serverApps.Stop (Seconds (duration));
16.268 +
16.269 + udpClient = new UdpClientHelper (SSinterfaces.GetAddress (0), 100);
16.270 +
16.271 + clientApps = udpClient->Install (ssNodes.Get (1));
16.272 + clientApps.Start (Seconds (1));
16.273 + clientApps.Stop (Seconds (duration));
16.274 +
16.275 + Simulator::Stop (Seconds (duration + 0.1));
16.276 + QoSParameterSet* UGSparameterSet[2];
16.277 + for (int i = 0; i < 2; i++)
16.278 + {
16.279 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 100, 10);
16.280 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.281 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.282 + WimaxBaseStationNetDevice> (), UGSparameterSet[i],
16.283 + QoSParameterSet::SCHEDULING_TYPE_UGS);
16.284 + }
16.285 +
16.286 + /*
16.287 + * configure the classifier of the sender SS (1) and the classifier of the BS.
16.288 + * set the source port to any (0)
16.289 + * set the protocol to UDP (17)
16.290 + * and the serviceFlow to UGS
16.291 + */
16.292 +
16.293 + wimax.ClassifierConfig (ssDevs.Get (1)->GetObject<
16.294 + WimaxSubscriberStationNetDevice> (), ssDevs.Get (0)->GetObject<
16.295 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.296 + WimaxBaseStationNetDevice> (), SSinterfaces.GetAddress (1),
16.297 + SSinterfaces.GetAddress (0), 0, 100, 17, ServiceFlow::SFID_TYPE_UGS);
16.298 +
16.299 + Simulator::Run ();
16.300 + if ((udpServer->GetServer ()->GetLost () != 0)
16.301 + || (udpServer->GetServer ()->GetReceived () == 0))
16.302 + {
16.303 + return true; // there was an error
16.304 + }
16.305 +
16.306 + Simulator::Destroy ();
16.307 + return (false);
16.308 +
16.309 +}
16.310 +
16.311 +bool Ns3WimaxMCSTestCase::DoRun ()
16.312 +{
16.313 + if (RunOnce (WimaxPhy::MODULATION_TYPE_QPSK_12) != false)
16.314 + {
16.315 + return true;
16.316 + }
16.317 + if (RunOnce (WimaxPhy::MODULATION_TYPE_QPSK_34) != false)
16.318 + {
16.319 + return true;
16.320 + }
16.321 +
16.322 + if (RunOnce (WimaxPhy::MODULATION_TYPE_QAM16_12) != false)
16.323 + {
16.324 + return true;
16.325 + }
16.326 + if (RunOnce (WimaxPhy::MODULATION_TYPE_QAM64_23) != false)
16.327 + {
16.328 + return true;
16.329 + }
16.330 + if (RunOnce (WimaxPhy::MODULATION_TYPE_QAM64_34) != false)
16.331 + {
16.332 + return true;
16.333 + }
16.334 +
16.335 + return false;
16.336 +}
16.337 +
16.338 +//=============================================================================
16.339 +class Ns3WimaxSFTypeTestCase: public TestCase
16.340 +{
16.341 +public:
16.342 + Ns3WimaxSFTypeTestCase ();
16.343 + virtual ~Ns3WimaxSFTypeTestCase ();
16.344 +
16.345 +private:
16.346 + virtual bool DoRun (void);
16.347 + virtual bool RunOnce (QoSParameterSet::SchedulingType QoS);
16.348 +
16.349 +};
16.350 +
16.351 +Ns3WimaxSFTypeTestCase::Ns3WimaxSFTypeTestCase () :
16.352 + TestCase ("Test the 3 implemented types of service flows")
16.353 +{
16.354 +}
16.355 +
16.356 +Ns3WimaxSFTypeTestCase::~Ns3WimaxSFTypeTestCase ()
16.357 +{
16.358 +}
16.359 +
16.360 +bool Ns3WimaxSFTypeTestCase::RunOnce (QoSParameterSet::SchedulingType QoS)
16.361 +{
16.362 + //default values
16.363 + int duration = 4;
16.364 + //WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
16.365 + TimeStepPrecision::Set (TimeStepPrecision::FS);
16.366 +
16.367 + NodeContainer ssNodes;
16.368 + NodeContainer bsNodes;
16.369 +
16.370 + ssNodes.Create (2);
16.371 + bsNodes.Create (1);
16.372 +
16.373 + WimaxHelper wimax;
16.374 +
16.375 + NetDeviceContainer ssDevs, bsDevs;
16.376 +
16.377 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
16.378 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, WimaxHelper::SCHED_TYPE_SIMPLE);
16.379 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
16.380 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, WimaxHelper::SCHED_TYPE_SIMPLE);
16.381 +
16.382 + ssDevs.Get (0)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.383 + WimaxPhy::MODULATION_TYPE_QAM16_12);
16.384 + ssDevs.Get (1)->GetObject<WimaxSubscriberStationNetDevice> ()->SetModulationType (
16.385 + WimaxPhy::MODULATION_TYPE_QAM16_12);
16.386 +
16.387 + bsDevs.Get (0)->GetObject<WimaxBaseStationNetDevice> ();
16.388 +
16.389 + InternetStackHelper stack;
16.390 + stack.Install (bsNodes);
16.391 + stack.Install (ssNodes);
16.392 +
16.393 + Ipv4AddressHelper address;
16.394 + address.SetBase ("10.1.1.0", "255.255.255.0");
16.395 +
16.396 + Ipv4InterfaceContainer SSinterfaces = address.Assign (ssDevs);
16.397 + Ipv4InterfaceContainer BSinterface = address.Assign (bsDevs);
16.398 +
16.399 + /*------------------------------*/
16.400 + UdpServerHelper * udpServer;
16.401 + ApplicationContainer serverApps;
16.402 + UdpClientHelper * udpClient;
16.403 + ApplicationContainer clientApps;
16.404 +
16.405 + // set server port to 100+(i*10)
16.406 + udpServer = new UdpServerHelper (100);
16.407 +
16.408 + serverApps = udpServer->Install (ssNodes.Get (0));
16.409 + serverApps.Start (Seconds (1));
16.410 + serverApps.Stop (Seconds (duration));
16.411 +
16.412 + udpClient = new UdpClientHelper (SSinterfaces.GetAddress (0), 100);
16.413 +
16.414 + clientApps = udpClient->Install (ssNodes.Get (1));
16.415 + clientApps.Start (Seconds (1));
16.416 + clientApps.Stop (Seconds (duration));
16.417 +
16.418 + Simulator::Stop (Seconds (duration + 0.1));
16.419 + QoSParameterSet* RTPSparameterSet[2];
16.420 + QoSParameterSet* BEparameterSet[2];
16.421 + QoSParameterSet* UGSparameterSet[2];
16.422 + for (int i = 0; i < 2; i++)
16.423 + {
16.424 +
16.425 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 1000, 100);
16.426 + RTPSparameterSet[i] = wimax.CreateRtpsParameterSet (12176, 2000000, 700,
16.427 + 20);
16.428 + BEparameterSet[i] = wimax.CreateBeParameterSet (100);
16.429 +
16.430 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 100, 10);
16.431 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.432 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.433 + WimaxBaseStationNetDevice> (), UGSparameterSet[i],
16.434 + QoSParameterSet::SCHEDULING_TYPE_UGS);
16.435 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.436 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.437 + WimaxBaseStationNetDevice> (), BEparameterSet[i],
16.438 + QoSParameterSet::SCHEDULING_TYPE_BE);
16.439 + wimax.SetupConnection (ssDevs.Get (i)->GetObject<
16.440 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.441 + WimaxBaseStationNetDevice> (), RTPSparameterSet[i],
16.442 + QoSParameterSet::SCHEDULING_TYPE_RTPS);
16.443 +
16.444 + if (QoS == QoSParameterSet::SCHEDULING_TYPE_UGS)
16.445 + {
16.446 + wimax.ClassifierConfig (ssDevs.Get (1)->GetObject<
16.447 + WimaxSubscriberStationNetDevice> (), ssDevs.Get (0)->GetObject<
16.448 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.449 + WimaxBaseStationNetDevice> (), SSinterfaces.GetAddress (1),
16.450 + SSinterfaces.GetAddress (0), 0, 100, 17,
16.451 + ServiceFlow::SFID_TYPE_UGS);
16.452 + }
16.453 + if (QoS == QoSParameterSet::SCHEDULING_TYPE_BE)
16.454 + {
16.455 + wimax.ClassifierConfig (ssDevs.Get (1)->GetObject<
16.456 + WimaxSubscriberStationNetDevice> (), ssDevs.Get (0)->GetObject<
16.457 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.458 + WimaxBaseStationNetDevice> (), SSinterfaces.GetAddress (1),
16.459 + SSinterfaces.GetAddress (0), 0, 100, 17,
16.460 + ServiceFlow::SFID_TYPE_BE);
16.461 + }
16.462 + if (QoS == QoSParameterSet::SCHEDULING_TYPE_RTPS)
16.463 + {
16.464 + wimax.ClassifierConfig (ssDevs.Get (1)->GetObject<
16.465 + WimaxSubscriberStationNetDevice> (), ssDevs.Get (0)->GetObject<
16.466 + WimaxSubscriberStationNetDevice> (), bsDevs.Get (0)->GetObject<
16.467 + WimaxBaseStationNetDevice> (), SSinterfaces.GetAddress (1),
16.468 + SSinterfaces.GetAddress (0), 0, 100, 17,
16.469 + ServiceFlow::SFID_TYPE_RTPS);
16.470 + }
16.471 +
16.472 + }
16.473 +
16.474 + Simulator::Run ();
16.475 + if ((udpServer->GetServer ()->GetLost () != 0)
16.476 + || (udpServer->GetServer ()->GetReceived () == 0))
16.477 + {
16.478 + return true; // there was an error
16.479 + }
16.480 +
16.481 + Simulator::Destroy ();
16.482 + return (false);
16.483 +
16.484 +}
16.485 +
16.486 +bool Ns3WimaxSFTypeTestCase::DoRun ()
16.487 +{
16.488 + if (RunOnce (QoSParameterSet::SCHEDULING_TYPE_UGS) != false)
16.489 + {
16.490 + return true;
16.491 + }
16.492 + if (RunOnce (QoSParameterSet::SCHEDULING_TYPE_BE) != false)
16.493 + {
16.494 + return true;
16.495 + }
16.496 + if (RunOnce (QoSParameterSet::SCHEDULING_TYPE_RTPS) != false)
16.497 + {
16.498 + return true;
16.499 + }
16.500 +
16.501 + return false;
16.502 +}
16.503 +
16.504 +class Ns3WimaxQoSTestSuite: public TestSuite
16.505 +{
16.506 +public:
16.507 + Ns3WimaxQoSTestSuite ();
16.508 +};
16.509 +
16.510 +Ns3WimaxQoSTestSuite::Ns3WimaxQoSTestSuite () :
16.511 + TestSuite ("ns3-wimax-qos", SYSTEM)
16.512 +{
16.513 + //LogComponentEnable ("UdpClientApplication", LOG_LEVEL_INFO);
16.514 + //LogComponentEnable ("SimpleOfdmWimaxPhy", LOG_LEVEL_INFO);
16.515 + AddTestCase (new Ns3WimaxSchedulingTestCase);
16.516 + AddTestCase (new Ns3WimaxMCSTestCase);
16.517 + AddTestCase (new Ns3WimaxSFTypeTestCase);
16.518 +}
16.519 +
16.520 +Ns3WimaxQoSTestSuite ns3WimaxQoSTestSuite;
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/src/devices/wimax/wimax-ss-mac-test.cc Tue Nov 10 14:36:17 2009 +0100
17.3 @@ -0,0 +1,479 @@
17.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
17.5 +/*
17.6 + * Copyright (c) 2007,2008, 2009 INRIA, UDcast
17.7 + *
17.8 + * This program is free software; you can redistribute it and/or modify
17.9 + * it under the terms of the GNU General Public License version 2 as
17.10 + * published by the Free Software Foundation;
17.11 + *
17.12 + * This program is distributed in the hope that it will be useful,
17.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17.15 + * GNU General Public License for more details.
17.16 + *
17.17 + * You should have received a copy of the GNU General Public License
17.18 + * along with this program; if not, write to the Free Software
17.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17.20 + *
17.21 + * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
17.22 + * <amine.ismail@udcast.com>
17.23 + */
17.24 +#include "ns3/log.h"
17.25 +#include "ns3/abort.h"
17.26 +#include "ns3/test.h"
17.27 +#include "ns3/config.h"
17.28 +#include "ns3/string.h"
17.29 +#include "ns3/uinteger.h"
17.30 +#include "ns3/inet-socket-address.h"
17.31 +#include "ns3/point-to-point-helper.h"
17.32 +#include "ns3/internet-stack-helper.h"
17.33 +#include "ns3/ipv4-address-helper.h"
17.34 +#include "ns3/ipv4-header.h"
17.35 +#include "ns3/packet-sink-helper.h"
17.36 +#include "ns3/udp-helper.h"
17.37 +#include "ns3/udp-header.h"
17.38 +#include "ns3/simulator.h"
17.39 +#include "ns3/wimax-helper.h"
17.40 +#include "ns3/mobility-helper.h"
17.41 +#include <iostream>
17.42 +#include "ns3/global-route-manager.h"
17.43 +
17.44 +using namespace ns3;
17.45 +
17.46 +/*
17.47 + * Test the network entry procedure.
17.48 + * Create a network with a BS and 10 SS and check that all the SS perform the
17.49 + * network entry correctly
17.50 + *
17.51 + */
17.52 +class Ns3WimaxNetworkEntryTestCase : public TestCase
17.53 +{
17.54 +public:
17.55 + Ns3WimaxNetworkEntryTestCase ();
17.56 + virtual
17.57 + ~Ns3WimaxNetworkEntryTestCase ();
17.58 +
17.59 +private:
17.60 + virtual bool
17.61 + DoRun (void);
17.62 +
17.63 +};
17.64 +
17.65 +Ns3WimaxNetworkEntryTestCase::Ns3WimaxNetworkEntryTestCase () :
17.66 + TestCase ("Test the network entry procedure")
17.67 +{
17.68 +}
17.69 +
17.70 +Ns3WimaxNetworkEntryTestCase::~Ns3WimaxNetworkEntryTestCase ()
17.71 +{
17.72 +}
17.73 +
17.74 +bool
17.75 +Ns3WimaxNetworkEntryTestCase::DoRun (void)
17.76 +{
17.77 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
17.78 + TimeStepPrecision::Set (TimeStepPrecision::FS);
17.79 + NodeContainer ssNodes;
17.80 + NodeContainer bsNodes;
17.81 +
17.82 + ssNodes.Create (10);
17.83 + bsNodes.Create (1);
17.84 +
17.85 + WimaxHelper wimax;
17.86 +
17.87 + NetDeviceContainer ssDevs, bsDevs;
17.88 +
17.89 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
17.90 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.91 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
17.92 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.93 + Simulator::Stop (Seconds (0.5));
17.94 + Simulator::Run ();
17.95 + for (int i = 0; i < 10; i++)
17.96 + {
17.97 + if (ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ()->IsRegistered ()
17.98 + == false)
17.99 + {
17.100 + return true; // Test fail because SS[i] is not registered
17.101 + }
17.102 + }
17.103 + Simulator::Destroy ();
17.104 + return (false); // Test was ok, all the SS are registered
17.105 +
17.106 +}
17.107 +
17.108 +/*
17.109 + * Test if the management connections are correctly setup.
17.110 + * Create a network with a BS and 10 SS and check that the management
17.111 + * connections are correctly setup for all SS
17.112 + *
17.113 + */
17.114 +
17.115 +class Ns3WimaxManagementConnectionsTestCase : public TestCase
17.116 +{
17.117 +public:
17.118 + Ns3WimaxManagementConnectionsTestCase ();
17.119 + virtual
17.120 + ~Ns3WimaxManagementConnectionsTestCase ();
17.121 +
17.122 +private:
17.123 + virtual bool
17.124 + DoRun (void);
17.125 +
17.126 +};
17.127 +
17.128 +Ns3WimaxManagementConnectionsTestCase::Ns3WimaxManagementConnectionsTestCase () :
17.129 + TestCase ("Test if the management connections are correctly setup")
17.130 +{
17.131 +}
17.132 +
17.133 +Ns3WimaxManagementConnectionsTestCase::~Ns3WimaxManagementConnectionsTestCase ()
17.134 +{
17.135 +}
17.136 +
17.137 +bool
17.138 +Ns3WimaxManagementConnectionsTestCase::DoRun (void)
17.139 +{
17.140 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
17.141 + TimeStepPrecision::Set (TimeStepPrecision::FS);
17.142 + NodeContainer ssNodes;
17.143 + NodeContainer bsNodes;
17.144 +
17.145 + ssNodes.Create (10);
17.146 + bsNodes.Create (1);
17.147 +
17.148 + WimaxHelper wimax;
17.149 +
17.150 + NetDeviceContainer ssDevs, bsDevs;
17.151 +
17.152 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
17.153 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.154 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
17.155 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.156 + Simulator::Stop (Seconds (0.5));
17.157 + Simulator::Run ();
17.158 + for (int i = 0; i < 10; i++)
17.159 + {
17.160 + if (ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ()->GetAreManagementConnectionsAllocated ()
17.161 + == false)
17.162 + {
17.163 + return true; // Test fail because management connections of SS[i] are not allocated
17.164 + }
17.165 + }
17.166 + Simulator::Destroy ();
17.167 + return (false);
17.168 +
17.169 +}
17.170 +
17.171 +/*
17.172 + * Test if service flows are correctly setup.
17.173 + * Create a network with a BS and 10 SS and check that all the SS can create
17.174 + * 3 service flows
17.175 + *
17.176 + */
17.177 +
17.178 +class Ns3WimaxServiceFlowsCreationTestCase : public TestCase
17.179 +{
17.180 +public:
17.181 + Ns3WimaxServiceFlowsCreationTestCase ();
17.182 + virtual
17.183 + ~Ns3WimaxServiceFlowsCreationTestCase ();
17.184 +
17.185 +private:
17.186 + virtual bool
17.187 + DoRun (void);
17.188 +
17.189 +};
17.190 +
17.191 +Ns3WimaxServiceFlowsCreationTestCase::Ns3WimaxServiceFlowsCreationTestCase () :
17.192 + TestCase ("Test if service flows are correctly setup")
17.193 +{
17.194 +}
17.195 +
17.196 +Ns3WimaxServiceFlowsCreationTestCase::~Ns3WimaxServiceFlowsCreationTestCase ()
17.197 +{
17.198 +}
17.199 +
17.200 +bool
17.201 +Ns3WimaxServiceFlowsCreationTestCase::DoRun (void)
17.202 +{
17.203 +
17.204 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
17.205 + TimeStepPrecision::Set (TimeStepPrecision::FS);
17.206 + NodeContainer ssNodes;
17.207 + NodeContainer bsNodes;
17.208 + ssNodes.Create (10);
17.209 + bsNodes.Create (1);
17.210 +
17.211 + WimaxHelper wimax;
17.212 +
17.213 + NetDeviceContainer ssDevs, bsDevs;
17.214 +
17.215 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
17.216 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.217 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
17.218 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.219 +
17.220 + QoSParameterSet* UGSparameterSet[10];
17.221 + QoSParameterSet* RTPSparameterSet[10];
17.222 + QoSParameterSet* BEparameterSet[10];
17.223 +
17.224 + Ptr<WimaxBaseStationNetDevice> bs = bsDevs.Get (0)->GetObject<
17.225 + WimaxBaseStationNetDevice> ();
17.226 + Ptr<WimaxSubscriberStationNetDevice> ss;
17.227 +
17.228 + for (int i = 0; i < 10; i++)
17.229 + {
17.230 + ss = ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ();
17.231 + ss->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
17.232 +
17.233 + UGSparameterSet[i] = wimax.CreateUgsParameterSet (1000000, 1000, 100);
17.234 + RTPSparameterSet[i] = wimax.CreateRtpsParameterSet (12176, 2000000, 700,
17.235 + 20);
17.236 + BEparameterSet[i] = wimax.CreateBeParameterSet (100);
17.237 +
17.238 + wimax.SetupConnection (ss, bs, UGSparameterSet[i],
17.239 + QoSParameterSet::SCHEDULING_TYPE_UGS);
17.240 + wimax.SetupConnection (ss, bs, RTPSparameterSet[i],
17.241 + QoSParameterSet::SCHEDULING_TYPE_RTPS);
17.242 + wimax.SetupConnection (ss, bs, BEparameterSet[i],
17.243 + QoSParameterSet::SCHEDULING_TYPE_BE);
17.244 +
17.245 + }
17.246 + Simulator::Stop (Seconds (0.5));
17.247 + Simulator::Run ();
17.248 + for (int i = 0; i < 10; i++)
17.249 + {
17.250 + ss = ssDevs.Get (i)->GetObject<WimaxSubscriberStationNetDevice> ();
17.251 + int nb = ss->GetServiceFlowManager ()->GetServiceFlows (
17.252 + QoSParameterSet::SCHEDULING_TYPE_ALL)->size ();
17.253 + if (nb != 3)
17.254 + {
17.255 + return true; //Test fail because SS[i] has not 3 service flows
17.256 + }
17.257 + }
17.258 + Simulator::Destroy ();
17.259 + return (false);
17.260 +
17.261 +}
17.262 +
17.263 +/*
17.264 + * Test the IP packet classifier of subscriber station
17.265 + *
17.266 + */
17.267 +
17.268 +class Ns3WimaxSSClassifierTestCase : public TestCase
17.269 +{
17.270 +public:
17.271 + Ns3WimaxSSClassifierTestCase ();
17.272 + virtual
17.273 + ~Ns3WimaxSSClassifierTestCase ();
17.274 +
17.275 +private:
17.276 + virtual bool
17.277 + DoRun (void);
17.278 +
17.279 +};
17.280 +
17.281 +Ns3WimaxSSClassifierTestCase::Ns3WimaxSSClassifierTestCase () :
17.282 + TestCase ("Test the IP packet classifier")
17.283 +{
17.284 +}
17.285 +
17.286 +Ns3WimaxSSClassifierTestCase::~Ns3WimaxSSClassifierTestCase ()
17.287 +{
17.288 +}
17.289 +
17.290 +bool
17.291 +Ns3WimaxSSClassifierTestCase::DoRun (void)
17.292 +{
17.293 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
17.294 + TimeStepPrecision::Set (TimeStepPrecision::FS);
17.295 + NodeContainer ssNodes;
17.296 + NodeContainer bsNodes;
17.297 + ssNodes.Create (1);
17.298 + bsNodes.Create (1);
17.299 +
17.300 + WimaxHelper wimax;
17.301 +
17.302 + NetDeviceContainer ssDevs, bsDevs;
17.303 +
17.304 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
17.305 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.306 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
17.307 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.308 +
17.309 + QoSParameterSet* UGSparameterSet;
17.310 + QoSParameterSet* RTPSparameterSet;
17.311 + QoSParameterSet* BEparameterSet;
17.312 +
17.313 + Ptr<WimaxBaseStationNetDevice> bs = bsDevs.Get (0)->GetObject<
17.314 + WimaxBaseStationNetDevice> ();
17.315 + Ptr<WimaxSubscriberStationNetDevice> ss = ssDevs.Get (0)->GetObject<
17.316 + WimaxSubscriberStationNetDevice> ();
17.317 +
17.318 + ss->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
17.319 +
17.320 + UGSparameterSet = wimax.CreateUgsParameterSet (1000000, 1000, 100);
17.321 + RTPSparameterSet = wimax.CreateRtpsParameterSet (12176, 2000000, 700, 20);
17.322 + BEparameterSet = wimax.CreateBeParameterSet (100);
17.323 +
17.324 + wimax.SetupConnection (ss, bs, UGSparameterSet,
17.325 + QoSParameterSet::SCHEDULING_TYPE_UGS);
17.326 + wimax.SetupConnection (ss, bs, RTPSparameterSet,
17.327 + QoSParameterSet::SCHEDULING_TYPE_RTPS);
17.328 + wimax.SetupConnection (ss, bs, BEparameterSet,
17.329 + QoSParameterSet::SCHEDULING_TYPE_BE);
17.330 +
17.331 + Ipv4Address srcUGS, dstUGS, srcRTPS, dstRTPS, srcBE, dstBE;
17.332 + uint16_t portUGS = 1000, portRTPS = 2000, portBE = 3000;
17.333 + srcUGS.Set ("10.10.10.10");
17.334 + dstUGS.Set ("20.20.20.20");
17.335 + srcRTPS.Set ("11.11.11.11");
17.336 + dstRTPS.Set ("21.21.21.21");
17.337 + srcBE.Set ("12.12.12.12");
17.338 + dstBE.Set ("22.22.22.22");
17.339 +
17.340 + wimax.SSClassifierConfig (ss, srcRTPS, dstRTPS, 0, portRTPS, 17,
17.341 + ServiceFlow::SFID_TYPE_RTPS);
17.342 + wimax.SSClassifierConfig (ss, srcUGS, dstUGS, 0, portUGS, 17,
17.343 + ServiceFlow::SFID_TYPE_UGS);
17.344 + wimax.SSClassifierConfig (ss, srcBE, dstBE, 0, portBE, 17,
17.345 + ServiceFlow::SFID_TYPE_BE);
17.346 +
17.347 + Simulator::Stop (Seconds (0.5));
17.348 + Simulator::Run ();
17.349 + if (ss->GetIpcsClassifier ()->GetIpcsBindParameterManager ()->GetSfidClassifierRecord (
17.350 + srcRTPS, dstRTPS, 0, portRTPS, 17) != ServiceFlow::SFID_TYPE_RTPS)
17.351 + {
17.352 + return true;
17.353 + }
17.354 + if (ss->GetIpcsClassifier ()->GetIpcsBindParameterManager ()->GetSfidClassifierRecord (
17.355 + srcUGS, dstUGS, 0, portUGS, 17) != ServiceFlow::SFID_TYPE_UGS)
17.356 + {
17.357 + return true;
17.358 + }
17.359 + if (ss->GetIpcsClassifier ()->GetIpcsBindParameterManager ()->GetSfidClassifierRecord (
17.360 + srcBE, dstBE, 0, portBE, 17) != ServiceFlow::SFID_TYPE_BE)
17.361 + {
17.362 + return true;
17.363 + }
17.364 +
17.365 + Simulator::Destroy ();
17.366 + return (false);
17.367 +
17.368 +}
17.369 +
17.370 +/*
17.371 + * Test that an SS can send a packet correctly
17.372 + *
17.373 + */
17.374 +
17.375 +class Ns3WimaSSSendTestCase : public TestCase
17.376 +{
17.377 +public:
17.378 + Ns3WimaSSSendTestCase ();
17.379 + virtual
17.380 + ~Ns3WimaSSSendTestCase ();
17.381 +
17.382 +private:
17.383 + virtual bool
17.384 + DoRun (void);
17.385 +
17.386 +};
17.387 +
17.388 +Ns3WimaSSSendTestCase::Ns3WimaSSSendTestCase () :
17.389 + TestCase ("Check that an SS can send a packet correctly")
17.390 +{
17.391 +}
17.392 +
17.393 +Ns3WimaSSSendTestCase::~Ns3WimaSSSendTestCase ()
17.394 +{
17.395 +}
17.396 +
17.397 +bool
17.398 +Ns3WimaSSSendTestCase::DoRun (void)
17.399 +{
17.400 +
17.401 + WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
17.402 + TimeStepPrecision::Set (TimeStepPrecision::FS);
17.403 + NodeContainer ssNodes;
17.404 + NodeContainer bsNodes;
17.405 + ssNodes.Create (2);
17.406 + bsNodes.Create (1);
17.407 +
17.408 + WimaxHelper wimax;
17.409 +
17.410 + NetDeviceContainer ssDevs, bsDevs;
17.411 +
17.412 + ssDevs = wimax.Install (ssNodes, WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
17.413 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.414 + bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION,
17.415 + WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
17.416 +
17.417 + QoSParameterSet *UGSparameterSet1, *UGSparameterSet2;
17.418 +
17.419 + Ptr<WimaxBaseStationNetDevice> bs = bsDevs.Get (0)->GetObject<
17.420 + WimaxBaseStationNetDevice> ();
17.421 + Ptr<WimaxSubscriberStationNetDevice> ss1 = ssDevs.Get (0)->GetObject<
17.422 + WimaxSubscriberStationNetDevice> ();
17.423 + Ptr<WimaxSubscriberStationNetDevice> ss2 = ssDevs.Get (1)->GetObject<
17.424 + WimaxSubscriberStationNetDevice> ();
17.425 +
17.426 + ss1->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
17.427 + ss2->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
17.428 +
17.429 + UGSparameterSet1 = wimax.CreateUgsParameterSet (1000000, 1000, 100);
17.430 + UGSparameterSet2 = wimax.CreateUgsParameterSet (1000000, 1000, 100);
17.431 + wimax.SetupConnection (ss1, bs, UGSparameterSet1,
17.432 + QoSParameterSet::SCHEDULING_TYPE_UGS);
17.433 + wimax.SetupConnection (ss2, bs, UGSparameterSet2,
17.434 + QoSParameterSet::SCHEDULING_TYPE_UGS);
17.435 +
17.436 + Ipv4Address src, dst;
17.437 + uint16_t port = 1000;
17.438 + src.Set ("10.10.10.10");
17.439 + dst.Set ("20.20.20.20");
17.440 +
17.441 + Simulator::Stop (Seconds (0.5));
17.442 + Simulator::Run ();
17.443 +
17.444 + Ptr<Packet> packet = new Packet (1200);
17.445 +
17.446 + UdpHeader UDP_Header;
17.447 + UDP_Header.SetDestinationPort (port);
17.448 + UDP_Header.SetSourcePort (7878); //any
17.449 + packet->AddHeader (UDP_Header);
17.450 +
17.451 + Ipv4Header IPV4_Header;
17.452 + IPV4_Header.SetPayloadSize (packet->GetSize ());
17.453 + IPV4_Header.SetProtocol (17); //UDP
17.454 + IPV4_Header.SetSource (src);
17.455 + IPV4_Header.SetDestination (dst);
17.456 + packet->AddHeader (IPV4_Header);
17.457 + bool res = false;
17.458 + res = ss1->Send (packet, ss2->GetMacAddress (), 2048);
17.459 +
17.460 + Simulator::Destroy ();
17.461 + return (!res);
17.462 +
17.463 +}
17.464 +
17.465 +
17.466 +class Ns3WimaxSSMacTestSuite : public TestSuite
17.467 +{
17.468 +public:
17.469 + Ns3WimaxSSMacTestSuite ();
17.470 +};
17.471 +
17.472 +Ns3WimaxSSMacTestSuite::Ns3WimaxSSMacTestSuite () :
17.473 + TestSuite ("wimax-ss-mac-layer", UNIT)
17.474 +{
17.475 + AddTestCase (new Ns3WimaxNetworkEntryTestCase);
17.476 + AddTestCase (new Ns3WimaxManagementConnectionsTestCase);
17.477 + AddTestCase (new Ns3WimaxServiceFlowsCreationTestCase);
17.478 + AddTestCase (new Ns3WimaxSSClassifierTestCase);
17.479 + AddTestCase (new Ns3WimaSSSendTestCase);
17.480 +}
17.481 +
17.482 +Ns3WimaxSSMacTestSuite ns3WimaxSSMacTestSuite;
18.1 --- a/src/devices/wimax/wimax-ss-net-device.cc Thu Oct 29 15:22:25 2009 +0100
18.2 +++ b/src/devices/wimax/wimax-ss-net-device.cc Tue Nov 10 14:36:17 2009 +0100
18.3 @@ -395,6 +395,13 @@
18.4 QoSParameterSet::SCHEDULING_TYPE_ALL)->size () > 0;
18.5 }
18.6
18.7 +IpcsSSPacketclassifier *
18.8 +WimaxSubscriberStationNetDevice::GetIpcsClassifier ()
18.9 +{
18.10 +
18.11 + return m_classifier;
18.12 +}
18.13 +
18.14 void
18.15 WimaxSubscriberStationNetDevice::Start (void)
18.16 {
18.17 @@ -946,13 +953,28 @@
18.18 && cid == GetBroadcastConnection ()->GetCid ()) //regular ranging interval
18.19
18.20 {
18.21 - m_linkManager->SetNrRangingTransOpps (
18.22 - (ulMapIe.GetDuration () * GetPhy ()->GetPsPerSymbol ())
18.23 - / GetCurrentUcd ().GetChannelEncodings ().GetRangReqOppSize ());
18.24 + if (GetCurrentUcd ().GetChannelEncodings ().GetRangReqOppSize ()
18.25 + != 0)
18.26 + {
18.27 + /*
18.28 + std::cout << "test:"
18.29 + << (ulMapIe.GetDuration () * GetPhy ()->GetPsPerSymbol ())
18.30 + / GetCurrentUcd ().GetChannelEncodings ().GetRangReqOppSize ()
18.31 + << std::endl;
18.32 + */
18.33 +
18.34 + m_linkManager ->SetNrRangingTransOpps (
18.35 + (ulMapIe.GetDuration () * GetPhy ()->GetPsPerSymbol ())
18.36 + / GetCurrentUcd ().GetChannelEncodings ().GetRangReqOppSize ());
18.37 +
18.38 + }
18.39 + //else
18.40 + // m_linkManager->SetNrRangingTransOpps (9);
18.41
18.42 if (GetState () == SS_STATE_WAITING_REG_RANG_INTRVL
18.43 || GetState () == SS_STATE_ADJUSTING_PARAMETERS)
18.44 m_linkManager->StartContentionResolution ();
18.45 +
18.46 }
18.47 }
18.48 }
19.1 --- a/src/devices/wimax/wimax-ss-net-device.h Thu Oct 29 15:22:25 2009 +0100
19.2 +++ b/src/devices/wimax/wimax-ss-net-device.h Tue Nov 10 14:36:17 2009 +0100
19.3 @@ -187,6 +187,9 @@
19.4 IsRegistered (void) const;
19.5 Time
19.6 GetTimeToAllocation (Time defferTime);
19.7 + IpcsSSPacketclassifier *
19.8 + GetIpcsClassifier ();
19.9 +
19.10 IpcsSSPacketclassifier *m_classifier;
19.11 SSLinkManager *m_linkManager;
19.12
20.1 --- a/src/devices/wimax/wscript Thu Oct 29 15:22:25 2009 +0100
20.2 +++ b/src/devices/wimax/wscript Tue Nov 10 14:36:17 2009 +0100
20.3 @@ -29,10 +29,8 @@
20.4 'mac-messages.cc',
20.5 'dl-mac-messages.cc',
20.6 'ul-mac-messages.cc',
20.7 - 'simple-wimax-phy.cc',
20.8 'simple-ofdm-wimax-phy.cc',
20.9 'simple-ofdm-wimax-channel.cc',
20.10 - 'simple-wimax-channel.cc',
20.11 'send-params.cc',
20.12 'ss-manager.cc',
20.13 'connection-manager.cc',
20.14 @@ -68,7 +66,11 @@
20.15 'ul-job.cc' ,
20.16 'snr-to-block-error-rate-record.cc',
20.17 'snr-to-block-error-rate-manager.cc',
20.18 - 'simple-ofdm-send-param.cc'
20.19 + 'simple-ofdm-send-param.cc',
20.20 + 'wimax-ss-mac-test.cc',
20.21 + 'wimax-bs-mac-test.cc',
20.22 + 'wimax-phy-test.cc',
20.23 + 'wimax-qos-test.cc'
20.24 ]
20.25 headers.source = [
20.26 'wimax-channel.h',
20.27 @@ -84,10 +86,8 @@
20.28 'dl-mac-messages.h',
20.29 'ul-mac-messages.h',
20.30 'wimax-phy.h',
20.31 - 'simple-wimax-phy.h',
20.32 'simple-ofdm-wimax-phy.h',
20.33 - 'simple-ofdm-wimax-channel.h',
20.34 - 'simple-wimax-channel.h',
20.35 + 'simple-ofdm-wimax-channel.h',
20.36 'send-params.h',
20.37 'service-flow.h',
20.38 'packet-burst.h',
21.1 --- a/src/helper/wimax-helper.cc Thu Oct 29 15:22:25 2009 +0100
21.2 +++ b/src/helper/wimax-helper.cc Tue Nov 10 14:36:17 2009 +0100
21.3 @@ -29,10 +29,8 @@
21.4 #include "ns3/wimax-bs-net-device.h"
21.5 #include "ns3/wimax-ss-net-device.h"
21.6 #include "ns3/wimax-channel.h"
21.7 -#include "ns3/simple-wimax-channel.h"
21.8 #include "ns3/simple-ofdm-wimax-channel.h"
21.9 #include "ns3/wimax-phy.h"
21.10 -#include "ns3/simple-wimax-phy.h"
21.11 #include "ns3/simple-ofdm-wimax-phy.h"
21.12 #include "ns3/packet-classifier.h"
21.13 #include "ns3/pointer.h"
21.14 @@ -146,11 +144,6 @@
21.15 Ptr<WimaxPhy> phy;
21.16 switch (phyType)
21.17 {
21.18 - case PHY_TYPE_SIMPLE:
21.19 - phy = CreateObject<SimpleWimaxPhy> ();
21.20 - if (!m_channel)
21.21 - m_channel = CreateObject<SimpleWimaxChannel> ();
21.22 - break;
21.23 case SIMPLE_PHY_TYPE_OFDM:
21.24 phy = CreateObject<SimpleOfdmWimaxPhy> ();
21.25 if (!m_channel)
21.26 @@ -172,11 +165,6 @@
21.27 Ptr<SimpleOfdmWimaxPhy> sphy;
21.28 switch (phyType)
21.29 {
21.30 - case PHY_TYPE_SIMPLE:
21.31 - phy = CreateObject<SimpleWimaxPhy> ();
21.32 - if (!m_channel)
21.33 - m_channel = CreateObject<SimpleWimaxChannel> ();
21.34 - break;
21.35 case SIMPLE_PHY_TYPE_OFDM:
21.36 sphy = CreateObject<SimpleOfdmWimaxPhy> ();
21.37 phy = sphy;
21.38 @@ -199,9 +187,6 @@
21.39 Ptr<WimaxPhy> phy;
21.40 switch (phyType)
21.41 {
21.42 - case PHY_TYPE_SIMPLE:
21.43 - phy = CreateObject<SimpleWimaxPhy> ();
21.44 - break;
21.45 case SIMPLE_PHY_TYPE_OFDM:
21.46 phy = CreateObject<SimpleOfdmWimaxPhy> ();
21.47 break;
21.48 @@ -221,9 +206,6 @@
21.49 Ptr<SimpleOfdmWimaxPhy> sphy;
21.50 switch (phyType)
21.51 {
21.52 - case PHY_TYPE_SIMPLE:
21.53 - phy = CreateObject<SimpleWimaxPhy> ();
21.54 - break;
21.55 case SIMPLE_PHY_TYPE_OFDM:
21.56 sphy = CreateObject<SimpleOfdmWimaxPhy> ();
21.57 phy = sphy;
21.58 @@ -282,6 +264,51 @@
21.59 return bsScheduler;
21.60 }
21.61
21.62 +
21.63 +NetDeviceContainer
21.64 + WimaxHelper::Install (NodeContainer c, NetDeviceType deviceType,
21.65 + PhyType phyType, SchedulerType schedulerType, double frameDuration)
21.66 +{
21.67 + NetDeviceContainer devices;
21.68 + for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
21.69 + {
21.70 + Ptr<Node> node = *i;
21.71 + Ptr<WimaxPhy> phy = CreatePhy (phyType);
21.72 +
21.73 + //Set SuperFrame Duration
21.74 + phy->SetFrameDuration (Seconds (frameDuration));
21.75 +
21.76 + Ptr<WimaxNetDevice> device;
21.77 + Ptr<UplinkScheduler> uplinkScheduler = CreateUplinkScheduler (
21.78 + schedulerType);
21.79 + Ptr<BSScheduler> bsScheduler = CreateBSScheduler (schedulerType);
21.80 +
21.81 + if (deviceType == DEVICE_TYPE_BASE_STATION)
21.82 + {
21.83 + // attach phy
21.84 + Ptr<WimaxBaseStationNetDevice> deviceBS;
21.85 + deviceBS = CreateObject<WimaxBaseStationNetDevice> (node, phy,
21.86 + uplinkScheduler, bsScheduler);
21.87 + device = deviceBS;
21.88 + uplinkScheduler->SetBs (deviceBS);
21.89 + bsScheduler->SetBs (deviceBS);
21.90 + }
21.91 + else
21.92 + {
21.93 + device = CreateObject<WimaxSubscriberStationNetDevice> (node, phy);
21.94 + }
21.95 + device->SetAddress (Mac48Address::Allocate ());
21.96 + phy->SetDevice (device);
21.97 + device->Start ();
21.98 + device->Attach (m_channel); // attach channel
21.99 +
21.100 + node->AddDevice (device);
21.101 +
21.102 + devices.Add (device);
21.103 + }
21.104 + return devices;
21.105 +}
21.106 +
21.107 NetDeviceContainer
21.108 WimaxHelper::Install (NodeContainer c, NetDeviceType deviceType,
21.109 PhyType phyType, SchedulerType schedulerType)
21.110 @@ -681,6 +708,16 @@
21.111 }
21.112
21.113 void
21.114 +WimaxHelper::SSClassifierConfig (Ptr<WimaxSubscriberStationNetDevice> ss,
21.115 + Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort,
21.116 + uint16_t dstPort, uint16_t protocol, uint32_t SFID)
21.117 +{
21.118 + ss->m_classifier->GetIpcsBindParameterManager ()->CreateIpcsClassifierRecord (
21.119 + srcAddress, dstAddress, srcPort, dstPort, protocol, SFID);
21.120 +}
21.121 +
21.122 +
21.123 +void
21.124 WimaxHelper::BsClassifierConfig (Mac48Address MacAdress_ss, Ptr<
21.125 WimaxBaseStationNetDevice> bs, Ipv4Address srcAddress,
21.126 Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort,
22.1 --- a/src/helper/wimax-helper.h Thu Oct 29 15:22:25 2009 +0100
22.2 +++ b/src/helper/wimax-helper.h Tue Nov 10 14:36:17 2009 +0100
22.3 @@ -69,7 +69,6 @@
22.4 */
22.5 enum PhyType
22.6 {
22.7 - PHY_TYPE_SIMPLE, /**< Simple PHY layer. Simple forwards bursts received by MAC layer */
22.8 SIMPLE_PHY_TYPE_OFDM
22.9 /**< Simple OFDM PHY layer */
22.10 };
22.11 @@ -374,7 +373,23 @@
22.12 Ptr<WimaxBaseStationNetDevice> bs, Ipv4Address srcAddress,
22.13 Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort,
22.14 uint16_t protocol, uint32_t SFID);
22.15 -
22.16 + /**
22.17 + *
22.18 + * \param ss Subscriber station
22.19 + * \param srcAddress the source IP address
22.20 + * \param dstAddress the destination IP address
22.21 + * \param srcPort The source port
22.22 + * \param dstPort The destination port
22.23 + * \param protocol The protocol
22.24 + * \param SFID The service flow ID in wich the flow will be mapped
22.25 + *
22.26 + * Add a record into the classifier of the ss. A classifier is used to map
22.27 + * incoming packets to appropriate connections based on a set of criteria.
22.28 + */
22.29 + void
22.30 + SSClassifierConfig (Ptr<WimaxSubscriberStationNetDevice> ss,
22.31 + Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort,
22.32 + uint16_t dstPort, uint16_t protocol, uint32_t SFID);
22.33 /**
22.34 * \param c A set of nodes.
22.35 * \param deviceType Device type to create.
22.36 @@ -389,6 +404,21 @@
22.37 NetDeviceContainer
22.38 Install (NodeContainer c, NetDeviceType deviceType, PhyType phyType, Ptr<
22.39 WimaxChannel> channel, SchedulerType schedulerType);
22.40 + /**
22.41 + * \param c A set of nodes.
22.42 + * \param deviceType Device type to create.
22.43 + * \param phyType PHY type to create.
22.44 + * \param channel A channel to use.
22.45 + * \param schedulerType The scheduling mechanism.
22.46 + * \param frameDuration the super farme duration in seconds
22.47 + *
22.48 + * For each of the input nodes, a new WiMAX net device (either
22.49 + * ns3::WimaxSubscriberStationNetDevice or ns3::WimaxBaseStationNetDevice
22.50 + * depending on the type parameter) is attached to the shared input channel.
22.51 + */
22.52 + NetDeviceContainer
22.53 + Install (NodeContainer c, NetDeviceType deviceType, PhyType phyType,
22.54 + SchedulerType schedulerType, double frameDuration);
22.55
22.56 /**
22.57 * \param phyType WiMAX Physical layer type
22.58 @@ -435,6 +465,7 @@
22.59 Ptr<WimaxNetDevice>
22.60 Install (Ptr<Node> node, NetDeviceType deviceType, PhyType phyType, Ptr<
22.61 WimaxChannel> channel, SchedulerType schedulerType);
22.62 +
22.63 private:
22.64 static void
22.65 AsciiEnqueueEvent (std::ostream *os, std::string path,
22.66 @@ -451,7 +482,6 @@
22.67 AsciiTxEvent (std::ostream *os, std::string path, Ptr<const Packet> packet,
22.68 const Mac48Address &dest);
22.69
22.70 - //! The channel model
22.71 Ptr<WimaxChannel> m_channel;
22.72 };
22.73
23.1 --- a/src/wscript Thu Oct 29 15:22:25 2009 +0100
23.2 +++ b/src/wscript Tue Nov 10 14:36:17 2009 +0100
23.3 @@ -50,7 +50,6 @@
23.4 'devices/wimax',
23.5 'applications/udp-client-server',
23.6 'applications/trace-based-streamer',
23.7 -## 'test/ns3wimax' ,
23.8 )
23.9
23.10 def set_options(opt):
24.1 --- a/test.py Thu Oct 29 15:22:25 2009 +0100
24.2 +++ b/test.py Tue Nov 10 14:36:17 2009 +0100
24.3 @@ -146,6 +146,9 @@
24.4 ("wireless/wifi-simple-infra", "True", "True"),
24.5 ("wireless/wifi-simple-interference", "True", "True"),
24.6 ("wireless/wifi-wired-bridging", "True", "True"),
24.7 +
24.8 + ("wimax/wimax-ipv4", "True", "True"),
24.9 + ("wimax/wimax-multicast", "True", "True"),
24.10 ]
24.11
24.12 #