LTE user documentation(if there are inappropriate places, please correct me!) )8 Mobility Model with buildingswe now explain how to use the buildings model in the NS-3 emulator (especially the mobilitybuildinginfo and Buildingpropagationmodel classes) by example To set up LTE simulation scenarios (including buildings and indoor nodes).
1. Included Header files:
#include <ns3/mobility-building-info.h><ns3/buildings-propagation-loss-model.h> <ns3/building.h>
2. Path loss Model selection:
ptr<ltehelper> ltehelper = createobject<ltehelper> (); Ltehelper->setattribute (" Pathlossmodel ", StringValue ("ns3::buildingspropagationlossmodel"));
3. Eutra Band Selection:
the operating band selection of the propagation model must be achieved through the standard Ns-3 property system described in the relevant chapters ("Configuring LTE Model Parameters"), for example, by setting the DLEARFCN and ULEARFCN parameters:
Ltehelper->setenbdeviceattribute ("dlearfcn", Uintegervalue ()); Ltehelper->setenbdeviceattribute ("ulearfcn", Uintegervalue (18100) );
Note that using other methods to configure the frequency bands used by the propagation model (for example, directly configuring the associated Buildingspropagationlossmodel property) may cause conflicts in the definition of frequency in the module during emulation, and is therefore not advocated.
1. Mobility Model Selection:
Mobilityhelper mobility;mobility. Setmobilitymodel ("ns3::constantpositionmobilitymodel");
2. Create a building:
DoubleX_min =0.0;DoubleX_max =10.0;DoubleY_min =0.0;DoubleY_max =20.0;DoubleZ_min =0.0;DoubleZ_max =10.0; Ptr<Building> B = CreateObject <Building>(); b-setboundaries (Box (X_min, X_max, Y_min, Y_max, Z_min, Z_max)); b-Setbuildingtype (building::residential); b-Setextwallstype (building::concretewithwindows); b->setnfloors (3); b->SETNROOMSX (3); b->setnroomsy (2);
The code will instantiate a residential building with a base of ten x 20 meters, a height of 10 meters and a concrete window on the outside, and a building with three layers and 3 x 2 internal grid rooms of the same size.
3. Node creation and location:
Uenodes.create (2); mobility. Install (Uenodes); Buildingshelper::install (Uenodes); Netdevicecontainer Uedevs;uedevs= ltehelper->Installuedevice (uenodes); Ptr<ConstantPositionMobilityModel> mm0 = Enbnodes.get (0)->getobject<constantpositionmobilitymodel> (); Ptr<ConstantPositionMobilityModel> mm1 = Enbnodes.get (1)->getobject<constantpositionmobilitymodel>(); MM0->setposition (Vector (5.0,5.0,1.5)); MM1->setposition (Vector (30.0,40.0,1.5));
4. Complete the configuration of the building and mobility model:
Buildingshelper::makemobilitymodelconsistent ();
See the
Buildings module documentation for details.
Reference documents
Https://www.nsnam.org/docs/models/html/lte-user.html
LTE Module User Documentation (translator 5)--mobility Model with buildings