25 #include <ns3/double.h>
27 #include <ns3/uinteger.h>
29 NS_LOG_COMPONENT_DEFINE(
"SatRandomAccessConf");
34 NS_OBJECT_ENSURE_REGISTERED(SatRandomAccessConf);
40 TypeId(
"ns3::SatRandomAccessConf")
42 .AddConstructor<SatRandomAccessConf>()
44 "CrdsaSignalingOverheadInBytes",
45 "CRDSA signaling overhead in bytes.",
48 MakeUintegerChecker<uint32_t>())
50 "SlottedAlohaSignalingOverheadInBytes",
51 "Slotted ALOHA signaling overhead in bytes.",
54 MakeUintegerChecker<uint32_t>());
59 : m_slottedAlohaControlRandomizationIntervalInMilliSeconds(),
60 m_allocationChannelCount(),
61 m_crdsaSignalingOverheadInBytes(),
62 m_slottedAlohaSignalingOverheadInBytes()
64 NS_LOG_FUNCTION(
this);
65 NS_FATAL_ERROR(
"SatRandomAccessConf::SatRandomAccessConf - Constructor not in use");
69 Ptr<SatSuperframeSeq> superframeSeq)
70 : m_configurationIdPerAllocationChannel(),
71 m_slottedAlohaControlRandomizationIntervalInMilliSeconds(),
72 m_allocationChannelCount(llsConf->GetRaServiceCount()),
73 m_crdsaSignalingOverheadInBytes(5),
74 m_slottedAlohaSignalingOverheadInBytes(3)
76 NS_LOG_FUNCTION(
this);
81 "SatRandomAccessConf::SatRandomAccessConf - No random access allocation channel");
85 (llsConf->GetDefaultControlRandomizationInterval()).GetMilliSeconds();
90 Ptr<SatRandomAccessAllocationChannel> allocationChannel =
91 CreateObject<SatRandomAccessAllocationChannel>();
94 allocationChannel->SetSlottedAlohaAllowed(llsConf->GetRaIsSlottedAlohaAllowed(i));
95 allocationChannel->SetCrdsaAllowed(llsConf->GetRaIsCrdsaAllowed(i));
96 allocationChannel->SetEssaAllowed(llsConf->GetRaIsEssaAllowed(i));
97 allocationChannel->SetCrdsaMaxUniquePayloadPerBlock(
98 llsConf->GetRaMaximumUniquePayloadPerBlock(i));
99 allocationChannel->SetCrdsaMaxConsecutiveBlocksAccessed(
100 llsConf->GetRaMaximumConsecutiveBlockAccessed(i));
101 allocationChannel->SetCrdsaMinIdleBlocks(llsConf->GetRaMinimumIdleBlock(i));
102 allocationChannel->SetCrdsaNumOfInstances(llsConf->GetRaNumberOfInstances(i));
103 allocationChannel->SetCrdsaBackoffProbability(llsConf->GetRaBackOffProbability(i));
104 allocationChannel->SetCrdsaBackoffTimeInMilliSeconds(
105 llsConf->GetRaBackOffTimeInMilliSeconds(i));
106 allocationChannel->SetFSimBackoffProbability(llsConf->GetRaBackOffProbability(i));
107 allocationChannel->SetFSimBackoffTimeInMilliSeconds(
108 llsConf->GetRaBackOffTimeInMilliSeconds(i));
109 allocationChannel->SetFSimPhysicalLayerFrameInMilliSeconds(
110 (superframeSeq->GetSuperframeConf(0)->GetDuration()).GetMilliSeconds());
113 allocationChannel->SetCrdsaMinRandomizationValue(0);
114 allocationChannel->SetCrdsaMaxRandomizationValue(std::numeric_limits<uint16_t>::max());
118 Ptr<SatSuperframeConf> superframeConf = superframeSeq->GetSuperframeConf(0);
119 for (uint32_t i = 0; i < superframeConf->GetRaChannelCount(); ++i)
121 uint8_t allocationChannel = superframeConf->GetRaChannelAllocationChannelId(i);
123 uint16_t raSlotCount = superframeConf->GetRaSlotCount(i) - 1;
129 if (raSlotCount < allocationChannelConf->GetCrdsaMaxRandomizationValue())
131 allocationChannelConf->SetCrdsaMaxRandomizationValue(raSlotCount);
136 NS_FATAL_ERROR(
"Allocation channel for frame " << superframeConf->GetRaChannelFrameId(i)
137 <<
" is out of range");
143 if (allocationChannelConf.second->GetCrdsaAllowed())
145 allocationChannelConf.second->DoCrdsaVariableSanityCheck();
152 NS_LOG_FUNCTION(
this);
155 Ptr<SatRandomAccessAllocationChannel>
158 NS_LOG_FUNCTION(
this << allocationChannel);
160 std::map<uint32_t, Ptr<SatRandomAccessAllocationChannel>>::iterator iter =
166 "SatRandomAccessConf::GetAllocationChannelConfiguration - Invalid allocation channel");
169 return (iter->second);
175 NS_LOG_FUNCTION(
this);
179 NS_FATAL_ERROR(
"SatRandomAccessConf::DoSlottedAlohaVariableSanityCheck - "
180 "m_slottedAlohaControlRandomizationIntervalInMilliSeconds < 1");
183 NS_LOG_INFO(
"Variable sanity check done");
189 NS_LOG_FUNCTION(
this << allocationChannel);
194 "SatRandomAccessConf::GetAllocationChannelConfigurationId - allocation channel "
195 << 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.