22 #include "ns3/applications-module.h"
23 #include "ns3/core-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/network-module.h"
26 #include "ns3/satellite-module.h"
27 #include "ns3/traffic-module.h"
47 NS_LOG_COMPONENT_DEFINE(
"sat-cbr-user-defined-example");
51 CrTraceCb(Time now, Mac48Address addr, Ptr<SatCrMessage> crMsg)
53 NS_LOG_INFO(
"General info: " << addr <<
" " << crMsg->GetNumCapacityRequestElements() <<
" "
54 << crMsg->GetSizeInBytes() <<
" " << crMsg->GetCnoEstimate());
57 for (SatCrMessage::RequestContainer_t::const_iterator it = c.begin(); it != c.end(); ++it)
59 NS_LOG_INFO(
"CR component: " << (uint32_t)(it->first.first) <<
" " << it->first.second
60 <<
" " << it->second);
65 main(
int argc,
char* argv[])
73 uint32_t endUsersPerUt(3);
74 uint32_t utsPerBeam(3);
75 uint32_t packetSize(128);
76 Time interval(Seconds(1.0));
77 Time simLength(Seconds(20.0));
78 Time appStartTime = Seconds(0.1);
81 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
84 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
85 Ptr<SimulationHelper> simulationHelper =
86 CreateObject<SimulationHelper>(
"example-cbr-user-defined");
90 cmd.AddValue(
"endUsersPerUt",
"Number of end users per UT", endUsersPerUt);
91 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", utsPerBeam);
92 simulationHelper->AddDefaultUiArguments(cmd);
93 cmd.Parse(argc, argv);
101 simulationHelper->SetSimulationTime(simLength);
102 simulationHelper->SetUserCountPerUt(endUsersPerUt);
103 simulationHelper->SetUtCountPerBeam(utsPerBeam);
106 std::stringstream beamsEnabled;
107 beamsEnabled << beamId;
108 simulationHelper->SetBeams(beamsEnabled.str());
112 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
113 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
116 simulationHelper->LoadScenario(
"geo-33E");
119 simulationHelper->CreateSatScenario();
121 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatLlc/SatRequestManager/CrTrace",
127 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
132 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
133 Singleton<SatTopology>::Get()->GetUtUserNodes(),
138 NS_LOG_INFO(
"--- sat-cbr-user-defined-example ---");
139 NS_LOG_INFO(
" Packet size in bytes: " << packetSize);
140 NS_LOG_INFO(
" Packet sending interval: " << interval.GetSeconds());
141 NS_LOG_INFO(
" Simulation length: " << simLength.GetSeconds());
142 NS_LOG_INFO(
" Number of UTs: " << utsPerBeam);
143 NS_LOG_INFO(
" Number of end users per UT: " << endUsersPerUt);
146 simulationHelper->RunSimulation();
std::map< RequestDescriptor_t, uint16_t > RequestContainer_t
Define type RequestContainer_t.
ErrorModel
Error model enum.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static void CrTraceCb(Time now, Mac48Address addr, Ptr< SatCrMessage > crMsg)