satellite-ncc.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@toulouse.viveris.fr>
21  */
22 
23 #ifndef SAT_NCC_H
24 #define SAT_NCC_H
25 
27 #include "satellite-gw-mac.h"
29 
30 #include <ns3/object.h>
31 #include <ns3/ptr.h>
32 #include <ns3/traced-callback.h>
33 
34 #include <map>
35 #include <stdint.h>
36 #include <tuple>
37 #include <utility>
38 
39 namespace ns3
40 {
41 
42 class Packet;
43 class Address;
44 class SatCrMessage;
45 class SatSuperframeSeq;
46 class SatLowerLayerServiceConf;
47 
56 class SatNcc : public Object
57 {
58  public:
63  static TypeId GetTypeId(void);
64 
69  virtual TypeId GetInstanceTypeId(void) const;
70 
77  SatNcc();
78 
84  ~SatNcc();
85 
100  void UtCnoUpdated(uint32_t satId,
101  uint32_t beamId,
102  Address sourceMac,
103  Address gwId,
104  double cno,
105  bool isSatelliteMac);
106 
115  void DoRandomAccessDynamicLoadControl(uint32_t satId,
116  uint32_t beamId,
117  uint32_t carrierId,
118  uint8_t allocationChannelId,
119  double averageNormalizedOfferedLoad);
120 
132  void UtCrReceived(uint32_t satId, uint32_t beamId, Address utId, Ptr<SatCrMessage> crMsg);
133 
138 
142  typedef Callback<void, Ptr<SatTbtpMessage>> SendTbtpCallback;
143 
158  void AddBeam(uint32_t satId,
159  uint32_t beamId,
160  Ptr<SatNetDevice> gwNetDevice,
161  Ptr<SatOrbiterNetDevice> orbiterNetDevice,
164  Ptr<SatSuperframeSeq> seq,
165  uint32_t maxFrameSizeInBytes,
166  Address satAddress,
167  Address gwAddress);
168 
178  void AddUt(Ptr<SatLowerLayerServiceConf> llsConf,
179  Address utId,
180  uint32_t satId,
181  uint32_t beamId,
182  Callback<void, uint32_t> setRaChannelCallback,
183  bool verifyExisting = false);
184 
191  void RemoveUt(Address utId, uint32_t satId, uint32_t beamId);
192 
198  void SetRandomAccessAverageNormalizedOfferedLoadThreshold(uint8_t allocationChannelId,
199  double threshold);
200 
206  void SetRandomAccessLowLoadBackoffProbability(uint8_t allocationChannelId,
207  uint16_t lowLoadBackOffProbability);
208 
214  void SetRandomAccessHighLoadBackoffProbability(uint8_t allocationChannelId,
215  uint16_t highLoadBackOffProbability);
216 
222  void SetRandomAccessLowLoadBackoffTime(uint8_t allocationChannelId,
223  uint16_t lowLoadBackOffTime);
224 
230  void SetRandomAccessHighLoadBackoffTime(uint8_t allocationChannelId,
231  uint16_t highLoadBackOffTime);
232 
238  Ptr<SatBeamScheduler> GetBeamScheduler(uint32_t satId, uint32_t beamId) const;
239 
249  void MoveUtBetweenBeams(Address utId,
250  uint32_t srcSatId,
251  uint32_t srcBeamId,
252  uint32_t destSatId,
253  uint32_t destBeamId);
254 
261  typedef Callback<void, Address, Address, Address> UpdateRoutingCallback;
262 
268 
269  void ReserveLogonChannel(uint32_t logonChannelId);
270 
277  void ReceiveControlBurst(Address utId, uint32_t satId, uint32_t beamId);
278 
283  void SetUseLogon(bool useLogon);
284 
289  void SetUseLora(bool useLora);
290 
291  private:
293  SatNcc(const SatNcc&);
294 
295  void DoDispose(void);
296 
306  void CreateRandomAccessLoadControlMessage(uint16_t backoffProbability,
307  uint16_t backoffTime,
308  uint32_t satId,
309  uint32_t beamId,
310  uint8_t allocationChannelId);
311 
320  void DoMoveUtBetweenBeams(Address utId,
321  uint32_t srcSatId,
322  uint32_t srcBeamId,
323  uint32_t destSatId,
324  uint32_t destBeamId);
325 
332  void CheckTimeout(Address utId, uint32_t satId, uint32_t beamId);
333 
337  std::map<std::pair<uint32_t, uint32_t>, Ptr<SatBeamScheduler>> m_beamSchedulers;
338 
344  TracedCallback<Ptr<const Packet>> m_nccRxTrace;
345 
351  TracedCallback<Ptr<const Packet>> m_nccTxTrace;
352 
357  std::map<std::tuple<uint32_t, uint32_t, uint8_t>, bool> m_isLowRandomAccessLoad;
358 
363 
367  std::map<uint8_t, uint16_t> m_lowLoadBackOffProbability;
368 
372  std::map<uint8_t, uint16_t> m_highLoadBackOffProbability;
373 
377  std::map<uint8_t, uint16_t> m_lowLoadBackOffTime;
378 
382  std::map<uint8_t, uint16_t> m_highLoadBackOffTime;
383 
388 
393 
398 
402  bool m_useLora;
403 
408  std::map<std::tuple<Address, uint32_t, uint32_t>, Time> m_lastControlBurstReception;
409 
415 };
416 
417 } // namespace ns3
418 
419 #endif /* SAT_NCC_H */
Callback< bool, Ptr< SatControlMessage >, const Address & > SendCtrlMsgCallback
class for module NCC used as shared module among Gateways (GWs).
Definition: satellite-ncc.h:57
void SetUseLora(bool useLora)
Set if SNS-3 is used with Lora standard.
Callback< void, Address, Address, Address > UpdateRoutingCallback
Update routes and ARP tables on gateways after a terminal handover.
std::map< uint8_t, uint16_t > m_lowLoadBackOffProbability
Map for random access allocation channel specific low load backoff probabilities.
SatBeamScheduler::SendCtrlMsgCallback SendCallback
Define type SendCallback.
static TypeId GetTypeId(void)
Get the type ID.
void ReceiveControlBurst(Address utId, uint32_t satId, uint32_t beamId)
Function to call when a control burst has been received.
void ReserveLogonChannel(uint32_t logonChannelId)
void DoDispose(void)
Callback< void, Ptr< SatTbtpMessage > > SendTbtpCallback
void SetUseLogon(bool useLogon)
Set if logon is used in this simulation.
void AddUt(Ptr< SatLowerLayerServiceConf > llsConf, Address utId, uint32_t satId, uint32_t beamId, Callback< void, uint32_t > setRaChannelCallback, bool verifyExisting=false)
Function for adding the UT.
void RemoveUt(Address utId, uint32_t satId, uint32_t beamId)
Remove a UT.
void SetRandomAccessAverageNormalizedOfferedLoadThreshold(uint8_t allocationChannelId, double threshold)
Function for setting the random access allocation channel specific high load backoff probabilities.
void SetUpdateRoutingCallback(SatNcc::UpdateRoutingCallback cb)
Set the callback used to update routes and APR tables after a terminal handover.
std::map< std::pair< uint32_t, uint32_t >, Ptr< SatBeamScheduler > > m_beamSchedulers
The map containing beams in use (set).
SatNcc(const SatNcc &)
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
std::map< std::tuple< uint32_t, uint32_t, uint8_t >, bool > m_isLowRandomAccessLoad
Map for keeping track of the load status of each random access allocation channel Tuple is (satId,...
SatNcc()
Construct a SatNcc.
void MoveUtBetweenBeams(Address utId, uint32_t srcSatId, uint32_t srcBeamId, uint32_t destSatId, uint32_t destBeamId)
Check if a terminal can be moved between two beams.
void AddBeam(uint32_t satId, uint32_t beamId, Ptr< SatNetDevice > gwNetDevice, Ptr< SatOrbiterNetDevice > orbiterNetDevice, SatNcc::SendCallback cb, SatNcc::SendTbtpCallback tbtpCb, Ptr< SatSuperframeSeq > seq, uint32_t maxFrameSizeInBytes, Address satAddress, Address gwAddress)
Function for adding the beam.
Time m_utTimeout
Timeout to logoff a UT, if logon procedure is used.
void SetRandomAccessLowLoadBackoffProbability(uint8_t allocationChannelId, uint16_t lowLoadBackOffProbability)
Function for setting the random access allocation channel specific high load backoff probabilities.
std::map< uint8_t, uint16_t > m_lowLoadBackOffTime
Map for random access allocation channel specific low load backoff time.
std::map< uint8_t, uint16_t > m_highLoadBackOffProbability
Map for random access allocation channel specific high load backoff probabilities.
void DoMoveUtBetweenBeams(Address utId, uint32_t srcSatId, uint32_t srcBeamId, uint32_t destSatId, uint32_t destBeamId)
Perform terminal handover on the terestrial network.
UpdateRoutingCallback m_updateRoutingCallback
Callback to update routing tables and ARP tables on gateways once a handover request has been accepte...
void UtCrReceived(uint32_t satId, uint32_t beamId, Address utId, Ptr< SatCrMessage > crMsg)
Capacity request receiver.
Ptr< SatBeamScheduler > GetBeamScheduler(uint32_t satId, uint32_t beamId) const
std::map< uint8_t, double > m_randomAccessAverageNormalizedOfferedLoadThreshold
Map for random access allocation channel specific load thresholds.
void DoRandomAccessDynamicLoadControl(uint32_t satId, uint32_t beamId, uint32_t carrierId, uint8_t allocationChannelId, double averageNormalizedOfferedLoad)
Function for adjusting the random access allocation channel specific load.
bool m_useLora
Flag indicating if lora standard is used.
SatNcc & operator=(const SatNcc &)
bool m_useLogon
Flag indicating if logon procedure is used.
std::map< std::tuple< Address, uint32_t, uint32_t >, Time > m_lastControlBurstReception
List of reception time for all UTs.
void SetRandomAccessLowLoadBackoffTime(uint8_t allocationChannelId, uint16_t lowLoadBackOffTime)
Function for setting the random access allocation channel specific high load backoff time.
void UtCnoUpdated(uint32_t satId, uint32_t beamId, Address sourceMac, Address gwId, double cno, bool isSatelliteMac)
Update UT specific C/N0 information.
TracedCallback< Ptr< const Packet > > m_nccTxTrace
The trace source fired for TBTPs sent by the NCC.
~SatNcc()
Destroy a SatNcc.
void CreateRandomAccessLoadControlMessage(uint16_t backoffProbability, uint16_t backoffTime, uint32_t satId, uint32_t beamId, uint8_t allocationChannelId)
Function for creating the random access control message.
void CheckTimeout(Address utId, uint32_t satId, uint32_t beamId)
Check if a UT has not been receiving control bursts, and then need to logoff.
Time m_utHandoverDelay
Delay between handover acceptance and effective information transfer.
TracedCallback< Ptr< const Packet > > m_nccRxTrace
The trace source fired for Capacity Requests (CRs) received by the NCC.
std::map< uint8_t, uint16_t > m_highLoadBackOffTime
Map for random access allocation channel specific high load backoff time.
void SetRandomAccessHighLoadBackoffProbability(uint8_t allocationChannelId, uint16_t highLoadBackOffProbability)
Function for setting the random access allocation channel specific high load backoff probabilities.
void SetRandomAccessHighLoadBackoffTime(uint8_t allocationChannelId, uint16_t highLoadBackOffTime)
Function for setting the random access allocation channel specific high load backoff time.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.