12#include <ns3/double.h>
14#include <ns3/pointer.h>
45 TypeId(
"ns3::SpectrumChannel")
47 .SetGroupName(
"Spectrum")
48 .AddAttribute(
"MaxLossDb",
49 "If a single-frequency PropagationLossModel is used, "
50 "this value represents the maximum loss in dB for which "
51 "transmissions will be passed to the receiving PHY. "
52 "Signals for which the PropagationLossModel returns "
53 "a loss bigger than this value will not be propagated "
54 "to the receiver. This parameter is to be used to reduce "
55 "the computational load by not propagating signals "
56 "that are far beyond the interference range. Note that "
57 "the default value corresponds to considering all signals "
58 "for reception. Tune this value with care.",
63 .AddAttribute(
"PropagationLossModel",
64 "A pointer to the propagation loss model attached to this channel.",
69 .AddTraceSource(
"Gain",
70 "This trace is fired whenever a new path loss value "
71 "is calculated. The parameters to this trace are : "
72 "Pointer to the mobility model of the transmitter, "
73 "Pointer to the mobility model of the receiver, "
79 "ns3::SpectrumChannel::GainTracedCallback")
81 .AddTraceSource(
"PathLoss",
82 "This trace is fired whenever a new path loss value "
83 "is calculated. The first and second parameters "
84 "to the trace are pointers respectively to the TX and "
85 "RX SpectrumPhy instances, whereas the third parameters "
86 "is the loss value in dB. Note that the loss value "
87 "reported by this trace is the single-frequency loss "
88 "value obtained by evaluating only the TX and RX "
89 "AntennaModels and the PropagationLossModel. "
90 "In particular, note that SpectrumPropagationLossModel "
91 "(even if present) is never used to evaluate the "
92 "loss value reported in this trace.",
94 "ns3::SpectrumChannel::LossTracedCallback")
96 .AddTraceSource(
"TxSigParams",
97 "This trace is fired whenever a signal is transmitted. "
98 "The sole parameter is a pointer to a copy of the "
99 "SpectrumSignalParameters provided by the transmitter.",
101 "ns3::SpectrumChannel::SignalParametersTracedCallback");
192 auto currentStream = stream;
193 auto lastCurrentStream = stream;
198 if (currentStream - lastCurrentStream)
200 NS_LOG_DEBUG(
"PropagationLossModel objects used " << currentStream - lastCurrentStream
203 lastCurrentStream = currentStream;
209 if (currentStream - lastCurrentStream)
211 NS_LOG_DEBUG(
"PropagationDelayModel object used " << currentStream - lastCurrentStream
214 lastCurrentStream = currentStream;
219 if (currentStream - lastCurrentStream)
221 NS_LOG_DEBUG(
"SpectrumPropagationLossModel objects used "
222 << currentStream - lastCurrentStream <<
" streams");
224 lastCurrentStream = currentStream;
229 if (currentStream - lastCurrentStream)
231 NS_LOG_DEBUG(
"PhasedArraySpectrumPropagationLossModel objects used "
232 << currentStream - lastCurrentStream <<
" streams");
234 lastCurrentStream = currentStream;
237 currentStream +=
m_filter->AssignStreams(currentStream);
239 if (currentStream - lastCurrentStream)
241 NS_LOG_DEBUG(
"SpectrumTransmitFilter objects used " << currentStream - lastCurrentStream
245 NS_LOG_DEBUG(
"Assigned a total of " << currentStream - stream <<
" streams");
246 return (currentStream - stream);
Abstract Channel Base Class.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
TracedCallback< Ptr< SpectrumSignalParameters > > m_txSigParamsTrace
Traced callback for SpectrumSignalParameters in StartTx requests.
void DoDispose() override
Destructor implementation.
Ptr< SpectrumTransmitFilter > m_filter
Transmit filter to be used with this channel.
void AddSpectrumPropagationLossModel(Ptr< SpectrumPropagationLossModel > loss)
Add the frequency-dependent propagation loss model to be used.
SpectrumChannel()
constructor
Ptr< PropagationDelayModel > m_propagationDelay
Propagation delay model to be used with this channel.
void AddSpectrumTransmitFilter(Ptr< SpectrumTransmitFilter > filter)
Add the transmit filter to be used to filter possible signal receptions at the StartTx() time.
Ptr< SpectrumPropagationLossModel > m_spectrumPropagationLoss
Frequency-dependent propagation loss model to be used with this channel.
Ptr< PhasedArraySpectrumPropagationLossModel > m_phasedArraySpectrumPropagationLoss
Frequency-dependent propagation loss model to be used with this channel.
TracedCallback< Ptr< const SpectrumPhy >, Ptr< const SpectrumPhy >, double > m_pathLossTrace
The PathLoss trace source.
Ptr< SpectrumTransmitFilter > GetSpectrumTransmitFilter() const
Get the transmit filter, or first in a chain of transmit filters if more than one is present.
TracedCallback< Ptr< const MobilityModel >, Ptr< const MobilityModel >, double, double, double, double > m_gainTrace
The Gain trace source.
int64_t AssignStreams(int64_t stream)
This method calls AssignStreams() on any/all of the PropagationLossModel, PropagationDelayModel,...
Ptr< PropagationLossModel > m_propagationLoss
Single-frequency propagation loss model to be used with this channel.
static TypeId GetTypeId()
Get the type ID.
Ptr< SpectrumPropagationLossModel > GetSpectrumPropagationLossModel() const
Get the frequency-dependent propagation loss model.
virtual int64_t DoAssignStreams(int64_t stream)
This provides a base class implementation that may be subclassed if needed by subclasses that might n...
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
Ptr< PropagationLossModel > GetPropagationLossModel() const
Get the propagation loss model.
Ptr< PhasedArraySpectrumPropagationLossModel > GetPhasedArraySpectrumPropagationLossModel() const
Get the frequency-dependent propagation loss model that is compatible with the phased antenna arrays ...
Ptr< PropagationDelayModel > GetPropagationDelayModel() const
Get the propagation delay model that has been set on the channel.
double m_maxLossDb
Maximum loss [dB].
void AddPhasedArraySpectrumPropagationLossModel(Ptr< PhasedArraySpectrumPropagationLossModel > loss)
Add the frequency-dependent propagation loss model that is compapatible with the phased antenna array...
~SpectrumChannel() override
destructor
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
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.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)