33 #include <ns3/config.h>
35 #include <ns3/internet-stack-helper.h>
36 #include <ns3/ipv4-interface.h>
37 #include <ns3/ipv4-static-routing-helper.h>
39 #include <ns3/mobility-helper.h>
40 #include <ns3/pointer.h>
41 #include <ns3/satellite-antenna-gain-pattern-container.h>
42 #include <ns3/satellite-arp-cache.h>
43 #include <ns3/satellite-bstp-controller.h>
44 #include <ns3/satellite-channel.h>
45 #include <ns3/satellite-const-variables.h>
46 #include <ns3/satellite-enums.h>
47 #include <ns3/satellite-fading-input-trace-container.h>
48 #include <ns3/satellite-fading-input-trace.h>
49 #include <ns3/satellite-gw-llc.h>
50 #include <ns3/satellite-gw-mac.h>
51 #include <ns3/satellite-id-mapper.h>
52 #include <ns3/satellite-lorawan-net-device.h>
53 #include <ns3/satellite-mobility-model.h>
54 #include <ns3/satellite-orbiter-net-device.h>
55 #include <ns3/satellite-packet-trace.h>
56 #include <ns3/satellite-phy-rx.h>
57 #include <ns3/satellite-phy-tx.h>
58 #include <ns3/satellite-phy.h>
59 #include <ns3/satellite-propagation-delay-model.h>
60 #include <ns3/satellite-sgp4-mobility-model.h>
61 #include <ns3/satellite-topology.h>
62 #include <ns3/satellite-typedefs.h>
63 #include <ns3/satellite-ut-llc.h>
64 #include <ns3/satellite-ut-mac.h>
65 #include <ns3/satellite-utils.h>
66 #include <ns3/singleton.h>
67 #include <ns3/string.h>
68 #include <ns3/traffic-control-helper.h>
81 NS_LOG_COMPONENT_DEFINE(
"SatBeamHelper");
86 NS_OBJECT_ENSURE_REGISTERED(SatBeamHelper);
92 TypeId(
"ns3::SatBeamHelper")
94 .AddConstructor<SatBeamHelper>()
95 .AddAttribute(
"CarrierFrequencyConverter",
96 "Callback to convert carrier id to generate frequency.",
99 MakeCallbackChecker())
100 .AddAttribute(
"FadingModel",
110 .AddAttribute(
"RandomAccessModel",
111 "Random Access Model",
113 MakeEnumAccessor<SatEnums::RandomAccessModel_t>(
122 "RaRcs2Specification",
127 .AddAttribute(
"RaInterferenceModel",
128 "Interference model for random access",
130 MakeEnumAccessor<SatPhyRxCarrierConf::InterferenceModel>(
140 .AddAttribute(
"RaInterferenceEliminationModel",
141 "Interference elimination model for random access",
143 MakeEnumAccessor<SatPhyRxCarrierConf::InterferenceEliminationModel>(
151 "Collision model for random access",
153 MakeEnumAccessor<SatPhyRxCarrierConf::RandomAccessCollisionModel>(
156 "RaCollisionNotDefined",
158 "RaCollisionAlwaysDropCollidingPackets",
160 "RaCollisionCheckAgainstSinr",
162 "RaCollisionConstantErrorProbability"))
163 .AddAttribute(
"RaConstantErrorRate",
164 "Constant error rate for random access",
167 MakeDoubleChecker<double>())
168 .AddAttribute(
"PropagationDelayModel",
169 "Propagation delay model",
171 MakeEnumAccessor<SatEnums::PropagationDelayModel_t>(
177 .AddAttribute(
"ConstantPropagationDelay",
178 "Constant propagation delay",
179 TimeValue(Seconds(0.13)),
183 "PrintDetailedInformationToCreationTraces",
184 "Print detailed information to creation traces",
187 MakeBooleanChecker())
188 .AddAttribute(
"CtrlMsgStoreTimeInFwdLink",
189 "Time to store a control message in container for forward link.",
190 TimeValue(MilliSeconds(10000)),
193 .AddAttribute(
"CtrlMsgStoreTimeInRtnLink",
194 "Time to store a control message in container for return link.",
195 TimeValue(MilliSeconds(10000)),
198 .AddAttribute(
"EnableFwdLinkBeamHopping",
199 "Enable beam hopping in forward link.",
202 MakeBooleanChecker())
203 .AddAttribute(
"EnableTracesOnUserReturnLink",
204 "Use traces files on the user return channel only",
207 MakeBooleanChecker())
208 .AddAttribute(
"DvbVersion",
209 "Indicates if using DVB-S2 or DVB-S2X",
214 "ReturnLinkLinkResults",
215 "Protocol used for the return link link results.",
224 .AddTraceSource(
"Creation",
227 "ns3::SatTypedefs::CreationCallback");
234 NS_LOG_FUNCTION(
this);
240 : m_printDetailedInformationToCreationTraces(false),
242 m_propagationDelayModel(
SatEnums::PD_CONSTANT_SPEED),
243 m_constantPropagationDelay(Seconds(0.13)),
244 m_randomAccessModel(
SatEnums::RA_MODEL_OFF),
248 m_raConstantErrorRate(0.0),
249 m_enableFwdLinkBeamHopping(false),
252 NS_LOG_FUNCTION(
this);
255 NS_FATAL_ERROR(
"SatBeamHelper::SatBeamHelper - Constructor not in use");
260 uint32_t rtnLinkCarrierCount,
261 uint32_t fwdLinkCarrierCount,
262 Ptr<SatSuperframeSeq> seq)
263 : m_carrierBandwidthConverter(bandwidthConverterCb),
264 m_superframeSeq(seq),
265 m_printDetailedInformationToCreationTraces(false),
266 m_fadingModel(
SatEnums::FADING_MARKOV),
267 m_propagationDelayModel(
SatEnums::PD_CONSTANT_SPEED),
268 m_constantPropagationDelay(Seconds(0.13)),
269 m_randomAccessModel(
SatEnums::RA_MODEL_OFF),
273 m_raConstantErrorRate(0.0),
274 m_enableFwdLinkBeamHopping(false),
278 NS_LOG_FUNCTION(
this << rtnLinkCarrierCount << fwdLinkCarrierCount << seq);
282 ObjectBase::ConstructSelf(AttributeConstructionList());
291 Ptr<SatControlMsgContainer> rtnCtrlMsgContainer =
293 Ptr<SatControlMsgContainer> fwdCtrlMsgContainer =
336 Config::SetDefault(
"ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
337 StringValue(
"Trace"));
338 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel", StringValue(
"Trace"));
342 switch (Singleton<SatTopology>::Get()->GetStandard())
345 m_gwHelper = CreateObject<SatGwHelperDvb>(bandwidthConverterCb,
352 m_utHelper = CreateObject<SatUtHelperDvb>(bandwidthConverterCb,
359 m_orbiterHelper = CreateObject<SatOrbiterHelperDvb>(bandwidthConverterCb,
369 if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
372 m_gwHelper = CreateObject<SatGwHelperLora>(bandwidthConverterCb,
382 Config::SetDefault(
"ns3::SatGwMac::SendNcrBroadcast", BooleanValue(
false));
383 m_gwHelper = CreateObject<SatGwHelperDvb>(bandwidthConverterCb,
391 m_utHelper = CreateObject<SatUtHelperLora>(bandwidthConverterCb,
398 m_orbiterHelper = CreateObject<SatOrbiterHelperLora>(bandwidthConverterCb,
408 NS_FATAL_ERROR(
"Unknown standard");
422 Ptr<SatLinkResultsFwd> linkResultsFwd;
426 linkResultsFwd = CreateObject<SatLinkResultsDvbS2>();
429 linkResultsFwd = CreateObject<SatLinkResultsDvbS2X>();
432 NS_FATAL_ERROR(
"The DVB version does not exist");
435 Ptr<SatLinkResultsRtn> linkResultsReturnLink;
439 linkResultsReturnLink = CreateObject<SatLinkResultsDvbRcs2>();
443 linkResultsReturnLink = CreateObject<SatLinkResultsFSim>();
447 linkResultsReturnLink = CreateObject<SatLinkResultsLora>();
451 NS_FATAL_ERROR(
"Invalid address for multicast group");
456 linkResultsFwd->Initialize();
457 linkResultsReturnLink->Initialize();
459 bool useScpc = (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
461 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
472 m_superframeSeq->GetWaveformConf()->InitializeEbNoRequirements(linkResultsReturnLink);
476 m_ncc = CreateObject<SatNcc>();
478 if (Singleton<SatTopology>::Get()->GetStandard() ==
SatEnums::LORA)
480 m_ncc->SetUseLora(
true);
485 PointerValue llsConf;
486 m_utHelper->GetAttribute(
"LowerLayerServiceConf", llsConf);
487 uint8_t allocationChannelCount =
491 for (uint8_t i = 0; i < allocationChannelCount; i++)
493 m_ncc->SetRandomAccessLowLoadBackoffProbability(
496 m_ncc->SetRandomAccessHighLoadBackoffProbability(
499 m_ncc->SetRandomAccessLowLoadBackoffTime(
502 m_ncc->SetRandomAccessHighLoadBackoffTime(
505 m_ncc->SetRandomAccessAverageNormalizedOfferedLoadThreshold(
536 NS_LOG_FUNCTION(
this);
554 NS_LOG_FUNCTION(
this);
565 NS_LOG_FUNCTION(
this << antennaPatterns);
573 NS_LOG_FUNCTION(
this << n1);
579 NS_LOG_FUNCTION(
this << n1);
587 NS_LOG_FUNCTION(
this << &cb);
589 m_ncc->SetUpdateRoutingCallback(cb);
592 std::pair<Ptr<NetDevice>, NetDeviceContainer>
598 uint32_t rtnUlFreqId,
599 uint32_t rtnFlFreqId,
600 uint32_t fwdUlFreqId,
601 uint32_t fwdFlFreqId,
604 NS_LOG_FUNCTION(
this << gwNode << gwId << satId << beamId << rtnUlFreqId << rtnFlFreqId
605 << fwdUlFreqId << fwdFlFreqId);
609 std::pair<std::map<std::pair<uint32_t, uint32_t>, uint32_t>::iterator,
bool> beam =
610 m_beam.insert(std::make_pair(std::make_pair(satId, beamId), gwId));
611 NS_ASSERT(beam.second ==
true);
626 Ptr<Node> satNode = Singleton<SatTopology>::Get()->GetOrbiterNode(satId);
628 NS_ASSERT(satNode !=
nullptr);
634 uint32_t feederSatId = Singleton<SatTopology>::Get()->GetClosestSat(gwPos);
636 if (feederBeamId == 0)
655 NS_ASSERT(gwMobility !=
nullptr);
658 for (NodeContainer::Iterator i = ut.Begin(); i != ut.End(); i++)
663 NS_ASSERT(observer !=
nullptr);
664 observer->ObserveTimingAdvance(userLink.second->GetPropagationDelayModel(),
665 feederLink.second->GetPropagationDelayModel(),
674 m_utNode.insert(std::make_pair(std::make_pair(satId, beamId), *i));
677 Ptr<NetDevice> gwNd =
InstallFeeder(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
689 NetDeviceContainer utNd;
690 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
692 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
700 utNd =
InstallUser(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
712 utNd =
InstallUser(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
728 m_bstpController->AddNetDeviceCallback(beamId, fwdUlFreqId, fwdFlFreqId, gwId, gwNdCb);
731 return std::make_pair(gwNd, utNd);
740 uint32_t feederSatId,
741 uint32_t feederBeamId,
743 uint32_t rtnFlFreqId,
744 uint32_t fwdFlFreqId,
747 NS_LOG_FUNCTION(
this << gwNode << gwId << satId << beamId << rtnFlFreqId << fwdFlFreqId);
752 feederLink.second->SetAttribute(
"RxPowerCalculationMode",
767 PointerValue llsConf;
768 m_utHelper->GetAttribute(
"LowerLayerServiceConf", llsConf);
769 Ptr<NetDevice> gwNd =
783 Ptr<SatBbFrameConf> bbFrameConf =
m_gwHelper->GetBbFrameConf();
792 uint32_t maxBbFrameDataSizeInBytes =
793 (bbFrameConf->GetBbFramePayloadBits(bbFrameConf->GetMostRobustModcod(frameType),
796 bbFrameConf->GetBbFrameHeaderSizeInBytes();
798 Address satelliteUserAddress = Address();
799 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
801 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
804 satelliteUserAddress = orbiterNetDevice->GetSatelliteUserAddress(beamId);
807 switch (Singleton<SatTopology>::Get()->GetStandard())
813 DynamicCast<SatNetDevice>(gwNd),
817 DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac())),
819 maxBbFrameDataSizeInBytes,
820 satelliteUserAddress,
824 if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
827 m_ncc->AddBeam(satId,
829 DynamicCast<SatNetDevice>(gwNd),
832 DynamicCast<SatLorawanNetDevice>(gwNd)),
833 MakeNullCallback<
void, Ptr<SatTbtpMessage>>(),
835 maxBbFrameDataSizeInBytes,
836 satelliteUserAddress,
844 DynamicCast<SatNetDevice>(gwNd),
848 DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac())),
850 maxBbFrameDataSizeInBytes,
851 satelliteUserAddress,
858 NS_FATAL_ERROR(
"Incorrect standard chosen");
862 if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
864 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
867 Ptr<SatGwMac> gwMac = DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac());
868 Mac48Address satFeederAddress = orbiterNetDevice->GetSatelliteFeederAddress(beamId);
869 gwMac->SetSatelliteAddress(satFeederAddress);
873 if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
876 Ptr<SatGwMac> gwMac = DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac());
877 Ptr<SatGwLlc> gwLlc = DynamicCast<SatGwLlc>(DynamicCast<SatNetDevice>(gwNd)->GetLlc());
878 Mac48Address satFeederAddress = orbiterNetDevice->GetSatelliteFeederAddress(beamId);
879 gwLlc->SetSatelliteAddress(satFeederAddress);
892 uint32_t rtnUlFreqId,
893 uint32_t fwdUlFreqId,
896 NS_LOG_FUNCTION(
this << beamId << rtnUlFreqId << fwdUlFreqId);
901 userLink.second->SetAttribute(
"RxPowerCalculationMode",
905 Address satUserAddress = Address();
906 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
908 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
911 satUserAddress = orbiterNetDevice->GetUserMac(beamId)->GetAddress();
915 NetDeviceContainer utNd =
921 DynamicCast<SatNetDevice>(gwNd),
928 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
930 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
933 for (NetDeviceContainer::Iterator i = utNd.Begin(); i != utNd.End(); i++)
935 Ptr<SatMac> mac = DynamicCast<SatNetDevice>(*i)->GetMac();
936 Ptr<SatUtMac> utMac = DynamicCast<SatUtMac>(mac);
937 if (utMac !=
nullptr)
939 utMac->SetSatelliteAddress(satUserAddress);
943 mac->SetSatelliteAddress(satUserAddress);
949 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
952 for (NetDeviceContainer::Iterator i = utNd.Begin(); i != utNd.End(); i++)
954 Ptr<SatUtLlc> utLlc = DynamicCast<SatUtLlc>(DynamicCast<SatNetDevice>(*i)->GetLlc());
955 if (utLlc !=
nullptr)
957 utLlc->SetSatelliteAddress(Mac48Address::ConvertFrom(satUserAddress));
968 NS_LOG_FUNCTION(
this);
970 Ptr<PointToPointIslHelper> p2pIslHelper = CreateObject<PointToPointIslHelper>();
971 TrafficControlHelper tchIsl;
973 for (std::vector<std::pair<uint32_t, uint32_t>>::iterator it =
m_isls.begin();
977 Ptr<Node> sat1 = Singleton<SatTopology>::Get()->GetOrbiterNode(it->first);
978 Ptr<Node> sat2 = Singleton<SatTopology>::Get()->GetOrbiterNode(it->second);
981 NetDeviceContainer netDevices = p2pIslHelper->Install(sat1, sat2);
982 Ptr<PointToPointIslNetDevice> islNdSat1 =
983 DynamicCast<PointToPointIslNetDevice>(netDevices.Get(0));
984 Ptr<PointToPointIslNetDevice> islNdSat2 =
985 DynamicCast<PointToPointIslNetDevice>(netDevices.Get(1));
987 Ptr<SatOrbiterNetDevice> satNdSat1 = DynamicCast<SatOrbiterNetDevice>(sat1->GetDevice(0));
988 Ptr<SatOrbiterNetDevice> satNdSat2 = DynamicCast<SatOrbiterNetDevice>(sat2->GetDevice(0));
990 satNdSat1->AddIslsNetDevice(islNdSat1);
991 satNdSat2->AddIslsNetDevice(islNdSat2);
993 islNdSat1->SetOrbiterNetDevice(satNdSat1);
994 islNdSat2->SetOrbiterNetDevice(satNdSat2);
1001 NS_LOG_FUNCTION(
this);
1009 std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator i =
1010 m_beam.find(std::make_pair(satId, beamId));
1025 NS_LOG_FUNCTION(
this << gwId);
1027 std::map<uint32_t, Ptr<Node>>::const_iterator gwIterator =
m_gwNode.find(gwId);
1028 Ptr<Node> node =
nullptr;
1032 node = gwIterator->second;
1041 NS_LOG_FUNCTION(
this);
1048 NS_LOG_FUNCTION(
this);
1052 Ptr<SatOrbiterHelper>
1055 NS_LOG_FUNCTION(
this);
1062 NS_LOG_FUNCTION(
this << beamId);
1064 NodeContainer utNodes;
1067 std::pair<std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator,
1068 std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator>
1070 range =
m_utNode.equal_range(std::make_pair(satId, beamId));
1072 for (std::map<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator i = range.first;
1076 utNodes.Add(i->second);
1082 std::list<std::pair<uint32_t, uint32_t>>
1085 NS_LOG_FUNCTION(
this);
1087 std::list<std::pair<uint32_t, uint32_t>> ret;
1089 for (std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator it =
m_beam.begin();
1093 ret.push_back(it->first);
1102 NS_LOG_FUNCTION(
this);
1110 NS_LOG_FUNCTION(
this);
1112 uint32_t beamId = 0;
1114 for (std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator it =
1116 ((it !=
m_utNode.end()) && (beamId == 0));
1119 if (it->second == utNode)
1121 beamId = it->first.second;
1130 Ptr<Node> sourceUtNode,
1131 Ipv4Address sourceAddress,
1132 Ipv4Address groupAddress,
1133 bool routeToGwUsers,
1134 Ptr<NetDevice>& gwOutputDev)
1136 NS_LOG_FUNCTION(
this);
1138 Mac48Address groupMacAddress;
1139 Ipv4StaticRoutingHelper multicast;
1140 NetDeviceContainer gwInputDevices;
1141 NetDeviceContainer routerGwOutputDevices;
1142 Ptr<NetDevice> routerDev =
nullptr;
1144 uint32_t sourceBeamId =
GetUtBeamId(sourceUtNode);
1145 gwOutputDev =
nullptr;
1148 if (groupAddress.IsMulticast())
1150 groupMacAddress = Mac48Address::GetMulticast(groupAddress);
1151 NS_LOG_INFO(
"IP address for multicast group: "
1152 << groupAddress <<
", MAC address for multicast group: " << groupMacAddress);
1156 NS_FATAL_ERROR(
"Invalid address for multicast group");
1159 NodeContainer gwNodes = Singleton<SatTopology>::Get()->GetGwNodes();
1162 for (NodeContainer::Iterator it = gwNodes.Begin(); it != gwNodes.End(); it++)
1164 bool routerGw =
false;
1165 NetDeviceContainer gwOutputDevices;
1166 Ptr<NetDevice> gwInputDev =
nullptr;
1169 for (uint32_t i = 1; i < (*it)->GetNDevices(); i++)
1171 Ptr<NetDevice> dev = (*it)->GetDevice(i);
1172 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(dev->GetAddress());
1173 MulticastBeamInfo_t::iterator beamIt = beamInfo.find(beamId);
1176 if (beamId == (int32_t)sourceBeamId)
1184 if (beamIt != beamInfo.end())
1187 if (dev->GetInstanceTypeId().GetName() ==
"ns3::SatNetDevice")
1191 gwOutputDevices.Add(dev);
1195 for (std::set<Ptr<Node>>::iterator utIt = beamIt->second.begin();
1196 utIt != beamIt->second.end();
1204 NS_FATAL_ERROR(
"Not a satellite net device!!!");
1207 else if (dev->GetInstanceTypeId().GetName() !=
"ns3::SatNetDevice")
1218 gwOutputDev = gwInputDev;
1223 routerGwOutputDevices = gwOutputDevices;
1225 else if (gwOutputDevices.GetN() >
1229 multicast.AddMulticastRoute(*it,
1236 gwInputDevices.Add(gwInputDev);
1242 if (sourceUtNode && ((gwInputDevices.GetN() > 0) || routeToGwUsers))
1246 NS_FATAL_ERROR(
"Router device shall exist!!!");
1249 routerGwOutputDevices.Add(gwOutputDev);
1253 gwOutputDev =
nullptr;
1259 if (routerDev && (routerGwOutputDevices.GetN() > 0))
1261 multicast.AddMulticastRoute(routerDev->GetNode(),
1265 routerGwOutputDevices);
1270 return gwInputDevices;
1276 NS_LOG_FUNCTION(
this);
1278 TraceConnect(
"Creation",
"SatBeamHelper", cb);
1280 m_gwHelper->EnableCreationTraces(stream, cb);
1281 m_utHelper->EnableCreationTraces(stream, cb);
1300 std::max(Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode(),
1301 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode());
1308 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/PacketTrace",
1310 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatPhy/PacketTrace",
1312 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/UserPhy/*/PacketTrace",
1314 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/FeederPhy/*/PacketTrace",
1316 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatMac/PacketTrace",
1321 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/UserMac/*/PacketTrace",
1323 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/FeederMac/*/PacketTrace",
1326 if (Singleton<SatTopology>::Get()->GetStandard() ==
SatEnums::DVB)
1328 Config::ConnectWithoutContext(
"/NodeList/*/DeviceList/*/SatLlc/PacketTrace",
1336 NS_LOG_FUNCTION(
this);
1338 std::ostringstream oss;
1339 oss <<
"--- Beam Info, "
1340 <<
"number of created beams: " <<
m_beam.size() <<
" ---" << std::endl;
1353 NS_LOG_FUNCTION(
this);
1355 std::ostringstream oss;
1357 for (std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator i =
1366 Ptr<Ipv4> ipv4 = i->second->GetObject<Ipv4>();
1368 std::vector<Ipv4Address> IPAddressVector;
1369 std::vector<std::string> devNameVector;
1370 std::vector<Address> devAddressVector;
1372 for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1374 Ptr<NetDevice> device = i->second->GetDevice(j);
1376 if (device->GetInstanceTypeId().GetName() ==
"ns3::SatNetDevice")
1378 devAddress = device->GetAddress();
1380 IPAddressVector.push_back(
1381 ipv4->GetAddress(j, 0).GetLocal());
1382 devNameVector.push_back(device->GetInstanceTypeId().GetName());
1383 devAddressVector.push_back(device->GetAddress());
1388 oss << i->first.second <<
" "
1389 << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) <<
" "
1390 << pos.
GetLatitude() <<
" " << pos.GetLongitude() <<
" " << pos.GetAltitude()
1393 for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1395 oss << devNameVector[j] <<
" " << devAddressVector[j] <<
" " << IPAddressVector[j]
1403 oss << i->first.second <<
" "
1404 << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) <<
" "
1405 << pos.GetLatitude() <<
" " << pos.GetLongitude() <<
" " << pos.GetAltitude()
1416 NS_LOG_FUNCTION(
this);
1418 std::ostringstream oss;
1420 oss << std::endl <<
" -- Beam details --";
1422 for (std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator i =
m_beam.begin();
1426 uint32_t satId = i->first.first;
1427 uint32_t beamId = i->first.second;
1429 oss << std::endl <<
"Sat ID: " << satId <<
" ";
1430 oss <<
"Beam ID: " << beamId <<
" ";
1432 std::map<std::pair<uint32_t, uint32_t>,
FrequencyPair_t>::const_iterator freqIds =
1437 oss <<
"user link frequency ID: " << (*freqIds).second.first <<
", ";
1438 oss <<
"feeder link frequency ID: " << (*freqIds).second.second;
1441 oss <<
", GW ID: " << (*i).second;
1444 oss << std::endl << std::endl <<
" -- GW details --" << std::endl;
1447 oss.setf(std::ios::fixed, std::ios::floatfield);
1449 for (std::map<uint32_t, Ptr<Node>>::const_iterator i =
m_gwNode.begin(); i !=
m_gwNode.end();
1456 Ptr<Ipv4> ipv4 = i->second->GetObject<Ipv4>();
1458 std::vector<Ipv4Address> IPAddressVector;
1459 std::vector<std::string> devNameVector;
1460 std::vector<Address> devAddressVector;
1462 for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1464 Ptr<NetDevice> device = i->second->GetDevice(j);
1466 if (device->GetInstanceTypeId().GetName() ==
"ns3::SatNetDevice")
1468 devAddress = device->GetAddress();
1471 IPAddressVector.push_back(
1472 ipv4->GetAddress(j, 0).GetLocal());
1473 devNameVector.push_back(device->GetInstanceTypeId().GetName());
1474 devAddressVector.push_back(device->GetAddress());
1479 oss <<
"GW=" << i->first <<
" "
1480 << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) <<
" "
1481 <<
" latitude=" << pos.
GetLatitude() <<
" longitude=" << pos.GetLongitude()
1482 <<
" altitude=" << pos.GetAltitude() <<
" ";
1484 for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1486 oss << devNameVector[j] <<
" " << devAddressVector[j] <<
" " << IPAddressVector[j]
1494 oss <<
"GW=" << i->first <<
" "
1495 << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) <<
" "
1496 <<
" latitude=" << pos.GetLatitude() <<
" longitude=" << pos.GetLongitude()
1497 <<
" altitude=" << pos.GetAltitude() << std::endl;
1501 oss << std::endl <<
" -- Satellite positions --" << std::endl;
1503 NodeContainer orbiters = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1504 for (NodeContainer::Iterator it = orbiters.Begin(); it != orbiters.End(); it++)
1508 oss <<
"latitude=" << pos.
GetLatitude() <<
", longitude=" << pos.GetLongitude()
1509 <<
", altitude=" << pos.GetAltitude() << std::endl;
1518 uint32_t fwdFrequencyId,
1519 uint32_t rtnFrequencyId,
1522 NS_LOG_FUNCTION(
this << satId << beamId << fwdFrequencyId << rtnFrequencyId << isUserLink);
1526 bool hasFwdChannel = chPairs->HasFwdChannel(satId, fwdFrequencyId);
1527 bool hasRtnChannel = chPairs->HasRtnChannel(satId, rtnFrequencyId);
1529 if (hasFwdChannel && hasRtnChannel)
1531 chPairs->UpdateBeamsForFrequency(satId, beamId, fwdFrequencyId, rtnFrequencyId);
1535 Ptr<SatFreeSpaceLoss> pFsl;
1536 Ptr<PropagationDelayModel> pDelay;
1537 Ptr<SatChannel> forwardCh;
1538 Ptr<SatChannel> returnCh;
1542 forwardCh = chPairs->GetForwardChannel(satId, fwdFrequencyId);
1543 pDelay = forwardCh->GetPropagationDelayModel();
1544 pFsl = forwardCh->GetFreeSpaceLoss();
1546 else if (hasRtnChannel)
1548 returnCh = chPairs->GetReturnChannel(satId, rtnFrequencyId);
1549 pDelay = returnCh->GetPropagationDelayModel();
1550 pFsl = returnCh->GetFreeSpaceLoss();
1557 pDelay = CreateObject<ConstantSpeedPropagationDelayModel>();
1558 DynamicCast<ConstantSpeedPropagationDelayModel>(pDelay)->SetSpeed(
1563 pDelay = CreateObject<SatConstantPropagationDelayModel>();
1564 DynamicCast<SatConstantPropagationDelayModel>(pDelay)->SetDelay(
1569 NS_FATAL_ERROR(
"Unsupported propagation delay model!");
1572 pFsl = CreateObject<SatFreeSpaceLoss>();
1582 forwardCh->SetFrequencyId(fwdFrequencyId);
1583 forwardCh->SetPropagationDelayModel(pDelay);
1584 forwardCh->SetFreeSpaceLoss(pFsl);
1594 returnCh->SetFrequencyId(rtnFrequencyId);
1595 returnCh->SetPropagationDelayModel(pDelay);
1596 returnCh->SetFreeSpaceLoss(pFsl);
1600 ->StoreChannelPair(satId, beamId, fwdFrequencyId, forwardCh, rtnFrequencyId, returnCh);
1603 return chPairs->GetChannelPair(satId, beamId);
1609 NS_LOG_FUNCTION(
this <<
id << node);
1611 bool storingSuccess =
false;
1615 if (storedNode !=
nullptr)
1617 if (storedNode == node)
1619 storingSuccess =
true;
1624 std::pair<std::map<uint32_t, Ptr<Node>>::iterator,
bool> result =
1625 m_gwNode.insert(std::make_pair(
id, node));
1626 storingSuccess = result.second;
1627 Singleton<SatTopology>::Get()->AddGwNode(
id, node);
1630 return storingSuccess;
1636 NS_LOG_FUNCTION(
this << node);
1638 Ptr<SatBaseFading> fadingContainer = node->GetObject<
SatBaseFading>();
1640 if (fadingContainer ==
nullptr)
1646 NS_ASSERT(observer !=
nullptr);
1655 CreateObject<SatMarkovContainer>(
m_markovConf, elevationCb, velocityCb);
1656 node->AggregateObject(fadingContainer);
1663 CreateObject<SatFadingInputTrace>(Singleton<SatFadingInputTraceContainer>::Get());
1665 node->AggregateObject(fadingContainer);
1671 NS_FATAL_ERROR(
"SatBeamHelper::InstallFadingContainer - Incorrect fading model");
1676 return fadingContainer;
1681 Ipv4Address sourceAddress,
1682 Ipv4Address groupAddress,
1683 bool routeToSatellite)
1685 NS_LOG_FUNCTION(
this);
1687 Ptr<NetDevice> satDev =
nullptr;
1688 Ptr<NetDevice> publicDev =
nullptr;
1690 for (uint32_t i = 1; i < utNode->GetNDevices(); i++)
1692 Ptr<NetDevice> dev = utNode->GetDevice(i);
1695 if (dev->GetInstanceTypeId().GetName() ==
"ns3::SatNetDevice")
1706 if (satDev && publicDev)
1708 Ipv4StaticRoutingHelper multicast;
1710 if (routeToSatellite)
1712 multicast.AddMulticastRoute(utNode, sourceAddress, groupAddress, publicDev, satDev);
1716 multicast.AddMulticastRoute(utNode, sourceAddress, groupAddress, satDev, publicDev);
1723 NS_FATAL_ERROR(
"Input of output device not found in UT node!!!");
1727 Ptr<PropagationDelayModel>
1732 Ptr<SatChannel> channel =
nullptr;
1733 switch (channelType)
1736 channel =
m_flChannels->GetChannelPair(satId, beamId).first;
1740 channel =
m_ulChannels->GetChannelPair(satId, beamId).first;
1744 channel =
m_ulChannels->GetChannelPair(satId, beamId).second;
1748 channel =
m_flChannels->GetChannelPair(satId, beamId).second;
1756 return channel->GetPropagationDelayModel();
GeoCoordinate class is used to store and operate with geodetic coordinates.
double GetLatitude() const
Gets latitude value of coordinate.
Base class for fading models such as Markov-based fading or fading trace.
Callback< double > VelocityCallback
Gets velocity in m/s.
Callback< double > ElevationCallback
Gets elevation angle in degrees.
void SetAntennaGainPatterns(Ptr< SatAntennaGainPatternContainer > antennaPatterns)
Set the antenna gain patterns to be used when configuring the beams to the satellite.
NetDeviceContainer AddMulticastGroupRoutes(MulticastBeamInfo_t beamInfo, Ptr< Node > sourceUtNode, Ipv4Address sourceAddress, Ipv4Address groupAddress, bool routeToGwUsers, Ptr< NetDevice > &gwOutputDev)
std::map< std::pair< uint32_t, uint32_t >, uint32_t > m_beam
SatEnums::DvbVersion_t m_dvbVersion
Indicates if using DVB-S2 or DVB-S2X.
Time m_constantPropagationDelay
Constant propagation delay.
bool m_printDetailedInformationToCreationTraces
Flag indicating whether to print detailed information to the creation traces.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Ptr< SatChannelPair > m_flChannels
ObjectFactory m_channelFactory
void SetIslRoutes()
Set ISL routes.
Ptr< SatSuperframeSeq > m_superframeSeq
bool StoreGwNode(uint32_t id, Ptr< Node > node)
Creates GW node according to given id and stores GW to map.
Ptr< SatBstpController > m_bstpController
Beam Switching Time Plan controller, which is created if FWD link beam hopping is enabled (m_enableFw...
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void InstallIsls()
Create all the ISLs.
Ptr< SatGwHelper > GetGwHelper() const
SatEnums::PropagationDelayModel_t GetPropagationDelayModelEnum()
Ptr< SatAntennaGainPatternContainer > m_antennaGainPatterns
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
CarrierFreqConverter m_carrierFreqConverter
bool m_enableFwdLinkBeamHopping
Flag indicating whether beam hopping is enabled in FWD link.
Ptr< SatUtHelper > GetUtHelper() const
void EnableCreationTraces(Ptr< OutputStreamWrapper > stream, CallbackBase &cb)
Enables creation traces to be written in given file.
uint32_t GetGwId(uint32_t satId, uint32_t beamId) const
std::map< uint32_t, Ptr< NetDevice > > m_gwNdMap
Map used in regenerative mode to store GW Net device (we need only one per GW)
NodeContainer GetUtNodes(uint32_t satId, uint32_t beamId) const
virtual void DoDispose()
Dispose of this class instance.
Ptr< PropagationDelayModel > GetPropagationDelayModel(uint32_t satId, uint32_t beamId, SatEnums::ChannelType_t channelType)
TracedCallback< std::string > m_creationTrace
Trace callback for creation traces.
std::pair< Ptr< NetDevice >, NetDeviceContainer > Install(NodeContainer ut, Ptr< Node > gwNode, uint32_t gwId, uint32_t satId, uint32_t beamId, uint32_t rtnUlFreqId, uint32_t rtnFlFreqId, uint32_t fwdUlFreqId, uint32_t fwdFlFreqId, SatMac::RoutingUpdateCallback routingCallback)
NetDeviceContainer InstallUser(Ptr< SatOrbiterNetDevice > orbiterNetDevice, NodeContainer ut, Ptr< NetDevice > gwNd, uint32_t satId, uint32_t beamId, SatChannelPair::ChannelPair_t userLink, uint32_t rtnUlFreqId, uint32_t fwdUlFreqId, SatMac::RoutingUpdateCallback routingCallback)
SatBeamHelper()
Default constructor for SatBeamHelper (should not be used).
SatEnums::LinkResults_t m_rlLinkResultsType
Type of Return channel link results.
std::string GetBeamInfo() const
uint32_t GetUtBeamId(Ptr< Node > utNode) const
Get beam Id of the given UT.
Ptr< SatNcc > GetNcc() const
Ptr< SatBaseFading > InstallFadingContainer(Ptr< Node > node) const
Install fading model to node, if fading model doesn't exist already in node.
Time m_ctrlMsgStoreTimeFwdLink
Control message store time in container for forward link.
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
The used collision model for random access.
std::pair< uint32_t, uint32_t > FrequencyPair_t
std::map< std::pair< uint32_t, uint32_t >, FrequencyPair_t > m_beamFreqs
std::map< uint32_t, Ptr< Node > > m_gwNode
std::list< std::pair< uint32_t, uint32_t > > GetBeams() const
Ptr< SatMarkovConf > m_markovConf
Common configuration for Markov model.
Ptr< SatUtHelper > m_utHelper
void AddMulticastRouteToUt(Ptr< Node > utNode, Ipv4Address sourceAddress, Ipv4Address groupAddress, bool routeToSatellite)
Add multicast route to UT node.
Ptr< SatOrbiterHelper > GetOrbiterHelper() const
Ptr< NetDevice > InstallFeeder(Ptr< SatOrbiterNetDevice > orbiterNetDevice, Ptr< Node > gwNode, uint32_t gwId, uint32_t satId, uint32_t beamId, uint32_t feederSatId, uint32_t feederBeamId, SatChannelPair::ChannelPair_t feederLink, uint32_t rtnFlFreqId, uint32_t fwdFlFreqId, SatMac::RoutingUpdateCallback routingCallback)
Ptr< SatOrbiterHelper > m_orbiterHelper
static TypeId GetTypeId(void)
Get the type ID.
std::string GetUtInfo() const
std::string CreateBeamInfo() const
Creates info of the beam.
SatEnums::PropagationDelayModel_t m_propagationDelayModel
Propagation delay model.
void EnablePacketTrace()
Enable packet traces.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
void Init()
Init method is called after all the initial configurations have been done by the SatHelper and SatBea...
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
The used interference model for random access.
Ptr< SatPacketTrace > m_packetTrace
Packet trace.
SatEnums::FadingModel_t m_fadingModel
Configured fading model.
Ptr< Node > GetGwNode(uint32_t gwId) const
Gets GW node according to given id.
SatChannelPair::ChannelPair_t GetChannelPair(uint32_t satId, uint32_t beamId, uint32_t fwdFrequencyId, uint32_t rtnFrequencyId, bool isUserLink)
Gets satellite channel pair from requested map.
std::vector< std::pair< uint32_t, uint32_t > > m_isls
Vector constaining all the ISLs of the topology.
SatEnums::RandomAccessModel_t m_randomAccessModel
The used random access model.
Time m_ctrlMsgStoreTimeRtnLink
Control message store in container for return link.
Ptr< SatChannelPair > m_ulChannels
Ptr< SatGwHelper > m_gwHelper
std::map< uint32_t, std::set< Ptr< Node > > > MulticastBeamInfo_t
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel
The used interference model for random access.
double m_raConstantErrorRate
Constant error rate for random access.
void SetNccRoutingCallback(SatNcc::UpdateRoutingCallback cb)
Attach an update routing callback to the NCC of this simulation.
std::multimap< std::pair< uint32_t, uint32_t >, Ptr< Node > > m_utNode
bool m_enableTracesOnReturnLink
Helper flag to activate packet traces on the return link only.
Callback< void, bool > ToggleCallback
Callback to fetch queue statistics.
Satellite channel implementation.
virtual void SetChannelType(SatEnums::ChannelType_t chType)
Set the type of the channel.
std::pair< Ptr< SatChannel >, Ptr< SatChannel > > ChannelPair_t
ChannelPair_t GetChannelPair(uint32_t satId, uint32_t beamId) const
Retrieve the channel pair associated to a beam.
Ptr< SatControlMessage > Read(uint32_t recvId)
Read a control message.
uint32_t Send(uint32_t sendId)
Add a control message.
uint32_t ReserveIdAndStore(Ptr< SatControlMessage > controlMsg)
Reserve an id and store a control message.
SatEnums class is for simplifying the use of enumerators in the satellite module.
SatBbFrameType_t
BB frame type used in DVB-S2 FWD link.
ChannelType_t
Types of channel.
PropagationDelayModel_t
Propagation delay model.
@ SHORT_FRAMES
SHORT_FRAMES.
@ RA_MODEL_RCS2_SPECIFICATION
RegenerationMode_t
The regeneration mode used in satellites.
void TbtpSent(Ptr< SatTbtpMessage > tbtp)
Function called when a TBTP has been sent by the SatBeamScheduler.
bool SendControlMsg(Ptr< SatControlMessage > msg, const Address &dest)
The SatLowerLayerServiceConf class holds information of all configures lower layer service entries.
uint16_t GetRaHighLoadBackOffProbability(uint8_t index) const
Get high load back off probability.
uint16_t GetRaHighLoadBackOffTimeInMilliSeconds(uint8_t index) const
Get high load back off time in milliseconds.
double GetRaAverageNormalizedOfferedLoadThreshold(uint8_t index) const
Get average normalized offeredLoad Threshold.
uint16_t GetRaBackOffProbability(uint8_t index) const
Get back off probability.
uint16_t GetRaBackOffTimeInMilliSeconds(uint8_t index) const
Get back off time in milliseconds.
Callback< uint32_t, Ptr< SatControlMessage > > ReserveCtrlMsgCallback
Callback to reserve an id and initially store the control message.
Callback< void, Address, Address > RoutingUpdateCallback
Callback to update routing and ARP tables after handover.
Callback< uint32_t, uint32_t > SendCtrlMsgCallback
Callback to send a control message and allocate a recv ID for it.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
Keep track of the current position and velocity of an object in satellite network.
Observes given mobilities and keeps track of certain wanted properties.
double GetVelocity(void)
Get velocity of own movement (speed).
double GetElevationAngle(void)
Get elevation angle.
Callback< void, Address, Address, Address > UpdateRoutingCallback
Update routes and ARP tables on gateways after a terminal handover.
void ToggleState(bool enabled)
Toggle the state of the device.
bool SendControlMsg(Ptr< SatControlMessage > msg, const Address &dest)
void AddTraceEntry(Time now, SatEnums::SatPacketEvent_t packetEvent, SatEnums::SatNodeType_t nodeType, uint32_t nodeId, Mac48Address macAddress, SatEnums::SatLogLevel_t logLevel, SatEnums::SatLinkDir_t linkDir, std::string packetInfo)
Add a packet trace entry to the log.
Information of beam users liken UTs and their users.
@ RA_CONSTANT_COLLISION_PROBABILITY
@ RA_COLLISION_CHECK_AGAINST_SINR
@ RA_COLLISION_NOT_DEFINED
@ RA_COLLISION_ALWAYS_DROP_ALL_COLLIDING_PACKETS
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
constexpr double SPEED_OF_LIGHT
Constant definition for the speed of light in m/s.
constexpr uint32_t BITS_PER_BYTE
Number of bits in a byte.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Random access setting options.
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel
double m_raConstantErrorRate
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
Random access setting options.
SatPhyRxCarrierConf::InterferenceModel m_raFwdInterferenceModel
SatPhyRxCarrierConf::InterferenceModel m_raRtnInterferenceModel
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
Define RandomAccessSettings as a struct.
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel