20 #include <ns3/core-module.h>
21 #include <ns3/mobility-module.h>
22 #include <ns3/spectrum-analyzer-helper.h>
23 #include <ns3/spectrum-helper.h>
24 #include <ns3/tv-spectrum-transmitter-helper.h>
43 main(
int argc,
char** argv)
46 cmd.Parse(argc, argv);
54 spectrumAnalyzerNodes.
Create(1);
62 nodePositionList->Add(coordinates);
63 mobility.SetPositionAllocator(nodePositionList);
64 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
65 mobility.Install(spectrumAnalyzerNodes);
69 channelHelper.
SetChannel(
"ns3::MultiModelSpectrumChannel");
92 std::vector<double> freqs;
93 for (
int i = 0; i < 6860; i = i + 5)
95 freqs.push_back((i + 1740) * 1e5);
105 spectrumAnalyzerHelper.
EnableAsciiAll(
"spectrum-analyzer-tv-sim-regional");
107 spectrumAnalyzerHelper.
Install(spectrumAnalyzerNodes);
115 std::cout <<
"simulation done!" << std::endl;
116 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.
static Vector GeographicToCartesianCoordinates(double latitude, double longitude, double altitude, EarthSpheroidType sphType)
Converts earth geographic/geodetic coordinates (latitude and longitude in degrees) with a given altit...
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.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
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 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.
int64_t AssignStreams(int64_t streamNum)
Assigns the stream number for the uniform random number generator to use.
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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.