satellite-orbiter-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_ORBITER_HELPER_H
24 #define SAT_ORBITER_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-ncc.h"
35 #include "ns3/satellite-orbiter-feeder-mac.h"
36 #include "ns3/satellite-orbiter-net-device.h"
37 #include "ns3/satellite-phy.h"
38 #include "ns3/satellite-scpc-scheduler.h"
39 #include "ns3/satellite-superframe-sequence.h"
40 #include "ns3/satellite-typedefs.h"
41 #include "ns3/traced-callback.h"
42 
43 #include <map>
44 #include <stdint.h>
45 #include <string>
46 #include <utility>
47 #include <vector>
48 
49 namespace ns3
50 {
51 
57 class SatOrbiterHelper : public Object
58 {
59  public:
63  typedef struct
64  {
71 
76  static TypeId GetTypeId(void);
77  TypeId GetInstanceTypeId(void) const;
78 
83 
89  uint32_t rtnLinkCarrierCount,
90  uint32_t fwdLinkCarrierCount,
91  Ptr<SatSuperframeSeq> seq,
94  RandomAccessSettings_s randomAccessSettings);
95 
97  {
98  }
99 
100  /*
101  * Initializes the orbiter helper based on attributes.
102  * Link results are used only if satellite is regenerative.
103  * \param lrFwd DVB-S2 or DVB-S2X link results
104  * \param lrRcs2 return link results
105  */
106  void Initialize(Ptr<SatLinkResultsFwd> lrFwd, Ptr<SatLinkResultsRtn> lrRcs2);
107 
118  void SetDeviceAttribute(std::string name, const AttributeValue& value);
119 
129  void SetUserPhyAttribute(std::string name, const AttributeValue& value);
130 
140  void SetFeederPhyAttribute(std::string name, const AttributeValue& value);
141 
149  NetDeviceContainer InstallAllOrbiters();
150 
159  Ptr<NetDevice> Install(Ptr<Node> n);
160 
169  Ptr<NetDevice> Install(std::string aName);
170 
176  virtual Ptr<SatOrbiterNetDevice> CreateOrbiterNetDevice() = 0;
177 
178  /*
179  * Attach the SatChannels for the beam to NetDevice
180  * \param dev NetDevice to attach channels
181  * \param fr feeder return channel
182  * \param uf user forward channel
183  * \param uf user return channel
184  * \param userAgp user beam antenna gain pattern
185  * \param feederAgp feeder beam antenna gain pattern
186  * \param ncc NCC (Network Control Center)
187  * \param satId ID of satellite associated to this channel
188  * \param gwId ID of GW associated to this channel
189  * \param userBeamId Id of the user beam
190  */
191  void AttachChannels(Ptr<NetDevice> dev,
192  Ptr<SatChannel> ff,
193  Ptr<SatChannel> fr,
194  Ptr<SatChannel> uf,
195  Ptr<SatChannel> ur,
196  Ptr<SatAntennaGainPattern> userAgp,
197  Ptr<SatAntennaGainPattern> feederAgp,
198  Ptr<SatNcc> ncc,
199  uint32_t satId,
200  uint32_t gwId,
201  uint32_t userBeamId);
202 
203  /*
204  * Attach the SatChannels for the beam to NetDevice
205  * \param dev NetDevice to attach channels
206  * \param fr feeder forward channel
207  * \param fr feeder return channel
208  * \param feederAgp feeder beam antenna gain pattern
209  * \param ncc NCC (Network Control Center)
210  * \param satId ID of satellite associated to this channel
211  * \param gwId ID of GW associated to this channel
212  * \param userBeamId Id of the user beam
213  */
214  void AttachChannelsFeeder(Ptr<SatOrbiterNetDevice> dev,
215  Ptr<SatChannel> ff,
216  Ptr<SatChannel> fr,
217  Ptr<SatAntennaGainPattern> feederAgp,
218  Ptr<SatNcc> ncc,
219  uint32_t satId,
220  uint32_t gwId,
221  uint32_t userBeamId);
222 
223  /*
224  * Attach the SatChannels for the beam to NetDevice
225  * \param dev NetDevice to attach channels
226  * \param uf user forward channel
227  * \param uf user return channel
228  * \param userAgp user beam antenna gain pattern
229  * \param ncc NCC (Network Control Center)
230  * \param satId ID of satellite associated to this channel
231  * \param userBeamId Id of the beam
232  */
233  virtual void AttachChannelsUser(Ptr<SatOrbiterNetDevice> dev,
234  Ptr<SatChannel> uf,
235  Ptr<SatChannel> ur,
236  Ptr<SatAntennaGainPattern> userAgp,
237  Ptr<SatNcc> ncc,
238  uint32_t satId,
239  uint32_t userBeamId) = 0;
240 
246  void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
247 
253  void SetIslRoutes(std::vector<std::pair<uint32_t, uint32_t>> isls);
254 
255  protected:
259  std::vector<uint32_t> m_nodeIds;
260 
264 
265  // count for devices for each node ID. Currently only one device supported by helper.
266  std::map<uint32_t, uint16_t> m_deviceCount;
267 
268  ObjectFactory m_deviceFactory;
269 
270  /*
271  * Configured forward link interference model for dedicated access
272  */
274 
275  /*
276  * Configured return link interference model for dedicated access
277  */
279 
280  /*
281  * Configured error model for the forward feeder link. Set as an attribute.
282  */
284 
285  /*
286  * Constant error rate for dedicated access in the FWD feeder link.
287  */
289 
290  /*
291  * Configured error model for the return user link. Set as an attribute.
292  */
294 
295  /*
296  * Constant error rate for dedicated access in the RTN user link.
297  */
299 
301 
302  Ptr<SatBbFrameConf> m_bbFrameConfRtn;
303 
305 
306  Ptr<SatBbFrameConf> m_bbFrameConfFwd;
307 
311  TracedCallback<std::string> m_creationTrace;
312 
316  Ptr<SatSuperframeSeq> m_superframeSeq;
317 
322 
327  Ptr<SatLinkResults> m_fwdLinkResults;
328 
333  Ptr<SatLinkResults> m_rtnLinkResults;
334 
338  std::map<std::pair<uint32_t, uint32_t>, Ptr<SatOrbiterFeederMac>> m_gwMacMap;
339 
344 
349 
354 };
355 
356 } // namespace ns3
357 
358 #endif /* SAT_ORBITER_HELPER_H */
IslArbiterType_t
Choose the arbiter to use to route packets on ISLs.
RandomAccessModel_t
The defined random access models.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
Creates needed objects for Satellite node like SatorbiterNetDevice objects.
Ptr< SatLinkResults > m_rtnLinkResults
Return channel link results (DVB-RCS2) are created if ErrorModel is configured to be AVI.
SatPhy::InterferenceModel m_daFwdLinkInterferenceModel
SatMac::ReadCtrlMsgCallback m_fwdReadCtrlCb
Control forward link messages callback.
SatEnums::IslArbiterType_t m_islArbiterType
Arbiter in use to route packets on ISLs.
virtual void AttachChannelsUser(Ptr< SatOrbiterNetDevice > dev, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, Ptr< SatNcc > ncc, uint32_t satId, uint32_t userBeamId)=0
void Initialize(Ptr< SatLinkResultsFwd > lrFwd, Ptr< SatLinkResultsRtn > lrRcs2)
std::map< std::pair< uint32_t, uint32_t >, Ptr< SatOrbiterFeederMac > > m_gwMacMap
Map used in regenerative mode to store if MAC already created for a given pair SAT ID / GW ID.
void SetFeederPhyAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Feeder Phy created by the helper.
void SetUserPhyAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each User Phy created by the helper.
TypeId GetInstanceTypeId(void) const
RandomAccessSettings_s m_raSettings
The used random access model settings.
std::vector< uint32_t > m_nodeIds
Satellites node id.
SatPhy::ErrorModel m_rtnErrorModel
NetDeviceContainer InstallAllOrbiters()
This method creates a ns3::SatOrbiterNetDevices with the requested attributes and associate the resul...
Ptr< SatBbFrameConf > m_bbFrameConfFwd
void AttachChannelsFeeder(Ptr< SatOrbiterNetDevice > dev, Ptr< SatChannel > ff, Ptr< SatChannel > fr, Ptr< SatAntennaGainPattern > feederAgp, Ptr< SatNcc > ncc, uint32_t satId, uint32_t gwId, uint32_t userBeamId)
TracedCallback< std::string > m_creationTrace
Trace callback for creation traces.
Ptr< SatLinkResults > m_fwdLinkResults
Forward channel link results (DVB-S2) are created if ErrorModel is configured to be AVI.
Ptr< SatSuperframeSeq > m_superframeSeq
Superframe sequence.
SatPhy::InterferenceModel m_daRtnLinkInterferenceModel
virtual Ptr< SatOrbiterNetDevice > CreateOrbiterNetDevice()=0
Create a SatOrbiterNetDevice instance, with correct type infered from child classes.
SatPhy::ErrorModel m_fwdErrorModel
void AttachChannels(Ptr< NetDevice > dev, Ptr< SatChannel > ff, Ptr< SatChannel > fr, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, Ptr< SatAntennaGainPattern > feederAgp, Ptr< SatNcc > ncc, uint32_t satId, uint32_t gwId, uint32_t userBeamId)
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
void SetIslRoutes(std::vector< std::pair< uint32_t, uint32_t >> isls)
Set ISL routes.
void EnableCreationTraces(Ptr< OutputStreamWrapper > stream, CallbackBase &cb)
Enables creation traces to be written in given file.
Ptr< SatBbFrameConf > m_bbFrameConfRtn
SatOrbiterHelper()
Default constructor.
Ptr< NetDevice > Install(Ptr< Node > n)
SatMac::ReadCtrlMsgCallback m_rtnReadCtrlCb
Control return link messages callback.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
static TypeId GetTypeId(void)
Get the type ID.
std::map< uint32_t, uint16_t > m_deviceCount
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::InterferenceModel m_raFwdInterferenceModel
SatPhyRxCarrierConf::InterferenceModel m_raRtnInterferenceModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel