25 #include <ns3/uinteger.h> 
   26 #include <ns3/double.h> 
   27 #include <ns3/isotropic-antenna-model.h> 
   28 #include <ns3/mobility-helper.h> 
   29 #include <ns3/position-allocator.h> 
   30 #include <ns3/geographic-positions.h> 
   41   82e6, 174e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 470e6, 476e6, 482e6, 
 
   42   488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 
 
   43   554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 
 
   44   620e6, 626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 
 
   45   686e6, 692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 
 
   46   752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 
 
   47   818e6, 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 
 
   51   88e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 216e6, 476e6, 482e6, 488e6, 
 
   52   494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
 
   53   560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6, 
 
   54   626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 
 
   55   692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 
 
   56   758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 818e6, 
 
   57   824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6, 
 
   64   195e6, 202e6, 209e6, 216e6, 223e6, 0, 0, 0, 0, 0, 0, 0, 0, 470e6, 478e6, 
 
   65   486e6, 494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 
 
   66   574e6, 582e6, 590e6, 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6, 
 
   67   662e6, 670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 
 
   68   750e6, 758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 
 
   72   202e6, 209e6, 216e6, 223e6, 230e6, 0, 0, 0, 0, 0, 0, 0, 0, 478e6, 486e6, 
 
   73   494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6, 
 
   74   582e6, 590e6, 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6, 662e6, 
 
   75   670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 750e6, 
 
   76   758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6, 
 
   83   182e6, 188e6, 192e6, 198e6, 204e6, 210e6, 216e6, 470e6, 476e6, 482e6, 488e6, 
 
   84   494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
 
   85   560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6, 
 
   86   626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 
 
   87   692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 
 
   91   188e6, 194e6, 198e6, 204e6, 210e6, 216e6, 222e6, 476e6, 482e6, 488e6, 494e6, 
 
   92   500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 560e6, 
 
   93   566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6, 626e6, 
 
   94   632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 692e6, 
 
   95   698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 758e6, 
 
  144       phy->SetDevice (dev);
 
  159                                       uint16_t channelNumber)
 
  163   double startFrequency;
 
  164   double channelBandwidth;
 
  168                      "channel number " << channelNumber <<
 
  169                      " does not exist for this region");
 
  171                      "channel number " << channelNumber <<
 
  172                      " does not exist for this region");
 
  180                      "channel number " << channelNumber <<
 
  181                      " does not exist for this region");
 
  183                      "channel number " << channelNumber <<
 
  184                      " does not exist for this region");
 
  192                      "channel number " << channelNumber <<
 
  193                      " does not exist for this region");
 
  195                      "channel number " << channelNumber <<
 
  196                      " does not exist for this region");
 
  206       phy->SetAttribute (
"StartFrequency", 
DoubleValue (startFrequency));
 
  207       phy->SetAttribute (
"ChannelBandwidth", 
DoubleValue (channelBandwidth));
 
  215       phy->SetDevice (dev);
 
  240       phy->GetAttribute (
"StartFrequency", startFrequency);
 
  241       phy->GetAttribute (
"ChannelBandwidth", channelBandwidth);
 
  243                          (index * channelBandwidth.
Get ())));
 
  251       phy->SetDevice (dev);
 
  267                                               uint16_t channelNumber)
 
  271   double startFrequency;
 
  272   double channelBandwidth;
 
  273   uint16_t currChannelNumber;
 
  278       currChannelNumber = channelNumber + index;
 
  282                          "channel number " << currChannelNumber <<
 
  283                          " does not exist for this region");
 
  285                          "channel number " << currChannelNumber <<
 
  286                          " does not exist for this region");
 
  294                          "channel number " << currChannelNumber <<
 
  295                          " does not exist for this region");
 
  297                          "channel number " << currChannelNumber <<
 
  298                          " does not exist for this region");
 
  306                          "channel number " << currChannelNumber <<
 
  307                          " does not exist for this region");
 
  309                          "channel number " << currChannelNumber <<
 
  310                          " does not exist for this region");
 
  317       phy->SetAttribute (
"StartFrequency", 
DoubleValue (startFrequency));
 
  318       phy->SetAttribute (
"ChannelBandwidth", 
DoubleValue (channelBandwidth));
 
  326       phy->SetDevice (dev);
 
  350                                                            double originLatitude, 
 
  351                                                            double originLongitude,
 
  356   std::list<int> transmitterIndicesToCreate;
 
  378   std::list<Vector> tvTransmitterLocations = 
 
  382                                                                    transmitterIndicesToCreate.size(), 
 
  386                                      transmitterIndicesToCreate, 
 
  387                                      tvTransmitterLocations);
 
  393                                                                  const int startFrequenciesLength, 
 
  396   std::vector<double> startFreqVector; 
 
  397   for (
int i = 0; i < startFrequenciesLength; i++)
 
  399       double element = startFrequencies[i];
 
  401       if (element != 0) startFreqVector.push_back(element);
 
  405   uint32_t freqVectorSize = startFreqVector.size();
 
  409   std::vector<double> transmitterStartFreqsToCreate; 
 
  410   for (
int i = 0; i < randNumTransmitters; i++)
 
  415       transmitterStartFreqsToCreate.push_back(startFreqVector[randIndex]); 
 
  417       startFreqVector.erase(startFreqVector.begin() + randIndex); 
 
  422   std::list<int> transmitterIndicesToCreate;
 
  423   for (
int i = 0; i < (int)transmitterStartFreqsToCreate.size(); i++)
 
  425       for (
int channelNumberIndex = 0; 
 
  426            channelNumberIndex < startFrequenciesLength; channelNumberIndex++)
 
  428           if (startFrequencies[channelNumberIndex] == transmitterStartFreqsToCreate[i])
 
  430               transmitterIndicesToCreate.push_back(channelNumberIndex);
 
  435   return transmitterIndicesToCreate;
 
  441                                                        uint32_t numChannels)
 
  450       numTransmitters = 
m_uniRand->
GetInteger (ceil (0.33 * numChannels) + 1, ceil (0.66 * numChannels));
 
  456   return numTransmitters;
 
  462                                                                 std::list<int> transmitterIndicesToCreate, 
 
  463                                                                 std::list<Vector> transmitterLocations)
 
  465   int numTransmitters = (int)transmitterIndicesToCreate.size();
 
  466   for (
int transNum = 0; transNum < numTransmitters; transNum++)
 
  470       nodePosition->Add (transmitterLocations.front()); 
 
  472       mobility.SetPositionAllocator (nodePosition);
 
  473       mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
 
  478       uint16_t channelNumber = (uint16_t) transmitterIndicesToCreate.front(); 
 
  479       Install (tvNode, region, channelNumber); 
 
  480       transmitterLocations.pop_front(); 
 
  481       transmitterIndicesToCreate.pop_front();