Loading...
Searching...
No Matches
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
39namespace ns3
40{
41
42class Packet;
43class Address;
44class SatCrMessage;
47
56class SatNcc : public Object
57{
58 public:
63 static TypeId GetTypeId(void);
64
71 SatNcc();
72
78 ~SatNcc();
79
94 void UtCnoUpdated(uint32_t satId,
95 uint32_t beamId,
96 Address sourceMac,
97 Address gwId,
98 double cno,
99 bool isSatelliteMac);
100
109 void DoRandomAccessDynamicLoadControl(uint32_t satId,
110 uint32_t beamId,
111 uint32_t carrierId,
112 uint8_t allocationChannelId,
113 double averageNormalizedOfferedLoad);
114
126 void UtCrReceived(uint32_t satId, uint32_t beamId, Address utId, Ptr<SatCrMessage> crMsg);
127
132
136 typedef Callback<void, Ptr<SatTbtpMessage>> SendTbtpCallback;
137
152 void AddBeam(uint32_t satId,
153 uint32_t beamId,
154 Ptr<SatNetDevice> gwNetDevice,
155 Ptr<SatOrbiterNetDevice> orbiterNetDevice,
158 Ptr<SatSuperframeSeq> seq,
159 uint32_t maxFrameSizeInBytes,
160 Address satAddress,
161 Address gwAddress);
162
172 void AddUt(Ptr<SatLowerLayerServiceConf> llsConf,
173 Address utId,
174 uint32_t satId,
175 uint32_t beamId,
176 Callback<void, uint32_t> setRaChannelCallback,
177 bool verifyExisting = false);
178
185 void RemoveUt(Address utId, uint32_t satId, uint32_t beamId);
186
192 void SetRandomAccessAverageNormalizedOfferedLoadThreshold(uint8_t allocationChannelId,
193 double threshold);
194
200 void SetRandomAccessLowLoadBackoffProbability(uint8_t allocationChannelId,
201 uint16_t lowLoadBackOffProbability);
202
208 void SetRandomAccessHighLoadBackoffProbability(uint8_t allocationChannelId,
209 uint16_t highLoadBackOffProbability);
210
216 void SetRandomAccessLowLoadBackoffTime(uint8_t allocationChannelId,
217 uint16_t lowLoadBackOffTime);
218
224 void SetRandomAccessHighLoadBackoffTime(uint8_t allocationChannelId,
225 uint16_t highLoadBackOffTime);
226
232 Ptr<SatBeamScheduler> GetBeamScheduler(uint32_t satId, uint32_t beamId) const;
233
243 void MoveUtBetweenBeams(Address utId,
244 uint32_t srcSatId,
245 uint32_t srcBeamId,
246 uint32_t destSatId,
247 uint32_t destBeamId);
248
255 typedef Callback<void, Address, Address, Address> UpdateRoutingCallback;
256
262
263 void ReserveLogonChannel(uint32_t logonChannelId);
264
271 void ReceiveControlBurst(Address utId, uint32_t satId, uint32_t beamId);
272
277 void SetUseLogon(bool useLogon);
278
283 void SetUseLora(bool useLora);
284
285 private:
287 SatNcc(const SatNcc&);
288
289 void DoDispose(void);
290
300 void CreateRandomAccessLoadControlMessage(uint16_t backoffProbability,
301 uint16_t backoffTime,
302 uint32_t satId,
303 uint32_t beamId,
304 uint8_t allocationChannelId);
305
314 void DoMoveUtBetweenBeams(Address utId,
315 uint32_t srcSatId,
316 uint32_t srcBeamId,
317 uint32_t destSatId,
318 uint32_t destBeamId);
319
326 void CheckTimeout(Address utId, uint32_t satId, uint32_t beamId);
327
331 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatBeamScheduler>> m_beamSchedulers;
332
338 TracedCallback<Ptr<const Packet>> m_nccRxTrace;
339
345 TracedCallback<Ptr<const Packet>> m_nccTxTrace;
346
351 std::map<std::tuple<uint32_t, uint32_t, uint8_t>, bool> m_isLowRandomAccessLoad;
352
357
361 std::map<uint8_t, uint16_t> m_lowLoadBackOffProbability;
362
366 std::map<uint8_t, uint16_t> m_highLoadBackOffProbability;
367
371 std::map<uint8_t, uint16_t> m_lowLoadBackOffTime;
372
376 std::map<uint8_t, uint16_t> m_highLoadBackOffTime;
377
382
387
392
397
402 std::map<std::tuple<Address, uint32_t, uint32_t>, Time> m_lastControlBurstReception;
403
409};
410
411} // namespace ns3
412
413#endif /* SAT_NCC_H */
Callback< bool, Ptr< SatControlMessage >, const Address & > SendCtrlMsgCallback
The packet for the Capacity Request (CR) messages.
The SatLowerLayerServiceConf class holds information of all configures lower layer service entries.
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 &)
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.
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.
SatNcc & operator=(const SatNcc &)
This class implements super frame sequence.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.