22#include <ns3/double.h>
23#include <ns3/geographic-positions.h>
24#include <ns3/isotropic-antenna-model.h>
26#include <ns3/mobility-helper.h>
27#include <ns3/position-allocator.h>
28#include <ns3/uinteger.h>
43 0, 0, 54e6, 60e6, 66e6, 76e6, 82e6, 174e6, 180e6, 186e6, 192e6, 198e6,
44 204e6, 210e6, 470e6, 476e6, 482e6, 488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6,
45 530e6, 536e6, 542e6, 548e6, 554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6,
46 602e6, 608e6, 614e6, 620e6, 626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6,
47 674e6, 680e6, 686e6, 692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6,
48 746e6, 752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6,
49 818e6, 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6,
53 0, 0, 60e6, 66e6, 72e6, 82e6, 88e6, 180e6, 186e6, 192e6, 198e6, 204e6,
54 210e6, 216e6, 476e6, 482e6, 488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6,
55 536e6, 542e6, 548e6, 554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6,
56 608e6, 614e6, 620e6, 626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6,
57 680e6, 686e6, 692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6,
58 752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 818e6,
59 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6, 890e6,
66 0, 0, 0, 0, 0, 174e6, 181e6, 188e6, 195e6, 202e6, 209e6, 216e6,
67 223e6, 0, 0, 0, 0, 0, 0, 0, 0, 470e6, 478e6, 486e6,
68 494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6, 582e6,
69 590e6, 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6, 662e6, 670e6, 678e6,
70 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 750e6, 758e6, 766e6, 774e6,
71 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6, 846e6, 854e6,
75 0, 0, 0, 0, 0, 181e6, 188e6, 195e6, 202e6, 209e6, 216e6, 223e6,
76 230e6, 0, 0, 0, 0, 0, 0, 0, 0, 478e6, 486e6, 494e6,
77 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6, 582e6, 590e6,
78 598e6, 606e6, 614e6, 622e6, 630e6, 638e6, 646e6, 654e6, 662e6, 670e6, 678e6, 686e6,
79 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 750e6, 758e6, 766e6, 774e6, 782e6,
80 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6, 846e6, 854e6, 862e6,
87 0, 90e6, 96e6, 102e6, 170e6, 176e6, 182e6, 188e6, 192e6, 198e6, 204e6, 210e6, 216e6,
88 470e6, 476e6, 482e6, 488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6,
89 548e6, 554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6,
90 626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 692e6, 698e6,
91 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 758e6, 764e6,
95 0, 96e6, 102e6, 108e6, 176e6, 182e6, 188e6, 194e6, 198e6, 204e6, 210e6, 216e6, 222e6,
96 476e6, 482e6, 488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6,
97 554e6, 560e6, 566e6, 572e6, 578e6, 584e6, 590e6, 596e6, 602e6, 608e6, 614e6, 620e6, 626e6,
98 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 692e6, 698e6, 704e6,
99 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 758e6, 764e6, 770e6,
103 : m_channel(nullptr),
151 node->AddDevice(dev);
163 double startFrequency;
164 double channelBandwidth;
168 "channel number " << channelNumber <<
" does not exist for this region");
170 "channel number " << channelNumber <<
" does not exist for this region");
178 "channel number " << channelNumber <<
" does not exist for this region");
180 "channel number " << channelNumber <<
" does not exist for this region");
188 "channel number " << channelNumber <<
" does not exist for this region");
190 "channel number " << channelNumber <<
" does not exist for this region");
200 phy->SetAttribute(
"StartFrequency",
DoubleValue(startFrequency));
201 phy->SetAttribute(
"ChannelBandwidth",
DoubleValue(channelBandwidth));
213 node->AddDevice(dev);
233 phy->GetAttribute(
"StartFrequency", startFrequency);
234 phy->GetAttribute(
"ChannelBandwidth", channelBandwidth);
235 phy->SetAttribute(
"StartFrequency",
248 node->AddDevice(dev);
259 uint16_t channelNumber)
263 double startFrequency;
264 double channelBandwidth;
265 uint16_t currChannelNumber;
270 currChannelNumber = channelNumber + index;
274 "channel number " << currChannelNumber
275 <<
" does not exist for this region");
277 "channel number " << currChannelNumber
278 <<
" does not exist for this region");
286 "channel number " << currChannelNumber
287 <<
" does not exist for this region");
289 "channel number " << currChannelNumber
290 <<
" does not exist for this region");
298 "channel number " << currChannelNumber
299 <<
" does not exist for this region");
301 "channel number " << currChannelNumber
302 <<
" does not exist for this region");
309 phy->SetAttribute(
"StartFrequency",
DoubleValue(startFrequency));
310 phy->SetAttribute(
"ChannelBandwidth",
DoubleValue(channelBandwidth));
322 node->AddDevice(dev);
340 double originLatitude,
341 double originLongitude,
346 std::list<int> transmitterIndicesToCreate;
349 transmitterIndicesToCreate =
356 transmitterIndicesToCreate =
361 transmitterIndicesToCreate =
364 std::list<Vector> tvTransmitterLocations =
369 transmitterIndicesToCreate.size(),
377 const int startFrequenciesLength,
380 std::vector<double> startFreqVector;
381 for (
int i = 0; i < startFrequenciesLength; i++)
383 double element = startFrequencies[i];
387 startFreqVector.push_back(element);
392 uint32_t freqVectorSize = startFreqVector.size();
396 std::vector<double> transmitterStartFreqsToCreate;
397 for (
int i = 0; i < randNumTransmitters; i++)
402 transmitterStartFreqsToCreate.push_back(startFreqVector[randIndex]);
404 startFreqVector.erase(startFreqVector.begin() + randIndex);
409 std::list<int> transmitterIndicesToCreate;
410 for (
int i = 0; i < (int)transmitterStartFreqsToCreate.size(); i++)
412 for (
int channelNumberIndex = 0; channelNumberIndex < startFrequenciesLength;
413 channelNumberIndex++)
415 if (startFrequencies[channelNumberIndex] == transmitterStartFreqsToCreate[i])
417 transmitterIndicesToCreate.push_back(channelNumberIndex);
422 return transmitterIndicesToCreate;
442 return numTransmitters;
448 std::list<int> transmitterIndicesToCreate,
449 std::list<Vector> transmitterLocations)
451 int numTransmitters = (int)transmitterIndicesToCreate.size();
452 for (
int transNum = 0; transNum < numTransmitters; transNum++)
456 nodePosition->Add(transmitterLocations.front());
458 mobility.SetPositionAllocator(nodePosition);
459 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
462 mobility.Install(tvNode);
464 uint16_t channelNumber = (uint16_t)transmitterIndicesToCreate.front();
465 Install(tvNode, region, channelNumber);
466 transmitterLocations.pop_front();
467 transmitterIndicesToCreate.pop_front();
Hold a value for an Attribute.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
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...
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
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...
TvSpectrumTransmitterHelper()
Default constructor.
void SetChannel(Ptr< SpectrumChannel > c)
Set the spectrum channel for the device(s) to transmit on.
NetDeviceContainer InstallAdjacent(NodeContainer nodes)
Set up and start the TV Transmitter's transmission on the spectrum channel.
Density
density of location that TV transmitters are being set up in
void InstallRandomRegionalTransmitters(Region region, std::list< int > transmitterIndicesToCreate, std::list< Vector > transmitterLocations)
Installs each randomly generated regional TV transmitter.
Region
geographical region that TV transmitters are being set up in
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...
virtual ~TvSpectrumTransmitterHelper()
Destructor.
Ptr< UniformRandomVariable > m_uniRand
Object to generate uniform random numbers.
int64_t AssignStreams(int64_t streamNum)
Assigns the stream number for the uniform random number generator to use.
ObjectFactory m_factory
Object factory for attribute setting.
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...
void SetAttribute(std::string name, const AttributeValue &val)
Set attribute for each TvSpectrumTransmitter instance to be created.
NetDeviceContainer Install(NodeContainer nodes)
Set up and start the TV Transmitter's transmission on the spectrum channel.
Ptr< SpectrumChannel > m_channel
Pointer to spectrum channel object.
SpectrumPhy implementation that creates a customizable TV transmitter which transmits a PSD spectrum ...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const double northAmericaEndFrequencies[84]
NORTH AMERICA end frequencies.
const int japanArrayLength
JAPAN: 63 elements (index 0 - 62); valid channels = 1 - 62.
const double europeEndFrequencies[70]
EUROPE end frequencies.
const int northAmericaArrayLength
NORTH AMERICA: 84 elements (index 0 - 83); valid channels = 2 - 83.
const double japanStartFrequencies[63]
JAPAN start frequencies.
const double europeStartFrequencies[70]
EUROPE start frequencies.
const double japanEndFrequencies[63]
JAPAN end frequencies.
const double northAmericaStartFrequencies[84]
NORTH AMERICA start frequencies.
const int europeArrayLength
EUROPE: 70 elements (index 0 - 69); valid channels = 5 - 12, 21 - 69.