satellite-beam-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
4  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Sami Rantanen <sami.rantanen@magister.fi>
20  * Author: Mathias Ettinger <mettinger@viveris.toulouse.fr>
21  */
22 
23 #include "satellite-beam-helper.h"
24 
32 
33 #include <ns3/config.h>
34 #include <ns3/enum.h>
35 #include <ns3/internet-stack-helper.h>
36 #include <ns3/ipv4-interface.h>
37 #include <ns3/ipv4-static-routing-helper.h>
38 #include <ns3/log.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>
69 
70 #include <algorithm>
71 #include <ios>
72 #include <iostream>
73 #include <list>
74 #include <map>
75 #include <set>
76 #include <sstream>
77 #include <string>
78 #include <utility>
79 #include <vector>
80 
81 NS_LOG_COMPONENT_DEFINE("SatBeamHelper");
82 
83 namespace ns3
84 {
85 
86 NS_OBJECT_ENSURE_REGISTERED(SatBeamHelper);
87 
88 TypeId
90 {
91  static TypeId tid =
92  TypeId("ns3::SatBeamHelper")
93  .SetParent<Object>()
94  .AddConstructor<SatBeamHelper>()
95  .AddAttribute("CarrierFrequencyConverter",
96  "Callback to convert carrier id to generate frequency.",
97  CallbackValue(),
98  MakeCallbackAccessor(&SatBeamHelper::m_carrierFreqConverter),
99  MakeCallbackChecker())
100  .AddAttribute("FadingModel",
101  "Fading model",
102  EnumValue(SatEnums::FADING_OFF),
103  MakeEnumAccessor<SatEnums::FadingModel_t>(&SatBeamHelper::m_fadingModel),
104  MakeEnumChecker(SatEnums::FADING_OFF,
105  "FadingOff",
107  "FadingTrace",
109  "FadingMarkov"))
110  .AddAttribute("RandomAccessModel",
111  "Random Access Model",
112  EnumValue(SatEnums::RA_MODEL_OFF),
113  MakeEnumAccessor<SatEnums::RandomAccessModel_t>(
115  MakeEnumChecker(SatEnums::RA_MODEL_OFF,
116  "RaOff",
118  "RaSlottedAloha",
120  "RaCrdsa",
122  "RaRcs2Specification",
124  "RaMarsala",
126  "RaEssa"))
127  .AddAttribute("RaInterferenceModel",
128  "Interference model for random access",
130  MakeEnumAccessor<SatPhyRxCarrierConf::InterferenceModel>(
132  MakeEnumChecker(SatPhyRxCarrierConf::IF_CONSTANT,
133  "Constant",
135  "Trace",
137  "PerPacket",
139  "PerFragment"))
140  .AddAttribute("RaInterferenceEliminationModel",
141  "Interference elimination model for random access",
143  MakeEnumAccessor<SatPhyRxCarrierConf::InterferenceEliminationModel>(
145  MakeEnumChecker(SatPhyRxCarrierConf::SIC_PERFECT,
146  "Perfect",
148  "Residual"))
149  .AddAttribute(
150  "RaCollisionModel",
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",
165  DoubleValue(0.0),
166  MakeDoubleAccessor(&SatBeamHelper::m_raConstantErrorRate),
167  MakeDoubleChecker<double>())
168  .AddAttribute("PropagationDelayModel",
169  "Propagation delay model",
170  EnumValue(SatEnums::PD_CONSTANT_SPEED),
171  MakeEnumAccessor<SatEnums::PropagationDelayModel_t>(
173  MakeEnumChecker(SatEnums::PD_CONSTANT_SPEED,
174  "ConstantSpeed",
176  "Constant"))
177  .AddAttribute("ConstantPropagationDelay",
178  "Constant propagation delay",
179  TimeValue(Seconds(0.13)),
181  MakeTimeChecker())
182  .AddAttribute(
183  "PrintDetailedInformationToCreationTraces",
184  "Print detailed information to creation traces",
185  BooleanValue(true),
187  MakeBooleanChecker())
188  .AddAttribute("CtrlMsgStoreTimeInFwdLink",
189  "Time to store a control message in container for forward link.",
190  TimeValue(MilliSeconds(10000)),
191  MakeTimeAccessor(&SatBeamHelper::m_ctrlMsgStoreTimeFwdLink),
192  MakeTimeChecker())
193  .AddAttribute("CtrlMsgStoreTimeInRtnLink",
194  "Time to store a control message in container for return link.",
195  TimeValue(MilliSeconds(10000)),
196  MakeTimeAccessor(&SatBeamHelper::m_ctrlMsgStoreTimeRtnLink),
197  MakeTimeChecker())
198  .AddAttribute("EnableFwdLinkBeamHopping",
199  "Enable beam hopping in forward link.",
200  BooleanValue(false),
201  MakeBooleanAccessor(&SatBeamHelper::m_enableFwdLinkBeamHopping),
202  MakeBooleanChecker())
203  .AddAttribute("EnableTracesOnUserReturnLink",
204  "Use traces files on the user return channel only",
205  BooleanValue(false),
206  MakeBooleanAccessor(&SatBeamHelper::m_enableTracesOnReturnLink),
207  MakeBooleanChecker())
208  .AddAttribute("DvbVersion",
209  "Indicates if using DVB-S2 or DVB-S2X",
210  EnumValue(SatEnums::DVB_S2),
211  MakeEnumAccessor<SatEnums::DvbVersion_t>(&SatBeamHelper::m_dvbVersion),
212  MakeEnumChecker(SatEnums::DVB_S2, "DVB_S2", SatEnums::DVB_S2X, "DVB_S2X"))
213  .AddAttribute(
214  "ReturnLinkLinkResults",
215  "Protocol used for the return link link results.",
216  EnumValue(SatEnums::LR_RCS2),
217  MakeEnumAccessor<SatEnums::LinkResults_t>(&SatBeamHelper::m_rlLinkResultsType),
218  MakeEnumChecker(SatEnums::LR_RCS2,
219  "RCS2",
221  "FSIM",
223  "LORA"))
224  .AddTraceSource("Creation",
225  "Creation traces",
226  MakeTraceSourceAccessor(&SatBeamHelper::m_creationTrace),
227  "ns3::SatTypedefs::CreationCallback");
228  return tid;
229 }
230 
231 TypeId
233 {
234  NS_LOG_FUNCTION(this);
235 
236  return GetTypeId();
237 }
238 
240  : m_printDetailedInformationToCreationTraces(false),
241  m_fadingModel(),
242  m_propagationDelayModel(SatEnums::PD_CONSTANT_SPEED),
243  m_constantPropagationDelay(Seconds(0.13)),
244  m_randomAccessModel(SatEnums::RA_MODEL_OFF),
245  m_raInterferenceModel(SatPhyRxCarrierConf::IF_CONSTANT),
246  m_raInterferenceEliminationModel(SatPhyRxCarrierConf::SIC_PERFECT),
247  m_raCollisionModel(SatPhyRxCarrierConf::RA_COLLISION_NOT_DEFINED),
248  m_raConstantErrorRate(0.0),
249  m_enableFwdLinkBeamHopping(false),
250  m_bstpController()
251 {
252  NS_LOG_FUNCTION(this);
253 
254  // this default constructor should not be called...
255  NS_FATAL_ERROR("SatBeamHelper::SatBeamHelper - Constructor not in use");
256 }
257 
258 SatBeamHelper::SatBeamHelper(std::vector<std::pair<uint32_t, uint32_t>> isls,
259  SatTypedefs::CarrierBandwidthConverter_t bandwidthConverterCb,
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),
270  m_raInterferenceModel(SatPhyRxCarrierConf::IF_CONSTANT),
271  m_raInterferenceEliminationModel(SatPhyRxCarrierConf::SIC_PERFECT),
272  m_raCollisionModel(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR),
273  m_raConstantErrorRate(0.0),
274  m_enableFwdLinkBeamHopping(false),
275  m_bstpController(),
276  m_isls(isls)
277 {
278  NS_LOG_FUNCTION(this << rtnLinkCarrierCount << fwdLinkCarrierCount << seq);
279 
280  // uncomment next code line, if attributes are needed already in construction phase.
281  // E.g attributes set by object factory affecting object creation
282  ObjectBase::ConstructSelf(AttributeConstructionList());
283 
284  m_channelFactory.SetTypeId("ns3::SatChannel");
285 
286  // create SatChannel containers
287  m_ulChannels = Create<SatChannelPair>();
288  m_flChannels = Create<SatChannelPair>();
289 
290  // create link specific control message containers
291  Ptr<SatControlMsgContainer> rtnCtrlMsgContainer =
292  Create<SatControlMsgContainer>(m_ctrlMsgStoreTimeRtnLink, true);
293  Ptr<SatControlMsgContainer> fwdCtrlMsgContainer =
294  Create<SatControlMsgContainer>(m_ctrlMsgStoreTimeFwdLink, false);
295 
296  SatMac::ReadCtrlMsgCallback rtnReadCtrlCb =
297  MakeCallback(&SatControlMsgContainer::Read, rtnCtrlMsgContainer);
298  SatMac::ReserveCtrlMsgCallback rtnReserveCtrlCb =
299  MakeCallback(&SatControlMsgContainer::ReserveIdAndStore, rtnCtrlMsgContainer);
300  SatMac::SendCtrlMsgCallback rtnSendCtrlCb =
301  MakeCallback(&SatControlMsgContainer::Send, rtnCtrlMsgContainer);
302 
303  SatMac::ReadCtrlMsgCallback fwdReadCtrlCb =
304  MakeCallback(&SatControlMsgContainer::Read, fwdCtrlMsgContainer);
305  SatMac::ReserveCtrlMsgCallback fwdReserveCtrlCb =
306  MakeCallback(&SatControlMsgContainer::ReserveIdAndStore, fwdCtrlMsgContainer);
307  SatMac::SendCtrlMsgCallback fwdSendCtrlCb =
308  MakeCallback(&SatControlMsgContainer::Send, fwdCtrlMsgContainer);
309 
314  orbiterRaSettings.m_randomAccessModel = m_randomAccessModel;
315  orbiterRaSettings.m_raCollisionModel = m_raCollisionModel;
316 
321  gwRaSettings.m_raCollisionModel = m_raCollisionModel;
322 
323  // Error rate is valid only at the GW for random access
325 
330  utRaSettings.m_raCollisionModel = m_raCollisionModel;
331 
333  {
336  Config::SetDefault("ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
337  StringValue("Trace"));
338  Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel", StringValue("Trace"));
339  }
340 
341  // create needed low level satellite helpers
342  switch (Singleton<SatTopology>::Get()->GetStandard())
343  {
344  case SatEnums::DVB: {
345  m_gwHelper = CreateObject<SatGwHelperDvb>(bandwidthConverterCb,
346  rtnLinkCarrierCount,
347  seq,
348  rtnReadCtrlCb,
349  fwdReserveCtrlCb,
350  fwdSendCtrlCb,
351  gwRaSettings);
352  m_utHelper = CreateObject<SatUtHelperDvb>(bandwidthConverterCb,
353  fwdLinkCarrierCount,
354  seq,
355  fwdReadCtrlCb,
356  rtnReserveCtrlCb,
357  rtnSendCtrlCb,
358  utRaSettings);
359  m_orbiterHelper = CreateObject<SatOrbiterHelperDvb>(bandwidthConverterCb,
360  rtnLinkCarrierCount,
361  fwdLinkCarrierCount,
362  seq,
363  fwdReadCtrlCb,
364  rtnReadCtrlCb,
365  orbiterRaSettings);
366  break;
367  }
368  case SatEnums::LORA: {
369  if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
371  {
372  m_gwHelper = CreateObject<SatGwHelperLora>(bandwidthConverterCb,
373  rtnLinkCarrierCount,
374  seq,
375  rtnReadCtrlCb,
376  fwdReserveCtrlCb,
377  fwdSendCtrlCb,
378  gwRaSettings);
379  }
380  else
381  {
382  Config::SetDefault("ns3::SatGwMac::SendNcrBroadcast", BooleanValue(false));
383  m_gwHelper = CreateObject<SatGwHelperDvb>(bandwidthConverterCb,
384  rtnLinkCarrierCount,
385  seq,
386  rtnReadCtrlCb,
387  fwdReserveCtrlCb,
388  fwdSendCtrlCb,
389  gwRaSettings);
390  }
391  m_utHelper = CreateObject<SatUtHelperLora>(bandwidthConverterCb,
392  fwdLinkCarrierCount,
393  seq,
394  fwdReadCtrlCb,
395  rtnReserveCtrlCb,
396  rtnSendCtrlCb,
397  utRaSettings);
398  m_orbiterHelper = CreateObject<SatOrbiterHelperLora>(bandwidthConverterCb,
399  rtnLinkCarrierCount,
400  fwdLinkCarrierCount,
401  seq,
402  fwdReadCtrlCb,
403  rtnReadCtrlCb,
404  orbiterRaSettings);
405  break;
406  }
407  default:
408  NS_FATAL_ERROR("Unknown standard");
409  }
410 
411  // Two usage of link results is two-fold: on the other hand they are needed in the
412  // packet reception for packet decoding, but on the other hand they are utilized in
413  // transmission side in ACM for deciding the best MODCOD.
414  //
415  // Return link results:
416  // - Packet reception at the GW
417  // - RTN link packet scheduling at the NCC
418  // DVB-S2 link results:
419  // - Packet reception at the UT
420  // - FWD link packet scheduling at the GW
421  //
422  Ptr<SatLinkResultsFwd> linkResultsFwd;
423  switch (m_dvbVersion)
424  {
425  case SatEnums::DVB_S2:
426  linkResultsFwd = CreateObject<SatLinkResultsDvbS2>();
427  break;
428  case SatEnums::DVB_S2X:
429  linkResultsFwd = CreateObject<SatLinkResultsDvbS2X>();
430  break;
431  default:
432  NS_FATAL_ERROR("The DVB version does not exist");
433  }
434 
435  Ptr<SatLinkResultsRtn> linkResultsReturnLink;
436  switch (m_rlLinkResultsType)
437  {
438  case SatEnums::LR_RCS2: {
439  linkResultsReturnLink = CreateObject<SatLinkResultsDvbRcs2>();
440  break;
441  }
442  case SatEnums::LR_FSIM: {
443  linkResultsReturnLink = CreateObject<SatLinkResultsFSim>();
444  break;
445  }
446  case SatEnums::LR_LORA: {
447  linkResultsReturnLink = CreateObject<SatLinkResultsLora>();
448  break;
449  }
450  default: {
451  NS_FATAL_ERROR("Invalid address for multicast group");
452  break;
453  }
454  }
455 
456  linkResultsFwd->Initialize();
457  linkResultsReturnLink->Initialize();
458 
459  bool useScpc = (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
461  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
463 
464  // DVB-S2 link results for packet decoding at the UT
465  m_utHelper->Initialize(linkResultsFwd);
466  // DVB-RCS2 link results for packet decoding at the GW +
467  // DVB-S2 link results for FWD link RRM
468  m_gwHelper->Initialize(linkResultsReturnLink, linkResultsFwd, m_dvbVersion, useScpc);
469  // link results on satellite, to use if regeneration
470  m_orbiterHelper->Initialize(linkResultsFwd, linkResultsReturnLink);
471  // DVB-RCS2 link results for RTN link waveform configurations
472  m_superframeSeq->GetWaveformConf()->InitializeEbNoRequirements(linkResultsReturnLink);
473 
474  m_orbiterHelper->InstallAllOrbiters();
475 
476  m_ncc = CreateObject<SatNcc>();
477 
478  if (Singleton<SatTopology>::Get()->GetStandard() == SatEnums::LORA)
479  {
480  m_ncc->SetUseLora(true);
481  }
482 
484  {
485  PointerValue llsConf;
486  m_utHelper->GetAttribute("LowerLayerServiceConf", llsConf);
487  uint8_t allocationChannelCount =
488  llsConf.Get<SatLowerLayerServiceConf>()->GetRaServiceCount();
489 
491  for (uint8_t i = 0; i < allocationChannelCount; i++)
492  {
493  m_ncc->SetRandomAccessLowLoadBackoffProbability(
494  i,
496  m_ncc->SetRandomAccessHighLoadBackoffProbability(
497  i,
499  m_ncc->SetRandomAccessLowLoadBackoffTime(
500  i,
502  m_ncc->SetRandomAccessHighLoadBackoffTime(
503  i,
505  m_ncc->SetRandomAccessAverageNormalizedOfferedLoadThreshold(
506  i,
508  i));
509  }
510  }
511 
512  switch (m_fadingModel)
513  {
516  m_markovConf = CreateObject<SatMarkovConf>();
517  break;
518  }
521  default: {
522  m_markovConf = nullptr;
523  break;
524  }
525  }
526 
528  {
529  m_bstpController = CreateObject<SatBstpController>();
530  }
531 }
532 
533 void
535 {
536  NS_LOG_FUNCTION(this);
537 
538  m_beam.clear();
539  m_gwNode.clear();
540  m_ulChannels = nullptr;
541  m_flChannels = nullptr;
542  m_beamFreqs.clear();
543  m_markovConf = nullptr;
544  m_ncc = nullptr;
545  m_orbiterHelper = nullptr;
546  m_gwHelper = nullptr;
547  m_utHelper = nullptr;
548  m_antennaGainPatterns = nullptr;
549 }
550 
551 void
553 {
554  NS_LOG_FUNCTION(this);
555 
556  if (m_bstpController)
557  {
558  m_bstpController->Initialize();
559  }
560 }
561 
562 void
563 SatBeamHelper::SetAntennaGainPatterns(Ptr<SatAntennaGainPatternContainer> antennaPatterns)
564 {
565  NS_LOG_FUNCTION(this << antennaPatterns);
566 
567  m_antennaGainPatterns = antennaPatterns;
568 }
569 
570 void
571 SatBeamHelper::SetDeviceAttribute(std::string n1, const AttributeValue& v1)
572 {
573  NS_LOG_FUNCTION(this << n1);
574 }
575 
576 void
577 SatBeamHelper::SetChannelAttribute(std::string n1, const AttributeValue& v1)
578 {
579  NS_LOG_FUNCTION(this << n1);
580 
581  m_channelFactory.Set(n1, v1);
582 }
583 
584 void
586 {
587  NS_LOG_FUNCTION(this << &cb);
588 
589  m_ncc->SetUpdateRoutingCallback(cb);
590 }
591 
592 std::pair<Ptr<NetDevice>, NetDeviceContainer>
593 SatBeamHelper::Install(NodeContainer ut,
594  Ptr<Node> gwNode,
595  uint32_t gwId,
596  uint32_t satId,
597  uint32_t beamId,
598  uint32_t rtnUlFreqId,
599  uint32_t rtnFlFreqId,
600  uint32_t fwdUlFreqId,
601  uint32_t fwdFlFreqId,
602  SatMac::RoutingUpdateCallback routingCallback)
603 {
604  NS_LOG_FUNCTION(this << gwNode << gwId << satId << beamId << rtnUlFreqId << rtnFlFreqId
605  << fwdUlFreqId << fwdFlFreqId);
606 
607  // add pair satId / beamId as key and gwId as value to beam map. In case it's there already,
608  // assertion failure is caused
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);
612 
613  // TODO: Update channels to store 4 frequency ID
614  // save frequency pair to map with beam ID
615  // FrequencyPair_t freqPair = FrequencyPair_t (ulFreqId, flFreqId);
616  // m_beamFreqs.insert (std::pair<uint32_t, FrequencyPair_t > (beamId, freqPair));
617 
618  // next it is found feeder link channels and if not found channels are created and saved to map
619  SatChannelPair::ChannelPair_t feederLink =
620  GetChannelPair(satId, beamId, fwdFlFreqId, rtnFlFreqId, false);
621 
622  // next it is found user link channels and if not found channels are created and saved to map
624  GetChannelPair(satId, beamId, fwdUlFreqId, rtnUlFreqId, true);
625 
626  Ptr<Node> satNode = Singleton<SatTopology>::Get()->GetOrbiterNode(satId);
627 
628  NS_ASSERT(satNode != nullptr);
629 
630  // Get the position of the GW serving this beam, get the best beam based on antenna patterns
631  // for this position, and set the antenna patterns to the feeder PHY objects via
632  // AttachChannels method.
633  GeoCoordinate gwPos = gwNode->GetObject<SatMobilityModel>()->GetGeoPosition();
634  uint32_t feederSatId = Singleton<SatTopology>::Get()->GetClosestSat(gwPos);
635  uint32_t feederBeamId = m_antennaGainPatterns->GetBestBeamId(feederSatId, gwPos, true);
636  if (feederBeamId == 0)
637  {
638  feederBeamId = 1;
639  }
640 
641  // attach channels to satellite device
642  m_orbiterHelper->AttachChannels(satNode->GetDevice(0),
643  feederLink.first,
644  feederLink.second,
645  userLink.first,
646  userLink.second,
647  m_antennaGainPatterns->GetAntennaGainPattern(beamId),
648  m_antennaGainPatterns->GetAntennaGainPattern(feederBeamId),
649  m_ncc,
650  satId,
651  gwId,
652  beamId);
653 
654  Ptr<SatMobilityModel> gwMobility = gwNode->GetObject<SatMobilityModel>();
655  NS_ASSERT(gwMobility != nullptr);
656 
657  // enable timing advance in observers of the UTs
658  for (NodeContainer::Iterator i = ut.Begin(); i != ut.End(); i++)
659  {
660  // enable timing advance observing in nodes.
661 
662  Ptr<SatMobilityObserver> observer = (*i)->GetObject<SatMobilityObserver>();
663  NS_ASSERT(observer != nullptr);
664  observer->ObserveTimingAdvance(userLink.second->GetPropagationDelayModel(),
665  feederLink.second->GetPropagationDelayModel(),
666  gwMobility);
667 
669  {
671  }
672 
673  // save UT node pointer to multimap container
674  m_utNode.insert(std::make_pair(std::make_pair(satId, beamId), *i));
675  }
676 
677  Ptr<NetDevice> gwNd = InstallFeeder(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
678  gwNode,
679  gwId,
680  satId,
681  beamId,
682  feederSatId,
683  feederBeamId,
684  feederLink,
685  rtnFlFreqId,
686  fwdFlFreqId,
687  routingCallback);
688 
689  NetDeviceContainer utNd;
690  if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
692  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
694  {
695  if (m_gwNdMap.count(gwId) == 0)
696  {
697  // If first time we create a Net Device for this GW ID, store it
698  m_gwNdMap[gwId] = gwNd;
699  }
700  utNd = InstallUser(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
701  ut,
702  m_gwNdMap[gwId],
703  satId,
704  beamId,
705  userLink,
706  rtnUlFreqId,
707  fwdUlFreqId,
708  routingCallback);
709  }
710  else
711  {
712  utNd = InstallUser(DynamicCast<SatOrbiterNetDevice>(satNode->GetDevice(0)),
713  ut,
714  gwNd,
715  satId,
716  beamId,
717  userLink,
718  rtnUlFreqId,
719  fwdUlFreqId,
720  routingCallback);
721  }
722 
723  if (m_bstpController)
724  {
726  MakeCallback(&SatNetDevice::ToggleState, DynamicCast<SatNetDevice>(gwNd));
727 
728  m_bstpController->AddNetDeviceCallback(beamId, fwdUlFreqId, fwdFlFreqId, gwId, gwNdCb);
729  }
730 
731  return std::make_pair(gwNd, utNd);
732 }
733 
734 Ptr<NetDevice>
735 SatBeamHelper::InstallFeeder(Ptr<SatOrbiterNetDevice> orbiterNetDevice,
736  Ptr<Node> gwNode,
737  uint32_t gwId,
738  uint32_t satId,
739  uint32_t beamId,
740  uint32_t feederSatId,
741  uint32_t feederBeamId,
743  uint32_t rtnFlFreqId,
744  uint32_t fwdFlFreqId,
745  SatMac::RoutingUpdateCallback routingCallback)
746 {
747  NS_LOG_FUNCTION(this << gwNode << gwId << satId << beamId << rtnFlFreqId << fwdFlFreqId);
748 
749  // Set trace files if options ask for it
751  {
752  feederLink.second->SetAttribute("RxPowerCalculationMode",
753  EnumValue(SatEnums::RX_PWR_INPUT_TRACE));
754  }
755 
756  // store GW node
757  bool storedOk = StoreGwNode(gwId, gwNode);
758  NS_ASSERT(storedOk);
759 
760  // install fading container to GW
762  {
763  InstallFadingContainer(gwNode);
764  }
765 
766  // install GW
767  PointerValue llsConf;
768  m_utHelper->GetAttribute("LowerLayerServiceConf", llsConf);
769  Ptr<NetDevice> gwNd =
770  m_gwHelper->Install(gwNode,
771  gwId,
772  satId,
773  beamId,
774  feederSatId,
775  feederBeamId,
776  feederLink.first,
777  feederLink.second,
779  m_ncc,
780  llsConf.Get<SatLowerLayerServiceConf>());
781 
782  // calculate maximum size of the BB frame with the most robust MODCOD
783  Ptr<SatBbFrameConf> bbFrameConf = m_gwHelper->GetBbFrameConf();
784 
786 
787  if (bbFrameConf->GetBbFrameUsageMode() == SatEnums::SHORT_FRAMES)
788  {
789  frameType = SatEnums::SHORT_FRAME;
790  }
791 
792  uint32_t maxBbFrameDataSizeInBytes =
793  (bbFrameConf->GetBbFramePayloadBits(bbFrameConf->GetMostRobustModcod(frameType),
794  frameType) /
796  bbFrameConf->GetBbFrameHeaderSizeInBytes();
797 
798  Address satelliteUserAddress = Address();
799  if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
801  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
803  {
804  satelliteUserAddress = orbiterNetDevice->GetSatelliteUserAddress(beamId);
805  }
806 
807  switch (Singleton<SatTopology>::Get()->GetStandard())
808  {
809  case SatEnums::DVB:
810  m_ncc->AddBeam(
811  satId,
812  beamId,
813  DynamicCast<SatNetDevice>(gwNd),
814  orbiterNetDevice,
815  MakeCallback(&SatNetDevice::SendControlMsg, DynamicCast<SatNetDevice>(gwNd)),
816  MakeCallback(&SatGwMac::TbtpSent,
817  DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac())),
819  maxBbFrameDataSizeInBytes,
820  satelliteUserAddress,
821  gwNd->GetAddress());
822  break;
823  case SatEnums::LORA: {
824  if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
826  {
827  m_ncc->AddBeam(satId,
828  beamId,
829  DynamicCast<SatNetDevice>(gwNd),
830  orbiterNetDevice,
832  DynamicCast<SatLorawanNetDevice>(gwNd)),
833  MakeNullCallback<void, Ptr<SatTbtpMessage>>(),
835  maxBbFrameDataSizeInBytes,
836  satelliteUserAddress,
837  gwNd->GetAddress());
838  }
839  else
840  {
841  m_ncc->AddBeam(
842  satId,
843  beamId,
844  DynamicCast<SatNetDevice>(gwNd),
845  orbiterNetDevice,
846  MakeCallback(&SatNetDevice::SendControlMsg, DynamicCast<SatNetDevice>(gwNd)),
847  MakeCallback(&SatGwMac::TbtpSent,
848  DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac())),
850  maxBbFrameDataSizeInBytes,
851  satelliteUserAddress,
852  gwNd->GetAddress());
853  }
854  }
855 
856  break;
857  default:
858  NS_FATAL_ERROR("Incorrect standard chosen");
859  }
860 
861  // Add satellite addresses to GW MAC layers.
862  if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
864  Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
866  {
867  Ptr<SatGwMac> gwMac = DynamicCast<SatGwMac>(DynamicCast<SatNetDevice>(gwNd)->GetMac());
868  Mac48Address satFeederAddress = orbiterNetDevice->GetSatelliteFeederAddress(beamId);
869  gwMac->SetSatelliteAddress(satFeederAddress);
870  }
871 
872  // Add satellite addresses to GW LLC layers.
873  if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
875  {
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);
880  }
881 
882  return gwNd;
883 }
884 
885 NetDeviceContainer
886 SatBeamHelper::InstallUser(Ptr<SatOrbiterNetDevice> orbiterNetDevice,
887  NodeContainer ut,
888  Ptr<NetDevice> gwNd,
889  uint32_t satId,
890  uint32_t beamId,
892  uint32_t rtnUlFreqId,
893  uint32_t fwdUlFreqId,
894  SatMac::RoutingUpdateCallback routingCallback)
895 {
896  NS_LOG_FUNCTION(this << beamId << rtnUlFreqId << fwdUlFreqId);
897 
898  // Set trace files if options ask for it
900  {
901  userLink.second->SetAttribute("RxPowerCalculationMode",
902  EnumValue(SatEnums::RX_PWR_INPUT_TRACE));
903  }
904 
905  Address satUserAddress = Address();
906  if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
908  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
910  {
911  satUserAddress = orbiterNetDevice->GetUserMac(beamId)->GetAddress();
912  }
913 
914  // install UTs
915  NetDeviceContainer utNd =
916  m_utHelper->Install(ut,
917  satId,
918  beamId,
919  userLink.first,
920  userLink.second,
921  DynamicCast<SatNetDevice>(gwNd),
922  m_ncc,
923  satUserAddress,
925  routingCallback);
926 
927  // Add satellite addresses UT MAC layers.
928  if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
930  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
932  {
933  for (NetDeviceContainer::Iterator i = utNd.Begin(); i != utNd.End(); i++)
934  {
935  Ptr<SatMac> mac = DynamicCast<SatNetDevice>(*i)->GetMac();
936  Ptr<SatUtMac> utMac = DynamicCast<SatUtMac>(mac);
937  if (utMac != nullptr)
938  {
939  utMac->SetSatelliteAddress(satUserAddress);
940  }
941  else
942  {
943  mac->SetSatelliteAddress(satUserAddress);
944  }
945  }
946  }
947 
948  // Add satellite addresses UT LLC layers.
949  if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
951  {
952  for (NetDeviceContainer::Iterator i = utNd.Begin(); i != utNd.End(); i++)
953  {
954  Ptr<SatUtLlc> utLlc = DynamicCast<SatUtLlc>(DynamicCast<SatNetDevice>(*i)->GetLlc());
955  if (utLlc != nullptr)
956  {
957  utLlc->SetSatelliteAddress(Mac48Address::ConvertFrom(satUserAddress));
958  }
959  }
960  }
961 
962  return utNd;
963 }
964 
965 void
967 {
968  NS_LOG_FUNCTION(this);
969 
970  Ptr<PointToPointIslHelper> p2pIslHelper = CreateObject<PointToPointIslHelper>();
971  TrafficControlHelper tchIsl;
972 
973  for (std::vector<std::pair<uint32_t, uint32_t>>::iterator it = m_isls.begin();
974  it != m_isls.end();
975  it++)
976  {
977  Ptr<Node> sat1 = Singleton<SatTopology>::Get()->GetOrbiterNode(it->first);
978  Ptr<Node> sat2 = Singleton<SatTopology>::Get()->GetOrbiterNode(it->second);
979 
980  // Install a p2p ISL link between these two satellites
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));
986 
987  Ptr<SatOrbiterNetDevice> satNdSat1 = DynamicCast<SatOrbiterNetDevice>(sat1->GetDevice(0));
988  Ptr<SatOrbiterNetDevice> satNdSat2 = DynamicCast<SatOrbiterNetDevice>(sat2->GetDevice(0));
989 
990  satNdSat1->AddIslsNetDevice(islNdSat1);
991  satNdSat2->AddIslsNetDevice(islNdSat2);
992 
993  islNdSat1->SetOrbiterNetDevice(satNdSat1);
994  islNdSat2->SetOrbiterNetDevice(satNdSat2);
995  }
996 }
997 
998 void
1000 {
1001  NS_LOG_FUNCTION(this);
1002 
1003  m_orbiterHelper->SetIslRoutes(m_isls);
1004 }
1005 
1006 uint32_t
1007 SatBeamHelper::GetGwId(uint32_t satId, uint32_t beamId) const
1008 {
1009  std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator i =
1010  m_beam.find(std::make_pair(satId, beamId));
1011 
1012  if (i == m_beam.end())
1013  {
1014  return 0;
1015  }
1016  else
1017  {
1018  return i->second;
1019  }
1020 }
1021 
1022 Ptr<Node>
1023 SatBeamHelper::GetGwNode(uint32_t gwId) const
1024 {
1025  NS_LOG_FUNCTION(this << gwId);
1026 
1027  std::map<uint32_t, Ptr<Node>>::const_iterator gwIterator = m_gwNode.find(gwId);
1028  Ptr<Node> node = nullptr;
1029 
1030  if (gwIterator != m_gwNode.end())
1031  {
1032  node = gwIterator->second;
1033  }
1034 
1035  return node;
1036 }
1037 
1038 Ptr<SatUtHelper>
1040 {
1041  NS_LOG_FUNCTION(this);
1042  return m_utHelper;
1043 }
1044 
1045 Ptr<SatGwHelper>
1047 {
1048  NS_LOG_FUNCTION(this);
1049  return m_gwHelper;
1050 }
1051 
1052 Ptr<SatOrbiterHelper>
1054 {
1055  NS_LOG_FUNCTION(this);
1056  return m_orbiterHelper;
1057 }
1058 
1059 NodeContainer
1060 SatBeamHelper::GetUtNodes(uint32_t satId, uint32_t beamId) const
1061 {
1062  NS_LOG_FUNCTION(this << beamId);
1063 
1064  NodeContainer utNodes;
1065 
1066  // find all entries with the specified beamId
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>
1069  range;
1070  range = m_utNode.equal_range(std::make_pair(satId, beamId));
1071 
1072  for (std::map<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator i = range.first;
1073  i != range.second;
1074  ++i)
1075  {
1076  utNodes.Add(i->second);
1077  }
1078 
1079  return utNodes;
1080 }
1081 
1082 std::list<std::pair<uint32_t, uint32_t>>
1084 {
1085  NS_LOG_FUNCTION(this);
1086 
1087  std::list<std::pair<uint32_t, uint32_t>> ret;
1088 
1089  for (std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator it = m_beam.begin();
1090  it != m_beam.end();
1091  ++it)
1092  {
1093  ret.push_back(it->first);
1094  }
1095 
1096  return ret;
1097 }
1098 
1099 Ptr<SatNcc>
1101 {
1102  NS_LOG_FUNCTION(this);
1103 
1104  return m_ncc;
1105 }
1106 
1107 uint32_t
1108 SatBeamHelper::GetUtBeamId(Ptr<Node> utNode) const
1109 {
1110  NS_LOG_FUNCTION(this);
1111 
1112  uint32_t beamId = 0;
1113 
1114  for (std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator it =
1115  m_utNode.begin();
1116  ((it != m_utNode.end()) && (beamId == 0));
1117  it++)
1118  {
1119  if (it->second == utNode)
1120  {
1121  beamId = it->first.second;
1122  }
1123  }
1124 
1125  return beamId;
1126 }
1127 
1128 NetDeviceContainer
1130  Ptr<Node> sourceUtNode,
1131  Ipv4Address sourceAddress,
1132  Ipv4Address groupAddress,
1133  bool routeToGwUsers,
1134  Ptr<NetDevice>& gwOutputDev)
1135 {
1136  NS_LOG_FUNCTION(this);
1137 
1138  Mac48Address groupMacAddress;
1139  Ipv4StaticRoutingHelper multicast;
1140  NetDeviceContainer gwInputDevices;
1141  NetDeviceContainer routerGwOutputDevices;
1142  Ptr<NetDevice> routerDev = nullptr;
1143 
1144  uint32_t sourceBeamId = GetUtBeamId(sourceUtNode);
1145  gwOutputDev = nullptr;
1146 
1147  // Check the address sanity
1148  if (groupAddress.IsMulticast())
1149  {
1150  groupMacAddress = Mac48Address::GetMulticast(groupAddress);
1151  NS_LOG_INFO("IP address for multicast group: "
1152  << groupAddress << ", MAC address for multicast group: " << groupMacAddress);
1153  }
1154  else
1155  {
1156  NS_FATAL_ERROR("Invalid address for multicast group");
1157  }
1158 
1159  NodeContainer gwNodes = Singleton<SatTopology>::Get()->GetGwNodes();
1160 
1161  // go through all GW nodes and devices in them
1162  for (NodeContainer::Iterator it = gwNodes.Begin(); it != gwNodes.End(); it++)
1163  {
1164  bool routerGw = false;
1165  NetDeviceContainer gwOutputDevices;
1166  Ptr<NetDevice> gwInputDev = nullptr;
1167 
1168  // go through devices in GW node
1169  for (uint32_t i = 1; i < (*it)->GetNDevices(); i++)
1170  {
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);
1174 
1175  // device is device serving source UT. (UT source is in question)
1176  if (beamId == (int32_t)sourceBeamId)
1177  {
1178  routerGw = true; // GW node is routing GW
1179  routerDev = dev; // save device routing multicast traffic from UT
1180  }
1181 
1182  // device needs to serve multicast receiving UT(s) in the beam (beam is among of the
1183  // multicast group)
1184  if (beamIt != beamInfo.end())
1185  {
1186  // device must be also SatNetDevice, just sanity check it
1187  if (dev->GetInstanceTypeId().GetName() == "ns3::SatNetDevice")
1188  {
1189  // add device to GW's output list (container) to route multicast traffic to
1190  // beam's UTs
1191  gwOutputDevices.Add(dev);
1192 
1193  // go through UTs receiving multicast traffic in the beam
1194  // to route multicast traffic toward public network (UT users)
1195  for (std::set<Ptr<Node>>::iterator utIt = beamIt->second.begin();
1196  utIt != beamIt->second.end();
1197  utIt++)
1198  {
1199  AddMulticastRouteToUt(*utIt, sourceAddress, groupAddress, false);
1200  }
1201  }
1202  else
1203  {
1204  NS_FATAL_ERROR("Not a satellite net device!!!");
1205  }
1206  }
1207  else if (dev->GetInstanceTypeId().GetName() != "ns3::SatNetDevice")
1208  {
1209  // save device receiving traffic from IP router
1210  gwInputDev = dev;
1211  }
1212  }
1213 
1214  if (routerGw)
1215  {
1216  // in case that GW is source beam serving (routing) GW
1217  // traffic is going to IP router, so input is output
1218  gwOutputDev = gwInputDev;
1219 
1220  // GW output devices to satellite network UTs are saved here to set later.
1221  // In router case it is needed to check later that if traffic is needed to route
1222  // IP router too. (GW user or some other beam behind another GW is receiving traffic)
1223  routerGwOutputDevices = gwOutputDevices;
1224  }
1225  else if (gwOutputDevices.GetN() >
1226  0) // no router GW some device in GW belong to beam receiving multicast traffic
1227  {
1228  // route traffic from source beam to receiving beams
1229  multicast.AddMulticastRoute(*it,
1230  sourceAddress,
1231  groupAddress,
1232  gwInputDev,
1233  gwOutputDevices);
1234 
1235  // save devices receiving traffic from IP router (backbone network)
1236  gwInputDevices.Add(gwInputDev);
1237  }
1238  }
1239 
1240  // source is UT and traffic is needed to route toward backbone network
1241  // add output device to routing GW's output container (list)
1242  if (sourceUtNode && ((gwInputDevices.GetN() > 0) || routeToGwUsers))
1243  {
1244  if (!routerDev)
1245  {
1246  NS_FATAL_ERROR("Router device shall exist!!!");
1247  }
1248 
1249  routerGwOutputDevices.Add(gwOutputDev);
1250  }
1251  else
1252  {
1253  gwOutputDev = nullptr;
1254  }
1255 
1256  // route traffic from source beam satellite net device to satellite net devices forwarding
1257  // traffic to receiving beams inside router GW and/or to backbone network (GW users). add also
1258  // route to UT from public network to satellite network
1259  if (routerDev && (routerGwOutputDevices.GetN() > 0))
1260  {
1261  multicast.AddMulticastRoute(routerDev->GetNode(),
1262  sourceAddress,
1263  groupAddress,
1264  routerDev,
1265  routerGwOutputDevices);
1266  AddMulticastRouteToUt(sourceUtNode, sourceAddress, groupAddress, true);
1267  }
1268 
1269  // return list of GW net devices receiving traffic from IP router (backbone network)
1270  return gwInputDevices;
1271 }
1272 
1273 void
1274 SatBeamHelper::EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb)
1275 {
1276  NS_LOG_FUNCTION(this);
1277 
1278  TraceConnect("Creation", "SatBeamHelper", cb);
1279  m_orbiterHelper->EnableCreationTraces(stream, cb);
1280  m_gwHelper->EnableCreationTraces(stream, cb);
1281  m_utHelper->EnableCreationTraces(stream, cb);
1282 }
1283 
1284 void
1286 {
1287  // Create packet trace instance
1288  m_packetTrace = CreateObject<SatPacketTrace>();
1289 
1299  SatEnums::RegenerationMode_t maxRegeneration =
1300  std::max(Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode(),
1301  Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode());
1302 
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",
1318  if (maxRegeneration == SatEnums::REGENERATION_LINK ||
1319  maxRegeneration == SatEnums::REGENERATION_NETWORK)
1320  {
1321  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/UserMac/*/PacketTrace",
1323  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/FeederMac/*/PacketTrace",
1325  }
1326  if (Singleton<SatTopology>::Get()->GetStandard() == SatEnums::DVB)
1327  {
1328  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/SatLlc/PacketTrace",
1330  }
1331 }
1332 
1333 std::string
1335 {
1336  NS_LOG_FUNCTION(this);
1337 
1338  std::ostringstream oss;
1339  oss << "--- Beam Info, "
1340  << "number of created beams: " << m_beam.size() << " ---" << std::endl;
1341 
1342  if (m_beam.size() > 0)
1343  {
1344  oss << CreateBeamInfo();
1345  }
1346 
1347  return oss.str();
1348 }
1349 
1350 std::string
1352 {
1353  NS_LOG_FUNCTION(this);
1354 
1355  std::ostringstream oss;
1356 
1357  for (std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>::const_iterator i =
1358  m_utNode.begin();
1359  i != m_utNode.end();
1360  ++i)
1361  {
1362  Ptr<SatMobilityModel> model = i->second->GetObject<SatMobilityModel>();
1363  GeoCoordinate pos = model->GetGeoPosition();
1364 
1365  Address devAddress;
1366  Ptr<Ipv4> ipv4 = i->second->GetObject<Ipv4>(); // Get Ipv4 instance of the node
1367 
1368  std::vector<Ipv4Address> IPAddressVector;
1369  std::vector<std::string> devNameVector;
1370  std::vector<Address> devAddressVector;
1371 
1372  for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1373  {
1374  Ptr<NetDevice> device = i->second->GetDevice(j);
1375 
1376  if (device->GetInstanceTypeId().GetName() == "ns3::SatNetDevice")
1377  {
1378  devAddress = device->GetAddress();
1379  }
1380  IPAddressVector.push_back(
1381  ipv4->GetAddress(j, 0).GetLocal()); // Get Ipv4InterfaceAddress of interface
1382  devNameVector.push_back(device->GetInstanceTypeId().GetName());
1383  devAddressVector.push_back(device->GetAddress());
1384  }
1385 
1387  {
1388  oss << i->first.second << " "
1389  << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) << " "
1390  << pos.GetLatitude() << " " << pos.GetLongitude() << " " << pos.GetAltitude()
1391  << " ";
1392 
1393  for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1394  {
1395  oss << devNameVector[j] << " " << devAddressVector[j] << " " << IPAddressVector[j]
1396  << " ";
1397  }
1398 
1399  oss << std::endl;
1400  }
1401  else
1402  {
1403  oss << i->first.second << " "
1404  << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) << " "
1405  << pos.GetLatitude() << " " << pos.GetLongitude() << " " << pos.GetAltitude()
1406  << std::endl;
1407  }
1408  }
1409 
1410  return oss.str();
1411 }
1412 
1413 std::string
1415 {
1416  NS_LOG_FUNCTION(this);
1417 
1418  std::ostringstream oss;
1419 
1420  oss << std::endl << " -- Beam details --";
1421 
1422  for (std::map<std::pair<uint32_t, uint32_t>, uint32_t>::const_iterator i = m_beam.begin();
1423  i != m_beam.end();
1424  ++i)
1425  {
1426  uint32_t satId = i->first.first;
1427  uint32_t beamId = i->first.second;
1428 
1429  oss << std::endl << "Sat ID: " << satId << " ";
1430  oss << "Beam ID: " << beamId << " ";
1431 
1432  std::map<std::pair<uint32_t, uint32_t>, FrequencyPair_t>::const_iterator freqIds =
1433  m_beamFreqs.find(std::make_pair(satId, beamId));
1434 
1435  if (freqIds != m_beamFreqs.end())
1436  {
1437  oss << "user link frequency ID: " << (*freqIds).second.first << ", ";
1438  oss << "feeder link frequency ID: " << (*freqIds).second.second;
1439  }
1440 
1441  oss << ", GW ID: " << (*i).second;
1442  }
1443 
1444  oss << std::endl << std::endl << " -- GW details --" << std::endl;
1445 
1446  oss.precision(8);
1447  oss.setf(std::ios::fixed, std::ios::floatfield);
1448 
1449  for (std::map<uint32_t, Ptr<Node>>::const_iterator i = m_gwNode.begin(); i != m_gwNode.end();
1450  ++i)
1451  {
1452  Ptr<SatMobilityModel> model = i->second->GetObject<SatMobilityModel>();
1453  GeoCoordinate pos = model->GetGeoPosition();
1454 
1455  Address devAddress;
1456  Ptr<Ipv4> ipv4 = i->second->GetObject<Ipv4>(); // Get Ipv4 instance of the node
1457 
1458  std::vector<Ipv4Address> IPAddressVector;
1459  std::vector<std::string> devNameVector;
1460  std::vector<Address> devAddressVector;
1461 
1462  for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1463  {
1464  Ptr<NetDevice> device = i->second->GetDevice(j);
1465 
1466  if (device->GetInstanceTypeId().GetName() == "ns3::SatNetDevice")
1467  {
1468  devAddress = device->GetAddress();
1469  }
1470 
1471  IPAddressVector.push_back(
1472  ipv4->GetAddress(j, 0).GetLocal()); // Get Ipv4InterfaceAddress of interface
1473  devNameVector.push_back(device->GetInstanceTypeId().GetName());
1474  devAddressVector.push_back(device->GetAddress());
1475  }
1476 
1478  {
1479  oss << "GW=" << i->first << " "
1480  << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) << " "
1481  << " latitude=" << pos.GetLatitude() << " longitude=" << pos.GetLongitude()
1482  << " altitude=" << pos.GetAltitude() << " ";
1483 
1484  for (uint32_t j = 0; j < i->second->GetNDevices(); j++)
1485  {
1486  oss << devNameVector[j] << " " << devAddressVector[j] << " " << IPAddressVector[j]
1487  << " ";
1488  }
1489 
1490  oss << std::endl;
1491  }
1492  else
1493  {
1494  oss << "GW=" << i->first << " "
1495  << Singleton<SatIdMapper>::Get()->GetUtIdWithMac(devAddress) << " "
1496  << " latitude=" << pos.GetLatitude() << " longitude=" << pos.GetLongitude()
1497  << " altitude=" << pos.GetAltitude() << std::endl;
1498  }
1499  }
1500 
1501  oss << std::endl << " -- Satellite positions --" << std::endl;
1502 
1503  NodeContainer orbiters = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1504  for (NodeContainer::Iterator it = orbiters.Begin(); it != orbiters.End(); it++)
1505  {
1506  Ptr<SatMobilityModel> model = (*it)->GetObject<SatMobilityModel>();
1507  GeoCoordinate pos = model->GetGeoPosition();
1508  oss << "latitude=" << pos.GetLatitude() << ", longitude=" << pos.GetLongitude()
1509  << ", altitude=" << pos.GetAltitude() << std::endl;
1510  }
1511 
1512  return oss.str();
1513 }
1514 
1517  uint32_t beamId,
1518  uint32_t fwdFrequencyId,
1519  uint32_t rtnFrequencyId,
1520  bool isUserLink)
1521 {
1522  NS_LOG_FUNCTION(this << satId << beamId << fwdFrequencyId << rtnFrequencyId << isUserLink);
1523 
1524  Ptr<SatChannelPair> chPairs = isUserLink ? m_ulChannels : m_flChannels;
1525 
1526  bool hasFwdChannel = chPairs->HasFwdChannel(satId, fwdFrequencyId);
1527  bool hasRtnChannel = chPairs->HasRtnChannel(satId, rtnFrequencyId);
1528 
1529  if (hasFwdChannel && hasRtnChannel)
1530  {
1531  chPairs->UpdateBeamsForFrequency(satId, beamId, fwdFrequencyId, rtnFrequencyId);
1532  }
1533  else
1534  {
1535  Ptr<SatFreeSpaceLoss> pFsl;
1536  Ptr<PropagationDelayModel> pDelay;
1537  Ptr<SatChannel> forwardCh;
1538  Ptr<SatChannel> returnCh;
1539 
1540  if (hasFwdChannel)
1541  {
1542  forwardCh = chPairs->GetForwardChannel(satId, fwdFrequencyId);
1543  pDelay = forwardCh->GetPropagationDelayModel();
1544  pFsl = forwardCh->GetFreeSpaceLoss();
1545  }
1546  else if (hasRtnChannel)
1547  {
1548  returnCh = chPairs->GetReturnChannel(satId, rtnFrequencyId);
1549  pDelay = returnCh->GetPropagationDelayModel();
1550  pFsl = returnCh->GetFreeSpaceLoss();
1551  }
1552  else
1553  {
1555  {
1556  // Signal propagates at the speed of light
1557  pDelay = CreateObject<ConstantSpeedPropagationDelayModel>();
1558  DynamicCast<ConstantSpeedPropagationDelayModel>(pDelay)->SetSpeed(
1560  }
1562  {
1563  pDelay = CreateObject<SatConstantPropagationDelayModel>();
1564  DynamicCast<SatConstantPropagationDelayModel>(pDelay)->SetDelay(
1566  }
1567  else
1568  {
1569  NS_FATAL_ERROR("Unsupported propagation delay model!");
1570  }
1571 
1572  pFsl = CreateObject<SatFreeSpaceLoss>();
1573  }
1574 
1575  if (!hasFwdChannel)
1576  {
1577  forwardCh = m_channelFactory.Create<SatChannel>();
1578  forwardCh->SetChannelType(isUserLink ? SatEnums::FORWARD_USER_CH
1580  forwardCh->SetFrequencyConverter(m_carrierFreqConverter);
1581  forwardCh->SetBandwidthConverter(m_carrierBandwidthConverter);
1582  forwardCh->SetFrequencyId(fwdFrequencyId);
1583  forwardCh->SetPropagationDelayModel(pDelay);
1584  forwardCh->SetFreeSpaceLoss(pFsl);
1585  }
1586 
1587  if (!hasRtnChannel)
1588  {
1589  returnCh = m_channelFactory.Create<SatChannel>();
1590  returnCh->SetChannelType(isUserLink ? SatEnums::RETURN_USER_CH
1592  returnCh->SetFrequencyConverter(m_carrierFreqConverter);
1593  returnCh->SetBandwidthConverter(m_carrierBandwidthConverter);
1594  returnCh->SetFrequencyId(rtnFrequencyId);
1595  returnCh->SetPropagationDelayModel(pDelay);
1596  returnCh->SetFreeSpaceLoss(pFsl);
1597  }
1598 
1599  chPairs
1600  ->StoreChannelPair(satId, beamId, fwdFrequencyId, forwardCh, rtnFrequencyId, returnCh);
1601  }
1602 
1603  return chPairs->GetChannelPair(satId, beamId);
1604 }
1605 
1606 bool
1607 SatBeamHelper::StoreGwNode(uint32_t id, Ptr<Node> node)
1608 {
1609  NS_LOG_FUNCTION(this << id << node);
1610 
1611  bool storingSuccess = false;
1612 
1613  Ptr<Node> storedNode = GetGwNode(id);
1614 
1615  if (storedNode != nullptr) // nGW node with id already stored
1616  {
1617  if (storedNode == node) // check that node is same
1618  {
1619  storingSuccess = true;
1620  }
1621  }
1622  else // try to store if not stored
1623  {
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);
1628  }
1629 
1630  return storingSuccess;
1631 }
1632 
1633 Ptr<SatBaseFading>
1635 {
1636  NS_LOG_FUNCTION(this << node);
1637 
1638  Ptr<SatBaseFading> fadingContainer = node->GetObject<SatBaseFading>();
1639 
1640  if (fadingContainer == nullptr)
1641  {
1642  switch (m_fadingModel)
1643  {
1644  case SatEnums::FADING_MARKOV: {
1645  Ptr<SatMobilityObserver> observer = node->GetObject<SatMobilityObserver>();
1646  NS_ASSERT(observer != nullptr);
1647 
1648  SatBaseFading::ElevationCallback elevationCb =
1649  MakeCallback(&SatMobilityObserver::GetElevationAngle, observer);
1650  SatBaseFading::VelocityCallback velocityCb =
1651  MakeCallback(&SatMobilityObserver::GetVelocity, observer);
1652 
1654  fadingContainer =
1655  CreateObject<SatMarkovContainer>(m_markovConf, elevationCb, velocityCb);
1656  node->AggregateObject(fadingContainer);
1657  break;
1658  }
1659  case SatEnums::FADING_TRACE: {
1661 
1662  fadingContainer =
1663  CreateObject<SatFadingInputTrace>(Singleton<SatFadingInputTraceContainer>::Get());
1664 
1665  node->AggregateObject(fadingContainer);
1666  break;
1667  }
1669  case SatEnums::FADING_OFF:
1670  default: {
1671  NS_FATAL_ERROR("SatBeamHelper::InstallFadingContainer - Incorrect fading model");
1672  break;
1673  }
1674  }
1675  }
1676  return fadingContainer;
1677 }
1678 
1679 void
1681  Ipv4Address sourceAddress,
1682  Ipv4Address groupAddress,
1683  bool routeToSatellite)
1684 {
1685  NS_LOG_FUNCTION(this);
1686 
1687  Ptr<NetDevice> satDev = nullptr;
1688  Ptr<NetDevice> publicDev = nullptr;
1689 
1690  for (uint32_t i = 1; i < utNode->GetNDevices(); i++)
1691  {
1692  Ptr<NetDevice> dev = utNode->GetDevice(i);
1693 
1694  // in UT SatNetDevice is routing traffic to public network NetDevice e.g. CSMA
1695  if (dev->GetInstanceTypeId().GetName() == "ns3::SatNetDevice")
1696  {
1697  satDev = dev;
1698  }
1699  else
1700  {
1701  // just save last non SatNetDevice (in practice there should be only one)
1702  publicDev = dev;
1703  }
1704  }
1705 
1706  if (satDev && publicDev)
1707  {
1708  Ipv4StaticRoutingHelper multicast;
1709 
1710  if (routeToSatellite)
1711  {
1712  multicast.AddMulticastRoute(utNode, sourceAddress, groupAddress, publicDev, satDev);
1713  }
1714  else
1715  {
1716  multicast.AddMulticastRoute(utNode, sourceAddress, groupAddress, satDev, publicDev);
1717  }
1718 
1719  // Add multicast route to UT
1720  }
1721  else
1722  {
1723  NS_FATAL_ERROR("Input of output device not found in UT node!!!");
1724  }
1725 }
1726 
1727 Ptr<PropagationDelayModel>
1729  uint32_t beamId,
1730  SatEnums::ChannelType_t channelType)
1731 {
1732  Ptr<SatChannel> channel = nullptr;
1733  switch (channelType)
1734  {
1736  channel = m_flChannels->GetChannelPair(satId, beamId).first;
1737  break;
1738  }
1740  channel = m_ulChannels->GetChannelPair(satId, beamId).first;
1741  break;
1742  }
1743  case SatEnums::RETURN_USER_CH: {
1744  channel = m_ulChannels->GetChannelPair(satId, beamId).second;
1745  break;
1746  }
1748  channel = m_flChannels->GetChannelPair(satId, beamId).second;
1749  break;
1750  }
1751  default: {
1752  return nullptr;
1753  }
1754  }
1755 
1756  return channel->GetPropagationDelayModel();
1757 }
1758 
1761 {
1762  return m_propagationDelayModel;
1763 }
1764 
1765 } // namespace ns3
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.
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.
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.
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceModel m_raFwdInterferenceModel
SatPhyRxCarrierConf::InterferenceModel m_raRtnInterferenceModel
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