42#include "ns3/antenna-module.h"
43#include "ns3/config-store.h"
44#include "ns3/core-module.h"
45#include "ns3/internet-module.h"
46#include "ns3/ipv4-global-routing-helper.h"
48#include "ns3/mobility-module.h"
49#include "ns3/network-module.h"
50#include "ns3/nr-eps-bearer-tag.h"
51#include "ns3/nr-helper.h"
52#include "ns3/nr-module.h"
53#include "ns3/nr-point-to-point-epc-helper.h"
54#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
58NS_LOG_COMPONENT_DEFINE(
"Cttc3gppChannelSimpleFdm");
75SendPacket(Ptr<NetDevice> device, Address& addr, uint32_t packetSize)
77 Ptr<Packet> pkt = Create<Packet>(packetSize);
83 pkt->AddHeader(ipHeader);
88 pkt->AddPacketTag(tag);
89 device->Send(pkt, addr, Ipv4L3Protocol::PROT_NUMBER);
102RxPdcpPDU(std::string path, uint16_t rnti, uint8_t lcid, uint32_t bytes, uint64_t pdcpDelay)
104 std::cout <<
"\n Packet PDCP delay:" << pdcpDelay <<
"\n";
119RxRlcPDU(std::string path, uint16_t rnti, uint8_t lcid, uint32_t bytes, uint64_t rlcDelay)
121 std::cout <<
"\n\n Data received by UE RLC at:" << Simulator::Now() << std::endl;
122 std::cout <<
"\n rnti:" << rnti << std::endl;
123 std::cout <<
"\n lcid:" << (unsigned)lcid << std::endl;
124 std::cout <<
"\n bytes :" << bytes << std::endl;
125 std::cout <<
"\n delay :" << rlcDelay << std::endl;
137 Config::Connect(
"/NodeList/*/DeviceList/*/NrUeRrc/DataRadioBearerMap/*/NrPdcp/RxPDU",
141 Config::Connect(
"/NodeList/*/DeviceList/*/NrUeRrc/DataRadioBearerMap/*/NrRlc/RxPDU",
146main(
int argc,
char* argv[])
149 uint16_t ueNumPergNb = 1;
150 uint16_t numerologyBwp1 = 4;
151 uint16_t numerologyBwp2 = 2;
152 double centralFrequencyBand = 28.1e9;
153 double bandwidthBand = 200e6;
154 double txPowerPerBwp = 4;
155 uint32_t packetSize = 1000;
158 Time sendPacketTime = Seconds(0.4);
160 CommandLine cmd(__FILE__);
161 cmd.AddValue(
"gNbNum",
"The number of gNbs in multiple-ue topology", gNbNum);
162 cmd.AddValue(
"ueNumPergNb",
"The number of UE per gNb in multiple-ue topology", ueNumPergNb);
163 cmd.AddValue(
"numerologyBwp1",
"The numerology to be used in bandwidth part 1", numerologyBwp1);
164 cmd.AddValue(
"numerologyBwp2",
"The numerology to be used in bandwidth part 2", numerologyBwp2);
165 cmd.AddValue(
"frequency",
"The system frequency", centralFrequencyBand);
166 cmd.AddValue(
"bandwidthBand",
"The system bandwidth", bandwidthBand);
167 cmd.AddValue(
"packetSize",
"packet size in bytes", packetSize);
168 cmd.AddValue(
"isUll",
"Enable Uplink", isUll);
169 cmd.Parse(argc, argv);
171 int64_t randomStream = 1;
183 gridScenario.SetScenarioHeight(3);
184 gridScenario.SetScenarioLength(3);
188 Config::SetDefault(
"ns3::NrEpsBearer::Release", UintegerValue(15));
190 Ptr<NrPointToPointEpcHelper> nrEpcHelper = CreateObject<NrPointToPointEpcHelper>();
191 Ptr<IdealBeamformingHelper> idealBeamformingHelper = CreateObject<IdealBeamformingHelper>();
192 Ptr<NrHelper> nrHelper = CreateObject<NrHelper>();
193 Ptr<NrChannelHelper> channelHelper = CreateObject<NrChannelHelper>();
195 nrHelper->SetBeamformingHelper(idealBeamformingHelper);
196 nrHelper->SetEpcHelper(nrEpcHelper);
198 channelHelper->ConfigureFactories(
"UMi",
"Default",
"ThreeGpp");
200 channelHelper->SetPathlossAttribute(
"ShadowingEnabled", BooleanValue(
false));
204 const uint8_t numCcPerBand = 1;
210 bandConf.m_numBwp = 2;
215 channelHelper->AssignChannelsToBands({band});
219 idealBeamformingHelper->SetAttribute(
"BeamformingMethod",
223 nrHelper->SetUeAntennaAttribute(
"NumRows", UintegerValue(2));
224 nrHelper->SetUeAntennaAttribute(
"NumColumns", UintegerValue(4));
225 nrHelper->SetUeAntennaAttribute(
"AntennaElement",
226 PointerValue(CreateObject<IsotropicAntennaModel>()));
229 nrHelper->SetGnbAntennaAttribute(
"NumRows", UintegerValue(4));
230 nrHelper->SetGnbAntennaAttribute(
"NumColumns", UintegerValue(8));
231 nrHelper->SetGnbAntennaAttribute(
"AntennaElement",
232 PointerValue(CreateObject<IsotropicAntennaModel>()));
234 uint32_t bwpIdForLowLat = 0;
235 uint32_t bwpIdForVoice = 1;
238 nrHelper->SetGnbBwpManagerAlgorithmAttribute(
"NGBR_LOW_LAT_EMBB",
239 UintegerValue(bwpIdForLowLat));
240 nrHelper->SetGnbBwpManagerAlgorithmAttribute(
"GBR_CONV_VOICE", UintegerValue(bwpIdForVoice));
243 nrHelper->SetUeBwpManagerAlgorithmAttribute(
"NGBR_LOW_LAT_EMBB", UintegerValue(bwpIdForLowLat));
244 nrHelper->SetUeBwpManagerAlgorithmAttribute(
"GBR_CONV_VOICE", UintegerValue(bwpIdForVoice));
247 NetDeviceContainer gnbNetDev =
249 NetDeviceContainer ueNetDev =
252 randomStream += nrHelper->AssignStreams(gnbNetDev, randomStream);
253 randomStream += nrHelper->AssignStreams(ueNetDev, randomStream);
256 nrHelper->GetGnbPhy(gnbNetDev.Get(0), 0)
257 ->SetAttribute(
"Numerology", UintegerValue(numerologyBwp1));
258 nrHelper->GetGnbPhy(gnbNetDev.Get(0), 1)
259 ->SetAttribute(
"Numerology", UintegerValue(numerologyBwp2));
260 nrHelper->GetGnbPhy(gnbNetDev.Get(0), 0)->SetTxPower(txPowerPerBwp);
261 nrHelper->GetGnbPhy(gnbNetDev.Get(0), 1)->SetTxPower(txPowerPerBwp);
263 InternetStackHelper internet;
265 Ipv4InterfaceContainer ueIpIface;
266 ueIpIface = nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueNetDev));
268 Simulator::Schedule(sendPacketTime,
271 ueNetDev.Get(0)->GetAddress(),
275 nrHelper->AttachToClosestGnb(ueNetDev, gnbNetDev);
277 Ptr<NrEpcTft> tft = Create<NrEpcTft>();
294 nrHelper->ActivateDedicatedEpsBearer(ueNetDev, bearer, tft);
298 nrHelper->EnableTraces();
300 Simulator::Stop(Seconds(1));
302 Simulator::Destroy();
Manages the correct creation of operation bands, component carriers and bandwidth parts.
OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf &conf)
Create an operation band with the CC specified.
static BandwidthPartInfoPtrVector GetAllBwps(const std::vector< std::reference_wrapper< OperationBandInfo > > &operationBands)
Get all the BWP pointers from the specified vector of operation bands.
The GridScenarioHelper class.
void SetRows(uint32_t r)
SetRows.
void SetHorizontalBsDistance(double d)
SetHorizontalBsDistance.
void CreateScenario() override
Create the scenario, with the configured parameter.
int64_t AssignStreams(int64_t stream)
void SetColumns(uint32_t c)
SetColumns.
const NodeContainer & GetUserTerminals() const
Get the list of user nodes.
void SetBsNumber(std::size_t n)
Set the number of base stations.
void SetUtNumber(std::size_t n)
Set the number of UT/UE.
const NodeContainer & GetBaseStations() const
Get the list of gnb/base station nodes.
This class contains the specification of EPS Bearers.
@ NGBR_LOW_LAT_EMBB
Non-GBR Low Latency eMBB applications.
@ GBR_CONV_VOICE
GBR Conversational Voice.
void SetBsHeight(double h)
SetGnbHeight.
void SetUtHeight(double h)
SetUeHeight.
void SetSectorization(SiteSectorizationType numSectors)
Sets the number of sectors of every site.
static int g_pdcpTraceCallbackCalled
static void SendPacket(Ptr< NetDevice > device, Address &addr, uint32_t packetSize)
static int g_rlcTraceCallbackCalled
void ConnectPdcpRlcTraces()
void RxPdcpPDU(std::string path, uint16_t rnti, uint8_t lcid, uint32_t bytes, uint64_t pdcpDelay)
void RxRlcPDU(std::string path, uint16_t rnti, uint8_t lcid, uint32_t bytes, uint64_t rlcDelay)
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
Minimum configuration requirements for a OperationBand.
uint16_t localPortStart
start of the port number range of the UE
uint16_t localPortEnd
end of the port number range of the UE
Operation band information structure.