|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include <ns3/simulator.h>
24 #include <ns3/uinteger.h>
25 #include <ns3/double.h>
26 #include <ns3/integer.h>
27 #include <ns3/string.h>
28 #include <ns3/pointer.h>
29 #include <ns3/isotropic-antenna-model.h>
30 #include <ns3/antenna-model.h>
45 m_tvType (TVTYPE_8VSB),
46 m_startFrequency (500e6),
47 m_channelBandwidth (6e6),
51 m_transmitDuration (
Seconds (0.2)),
72 .SetGroupName (
"Spectrum")
74 .AddAttribute (
"TvType",
75 "The type of TV transmitter/modulation to be used.",
81 .AddAttribute (
"StartFrequency",
82 "The lower end frequency (in Hz) of the TV transmitter's "
83 "signal. Must be greater than or equal to 0.",
87 .AddAttribute (
"ChannelBandwidth",
88 "The bandwidth (in Hz) of the TV transmitter's signal. Must "
89 "be greater than or equal to 0.",
93 .AddAttribute (
"BasePsd",
94 "The base power spectral density (in dBm/Hz) of the TV "
95 "transmitter's transmitted spectrum. Base PSD is the "
96 "maximum PSD of the spectrum excluding pilots. For analog "
97 "and COFDM transmitters this is the maximum PSD, but for "
98 "8-VSB transmitters this is the maximum PSD of the main "
99 "signal spectrum (flat-top segment) since the pilot "
100 "actually has the maximum PSD overall.",
103 MakeDoubleChecker<double> ())
104 .AddAttribute (
"Antenna",
105 "The AntennaModel to be used. Allows classes inherited "
106 "from ns3::AntennaModel. Defaults to ns3::IsotropicAntennaModel.",
109 MakePointerChecker<AntennaModel> ())
110 .AddAttribute (
"StartingTime",
111 "The time point after the simulation begins in which the TV "
112 "transmitter will begin transmitting.",
116 .AddAttribute (
"TransmitDuration",
117 "The duration of time that the TV transmitter will transmit for.",
202 : startFrequency (stFreq),
246 std::map<TvSpectrumModelId, Ptr<SpectrumModel> >::iterator iter =
g_tvSpectrumModelMap.find (key);
249 model = iter->second;
260 bi.
fc = fl + halfSubBand;
261 bi.
fh = fl + (2 * halfSubBand);
262 bands.push_back (bi);
264 model = Create<SpectrumModel> (bands);
268 double basePsdWattsHz = pow (10.0, (
m_basePsd - 30) / 10.0);
273 for (
int i = 0; i <= 100; i++)
279 (*psd) [i] = 0.015 * basePsdWattsHz;
283 (*psd) [i] = 0.019 * basePsdWattsHz;
287 (*psd) [i] = 0.034 * basePsdWattsHz;
291 (*psd) [i] = 0.116 * basePsdWattsHz;
295 (*psd) [i] = 0.309 * basePsdWattsHz;
298 (*psd) [i] = (0.502 * basePsdWattsHz) + (21.577 * basePsdWattsHz);
302 (*psd) [i] = 0.696 * basePsdWattsHz;
306 (*psd) [i] = 0.913 * basePsdWattsHz;
310 (*psd) [i] = 0.978 * basePsdWattsHz;
314 (*psd) [i] = 0.990 * basePsdWattsHz;
317 (*psd) [i] = 0.502 * basePsdWattsHz;
320 (*psd) [i] = basePsdWattsHz;
328 for (
int i = 0; i <= 100; i++)
334 (*psd) [i] = 1.52e-4 * basePsdWattsHz;
338 (*psd) [i] = 2.93e-4 * basePsdWattsHz;
342 (*psd) [i] = 8.26e-4 * basePsdWattsHz;
346 (*psd) [i] = 0.0927 * basePsdWattsHz;
349 (*psd) [i] = basePsdWattsHz;
357 for (
int i = 0; i <= 100; i++)
365 (*psd) [i] = 27.07946e-08 * basePsdWattsHz;
370 (*psd) [i] = 2.51189e-07 * basePsdWattsHz;
375 (*psd) [i] = 1e-06 * basePsdWattsHz;
380 (*psd) [i] = 2.39883e-06 * basePsdWattsHz;
385 (*psd) [i] = 5.62341e-06 * basePsdWattsHz;
390 (*psd) [i] = 6.68344e-06 * basePsdWattsHz;
395 (*psd) [i] = 1.25893e-05 * basePsdWattsHz;
400 (*psd) [i] = 3.16228e-05 * basePsdWattsHz;
403 (*psd) [i] = 0.000158489 * basePsdWattsHz;
406 (*psd) [i] = basePsdWattsHz;
409 (*psd) [i] = 7.49894e-05 * basePsdWattsHz;
414 (*psd) [i] = 2.37137e-05 * basePsdWattsHz;
419 (*psd) [i] = 1.14815e-05 * basePsdWattsHz;
424 (*psd) [i] = 7.49894e-06 * basePsdWattsHz;
429 (*psd) [i] = 5.62341e-06 * basePsdWattsHz;
434 (*psd) [i] = 4.21697e-06 * basePsdWattsHz;
439 (*psd) [i] = 3.16228e-06 * basePsdWattsHz;
444 (*psd) [i] = 1.99526e-06 * basePsdWattsHz;
449 (*psd) [i] = 1.25893e-06 * basePsdWattsHz;
454 (*psd) [i] = 8.41395e-07 * basePsdWattsHz;
459 (*psd) [i] = 6.30957e-07 * basePsdWattsHz;
464 (*psd) [i] = 5.88844e-07 * basePsdWattsHz;
469 (*psd) [i] = 5.62341e-07 * basePsdWattsHz;
474 (*psd) [i] = 5.30884e-07 * basePsdWattsHz;
479 (*psd) [i] = 5.01187e-07 * basePsdWattsHz;
484 (*psd) [i] = 5.30884e-07 * basePsdWattsHz;
489 (*psd) [i] = 7.49894e-07 * basePsdWattsHz;
494 (*psd) [i] = 1.77828e-06 * basePsdWattsHz;
497 (*psd) [i] = 5.62341e-06 * basePsdWattsHz;
500 (*psd) [i] = 0.000177828 * basePsdWattsHz;
503 (*psd) [i] = 4.21697e-06 * basePsdWattsHz;
508 (*psd) [i] = 3.16228e-06 * basePsdWattsHz;
513 (*psd) [i] = 3.16228e-06 * basePsdWattsHz;
518 (*psd) [i] = 4.73151e-06 * basePsdWattsHz;
523 (*psd) [i] = 7.49894e-06 * basePsdWattsHz;
526 (*psd) [i] = 7.49894e-05 * basePsdWattsHz;
529 (*psd) [i] = 0.1 * basePsdWattsHz;
532 (*psd) [i] = 7.49894e-05 * basePsdWattsHz;
538 (*psd) [i] = 1.77828e-06 * basePsdWattsHz;
568 signal->txPhy = GetObject<SpectrumPhy> ();
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
virtual void SetupTx()
Sets up signal to be transmitted.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool m_active
True if TV transmitter is transmitting.
Ptr< AntennaModel > GetRxAntenna() const
Get the AntennaModel used by the NetDevice for reception.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
double bandwidth
Bandwidth [Hz].
bool operator<(const EventId &a, const EventId &b)
Ptr< SpectrumChannel > GetChannel() const
Get the spectrum channel.
Ptr< SpectrumValue > m_txPsd
Pointer to power spectral density of TV transmitter's signal.
double m_startFrequency
Start frequency (in Hz) of TV transmitter's signal.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
The building block of a SpectrumModel.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Ptr< SpectrumChannel > m_channel
Pointer to spectrum channel object.
SpectrumPhy implementation that creates a customizable TV transmitter which transmits a PSD spectrum ...
double fl
lower limit of subband
Smart pointer class similar to boost::intrusive_ptr.
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Used as key for map containing created spectrum models.
Ptr< AntennaModel > m_antenna
Pointer to antenna model object.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Time m_startingTime
Timepoint after simulation begins that TV transmitter will begin transmitting.
Abstract base class for Spectrum-aware PHY layers.
Time m_transmitDuration
Length of time that TV transmitter will transmit for.
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
virtual void Stop()
Stops the TV Transmitter's transmission on the spectrum channel.
TvSpectrumModelId(double stFreq, double bwidth)
Constructor.
double fc
center frequency
static std::map< TvSpectrumModelId, Ptr< SpectrumModel > > g_tvSpectrumModelMap
Stores created spectrum models.
virtual void CreateTvPsd()
Creates power spectral density (PSD) spectrum of the TV transmitter and sets it for transmission.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Hold variables of type string.
virtual ~TvSpectrumTransmitter()
double fh
upper limit of subband
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Ptr< SpectrumValue > GetTxPsd() const
Get the power spectral density of the TV transmitter's signal.
virtual void Start()
Starts the TV Transmitter's transmission on the spectrum channel.
std::vector< BandInfo > Bands
Container of BandInfo.
Ptr< NetDevice > m_netDevice
Pointer to net device object.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
enum TvType m_tvType
Type of TV transmitter.
AttributeValue implementation for Time.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
double m_basePsd
Base power spectral density value (in dBm/Hz) of TV transmitter's signal.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
double m_channelBandwidth
Bandwidth (in Hz) of TV transmitter's signal.
Ptr< MobilityModel > m_mobility
Pointer to mobility model object.
static TypeId GetTypeId(void)
Register this type.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
double startFrequency
Start frequency [Hz].
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.