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 UintegerValue packetSize(128);
118 TimeValue interval(MicroSeconds(50));
119 DataRateValue dataRate(DataRate(16000));
122 auto simulationHelper = CreateObject<SimulationHelper>(
"example-fwd-system-test");
123 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
127 Config::SetDefault(
"ns3::CbrApplication::PacketSize", packetSize);
128 Config::SetDefault(
"ns3::CbrApplication::Interval", interval);
129 Config::SetDefault(
"ns3::OnOffApplication::PacketSize", packetSize);
130 Config::SetDefault(
"ns3::OnOffApplication::DataRate", dataRate);
131 Config::SetDefault(
"ns3::OnOffApplication::OnTime",
132 StringValue(
"ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]"));
133 Config::SetDefault(
"ns3::OnOffApplication::OffTime",
134 StringValue(
"ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]"));
136 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameHighOccupancyThreshold", DoubleValue(0.9));
137 Config::SetDefault(
"ns3::SatBbFrameConf::BbFrameLowOccupancyThreshold", DoubleValue(0.8));
138 Config::SetDefault(
"ns3::SatBbFrameConf::BBFrameUsageMode",
139 StringValue(
"ShortAndNormalFrames"));
140 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+07));
146 "Test case to execute. 0 = scheduler, ACM off, 1 = scheduler, ACM on, 2 = ACM one UT",
148 cmd.AddValue(
"gwEndUsers",
"Number of the GW end users", gwEndUsers);
149 cmd.AddValue(
"simLength",
"Length of simulation", simLength);
150 cmd.AddValue(
"traceFrameInfo",
"Trace (print) BB frame info", traceFrameInfo);
151 cmd.AddValue(
"traceMergeInfo",
"Trace (print) BB frame merge info", traceMergeInfo);
152 cmd.AddValue(
"beamId",
"Beam Id", beamId);
153 cmd.AddValue(
"trafficModel",
"Traffic model: either 'cbr' or 'onoff'", trafficModel);
154 cmd.AddValue(
"senderAppStartTime",
"Sender application (first) start time", senderAppStartTime);
155 cmd.Parse(argc, argv);
157 if (trafficModel !=
"cbr" && trafficModel !=
"onoff")
159 NS_FATAL_ERROR(
"Invalid traffic model, use either 'cbr' or 'onoff'");
164 simulationHelper->SetUtCountPerBeam(gwEndUsers);
165 simulationHelper->SetUserCountPerUt(1);
166 simulationHelper->SetSimulationTime(simLength);
167 simulationHelper->SetGwUserCount(gwEndUsers);
168 simulationHelper->SetBeamSet({beamId});
177 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
false));
181 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
185 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
186 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", StringValue(
"FadingMarkov"));
190 Config::SetDefault(
"ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(
true));
191 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
192 StringValue(
"BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
193 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
194 StringValue(
"BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
207 simulationHelper->CreateSatScenario();
212 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatMac/BBFrameTxTrace",
219 Config::ConnectWithoutContext(
220 "/NodeList/*/DeviceList/*/SatMac/Scheduler/BBFrameContainer/BBFrameMergeTrace",
227 simulationHelper->InstallTrafficModel(model,
234 simulationHelper->EnableProgressLogs();
236 NS_LOG_INFO(
"--- sat-fwd-sys-test ---");
237 NS_LOG_INFO(
" Packet size: " << packetSize.Get());
238 NS_LOG_INFO(
" Interval (CBR): " << interval.Get().GetSeconds());
239 NS_LOG_INFO(
" Data rate (OnOff): " << dataRate.Get());
240 NS_LOG_INFO(
" Simulation length: " << simLength);
241 NS_LOG_INFO(
" Number of GW end users: " << gwEndUsers);
256 simulationHelper->RunSimulation();
258 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)