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"
50 NS_LOG_COMPONENT_DEFINE(
"sat-link-budget-example");
55 Ptr<SatSignalParameters> params,
62 if (!destAdd.IsBroadcast())
64 NS_LOG_INFO(
"" << params->m_channelType <<
" " << ownAdd <<
" " << destAdd <<
" "
65 << params->m_beamId <<
" " << params->m_carrierFreq_hz <<
" "
73 main(
int argc,
char* argv[])
76 double latitude = 50.00;
77 double longitude = -1.00;
78 double altitude = 0.00;
81 auto simulationHelper = CreateObject<SimulationHelper>(
"example-link-budget");
82 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
83 std::string inputFileNameWithPath =
84 Singleton<SatEnvVariables>::Get()->LocateDirectory(
"contrib/satellite/examples") +
85 "/sat-link-budget-input-attributes.xml";
89 cmd.AddValue(
"beam",
"Beam to use for testing. (1 - 72)", beamId);
90 cmd.AddValue(
"latitude",
"Latitude of UT position (-90 ... 90.0)", latitude);
91 cmd.AddValue(
"longitude",
"Longitude of UT position (-180 ... 180)", longitude);
92 cmd.AddValue(
"altitude",
"Altitude of UT position (meters)", altitude);
93 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
94 cmd.Parse(argc, argv);
99 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(inputFileNameWithPath));
100 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Load"));
101 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
102 ConfigStore inputConfig;
103 inputConfig.ConfigureDefaults();
105 simulationHelper->SetUtCountPerBeam(1);
106 simulationHelper->SetUserCountPerUt(1);
107 simulationHelper->SetBeamSet({beamId});
108 simulationHelper->SetSimulationTime(Seconds(1.1));
111 LogComponentEnable(
"sat-link-budget-example", LOG_LEVEL_INFO);
114 Ptr<SatListPositionAllocator> posAllocator = CreateObject<SatListPositionAllocator>();
115 posAllocator->Add(
GeoCoordinate(latitude, longitude, altitude));
116 simulationHelper->SetUtPositionAllocatorForBeam(beamId, posAllocator);
118 simulationHelper->LoadScenario(
"geo-33E");
121 simulationHelper->CreateSatScenario();
124 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
127 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
130 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
133 Ptr<SatMobilityModel> utMob =
137 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
142 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
143 Singleton<SatTopology>::Get()->GetUtUserNodes(),
148 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
153 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
154 Singleton<SatTopology>::Get()->GetUtUserNodes(),
159 Ptr<SatMobilityModel> gwMob =
162 Ptr<Node> sat = Singleton<SatTopology>::Get()->GetOrbiterNode(0);
166 NS_LOG_INFO(
"--- satellite-link-budget-example ---");
167 NS_LOG_INFO(
" Beam ID: " << beamId);
168 NS_LOG_INFO(
" Sat position: " << satMob->GetGeoPosition() <<
" " << satMob->GetPosition());
169 NS_LOG_INFO(
" GW position: " << gwMob->GetGeoPosition() <<
" " << gwMob->GetPosition());
170 NS_LOG_INFO(
" UT position: " << utMob->GetGeoPosition() <<
" " << utMob->GetPosition());
172 NS_LOG_INFO(
"Link results (Time, Channel type, Own address, Dest. address, Beam ID, Carrier "
173 "Center freq, IF Power, RX Power, SINR, Composite SINR) :");
176 simulationHelper->RunSimulation();
GeoCoordinate class is used to store and operate with geodetic coordinates.
Keep track of the current position and velocity of an object in satellite network.
static T WToDbW(T w)
Converts Watts to Decibel Watts.
static T LinearToDb(T linear)
Converts linear to decibels.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static void LinkBudgetTraceCb(std::string context, Ptr< SatSignalParameters > params, Mac48Address ownAdd, Mac48Address destAdd, double ifPower, double cSinr)