25 #include <ns3/boolean.h>
26 #include <ns3/double.h>
32 NS_LOG_COMPONENT_DEFINE(
"SatFrameAllocator");
40 : m_ctrlSlotPresent(false),
42 m_minRbdcSymbols(0.0),
46 NS_LOG_FUNCTION(
this);
50 : m_ctrlSlotPresent(false),
52 m_minRbdcSymbols(0.0),
56 NS_LOG_FUNCTION(
this << (uint32_t)countOfRcs);
62 Ptr<SatWaveform> trcWaveForm,
64 double ctrlSlotLength)
65 : m_ctrlSlotPresent(ctrlSlotPresent),
67 m_minRbdcSymbols(0.0),
71 NS_LOG_FUNCTION(
this << ctrlSlotPresent << ctrlSlotLength);
73 for (SatFrameAllocReqItemContainer_t::const_iterator it = req.begin(); it != req.end(); it++)
77 reqInSymbols.
m_craSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_craBytes /
78 trcWaveForm->GetPayloadInBytes();
80 it->m_minRbdcBytes / trcWaveForm->GetPayloadInBytes();
81 reqInSymbols.
m_rbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_rbdcBytes /
82 trcWaveForm->GetPayloadInBytes();
83 reqInSymbols.
m_vbdcSymbols = trcWaveForm->GetBurstLengthInSymbols() * it->m_vbdcBytes /
84 trcWaveForm->GetPayloadInBytes();
105 NS_LOG_FUNCTION(
this);
108 m_minRbdcSymbols = 0.0;
114 for (SatFrameAllocInfoItemContainer_t::const_iterator it = m_allocInfoPerRc.begin();
115 it != m_allocInfoPerRc.end();
121 m_minRbdcSymbols += it->m_minRbdcSymbols;
122 m_rbdcSymbols += it->m_rbdcSymbols;
123 m_vbdcSymbols += it->m_vbdcSymbols;
137 return (m_craSymbols + m_rbdcSymbols + m_vbdcSymbols);
142 : m_utAllocContainer(utAllocContainer),
143 m_ccReqType(ccReqType)
154 case CC_TYPE_MIN_RBDC:
155 result = (m_utAllocContainer.at(rcAlloc1.first)
156 .m_request.m_allocInfoPerRc[rcAlloc1.second]
157 .m_minRbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
158 .m_request.m_allocInfoPerRc[rcAlloc2.second]
163 result = (m_utAllocContainer.at(rcAlloc1.first)
164 .m_request.m_allocInfoPerRc[rcAlloc1.second]
165 .m_rbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
166 .m_request.m_allocInfoPerRc[rcAlloc2.second]
171 result = (m_utAllocContainer.at(rcAlloc1.first)
172 .m_request.m_allocInfoPerRc[rcAlloc1.second]
173 .m_vbdcSymbols < m_utAllocContainer.at(rcAlloc2.first)
174 .m_request.m_allocInfoPerRc[rcAlloc2.second]
179 NS_FATAL_ERROR(
"Invalid CC type!!!");
188 const Ptr<SatFrameAllocator>& b)
const
190 double bandwidthA = a->m_frameConf->GetBandwidthHz();
191 double bandwidthB = b->m_frameConf->GetBandwidthHz();
193 if (bandwidthA == bandwidthB)
195 return bandwidthA > bandwidthB;
216 NS_LOG_FUNCTION(
this);
217 NS_FATAL_ERROR(
"Default constructor not supported!!!");
223 Ptr<SatFrameAllocator> parent)
224 : m_allocationDenied(true),
225 m_maxCarrierCount(0),
227 m_configType(configType),
229 m_frameConf(frameConf),
232 NS_LOG_FUNCTION(
this << (uint32_t)frameId);
255 uint32_t mostRobustWaveformId = 0;
264 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
271 if (frameConf->GetWaveformConf()->IsAcmEnabled())
273 m_burstLenghts = frameConf->GetWaveformConf()->GetSupportedBurstLengths();
280 uint32_t mostRobustWaveformId = 0;
289 NS_FATAL_ERROR(
"Most robust waveform not found, error in waveform configuration ???");
295 NS_FATAL_ERROR(
"Not supported configuration type");
305 NS_LOG_FUNCTION(
this);
323 NS_LOG_FUNCTION(
this << count << offset);
325 uint16_t total = count + offset;
328 NS_FATAL_ERROR(
"SatFrameAllocator::SetCarrierCount: Amount of carriers in use is greater "
329 "than the amount of carriers in frame.");
347 NS_LOG_INFO(
"Frame " << (uint32_t)
m_frameId <<
" selected " << count
348 <<
" carriers from carrier ID " << offset);
354 NS_LOG_FUNCTION(
this << ccLevel);
378 NS_FATAL_ERROR(
"Not supported CC level!!!");
388 NS_LOG_FUNCTION(
this << cno << waveFormId);
390 bool cnoSupported =
false;
419 NS_FATAL_ERROR(
"Not supported configuration type");
429 NS_LOG_FUNCTION(
this << ccLevel << waveFormId);
431 bool allocated =
false;
443 NS_FATAL_ERROR(
"Min RBDC bytes is greater than RBDC bytes!!!");
458 std::min<double>(reqInSymbols.
m_rbdcSymbols, symbolsLeftInCarrier);
467 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
474 NS_FATAL_ERROR(
"CRA symbols exceeds carrier limit!!!");
482 double symbolsLeftInFrame =
504 std::min<double>(reqInSymbols.
m_vbdcSymbols, vbdcSymbolsInCarrier);
513 double symbolsLeftInFrame =
519 double symbolsLeftInCarrier =
526 std::min<double>(reqInSymbols.
m_vbdcSymbols, symbolsLeftInCarrier);
552 NS_FATAL_ERROR(
"Not supported CC level!!!");
569 NS_LOG_FUNCTION(
this << targetLoad << fcaEnabled);
573 if ((targetLoad >= 0) && (targetLoad <= 1))
580 NS_FATAL_ERROR(
"target load must be between 0 and 1.");
589 uint32_t maxSizeInBytes,
591 bool rcBasedAllocationEnabled,
592 TracedCallback<uint32_t> waveformTrace,
593 TracedCallback<uint32_t, uint32_t> utLoadTrace,
594 TracedCallback<uint32_t, double> loadTrace)
596 NS_LOG_FUNCTION(
this);
599 uint32_t timeslotCount = 0;
601 if (tbtpContainer.empty())
603 NS_FATAL_ERROR(
"TBTP container must contain at least one message.");
606 Ptr<SatTbtpMessage> tbtpToFill = tbtpContainer.back();
609 std::vector<Address> uts =
SortUts();
616 std::vector<uint16_t>::const_iterator currentCarrier = carriers.begin();
618 uint32_t utCount = 0;
619 uint32_t symbolsAllocated = 0;
621 for (std::vector<Address>::iterator it = uts.begin();
622 (it != uts.end()) && (currentCarrier != carriers.end());
626 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes() +
627 tbtpToFill->GetFrameInfoSize()) > maxSizeInBytes)
633 std::vector<uint32_t> rcIndices =
SortUtRcs(*it);
634 std::vector<uint32_t>::const_iterator currentRcIndex = rcIndices.begin();
636 int64_t rcSymbolsLeft =
637 m_utAllocs[*it].m_allocation.m_allocInfoPerRc[*currentRcIndex].GetTotalSymbols();
641 int64_t utSymbolsLeft =
m_utAllocs[*it].m_allocation.GetTotalSymbols();
644 bool waveformIdTraced =
false;
646 while (utSymbolsLeft > 0)
648 Ptr<SatTimeSlotConf> timeSlot = NULL;
652 if ((currentRcIndex == rcIndices.begin()) &&
653 m_utAllocs[*it].m_request.m_ctrlSlotPresent &&
654 (
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent ==
false))
661 rcBasedAllocationEnabled);
668 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
true;
678 rcBasedAllocationEnabled);
689 rcBasedAllocationEnabled);
696 if (!waveformIdTraced)
698 waveformIdTraced =
true;
699 waveformTrace(timeSlot->GetWaveFormId());
703 if ((tbtpToFill->GetSizeInBytes() + tbtpToFill->GetTimeSlotInfoSizeInBytes()) >
709 timeSlot->SetRcIndex(*currentRcIndex);
717 tbtpToFill->SetDaTimeslot(Mac48Address::ConvertFrom(*it),
m_frameId, timeSlot);
721 Ptr<SatWaveform> waveform =
m_waveformConf->GetWaveform(timeSlot->GetWaveFormId());
723 UtAllocInfoContainer_t::iterator utAlloc =
GetUtAllocItem(utAllocContainer, *it);
724 utAlloc->second.first.at(*currentRcIndex) += waveform->GetPayloadInBytes();
725 utAlloc->second.second |=
m_utAllocs[*it].m_allocation.m_ctrlSlotPresent;
727 symbolsAllocated += waveform->GetBurstLengthInSymbols();
731 if (carrierSymbolsToUse <= 0)
736 if (currentCarrier == carriers.end())
744 if (rcSymbolsLeft <= 0)
748 if (currentRcIndex == rcIndices.end())
756 .m_allocation.m_allocInfoPerRc[*currentRcIndex]
763 if ((utSymbolsToUse <= 0) || (currentCarrier == carriers.end()))
769 m_utAllocs[*it].m_allocation.m_ctrlSlotPresent =
false;
773 utLoadTrace((uint32_t)
m_frameId, utCount);
782 NS_LOG_FUNCTION(
this);
806 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
807 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
810 double freeUtSymbols =
811 std::max<double>(0.0,
813 m_utAllocs.at(it->first).m_allocation.GetTotalSymbols());
814 double symbolsToAdd =
815 std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
818 if ((
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols >
820 (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols >
824 .m_allocation.m_allocInfoPerRc[it->second]
825 .m_vbdcSymbols += symbolsToAdd;
826 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
827 vbdcSymbolsLeft -= symbolsToAdd;
839 double vbdcSymbolsLeft =
852 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
853 it !=
m_rcAllocs.end() && (vbdcSymbolsLeft > 0);
856 double freeUtSymbols = std::max<double>(
859 double symbolsToAdd = std::min<double>(freeUtSymbols, (vbdcSymbolsLeft / rcAllocsLeft));
862 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_vbdcSymbols > 0)
864 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_vbdcSymbols =
866 m_utAllocs.at(it->first).m_allocation.m_vbdcSymbols += symbolsToAdd;
867 vbdcSymbolsLeft -= symbolsToAdd;
878 double rbdcSymbolsLeft =
893 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
894 it !=
m_rcAllocs.end() && (rbdcSymbolsLeft > 0);
897 double freeUtSymbols = std::max<double>(
900 double symbolsToAdd = std::min<double>(freeUtSymbols, (rbdcSymbolsLeft / rcAllocsLeft));
903 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
905 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
907 .m_allocation.m_allocInfoPerRc[it->second]
909 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols +=
911 .m_allocation.m_allocInfoPerRc[it->second]
913 rbdcSymbolsLeft -= symbolsToAdd;
939 for (RcAllocContainer_t::iterator it =
m_rcAllocs.begin();
940 it !=
m_rcAllocs.end() && (minRbdcSymbolsLeft > 0);
943 double freeUtSymbols = std::max<double>(
946 double symbolsToAdd =
947 std::min<double>(freeUtSymbols, (minRbdcSymbolsLeft / rcAllocsLeft));
950 if (
m_utAllocs.at(it->first).m_request.m_allocInfoPerRc[it->second].m_rbdcSymbols > 0)
953 .m_allocation.m_allocInfoPerRc[it->second]
954 .m_minRbdcSymbols = symbolsToAdd;
955 m_utAllocs.at(it->first).m_allocation.m_minRbdcSymbols += symbolsToAdd;
957 m_utAllocs.at(it->first).m_allocation.m_allocInfoPerRc[it->second].m_rbdcSymbols =
959 m_utAllocs.at(it->first).m_allocation.m_rbdcSymbols += symbolsToAdd;
961 minRbdcSymbolsLeft -= symbolsToAdd;
969 NS_FATAL_ERROR(
"CRAs don't fit to frame CAC or configuration error???");
975 int64_t& utSymbolsToUse,
976 int64_t& carrierSymbolsToUse,
977 int64_t& utSymbolsLeft,
978 int64_t& rcSymbolsLeft,
980 bool rcBasedAllocationEnabled)
982 NS_LOG_FUNCTION(
this << carrierId << cno << rcBasedAllocationEnabled);
984 Ptr<SatTimeSlotConf> timeSlotConf = NULL;
985 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
986 uint32_t waveformId = 0;
987 int64_t timeSlotSymbols = 0;
1000 if (timeSlotSymbols == 0)
1002 if (rcSymbolsLeft > 0)
1006 carrierSymbolsToUse -= symbolsToUse;
1010 utSymbolsToUse -= symbolsToUse;
1014 else if (rcSymbolsLeft > 0)
1020 timeSlotConf =
m_frameConf->GetTimeSlotConf(carrierId, index);
1029 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1030 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1038 NS_FATAL_ERROR(
"Not supported configuration type!!!");
1044 carrierSymbolsToUse -= timeSlotSymbols;
1045 utSymbolsToUse -= timeSlotSymbols;
1050 if (rcBasedAllocationEnabled)
1052 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1056 utSymbolsLeft -= timeSlotSymbols;
1059 rcSymbolsLeft -= timeSlotSymbols;
1063 return timeSlotConf;
1066 Ptr<SatTimeSlotConf>
1068 int64_t& utSymbolsToUse,
1069 int64_t& carrierSymbolsToUse,
1070 int64_t& utSymbolsLeft,
1071 int64_t& rcSymbolsLeft,
1072 bool rcBasedAllocationEnabled)
1074 NS_LOG_FUNCTION(
this);
1076 Ptr<SatTimeSlotConf> timeSlotConf = NULL;
1077 int64_t symbolsToUse = std::min<int64_t>(carrierSymbolsToUse, utSymbolsToUse);
1085 m_frameConf->GetBtuConf()->GetSymbolRateInBauds());
1086 timeSlotConf = Create<SatTimeSlotConf>(startTime,
1091 carrierSymbolsToUse -= timeSlotSymbols;
1092 utSymbolsToUse -= timeSlotSymbols;
1097 if (rcBasedAllocationEnabled)
1099 utSymbolsLeft -= std::min(rcSymbolsLeft, timeSlotSymbols);
1103 utSymbolsLeft -= timeSlotSymbols;
1106 rcSymbolsLeft -= timeSlotSymbols;
1109 return timeSlotConf;
1114 int64_t symbolsLeft,
1116 uint32_t& waveformId)
1118 NS_LOG_FUNCTION(
this);
1120 uint32_t burstLength = 0;
1122 for (SatWaveformConf::BurstLengthContainer_t::const_iterator it =
m_burstLenghts.begin();
1126 uint32_t newLength = *it;
1127 uint32_t selectedWaveformId = 0;
1135 double cnoThreshold = std::numeric_limits<double>::quiet_NaN();
1136 bool waveformFound =
1138 m_frameConf->GetBtuConf()->GetSymbolRateInBauds(),
1146 m_waveformConf->GetWaveform(selectedWaveformId)->GetBurstLengthInSymbols();
1150 if (symbolsToUse >= newLength)
1152 if (burstLength < symbolsLeft)
1154 if (burstLength < newLength)
1156 burstLength = newLength;
1157 waveformId = selectedWaveformId;
1160 else if ((newLength - symbolsLeft) < (burstLength - symbolsLeft))
1162 burstLength = newLength;
1163 waveformId = selectedWaveformId;
1174 NS_LOG_FUNCTION(
this);
1182 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1183 it->second.m_allocation.m_minRbdcSymbols = 0.0;
1184 it->second.m_allocation.m_rbdcSymbols = 0.0;
1185 it->second.m_allocation.m_vbdcSymbols = 0.0;
1189 it->second.m_allocation.m_craSymbols = it->second.m_request.m_craSymbols;
1190 it->second.m_allocation.m_minRbdcSymbols = it->second.m_request.m_minRbdcSymbols;
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 = it->second.m_request.m_rbdcSymbols;
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 = it->second.m_request.m_vbdcSymbols;
1210 NS_FATAL_ERROR(
"Not supported CC level!!!");
1215 for (uint32_t i = 0; i < it->second.m_request.m_allocInfoPerRc.size(); i++)
1220 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1221 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1222 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols = 0.0;
1223 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1224 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1228 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1229 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1230 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1231 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1232 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols = 0.0;
1233 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1237 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1238 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1239 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1240 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1241 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1242 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1243 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols = 0.0;
1247 it->second.m_allocation.m_allocInfoPerRc[i].m_craSymbols =
1248 it->second.m_request.m_allocInfoPerRc[i].m_craSymbols;
1249 it->second.m_allocation.m_allocInfoPerRc[i].m_minRbdcSymbols =
1250 it->second.m_request.m_allocInfoPerRc[i].m_minRbdcSymbols;
1251 it->second.m_allocation.m_allocInfoPerRc[i].m_rbdcSymbols =
1252 it->second.m_request.m_allocInfoPerRc[i].m_rbdcSymbols;
1253 it->second.m_allocation.m_allocInfoPerRc[i].m_vbdcSymbols =
1254 it->second.m_request.m_allocInfoPerRc[i].m_vbdcSymbols;
1258 NS_FATAL_ERROR(
"Not supported CC level!!!");
1268 NS_LOG_FUNCTION(
this);
1272 NS_FATAL_ERROR(
"CRA does not fit in to carrier. Error in configuration or CAC?");
1279 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1283 it->m_vbdcSymbols = 0.0;
1284 it->m_minRbdcSymbols =
1286 it->m_rbdcSymbols = it->m_minRbdcSymbols;
1299 if (rbdcReqOverMinRbdc > 0)
1303 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1307 it->m_vbdcSymbols = 0.0;
1308 double rcRbdcReqOverMinRbdc =
1309 std::max(0.0, (it->m_rbdcSymbols - it->m_minRbdcSymbols));
1312 ((rcRbdcReqOverMinRbdc / rbdcReqOverMinRbdc) * rbdcSymbolsLeft) +
1313 it->m_minRbdcSymbols;
1327 for (SatFrameAllocInfoItemContainer_t::iterator it = req.
m_allocInfoPerRc.begin();
1331 it->m_vbdcSymbols = (it->m_vbdcSymbols / req.
m_vbdcSymbols) * vbdcSymbolsLeft;
1341 utAlloc.
m_cno = cno;
1349 m_utAllocs.insert(std::make_pair(address, utAlloc));
1352 std::vector<Address>
1355 NS_LOG_FUNCTION(
this);
1357 std::vector<Address> uts;
1361 uts.push_back(it->first);
1365 std::random_shuffle(uts.begin(), uts.end());
1370 std::vector<uint16_t>
1373 NS_LOG_FUNCTION(
this);
1375 std::vector<uint16_t> carriers;
1383 std::random_shuffle(carriers.begin(), carriers.end());
1388 std::vector<uint32_t>
1391 NS_LOG_FUNCTION(
this);
1392 std::vector<uint32_t> rcIndices;
1394 for (uint32_t i = 0; i <
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(); i++)
1396 rcIndices.push_back(i);
1401 if (rcIndices.size() > 2)
1404 std::random_shuffle(rcIndices.begin() + 1, rcIndices.end());
1410 SatFrameAllocator::UtAllocInfoContainer_t::iterator
1413 NS_LOG_FUNCTION(
this);
1414 UtAllocInfoContainer_t::iterator utAlloc = allocContainer.find(ut);
1416 if (utAlloc == allocContainer.end())
1420 rcAllocs.second =
false;
1422 std::vector<uint32_t>(
m_utAllocs[ut].m_allocation.m_allocInfoPerRc.size(), 0);
1424 std::pair<UtAllocInfoContainer_t::iterator, bool> result =
1425 allocContainer.insert(std::make_pair(ut, rcAllocs));
1429 utAlloc = result.first;
1433 NS_FATAL_ERROR(
"UT cannot be added to map!!!");
1443 NS_LOG_FUNCTION(
this);
1445 if (tbtpContainer.empty())
1447 NS_FATAL_ERROR(
"TBTP container is empty");
1450 Ptr<SatTbtpMessage> newTbtp =
1451 CreateObject<SatTbtpMessage>(tbtpContainer.back()->GetSuperframeSeqId());
1452 newTbtp->SetSuperframeCounter(tbtpContainer.back()->GetSuperframeCounter());
1454 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