5#include "lena-v1-utils.h"
7#include "lena-v2-utils.h"
13LenaV1Utils::SetLenaV1SimulatorParameters(
const double sector0AngleRad,
15 NodeContainer enbSector1Container,
16 NodeContainer enbSector2Container,
17 NodeContainer enbSector3Container,
18 NodeContainer ueSector1Container,
19 NodeContainer ueSector2Container,
20 NodeContainer ueSector3Container,
21 Ptr<PointToPointEpcHelper>& epcHelper,
22 Ptr<LteHelper>& lteHelper,
23 NetDeviceContainer& enbSector1NetDev,
24 NetDeviceContainer& enbSector2NetDev,
25 NetDeviceContainer& enbSector3NetDev,
26 NetDeviceContainer& ueSector1NetDev,
27 NetDeviceContainer& ueSector2NetDev,
28 NetDeviceContainer& ueSector3NetDev,
31 SinrOutputStats* sinrStats,
32 PowerOutputStats* powerStats,
33 const std::string& scheduler,
34 uint32_t bandwidthMHz,
35 uint32_t freqScenario,
36 [[maybe_unused]]
double downtiltAngle)
68 uint32_t bandwidthBandDlRB;
69 uint32_t bandwidthBandUlRB;
71 if (bandwidthMHz == 20)
73 bandwidthBandDlRB = 100;
74 bandwidthBandUlRB = 100;
76 else if (bandwidthMHz == 15)
78 bandwidthBandDlRB = 75;
79 bandwidthBandUlRB = 75;
81 else if (bandwidthMHz == 10)
83 bandwidthBandDlRB = 50;
84 bandwidthBandUlRB = 50;
86 else if (bandwidthMHz == 5)
88 bandwidthBandDlRB = 25;
89 bandwidthBandUlRB = 25;
93 NS_ABORT_MSG(
"The configured bandwidth in MHz not supported:" << bandwidthMHz);
96 uint32_t centralFrequencyBand0Dl;
97 uint32_t centralFrequencyBand0Ul;
98 uint32_t centralFrequencyBand1Dl;
99 uint32_t centralFrequencyBand1Ul;
100 uint32_t centralFrequencyBand2Dl;
101 uint32_t centralFrequencyBand2Ul;
103 if (freqScenario == 0)
105 centralFrequencyBand0Dl = 100;
106 centralFrequencyBand0Ul = 200;
107 centralFrequencyBand1Dl = 300;
108 centralFrequencyBand1Ul = 400;
109 centralFrequencyBand2Dl = 500;
110 centralFrequencyBand2Ul = 600;
115 centralFrequencyBand0Dl = 100;
116 centralFrequencyBand0Ul = 18100;
117 centralFrequencyBand1Dl = 100;
118 centralFrequencyBand1Ul = 18100;
119 centralFrequencyBand2Dl = 100;
120 centralFrequencyBand2Ul = 18100;
124 double ueTxPower = 23;
125 std::string pathlossModel;
126 if (scenario ==
"UMa")
129 pathlossModel =
"ns3::ThreeGppUmaPropagationLossModel";
131 else if (scenario ==
"UMi")
134 pathlossModel =
"ns3::ThreeGppUmiStreetCanyonPropagationLossModel";
136 else if (scenario ==
"RMa")
139 pathlossModel =
"ns3::ThreeGppRmaPropagationLossModel";
143 NS_FATAL_ERROR(
"Selected scenario " << scenario
144 <<
" not valid. Valid values: UMa, UMi, RMa");
147 lteHelper = CreateObject<LteHelper>();
148 lteHelper->SetEpcHelper(epcHelper);
151 Config::SetDefault(
"ns3::FfMacScheduler::UlCqiFilter", EnumValue(FfMacScheduler::PUSCH_UL_CQI));
152 Config::SetDefault(
"ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(
false));
153 Config::SetDefault(
"ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(999999999));
154 Config::SetDefault(
"ns3::LteEnbPhy::TxPower", DoubleValue(txPower));
155 Config::SetDefault(
"ns3::LteUePhy::TxPower", DoubleValue(ueTxPower));
156 Config::SetDefault(
"ns3::LteUePhy::NoiseFigure", DoubleValue(9.0));
157 Config::SetDefault(
"ns3::LteUePhy::EnableRlfDetection", BooleanValue(
false));
158 Config::SetDefault(
"ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
159 lteHelper->SetAttribute(
"PathlossModel",
160 StringValue(pathlossModel));
163 lteHelper->SetPathlossModelAttribute(
"ShadowingEnabled", BooleanValue(!calibration));
165 if (scheduler ==
"PF")
167 lteHelper->SetSchedulerType(
"ns3::PfFfMacScheduler");
169 else if (scheduler ==
"RR")
171 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
174 Config::SetDefault(
"ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(enableUlPc));
178 lteHelper->SetEnbAntennaModelType(
"ns3::IsotropicAntennaModel");
182 lteHelper->SetEnbAntennaModelType(
"ns3::CosineAntennaModel");
183 lteHelper->SetEnbAntennaModelAttribute(
"HorizontalBeamwidth", DoubleValue(130));
184 lteHelper->SetEnbAntennaModelAttribute(
"MaxGain", DoubleValue(0));
186 lteHelper->SetEnbDeviceAttribute(
"DlBandwidth", UintegerValue(bandwidthBandDlRB));
187 lteHelper->SetEnbDeviceAttribute(
"UlBandwidth", UintegerValue(bandwidthBandUlRB));
192 double orientationDegrees = sector0AngleRad * 180.0 / M_PI;
193 lteHelper->SetEnbAntennaModelAttribute(
"Orientation", DoubleValue(orientationDegrees));
195 lteHelper->SetEnbDeviceAttribute(
"DlEarfcn", UintegerValue(centralFrequencyBand0Dl));
196 lteHelper->SetEnbDeviceAttribute(
"UlEarfcn", UintegerValue(centralFrequencyBand0Ul));
197 enbSector1NetDev = lteHelper->InstallEnbDevice(enbSector1Container);
202 double orientationDegrees = sector0AngleRad * 180.0 / M_PI + 120;
203 lteHelper->SetEnbAntennaModelAttribute(
"Orientation", DoubleValue(orientationDegrees));
206 lteHelper->SetEnbDeviceAttribute(
"DlEarfcn", UintegerValue(centralFrequencyBand1Dl));
207 lteHelper->SetEnbDeviceAttribute(
"UlEarfcn", UintegerValue(centralFrequencyBand1Ul));
208 enbSector2NetDev = lteHelper->InstallEnbDevice(enbSector2Container);
213 double orientationDegrees = sector0AngleRad * 180.0 / M_PI - 120;
214 lteHelper->SetEnbAntennaModelAttribute(
"Orientation", DoubleValue(orientationDegrees));
216 lteHelper->SetEnbDeviceAttribute(
"DlEarfcn", UintegerValue(centralFrequencyBand2Dl));
217 lteHelper->SetEnbDeviceAttribute(
"UlEarfcn", UintegerValue(centralFrequencyBand2Ul));
218 enbSector3NetDev = lteHelper->InstallEnbDevice(enbSector3Container);
220 ueSector1NetDev = lteHelper->InstallUeDevice(ueSector1Container);
221 NetDeviceContainer ueNetDevs(ueSector1NetDev);
222 ueSector2NetDev = lteHelper->InstallUeDevice(ueSector2Container);
223 ueNetDevs.Add(ueSector2NetDev);
224 ueSector3NetDev = lteHelper->InstallUeDevice(ueSector3Container);
226 int64_t randomStream = 1;
227 randomStream += lteHelper->AssignStreams(enbSector1NetDev, randomStream);
228 randomStream += lteHelper->AssignStreams(enbSector2NetDev, randomStream);
229 randomStream += lteHelper->AssignStreams(enbSector3NetDev, randomStream);
230 randomStream += lteHelper->AssignStreams(ueSector1NetDev, randomStream);
231 randomStream += lteHelper->AssignStreams(ueSector2NetDev, randomStream);
232 randomStream += lteHelper->AssignStreams(ueSector3NetDev, randomStream);
234 ueNetDevs.Add(ueSector3NetDev);
236 for (
auto nd = ueNetDevs.Begin(); nd != ueNetDevs.End(); ++nd)
238 auto ueNetDevice = DynamicCast<LteUeNetDevice>(*nd);
239 NS_ASSERT(ueNetDevice->GetCcMap().size() == 1);
240 auto uePhy = ueNetDevice->GetPhy();
242 uePhy->TraceConnectWithoutContext(
"ReportCurrentCellRsrpSinr",
243 MakeBoundCallback(&ReportSinrLena, sinrStats));
244 uePhy->TraceConnectWithoutContext(
"ReportPowerSpectralDensity",
245 MakeBoundCallback(&ReportPowerLena, powerStats));
248 lteHelper->Initialize();
249 auto dlSp = DynamicCast<ThreeGppPropagationLossModel>(
250 lteHelper->GetDownlinkSpectrumChannel()->GetPropagationLossModel());
251 auto ulSp = DynamicCast<ThreeGppPropagationLossModel>(
252 lteHelper->GetUplinkSpectrumChannel()->GetPropagationLossModel());
254 NS_ASSERT(dlSp !=
nullptr);
255 NS_ASSERT(ulSp !=
nullptr);
257 NS_ASSERT(dlSp->GetNext() ==
nullptr);
258 NS_ASSERT(ulSp->GetNext() ==
nullptr);
261 f.SetTypeId(TypeId::LookupByName(
"ns3::AlwaysLosChannelConditionModel"));
262 dlSp->SetChannelConditionModel(f.Create<ChannelConditionModel>());
263 ulSp->SetChannelConditionModel(f.Create<ChannelConditionModel>());
267LenaV1Utils::ReportSinrLena(SinrOutputStats* stats,
270 [[maybe_unused]]
double power,
274 LenaV2Utils::ReportSinrNr(stats, cellId, rnti, avgSinr,
static_cast<uint16_t
>(bwpId));
278LenaV1Utils::ReportPowerLena(PowerOutputStats* stats, uint16_t rnti, Ptr<SpectrumValue> txPsd)
281 LenaV2Utils::ReportPowerNr(stats, SfnSf(), txPsd, MilliSeconds(0), rnti, 0, 0, 0);