A Discrete-Event Network Simulator
API
tv-spectrum-transmitter-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Benjamin Cizdziel <ben.cizdziel@gmail.com>
19  */
20 
21 #include <ns3/log.h>
22 #include <cmath>
23 #include <list>
24 #include <vector>
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>
32 
33 namespace ns3 {
34 
35 NS_LOG_COMPONENT_DEFINE ("TvSpectrumTransmitterHelper");
36 
37 // NORTH AMERICA: 84 elements (index 0 - 83); valid channels = 2 - 83
38 const int northAmericaArrayLength = 84;
39 const double northAmericaStartFrequencies[84] = {0, 0, 54e6, 60e6, 66e6, 76e6,
40  82e6, 174e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 470e6, 476e6, 482e6,
41  488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6,
42  554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6,
43  620e6, 626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6,
44  686e6, 692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6,
45  752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6,
46  818e6, 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6,
47  884e6};
48 const double northAmericaEndFrequencies[84] = {0, 0, 60e6, 66e6, 72e6, 82e6,
49  88e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 216e6, 476e6, 482e6, 488e6,
50  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6,
51  560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6,
52  626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6,
53  692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6,
54  758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 818e6,
55  824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6,
56  890e6};
57 
58 // EUROPE: 70 elements (index 0 - 69); valid channels = 5 - 12, 21 - 69
59 const int europeArrayLength = 70;
60 const double europeStartFrequencies[70] = {0, 0, 0, 0, 0, 174e6, 181e6, 188e6,
61  195e6, 202e6, 209e6, 216e6, 223e6, 0, 0, 0, 0, 0, 0, 0, 0, 470e6, 478e6,
62  486e6, 494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6,
63  574e6, 582e6, 590e6, 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6,
64  662e6, 670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6,
65  750e6, 758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6,
66  838e6, 846e6, 854e6};
67 const double europeEndFrequencies[70] = {0, 0, 0, 0, 0, 181e6, 188e6, 195e6,
68  202e6, 209e6, 216e6, 223e6, 230e6, 0, 0, 0, 0, 0, 0, 0, 0, 478e6, 486e6,
69  494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6,
70  582e6, 590e6, 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6, 662e6,
71  670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 750e6,
72  758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6,
73  846e6, 854e6, 862e6};
74 
75 // JAPAN: 63 elements (index 0 - 62); valid channels = 1 - 62
76 const int japanArrayLength = 63;
77 const double japanStartFrequencies[63] = {0, 90e6, 96e6, 102e6, 170e6, 176e6,
78  182e6, 188e6, 192e6, 198e6, 204e6, 210e6, 216e6, 470e6, 476e6, 482e6, 488e6,
79  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6,
80  560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6,
81  626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6,
82  692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6,
83  758e6, 764e6};
84 const double japanEndFrequencies[63] = {0, 96e6, 102e6, 108e6, 176e6, 182e6,
85  188e6, 194e6, 198e6, 204e6, 210e6, 216e6, 222e6, 476e6, 482e6, 488e6, 494e6,
86  500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 560e6,
87  566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6, 626e6,
88  632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 692e6,
89  698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 758e6,
90  764e6, 770e6};
91 
93  : m_channel (0),
94  m_uniRand (CreateObject<UniformRandomVariable> ())
95 {
96  NS_LOG_FUNCTION (this);
97  m_factory.SetTypeId ("ns3::TvSpectrumTransmitter");
98 }
99 
101 {
102  m_channel = 0;
103  m_uniRand = 0;
104  NS_LOG_FUNCTION (this);
105 }
106 
107 void
109 {
110  NS_LOG_FUNCTION (this << c);
111  m_channel = c;
112 }
113 
114 void
116 {
117  m_factory.Set (name, val);
118 }
119 
120 
123 {
124  NS_LOG_FUNCTION (this);
125  NetDeviceContainer devCont;
126  //iterate over node container to make one transmitter for each given node
127  for (NodeContainer::Iterator i = nodeCont.Begin (); i != nodeCont.End (); ++i)
128  {
129  Ptr<Node> node = *i;
131  phy->CreateTvPsd ();
132  Ptr<NonCommunicatingNetDevice> dev = CreateObject<NonCommunicatingNetDevice> ();
133  NS_ASSERT (phy);
134  dev->SetPhy (phy);
135  NS_ASSERT (node);
136  phy->SetMobility (node->GetObject<MobilityModel> ());
137  NS_ASSERT (dev);
138  phy->SetDevice (dev);
140  phy->SetChannel (m_channel);
141  dev->SetChannel (m_channel);
142  node->AddDevice (dev);
143  devCont.Add (dev);
144  phy->Start ();
145  }
146  return devCont;
147 }
148 
149 
152  Region region,
153  uint16_t channelNumber)
154 {
155  NS_LOG_FUNCTION (this);
156  NetDeviceContainer devCont;
157  double startFrequency;
158  double channelBandwidth;
159  if (region == REGION_NORTH_AMERICA)
160  {
161  NS_ASSERT_MSG (channelNumber < northAmericaArrayLength,
162  "channel number " << channelNumber <<
163  " does not exist for this region");
164  NS_ASSERT_MSG (northAmericaStartFrequencies[channelNumber] != 0,
165  "channel number " << channelNumber <<
166  " does not exist for this region");
167  startFrequency = northAmericaStartFrequencies[channelNumber];
168  channelBandwidth = northAmericaEndFrequencies[channelNumber] -
169  northAmericaStartFrequencies[channelNumber];
170  }
171  else if (region == REGION_EUROPE)
172  {
173  NS_ASSERT_MSG (channelNumber < europeArrayLength,
174  "channel number " << channelNumber <<
175  " does not exist for this region");
176  NS_ASSERT_MSG (europeStartFrequencies[channelNumber] != 0,
177  "channel number " << channelNumber <<
178  " does not exist for this region");
179  startFrequency = europeStartFrequencies[channelNumber];
180  channelBandwidth = europeEndFrequencies[channelNumber] -
181  europeStartFrequencies[channelNumber];
182  }
183  else if (region == REGION_JAPAN)
184  {
185  NS_ASSERT_MSG (channelNumber < japanArrayLength,
186  "channel number " << channelNumber <<
187  " does not exist for this region");
188  NS_ASSERT_MSG (japanStartFrequencies[channelNumber] != 0,
189  "channel number " << channelNumber <<
190  " does not exist for this region");
191  startFrequency = japanStartFrequencies[channelNumber];
192  channelBandwidth = japanEndFrequencies[channelNumber] -
193  japanStartFrequencies[channelNumber];
194  }
195  //iterate over node container to make one transmitter for each given node
196  for (NodeContainer::Iterator i = nodeCont.Begin (); i != nodeCont.End (); ++i)
197  {
198  Ptr<Node> node = *i;
200  phy->SetAttribute ("StartFrequency", DoubleValue (startFrequency));
201  phy->SetAttribute ("ChannelBandwidth", DoubleValue (channelBandwidth));
202  phy->CreateTvPsd ();
203  Ptr<NonCommunicatingNetDevice> dev = CreateObject<NonCommunicatingNetDevice> ();
204  NS_ASSERT (phy);
205  dev->SetPhy (phy);
206  NS_ASSERT (node);
207  phy->SetMobility (node->GetObject<MobilityModel> ());
208  NS_ASSERT (dev);
209  phy->SetDevice (dev);
211  phy->SetChannel (m_channel);
212  dev->SetChannel (m_channel);
213  node->AddDevice (dev);
214  devCont.Add (dev);
215  phy->Start ();
216  }
217  return devCont;
218 }
219 
220 
223 {
224  NS_LOG_FUNCTION (this);
225  NetDeviceContainer devCont;
226  int index = 0;
227  DoubleValue startFrequency;
228  DoubleValue channelBandwidth;
229  //iterate over node container to make one transmitter for each given node
230  for (NodeContainer::Iterator i = nodeCont.Begin (); i != nodeCont.End (); ++i)
231  {
232  Ptr<Node> node = *i;
234  phy->GetAttribute ("StartFrequency", startFrequency);
235  phy->GetAttribute ("ChannelBandwidth", channelBandwidth);
236  phy->SetAttribute ("StartFrequency", DoubleValue (startFrequency.Get () +
237  (index * channelBandwidth.Get ())));
238  phy->CreateTvPsd ();
239  Ptr<NonCommunicatingNetDevice> dev = CreateObject<NonCommunicatingNetDevice> ();
240  NS_ASSERT (phy);
241  dev->SetPhy (phy);
242  NS_ASSERT (node);
243  phy->SetMobility (node->GetObject<MobilityModel> ());
244  NS_ASSERT (dev);
245  phy->SetDevice (dev);
247  phy->SetChannel (m_channel);
248  dev->SetChannel (m_channel);
249  node->AddDevice (dev);
250  devCont.Add (dev);
251  phy->Start ();
252  index++;
253  }
254  return devCont;
255 }
256 
257 
260  Region region,
261  uint16_t channelNumber)
262 {
263  NS_LOG_FUNCTION (this);
264  NetDeviceContainer devCont;
265  double startFrequency;
266  double channelBandwidth;
267  uint16_t currChannelNumber;
268  int index = 0;
269  //iterate over node container to make one transmitter for each given node
270  for (NodeContainer::Iterator i = nodeCont.Begin (); i != nodeCont.End (); ++i)
271  {
272  currChannelNumber = channelNumber + index;
273  if (region == REGION_NORTH_AMERICA)
274  {
275  NS_ASSERT_MSG (currChannelNumber < northAmericaArrayLength,
276  "channel number " << currChannelNumber <<
277  " does not exist for this region");
278  NS_ASSERT_MSG (northAmericaStartFrequencies[currChannelNumber] != 0,
279  "channel number " << currChannelNumber <<
280  " does not exist for this region");
281  startFrequency = northAmericaStartFrequencies[currChannelNumber];
282  channelBandwidth = northAmericaEndFrequencies[currChannelNumber]
283  - northAmericaStartFrequencies[currChannelNumber];
284  }
285  else if (region == REGION_EUROPE)
286  {
287  NS_ASSERT_MSG (currChannelNumber < europeArrayLength,
288  "channel number " << currChannelNumber <<
289  " does not exist for this region");
290  NS_ASSERT_MSG (europeStartFrequencies[currChannelNumber] != 0,
291  "channel number " << currChannelNumber <<
292  " does not exist for this region");
293  startFrequency = europeStartFrequencies[currChannelNumber];
294  channelBandwidth = europeEndFrequencies[currChannelNumber] -
295  europeStartFrequencies[currChannelNumber];
296  }
297  else if (region == REGION_JAPAN)
298  {
299  NS_ASSERT_MSG (currChannelNumber < japanArrayLength,
300  "channel number " << currChannelNumber <<
301  " does not exist for this region");
302  NS_ASSERT_MSG (japanStartFrequencies[currChannelNumber] != 0,
303  "channel number " << currChannelNumber <<
304  " does not exist for this region");
305  startFrequency = japanStartFrequencies[currChannelNumber];
306  channelBandwidth = japanEndFrequencies[currChannelNumber] -
307  japanStartFrequencies[currChannelNumber];
308  }
309  Ptr<Node> node = *i;
311  phy->SetAttribute ("StartFrequency", DoubleValue (startFrequency));
312  phy->SetAttribute ("ChannelBandwidth", DoubleValue (channelBandwidth));
313  phy->CreateTvPsd ();
314  Ptr<NonCommunicatingNetDevice> dev = CreateObject<NonCommunicatingNetDevice> ();
315  NS_ASSERT (phy);
316  dev->SetPhy (phy);
317  NS_ASSERT (node);
318  phy->SetMobility (node->GetObject<MobilityModel> ());
319  NS_ASSERT (dev);
320  phy->SetDevice (dev);
322  phy->SetChannel (m_channel);
323  dev->SetChannel (m_channel);
324  node->AddDevice (dev);
325  devCont.Add (dev);
326  phy->Start ();
327  index++;
328  }
329  return devCont;
330 }
331 
332 
333 int64_t
335 {
336  m_uniRand->SetStream (streamNum);
337  return 1;
338 }
339 
340 
341 void
343  Density density,
344  double originLatitude,
345  double originLongitude,
346  double maxAltitude,
347  double maxRadius)
348 {
349  NS_LOG_FUNCTION (this);
350  std::list<int> transmitterIndicesToCreate;
351  if (region == REGION_NORTH_AMERICA)
352  {
353  transmitterIndicesToCreate = GenerateRegionalTransmitterIndices
354  (northAmericaStartFrequencies,
355  northAmericaArrayLength,
356  density);
357  }
358  else if (region == REGION_EUROPE)
359  {
360  transmitterIndicesToCreate = GenerateRegionalTransmitterIndices
361  (europeStartFrequencies,
362  europeArrayLength,
363  density);
364  }
365  else if (region == REGION_JAPAN)
366  {
367  transmitterIndicesToCreate = GenerateRegionalTransmitterIndices
368  (japanStartFrequencies,
369  japanArrayLength,
370  density);
371  }
372  std::list<Vector> tvTransmitterLocations =
374  originLongitude,
375  maxAltitude,
376  transmitterIndicesToCreate.size(),
377  maxRadius,
378  m_uniRand);
380  transmitterIndicesToCreate,
381  tvTransmitterLocations);
382 }
383 
384 
385 std::list<int>
387  const int startFrequenciesLength,
388  Density density)
389 {
390  std::vector<double> startFreqVector; //stores all non-zero start frequencies
391  for (int i = 0; i < startFrequenciesLength; i++)
392  {
393  double element = startFrequencies[i];
394  //add all non-zero frequencies to vector (0 means unused channel)
395  if (element != 0) startFreqVector.push_back(element);
396  }
397 
398  //randomly generate number of transmitters to create based on density
399  uint32_t freqVectorSize = startFreqVector.size();
400  int randNumTransmitters = GetRandomNumTransmitters (density, freqVectorSize);
401 
402  //stores start frequencies that transmitters will be created to transmit
403  std::vector<double> transmitterStartFreqsToCreate;
404  for (int i = 0; i < randNumTransmitters; i++)
405  {
406  //get random index from start frequency vector
407  uint32_t randIndex = m_uniRand->GetInteger (0, startFreqVector.size () - 1);
408  //add start frequency corresponding to random index to vector
409  transmitterStartFreqsToCreate.push_back(startFreqVector[randIndex]);
410  //remove selected start frequency from vector so it is not selected again
411  startFreqVector.erase(startFreqVector.begin() + randIndex);
412  }
413 
414  //find indices on startFrequencies[] containing each start frequency that is
415  //selected to be transmitted and add to list
416  std::list<int> transmitterIndicesToCreate;
417  for (int i = 0; i < (int)transmitterStartFreqsToCreate.size(); i++)
418  {
419  for (int channelNumberIndex = 0;
420  channelNumberIndex < startFrequenciesLength; channelNumberIndex++)
421  {
422  if (startFrequencies[channelNumberIndex] == transmitterStartFreqsToCreate[i])
423  {
424  transmitterIndicesToCreate.push_back(channelNumberIndex);
425  break;
426  }
427  }
428  }
429  return transmitterIndicesToCreate;
430 }
431 
432 
433 int
435  uint32_t numChannels)
436 {
437  int numTransmitters;
438  if (density == DENSITY_LOW)
439  {
440  numTransmitters = m_uniRand->GetInteger (1, ceil (0.33 * numChannels));
441  }
442  else if (density == DENSITY_MEDIUM)
443  {
444  numTransmitters = m_uniRand->GetInteger (ceil (0.33 * numChannels) + 1, ceil (0.66 * numChannels));
445  }
446  else
447  {
448  numTransmitters = m_uniRand->GetInteger (ceil (0.66 * numChannels) + 1, numChannels);
449  }
450  return numTransmitters;
451 }
452 
453 
454 void
456  std::list<int> transmitterIndicesToCreate,
457  std::list<Vector> transmitterLocations)
458 {
459  int numTransmitters = (int)transmitterIndicesToCreate.size();
460  for (int transNum = 0; transNum < numTransmitters; transNum++)
461  {
462  Ptr<ListPositionAllocator> nodePosition = CreateObject<ListPositionAllocator> ();
463  // add generated coordinate point to node position
464  nodePosition->Add (transmitterLocations.front());
466  mobility.SetPositionAllocator (nodePosition);
467  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
468  NodeContainer tvNode; // contains position of transmitter to be created
469  tvNode.Create (1);
470  mobility.Install (tvNode);
471  // set channel number for this transmitter
472  uint16_t channelNumber = (uint16_t) transmitterIndicesToCreate.front();
473  Install (tvNode, region, channelNumber); //install tv transmitter
474  transmitterLocations.pop_front(); // remove created transmitter location
475  transmitterIndicesToCreate.pop_front(); // remove created transmitter index
476  }
477 }
478 
479 } // namespace ns3
480 
Ptr< UniformRandomVariable > m_uniRand
Object to generate uniform random numbers.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:455
ObjectFactory m_factory
Object factory for attribute setting.
Hold a value for an Attribute.
Definition: attribute.h:68
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
const double europeEndFrequencies[70]
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
const double northAmericaStartFrequencies[84]
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
const double europeStartFrequencies[70]
std::list< int > GenerateRegionalTransmitterIndices(const double startFrequencies[], const int startFrequenciesLength, Density density)
Generates random indices of given region frequency array (ignoring indices referring to invalid chann...
void CreateRegionalTvTransmitters(Region region, Density density, double originLatitude, double originLongitude, double maxAltitude, double maxRadius)
Generates and installs (starts transmission on the spectrum channel) a random number of TV transmitte...
Region
geographical region that TV transmitters are being set up in
Keep track of the current position and velocity of an object.
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
NetDeviceContainer Install(NodeContainer nodes)
Set up and start the TV Transmitter's transmission on the spectrum channel.
tuple mobility
Definition: third.py:101
Density
density of location that TV transmitters are being set up in
tuple phy
Definition: third.py:86
const int japanArrayLength
const int northAmericaArrayLength
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
int GetRandomNumTransmitters(Density density, uint32_t numChannels)
Randomly generates the number of TV transmitters to be created based on given density and number of p...
holds a vector of ns3::NetDevice pointers
Ptr< SpectrumChannel > m_channel
Pointer to spectrum channel object.
The uniform distribution Random Number Generator (RNG).
double Get(void) const
Definition: double.cc:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
const double northAmericaEndFrequencies[84]
const double japanStartFrequencies[63]
int64_t AssignStreams(int64_t streamNum)
Assigns the stream number for the uniform random number generator to use.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
SpectrumPhy implementation that creates a customizable TV transmitter which transmits a PSD spectrum ...
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
NetDeviceContainer InstallAdjacent(NodeContainer nodes)
Set up and start the TV Transmitter's transmission on the spectrum channel.
static std::list< Vector > RandCartesianPointsAroundGeographicPoint(double originLatitude, double originLongitude, double maxAltitude, int numPoints, double maxDistFromOrigin, Ptr< UniformRandomVariable > uniRand)
Generates uniformly distributed random points (in ECEF Cartesian coordinates) within a given altitude...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:90
Helper class used to assign positions and mobility models to nodes.
void InstallRandomRegionalTransmitters(Region region, std::list< int > transmitterIndicesToCreate, std::list< Vector > transmitterLocations)
Installs each randomly generated regional TV transmitter.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:121
const double japanEndFrequencies[63]
Ptr< T > CreateObject(void)
Create an object by type, with varying number of constructor parameters.
Definition: object.h:524
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
const int europeArrayLength
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void SetAttribute(std::string name, const AttributeValue &val)
Set attribute for each TvSpectrumTransmitter instance to be created.
void SetChannel(Ptr< SpectrumChannel > c)
Set the spectrum channel for the device(s) to transmit on.