satellite-random-access-allocation-channel.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 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: Frans Laakso <frans.laakso@magister.fi>
20  * Author: Mathias Ettinger <mettinger@toulouse.viveris.fr>
21  */
22 
24 
25 #include <ns3/log.h>
26 
27 #include <stdint.h>
28 
29 NS_LOG_COMPONENT_DEFINE("SatRandomAccessAllocationChannel");
30 
31 namespace ns3
32 {
33 
34 NS_OBJECT_ENSURE_REGISTERED(SatRandomAccessAllocationChannel);
35 
36 TypeId
38 {
39  static TypeId tid = TypeId("ns3::SatRandomAccessAllocationChannel")
40  .SetParent<Object>()
41  .AddConstructor<SatRandomAccessAllocationChannel>();
42  return tid;
43 }
44 
46  : m_slottedAlohaAllowed(false),
47  m_crdsaAllowed(false),
48  m_essaAllowed(false),
49  m_crdsaMinRandomizationValue(),
50  m_crdsaMaxRandomizationValue(),
51  m_crdsaNumOfInstances(),
52  m_crdsaMinIdleBlocks(),
53  m_crdsaIdleBlocksLeft(0),
54  m_crdsaBackoffTimeInMilliSeconds(),
55  m_crdsaBackoffProbability(),
56  m_crdsaMaxUniquePayloadPerBlock(),
57  m_crdsaMaxConsecutiveBlocksAccessed(),
58  m_crdsaNumOfConsecutiveBlocksUsed(0),
59  m_crdsaBackoffReleaseTime(0),
60  m_fSimBackoffTimeInMilliSeconds(),
61  m_fSimBackoffProbability(),
62  m_fSimPhysicalLayerFrameInMilliSeconds()
63 {
64  NS_LOG_FUNCTION(this);
65 }
66 
68 {
69  NS_LOG_FUNCTION(this);
70 }
71 
72 void
74 {
75  NS_LOG_FUNCTION(this);
76 
77  if (!m_crdsaAllowed)
78  {
79  NS_LOG_INFO("CRDSA disallowed: skipping sanity check");
80  return;
81  }
82 
84  {
85  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - max < 1");
86  }
87 
89  {
90  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - min > max");
91  }
92 
93  if (m_crdsaNumOfInstances < 1)
94  {
95  NS_FATAL_ERROR(
96  "SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - instances < 1");
97  }
98 
100  {
101  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - (max - min) "
102  "< instances");
103  }
104 
105  if (m_crdsaBackoffProbability < 0.0 || m_crdsaBackoffProbability > 1.0)
106  {
107  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::CrdsaDoVariableSanityCheck - "
108  "m_crdsaBackoffProbability < 0.0 || m_crdsaBackoffProbability > 1.0");
109  }
110 
111  NS_LOG_INFO("Variable sanity check done");
112 }
113 
114 } // namespace ns3
uint32_t m_crdsaNumOfInstances
CRDSA number of packet instances (replicas)
void DoCrdsaVariableSanityCheck()
Function for checking the CRDSA parameter sanity.
uint32_t m_crdsaMinRandomizationValue
CRDSA minimum randomization value.
uint32_t m_crdsaMaxRandomizationValue
CRDSA maximum randomization value.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.