9#include <ns3/core-module.h>
10#include <ns3/mobility-module.h>
11#include <ns3/spectrum-analyzer-helper.h>
12#include <ns3/spectrum-helper.h>
13#include <ns3/tv-spectrum-transmitter-helper.h>
32main(
int argc,
char** argv)
35 cmd.Parse(argc, argv);
41 tvTransmitterNodes.
Create(2);
42 spectrumAnalyzerNodes.
Create(1);
43 allNodes.
Add(tvTransmitterNodes);
44 allNodes.
Add(spectrumAnalyzerNodes);
47 nodePositionList->Add(
48 Vector(128000.0, 0.0, 0.0));
49 nodePositionList->Add(
50 Vector(0.0, 24000.0, 0.0));
51 nodePositionList->Add(Vector(0.0, 0.0, 0.0));
52 mobility.SetPositionAllocator(nodePositionList);
53 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
58 channelHelper.
SetChannel(
"ns3::MultiModelSpectrumChannel");
79 std::vector<double> freqs;
81 for (
int i = 0; i < 200; ++i)
83 freqs.push_back((i + 5200) * 1e5);
95 spectrumAnalyzerHelper.
Install(spectrumAnalyzerNodes);
103 std::cout <<
"simulation done!" << std::endl;
104 std::cout <<
"see spectrum analyzer output file" << std::endl;
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Class to allow the Spectrum Analysis.
NetDeviceContainer Install(NodeContainer c) const
void SetPhyAttribute(std::string name, const AttributeValue &v)
void SetChannel(Ptr< SpectrumChannel > channel)
Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper.
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals.
Ptr< SpectrumChannel > Create() const
static SpectrumChannelHelper Default()
Setup a default SpectrumChannel.
void AddSpectrumPropagationLoss(std::string name, Ts &&... args)
void SetChannel(std::string type, Ts &&... args)
Hold variables of type string.
Helper class which uses TvSpectrumTransmitter class to create customizable TV transmitter(s) that tra...
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.
void SetAttribute(std::string name, const AttributeValue &val)
Set attribute for each TvSpectrumTransmitter instance to be created.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.