satellite-ut-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_UT_HELPER_H
24 #define SATELLITE_UT_HELPER_H
25 
26 #include <ns3/lorawan-mac-end-device.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-channel.h>
32 #include <ns3/satellite-link-results.h>
33 #include <ns3/satellite-ncc.h>
34 #include <ns3/satellite-phy.h>
35 #include <ns3/satellite-random-access-container-conf.h>
36 #include <ns3/satellite-random-access-container.h>
37 #include <ns3/satellite-superframe-sequence.h>
38 #include <ns3/satellite-typedefs.h>
39 #include <ns3/satellite-ut-mac.h>
40 #include <ns3/traced-callback.h>
41 
42 #include <string>
43 
44 namespace ns3
45 {
46 
52 class SatUtHelper : public Object
53 {
54  public:
58  typedef struct
59  {
65 
69  static TypeId GetTypeId(void);
70 
74  TypeId GetInstanceTypeId(void) const;
75 
79  SatUtHelper();
80 
85  SatUtHelper(SatTypedefs::CarrierBandwidthConverter_t carrierBandwidthConverter,
86  uint32_t rtnLinkCarrierCount,
87  Ptr<SatSuperframeSeq> seq,
91  RandomAccessSettings_s randomAccessSettings);
92 
96  virtual ~SatUtHelper()
97  {
98  }
99 
100  /*
101  * Initializes the UT helper based on attributes
102  * \param lrFwd DVB-S2 or DVB-S2X link results
103  */
104  void Initialize(Ptr<SatLinkResultsFwd> lrFwd);
105 
116  void SetDeviceAttribute(std::string name, const AttributeValue& value);
117 
128  void SetChannelAttribute(std::string name, const AttributeValue& value);
129 
139  void SetPhyAttribute(std::string name, const AttributeValue& value);
140 
161  NetDeviceContainer InstallDvb(NodeContainer c,
162  uint32_t satId,
163  uint32_t beamId,
164  Ptr<SatChannel> fCh,
165  Ptr<SatChannel> rCh,
166  Ptr<SatNetDevice> gwNd,
167  Ptr<SatNcc> ncc,
168  Address satUserAddress,
171  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
172  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
188  Ptr<NetDevice> InstallDvb(Ptr<Node> n,
189  uint32_t satId,
190  uint32_t beamId,
191  Ptr<SatChannel> fCh,
192  Ptr<SatChannel> rCh,
193  Ptr<SatNetDevice> gwNd,
194  Ptr<SatNcc> ncc,
195  Address satUserAddress,
198  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
199  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
200 
221  NetDeviceContainer InstallLora(NodeContainer c,
222  uint32_t satId,
223  uint32_t beamId,
224  Ptr<SatChannel> fCh,
225  Ptr<SatChannel> rCh,
226  Ptr<SatNetDevice> gwNd,
227  Ptr<SatNcc> ncc,
228  Address satUserAddress,
231  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
232  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
248  Ptr<NetDevice> InstallLora(Ptr<Node> n,
249  uint32_t satId,
250  uint32_t beamId,
251  Ptr<SatChannel> fCh,
252  Ptr<SatChannel> rCh,
253  Ptr<SatNetDevice> gwNd,
254  Ptr<SatNcc> ncc,
255  Address satUserAddress,
258  SatEnums::RegenerationMode_t forwardLinkRegenerationMode,
259  SatEnums::RegenerationMode_t returnLinkRegenerationMode);
260 
266  void EnableCreationTraces(Ptr<OutputStreamWrapper> stream, CallbackBase& cb);
267 
268  private:
271  Ptr<SatSuperframeSeq> m_superframeSeq;
272 
273  // Control message container callbacks
277 
278  ObjectFactory m_channelFactory;
279  ObjectFactory m_deviceFactory;
280 
281  /*
282  * Configured dedicated access interference model for the forward link. Set as an attribute.
283  */
285 
286  /*
287  * Configured error model for the forward link. Set as an attribute.
288  */
290 
291  /*
292  * Constant error rate for dedicated access in the FWD link.
293  */
295 
296  /*
297  * Forward channel link results (DVB-S2) are created if ErrorModel
298  * is configured to be AVI. Note, that only one instance of the
299  * link results is needed for all UTs.
300  */
301  Ptr<SatLinkResults> m_linkResults;
302 
306  TracedCallback<std::string> m_creationTrace;
307 
311  Ptr<SatLowerLayerServiceConf> m_llsConf;
312 
318 
325 
326  /*
327  * Asynchronous access on the return channel:
328  * - true -> asynchronous
329  * - false -> synchronous
330  */
332 
337 };
338 
339 } // namespace ns3
340 
341 #endif /* SATELLITE_UT_HELPER_H */
RandomAccessModel_t
The defined random access models.
RegenerationMode_t
The regeneration mode used in satellites.
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.
Callback< SatChannelPair::ChannelPair_t, uint32_t, uint32_t > ChannelPairGetterCallback
Callback for retrieving a pair of SatChannel associated to a beam.
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.
Creates needed objects for UT nodes like SatGeoNetDevice objects.
NetDeviceContainer InstallLora(NodeContainer c, uint32_t satId, uint32_t beamId, Ptr< SatChannel > fCh, Ptr< SatChannel > rCh, Ptr< SatNetDevice > gwNd, Ptr< SatNcc > ncc, Address satUserAddress, SatPhy::ChannelPairGetterCallback cbChannel, SatMac::RoutingUpdateCallback cbRouting, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
void EnableCreationTraces(Ptr< OutputStreamWrapper > stream, CallbackBase &cb)
Enables creation traces to be written in given file.
SatPhy::ErrorModel m_errorModel
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
SatPhy::InterferenceModel m_daInterferenceModel
RandomAccessSettings_s m_raSettings
The used random access model settings.
bool m_enableChannelEstimationError
Enable channel estimation error modeling at forward link receiver (= UT).
SatMac::ReadCtrlMsgCallback m_readCtrlCb
TracedCallback< std::string > m_creationTrace
Trace callback for creation traces.
void SetPhyAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Phy created by the helper.
void Initialize(Ptr< SatLinkResultsFwd > lrFwd)
ObjectFactory m_channelFactory
Ptr< SatLinkResults > m_linkResults
Ptr< SatLowerLayerServiceConf > m_llsConf
Configured lower layer service configuration.
NetDeviceContainer InstallDvb(NodeContainer c, uint32_t satId, uint32_t beamId, Ptr< SatChannel > fCh, Ptr< SatChannel > rCh, Ptr< SatNetDevice > gwNd, Ptr< SatNcc > ncc, Address satUserAddress, SatPhy::ChannelPairGetterCallback cbChannel, SatMac::RoutingUpdateCallback cbRouting, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
SatUtHelper()
Default constructor.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
ObjectFactory m_deviceFactory
bool m_crdsaOnlyForControl
Planned CRDSA usage:
virtual ~SatUtHelper()
Destructor.
SatMac::SendCtrlMsgCallback m_sendCtrlCb
Ptr< SatSuperframeSeq > m_superframeSeq
SatMac::ReserveCtrlMsgCallback m_reserveCtrlCb
static TypeId GetTypeId(void)
Derived from Object.
TypeId GetInstanceTypeId(void) const
Derived from Object.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Define RandomAccessSettings as a struct.
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel