22 #include "ns3/applications-module.h"
23 #include "ns3/config-store-module.h"
24 #include "ns3/core-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/network-module.h"
27 #include "ns3/satellite-module.h"
28 #include "ns3/traffic-module.h"
42 NS_LOG_COMPONENT_DEFINE(
"sat-fwd-sys-test");
49 std::cout <<
"[BBFrameTx] Time: " << Now().GetSeconds() <<
", Frame Type: DUMMY_FRAME"
54 std::cout <<
"[BBFrameTx] "
55 <<
"Time: " << Now().GetSeconds()
58 <<
", Occupancy: " << bbFrame->GetOccupancy()
59 <<
", Duration: " << bbFrame->GetDuration()
60 <<
", Space used: " << bbFrame->GetSpaceUsedInBytes()
61 <<
", Space Left: " << bbFrame->GetSpaceLeftInBytes();
63 std::cout <<
" [Receivers: ";
65 for (SatBbFrame::SatBbFramePayload_t::const_iterator it = bbFrame->GetPayload().begin();
66 it != bbFrame->GetPayload().end();
71 if ((*it)->PeekPacketTag(tag))
73 if (it != bbFrame->GetPayload().begin())
82 NS_FATAL_ERROR(
"No tag");
86 std::cout <<
"]" << std::endl;
92 std::cout <<
"[Merge Info Begins]" << std::endl;
93 std::cout <<
"Merge To -> ";
95 std::cout <<
"Merge From <- ";
97 std::cout <<
"[Merge Info Ends]" << std::endl;
101 main(
int argc,
char* argv[])
104 LogComponentEnable(
"sat-fwd-sys-test", LOG_INFO);
107 uint32_t beamId = 26;
108 uint32_t gwEndUsers = 10;
110 uint32_t testCase = 0;
111 std::string trafficModel =
"cbr";
112 double simLength(40.0);
113 Time senderAppStartTime = Seconds(0.1);
114 bool traceFrameInfo =
false;
115 bool traceMergeInfo =
false;
117 uint32_t packetSize(128);
118 Time interval(MicroSeconds(50));
119 DataRate dataRate(DataRate(16000));
122 auto simulationHelper = CreateObject<SimulationHelper>(
"example-fwd-system-test");
123 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
125 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameHighOccupancyThreshold", DoubleValue(0.9));
126 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameLowOccupancyThreshold", DoubleValue(0.8));
127 Config::SetDefault(
"ns3::SatBbFrameConf::BBFrameUsageMode",
128 StringValue(
"ShortAndNormalFrames"));
129 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+07));
135 "Test case to execute. 0 = scheduler, ACM off, 1 = scheduler, ACM on, 2 = ACM one UT",
137 cmd.AddValue(
"gwEndUsers",
"Number of the GW end users", gwEndUsers);
138 cmd.AddValue(
"simLength",
"Length of simulation", simLength);
139 cmd.AddValue(
"traceFrameInfo",
"Trace (print) BB frame info", traceFrameInfo);
140 cmd.AddValue(
"traceMergeInfo",
"Trace (print) BB frame merge info", traceMergeInfo);
141 cmd.AddValue(
"beamId",
"Beam Id", beamId);
142 cmd.AddValue(
"trafficModel",
"Traffic model: either 'cbr' or 'onoff'", trafficModel);
143 cmd.AddValue(
"senderAppStartTime",
"Sender application (first) start time", senderAppStartTime);
144 cmd.Parse(argc, argv);
146 if (trafficModel !=
"cbr" && trafficModel !=
"onoff")
148 NS_FATAL_ERROR(
"Invalid traffic model, use either 'cbr' or 'onoff'");
151 simulationHelper->SetUtCountPerBeam(gwEndUsers);
152 simulationHelper->SetUserCountPerUt(1);
153 simulationHelper->SetSimulationTime(simLength);
154 simulationHelper->SetGwUserCount(gwEndUsers);
155 simulationHelper->SetBeamSet({beamId});
164 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
false));
168 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
172 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
173 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", StringValue(
"FadingMarkov"));
177 Config::SetDefault(
"ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(
true));
178 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
179 StringValue(
"BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
180 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
181 StringValue(
"BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
190 simulationHelper->LoadScenario(
"geo-33E");
193 simulationHelper->CreateSatScenario();
198 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatMac/BBFrameTxTrace",
205 Config::ConnectWithoutContext(
206 "/NodeList/*/DeviceList/*/SatMac/Scheduler/BBFrameContainer/BBFrameMergeTrace",
213 if (trafficModel ==
"cbr")
215 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
220 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
221 Singleton<SatTopology>::Get()->GetUtUserNodes(),
228 simulationHelper->GetTrafficHelper()->AddOnOffTraffic(
233 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
234 Singleton<SatTopology>::Get()->GetUtUserNodes(),
235 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
236 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
242 simulationHelper->EnableProgressLogs();
244 NS_LOG_INFO(
"--- sat-fwd-sys-test ---");
245 NS_LOG_INFO(
" Packet size: " << packetSize);
246 NS_LOG_INFO(
" Interval (CBR): " << interval.GetSeconds());
247 NS_LOG_INFO(
" Data rate (OnOff): " << dataRate);
248 NS_LOG_INFO(
" Simulation length: " << simLength);
249 NS_LOG_INFO(
" Number of GW end users: " << gwEndUsers);
264 simulationHelper->RunSimulation();
266 Simulator::Destroy();
static std::string GetFrameTypeName(SatBbFrameType_t frameType)
static std::string GetModcodTypeName(SatModcod_t modcod)
This class implements a tag that carries the satellite MAC specific information, such as source and d...
Mac48Address GetDestAddress(void) const
Get destination MAC address.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static void PrintBbFrameMergeInfo(Ptr< SatBbFrame > mergeTo, Ptr< SatBbFrame > mergeFrom)
static void PrintBbFrameInfo(Ptr< SatBbFrame > bbFrame)