Hi everyone,
I'm going to simulating an LTE scenario to calculating the BER (BLER) to SINR curve. To doing this I want to fix the PDU size to a constant value because in any SNIR value it's going to change that prevents to estimate the actual BER. How can I this?
consider that I'm using LteHelper. I'll attach my code below to more info:
Tanks a lot already.
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
#include <ns3/buildings-module.h>
#include <iomanip>
#include <string>
#include <vector>
#include <ns3/building-position-allocator.h>
#include <ns3/netanim-module.h>
#include <ns3/flow-monitor-helper.h>
using namespace ns3;
int main (int argc, char *argv[])
{
uint32_t nFloors = 2;
uint16_t Ubw = 25;
uint16_t Dbw = 25;
double simTime = 1;
double EnTxPw = 30;
double UeTxPw = 10;
double EnNF = 5;
uint32_t nUe = 4;
uint32_t Constant = 0;
CommandLine cmd;
cmd.AddValue ("nFloors", "Number of floors, 0 for Friis propagation model",
nFloors);
cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)",
simTime);
cmd.AddValue ("UlBW" , "BandWith of Ul (in Mbps)" ,
Ubw);
cmd.AddValue ("DlBW" , "BandWith of Dl (in Mbps)" ,
Dbw);
cmd.AddValue ("EnTxPw" , "EnodB TX Power [30 dBm]" ,
EnTxPw);
cmd.AddValue ("EnNF" , "EnodB Nois Foiguer" ,
EnNF);
cmd.AddValue ("UeTxPw" , "UEs Tx Power [10 dBm]",
UeTxPw);
cmd.AddValue ("nUe" , "Number of total Ues (Max.Num=4)",
nUe);
cmd.AddValue ("UeMobility" , "The Mobility of UEs: 0 to RandomWalk 1 to ConstntPosiotion" ,
Constant);
cmd.Parse (argc, argv);
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again for override default values from the command line
cmd.Parse (argc, argv);
// the rest of the simulation program follows
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
/*
// Setting MacScheduler
// Uncommented to enabling all UEs to recieve PDU ****
lteHelper->SetSchedulerType("ns3::TdTbfqFfMacScheduler");
lteHelper->SetSchedulerAttribute("DebtLimit", IntegerValue(-625000)); // default value -625000 bytes (-5Mb)
lteHelper->SetSchedulerAttribute("CreditLimit", UintegerValue(625000)); // default value 625000 bytes (5Mb)
lteHelper->SetSchedulerAttribute("TokenPoolSize", UintegerValue(1)); // default value 1 byte
lteHelper->SetSchedulerAttribute("CreditableThreshold", UintegerValue(0)); // default value 0
*/
// Setting AMC Model and DataError Model
Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.003));
Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true));
// disabling Ideal RRC Protocol Model
Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
/* Setting Carrier aggregation
Config::SetDefault ("ns3::LteHelper::UseCa", BooleanValue (true));
Config::SetDefault ("ns3::LteHelper::NumberOfComponentCarriers", UintegerValue (2));
Config::SetDefault ("ns3::LteHelper::EnbComponentCarrierManager", StringValue ("ns3::RrComponentCarrierManager"));
*/
// Setting Pathloss Model and Building
if ( nFloors == 0)
{
lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // FreeSpace Model
}
else
{
lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel"));
lteHelper->SetPathlossModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0));
lteHelper->SetPathlossModelAttribute ("ShadowSigmaOutdoor", DoubleValue (1));
lteHelper->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (1.5));
// Building creation
double x_min = 1.0;
double x_max = 11.0;
double y_min = 1.0;
double y_max = 21.0;
double z_min = 0.0;
double z_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 (nFloors);
b->SetNRoomsX (2);
b->SetNRoomsY (3);
}
// Setting Fading Model
lteHelper->SetFadingModel("ns3::TraceFadingLossModel");
lteHelper->SetFadingModelAttribute ("TraceFilename", StringValue ("src/lte/model/fading-traces/fading_trace_ETU_3kmph.fad"));
lteHelper->SetFadingModelAttribute ("TraceLength", TimeValue (Seconds (10.0)));
lteHelper->SetFadingModelAttribute ("SamplesNum", UintegerValue (10000));
lteHelper->SetFadingModelAttribute ("WindowSize", TimeValue (Seconds (0.5)));
lteHelper->SetFadingModelAttribute ("RbNum", UintegerValue (100));
// Setting MIMO Antenna
Config::SetDefault ("ns3::LteEnbRrc::DefaultTransmissionMode", UintegerValue (2)); // MIMO Spatial Multiplexity (2 layers)
// Creating Nodes
NodeContainer enbNodes;
enbNodes.Create (1);
// Configure the Mobility model for enodB nodes
MobilityHelper enmobility;
Ptr<ListPositionAllocator> enposition = CreateObject<ListPositionAllocator> ();
enposition->Add(Vector (100,100,3.0));
enmobility.SetPositionAllocator(enposition);
enmobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
enmobility.Install (enbNodes);
BuildingsHelper::Install (enbNodes);
// Create The EnodB Devices and Install those LTE protocol stack on the eNB(s):
// 1-setting up the endbdev attributes
lteHelper->SetEnbDeviceAttribute("DlBandwidth",UintegerValue(Ubw)); // changing the DlBw of Enb before Creat
lteHelper->SetEnbDeviceAttribute("UlBandwidth",UintegerValue(Dbw)); // changing the UlBw of Enb before Creat
lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100));
lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100));
// Setting EndB Phisical Status
Config::SetDefault ("ns3::LteEnbPhy::TxPower" , DoubleValue (EnTxPw)); // Setting EndB Tx Power
//Config::SetDefault ("ns3::LteEnbPhy::NoiseFigure" , DoubleValue (EnNF)); // Setting EndB NoiseFigure
//Config::SetDefault ("ns3::LteUePhy::TxPower" , DoubleValue (UeTxPw)); // Setting EndB Tx Power
// 2-Creating the endbdev and install them to nodes
NetDeviceContainer enbDevs;
enbDevs = lteHelper->InstallEnbDevice (enbNodes);
// UeNode creation and positioning:
NodeContainer ueNodes;
ueNodes.Create (nUe);
// UEs mobility and position
MobilityHelper uemobility;
uemobility.SetPositionAllocator ("ns3::RandomBoxPositionAllocator",
"X", StringValue ("ns3::UniformRandomVariable[Min=1|Max=10]"),
"Y", StringValue ("ns3::UniformRandomVariable[Min=1|Max=20]"),
"Z", StringValue ("ns3::UniformRandomVariable[Min=0|Max=9]"));
if ( Constant == 1 )
{
uemobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
}
else
{
uemobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
"Bounds", RectangleValue (Rectangle (1,10,1,20)),
"Speed" , StringValue ("ns3::UniformRandomVariable[Min=0.01|Max=2]") );
// Random mobility in 0.01 <speed< 2 (m/s)
}
uemobility.Install (ueNodes);
BuildingsHelper::Install (ueNodes);
BuildingsHelper::MakeMobilityModelConsistent ();
//UEs Device
NetDeviceContainer ueDevs;
ueDevs = lteHelper->InstallUeDevice (ueNodes);
// Attach the UEs to an eNB
lteHelper->Attach (ueDevs, enbDevs.Get (0));
// Activate a data radio bearer between each UE and the eNB it is attached to:
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VIDEO;
EpsBearer bearer (q);
lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
Simulator::Stop (Seconds (simTime));
Config::SetDefault("ns3::RadioBearerStatsCalculator::EpochDuration", TimeValue (Seconds((simTime))));
lteHelper->EnableRlcTraces();
lteHelper->EnablePhyTraces();
//lteHelper->EnableMacTraces();
//lteHelper->EnablePdcpTraces();
AnimationInterface anim ("animation.xml");
Simulator::Run ();
Simulator::Destroy ();
return 0;
}