27#include "ns3/buildings-module.h"
28#include "ns3/core-module.h"
29#include "ns3/mobility-module.h"
30#include "ns3/network-module.h"
31#include "ns3/spectrum-signal-parameters.h"
32#include "ns3/three-gpp-channel-model.h"
33#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
34#include "ns3/three-gpp-v2v-propagation-loss-model.h"
35#include "ns3/uniform-planar-array.h"
78 Vector aPos = thisDevice->GetNode()->GetObject<
MobilityModel>()->GetPosition();
79 Vector bPos = otherDevice->GetNode()->GetObject<
MobilityModel>()->GetPosition();
82 Angles completeAngle(bPos, aPos);
85 thisAntenna->SetBeamformingVector(bf);
101 NS_LOG_DEBUG(
"Pathloss " << -propagationGainDb <<
" dB");
102 double propagationGainLinear = std::pow(10.0, (propagationGainDb) / 10.0);
103 *(params.txParams->psd) *= propagationGainLinear;
112 NS_LOG_DEBUG(
"Average rx power " << 10 * log10(
Sum(*rxPsd) * 180e3) <<
" dB");
116 const double kT_dBm_Hz = -174.0;
117 double kT_W_Hz = std::pow(10.0, (kT_dBm_Hz - 30) / 10.0);
118 double noiseFigureLinear = std::pow(10.0, params.noiseFigure / 10.0);
119 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
128 f.open(
"example-output.txt", std::ios::out | std::ios::app);
130 << params.txMob->GetPosition().x <<
" " << params.txMob->GetPosition().y <<
" "
131 << params.rxMob->GetPosition().x <<
" " << params.rxMob->GetPosition().y <<
" "
132 << cond->GetLosCondition() <<
" "
157 Box box = (*it)->GetBoundaries();
158 outFile <<
"set object " << index <<
" rect from " <<
box.xMin <<
"," <<
box.yMin <<
" to "
159 <<
box.xMax <<
"," <<
box.yMax << std::endl;
166 double frequency = 28.0e9;
168 double noiseFigure = 9.0;
171 std::string scenario =
"V2V-Urban";
177 cmd.AddValue(
"frequency",
"operating frequency in Hz", frequency);
179 cmd.AddValue(
"noiseFigure",
"noise figure in dB", noiseFigure);
180 cmd.AddValue(
"scenario",
"3GPP propagation scenario, V2V-Urban or V2V-Highway", scenario);
215 if (scenario ==
"V2V-Urban")
283 else if (scenario ==
"V2V-Highway")
357 txParams->psd =
txPsd->Copy();
367 f.open(
"example-output.txt", std::ios::out);
368 f <<
"Time[s] TxPosX[m] TxPosY[m] RxPosX[m] RxPosY[m] ChannelState SNR[dB] Pathloss[dB]"
Class holding the azimuth and inclination angles of spherical coordinates.
AttributeValue implementation for Boolean.
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Parse command-line arguments.
Mobility model for which the current speed does not change once it has been set and until it is set a...
This class can be used to hold variables of floating point type such as 'double' or 'float'.
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.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
AttributeValue implementation for Pointer.
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
Waypoint-based mobility model.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
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.
Time MilliSeconds(uint64_t 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.
double Sum(const SpectrumValue &x)
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
A structure that holds the parameters for the ComputeSnr function.
Ptr< PhasedArrayModel > txAntenna
the tx antenna array
Ptr< MobilityModel > rxMob
the rx mobility model
double noiseFigure
the noise figure in dB
Ptr< SpectrumSignalParameters > txParams
the params of the tx signal
Ptr< PhasedArrayModel > rxAntenna
the rx antenna array
Ptr< MobilityModel > txMob
the tx mobility model
The building block of a SpectrumModel.
double fl
lower limit of subband
static Ptr< ChannelConditionModel > m_condModel
the ChannelConditionModel object
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.
static void ComputeSnr(const ComputeSnrParams ¶ms)
Compute the average SNR.
void PrintGnuplottableBuildingListToFile(std::string filename)
Generates a GNU-plottable file representing the buildings deployed in the scenario.
static Ptr< ThreeGppSpectrumPropagationLossModel > m_spectrumLossModel
the SpectrumPropagationLossModel object