|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include <ns3/core-module.h>
24 #include <ns3/mobility-module.h>
25 #include <ns3/spectrum-helper.h>
26 #include <ns3/spectrum-analyzer-helper.h>
27 #include <ns3/tv-spectrum-transmitter-helper.h>
42 int main (
int argc,
char** argv)
45 cmd.Parse (argc, argv);
51 tvTransmitterNodes.
Create (2);
52 spectrumAnalyzerNodes.
Create (1);
53 allNodes.
Add (tvTransmitterNodes);
54 allNodes.
Add (spectrumAnalyzerNodes);
57 nodePositionList->
Add (Vector (128000.0, 0.0, 0.0));
58 nodePositionList->
Add (Vector (0.0, 24000.0, 0.0));
59 nodePositionList->
Add (Vector (0.0, 0.0, 0.0));
60 mobility.SetPositionAllocator (nodePositionList);
61 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
66 channelHelper.
SetChannel (
"ns3::MultiModelSpectrumChannel");
86 std::vector<double> freqs;
87 for (
int i = 0; i < 200; ++i)
89 freqs.push_back ((i + 5200) * 1e5);
98 spectrumAnalyzerHelper.
EnableAsciiAll (
"spectrum-analyzer-tv-sim");
107 std::cout <<
"simulation done!" << std::endl;
108 std::cout <<
"see spectrum analyzer output file" << std::endl;
holds a vector of ns3::NetDevice pointers
void SetPhyAttribute(std::string name, const AttributeValue &v)
Parse command-line arguments.
void Add(Vector v)
Add a position to the list of positions.
void SetChannel(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), 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())
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NetDeviceContainer Install(NodeContainer c) const
Helper class which uses TvSpectrumTransmitter class to create customizable TV transmitter(s) that tra...
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold variables of type enum.
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
Ptr< SpectrumChannel > Create(void) const
Smart pointer class similar to boost::intrusive_ptr.
Class to allow the Spectrum Analysis.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
void SetAttribute(std::string name, const AttributeValue &val)
Set attribute for each TvSpectrumTransmitter instance to be created.
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
static void Run(void)
Run the simulation.
Hold variables of type string.
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals.
void AddSpectrumPropagationLoss(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), 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())
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
NetDeviceContainer InstallAdjacent(NodeContainer nodes)
Set up and start the TV Transmitter's transmission on the spectrum channel.
AttributeValue implementation for Time.
void SetChannel(Ptr< SpectrumChannel > c)
Set the spectrum channel for the device(s) to transmit on.
keep track of a set of node pointers.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper.
static SpectrumChannelHelper Default()
Setup a default SpectrumChannel.
Helper class used to assign positions and mobility models to nodes.