Thank you so much for helping me. I was working down-link but when you told me that I should have a congestion even I get a change in throughput I tried to squint my work from the down-link to the up-link even I have congestion and can to see the change in each of throughput and delay but when I do a change in application output is become each of throughput and delay = 0. Could you help me please
#include "ns3/network-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/wifi-module.h"
#include "ns3/lte-module.h"
#include "ns3/mobility-module.h"
#include "ns3/applications-module.h"
#include "ns3/netanim-module.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/config-store-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/flow-monitor.h"
#include "ns3/ipv4-flow-classifier.h"
#include "ns3/ipv4-flow-probe.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv6-flow-classifier.h"
#include "ns3/ipv6-flow-probe.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/node.h"
#include "ns3/node-list.h"
#include "ns3/flow-monitor-helper.h"
#include "ns3/flow-monitor-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns-3-TCP");
std::string sock_factory = "ns3::TcpSocketFactory";
int main (int argc, char *argv[])
{
LogComponentEnable ("Ns-3-TCP", LOG_LEVEL_ALL);
double simTime = 30.0;
std::string datarate = "10Mbps";
CommandLine cmd;
cmd.AddValue ("stopTime", "StopTime of simulatino.", simTime);
cmd.Parse (argc, argv);
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
NodeContainer remoteHostContainer;
remoteHostContainer.Create (1);
InternetStackHelper stack;
stack.Install (remoteHostContainer);
PointToPointHelper pointToPoint;
NetDeviceContainer devices1, devices2;
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
Ipv4AddressHelper address1, address2;
std::ostringstream cmd_oss;
address1.SetBase ("10.1.0.0", "255.255.255.0");
address2.SetBase ("10.2.0.0", "255.255.255.0");
Ipv4InterfaceContainer ueIpFace, rmIpFace;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue (datarate));
pointToPoint.SetDeviceAttribute ("Mtu", UintegerValue (1500));
Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (320));
Ptr<RateErrorModel> em1 =
CreateObjectWithAttributes<RateErrorModel> ("RanVar", StringValue ("ns3::UniformRandomVariable[Min=0.0,Max=1.0]"),
"ErrorRate", DoubleValue (0.01),
"ErrorUnit", EnumValue (RateErrorModel::ERROR_UNIT_PACKET)
);
// Left link: H1 <-> LTE-R
NodeContainer enbNodes;
enbNodes.Create (1);
NodeContainer ueNodes;
ueNodes.Create (30);
stack.Install (ueNodes);
lteHelper->SetEpcHelper (epcHelper);
Ptr<Node> pgw = epcHelper->GetPgwNode ();
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (enbNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (ueNodes);
NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);
// Assign ip addresses
ueIpFace = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
lteHelper->Attach (ueLteDevs, enbLteDevs.Get (0));
Ptr<Ipv4StaticRouting> ueStaticRouting;
Ipv4StaticRoutingHelper ipv4RoutingHelper;
ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNodes.Get (0)->GetObject<Ipv4> ());
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
// LTE-R <-> H2
// Right link
devices2 = pointToPoint.Install (pgw, remoteHostContainer.Get (0));
devices2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em1));
rmIpFace = address2.Assign (devices2);
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
ApplicationContainer clientApps;
ApplicationContainer serverApps;
PacketSinkHelper ulPacketSinkHelper (sock_factory, InetSocketAddress (Ipv4Address::GetAny (), 1000));
serverApps.Add (ulPacketSinkHelper.Install (remoteHostContainer.Get (0)));
OnOffHelper ulClient = OnOffHelper (sock_factory,InetSocketAddress (ueIpFace.GetAddress (0), 1000));
ulClient.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
ulClient.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
ulClient.SetAttribute ("PacketSize", StringValue ("1024"));
ulClient.SetAttribute ("DataRate", StringValue (datarate));
clientApps.Add (ulClient.Install (ueNodes));
serverApps.Start (Seconds (0.01));
clientApps.Start (Seconds (4.0));
//LTE QoS bearer
EpsBearer bearer (EpsBearer::NGBR_VOICE_VIDEO_GAMING);
lteHelper->ActivateDedicatedEpsBearer (ueLteDevs, bearer, EpcTft::Default ());
pointToPoint.EnablePcapAll ("tcp-outdoor", false);
lteHelper->EnableTraces ();