9#include <ns3/command-line.h>
10#include <ns3/core-module.h>
11#include <ns3/double.h>
12#include <ns3/isotropic-antenna-model.h>
13#include <ns3/mobility-helper.h>
14#include <ns3/node-container.h>
15#include <ns3/object-factory.h>
16#include <ns3/pointer.h>
17#include <ns3/string.h>
18#include <ns3/three-gpp-channel-model.h>
19#include <ns3/three-gpp-propagation-loss-model.h>
20#include <ns3/three-gpp-spectrum-propagation-loss-model.h>
21#include <ns3/two-ray-spectrum-propagation-loss-model.h>
22#include <ns3/uinteger.h>
23#include <ns3/uniform-planar-array.h>
39constexpr double BW = 200e6;
62LogEndToEndGain(std::string cond, std::string scen,
double fc,
long int seed,
double gain)
64 *
g_outStream->GetStream() << cond <<
"\t" << scen <<
"\t" << fc <<
"\t" << seed <<
"\t" << gain
78 double f = fc - (numRbs *
RB_WIDTH / 2.0);
82 std::vector<int> rbsId;
83 rbsId.reserve(numRbs);
85 for (
uint32_t numrb = 0; numrb < numRbs; ++numrb)
95 rbsId.push_back(numrb);
100 double powerTxW = std::pow(10., (powerTx - 30) / 10);
101 double txPowerDensity = powerTxW /
BW;
103 for (
auto rbId : rbsId)
105 (*txPsd)[rbId] = txPowerDensity;
126 else if (cond ==
"NLOS")
142 threeGppSpectrumLossModel->SetAttribute(
"ChannelModel",
PointerValue(threeGppChannelModel));
143 threeGppChannelModel->SetAttribute(
"ChannelConditionModel",
152 signalParams->psd = txPsd;
155 threeGppChannelModel->SetAttribute(
"Frequency",
DoubleValue(fc));
158 threeGppChannelModel->SetAttribute(
"Scenario",
StringValue(scen));
161 threeGppChannelModel->SetAttribute(
"Blockage",
BooleanValue(
false));
166 Vector aPos = aMob->GetPosition();
167 Vector bPos = bMob->GetPosition();
170 Angles angleBtoA(bPos, aPos);
171 Angles angleAtoB(aPos, bPos);
174 aArray->SetBeamformingVector(aArray->GetBeamformingVector(angleBtoA));
175 bArray->SetBeamformingVector(bArray->GetBeamformingVector(angleAtoB));
178 auto rxParams = threeGppSpectrumLossModel->DoCalcRxPowerSpectralDensity(signalParams,
185 return rxPower / txPower;
189main(
int argc,
char* argv[])
192 bool enableOutput =
false;
195 cmd.AddValue(
"enableOutput",
"Logs the results of the example", enableOutput);
196 cmd.AddValue(
"numRealizations",
"The number of different realizations", numRealizations);
197 cmd.Parse(argc, argv);
202 *
g_outStream->GetStream() <<
"cond\tscen\tfc\tseed\tgain\n";
212 Vector aPos(0.0, 0.0, 0.0);
213 Vector bPos(10.0, 0.0, 0.0);
214 positionAlloc->Add(aPos);
215 positionAlloc->Add(bPos);
216 mobility.SetPositionAllocator(positionAlloc);
217 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
241 for (
uint32_t runIdx = 0; runIdx < numRealizations; runIdx++)
Class holding the azimuth and inclination angles of spherical coordinates.
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to assign positions and mobility models to nodes.
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.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
Hold an unsigned integer type.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
void LogEndToEndGain(std::string cond, std::string scen, double fc, long int seed, double gain)
const Ptr< OutputStreamWrapper > g_outStream
const std::vector< std::string > LOS_CONDITIONS
const std::vector< std::string > THREE_GPP_SCENARIOS
double ComputePowerSpectralDensityOverallPower(Ptr< const SpectrumValue > psd)
double ComputeEndToEndGain(std::string cond, std::string scen, double fc, Ptr< Node > a, Ptr< Node > b, Ptr< PhasedArrayModel > aArray, Ptr< PhasedArrayModel > bArray)
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fc)
constexpr double RB_WIDTH