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"
42NS_LOG_COMPONENT_DEFINE(
"sat-fwd-sys-test");
49 std::cout <<
"[BBFrameTx] Time: " << Now().GetSeconds() <<
", Frame Type: DUMMY_FRAME"
54 std::cout <<
"[BBFrameTx] " <<
"Time: " << Now().GetSeconds()
57 <<
", Occupancy: " << bbFrame->GetOccupancy()
58 <<
", Duration: " << bbFrame->GetDuration()
59 <<
", Space used: " << bbFrame->GetSpaceUsedInBytes()
60 <<
", Space Left: " << bbFrame->GetSpaceLeftInBytes();
62 std::cout <<
" [Receivers: ";
64 for (SatBbFrame::SatBbFramePayload_t::const_iterator it = bbFrame->GetPayload().begin();
65 it != bbFrame->GetPayload().end();
70 if ((*it)->PeekPacketTag(tag))
72 if (it != bbFrame->GetPayload().begin())
81 NS_FATAL_ERROR(
"No tag");
85 std::cout <<
"]" << std::endl;
91 std::cout <<
"[Merge Info Begins]" << std::endl;
92 std::cout <<
"Merge To -> ";
94 std::cout <<
"Merge From <- ";
96 std::cout <<
"[Merge Info Ends]" << std::endl;
100main(
int argc,
char* argv[])
103 LogComponentEnable(
"sat-fwd-sys-test", LOG_INFO);
106 uint32_t beamId = 26;
107 uint32_t gwEndUsers = 10;
109 uint32_t testCase = 0;
110 std::string trafficModel =
"cbr";
111 double simLength(40.0);
112 Time senderAppStartTime = Seconds(0.1);
113 bool traceFrameInfo =
false;
114 bool traceMergeInfo =
false;
116 uint32_t packetSize(128);
117 Time interval(MicroSeconds(50));
118 DataRate dataRate(DataRate(16000));
121 auto simulationHelper = CreateObject<SimulationHelper>(
"example-fwd-system-test");
122 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
124 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameHighOccupancyThreshold", DoubleValue(0.9));
125 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameLowOccupancyThreshold", DoubleValue(0.8));
126 Config::SetDefault(
"ns3::SatBbFrameConf::BBFrameUsageMode",
127 StringValue(
"ShortAndNormalFrames"));
128 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+07));
134 "Test case to execute. 0 = scheduler, ACM off, 1 = scheduler, ACM on, 2 = ACM one UT",
136 cmd.AddValue(
"gwEndUsers",
"Number of the GW end users", gwEndUsers);
137 cmd.AddValue(
"simLength",
"Length of simulation", simLength);
138 cmd.AddValue(
"traceFrameInfo",
"Trace (print) BB frame info", traceFrameInfo);
139 cmd.AddValue(
"traceMergeInfo",
"Trace (print) BB frame merge info", traceMergeInfo);
140 cmd.AddValue(
"beamId",
"Beam Id", beamId);
141 cmd.AddValue(
"trafficModel",
"Traffic model: either 'cbr' or 'onoff'", trafficModel);
142 cmd.AddValue(
"senderAppStartTime",
"Sender application (first) start time", senderAppStartTime);
143 cmd.Parse(argc, argv);
145 if (trafficModel !=
"cbr" && trafficModel !=
"onoff")
147 NS_FATAL_ERROR(
"Invalid traffic model, use either 'cbr' or 'onoff'");
150 simulationHelper->SetUtCountPerBeam(gwEndUsers);
151 simulationHelper->SetUserCountPerUt(1);
152 simulationHelper->SetSimulationTime(simLength);
153 simulationHelper->SetGwUserCount(gwEndUsers);
154 simulationHelper->SetBeamSet({beamId});
163 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
false));
167 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
171 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
172 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", StringValue(
"FadingMarkov"));
176 Config::SetDefault(
"ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(
true));
177 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
178 StringValue(
"BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
179 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
180 StringValue(
"BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
189 simulationHelper->LoadScenario(
"geo-33E");
192 simulationHelper->CreateSatScenario();
197 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatMac/BBFrameTxTrace",
204 Config::ConnectWithoutContext(
205 "/NodeList/*/DeviceList/*/SatMac/Scheduler/BBFrameContainer/BBFrameMergeTrace",
212 if (trafficModel ==
"cbr")
214 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
219 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
220 Singleton<SatTopology>::Get()->GetUtUserNodes(),
227 simulationHelper->GetTrafficHelper()->AddOnOffTraffic(
232 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
233 Singleton<SatTopology>::Get()->GetUtUserNodes(),
234 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
235 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
241 simulationHelper->EnableProgressLogs();
243 NS_LOG_INFO(
"--- sat-fwd-sys-test ---");
244 NS_LOG_INFO(
" Packet size: " << packetSize);
245 NS_LOG_INFO(
" Interval (CBR): " << interval.GetSeconds());
246 NS_LOG_INFO(
" Data rate (OnOff): " << dataRate);
247 NS_LOG_INFO(
" Simulation length: " << simLength);
248 NS_LOG_INFO(
" Number of GW end users: " << gwEndUsers);
263 simulationHelper->RunSimulation();
265 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)