25 #include <ns3/boolean.h>
26 #include <ns3/double.h>
34 NS_LOG_COMPONENT_DEFINE(
"SatFrameAllocator");
42 : m_ctrlSlotPresent(false),
44 m_minRbdcSymbols(0.0),
48 NS_LOG_FUNCTION(
this);
52 : m_ctrlSlotPresent(false),
54 m_minRbdcSymbols(0.0),
58 NS_LOG_FUNCTION(
this << (uint32_t)countOfRcs);
64 Ptr<SatWaveform> trcWaveForm,
66 double ctrlSlotLength)
67 : m_ctrlSlotPresent(ctrlSlotPresent),
69 m_minRbdcSymbols(0.0),
73 NS_LOG_FUNCTION(
this << ctrlSlotPresent << ctrlSlotLength);
75 for (SatFrameAllocReqItemContainer_t::const_iterator it = req.begin(); it != req.end(); it++)
79 reqInSymbols.
m_craSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_craBytes /
80 trcWaveForm->GetPayloadInBytes();
82 it->m_minRbdcBytes / trcWaveForm->GetPayloadInBytes();
83 reqInSymbols.
m_rbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_rbdcBytes /
84 trcWaveForm->GetPayloadInBytes();
85 reqInSymbols.
m_vbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_vbdcBytes /
86 trcWaveForm->GetPayloadInBytes();
107 NS_LOG_FUNCTION(
this);
110 m_minRbdcSymbols = 0.0;
116 for (SatFrameAllocInfoItemContainer_t::const_iterator it = m_allocInfoPerRc.begin();
117 it != m_allocInfoPerRc.end();
123 m_minRbdcSymbols += it->m_minRbdcSymbols;
124 m_rbdcSymbols += it->m_rbdcSymbols;
125 m_vbdcSymbols += it->m_vbdcSymbols;
139 return (m_craSymbols + m_rbdcSymbols + m_vbdcSymbols);
144 : m_utAllocContainer(utAllocContainer),
145 m_ccReqType(ccReqType)
156 case CC_TYPE_MIN_RBDC:
157 result = (m_utAllocContainer.at(rcAlloc1.first)
158 .m_request.m_allocInfoPerRc[rcAlloc1.second]
159 .m_minRbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
160 .m_request.m_allocInfoPerRc[rcAlloc2.second]
165 result = (m_utAllocContainer.at(rcAlloc1.first)
166 .m_request.m_allocInfoPerRc[rcAlloc1.second]
167 .m_rbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
168 .m_request.m_allocInfoPerRc[rcAlloc2.second]
173 result = (m_utAllocContainer.at(rcAlloc1.first)
174 .m_request.m_allocInfoPerRc[rcAlloc1.second]
175 .m_vbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
176 .m_request.m_allocInfoPerRc[rcAlloc2.second]
181 NS_FATAL_ERROR(
"Invalid CC type!!!");
190 const Ptr<SatFrameAllocator>& b)
const
192 double bandwidthA = a->m_frameConf->GetBandwidthHz();
193 double bandwidthB = b->m_frameConf->GetBandwidthHz();
195 if (bandwidthA == bandwidthB)
197 return bandwidthA > bandwidthB;
218 NS_LOG_FUNCTION(
this);
219 NS_FATAL_ERROR(
"Default constructor not supported!!!");
225 Ptr<SatFrameAllocator> parent)
226 : m_allocationDenied(true),
227 m_maxCarrierCount(0),
229 m_configType(configType),
231 m_frameConf(frameConf),
234 NS_LOG_FUNCTION(
this << (uint32_t)frameId);
257 uint32_t mostRobustWaveformId = 0;
266 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
273 if (frameConf->GetWaveformConf()->IsAcmEnabled())
275 m_burstLenghts = frameConf->GetWaveformConf()->GetSupportedBurstLengths();
282 uint32_t mostRobustWaveformId = 0;
291 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
297 NS_FATAL_ERROR(
"Not supported configuration type");
307 NS_LOG_FUNCTION(
this);
325 NS_LOG_FUNCTION(
this << count << offset);
327 uint16_t total = count + offset;
330 NS_FATAL_ERROR(
"SatFrameAllocator::SetCarrierCount: Amount of carriers in use is greater "
331 "than the amount of carriers in frame.");
349 NS_LOG_INFO(
"Frame " << (uint32_t)
m_frameId <<
" selected " << count
350 <<
" carriers from carrier ID " << offset);
356 NS_LOG_FUNCTION(
this << ccLevel);
380 NS_FATAL_ERROR(
"Not supported CC level!!!");
390 NS_LOG_FUNCTION(
this << cno << waveFormId);
392 bool cnoSupported =
false;
421 NS_FATAL_ERROR(
"Not supported configuration type");
431 NS_LOG_FUNCTION(
this << ccLevel << waveFormId);
433 bool allocated =
false;
445 NS_FATAL_ERROR(
"Min RBDC bytes is greater than RBDC bytes!!!");
460 std::min<double>(reqInSymbols.
m_rbdcSymbols, symbolsLeftInCarrier);
469 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
476 NS_FATAL_ERROR(
"CRA symbols exceeds carrier limit!!!");
484 double symbolsLeftInFrame =
506 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
515 double symbolsLeftInFrame =
521 double symbolsLeftInCarrier =
528 std::min<double>(reqInSymbols.
m_vbdcSymbols, symbolsLeftInCarrier);
554 NS_FATAL_ERROR(
"Not supported CC level!!!");
571 NS_LOG_FUNCTION(
this << targetLoad << fcaEnabled);
575 if ((targetLoad >= 0) && (targetLoad <= 1))
582 NS_FATAL_ERROR(
"target load must be between 0 and 1.");
591 uint32_t maxSizeInBytes,
593 bool rcBasedAllocationEnabled,
594 TracedCallback<uint32_t> waveformTrace,
595 TracedCallback<uint32_t, uint32_t> utLoadTrace,
596 TracedCallback<uint32_t, double> loadTrace)
598 NS_LOG_FUNCTION(
this);
601 uint32_t timeslotCount = 0;
603 if (tbtpContainer.empty())
605 NS_FATAL_ERROR(
"TBTP container must contain at least one message.");
608 Ptr<SatTbtpMessage> tbtpToFill = tbtpContainer.back();
611 std::vector<Address> uts =
SortUts();
618 std::vector<uint16_t>::const_iterator currentCarrier = carriers.begin();
620 uint32_t utCount = 0;
621 uint32_t symbolsAllocated = 0;
623 for (std::vector<Address>::iterator it = uts.begin();
624 (it != uts.end()) && (currentCarrier != carriers.end());
628 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes() +
629 tbtpToFill->GetFrameInfoSize()) > maxSizeInBytes)
635 std::vector<uint32_t> rcIndices =
SortUtRcs(*it);
636 std::vector<uint32_t>::const_iterator currentRcIndex = rcIndices.begin();
638 int64_t rcSymbolsLeft =
639 m_utAllocs[*it].m_allocation.m_allocInfoPerRc[*currentRcIndex].GetTotalSymbols();
643 int64_t utSymbolsLeft =
m_utAllocs[*it].m_allocation.GetTotalSymbols();
646 bool waveformIdTraced =
false;
648 while (utSymbolsLeft > 0)
650 Ptr<SatTimeSlotConf> timeSlot =
nullptr;
654 if ((currentRcIndex == rcIndices.begin()) &&
655 m_utAllocs[*it].m_request.m_ctrlSlotPresent &&
656 (
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent ==
false))
663 rcBasedAllocationEnabled);
670 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
true;
680 rcBasedAllocationEnabled);
691 rcBasedAllocationEnabled);
698 if (!waveformIdTraced)
700 waveformIdTraced =
true;
701 waveformTrace(timeSlot->GetWaveFormId());
705 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes()) >
711 timeSlot->SetRcIndex(*currentRcIndex);
719 tbtpToFill->SetDaTimeslot(Mac48Address::ConvertFrom(*it),
m_frameId, timeSlot);
723 Ptr<SatWaveform> waveform =
m_waveformConf->GetWaveform(timeSlot->GetWaveFormId());
725 UtAllocInfoContainer_t::iterator utAlloc =
GetUtAllocItem(utAllocContainer, *it);
726 utAlloc->second.first.at(*currentRcIndex) += waveform->GetPayloadInBytes();
727 utAlloc->second.second |=
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent;
729 symbolsAllocated += waveform->GetBurstLengthInSymbols();
733 if (carrierSymbolsToUse <= 0)
738 if (currentCarrier == carriers.end())
746 if (rcSymbolsLeft <= 0)
750 if (currentRcIndex == rcIndices.end())
758 .m_allocation.m_allocInfoPerRc[*currentRcIndex]
765 if ((utSymbolsToUse <= 0) || (currentCarrier == carriers.end()))
771 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
false;
775 utLoadTrace((uint32_t)
m_frameId, utCount);
784 NS_LOG_FUNCTION(
this);
808 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
809 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
812 double freeUtSymbols =
813 std::max<double>(0.0,
815 m_utAllocs.at(it->first).m_allocation.GetTotalSymbols());
816 double symbolsToAdd =
817 std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
820 if ((
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols >
822 (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols >
826 .m_allocation.m_allocInfoPerRc[it->second]
827 .m_vbdcSymbols += symbolsToAdd;
828 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
829 vbdcSymbolsLeft -= symbolsToAdd;
841 double vbdcSymbolsLeft =
854 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
855 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
858 double freeUtSymbols = std::max<double>(
861 double symbolsToAdd = std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
864 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols > 0)
866 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_vbdcSymbols =
868 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
869 vbdcSymbolsLeft -= symbolsToAdd;
880 double rbdcSymbolsLeft =
895 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
896 it !=
m_rcAllocs.end() && (rbdcSymbolsLeft > 0);
899 double freeUtSymbols = std::max<double>(
902 double symbolsToAdd = std::min<double>(freeUtSymbols, (rbdcSymbolsLeft / rcAllocsLeft));
905 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
907 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
909 .m_allocation.m_allocInfoPerRc[it->second]
911 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols +=
913 .m_allocation.m_allocInfoPerRc[it->second]
915 rbdcSymbolsLeft -= symbolsToAdd;
941 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
942 it !=
m_rcAllocs.end() && (minRbdcSymbolsLeft > 0);
945 double freeUtSymbols = std::max<double>(
948 double symbolsToAdd =
949 std::min<double>(freeUtSymbols, (minRbdcSymbolsLeft / rcAllocsLeft));
952 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
955 .m_allocation.m_allocInfoPerRc[it->second]
956 .m_minRbdcSymbols = symbolsToAdd;
957 m_utAllocs.at(it->first).m_allocation.m_minRbdcSymbols += symbolsToAdd;
959 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
961 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols += symbolsToAdd;
963 minRbdcSymbolsLeft -= symbolsToAdd;
971 NS_FATAL_ERROR(
"CRAs don't fit to frame CAC or configuration error???");
977 int64_t& utSymbolsToUse,
978 int64_t& carrierSymbolsToUse,
979 int64_t& utSymbolsLeft,
980 int64_t& rcSymbolsLeft,
982 bool rcBasedAllocationEnabled)
984 NS_LOG_FUNCTION(
this << carrierId << cno << rcBasedAllocationEnabled);
986 Ptr<SatTimeSlotConf> timeSlotConf =
nullptr;
987 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
988 uint32_t waveformId = 0;
989 int64_t timeSlotSymbols = 0;
1002 if (timeSlotSymbols == 0)
1004 if (rcSymbolsLeft > 0)
1008 carrierSymbolsToUse -= symbolsToUse;
1012 utSymbolsToUse -= symbolsToUse;
1016 else if (rcSymbolsLeft > 0)
1022 timeSlotConf =
m_frameConf->GetTimeSlotConf(carrierId, index);
1031 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1032 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1040 NS_FATAL_ERROR(
"Not supported configuration type!!!");
1046 carrierSymbolsToUse -= timeSlotSymbols;
1047 utSymbolsToUse -= timeSlotSymbols;
1052 if (rcBasedAllocationEnabled)
1054 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1058 utSymbolsLeft -= timeSlotSymbols;
1061 rcSymbolsLeft -= timeSlotSymbols;
1065 return timeSlotConf;
1068 Ptr<SatTimeSlotConf>
1070 int64_t& utSymbolsToUse,
1071 int64_t& carrierSymbolsToUse,
1072 int64_t& utSymbolsLeft,
1073 int64_t& rcSymbolsLeft,
1074 bool rcBasedAllocationEnabled)
1076 NS_LOG_FUNCTION(
this);
1078 Ptr<SatTimeSlotConf> timeSlotConf =
nullptr;
1079 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
1087 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1088 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1093 carrierSymbolsToUse -= timeSlotSymbols;
1094 utSymbolsToUse -= timeSlotSymbols;
1099 if (rcBasedAllocationEnabled)
1101 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1105 utSymbolsLeft -= timeSlotSymbols;
1108 rcSymbolsLeft -= timeSlotSymbols;
1111 return timeSlotConf;
1116 int64_t symbolsLeft,
1118 uint32_t& waveformId)
1120 NS_LOG_FUNCTION(
this);
1122 uint32_t burstLength = 0;
1124 for (SatWaveformConf::BurstLengthContainer_t::const_iterator it =
m_burstLenghts.begin();
1128 uint32_t newLength = *it;
1129 uint32_t selectedWaveformId = 0;
1137 double cnoThreshold = std::numeric_limits<double>::quiet_NaN();
1138 bool waveformFound =
1140 m_frameConf->GetBtuConf()->GetSymbolRateInBauds(),
1148 m_waveformConf->GetWaveform(selectedWaveformId)->GetBurstLengthInSymbols();
1152 if (symbolsToUse >= newLength)
1154 if (burstLength < symbolsLeft)
1156 if (burstLength < newLength)
1158 burstLength = newLength;
1159 waveformId = selectedWaveformId;
1162 else if ((newLength - symbolsLeft) < (burstLength - symbolsLeft))
1164 burstLength = newLength;
1165 waveformId = selectedWaveformId;
1176 NS_LOG_FUNCTION(
this);
1184 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1185 it->second.m_allocation.m_minRbdcSymbols = 0.0;
1186 it->second.m_allocation.m_rbdcSymbols = 0.0;
1187 it->second.m_allocation.m_vbdcSymbols = 0.0;
1191 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1192 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1193 it->second.m_allocation.m_rbdcSymbols = 0.0;
1194 it->second.m_allocation.m_vbdcSymbols = 0.0;
1198 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1199 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1200 it->second.m_allocation.m_rbdcSymbols = it->second.m_request.m_rbdcSymbols;
1201 it->second.m_allocation.m_vbdcSymbols = 0.0;
1205 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1206 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
1207 it->second.m_allocation.m_rbdcSymbols = it->second.m_request.m_rbdcSymbols;
1208 it->second.m_allocation.m_vbdcSymbols = it->second.m_request.m_vbdcSymbols;
1212 NS_FATAL_ERROR(
"Not supported CC level!!!");
1217 for (uint32_t i = 0; i < it->second.m_request.m_allocInfoPerRc.size(); i++)
1222 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1223 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1224 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols = 0.0;
1225 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1226 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1230 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1231 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1232 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1233 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1234 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1235 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1239 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1240 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1241 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1242 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1243 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1244 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1245 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1249 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1250 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1251 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1252 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1253 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1254 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1255 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols =
1256 it->second.m_request.m_allocInfoPerRc[i].m_vbdcSymbols;
1260 NS_FATAL_ERROR(
"Not supported CC level!!!");
1270 NS_LOG_FUNCTION(
this);
1274 NS_FATAL_ERROR(
"CRA does not fit in to carrier. Error in configuration or CAC?");
1281 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1285 it->m_vbdcSymbols = 0.0;
1286 it->m_minRbdcSymbols =
1288 it->m_rbdcSymbols = it->m_minRbdcSymbols;
1301 if (rbdcReqOverMinRbdc > 0)
1305 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1309 it->m_vbdcSymbols = 0.0;
1310 double rcRbdcReqOverMinRbdc =
1311 std::max(0.0, (it->m_rbdcSymbols - it->m_minRbdcSymbols));
1314 ((rcRbdcReqOverMinRbdc / rbdcReqOverMinRbdc) * rbdcSymbolsLeft) +
1315 it->m_minRbdcSymbols;
1329 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1333 it->m_vbdcSymbols = (it->m_vbdcSymbols / req.
m_vbdcSymbols) * vbdcSymbolsLeft;
1343 utAlloc.
m_cno = cno;
1351 m_utAllocs.insert(std::make_pair(address, utAlloc));
1354 std::vector<Address>
1357 NS_LOG_FUNCTION(
this);
1359 std::vector<Address> uts;
1363 uts.push_back(it->first);
1367 std::random_shuffle(uts.begin(), uts.end());
1372 std::vector<uint16_t>
1375 NS_LOG_FUNCTION(
this);
1377 std::vector<uint16_t> carriers;
1385 std::random_shuffle(carriers.begin(), carriers.end());
1390 std::vector<uint32_t>
1393 NS_LOG_FUNCTION(
this);
1394 std::vector<uint32_t> rcIndices;
1396 for (uint32_t i = 0; i <
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(); i++)
1398 rcIndices.push_back(i);
1403 if (rcIndices.size() > 2)
1406 std::random_shuffle(rcIndices.begin() + 1, rcIndices.end());
1412 SatFrameAllocator::UtAllocInfoContainer_t::iterator
1415 NS_LOG_FUNCTION(
this);
1416 UtAllocInfoContainer_t::iterator utAlloc = allocContainer.find(ut);
1418 if (utAlloc == allocContainer.end())
1422 rcAllocs.second =
false;
1424 std::vector<uint32_t>(
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(), 0);
1426 std::pair<UtAllocInfoContainer_t::iterator, bool> result =
1427 allocContainer.insert(std::make_pair(ut, rcAllocs));
1431 utAlloc = result.first;
1435 NS_FATAL_ERROR(
"UT cannot be added to map!!!");
1445 NS_LOG_FUNCTION(
this);
1447 if (tbtpContainer.empty())
1449 NS_FATAL_ERROR(
"TBTP container is empty");
1452 Ptr<SatTbtpMessage> newTbtp =
1453 CreateObject<SatTbtpMessage>(tbtpContainer.back()->GetSuperframeSeqId());
1454 newTbtp->SetSuperframeCounter(tbtpContainer.back()->GetSuperframeCounter());
1456 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.
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