LTE user documentation(if there are inappropriate places, please correct me!) )evolved Packet Core (EPC) we now explain how to write a simulation program that allows simulation of the EPC in addition to the LTE Wireless access network. The EPC allows the use of IPV4 networks to connect to LTE devices. In other words, conventional ns-3 applications and IPV4 sockets can be used on LTE and can connect the LTE network to any IPV4 network in the simulation. First, in addition to the ltehelper that we've covered in
Basic simulation program, you need to use an additional Epchelper class--responsible for creating EPC entities and network topologies. Note that you cannot use epchelper directly, because it is an abstract base class; instead, you need to use one of its subclasses--to provide a different implementation of the EPC topology. In this example, we will consider Pointtopointepchelper, which implements the EPC based on the point-to-point link. In order to use it, you first need to insert the following code in the emulator:
ptr<ltehelper> ltehelper = createobject<ltehelper> (); Ptr<PointToPointEpcHelper> epchelper = createobject<pointtopointepchelper> ();
then you need to tell the LTE helper to use the EPC next:
Ltehelper->setepchelper (Epchelper);
The above step is necessary, and LTE helper will trigger the appropriate EPC configuration with some related important configurations, such as when a base station or user is added to the simulation or when an EPS is created. In addition, all of these implementations are not subject to user intervention. calling Ltehelper->setepchelper (epchelper) will enable EPC to work with side effects-any new LTEENBRRC created The Epsbearertorlcmapping property is set to Rlc_um_always instead of Rlc_tm_always (the original document is written in Rlc_sm_always, Error!). If the latter is the default; otherwise, the property will not change (for example, if you modify the default property to Rlc_am_always, it will not change). Note that Epchelper will also automatically create the PGW node and configure it so that it can properly handle the business from/to the LTE wireless access network. However, you need to add some explicit code to connect PGW to other IPV4 networks (such as the Internet). Here is a very simple example of how to connect a single remote host to PGW via a point-to-point link:
Ptr<node> PGW = epchelper->Getpgwnode ();
//Create a remote hostNodecontainer remotehostcontainer;remotehostcontainer.create (1); Ptr<Node> remotehost = Remotehostcontainer.get (0); Internetstackhelper internet;internet. Install (Remotehostcontainer); //Creating the InternetPointtopointhelper p2ph;p2ph. Setdeviceattribute ("datarate", Dataratevalue (Datarate ("100gb/s"))); P2ph. Setdeviceattribute ("Mtu", Uintegervalue ( the)); P2ph. Setchannelattribute ("Delay", TimeValue (Seconds (0.010))); Netdevicecontainer internetdevices=p2ph. Install (PGW, remotehost); Ipv4addresshelper ipv4h;ipv4h. SetBase ("1.0.0.0","255.0.0.0"); Ipv4interfacecontainer internetipifaces=ipv4h. Assign (internetdevices);//interface 0 is a local host and 1 is a peer deviceIPv4Address remotehostaddr = internetipifaces.getaddress (1);
It is important to specify the route so that the remote host can reach the LTE user. One way to do this is to take advantage of the fact thatPointtopointepchelper allocates an IP address for an 7.0.0.0 network by default for LTE users . Suffice it to consider this:
Ipv4staticroutinghelper Ipv4routinghelper; Ptr<Ipv4StaticRouting> remotehoststaticrouting = ipv4routinghelper.getstaticrouting (remotehost-> Getobject<ipv4> ()); Remotehoststaticrouting->addnetworkrouteto (ipv4address ("7.0.0.0"), Ipv4mask ( " 255.0.0.0 " 1 );
now you should continue and create LTE base stations and users (refer to the previous section). Of course, you can configure other aspects of LTE, such as path loss and fading models. Once you have created your users, you should also configure them with an IP network. This is accomplished in the following way. We assume that you have a container that is loaded with users and base station nodes, similar to the following:
Nodecontainer Uenodes; Nodecontainer Enbnodes;
to configure an LTE-only emulation, you will typically do this:
Netdevicecontainer Ueltedevs = ltehelper->installuedevice (uenodes); Ltehelper->attach (UeLteDevs, Enbltedevs.get (0));
in order to configure the IP network for the user, you only need to add these extra:
//Installing the IP stack on the userInternetstackhelper internet;internet. Install (uenodes);//assigning IP addresses to users for(uint32_t u =0; U < UENODES.GETN (); ++u) {Ptr<Node> UE =uenodes.get (U); Ptr<NetDevice> Ueltedevice =ueltedevs.get (U); Ipv4interfacecontainer Ueipiface= epchelper->assignueipv4address (Netdevicecontainer (Ueltedevice)); //set a default gateway for usersptr<ipv4staticrouting> uestaticrouting = ipv4routinghelper.getstaticrouting (ue->GetObject<Ipv4> ()); Uestaticrouting->setdefaultroute (Epchelper->getuedefaultgatewayaddress (),1); }
the hosting activation of EPC is slightly different from lte-only simulation. First, when using EPC, the Activatedataradiobearer method is no longer used. Second, with EPC, when you call Ltehelper::attach (), the default EPS hosting is automatically activated. Third, if you want to set up dedicated EPS hosting, you can use the method Ltehelper::activatededicatedepsbearer () to implement. This method is considered as a parameter traffic flow template (TFT, business flow templates)-A struct that defines the type of business (which is mapped to a dedicated EPS bearer). Here's an example of how to set up a dedicated wireless host for an app when the user communicates on port 1234:
ptr<epctft> TFT = create<epctft>12341234, TFT--ADD (PF); Ltehelper->activatededicatedepsbearer (Ueltedevs, Epsbearer (Epsbearer::ngbr_video_tcp_default), TFT) ;
You can of course use custom epsbearer and Epctft configurations, refer to the Doxygen documentation to learn how to implement it. Finally, you can install applications on the LTE user node to communicate with remote applications over the Internet. This can be achieved through a general NS3 process. Next is a simple example of a remote host, how to set up downlink communication, a udpclient application on the remote host, and a packetsinkon the LTE user (with the same variable name as the previous code fragment).
1234 ; Packetsinkhelper Packetsinkhelper ("ns3::udpsocketfactory", = Packetsinkhelper.install (UE); Serverapps.start (Seconds (0.01)); Udpclienthelper Client (ueipiface.getaddress (0= client. Install (remotehost); Clientapps.start (Seconds (0.01));
Well, now you can start your simulation as usual:
Simulator::stop (Seconds (10.0)); Simulator::run ();
Reference documents
Https://www.nsnam.org/docs/models/html/lte-user.html
LTE Module User Documentation (translator 8)-core network (EPC)