25 #include <ns3/double.h>
27 #include <ns3/uinteger.h>
33 NS_LOG_COMPONENT_DEFINE(
"SatRandomAccessConf");
38 NS_OBJECT_ENSURE_REGISTERED(SatRandomAccessConf);
44 TypeId(
"ns3::SatRandomAccessConf")
46 .AddConstructor<SatRandomAccessConf>()
48 "CrdsaSignalingOverheadInBytes",
49 "CRDSA signaling overhead in bytes.",
52 MakeUintegerChecker<uint32_t>())
54 "SlottedAlohaSignalingOverheadInBytes",
55 "Slotted ALOHA signaling overhead in bytes.",
58 MakeUintegerChecker<uint32_t>());
63 : m_slottedAlohaControlRandomizationIntervalInMilliSeconds(),
64 m_allocationChannelCount(),
65 m_crdsaSignalingOverheadInBytes(),
66 m_slottedAlohaSignalingOverheadInBytes()
68 NS_LOG_FUNCTION(
this);
69 NS_FATAL_ERROR(
"SatRandomAccessConf::SatRandomAccessConf - Constructor not in use");
73 Ptr<SatSuperframeSeq> superframeSeq)
74 : m_configurationIdPerAllocationChannel(),
75 m_slottedAlohaControlRandomizationIntervalInMilliSeconds(),
76 m_allocationChannelCount(llsConf->GetRaServiceCount()),
77 m_crdsaSignalingOverheadInBytes(5),
78 m_slottedAlohaSignalingOverheadInBytes(3)
80 NS_LOG_FUNCTION(
this);
85 "SatRandomAccessConf::SatRandomAccessConf - No random access allocation channel");
89 (llsConf->GetDefaultControlRandomizationInterval()).GetMilliSeconds();
94 Ptr<SatRandomAccessAllocationChannel> allocationChannel =
95 CreateObject<SatRandomAccessAllocationChannel>();
98 allocationChannel->SetSlottedAlohaAllowed(llsConf->GetRaIsSlottedAlohaAllowed(i));
99 allocationChannel->SetCrdsaAllowed(llsConf->GetRaIsCrdsaAllowed(i));
100 allocationChannel->SetEssaAllowed(llsConf->GetRaIsEssaAllowed(i));
101 allocationChannel->SetCrdsaMaxUniquePayloadPerBlock(
102 llsConf->GetRaMaximumUniquePayloadPerBlock(i));
103 allocationChannel->SetCrdsaMaxConsecutiveBlocksAccessed(
104 llsConf->GetRaMaximumConsecutiveBlockAccessed(i));
105 allocationChannel->SetCrdsaMinIdleBlocks(llsConf->GetRaMinimumIdleBlock(i));
106 allocationChannel->SetCrdsaNumOfInstances(llsConf->GetRaNumberOfInstances(i));
107 allocationChannel->SetCrdsaBackoffProbability(llsConf->GetRaBackOffProbability(i));
108 allocationChannel->SetCrdsaBackoffTimeInMilliSeconds(
109 llsConf->GetRaBackOffTimeInMilliSeconds(i));
110 allocationChannel->SetFSimBackoffProbability(llsConf->GetRaBackOffProbability(i));
111 allocationChannel->SetFSimBackoffTimeInMilliSeconds(
112 llsConf->GetRaBackOffTimeInMilliSeconds(i));
113 allocationChannel->SetFSimPhysicalLayerFrameInMilliSeconds(
114 (superframeSeq->GetSuperframeConf(0)->GetDuration()).GetMilliSeconds());
117 allocationChannel->SetCrdsaMinRandomizationValue(0);
118 allocationChannel->SetCrdsaMaxRandomizationValue(std::numeric_limits<uint16_t>::max());
122 Ptr<SatSuperframeConf> superframeConf = superframeSeq->GetSuperframeConf(0);
123 for (uint32_t i = 0; i < superframeConf->GetRaChannelCount(); ++i)
125 uint8_t allocationChannel = superframeConf->GetRaChannelAllocationChannelId(i);
127 uint16_t raSlotCount = superframeConf->GetRaSlotCount(i) - 1;
133 if (raSlotCount < allocationChannelConf->GetCrdsaMaxRandomizationValue())
135 allocationChannelConf->SetCrdsaMaxRandomizationValue(raSlotCount);
140 NS_FATAL_ERROR(
"Allocation channel for frame " << superframeConf->GetRaChannelFrameId(i)
141 <<
" is out of range");
147 if (allocationChannelConf.second->GetCrdsaAllowed())
149 allocationChannelConf.second->DoCrdsaVariableSanityCheck();
156 NS_LOG_FUNCTION(
this);
159 Ptr<SatRandomAccessAllocationChannel>
162 NS_LOG_FUNCTION(
this << allocationChannel);
164 std::map<uint32_t, Ptr<SatRandomAccessAllocationChannel>>::iterator iter =
170 "SatRandomAccessConf::GetAllocationChannelConfiguration - Invalid allocation channel");
173 return (iter->second);
179 NS_LOG_FUNCTION(
this);
183 NS_FATAL_ERROR(
"SatRandomAccessConf::DoSlottedAlohaVariableSanityCheck - "
184 "m_slottedAlohaControlRandomizationIntervalInMilliSeconds < 1");
187 NS_LOG_INFO(
"Variable sanity check done");
193 NS_LOG_FUNCTION(
this << allocationChannel);
198 "SatRandomAccessConf::GetAllocationChannelConfigurationId - allocation channel "
199 << allocationChannel <<
" has no associated configuration.");
uint32_t m_allocationChannelCount
Number of available allocation channels.
uint32_t GetAllocationChannelConfigurationId(uint32_t allocationChannel)
Function for retrieving the configuration ID of a given allocation channel.
SatRandomAccessConf()
Constructor.
virtual ~SatRandomAccessConf()
Destructor.
uint32_t m_slottedAlohaControlRandomizationIntervalInMilliSeconds
Slotted ALOHA control randomization interval in milliseconds.
std::vector< uint32_t > m_configurationIdPerAllocationChannel
Mapping between an allocation channel and its associated configuration index.
void DoSlottedAlohaVariableSanityCheck()
Function for checking the Slotted ALOHA variable sanity.
static TypeId GetTypeId(void)
NS-3 type id function.
Ptr< SatRandomAccessAllocationChannel > GetAllocationChannelConfiguration(uint32_t allocationChannel)
Function for returning the allocation channel specific RA configuration.
uint32_t m_crdsaSignalingOverheadInBytes
Defines the size of the CRDSA signaling overhead in bytes.
uint32_t m_slottedAlohaSignalingOverheadInBytes
Defines the size of the Slotted ALOHA signaling overhead in bytes.
std::map< uint32_t, Ptr< SatRandomAccessAllocationChannel > > m_allocationChannelConf
Map containing the allocation channel configurations.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.