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 NS_LOG_COMPONENT_DEFINE("SatRandomAccessAllocationChannel");
28 
29 namespace ns3
30 {
31 
32 NS_OBJECT_ENSURE_REGISTERED(SatRandomAccessAllocationChannel);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::SatRandomAccessAllocationChannel")
38  .SetParent<Object>()
39  .AddConstructor<SatRandomAccessAllocationChannel>();
40  return tid;
41 }
42 
44  : m_slottedAlohaAllowed(false),
45  m_crdsaAllowed(false),
46  m_essaAllowed(false),
47  m_crdsaMinRandomizationValue(),
48  m_crdsaMaxRandomizationValue(),
49  m_crdsaNumOfInstances(),
50  m_crdsaMinIdleBlocks(),
51  m_crdsaIdleBlocksLeft(0),
52  m_crdsaBackoffTimeInMilliSeconds(),
53  m_crdsaBackoffProbability(),
54  m_crdsaMaxUniquePayloadPerBlock(),
55  m_crdsaMaxConsecutiveBlocksAccessed(),
56  m_crdsaNumOfConsecutiveBlocksUsed(0),
57  m_crdsaBackoffReleaseTime(0),
58  m_fSimBackoffTimeInMilliSeconds(),
59  m_fSimBackoffProbability(),
60  m_fSimPhysicalLayerFrameInMilliSeconds()
61 {
62  NS_LOG_FUNCTION(this);
63 }
64 
66 {
67  NS_LOG_FUNCTION(this);
68 }
69 
70 void
72 {
73  NS_LOG_FUNCTION(this);
74 
75  if (!m_crdsaAllowed)
76  {
77  NS_LOG_INFO("CRDSA disallowed: skipping sanity check");
78  return;
79  }
80 
82  {
83  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - max < 1");
84  }
85 
87  {
88  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - min > max");
89  }
90 
91  if (m_crdsaNumOfInstances < 1)
92  {
93  NS_FATAL_ERROR(
94  "SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - instances < 1");
95  }
96 
98  {
99  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::DoCrdsaVariableSanityCheck - (max - min) "
100  "< instances");
101  }
102 
103  if (m_crdsaBackoffProbability < 0.0 || m_crdsaBackoffProbability > 1.0)
104  {
105  NS_FATAL_ERROR("SatRandomAccessAllocationChannel::CrdsaDoVariableSanityCheck - "
106  "m_crdsaBackoffProbability < 0.0 || m_crdsaBackoffProbability > 1.0");
107  }
108 
109  NS_LOG_INFO("Variable sanity check done");
110 }
111 
112 } // 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.