A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
three-gpp-ntn-channel-example.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 SIGNET Lab, Department of Information Engineering,
3 * University of Padova
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19/**
20 * \file
21 * This example is a modified version of "three-gpp-channel-example", to include
22 * the 3GPP NTN channel model.
23 * Specifically, most changes (which are also highlighted throughout the code)
24 * impact the main method, and comprise:
25 * - the configuration of ad-hoc propagation and channel condition models;
26 * - the use of GeocentricConstantPositionMobilityModel for the nodes mobility.
27 * The pre-configured parameters are the one provided by 3GPP in TR 38.821,
28 * more specifically scenario 10 in down-link mode.
29 * Two static nodes, one on the ground and one in orbit, communicate with each other.
30 * The carrier frequency is set at 20GHz with 400MHz bandwidth.
31 * The result is the SNR of the signal and the path loss, saved in the ntn-snr-trace.txt file.
32 */
33
34#include "ns3/channel-condition-model.h"
35#include "ns3/constant-position-mobility-model.h"
36#include "ns3/core-module.h"
37#include "ns3/geocentric-constant-position-mobility-model.h"
38#include "ns3/isotropic-antenna-model.h"
39#include "ns3/mobility-model.h"
40#include "ns3/net-device.h"
41#include "ns3/node-container.h"
42#include "ns3/node.h"
43#include "ns3/parabolic-antenna-model.h"
44#include "ns3/simple-net-device.h"
45#include "ns3/spectrum-signal-parameters.h"
46#include "ns3/three-gpp-channel-model.h"
47#include "ns3/three-gpp-propagation-loss-model.h"
48#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
49#include "ns3/uniform-planar-array.h"
50#include <ns3/antenna-model.h>
51
52#include <fstream>
53
54NS_LOG_COMPONENT_DEFINE("NTNChannelExample");
55
56using namespace ns3;
57
59 m_propagationLossModel; //!< the PropagationLossModel object
61 m_spectrumLossModel; //!< the SpectrumPropagationLossModel object
62
63/**
64 * @brief Create the PSD for the TX
65 *
66 * @param fcHz the carrier frequency in Hz
67 * @param pwrDbm the transmission power in dBm
68 * @param bwHz the bandwidth in Hz
69 * @param rbWidthHz the Resource Block (RB) width in Hz
70 *
71 * @return the pointer to the PSD
72 */
74CreateTxPowerSpectralDensity(double fcHz, double pwrDbm, double bwHz, double rbWidthHz)
75{
76 unsigned int numRbs = std::floor(bwHz / rbWidthHz);
77 double f = fcHz - (numRbs * rbWidthHz / 2.0);
78 double powerTx = pwrDbm; // dBm power
79
80 Bands rbs; // A vector representing each resource block
81 for (uint32_t numrb = 0; numrb < numRbs; ++numrb)
82 {
83 BandInfo rb;
84 rb.fl = f;
85 f += rbWidthHz / 2;
86 rb.fc = f;
87 f += rbWidthHz / 2;
88 rb.fh = f;
89
90 rbs.push_back(rb);
91 }
92 Ptr<SpectrumModel> model = Create<SpectrumModel>(rbs);
93 Ptr<SpectrumValue> txPsd = Create<SpectrumValue>(model);
94
95 double powerTxW = std::pow(10., (powerTx - 30) / 10); // Get Tx power in Watts
96 double txPowerDensity = (powerTxW / bwHz);
97
98 for (auto psd = txPsd->ValuesBegin(); psd != txPsd->ValuesEnd(); ++psd)
99 {
100 *psd = txPowerDensity;
101 }
102
103 return txPsd; // [W/Hz]
104}
105
106/**
107 * @brief Create the noise PSD for the
108 *
109 * @param fcHz the carrier frequency in Hz
110 * @param noiseFigureDb the noise figure in dB
111 * @param bwHz the bandwidth in Hz
112 * @param rbWidthHz the Resource Block (RB) width in Hz
113 *
114 * @return the pointer to the noise PSD
115 */
117CreateNoisePowerSpectralDensity(double fcHz, double noiseFigureDb, double bwHz, double rbWidthHz)
118{
119 unsigned int numRbs = std::floor(bwHz / rbWidthHz);
120 double f = fcHz - (numRbs * rbWidthHz / 2.0);
121
122 Bands rbs; // A vector representing each resource block
123 std::vector<int> rbsId; // A vector representing the resource block IDs
124 for (uint32_t numrb = 0; numrb < numRbs; ++numrb)
125 {
126 BandInfo rb;
127 rb.fl = f;
128 f += rbWidthHz / 2;
129 rb.fc = f;
130 f += rbWidthHz / 2;
131 rb.fh = f;
132
133 rbs.push_back(rb);
134 rbsId.push_back(numrb);
135 }
136 Ptr<SpectrumModel> model = Create<SpectrumModel>(rbs);
137 Ptr<SpectrumValue> txPsd = Create<SpectrumValue>(model);
138
139 // see "LTE - From theory to practice"
140 // Section 22.4.4.2 Thermal Noise and Receiver Noise Figure
141 const double ktDbmHz = -174.0; // dBm/Hz
142 double ktWHz = std::pow(10.0, (ktDbmHz - 30) / 10.0); // W/Hz
143 double noiseFigureLinear = std::pow(10.0, noiseFigureDb / 10.0);
144
145 double noisePowerSpectralDensity = ktWHz * noiseFigureLinear;
146
147 for (auto rbId : rbsId)
148 {
149 (*txPsd)[rbId] = noisePowerSpectralDensity;
150 }
151
152 return txPsd; // W/Hz
153}
154
155/**
156 * \brief A structure that holds the parameters for the
157 * ComputeSnr function. In this way the problem with the limited
158 * number of parameters of method Schedule is avoided.
159 */
160struct ComputeSnrParams
161{
162 Ptr<MobilityModel> txMob; //!< the tx mobility model
163 Ptr<MobilityModel> rxMob; //!< the rx mobility model
164 double txPow; //!< the tx power in dBm
165 double noiseFigure; //!< the noise figure in dB
166 Ptr<PhasedArrayModel> txAntenna; //!< the tx antenna array
167 Ptr<PhasedArrayModel> rxAntenna; //!< the rx antenna array
168 double frequency; //!< the carrier frequency in Hz
169 double bandwidth; //!< the total bandwidth in Hz
170 double resourceBlockBandwidth; //!< the Resource Block bandwidth in Hz
171
172 /**
173 * \brief Constructor
174 * \param pTxMob the tx mobility model
175 * \param pRxMob the rx mobility model
176 * \param pTxPow the tx power in dBm
177 * \param pNoiseFigure the noise figure in dB
178 * \param pTxAntenna the tx antenna array
179 * \param pRxAntenna the rx antenna array
180 * \param pFrequency the carrier frequency in Hz
181 * \param pBandwidth the total bandwidth in Hz
182 * \param pResourceBlockBandwidth the Resource Block bandwidth in Hz
183 */
185 Ptr<MobilityModel> pRxMob,
186 double pTxPow,
187 double pNoiseFigure,
188 Ptr<PhasedArrayModel> pTxAntenna,
189 Ptr<PhasedArrayModel> pRxAntenna,
190 double pFrequency,
191 double pBandwidth,
192 double pResourceBlockBandwidth)
193 {
194 txMob = pTxMob;
195 rxMob = pRxMob;
196 txPow = pTxPow;
197 noiseFigure = pNoiseFigure;
198 txAntenna = pTxAntenna;
199 rxAntenna = pRxAntenna;
200 frequency = pFrequency;
201 bandwidth = pBandwidth;
202 resourceBlockBandwidth = pResourceBlockBandwidth;
203 }
204};
205
206/**
207 * Perform the beamforming using the DFT beamforming method
208 * \param thisDevice the device performing the beamforming
209 * \param thisAntenna the antenna object associated to thisDevice
210 * \param otherDevice the device towards which point the beam
211 */
212static void
214 Ptr<PhasedArrayModel> thisAntenna,
215 Ptr<NetDevice> otherDevice)
216{
217 // retrieve the position of the two devices
218 Vector aPos = thisDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
219 Vector bPos = otherDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
220
221 // compute the azimuth and the elevation angles
222 Angles completeAngle(bPos, aPos);
223 double hAngleRadian = completeAngle.GetAzimuth();
224 double vAngleRadian = completeAngle.GetInclination(); // the elevation angle
225
226 // retrieve the number of antenna elements and resize the vector
227 uint64_t totNoArrayElements = thisAntenna->GetNumElems();
228 PhasedArrayModel::ComplexVector antennaWeights(totNoArrayElements);
229
230 // the total power is divided equally among the antenna elements
231 double power = 1.0 / sqrt(totNoArrayElements);
232
233 // compute the antenna weights
234 const double sinVAngleRadian = sin(vAngleRadian);
235 const double cosVAngleRadian = cos(vAngleRadian);
236 const double sinHAngleRadian = sin(hAngleRadian);
237 const double cosHAngleRadian = cos(hAngleRadian);
238
239 for (uint64_t ind = 0; ind < totNoArrayElements; ind++)
240 {
241 Vector loc = thisAntenna->GetElementLocation(ind);
242 double phase = -2 * M_PI *
243 (sinVAngleRadian * cosHAngleRadian * loc.x +
244 sinVAngleRadian * sinHAngleRadian * loc.y + cosVAngleRadian * loc.z);
245 antennaWeights[ind] = exp(std::complex<double>(0, phase)) * power;
246 }
247
248 // store the antenna weights
249 thisAntenna->SetBeamformingVector(antennaWeights);
250}
251
252/**
253 * Compute the average SNR
254 * \param params A structure that holds the parameters that are needed to perform calculations in
255 * ComputeSnr
256 */
257static void
259{
260 Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity(params.frequency,
261 params.txPow,
262 params.bandwidth,
263 params.resourceBlockBandwidth);
264 Ptr<SpectrumValue> rxPsd = txPsd->Copy();
265 NS_LOG_DEBUG("Average tx power " << 10 * log10(Sum(*txPsd) * params.resourceBlockBandwidth)
266 << " dB");
267
268 // create the noise PSD
269 Ptr<SpectrumValue> noisePsd = CreateNoisePowerSpectralDensity(params.frequency,
270 params.noiseFigure,
271 params.bandwidth,
272 params.resourceBlockBandwidth);
273 NS_LOG_DEBUG("Average noise power "
274 << 10 * log10(Sum(*noisePsd) * params.resourceBlockBandwidth) << " dB");
275
276 // apply the pathloss
277 double propagationGainDb = m_propagationLossModel->CalcRxPower(0, params.txMob, params.rxMob);
278 NS_LOG_DEBUG("Pathloss " << -propagationGainDb << " dB");
279 double propagationGainLinear = std::pow(10.0, (propagationGainDb) / 10.0);
280 *(rxPsd) *= propagationGainLinear;
281
282 NS_ASSERT_MSG(params.txAntenna, "params.txAntenna is nullptr!");
283 NS_ASSERT_MSG(params.rxAntenna, "params.rxAntenna is nullptr!");
284
285 Ptr<SpectrumSignalParameters> rxSsp = Create<SpectrumSignalParameters>();
286 rxSsp->psd = rxPsd;
287 rxSsp->txAntenna =
288 ConstCast<AntennaModel, const AntennaModel>(params.txAntenna->GetAntennaElement());
289
290 // apply the fast fading and the beamforming gain
292 params.txMob,
293 params.rxMob,
294 params.txAntenna,
295 params.rxAntenna);
296 NS_LOG_DEBUG("Average rx power " << 10 * log10(Sum(*rxSsp->psd) * params.bandwidth) << " dB");
297
298 // compute the SNR
299 NS_LOG_DEBUG("Average SNR " << 10 * log10(Sum(*rxSsp->psd) / Sum(*noisePsd)) << " dB");
300
301 // print the SNR and pathloss values in the ntn-snr-trace.txt file
302 std::ofstream f;
303 f.open("ntn-snr-trace.txt", std::ios::out | std::ios::app);
304 f << Simulator::Now().GetSeconds() << " " << 10 * log10(Sum(*rxSsp->psd) / Sum(*noisePsd))
305 << " " << propagationGainDb << std::endl;
306 f.close();
307}
308
309int
310main(int argc, char* argv[])
311{
312 uint32_t simTimeMs = 1000; // simulation time in milliseconds
313 uint32_t timeResMs = 10; // time resolution in milliseconds
314
315 // Start changes with respect to three-gpp-channel-example
316 // SCENARIO 10 DL of TR 38.321
317 // This parameters can be set accordingly to 3GPP TR 38.821 or arbitrarily modified
318 std::string scenario = "NTN-Suburban"; // 3GPP propagation scenario
319 // All available NTN scenarios: DenseUrban, Urban, Suburban, Rural.
320
321 double frequencyHz = 20e9; // operating frequency in Hz
322 double bandwidthHz = 400e6; // Hz
323 double RbBandwidthHz = 120e3; // Hz
324
325 // Satellite parameters
326 double satEIRPDensity = 40; // dBW/MHz
327 double satAntennaGainDb = 58.5; // dB
328
329 // UE Parameters
330 double vsatAntennaGainDb = 39.7; // dB
331 double vsatAntennaNoiseFigureDb = 1.2; // dB
332 // End changes with respect to three-gpp-channel-example
333
334 /* Command line argument parser setup. */
335 CommandLine cmd(__FILE__);
336 cmd.AddValue("scenario",
337 "The 3GPP NTN scenario to use. Valid options are: "
338 "NTN-DenseUrban, NTN-Urban, NTN-Suburban, and NTN-Rural",
339 scenario);
340 cmd.AddValue("frequencyHz", "The carrier frequency in Hz", frequencyHz);
341 cmd.AddValue("bandwidthHz", "The bandwidth in Hz", bandwidthHz);
342 cmd.AddValue("satEIRPDensity", "The satellite EIRP density in dBW/MHz", satEIRPDensity);
343 cmd.AddValue("satAntennaGainDb", "The satellite antenna gain in dB", satAntennaGainDb);
344 cmd.AddValue("vsatAntennaGainDb", "The UE VSAT antenna gain in dB", vsatAntennaGainDb);
345 cmd.AddValue("vsatAntennaNoiseFigureDb",
346 "The UE VSAT antenna noise figure in dB",
347 vsatAntennaNoiseFigureDb);
348 cmd.Parse(argc, argv);
349
350 // Calculate transmission power in dBm using EIRPDensity + 10*log10(Bandwidth) - AntennaGain +
351 // 30
352 double txPowDbm = (satEIRPDensity + 10 * log10(bandwidthHz / 1e6) - satAntennaGainDb) + 30;
353
354 NS_LOG_DEBUG("Transmitting power: " << txPowDbm << "dBm, (" << pow(10., (txPowDbm - 30) / 10)
355 << "W)");
356
357 Config::SetDefault("ns3::ThreeGppChannelModel::UpdatePeriod",
358 TimeValue(MilliSeconds(10))); // update the channel at every 10 ms
359 Config::SetDefault("ns3::ThreeGppChannelConditionModel::UpdatePeriod",
360 TimeValue(MilliSeconds(0.0))); // do not update the channel condition
361
364
365 // create and configure the factories for the channel condition and propagation loss models
366 ObjectFactory propagationLossModelFactory;
367 ObjectFactory channelConditionModelFactory;
368
369 // Start changes with respect to three-gpp-channel-example
370 if (scenario == "NTN-DenseUrban")
371 {
372 propagationLossModelFactory.SetTypeId(
374 channelConditionModelFactory.SetTypeId(
376 }
377 else if (scenario == "NTN-Urban")
378 {
379 propagationLossModelFactory.SetTypeId(ThreeGppNTNUrbanPropagationLossModel::GetTypeId());
380 channelConditionModelFactory.SetTypeId(ThreeGppNTNUrbanChannelConditionModel::GetTypeId());
381 }
382 else if (scenario == "NTN-Suburban")
383 {
385 channelConditionModelFactory.SetTypeId(
387 }
388 else if (scenario == "NTN-Rural")
389 {
390 propagationLossModelFactory.SetTypeId(ThreeGppNTNRuralPropagationLossModel::GetTypeId());
391 channelConditionModelFactory.SetTypeId(ThreeGppNTNRuralChannelConditionModel::GetTypeId());
392 }
393 else
394 {
395 NS_FATAL_ERROR("Unknown NTN scenario");
396 }
397 // End changes with respect to three-gpp-channel-example
398
399 // create the propagation loss model
400 m_propagationLossModel = propagationLossModelFactory.Create<ThreeGppPropagationLossModel>();
401 m_propagationLossModel->SetAttribute("Frequency", DoubleValue(frequencyHz));
402 m_propagationLossModel->SetAttribute("ShadowingEnabled", BooleanValue(true));
403
404 // create the spectrum propagation loss model
405 m_spectrumLossModel = CreateObject<ThreeGppSpectrumPropagationLossModel>();
406 m_spectrumLossModel->SetChannelModelAttribute("Frequency", DoubleValue(frequencyHz));
408
409 // create the channel condition model and associate it with the spectrum and
410 // propagation loss model
412 channelConditionModelFactory.Create<ThreeGppChannelConditionModel>();
413 m_spectrumLossModel->SetChannelModelAttribute("ChannelConditionModel", PointerValue(condModel));
415
416 // create the tx and rx nodes
418 nodes.Create(2);
419
420 // create the tx and rx devices
421 Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice>();
422 Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice>();
423
424 // associate the nodes and the devices
425 nodes.Get(0)->AddDevice(txDev);
426 txDev->SetNode(nodes.Get(0));
427 nodes.Get(1)->AddDevice(rxDev);
428 rxDev->SetNode(nodes.Get(1));
429
430 // Start changes with respect to three-gpp-channel-example, here a mobility model
431 // tailored to NTN scenarios is used (GeocentricConstantPositionMobilityModel)
432 // create the tx and rx mobility models, set the positions
434 CreateObject<GeocentricConstantPositionMobilityModel>();
436 CreateObject<GeocentricConstantPositionMobilityModel>();
437
438 txMob->SetGeographicPosition(Vector(45.40869, 11.89448, 35786000)); // GEO over Padova
439 rxMob->SetGeographicPosition(Vector(45.40869, 11.89448, 14.0)); // Padova Coordinates
440
441 // This is not strictly necessary, but is useful to have "sensible" values when using
442 // GetPosition()
443 txMob->SetCoordinateTranslationReferencePoint(
444 Vector(45.40869, 11.89448, 0.0)); // Padova Coordinates without altitude
445 rxMob->SetCoordinateTranslationReferencePoint(
446 Vector(45.40869, 11.89448, 0.0)); // Padova Coordinates without altitude
447 // End changes with respect to three-gpp-channel-example,
448
449 NS_LOG_DEBUG("TX Position: " << txMob->GetPosition());
450 NS_LOG_DEBUG("RX Position: " << rxMob->GetPosition());
451
452 // assign the mobility models to the nodes
453 nodes.Get(0)->AggregateObject(txMob);
454 nodes.Get(1)->AggregateObject(rxMob);
455
456 // Start changes with respect to three-gpp-channel-example,
457 // Here antenna models mimic the gain achieved by the CircularApertureAntennaModel,
458 // which is not used to avoid inheriting the latter's dependence on either libstdc++
459 // or Boost.
460 Ptr<PhasedArrayModel> txAntenna = CreateObjectWithAttributes<UniformPlanarArray>(
461 "NumColumns",
462 UintegerValue(1),
463 "NumRows",
464 UintegerValue(1),
465 "AntennaElement",
467 CreateObjectWithAttributes<IsotropicAntennaModel>("Gain",
468 DoubleValue(satAntennaGainDb))));
469
470 Ptr<PhasedArrayModel> rxAntenna = CreateObjectWithAttributes<UniformPlanarArray>(
471 "NumColumns",
472 UintegerValue(1),
473 "NumRows",
474 UintegerValue(1),
475 "AntennaElement",
477 CreateObjectWithAttributes<IsotropicAntennaModel>("Gain",
478 DoubleValue(vsatAntennaGainDb))));
479 // End changes with respect to three-gpp-channel-example
480
481 // set the beamforming vectors
482 DoBeamforming(rxDev, rxAntenna, txDev);
483 DoBeamforming(txDev, txAntenna, rxDev);
484
485 for (int i = 0; i < floor(simTimeMs / timeResMs); i++)
486 {
487 Simulator::Schedule(MilliSeconds(timeResMs * i),
488 &ComputeSnr,
489 ComputeSnrParams(txMob,
490 rxMob,
491 txPowDbm,
492 vsatAntennaNoiseFigureDb,
493 txAntenna,
494 rxAntenna,
495 frequencyHz,
496 bandwidthHz,
497 RbBandwidthHz));
498 }
499
502 return 0;
503}
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
double GetInclination() const
Getter for inclination angle.
Definition: angles.cc:247
double GetAzimuth() const
Getter for azimuth angle.
Definition: angles.cc:241
Parse command-line arguments.
Definition: command-line.h:232
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Keep track of the current position and velocity of an object.
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:135
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:211
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:309
Ptr< SpectrumSignalParameters > CalcRxPowerSpectralDensity(Ptr< const SpectrumSignalParameters > txPsd, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const
This method is to be called to calculate.
AttributeValue implementation for Pointer.
Definition: pointer.h:48
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagationLossModel(s) chained to the current one.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
Hold variables of type string.
Definition: string.h:56
Base class for the 3GPP channel condition models.
static TypeId GetTypeId()
Register this type.
static TypeId GetTypeId()
Register this type.
Base class for the 3GPP propagation models.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model used to determine the channel state (e.g., the LOS/NLOS condition)
void SetChannelModelAttribute(const std::string &name, const AttributeValue &value)
Sets the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:403
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:894
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< BandInfo > Bands
Container of BandInfo.
double Sum(const SpectrumValue &x)
ns cmd
Definition: second.py:40
A structure that holds the parameters for the ComputeSnr function.
ComputeSnrParams(Ptr< MobilityModel > pTxMob, Ptr< MobilityModel > pRxMob, double pTxPow, double pNoiseFigure, Ptr< PhasedArrayModel > pTxAntenna, Ptr< PhasedArrayModel > pRxAntenna, double pFrequency, double pBandwidth, double pResourceBlockBandwidth)
Constructor.
Ptr< PhasedArrayModel > txAntenna
the tx antenna array
Ptr< MobilityModel > rxMob
the rx mobility model
double bandwidth
the total bandwidth in Hz
double noiseFigure
the noise figure in dB
double resourceBlockBandwidth
the Resource Block bandwidth in Hz
double txPow
the tx power in dBm
double frequency
the carrier frequency in Hz
Ptr< PhasedArrayModel > rxAntenna
the rx antenna array
Ptr< MobilityModel > txMob
the tx mobility model
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
static Ptr< ThreeGppPropagationLossModel > m_propagationLossModel
the PropagationLossModel object
static void DoBeamforming(Ptr< NetDevice > thisDevice, Ptr< PhasedArrayModel > thisAntenna, Ptr< NetDevice > otherDevice)
Perform the beamforming using the DFT beamforming method.
Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(double fcHz, double noiseFigureDb, double bwHz, double rbWidthHz)
Create the noise PSD for the.
static void ComputeSnr(ComputeSnrParams &params)
Compute the average SNR.
static Ptr< ThreeGppSpectrumPropagationLossModel > m_spectrumLossModel
the SpectrumPropagationLossModel object
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fcHz, double pwrDbm, double bwHz, double rbWidthHz)
Create the PSD for the TX.