satellite-beam-helper.h
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 #ifndef SATELLITE_BEAM_HELPER_H
24 #define SATELLITE_BEAM_HELPER_H
25 
26 #include "satellite-geo-helper.h"
27 #include "satellite-gw-helper.h"
28 #include "satellite-ut-helper.h"
29 
30 #include <ns3/ipv4-address-helper.h>
31 #include <ns3/node-container.h>
32 #include <ns3/satellite-antenna-gain-pattern-container.h>
33 #include <ns3/satellite-beam-channel-pair.h>
34 #include <ns3/satellite-bstp-controller.h>
35 #include <ns3/satellite-markov-container.h>
36 #include <ns3/satellite-mobility-observer.h>
37 #include <ns3/satellite-ncc.h>
38 #include <ns3/satellite-packet-trace.h>
39 #include <ns3/satellite-phy-rx-carrier-conf.h>
40 #include <ns3/satellite-superframe-sequence.h>
41 #include <ns3/satellite-typedefs.h>
42 
43 #include <map>
44 #include <set>
45 #include <stdint.h>
46 #include <string>
47 #include <vector>
48 
49 namespace ns3
50 {
51 
52 class PropagationDelayModel;
53 
62 class SatBeamHelper : public Object
63 {
64  public:
69 
74 
75  typedef std::pair<uint32_t, uint32_t> FrequencyPair_t; // user = first, feeder = second
76  typedef std::pair<uint32_t, uint32_t> GwLink_t; // first GW ID, second feeder link frequency id
77 
78  typedef std::set<Ptr<Node>>
79  MulticastBeamInfoItem_t; // set container having receiving UT nodes in beam
80  typedef std::map<uint32_t, std::set<Ptr<Node>>>
81  MulticastBeamInfo_t; // key = beam ID, value = receiving UT nodes in beam
82 
87  static TypeId GetTypeId(void);
88 
93  virtual TypeId GetInstanceTypeId(void) const;
94 
98  SatBeamHelper();
99 
113  SatBeamHelper(NodeContainer geoNodes,
114  std::vector<std::pair<uint32_t, uint32_t>> isls,
115  SatTypedefs::CarrierBandwidthConverter_t bandwidthConverterCb,
116  uint32_t fwdLinkCarrierCount,
117  uint32_t rtnLinkCarrierCount,
118  Ptr<SatSuperframeSeq> seq,
119  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
120  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
121 
125  virtual ~SatBeamHelper()
126  {
127  }
128 
133  void Init();
134 
138  void SetStandard(SatEnums::Standard_t standard);
139 
149  void SetAntennaGainPatterns(Ptr<SatAntennaGainPatternContainer> antennaPatterns);
150 
161  void SetDeviceAttribute(std::string name, const AttributeValue& value);
162 
173  void SetChannelAttribute(std::string name, const AttributeValue& value);
174 
180 
199  std::pair<Ptr<NetDevice>, NetDeviceContainer> Install(
200  NodeContainer ut,
201  Ptr<Node> gwNode,
202  uint32_t gwId,
203  uint32_t satId,
204  uint32_t beamId,
205  uint32_t rtnUlFreqId,
206  uint32_t rtnFlFreqId,
207  uint32_t fwdUlFreqId,
208  uint32_t fwdFlFreqId,
209  SatUtMac::RoutingUpdateCallback routingCallback);
210 
227  Ptr<NetDevice> InstallFeeder(Ptr<SatGeoNetDevice> geoNetDevice,
228  Ptr<Node> gwNode,
229  uint32_t gwId,
230  uint32_t satId,
231  uint32_t beamId,
233  uint32_t rtnFlFreqId,
234  uint32_t fwdFlFreqId,
235  SatUtMac::RoutingUpdateCallback routingCallback);
236 
253  NetDeviceContainer InstallUser(Ptr<SatGeoNetDevice> geoNetDevice,
254  NodeContainer ut,
255  Ptr<NetDevice> gwNd,
256  uint32_t satId,
257  uint32_t beamId,
259  uint32_t rtnUlFreqId,
260  uint32_t fwdUlFreqId,
261  SatUtMac::RoutingUpdateCallback routingCallback);
262 
266  void InstallIsls();
267 
271  void SetIslRoutes();
272 
279  uint32_t GetGwId(uint32_t satId, uint32_t beamId) const;
280 
284  NodeContainer GetGwNodes() const;
285 
289  NodeContainer GetUtNodes() const;
290 
296  NodeContainer GetUtNodes(uint32_t satId, uint32_t beamId) const;
297 
302  std::list<std::pair<uint32_t, uint32_t>> GetBeams() const;
303 
309  void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
310 
316  uint32_t GetClosestSat(GeoCoordinate position);
317 
321  std::string GetBeamInfo() const;
322 
326  std::string GetUtInfo() const;
327 
335  Ptr<Node> GetGwNode(uint32_t gwId) const;
336 
342  NodeContainer GetGeoSatNodes() const;
343 
347  Ptr<SatUtHelper> GetUtHelper() const;
348 
352  Ptr<SatGwHelper> GetGwHelper() const;
353 
357  Ptr<SatGeoHelper> GetGeoHelper() const;
358 
362  Ptr<SatNcc> GetNcc() const;
363 
370  uint32_t GetUtBeamId(Ptr<Node> utNode) const;
371 
377 
390  NetDeviceContainer AddMulticastGroupRoutes(MulticastBeamInfo_t beamInfo,
391  Ptr<Node> sourceUtNode,
392  Ipv4Address sourceAddress,
393  Ipv4Address groupAddress,
394  bool routeToGwUsers,
395  Ptr<NetDevice>& gwOutputDev);
396 
400  virtual void DoDispose();
401 
407  void EnablePacketTrace();
408 
409  Ptr<PropagationDelayModel> GetPropagationDelayModel(uint32_t satId,
410  uint32_t beamId,
411  SatEnums::ChannelType_t channelType);
412 
414 
415  private:
418 
419  Ptr<SatSuperframeSeq> m_superframeSeq;
420 
421  ObjectFactory m_channelFactory;
422  Ptr<SatGeoHelper> m_geoHelper;
423  Ptr<SatGwHelper> m_gwHelper;
424  Ptr<SatUtHelper> m_utHelper;
425  NodeContainer m_geoNodes;
426  Ptr<SatNcc> m_ncc;
427 
428  Ptr<SatAntennaGainPatternContainer> m_antennaGainPatterns;
429 
430  std::map<std::pair<uint32_t, uint32_t>, uint32_t>
431  m_beam; // first pair sat ID / beam ID, second GW ID
432  std::map<uint32_t, Ptr<Node>> m_gwNode; // first GW ID, second node pointer
433  std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>
434  m_utNode; // first pair sat ID / beam ID, second node pointer of the UT
435  Ptr<SatChannelPair> m_ulChannels; // user link ID, channel pointers pair
436  Ptr<SatChannelPair> m_flChannels; // feeder link ID, channel pointers pair
437  std::map<std::pair<uint32_t, uint32_t>, FrequencyPair_t>
438  m_beamFreqs; // first beam ID, channel frequency IDs pair
439 
443  TracedCallback<std::string> m_creationTrace;
444 
450 
455 
460 
465 
470 
474  Ptr<SatMarkovConf> m_markovConf;
475 
482 
488 
493 
498 
503 
508 
514 
521 
526  Ptr<SatBstpController> m_bstpController;
527 
531  Ptr<SatPacketTrace> m_packetTrace;
532 
537 
542  std::string CreateBeamInfo() const;
543 
553  uint32_t beamId,
554  uint32_t fwdFrequencyId,
555  uint32_t rtnFrequencyId,
556  bool isUserLink);
557 
566  bool StoreGwNode(uint32_t id, Ptr<Node> node);
567 
574  Ptr<SatBaseFading> InstallFadingContainer(Ptr<Node> node) const;
575 
584  void AddMulticastRouteToUt(Ptr<Node> utNode,
585  Ipv4Address sourceAddress,
586  Ipv4Address groupAddress,
587  bool routeToSatellite);
588 
593 
598 
603 
608 
612  std::map<uint32_t, Ptr<NetDevice>> m_gwNdMap;
613 
617  std::vector<std::pair<uint32_t, uint32_t>> m_isls;
618 };
619 
620 } // namespace ns3
621 
622 #endif /* SATELLITE_BEAM_HELPER_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
SatBeamHelper builds a set Satellite beams with needed objects and configuration.
void SetAntennaGainPatterns(Ptr< SatAntennaGainPatternContainer > antennaPatterns)
Set the antenna gain patterns to be used when configuring the beams to the GEO 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
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
The regeneration mode used in satellites for forward link.
void SetIslRoutes()
Set ISL routes.
SatChannel::CarrierFreqConverter CarrierFreqConverter
Define type CarrierFreqConverter.
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
std::set< Ptr< Node > > MulticastBeamInfoItem_t
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)
SatTypedefs::CarrierBandwidthConverter_t CarrierBandwidthConverter
Define type CarrierBandwidthConverter.
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.
SatBeamHelper()
Default constructor for SatBeamHelper (should not be used).
SatEnums::LinkResults_t m_rlLinkResultsType
Type of Return channel link results.
std::string GetBeamInfo() const
Ptr< SatGeoHelper > GetGeoHelper() const
uint32_t GetUtBeamId(Ptr< Node > utNode) const
Get beam Id of the given UT.
NodeContainer GetGeoSatNodes() const
Gets Geo Satellite nodes.
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.
std::pair< uint32_t, uint32_t > GwLink_t
static TypeId GetTypeId(void)
Get the type ID.
std::string GetUtInfo() const
std::string CreateBeamInfo() const
Creates info of the beam.
NodeContainer GetUtNodes() const
NodeContainer GetGwNodes() const
SatEnums::PropagationDelayModel_t m_propagationDelayModel
Propagation delay model.
SatEnums::RegenerationMode_t GetReturnLinkRegenerationMode() const
Get the regeneration mode used in satellites for return link.
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, SatUtMac::RoutingUpdateCallback routingCallback)
void SetStandard(SatEnums::Standard_t standard)
Set the standard to either DVB or Lora.
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.
NetDeviceContainer InstallUser(Ptr< SatGeoNetDevice > geoNetDevice, NodeContainer ut, Ptr< NetDevice > gwNd, uint32_t satId, uint32_t beamId, SatChannelPair::ChannelPair_t userLink, uint32_t rtnUlFreqId, uint32_t fwdUlFreqId, SatUtMac::RoutingUpdateCallback routingCallback)
Time m_ctrlMsgStoreTimeRtnLink
Control message store in container for return link.
uint32_t GetClosestSat(GeoCoordinate position)
Get closest satellite to a ground station.
Ptr< SatChannelPair > m_ulChannels
Ptr< NetDevice > InstallFeeder(Ptr< SatGeoNetDevice > geoNetDevice, Ptr< Node > gwNode, uint32_t gwId, uint32_t satId, uint32_t beamId, SatChannelPair::ChannelPair_t feederLink, uint32_t rtnFlFreqId, uint32_t fwdFlFreqId, SatUtMac::RoutingUpdateCallback routingCallback)
virtual ~SatBeamHelper()
Destructor for SatBeamHelper.
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
The regeneration mode used in satellites for return link.
Ptr< SatGwHelper > m_gwHelper
SatEnums::Standard_t m_standard
The global standard used.
Ptr< SatGeoHelper > m_geoHelper
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< double, SatEnums::ChannelType_t, uint32_t, uint32_t > CarrierFreqConverter
std::pair< Ptr< SatChannel >, Ptr< SatChannel > > ChannelPair_t
LinkResults_t
Return link Link result types.
ChannelType_t
Types of channel.
PropagationDelayModel_t
Propagation delay model.
Standard_t
The global standard used.
RandomAccessModel_t
The defined random access models.
FadingModel_t
Fading models.
RegenerationMode_t
The regeneration mode used in satellites.
DvbVersion_t
The scheduling algorithm used to fill the BBFrames.
Callback< void, Address, Address > RoutingUpdateCallback
Callback to update routing and ARP tables after handover.
Callback< void, Address, Address, Address > UpdateRoutingCallback
Update routes and ARP tables on gateways after a terminal handover.
InterferenceEliminationModel
Interference cancelation model enum.
RandomAccessCollisionModel
Random access collision model enum.
InterferenceModel
Interference model enum.
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.