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 
28 #include <ns3/object.h>
29 #include <ns3/ptr.h>
30 #include <ns3/traced-callback.h>
31 
32 #include <map>
33 #include <utility>
34 
35 namespace ns3
36 {
37 
38 class Packet;
39 class Address;
40 class SatCrMessage;
41 class SatSuperframeSeq;
42 class SatLowerLayerServiceConf;
43 
52 class SatNcc : public Object
53 {
54  public:
59  static TypeId GetTypeId(void);
60 
65  virtual TypeId GetInstanceTypeId(void) const;
66 
73  SatNcc();
74 
80  ~SatNcc();
81 
96  void UtCnoUpdated(uint32_t satId,
97  uint32_t beamId,
98  Address sourceMac,
99  Address gwId,
100  double cno,
101  bool isSatelliteMac);
102 
111  void DoRandomAccessDynamicLoadControl(uint32_t satId,
112  uint32_t beamId,
113  uint32_t carrierId,
114  uint8_t allocationChannelId,
115  double averageNormalizedOfferedLoad);
116 
128  void UtCrReceived(uint32_t satId, uint32_t beamId, Address utId, Ptr<SatCrMessage> crMsg);
129 
134 
138  typedef Callback<void, Ptr<SatTbtpMessage>> SendTbtpCallback;
139 
151  void AddBeam(uint32_t satId,
152  uint32_t beamId,
155  Ptr<SatSuperframeSeq> seq,
156  uint32_t maxFrameSizeInBytes,
157  Address gwAddress);
158 
168  void AddUt(Ptr<SatLowerLayerServiceConf> llsConf,
169  Address utId,
170  uint32_t satId,
171  uint32_t beamId,
172  Callback<void, uint32_t> setRaChannelCallback,
173  bool verifyExisting = false);
174 
181  void RemoveUt(Address utId, uint32_t satId, uint32_t beamId);
182 
188  void SetRandomAccessAverageNormalizedOfferedLoadThreshold(uint8_t allocationChannelId,
189  double threshold);
190 
196  void SetRandomAccessLowLoadBackoffProbability(uint8_t allocationChannelId,
197  uint16_t lowLoadBackOffProbability);
198 
204  void SetRandomAccessHighLoadBackoffProbability(uint8_t allocationChannelId,
205  uint16_t highLoadBackOffProbability);
206 
212  void SetRandomAccessLowLoadBackoffTime(uint8_t allocationChannelId,
213  uint16_t lowLoadBackOffTime);
214 
220  void SetRandomAccessHighLoadBackoffTime(uint8_t allocationChannelId,
221  uint16_t highLoadBackOffTime);
222 
228  Ptr<SatBeamScheduler> GetBeamScheduler(uint32_t satId, uint32_t beamId) const;
229 
238  void MoveUtBetweenBeams(Address utId, uint32_t satId, uint32_t srcBeamId, uint32_t destBeamId);
239 
246  typedef Callback<void, Address, Address, Address> UpdateRoutingCallback;
247 
253 
254  void ReserveLogonChannel(uint32_t logonChannelId);
255 
262  void ReceiveControlBurst(Address utId, uint32_t satId, uint32_t beamId);
263 
268  void SetUseLogon(bool useLogon);
269 
274  void SetUseLora(bool useLora);
275 
276  private:
278  SatNcc(const SatNcc&);
279 
280  void DoDispose(void);
281 
291  void CreateRandomAccessLoadControlMessage(uint16_t backoffProbability,
292  uint16_t backoffTime,
293  uint32_t satId,
294  uint32_t beamId,
295  uint8_t allocationChannelId);
296 
304  void DoMoveUtBetweenBeams(Address utId,
305  uint32_t satId,
306  uint32_t srcBeamId,
307  uint32_t destBeamId);
308 
315  void CheckTimeout(Address utId, uint32_t satId, uint32_t beamId);
316 
320  std::map<std::pair<uint32_t, uint32_t>, Ptr<SatBeamScheduler>> m_beamSchedulers;
321 
327  TracedCallback<Ptr<const Packet>> m_nccRxTrace;
328 
334  TracedCallback<Ptr<const Packet>> m_nccTxTrace;
335 
340  std::map<std::tuple<uint32_t, uint32_t, uint8_t>, bool> m_isLowRandomAccessLoad;
341 
346 
350  std::map<uint8_t, uint16_t> m_lowLoadBackOffProbability;
351 
355  std::map<uint8_t, uint16_t> m_highLoadBackOffProbability;
356 
360  std::map<uint8_t, uint16_t> m_lowLoadBackOffTime;
361 
365  std::map<uint8_t, uint16_t> m_highLoadBackOffTime;
366 
371 
376 
381 
385  bool m_useLora;
386 
391  std::map<std::tuple<Address, uint32_t, uint32_t>, Time> m_lastControlBurstReception;
392 
398 };
399 
400 } // namespace ns3
401 
402 #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:53
void SetUseLora(bool useLora)
Set if SNS-3 is used with Lora standard.
void DoMoveUtBetweenBeams(Address utId, uint32_t satId, uint32_t srcBeamId, uint32_t destBeamId)
Perform terminal handover on the terestrial network.
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.
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.
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 MoveUtBetweenBeams(Address utId, uint32_t satId, uint32_t srcBeamId, uint32_t destBeamId)
Check if a terminal can be moved between two beams.
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.
void AddBeam(uint32_t satId, uint32_t beamId, SatNcc::SendCallback cb, SatNcc::SendTbtpCallback tbtpCb, Ptr< SatSuperframeSeq > seq, uint32_t maxFrameSizeInBytes, Address gwAddress)
Function for adding the beam.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.