satellite-geo-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 SAT_GEO_HELPER_H
24 #define SAT_GEO_HELPER_H
25 
26 #include "ns3/error-model.h"
27 #include "ns3/net-device-container.h"
28 #include "ns3/node-container.h"
29 #include "ns3/object-factory.h"
30 #include "ns3/output-stream-wrapper.h"
31 #include "ns3/satellite-bbframe-conf.h"
32 #include "ns3/satellite-channel.h"
33 #include "ns3/satellite-fwd-link-scheduler.h"
34 #include "ns3/satellite-geo-feeder-mac.h"
35 #include "ns3/satellite-geo-net-device.h"
36 #include "ns3/satellite-phy.h"
37 #include "ns3/satellite-scpc-scheduler.h"
38 #include "ns3/satellite-superframe-sequence.h"
39 #include "ns3/satellite-typedefs.h"
40 #include "ns3/traced-callback.h"
41 
42 #include <string>
43 
44 namespace ns3
45 {
46 
52 class SatGeoHelper : public Object
53 {
54  public:
58  typedef struct
59  {
66 
71  static TypeId GetTypeId(void);
72  TypeId GetInstanceTypeId(void) const;
73 
77  SatGeoHelper();
78 
84  uint32_t rtnLinkCarrierCount,
85  uint32_t fwdLinkCarrierCount,
86  Ptr<SatSuperframeSeq> seq,
89  RandomAccessSettings_s randomAccessSettings);
90 
91  virtual ~SatGeoHelper()
92  {
93  }
94 
95  /*
96  * Initializes the GEO helper based on attributes.
97  * Link results are used only if satellite is regenerative.
98  * \param lrFwd DVB-S2 or DVB-S2X link results
99  * \param lrRcs2 return link results
100  */
101  void Initialize(Ptr<SatLinkResultsFwd> lrFwd, Ptr<SatLinkResultsRtn> lrRcs2);
102 
113  void SetDeviceAttribute(std::string name, const AttributeValue& value);
114 
124  void SetUserPhyAttribute(std::string name, const AttributeValue& value);
125 
135  void SetFeederPhyAttribute(std::string name, const AttributeValue& value);
136 
145  NetDeviceContainer Install(NodeContainer c);
146 
155  Ptr<NetDevice> Install(Ptr<Node> n);
156 
165  Ptr<NetDevice> Install(std::string aName);
166 
167  /*
168  * Attach the SatChannels for the beam to NetDevice
169  * \param dev NetDevice to attach channels
170  * \param fr feeder return channel
171  * \param uf user forward channel
172  * \param uf user return channel
173  * \param userAgp user beam antenna gain pattern
174  * \param feederAgp feeder beam antenna gain pattern
175  * \param satId ID of satellite associated to this channel
176  * \param gwId ID of GW associated to this channel
177  * \param userBeamId Id of the beam
178  * \param forwardLinkRegenerationMode Regeneration mode on forward
179  * \param returnLinkRegenerationMode Regeneration mode on return
180  */
181  void AttachChannels(Ptr<NetDevice> dev,
182  Ptr<SatChannel> ff,
183  Ptr<SatChannel> fr,
184  Ptr<SatChannel> uf,
185  Ptr<SatChannel> ur,
186  Ptr<SatAntennaGainPattern> userAgp,
187  Ptr<SatAntennaGainPattern> feederAgp,
188  uint32_t satId,
189  uint32_t gwId,
190  uint32_t userBeamId,
191  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
192  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
193 
194  /*
195  * Attach the SatChannels for the beam to NetDevice
196  * \param dev NetDevice to attach channels
197  * \param fr feeder forward channel
198  * \param fr feeder return channel
199  * \param feederAgp feeder beam antenna gain pattern
200  * \param satId ID of satellite associated to this channel
201  * \param gwId ID of GW associated to this channel
202  * \param userBeamId Id of the beam
203  * \param forwardLinkRegenerationMode Regeneration mode on forward
204  * \param returnLinkRegenerationMode Regeneration mode on return
205  */
206  void AttachChannelsFeeder(Ptr<SatGeoNetDevice> dev,
207  Ptr<SatChannel> ff,
208  Ptr<SatChannel> fr,
209  Ptr<SatAntennaGainPattern> feederAgp,
210  uint32_t satId,
211  uint32_t gwId,
212  uint32_t userBeamId,
213  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
214  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
215 
216  /*
217  * Attach the SatChannels for the beam to NetDevice
218  * \param dev NetDevice to attach channels
219  * \param uf user forward channel
220  * \param uf user return channel
221  * \param userAgp user beam antenna gain pattern
222  * \param satId ID of satellite associated to this channel
223  * \param userBeamId Id of the beam
224  * \param forwardLinkRegenerationMode Regeneration mode on forward
225  * \param returnLinkRegenerationMode Regeneration mode on return
226  */
227  void AttachChannelsUser(Ptr<SatGeoNetDevice> dev,
228  Ptr<SatChannel> uf,
229  Ptr<SatChannel> ur,
230  Ptr<SatAntennaGainPattern> userAgp,
231  uint32_t satId,
232  uint32_t userBeamId,
233  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
234  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
235 
241  void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
242 
249  void SetIslRoutes(NodeContainer geoNodes, std::vector<std::pair<uint32_t, uint32_t>> isls);
250 
251  private:
255  std::vector<uint32_t> m_nodeIds;
256 
260 
261  // count for devices for each node ID. Currently only one device supported by helper.
262  std::map<uint32_t, uint16_t> m_deviceCount;
263 
264  ObjectFactory m_deviceFactory;
265 
266  /*
267  * Configured forward link interference model for dedicated access
268  */
270 
271  /*
272  * Configured return link interference model for dedicated access
273  */
275 
276  /*
277  * Configured error model for the forward feeder link. Set as an attribute.
278  */
280 
281  /*
282  * Constant error rate for dedicated access in the FWD feeder link.
283  */
285 
286  /*
287  * Configured error model for the return user link. Set as an attribute.
288  */
290 
291  /*
292  * Constant error rate for dedicated access in the RTN user link.
293  */
295 
297 
298  Ptr<SatBbFrameConf> m_bbFrameConfRtn;
299 
301 
302  Ptr<SatBbFrameConf> m_bbFrameConfFwd;
303 
307  TracedCallback<std::string> m_creationTrace;
308 
312  Ptr<SatSuperframeSeq> m_superframeSeq;
313 
318 
323  Ptr<SatLinkResults> m_fwdLinkResults;
324 
329  Ptr<SatLinkResults> m_rtnLinkResults;
330 
334  std::map<std::pair<uint32_t, uint32_t>, Ptr<SatGeoFeederMac>> m_gwMacMap;
335 
340 
345 
350 };
351 
352 } // namespace ns3
353 
354 #endif /* SAT_GEO_HELPER_H */
IslArbiterType_t
Choose the arbiter to use to route packets on ISLs.
RandomAccessModel_t
The defined random access models.
RegenerationMode_t
The regeneration mode used in satellites.
Creates needed objects for Geo Satellite node like SatGeoNetDevice objects.
SatPhy::InterferenceModel m_daFwdLinkInterferenceModel
void SetIslRoutes(NodeContainer geoNodes, std::vector< std::pair< uint32_t, uint32_t >> isls)
Set ISL routes.
std::vector< uint32_t > m_nodeIds
GEO satellites node id.
ObjectFactory m_deviceFactory
SatGeoHelper()
Default constructor.
RandomAccessSettings_s m_raSettings
The used random access model settings.
NetDeviceContainer Install(NodeContainer c)
void AttachChannelsUser(Ptr< SatGeoNetDevice > dev, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, uint32_t satId, uint32_t userBeamId, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
SatPhy::InterferenceModel m_daRtnLinkInterferenceModel
std::map< uint32_t, uint16_t > m_deviceCount
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
SatMac::ReadCtrlMsgCallback m_fwdReadCtrlCb
Control forward link messages callback.
Ptr< SatLinkResults > m_rtnLinkResults
Return channel link results (DVB-RCS2) are created if ErrorModel is configured to be AVI.
SatPhy::ErrorModel m_rtnErrorModel
Ptr< SatSuperframeSeq > m_superframeSeq
Superframe sequence.
void EnableCreationTraces(Ptr< OutputStreamWrapper > stream, CallbackBase &cb)
Enables creation traces to be written in given file.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
Ptr< SatLinkResults > m_fwdLinkResults
Forward channel link results (DVB-S2) are created if ErrorModel is configured to be AVI.
void Initialize(Ptr< SatLinkResultsFwd > lrFwd, Ptr< SatLinkResultsRtn > lrRcs2)
void SetFeederPhyAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Feeder Phy created by the helper.
std::map< std::pair< uint32_t, uint32_t >, Ptr< SatGeoFeederMac > > m_gwMacMap
Map used in regenerative mode to store if MAC already created for a given pair SAT ID / GW ID.
void SetUserPhyAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each User Phy created by the helper.
SatMac::ReadCtrlMsgCallback m_rtnReadCtrlCb
Control return link messages callback.
SatEnums::IslArbiterType_t m_islArbiterType
Arbiter in use to route packets on ISLs.
TracedCallback< std::string > m_creationTrace
Trace callback for creation traces.
void AttachChannelsFeeder(Ptr< SatGeoNetDevice > dev, Ptr< SatChannel > ff, Ptr< SatChannel > fr, Ptr< SatAntennaGainPattern > feederAgp, uint32_t satId, uint32_t gwId, uint32_t userBeamId, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
SatPhy::ErrorModel m_fwdErrorModel
Ptr< SatBbFrameConf > m_bbFrameConfFwd
Ptr< SatBbFrameConf > m_bbFrameConfRtn
void AttachChannels(Ptr< NetDevice > dev, Ptr< SatChannel > ff, Ptr< SatChannel > fr, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, Ptr< SatAntennaGainPattern > feederAgp, uint32_t satId, uint32_t gwId, uint32_t userBeamId, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
TypeId GetInstanceTypeId(void) const
static TypeId GetTypeId(void)
Get the type ID.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
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.
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatPhyRxCarrierConf::InterferenceModel m_raRtnInterferenceModel
SatPhyRxCarrierConf::InterferenceModel m_raFwdInterferenceModel
SatEnums::RandomAccessModel_t m_randomAccessModel