25#include "ns3/boolean.h"
26#include "ns3/double.h"
35NS_LOG_COMPONENT_DEFINE(
"SatFrameAllocator");
49 NS_LOG_FUNCTION(
this);
59 NS_LOG_FUNCTION(
this << (uint32_t)countOfRcs);
65 Ptr<SatWaveform> trcWaveForm,
67 double ctrlSlotLength)
74 NS_LOG_FUNCTION(
this << ctrlSlotPresent << ctrlSlotLength);
76 for (SatFrameAllocReqItemContainer_t::const_iterator it = req.begin(); it != req.end(); it++)
80 reqInSymbols.
m_craSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_craBytes /
81 trcWaveForm->GetPayloadInBytes();
83 it->m_minRbdcBytes / trcWaveForm->GetPayloadInBytes();
84 reqInSymbols.
m_rbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_rbdcBytes /
85 trcWaveForm->GetPayloadInBytes();
86 reqInSymbols.
m_vbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_vbdcBytes /
87 trcWaveForm->GetPayloadInBytes();
108 NS_LOG_FUNCTION(
this);
117 for (SatFrameAllocInfoItemContainer_t::const_iterator it =
m_allocInfoPerRc.begin();
159 .m_request.m_allocInfoPerRc[rcAlloc1.second]
161 .m_request.m_allocInfoPerRc[rcAlloc2.second]
167 .m_request.m_allocInfoPerRc[rcAlloc1.second]
169 .m_request.m_allocInfoPerRc[rcAlloc2.second]
175 .m_request.m_allocInfoPerRc[rcAlloc1.second]
177 .m_request.m_allocInfoPerRc[rcAlloc2.second]
182 NS_FATAL_ERROR(
"Invalid CC type!!!");
191 const Ptr<SatFrameAllocator>& b)
const
193 double bandwidthA = a->m_frameConf->GetBandwidthHz();
194 double bandwidthB = b->m_frameConf->GetBandwidthHz();
196 if (bandwidthA == bandwidthB)
200 return bandwidthA > bandwidthB;
221 NS_LOG_FUNCTION(
this);
222 NS_FATAL_ERROR(
"Default constructor not supported!!!");
228 Ptr<SatFrameAllocator> parent)
237 NS_LOG_FUNCTION(
this << (uint32_t)frameId);
260 uint32_t mostRobustWaveformId = 0;
269 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
276 if (frameConf->GetWaveformConf()->IsAcmEnabled())
278 m_burstLenghts = frameConf->GetWaveformConf()->GetSupportedBurstLengths();
285 uint32_t mostRobustWaveformId = 0;
294 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
300 NS_FATAL_ERROR(
"Not supported configuration type");
310 NS_LOG_FUNCTION(
this);
328 NS_LOG_FUNCTION(
this << count << offset);
330 uint16_t total = count + offset;
333 NS_FATAL_ERROR(
"SatFrameAllocator::SetCarrierCount: Amount of carriers in use is greater "
334 "than the amount of carriers in frame.");
354 NS_LOG_INFO(
"Frame " << (uint32_t)
m_frameId <<
" selected " << count
355 <<
" carriers from carrier ID " << offset);
361 NS_LOG_FUNCTION(
this << ccLevel);
385 NS_FATAL_ERROR(
"Not supported CC level!!!");
395 NS_LOG_FUNCTION(
this << cno << waveFormId);
397 bool cnoSupported =
false;
426 NS_FATAL_ERROR(
"Not supported configuration type");
436 NS_LOG_FUNCTION(
this << ccLevel << waveFormId);
438 bool allocated =
false;
450 NS_FATAL_ERROR(
"Min RBDC bytes is greater than RBDC bytes!!!");
465 std::min<double>(reqInSymbols.
m_rbdcSymbols, symbolsLeftInCarrier);
474 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
481 NS_FATAL_ERROR(
"CRA symbols exceeds carrier limit!!!");
489 double symbolsLeftInFrame =
511 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
520 double symbolsLeftInFrame =
526 double symbolsLeftInCarrier =
533 std::min<double>(reqInSymbols.
m_vbdcSymbols, symbolsLeftInCarrier);
559 NS_FATAL_ERROR(
"Not supported CC level!!!");
576 NS_LOG_FUNCTION(
this << targetLoad << fcaEnabled);
580 if ((targetLoad >= 0) && (targetLoad <= 1))
587 NS_FATAL_ERROR(
"target load must be between 0 and 1.");
596 uint32_t maxSizeInBytes,
598 bool rcBasedAllocationEnabled,
599 TracedCallback<uint32_t> waveformTrace,
600 TracedCallback<uint32_t, uint32_t> utLoadTrace,
601 TracedCallback<uint32_t, double> loadTrace)
603 NS_LOG_FUNCTION(
this);
606 uint32_t timeslotCount = 0;
608 if (tbtpContainer.empty())
610 NS_FATAL_ERROR(
"TBTP container must contain at least one message.");
613 Ptr<SatTbtpMessage> tbtpToFill = tbtpContainer.back();
616 std::vector<Address> uts =
SortUts();
623 std::vector<uint16_t>::const_iterator currentCarrier = carriers.begin();
625 uint32_t utCount = 0;
626 uint32_t symbolsAllocated = 0;
628 for (std::vector<Address>::iterator it = uts.begin();
629 (it != uts.end()) && (currentCarrier != carriers.end());
633 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes() +
634 tbtpToFill->GetFrameInfoSize()) > maxSizeInBytes)
640 std::vector<uint32_t> rcIndices =
SortUtRcs(*it);
641 std::vector<uint32_t>::const_iterator currentRcIndex = rcIndices.begin();
643 int64_t rcSymbolsLeft =
644 m_utAllocs[*it].m_allocation.m_allocInfoPerRc[*currentRcIndex].GetTotalSymbols();
648 int64_t utSymbolsLeft =
m_utAllocs[*it].m_allocation.GetTotalSymbols();
651 bool waveformIdTraced =
false;
653 while (utSymbolsLeft > 0)
655 Ptr<SatTimeSlotConf> timeSlot =
nullptr;
659 if ((currentRcIndex == rcIndices.begin()) &&
660 m_utAllocs[*it].m_request.m_ctrlSlotPresent &&
661 (
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent ==
false))
668 rcBasedAllocationEnabled);
675 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
true;
685 rcBasedAllocationEnabled);
696 rcBasedAllocationEnabled);
703 if (!waveformIdTraced)
705 waveformIdTraced =
true;
706 waveformTrace(timeSlot->GetWaveFormId());
710 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes()) >
716 timeSlot->SetRcIndex(*currentRcIndex);
724 tbtpToFill->SetDaTimeslot(Mac48Address::ConvertFrom(*it),
m_frameId, timeSlot);
728 Ptr<SatWaveform> waveform =
m_waveformConf->GetWaveform(timeSlot->GetWaveFormId());
730 UtAllocInfoContainer_t::iterator utAlloc =
GetUtAllocItem(utAllocContainer, *it);
731 utAlloc->second.first.at(*currentRcIndex) += waveform->GetPayloadInBytes();
732 utAlloc->second.second |=
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent;
734 symbolsAllocated += waveform->GetBurstLengthInSymbols();
738 if (carrierSymbolsToUse <= 0)
743 if (currentCarrier == carriers.end())
751 if (rcSymbolsLeft <= 0)
755 if (currentRcIndex == rcIndices.end())
763 .m_allocation.m_allocInfoPerRc[*currentRcIndex]
770 if ((utSymbolsToUse <= 0) || (currentCarrier == carriers.end()))
776 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
false;
780 utLoadTrace((uint32_t)
m_frameId, utCount);
789 NS_LOG_FUNCTION(
this);
813 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
814 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
817 double freeUtSymbols =
818 std::max<double>(0.0,
820 m_utAllocs.at(it->first).m_allocation.GetTotalSymbols());
821 double symbolsToAdd =
822 std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
825 if ((
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols >
827 (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols >
831 .m_allocation.m_allocInfoPerRc[it->second]
832 .m_vbdcSymbols += symbolsToAdd;
833 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
834 vbdcSymbolsLeft -= symbolsToAdd;
846 double vbdcSymbolsLeft =
859 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
860 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
863 double freeUtSymbols = std::max<double>(
866 double symbolsToAdd = std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
869 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols > 0)
871 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_vbdcSymbols =
873 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
874 vbdcSymbolsLeft -= symbolsToAdd;
885 double rbdcSymbolsLeft =
900 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
901 it !=
m_rcAllocs.end() && (rbdcSymbolsLeft > 0);
904 double freeUtSymbols = std::max<double>(
907 double symbolsToAdd = std::min<double>(freeUtSymbols, (rbdcSymbolsLeft / rcAllocsLeft));
910 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
912 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
914 .m_allocation.m_allocInfoPerRc[it->second]
916 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols +=
918 .m_allocation.m_allocInfoPerRc[it->second]
920 rbdcSymbolsLeft -= symbolsToAdd;
946 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
947 it !=
m_rcAllocs.end() && (minRbdcSymbolsLeft > 0);
950 double freeUtSymbols = std::max<double>(
953 double symbolsToAdd =
954 std::min<double>(freeUtSymbols, (minRbdcSymbolsLeft / rcAllocsLeft));
957 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
960 .m_allocation.m_allocInfoPerRc[it->second]
961 .m_minRbdcSymbols = symbolsToAdd;
962 m_utAllocs.at(it->first).m_allocation.m_minRbdcSymbols += symbolsToAdd;
964 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
966 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols += symbolsToAdd;
968 minRbdcSymbolsLeft -= symbolsToAdd;
976 NS_FATAL_ERROR(
"CRAs don't fit to frame CAC or configuration error???");
982 int64_t& utSymbolsToUse,
983 int64_t& carrierSymbolsToUse,
984 int64_t& utSymbolsLeft,
985 int64_t& rcSymbolsLeft,
987 bool rcBasedAllocationEnabled)
989 NS_LOG_FUNCTION(
this << carrierId << cno << rcBasedAllocationEnabled);
991 Ptr<SatTimeSlotConf> timeSlotConf =
nullptr;
992 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
993 uint32_t waveformId = 0;
994 int64_t timeSlotSymbols = 0;
1007 if (timeSlotSymbols == 0)
1009 if (rcSymbolsLeft > 0)
1013 carrierSymbolsToUse -= symbolsToUse;
1017 utSymbolsToUse -= symbolsToUse;
1021 else if (rcSymbolsLeft > 0)
1027 timeSlotConf =
m_frameConf->GetTimeSlotConf(carrierId, index);
1036 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1037 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1045 NS_FATAL_ERROR(
"Not supported configuration type!!!");
1051 carrierSymbolsToUse -= timeSlotSymbols;
1052 utSymbolsToUse -= timeSlotSymbols;
1057 if (rcBasedAllocationEnabled)
1059 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1063 utSymbolsLeft -= timeSlotSymbols;
1066 rcSymbolsLeft -= timeSlotSymbols;
1070 return timeSlotConf;
1075 int64_t& utSymbolsToUse,
1076 int64_t& carrierSymbolsToUse,
1077 int64_t& utSymbolsLeft,
1078 int64_t& rcSymbolsLeft,
1079 bool rcBasedAllocationEnabled)
1081 NS_LOG_FUNCTION(
this);
1083 Ptr<SatTimeSlotConf> timeSlotConf =
nullptr;
1084 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
1092 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1093 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1098 carrierSymbolsToUse -= timeSlotSymbols;
1099 utSymbolsToUse -= timeSlotSymbols;
1104 if (rcBasedAllocationEnabled)
1106 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1110 utSymbolsLeft -= timeSlotSymbols;
1113 rcSymbolsLeft -= timeSlotSymbols;
1116 return timeSlotConf;
1121 int64_t symbolsLeft,
1123 uint32_t& waveformId)
1125 NS_LOG_FUNCTION(
this);
1127 uint32_t burstLength = 0;
1129 for (SatWaveformConf::BurstLengthContainer_t::const_iterator it =
m_burstLenghts.begin();
1133 uint32_t newLength = *it;
1134 uint32_t selectedWaveformId = 0;
1142 double cnoThreshold = std::numeric_limits<double>::quiet_NaN();
1143 bool waveformFound =
1145 m_frameConf->GetBtuConf()->GetSymbolRateInBauds(),
1153 m_waveformConf->GetWaveform(selectedWaveformId)->GetBurstLengthInSymbols();
1157 if (symbolsToUse >= newLength)
1159 if (burstLength < symbolsLeft)
1161 if (burstLength < newLength)
1163 burstLength = newLength;
1164 waveformId = selectedWaveformId;
1167 else if ((newLength - symbolsLeft) < (burstLength - symbolsLeft))
1169 burstLength = newLength;
1170 waveformId = selectedWaveformId;
1181 NS_LOG_FUNCTION(
this);
1189 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1190 it->second.m_allocation.m_minRbdcSymbols = 0.0;
1191 it->second.m_allocation.m_rbdcSymbols = 0.0;
1192 it->second.m_allocation.m_vbdcSymbols = 0.0;
1196 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1197 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1198 it->second.m_allocation.m_rbdcSymbols = 0.0;
1199 it->second.m_allocation.m_vbdcSymbols = 0.0;
1203 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1204 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1205 it->second.m_allocation.m_rbdcSymbols = it->second.m_request.m_rbdcSymbols;
1206 it->second.m_allocation.m_vbdcSymbols = 0.0;
1210 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1211 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1212 it->second.m_allocation.m_rbdcSymbols = it->second.m_request.m_rbdcSymbols;
1213 it->second.m_allocation.m_vbdcSymbols = it->second.m_request.m_vbdcSymbols;
1217 NS_FATAL_ERROR(
"Not supported CC level!!!");
1222 for (uint32_t i = 0; i < it->second.m_request.m_allocInfoPerRc.size(); i++)
1227 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1228 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1229 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols = 0.0;
1230 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1231 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1235 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1236 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1237 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1238 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1239 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1240 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1244 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1245 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1246 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1247 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1248 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1249 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1250 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1254 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1255 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1256 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1257 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1258 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1259 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1260 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols =
1261 it->second.m_request.m_allocInfoPerRc[i].m_vbdcSymbols;
1265 NS_FATAL_ERROR(
"Not supported CC level!!!");
1275 NS_LOG_FUNCTION(
this);
1279 NS_FATAL_ERROR(
"CRA does not fit in to carrier. Error in configuration or CAC?");
1286 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1290 it->m_vbdcSymbols = 0.0;
1291 it->m_minRbdcSymbols =
1293 it->m_rbdcSymbols = it->m_minRbdcSymbols;
1306 if (rbdcReqOverMinRbdc > 0)
1310 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1314 it->m_vbdcSymbols = 0.0;
1315 double rcRbdcReqOverMinRbdc =
1316 std::max(0.0, (it->m_rbdcSymbols - it->m_minRbdcSymbols));
1319 ((rcRbdcReqOverMinRbdc / rbdcReqOverMinRbdc) * rbdcSymbolsLeft) +
1320 it->m_minRbdcSymbols;
1334 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1338 it->m_vbdcSymbols = (it->m_vbdcSymbols / req.
m_vbdcSymbols) * vbdcSymbolsLeft;
1348 utAlloc.
m_cno = cno;
1356 m_utAllocs.insert(std::make_pair(address, utAlloc));
1362 NS_LOG_FUNCTION(
this);
1364 std::vector<Address> uts;
1368 uts.push_back(it->first);
1372 std::default_random_engine rng = std::default_random_engine{};
1373 std::shuffle(uts.begin(), uts.end(), rng);
1378std::vector<uint16_t>
1381 NS_LOG_FUNCTION(
this);
1383 std::vector<uint16_t> carriers;
1391 std::default_random_engine rng = std::default_random_engine{};
1392 std::shuffle(carriers.begin(), carriers.end(), rng);
1397std::vector<uint32_t>
1400 NS_LOG_FUNCTION(
this);
1401 std::vector<uint32_t> rcIndices;
1403 for (uint32_t i = 0; i <
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(); i++)
1405 rcIndices.push_back(i);
1410 if (rcIndices.size() > 2)
1413 std::default_random_engine rng = std::default_random_engine{};
1414 std::shuffle(rcIndices.begin() + 1, rcIndices.end(), rng);
1420SatFrameAllocator::UtAllocInfoContainer_t::iterator
1423 NS_LOG_FUNCTION(
this);
1424 UtAllocInfoContainer_t::iterator utAlloc = allocContainer.find(ut);
1426 if (utAlloc == allocContainer.end())
1430 rcAllocs.second =
false;
1432 std::vector<uint32_t>(
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(), 0);
1434 std::pair<UtAllocInfoContainer_t::iterator, bool> result =
1435 allocContainer.insert(std::make_pair(ut, rcAllocs));
1439 utAlloc = result.first;
1443 NS_FATAL_ERROR(
"UT cannot be added to map!!!");
1453 NS_LOG_FUNCTION(
this);
1455 if (tbtpContainer.empty())
1457 NS_FATAL_ERROR(
"TBTP container is empty");
1460 Ptr<SatTbtpMessage> newTbtp =
1461 CreateObject<SatTbtpMessage>(tbtpContainer.back()->GetSuperframeSeqId());
1462 newTbtp->SetSuperframeCounter(tbtpContainer.back()->GetSuperframeCounter());
1464 tbtpContainer.push_back(newTbtp);
CcReqCompare class for CC type comparisons.
CcReqType_t
Definition for different comparison types.
@ CC_TYPE_MIN_RBDC
CC_TYPE_MIN_RBDC.
@ CC_TYPE_VBDC
CC_TYPE_VBDC.
@ CC_TYPE_RBDC
CC_TYPE_RBDC.
CcReqCompare(const UtAllocContainer_t &utAllocContainer, CcReqCompare::CcReqType_t ccReqType)
Construct CcReqCompare.
bool operator()(RcAllocItem_t rcAlloc1, RcAllocItem_t rcAlloc2)
Comparison operator to compare two RC allocations.
CcReqType_t m_ccReqType
Type used for comparisons.
const UtAllocContainer_t & m_utAllocContainer
Reference to UT allocation container.
SatFrameAllocInfo is used to hold a frame's allocation info in symbols.
SatFrameAllocInfoItemContainer_t m_allocInfoPerRc
Information for the RCs.
SatFrameAllocInfo()
Construct empty SatFrameAllocInfo.
double GetTotalSymbols()
Get total symbols of the item.
SatFrameAllocInfoItem UpdateTotalCounts()
Update total count of SatFrameAllocInfo from RCs.
Allocation information item for requests and allocations [symbols] used internally by SatFrameAllocat...
SatFrameAllocReq is used to define frame allocation parameters when requesting allocation from SatFra...
SatFrameAllocReqItemContainer_t m_reqPerRc
void ShareSymbols(bool fcaEnabled)
Share symbols between all UTs and RCs allocated to the frame.
double m_maxSymbolsPerCarrier
std::vector< uint16_t > SortCarriers()
Sort carriers belonging to this frame.
RcAllocContainer_t m_rcAllocs
Ptr< SatWaveform > m_mostRobustWaveform
double m_preAllocatedCraSymbols
double GetCcLoad(CcLevel_t ccLevel)
Get frame load by requested CC.
uint16_t m_carriersOffset
Ptr< SatFrameConf > m_frameConf
SatSuperframeConf::ConfigType_t m_configType
void SelectCarriers(uint16_t &amount, uint16_t offset)
Set the amount of carriers used in this frame.
double m_preAllocatedRdbcSymbols
std::map< Address, UtAllocItem_t > UtAllocContainer_t
Map container for UT allocation items.
SatFrameAllocator::UtAllocInfoContainer_t::iterator GetUtAllocItem(UtAllocInfoContainer_t &allocContainer, Address ut)
Get UT allocation item from given container.
bool Allocate(CcLevel_t ccLevel, SatFrameAllocReq *allocReq, uint32_t waveformId)
Allocate symbols to this frame, if criteria are fulfilled.
bool GetBestWaveform(double cno, uint32_t &waveFormId, double &cnoThreshold) const
Get the best waveform supported by this allocator based on given C/N0.
SatWaveformConf::BurstLengthContainer_t m_burstLenghts
Ptr< SatWaveformConf > m_waveformConf
void Reset()
Reset frame allocator.
SatFrameAllocator()
Default constructor (not in used).
std::vector< Address > SortUts()
Sort UTs allocated to this frame.
std::pair< std::vector< uint32_t >, bool > UtAllocInfoItem_t
Pair used to store UT allocation information.
double m_totalSymbolsInFrame
Ptr< SatTimeSlotConf > CreateTimeSlot(uint16_t carrierId, int64_t &utSymbolsToUse, int64_t &carrierSymbolsToUse, int64_t &utSymbolsLeft, int64_t &rcSymbolsLeft, double cno, bool rcBasedAllocationEnabled)
Create time slot according to configuration type.
void UpdateAndStoreAllocReq(Address address, double cno, SatFrameAllocInfo &req)
Update RC/CC requested according to carrier limit.
void AcceptRequests(CcLevel_t ccLevel)
Accept UT/RC requests of the frame according to given CC level.
double m_preAllocatedMinRdbcSymbols
uint16_t m_maxCarrierCount
std::vector< SatFrameAllocInfoItem > SatFrameAllocInfoItemContainer_t
Container to store SatFrameAllocInfoItem items.
std::vector< Ptr< SatTbtpMessage > > TbtpMsgContainer_t
Container to store generated TBTP messages.
uint32_t GetOptimalBurtsLengthInSymbols(int64_t symbolsToUse, int64_t symbolsLeft, double cno, uint32_t &waveformId)
Get optimal burst length in symbols.
Ptr< SatFrameAllocator > m_parent
UtAllocContainer_t m_utAllocs
Ptr< SatTimeSlotConf > CreateCtrlTimeSlot(uint16_t carrierId, int64_t &utSymbolsToUse, int64_t &carrierSymbolsToUse, int64_t &utSymbolsLeft, int64_t &rcSymbolsLeft, bool rcBasedAllocationEnabled)
Create control time slot.
double m_availableSymbolsInFrame
double m_preAllocatedVdbcSymbols
Ptr< SatTbtpMessage > CreateNewTbtp(TbtpMsgContainer_t &tbtpContainer)
Creates new TBTP to given container with information of the last TBTP in container.
void GenerateTimeSlots(SatFrameAllocator::TbtpMsgContainer_t &tbtpContainer, uint32_t maxSizeInBytes, UtAllocInfoContainer_t &utAllocContainer, bool rcBasedAllocationEnabled, TracedCallback< uint32_t > waveformTrace, TracedCallback< uint32_t, uint32_t > utLoadTrace, TracedCallback< uint32_t, double > loadTrace)
Generate time slots for UT/RCs i.e.
CcLevel_t
Enum for CC levels.
@ CC_LEVEL_CRA_RBDC
CC level CRA + RBDC.
@ CC_LEVEL_CRA
CC level CRA.
@ CC_LEVEL_CRA_RBDC_VBDC
CC level CRA + RBDC + VBDC.
@ CC_LEVEL_CRA_MIN_RBDC
CC level CRA + Minimum RBDC.
std::map< Address, UtAllocInfoItem_t > UtAllocInfoContainer_t
Map container to store UT allocation information.
std::pair< Address, uint8_t > RcAllocItem_t
Pair used as RC allocation item.
uint8_t m_guardTimeSymbols
void PreAllocateSymbols(double targetLoad, bool fcaEnabled)
Preallocate symbols for all UTs with RCs allocated to the frame.
std::vector< SatFrameAllocReqItem > SatFrameAllocReqItemContainer_t
Container to store SatFrameAllocReqItem items.
std::vector< uint32_t > SortUtRcs(Address ut)
Sort RCs in given UT.
static const uint16_t m_maxTimeSlotCount
This abstract class defines and implements interface of configuration for super frames.
ConfigType_t
Enum for configuration types.
@ CONFIG_TYPE_2
Configuration type 2.
@ CONFIG_TYPE_1
Configuration type 1.
@ CONFIG_TYPE_0
Configuration type 0.
@ CONFIG_TYPE_3
Configuration type 3.
@ SLOT_TYPE_TRC
Control or traffic slot.
@ SLOT_TYPE_C
Control slot.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
bool operator()(const Ptr< SatFrameAllocator > &a, const Ptr< SatFrameAllocator > &b) const
Allocation information for a UT.
SatFrameAllocInfo m_request
SatFrameAllocInfo m_allocation