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-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 <list>
44 #include <map>
45 #include <set>
46 #include <stdint.h>
47 #include <string>
48 #include <utility>
49 #include <vector>
50 
51 namespace ns3
52 {
53 
54 class PropagationDelayModel;
55 
64 class SatBeamHelper : public Object
65 {
66  public:
71 
76 
77  typedef std::pair<uint32_t, uint32_t> FrequencyPair_t; // user = first, feeder = second
78  typedef std::pair<uint32_t, uint32_t> GwLink_t; // first GW ID, second feeder link frequency id
79 
80  typedef std::set<Ptr<Node>>
81  MulticastBeamInfoItem_t; // set container having receiving UT nodes in beam
82  typedef std::map<uint32_t, std::set<Ptr<Node>>>
83  MulticastBeamInfo_t; // key = beam ID, value = receiving UT nodes in beam
84 
89  static TypeId GetTypeId(void);
90 
95  virtual TypeId GetInstanceTypeId(void) const;
96 
100  SatBeamHelper();
101 
112  SatBeamHelper(std::vector<std::pair<uint32_t, uint32_t>> isls,
113  SatTypedefs::CarrierBandwidthConverter_t bandwidthConverterCb,
114  uint32_t fwdLinkCarrierCount,
115  uint32_t rtnLinkCarrierCount,
116  Ptr<SatSuperframeSeq> seq);
117 
121  virtual ~SatBeamHelper()
122  {
123  }
124 
129  void Init();
130 
140  void SetAntennaGainPatterns(Ptr<SatAntennaGainPatternContainer> antennaPatterns);
141 
152  void SetDeviceAttribute(std::string name, const AttributeValue& value);
153 
164  void SetChannelAttribute(std::string name, const AttributeValue& value);
165 
171 
190  std::pair<Ptr<NetDevice>, NetDeviceContainer> Install(
191  NodeContainer ut,
192  Ptr<Node> gwNode,
193  uint32_t gwId,
194  uint32_t satId,
195  uint32_t beamId,
196  uint32_t rtnUlFreqId,
197  uint32_t rtnFlFreqId,
198  uint32_t fwdUlFreqId,
199  uint32_t fwdFlFreqId,
200  SatMac::RoutingUpdateCallback routingCallback);
201 
220  Ptr<NetDevice> InstallFeeder(Ptr<SatOrbiterNetDevice> orbiterNetDevice,
221  Ptr<Node> gwNode,
222  uint32_t gwId,
223  uint32_t satId,
224  uint32_t beamId,
225  uint32_t feederSatId,
226  uint32_t feederBeamId,
228  uint32_t rtnFlFreqId,
229  uint32_t fwdFlFreqId,
230  SatMac::RoutingUpdateCallback routingCallback);
231 
248  NetDeviceContainer InstallUser(Ptr<SatOrbiterNetDevice> orbiterNetDevice,
249  NodeContainer ut,
250  Ptr<NetDevice> gwNd,
251  uint32_t satId,
252  uint32_t beamId,
254  uint32_t rtnUlFreqId,
255  uint32_t fwdUlFreqId,
256  SatMac::RoutingUpdateCallback routingCallback);
257 
261  void InstallIsls();
262 
266  void SetIslRoutes();
267 
274  uint32_t GetGwId(uint32_t satId, uint32_t beamId) const;
275 
281  NodeContainer GetUtNodes(uint32_t satId, uint32_t beamId) const;
282 
287  std::list<std::pair<uint32_t, uint32_t>> GetBeams() const;
288 
294  void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
295 
299  std::string GetBeamInfo() const;
300 
304  std::string GetUtInfo() const;
305 
313  Ptr<Node> GetGwNode(uint32_t gwId) const;
314 
318  Ptr<SatUtHelper> GetUtHelper() const;
319 
323  Ptr<SatGwHelper> GetGwHelper() const;
324 
328  Ptr<SatOrbiterHelper> GetOrbiterHelper() const;
329 
333  Ptr<SatNcc> GetNcc() const;
334 
341  uint32_t GetUtBeamId(Ptr<Node> utNode) const;
342 
355  NetDeviceContainer AddMulticastGroupRoutes(MulticastBeamInfo_t beamInfo,
356  Ptr<Node> sourceUtNode,
357  Ipv4Address sourceAddress,
358  Ipv4Address groupAddress,
359  bool routeToGwUsers,
360  Ptr<NetDevice>& gwOutputDev);
361 
365  virtual void DoDispose();
366 
372  void EnablePacketTrace();
373 
374  Ptr<PropagationDelayModel> GetPropagationDelayModel(uint32_t satId,
375  uint32_t beamId,
376  SatEnums::ChannelType_t channelType);
377 
379 
380  private:
383 
384  Ptr<SatSuperframeSeq> m_superframeSeq;
385 
386  ObjectFactory m_channelFactory;
387  Ptr<SatOrbiterHelper> m_orbiterHelper;
388  Ptr<SatGwHelper> m_gwHelper;
389  Ptr<SatUtHelper> m_utHelper;
390  Ptr<SatNcc> m_ncc;
391 
392  Ptr<SatAntennaGainPatternContainer> m_antennaGainPatterns;
393 
394  std::map<std::pair<uint32_t, uint32_t>, uint32_t>
395  m_beam; // first pair sat ID / beam ID, second GW ID
396  std::map<uint32_t, Ptr<Node>> m_gwNode; // first GW ID, second node pointer
397  std::multimap<std::pair<uint32_t, uint32_t>, Ptr<Node>>
398  m_utNode; // first pair sat ID / beam ID, second node pointer of the UT
399  Ptr<SatChannelPair> m_ulChannels; // user link ID, channel pointers pair
400  Ptr<SatChannelPair> m_flChannels; // feeder link ID, channel pointers pair
401  std::map<std::pair<uint32_t, uint32_t>, FrequencyPair_t>
402  m_beamFreqs; // first beam ID, channel frequency IDs pair
403 
407  TracedCallback<std::string> m_creationTrace;
408 
414 
419 
424 
429 
434 
438  Ptr<SatMarkovConf> m_markovConf;
439 
446 
452 
457 
462 
467 
472 
478 
485 
490  Ptr<SatBstpController> m_bstpController;
491 
495  Ptr<SatPacketTrace> m_packetTrace;
496 
501 
506  std::string CreateBeamInfo() const;
507 
517  uint32_t beamId,
518  uint32_t fwdFrequencyId,
519  uint32_t rtnFrequencyId,
520  bool isUserLink);
521 
530  bool StoreGwNode(uint32_t id, Ptr<Node> node);
531 
538  Ptr<SatBaseFading> InstallFadingContainer(Ptr<Node> node) const;
539 
548  void AddMulticastRouteToUt(Ptr<Node> utNode,
549  Ipv4Address sourceAddress,
550  Ipv4Address groupAddress,
551  bool routeToSatellite);
552 
557 
561  std::map<uint32_t, Ptr<NetDevice>> m_gwNdMap;
562 
566  std::vector<std::pair<uint32_t, uint32_t>> m_isls;
567 };
568 
569 } // namespace ns3
570 
571 #endif /* SATELLITE_BEAM_HELPER_H */
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 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.
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)
NodeContainer GetUtNodes(uint32_t satId, uint32_t beamId) const
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.
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)
std::pair< uint32_t, uint32_t > GwLink_t
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
virtual ~SatBeamHelper()
Destructor for SatBeamHelper.
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< 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.
RandomAccessModel_t
The defined random access models.
FadingModel_t
Fading models.
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.