11#include <ns3/antenna-model.h>
12#include <ns3/double.h>
14#include <ns3/integer.h>
15#include <ns3/isotropic-antenna-model.h>
17#include <ns3/pointer.h>
18#include <ns3/simulator.h>
19#include <ns3/string.h>
20#include <ns3/uinteger.h>
32 : m_mobility(nullptr),
36 m_tvType(TVTYPE_8VSB),
37 m_startFrequency(500e6),
38 m_channelBandwidth(6e6),
42 m_transmitDuration(
Seconds(0.2)),
62 TypeId(
"ns3::TvSpectrumTransmitter")
64 .SetGroupName(
"Spectrum")
68 "The type of TV transmitter/modulation to be used.",
77 .AddAttribute(
"StartFrequency",
78 "The lower end frequency (in Hz) of the TV transmitter's "
79 "signal. Must be greater than or equal to 0.",
83 .AddAttribute(
"ChannelBandwidth",
84 "The bandwidth (in Hz) of the TV transmitter's signal. Must "
85 "be greater than or equal to 0.",
89 .AddAttribute(
"BasePsd",
90 "The base power spectral density (in dBm/Hz) of the TV "
91 "transmitter's transmitted spectrum. Base PSD is the "
92 "maximum PSD of the spectrum excluding pilots. For analog "
93 "and COFDM transmitters this is the maximum PSD, but for "
94 "8-VSB transmitters this is the maximum PSD of the main "
95 "signal spectrum (flat-top segment) since the pilot "
96 "actually has the maximum PSD overall.",
100 .AddAttribute(
"Antenna",
101 "The AntennaModel to be used. Allows classes inherited "
102 "from ns3::AntennaModel. Defaults to ns3::IsotropicAntennaModel.",
106 .AddAttribute(
"StartingTime",
107 "The time point after the simulation begins in which the TV "
108 "transmitter will begin transmitting.",
112 .AddAttribute(
"TransmitDuration",
113 "The duration of time that the TV transmitter will transmit for.",
196 : startFrequency(stFreq),
242 model = iter->second;
254 bi.
fc = fl + halfSubBand;
255 bi.
fh = fl + (2 * halfSubBand);
262 double basePsdWattsHz = pow(10.0, (
m_basePsd - 30) / 10.0);
266 for (
int i = 0; i <= 100; i++)
272 (*psd)[i] = 0.015 * basePsdWattsHz;
276 (*psd)[i] = 0.019 * basePsdWattsHz;
280 (*psd)[i] = 0.034 * basePsdWattsHz;
284 (*psd)[i] = 0.116 * basePsdWattsHz;
288 (*psd)[i] = 0.309 * basePsdWattsHz;
291 (*psd)[i] = (0.502 * basePsdWattsHz) + (21.577 * basePsdWattsHz);
295 (*psd)[i] = 0.696 * basePsdWattsHz;
299 (*psd)[i] = 0.913 * basePsdWattsHz;
303 (*psd)[i] = 0.978 * basePsdWattsHz;
307 (*psd)[i] = 0.990 * basePsdWattsHz;
310 (*psd)[i] = 0.502 * basePsdWattsHz;
313 (*psd)[i] = basePsdWattsHz;
320 for (
int i = 0; i <= 100; i++)
326 (*psd)[i] = 1.52e-4 * basePsdWattsHz;
330 (*psd)[i] = 2.93e-4 * basePsdWattsHz;
334 (*psd)[i] = 8.26e-4 * basePsdWattsHz;
338 (*psd)[i] = 0.0927 * basePsdWattsHz;
341 (*psd)[i] = basePsdWattsHz;
348 for (
int i = 0; i <= 100; i++)
356 (*psd)[i] = 27.07946e-08 * basePsdWattsHz;
361 (*psd)[i] = 2.51189e-07 * basePsdWattsHz;
366 (*psd)[i] = 1e-06 * basePsdWattsHz;
371 (*psd)[i] = 2.39883e-06 * basePsdWattsHz;
376 (*psd)[i] = 5.62341e-06 * basePsdWattsHz;
381 (*psd)[i] = 6.68344e-06 * basePsdWattsHz;
386 (*psd)[i] = 1.25893e-05 * basePsdWattsHz;
391 (*psd)[i] = 3.16228e-05 * basePsdWattsHz;
394 (*psd)[i] = 0.000158489 * basePsdWattsHz;
397 (*psd)[i] = basePsdWattsHz;
400 (*psd)[i] = 7.49894e-05 * basePsdWattsHz;
405 (*psd)[i] = 2.37137e-05 * basePsdWattsHz;
410 (*psd)[i] = 1.14815e-05 * basePsdWattsHz;
415 (*psd)[i] = 7.49894e-06 * basePsdWattsHz;
420 (*psd)[i] = 5.62341e-06 * basePsdWattsHz;
425 (*psd)[i] = 4.21697e-06 * basePsdWattsHz;
430 (*psd)[i] = 3.16228e-06 * basePsdWattsHz;
435 (*psd)[i] = 1.99526e-06 * basePsdWattsHz;
440 (*psd)[i] = 1.25893e-06 * basePsdWattsHz;
445 (*psd)[i] = 8.41395e-07 * basePsdWattsHz;
450 (*psd)[i] = 6.30957e-07 * basePsdWattsHz;
455 (*psd)[i] = 5.88844e-07 * basePsdWattsHz;
460 (*psd)[i] = 5.62341e-07 * basePsdWattsHz;
465 (*psd)[i] = 5.30884e-07 * basePsdWattsHz;
470 (*psd)[i] = 5.01187e-07 * basePsdWattsHz;
475 (*psd)[i] = 5.30884e-07 * basePsdWattsHz;
480 (*psd)[i] = 7.49894e-07 * basePsdWattsHz;
485 (*psd)[i] = 1.77828e-06 * basePsdWattsHz;
488 (*psd)[i] = 5.62341e-06 * basePsdWattsHz;
491 (*psd)[i] = 0.000177828 * basePsdWattsHz;
494 (*psd)[i] = 4.21697e-06 * basePsdWattsHz;
502 (*psd)[i] = 3.16228e-06 * basePsdWattsHz;
507 (*psd)[i] = 4.73151e-06 * basePsdWattsHz;
512 (*psd)[i] = 7.49894e-06 * basePsdWattsHz;
515 (*psd)[i] = 7.49894e-05 * basePsdWattsHz;
518 (*psd)[i] = 0.1 * basePsdWattsHz;
521 (*psd)[i] = 7.49894e-05 * basePsdWattsHz;
527 (*psd)[i] = 1.77828e-06 * basePsdWattsHz;
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Abstract base class for Spectrum-aware PHY layers.
Hold variables of type string.
AttributeValue implementation for Time.
SpectrumPhy implementation that creates a customizable TV transmitter which transmits a PSD spectrum ...
Ptr< AntennaModel > m_antenna
Pointer to antenna model object.
TvType m_tvType
Type of TV transmitter.
Ptr< MobilityModel > GetMobility() const override
Get the associated MobilityModel instance.
virtual void CreateTvPsd()
Creates power spectral density (PSD) spectrum of the TV transmitter and sets it for transmission.
double m_basePsd
Base power spectral density value (in dBm/Hz) of TV transmitter's signal.
Time m_transmitDuration
Length of time that TV transmitter will transmit for.
bool m_active
True if TV transmitter is transmitting.
Ptr< NetDevice > m_netDevice
Pointer to net device object.
virtual void Start()
Starts the TV Transmitter's transmission on the spectrum channel.
void SetDevice(Ptr< NetDevice > d) override
Set the associated NetDevice instance.
void SetMobility(Ptr< MobilityModel > m) override
Set the mobility model associated with this device.
double m_channelBandwidth
Bandwidth (in Hz) of TV transmitter's signal.
double m_startFrequency
Start frequency (in Hz) of TV transmitter's signal.
Time m_startingTime
Timepoint after simulation begins that TV transmitter will begin transmitting.
virtual void Stop()
Stops the TV Transmitter's transmission on the spectrum channel.
virtual void SetupTx()
Sets up signal to be transmitted.
Ptr< const SpectrumModel > GetRxSpectrumModel() const override
~TvSpectrumTransmitter() override
Ptr< SpectrumValue > GetTxPsd() const
Get the power spectral density of the TV transmitter's signal.
Ptr< SpectrumChannel > GetChannel() const
Get the spectrum channel.
Ptr< Object > GetAntenna() const override
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
void SetChannel(Ptr< SpectrumChannel > c) override
Set the channel attached to this device.
static TypeId GetTypeId()
Register this type.
Ptr< SpectrumChannel > m_channel
Pointer to spectrum channel object.
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
Ptr< NetDevice > GetDevice() const override
Get the associated NetDevice instance.
Ptr< SpectrumValue > m_txPsd
Pointer to power spectral density of TV transmitter's signal.
Ptr< MobilityModel > m_mobility
Pointer to mobility model object.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
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.
std::vector< BandInfo > Bands
Container of BandInfo.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
bool operator<(const EventId &a, const EventId &b)
static std::map< TvSpectrumModelId, Ptr< SpectrumModel > > g_tvSpectrumModelMap
Stores created spectrum models.
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
Used as key for map containing created spectrum models.
TvSpectrumModelId(double stFreq, double bwidth)
Constructor.
double startFrequency
Start frequency [Hz].
double bandwidth
Bandwidth [Hz].