A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
three-gpp-spatiotemporal-channel-consistency-example.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, University of Padova, Dep. of Information Engineering, SIGNET lab
3 * Copyright (c) 2026, Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9/*
10 * @file
11 * This example shows how to configure spatially consistent channel updates in a mobile environment.
12 * This example is using the mobility-update mechanism of Procedure A described in
13 * 3GPP TR 38.901, Sec. 7.6.3.2, to evolve an existing channel realization as the endpoints move.
14 * Spatially consistent channel updates are enabled by setting the
15 * ThreeGppChannelModel UpdatePeriod attribute to a non-zero value.
16 *
17 * The example is inspired by 3GPP TR 38.901 Sec. 7.8.5 Config. 2 scenario setup for the
18 * evaluation of channel consistency with a moving user. The channel model is
19 * configured as 3GPP UMi Street Canyon, while the channel condition model is set to be a
20 * deterministic channel condition model based on the configured building obstacles, according to a
21 * typical 3GPP urban setup. See the illustration in the following figure:
22 *
23 * _______ _______
24 * | | | |
25 * | | | |
26 * | | | |
27 * |______| |______|
28 * < < < < <
29 * _______ ^ _______
30 * | | ^ | |
31 * | | ^ | |
32 * | | ^ | |
33 * |______| UE |______|
34 * * gNB
35 *
36 * gNB is at the fixed position (shown by * in the previous illustration), and at the height of 10
37 * meters. The user is moving away from gNB as illustrated in the figure with ^ and <. The link is
38 * initially in LOS and later transitions to NLOS because of the configured buildings.
39 *
40 * The UE moves with a speed of 30 km/h, the frequency used is 30 GHz, and the channel update is 0.5
41 * ms.
42 *
43 * The antenna arrays use fixed quasi-omnidirectional beamforming vectors throughout the simulation
44 * to isolate the SNR variation caused by channel evolution from changes due to beamforming updates.
45 * The antenna bearing angles are set to 90 degrees at the gNB and -90 degrees at the UE.
46 *
47 * This example generates the output file '3gpp-spatiotemporal-channel-consistency-output.txt'.
48 * Each row of this output file is organized as follows:
49 * Time[s] TxPosX[m] TxPosY[m] RxPosX[m] RxPosY[m] ChannelState SNR[dB] Pathloss[dB]
50 * 1st_C_Power[dB] 2nd_C_Power[dB] 3rd_C_Power[dB]
51 * 1st_C_Delay[s] 1st_C_Aoa[Degree] 1st_C_Zoa[Degree]
52 * 2nd_C_Delay[s] 2nd_C_Aoa[Degree] 2nd_C_Zoa[Degree]
53 * 3rd_C_Delay[s] 3rd_C_Aoa[Degree] 3rd_C_Zoa[Degree]
54 * C1ComponentPower[dB] C2ComponentPower[dB] C3ComponentPower[dB]
55 *
56 * The cluster powers, delays, and angles are obtained from the 3GPP channel parameters.
57 * The channel-component powers are computed from the corresponding components of the generated
58 * channel matrix as the mean squared magnitude over all TX/RX antenna-element pairs. In LOS,
59 * the first channel component therefore includes the deterministic LOS contribution coherently
60 * combined with the strongest stochastic cluster by the channel model.
61 *
62 * The additional Python script three-gpp-spatiotemporal-channel-consistency-example.py reads the
63 * output and generates static figures for the scenario, SNR, and channel-component and cluster
64 * metrics. The --animations option also generates 3gpp-spatiotemporal-channel-consistency.gif and
65 * spatiotemporal_channel_consistency_component_powers.gif, which represent the scenario, UE
66 * mobility, SNR, and SNR changes, and component power and changes in component powers.
67 */
68
69#include "ns3/buildings-module.h"
70#include "ns3/core-module.h"
71#include "ns3/mobility-module.h"
72#include "ns3/network-module.h"
73#include "ns3/spectrum-signal-parameters.h"
74#include "ns3/three-gpp-channel-model.h"
75#include "ns3/three-gpp-propagation-loss-model.h"
76#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
77#include "ns3/uniform-planar-array.h"
78
79#include <algorithm>
80#include <array>
81#include <fstream>
82#include <limits>
83
84using namespace ns3;
85
86/// the log component
87NS_LOG_COMPONENT_DEFINE("ThreeGppSpatiotemporalChannelConsistencyExample");
88
89/// the PropagationLossModel object
91/// the SpectrumPropagationLossModel object
93/// the ChannelConditionModel object
95
96/**
97 * @brief A structure that holds the parameters for the ComputeSnr
98 * function.
99 */
100struct ComputeSnrParams
101{
102 Ptr<MobilityModel> txMob; //!< the tx mobility model
103 Ptr<MobilityModel> rxMob; //!< the rx mobility model
104 Ptr<SpectrumSignalParameters> txParams; //!< the params of the tx signal
105 double noiseFigure; //!< the noise figure in dB
106 Ptr<PhasedArrayModel> txAntenna; //!< the tx antenna array
107 Ptr<PhasedArrayModel> rxAntenna; //!< the rx antenna array
109};
110
111/**
112 * Metrics for the first three channel components and clusters.
113 */
115{
116 std::array<double, 3> componentPowerDb;
117 //!< C1, C2, and C3 channel-component powers in dB,
118 //!< computed from the corresponding channel-matrix
119 //!< components
120 std::array<double, 3> clusterPowerDb;
121 //!< C1, C2, and C3 cluster powers in dB, taken from
122 //!< the 3GPP channel parameters
123 std::array<double, 3> delay; //!< C1, C2, and C3 delays in seconds
124 std::array<double, 3> aoa; //!< C1, C2, and C3 azimuth arrival angles in degrees
125 std::array<double, 3> zoa; //!< C1, C2, and C3 zenith arrival angles in degrees
126};
127
128/**
129 * Convert a non-negative linear power ratio to dB.
130 *
131 * @param power the linear power ratio
132 * @return the power ratio in dB
133 */
134static double
135PowerRatioToDb(double power)
136{
137 return 10.0 * std::log10(std::max(power, std::numeric_limits<double>::min()));
138}
139
140/**
141 * Get metrics for the first three channel components and clusters.
142 *
143 * The channel-component power is computed as the mean squared magnitude
144 * of the coefficients in each channel-matrix component (squared Frobenius
145 * norm normalized by the number of TX/RX antenna-element pairs). In LOS,
146 * component 0 therefore includes the deterministic LOS contribution
147 * coherently combined with the strongest stochastic cluster by the
148 * channel model.
149 *
150 * The cluster power, delay, AoA, and ZoA are taken directly from the
151 * channel parameters. These quantities retain their cluster-level
152 * definition and are used for the cluster-based spatial-consistency
153 * metrics.
154 *
155 * @param params the objects used to obtain the channel and channel parameters
156 * @return channel-component and cluster metrics for the first three entries
157 */
158static ChannelMetrics
160{
162 params.channelModel->GetChannel(params.txMob,
163 params.rxMob,
164 params.txAntenna,
165 params.rxAntenna);
166
168 params.channelModel->GetParams(params.txMob, params.rxMob);
169
172
173 NS_ABORT_MSG_IF(channelMatrix == nullptr, "The channel matrix is not available");
174
175 NS_ABORT_MSG_IF(channelParams == nullptr, "The 3GPP channel parameters are not available");
176
177 NS_ABORT_MSG_IF(channelMatrix->m_channel.GetNumPages() < 3,
178 "The channel matrix has fewer than three components");
179
180 NS_ABORT_MSG_IF(channelParams->m_clusterPower.size() < 3,
181 "The channel has fewer than three cluster powers");
182
183 NS_ABORT_MSG_IF(channelParams->m_delay.size() < 3,
184 "The channel has fewer than three cluster delays");
185
186 NS_ABORT_MSG_IF(channelParams->m_angle.size() <= MatrixBasedChannelModel::ZOA_INDEX ||
187 channelParams->m_angle[MatrixBasedChannelModel::AOA_INDEX].size() < 3 ||
188 channelParams->m_angle[MatrixBasedChannelModel::ZOA_INDEX].size() < 3,
189 "The channel has fewer than three cluster arrival angles");
190
191 const size_t numRows = channelMatrix->m_channel.GetNumRows();
192 const size_t numCols = channelMatrix->m_channel.GetNumCols();
193 const auto numElements = static_cast<double>(numRows * numCols);
194
195 std::array<double, 3> componentPower{0.0, 0.0, 0.0};
196
197 for (size_t componentIndex = 0; componentIndex < componentPower.size(); ++componentIndex)
198 {
199 for (size_t row = 0; row < numRows; ++row)
200 {
201 for (size_t col = 0; col < numCols; ++col)
202 {
203 componentPower[componentIndex] +=
204 std::norm(channelMatrix->m_channel(row, col, componentIndex));
205 }
206 }
207
208 componentPower[componentIndex] /= numElements;
209 }
210
211 return {{PowerRatioToDb(componentPower[0]),
212 PowerRatioToDb(componentPower[1]),
213 PowerRatioToDb(componentPower[2])},
214
215 {PowerRatioToDb(channelParams->m_clusterPower[0]),
216 PowerRatioToDb(channelParams->m_clusterPower[1]),
217 PowerRatioToDb(channelParams->m_clusterPower[2])},
218
219 {channelParams->m_delay[0], channelParams->m_delay[1], channelParams->m_delay[2]},
220
221 {channelParams->m_angle[MatrixBasedChannelModel::AOA_INDEX][0],
222 channelParams->m_angle[MatrixBasedChannelModel::AOA_INDEX][1],
223 channelParams->m_angle[MatrixBasedChannelModel::AOA_INDEX][2]},
224
225 {channelParams->m_angle[MatrixBasedChannelModel::ZOA_INDEX][0],
226 channelParams->m_angle[MatrixBasedChannelModel::ZOA_INDEX][1],
227 channelParams->m_angle[MatrixBasedChannelModel::ZOA_INDEX][2]}};
228}
229
230/**
231 * Set QuasiOmni beamforming vector to the antenna array
232 * @param antenna the antenna array to which will be set quasi omni beamforming vector
233 */
234static void
236{
237 PhasedArrayModel::ComplexVector antennaWeights;
238
239 auto antennaRows = antenna->GetNumRows();
240 auto antennaColumns = antenna->GetNumColumns();
241 auto numElemsPerPort = antenna->GetNumElemsPerPort();
242
243 double power = 1 / std::sqrt(numElemsPerPort);
244 size_t numPolarizations = antenna->IsDualPol() ? 2 : 1;
245
246 PhasedArrayModel::ComplexVector omni(antennaRows * antennaColumns * numPolarizations);
247 uint16_t bfIndex = 0;
248 for (size_t pol = 0; pol < numPolarizations; pol++)
249 {
250 for (uint32_t ind = 0; ind < antennaRows; ind++)
251 {
252 std::complex<double> c = 0.0;
253 if (antennaRows % 2 == 0)
254 {
255 c = std::exp(std::complex<double>(0, M_PI * ind * ind / antennaRows));
256 }
257 else
258 {
259 c = std::exp(std::complex<double>(0, M_PI * ind * (ind + 1) / antennaRows));
260 }
261 for (uint32_t ind2 = 0; ind2 < antennaColumns; ind2++)
262 {
263 std::complex<double> d = 0.0;
264 if (antennaColumns % 2 == 0)
265 {
266 d = std::exp(std::complex<double>(0, M_PI * ind2 * ind2 / antennaColumns));
267 }
268 else
269 {
270 d = std::exp(
271 std::complex<double>(0, M_PI * ind2 * (ind2 + 1) / antennaColumns));
272 }
273 omni[bfIndex] = (c * d * power);
274 bfIndex++;
275 }
276 }
277 }
278
279 antenna->SetBeamformingVector(omni);
280}
281
282/**
283 * Computes the SNR
284 * @param params A structure that holds a bunch of parameters needed by ComputeSnr function to
285 * calculate the average SNR
286 */
287static void
289{
290 // check the channel condition
291 Ptr<ChannelCondition> cond = g_condModel->GetChannelCondition(params.txMob, params.rxMob);
292 // apply the pathloss
293 double propagationGainDb = g_propagationLossModel->CalcRxPower(0, params.txMob, params.rxMob);
294 double propagationGainLinear = std::pow(10.0, (propagationGainDb) / 10.0);
295 *(params.txParams->psd) *= propagationGainLinear;
296 // apply the fast fading and the beamforming gain
297 auto rxParams =
298 g_spectrumLossModel->CalcRxPowerSpectralDensity(params.txParams,
299 params.txMob,
300 params.rxMob,
301 params.txAntenna,
302 params.rxAntenna,
303 params.txAntenna->GetBeamformingVector(),
304 params.rxAntenna->GetBeamformingVector());
305 Ptr<SpectrumValue> rxPsd = rxParams->psd;
306 const ChannelMetrics metrics = GetChannelMetrics(params);
307 // create the noise psd
308 // taken from lte-spectrum-value-helper
309 const double kTDbmHz = -174.0; // dBm/Hz
310 double kT_W_Hz = std::pow(10.0, (kTDbmHz - 30) / 10.0);
311 double noiseFigureLinear = std::pow(10.0, params.noiseFigure / 10.0);
312 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
313 Ptr<SpectrumValue> noisePsd = Create<SpectrumValue>(params.txParams->psd->GetSpectrumModel());
314 (*noisePsd) = noisePowerSpectralDensity;
315 // print the SNR and pathloss values to the output file
316 std::ofstream f;
317 f.open("3gpp-spatiotemporal-channel-consistency-output.txt", std::ios::out | std::ios::app);
318 f << Simulator::Now().GetSeconds() << " " // time [s]
319 << params.txMob->GetPosition().x << " " << params.txMob->GetPosition().y << " "
320 << params.rxMob->GetPosition().x << " " << params.rxMob->GetPosition().y << " "
321 << cond->GetLosCondition() << " " // channel state
322 << 10 * std::log10(Sum(*rxPsd) / Sum(*noisePsd)) << " " // SNR [dB]
323 << -propagationGainDb << " " // pathloss [dB]
324 << metrics.clusterPowerDb[0] << " " // C1 cluster power [dB]
325 << metrics.clusterPowerDb[1] << " " // C2 cluster power [dB]
326 << metrics.clusterPowerDb[2] << " " // C3 cluster power [dB]
327 << metrics.delay[0] << " " << metrics.aoa[0] << " " << metrics.zoa[0] << " "
328 << metrics.delay[1] << " " << metrics.aoa[1] << " " << metrics.zoa[1] << " "
329 << metrics.delay[2] << " " << metrics.aoa[2] << " " << metrics.zoa[2] << " "
330 << metrics.componentPowerDb[0] << " " << metrics.componentPowerDb[1] << " "
331 << metrics.componentPowerDb[2] << std::endl;
332
333 f.close();
334}
335
336/**
337 * Generates a GNU-plottable file representing the buildings deployed in the
338 * scenario
339 * @param filename the name of the output file
340 */
341void
343{
344 std::ofstream outFile;
345 outFile.open(filename, std::ios_base::out | std::ios_base::trunc);
346 if (!outFile.is_open())
347 {
348 NS_LOG_ERROR("Can't open file " << filename);
349 return;
350 }
351 for (auto it = BuildingList::Begin(); it != BuildingList::End(); ++it)
352 {
353 Box box = (*it)->GetBoundaries();
354 outFile << box.xMin << " " << box.yMin << " " << box.xMax << " " << box.yMax << std::endl;
355 }
356}
357
358int
359main(int argc, char* argv[])
360{
361 double frequency = 30e9; // operating frequency in Hz
362 double txPowerDbm = 35.0; // tx power in dBm
363 double noiseFigure = 9.0; // noise figure in dB
364 Time updatePeriod = MicroSeconds(500); // time resolution and the channel update time
365 double speed = 30.0 / 3.6; // speed of the mobile node in the scenario [m/s]
366 double rbWidthHz = 720e3; // RB width in Hz
367 uint32_t numRb = 275; // number of resource blocks
368 double gnbHeight = 10; // the height of the gNB
369 double ueHeight =
370 1.5; // the height of the UE (a bit higher than 1m because of the BP distance calculation)
371
372 // fix random parameters
375 uint64_t stream = 10000;
376
377 // create the nodes
379 nodes.Create(2);
380
381 // create the tx and rx devices
384
385 // associate the nodes and the devices
386 nodes.Get(0)->AddDevice(txDev);
387 txDev->SetNode(nodes.Get(0));
388 nodes.Get(1)->AddDevice(rxDev);
389 rxDev->SetNode(nodes.Get(1));
390
391 // create the antenna objects and set their dimensions
392 Ptr<PhasedArrayModel> txAntenna =
394 UintegerValue(2),
395 "NumRows",
396 UintegerValue(2),
397 "BearingAngle",
398 DoubleValue(M_PI / 2));
399 Ptr<PhasedArrayModel> rxAntenna =
401 UintegerValue(2),
402 "NumRows",
403 UintegerValue(2),
404 "BearingAngle",
405 DoubleValue(-M_PI / 2));
406
407 Ptr<MobilityModel> txMob;
408 Ptr<MobilityModel> rxMob;
409
410 // create a grid of buildings
411 double buildingSizeX = (250 - 3.5 * 2 - 3) / 2; // m
412 double buildingSizeY = (433 - 3.5 * 2 - 3) / 4; // m
413 double streetWidth = 20; // m
414 double buildingHeight = 10; // m
415 uint32_t numBuildingsX = 2;
416 uint32_t numBuildingsY = 2;
417 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
418 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
419
420 std::vector<Ptr<Building>> buildingVector;
421 for (uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
422 {
423 for (uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
424 {
425 Ptr<Building> building;
426 building = CreateObject<Building>();
427
428 building->SetBoundaries(Box(buildingIdX * (buildingSizeX + streetWidth),
429 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
430 buildingIdY * (buildingSizeY + streetWidth),
431 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
432 0.0,
433 buildingHeight));
434 building->SetNRoomsX(1);
435 building->SetNRoomsY(1);
436 building->SetNFloors(1);
437 buildingVector.push_back(building);
438 }
439 }
440
441 // set the mobility models of the TX(gNB) and RX(mobile UE)
443 txMob->SetPosition(Vector(maxAxisX / 2 - streetWidth / 2, -20, gnbHeight));
444 nodes.Get(0)->AggregateObject(txMob);
445
446 const Vector firstPosition(maxAxisX / 2 - streetWidth / 2, -10, ueHeight);
447 const Vector secondPosition(maxAxisX / 2 - streetWidth / 2,
448 maxAxisY / 2 - streetWidth / 2,
449 ueHeight);
450 const Vector thirdPosition(0.0, maxAxisY / 2 - streetWidth / 2, ueHeight);
451
452 Time nextWaypoint;
454 rxMob->GetObject<WaypointMobilityModel>()->AddWaypoint(Waypoint(nextWaypoint, firstPosition));
455 nextWaypoint += Seconds(CalculateDistance(firstPosition, secondPosition) / speed);
456 rxMob->GetObject<WaypointMobilityModel>()->AddWaypoint(Waypoint(nextWaypoint, secondPosition));
457 nextWaypoint += Seconds(CalculateDistance(secondPosition, thirdPosition) / speed);
458 rxMob->GetObject<WaypointMobilityModel>()->AddWaypoint(Waypoint(nextWaypoint, thirdPosition));
459 const Time simTime = nextWaypoint;
460 nodes.Get(1)->AggregateObject(rxMob);
461
462 // create the channel condition model
464
465 // create the propagation loss model
467
468 g_propagationLossModel->SetAttribute("Frequency", DoubleValue(frequency));
469 g_propagationLossModel->SetAttribute("ShadowingEnabled", BooleanValue(true));
470 g_propagationLossModel->SetAttribute("ChannelConditionModel", PointerValue(g_condModel));
471 stream += g_propagationLossModel->AssignStreams(stream);
472
473 // create the channel model
475 channelModel->SetAttribute("Scenario", StringValue("UMi-StreetCanyon"));
476 channelModel->SetAttribute("Frequency", DoubleValue(frequency));
477 channelModel->SetAttribute("ChannelConditionModel", PointerValue(g_condModel));
478 channelModel->SetAttribute("UpdatePeriod", TimeValue(updatePeriod));
479 stream += channelModel->AssignStreams(stream);
480
481 // create the spectrum propagation loss model
483 "ChannelModel",
484 PointerValue(channelModel));
485
487
488 // create the tx power spectral density
489 Bands rbs;
490 double freqSubBand = frequency;
491 for (uint32_t n = 0; n < numRb; ++n)
492 {
493 BandInfo rb;
494 rb.fl = freqSubBand;
495 freqSubBand += rbWidthHz / 2;
496 rb.fc = freqSubBand;
497 freqSubBand += rbWidthHz / 2;
498 rb.fh = freqSubBand;
499 rbs.push_back(rb);
500 }
501 Ptr<SpectrumModel> spectrumModel = Create<SpectrumModel>(rbs);
502 Ptr<SpectrumValue> txPsd = Create<SpectrumValue>(spectrumModel);
504 double txPowerW = std::pow(10., (txPowerDbm - 30) / 10);
505 double txPowDens = (txPowerW / (numRb * rbWidthHz));
506 (*txPsd) = txPowDens;
507 txParams->psd = txPsd->Copy();
508
509 CreateQuasiOmniBf(txAntenna);
510 CreateQuasiOmniBf(rxAntenna);
511
512 for (int i = 0; i < simTime / updatePeriod; i++)
513 {
515 params{txMob, rxMob, txParams->Copy(), noiseFigure, txAntenna, rxAntenna, channelModel};
516 Simulator::Schedule(updatePeriod * i, &ComputeSnr, params);
517 }
518 ComputeSnrParams finalParams{
519 txMob,
520 rxMob,
521 txParams->Copy(),
522 noiseFigure,
523 txAntenna,
524 rxAntenna,
525 channelModel,
526 };
527 Simulator::Schedule(simTime, &ComputeSnr, finalParams);
528 Simulator::Stop(simTime);
529
530 // initialize the output file
531 std::ofstream f;
532 f.open("3gpp-spatiotemporal-channel-consistency-output.txt", std::ios::out);
533 f << "Time[s] TxPosX[m] TxPosY[m] RxPosX[m] RxPosY[m] ChannelState SNR[dB] Pathloss[dB] "
534 "1st_C_Power[dB] 2nd_C_Power[dB] 3rd_C_Power[dB] "
535 "1st_C_Delay[s] 1st_C_Aoa[Degree] 1st_C_Zoa[Degree] "
536 "2nd_C_Delay[s] 2nd_C_Aoa[Degree] 2nd_C_Zoa[Degree] "
537 "3rd_C_Delay[s] 3rd_C_Aoa[Degree] 3rd_C_Zoa[Degree] "
538 "C1ComponentPower[dB] C2ComponentPower[dB] C3ComponentPower[dB]"
539 << std::endl;
540 f.close();
541
542 // print the list of buildings to file
543 PrintGnuplottableBuildingListToFile("3gpp-spatiotemporal-channel-consistency-buildings.txt");
544
547 return 0;
548}
a 3d box
Definition box.h:24
double yMax
The y coordinate of the top bound of the box.
Definition box.h:105
double xMin
The x coordinate of the left bound of the box.
Definition box.h:99
double yMin
The y coordinate of the bottom bound of the box.
Definition box.h:103
double xMax
The x coordinate of the right bound of the box.
Definition box.h:101
static Iterator End()
static Iterator Begin()
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
static const uint8_t AOA_INDEX
index of the AOA value in the m_angle array
static const uint8_t ZOA_INDEX
index of the ZOA value in the m_angle array
keep track of a set of node pointers.
ComplexMatrixArray ComplexVector
the underlying Valarray
AttributeValue implementation for Pointer.
Definition pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
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:580
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
Hold variables of type string.
Definition string.h:45
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:398
Hold an unsigned integer type.
Definition uinteger.h:34
a (time, location) pair.
Definition waypoint.h:25
Waypoint-based mobility model.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:99
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition log.h:253
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:201
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:492
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1347
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1313
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< BandInfo > Bands
Container of BandInfo.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:643
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition vector.cc:96
double Sum(const SpectrumValue &x)
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Metrics for the first three channel components and clusters.
std::array< double, 3 > delay
C1, C2, and C3 delays in seconds.
std::array< double, 3 > aoa
C1, C2, and C3 azimuth arrival angles in degrees.
std::array< double, 3 > clusterPowerDb
C1, C2, and C3 cluster powers in dB, taken from the 3GPP channel parameters.
std::array< double, 3 > componentPowerDb
C1, C2, and C3 channel-component powers in dB, computed from the corresponding channel-matrix compone...
std::array< double, 3 > zoa
C1, C2, and C3 zenith arrival angles in degrees.
A structure that holds the parameters for the ComputeSnr function.
Ptr< PhasedArrayModel > txAntenna
the tx antenna array
Ptr< MobilityModel > rxMob
the rx mobility model
Ptr< ThreeGppChannelModel > channelModel
the channel model
Ptr< SpectrumSignalParameters > txParams
the params of the tx signal
double noiseFigure
the noise figure in dB
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< ThreeGppSpectrumPropagationLossModel > g_spectrumLossModel
the SpectrumPropagationLossModel object
static Ptr< ThreeGppPropagationLossModel > g_propagationLossModel
the log component
static ChannelMetrics GetChannelMetrics(const ComputeSnrParams &params)
Get metrics for the first three channel components and clusters.
static double PowerRatioToDb(double power)
Convert a non-negative linear power ratio to dB.
static void ComputeSnr(const ComputeSnrParams &params)
Computes the SNR.
void PrintGnuplottableBuildingListToFile(std::string filename)
Generates a GNU-plottable file representing the buildings deployed in the scenario.
static Ptr< ChannelConditionModel > g_condModel
the ChannelConditionModel object
static void CreateQuasiOmniBf(Ptr< PhasedArrayModel > antenna)
Set QuasiOmni beamforming vector to the antenna array.
static void ComputeSnr(const ComputeSnrParams &params)
Compute the average SNR.