187 m_waveFormConf->SetAttribute(
"AcmEnabled", BooleanValue(acmEnabled));
191 double cnoThreshold = std::numeric_limits<double>::quiet_NaN();
194 for (uint32_t i = 0; i < 11; i += 2)
196 for (uint32_t j = 0; j < 15; j += 2)
198 for (uint32_t k = 0; k < 15; k += 2)
200 for (uint32_t l = 0; l < 15; l += 2)
202 uint32_t bytesReq = 0;
217 bool allocationResult =
225 Ptr<SatTbtpMessage> tptp = CreateObject<SatTbtpMessage>();
227 tbtpContainer.push_back(tptp);
234 TracedCallback<uint32_t>(),
235 TracedCallback<uint32_t, uint32_t>(),
236 TracedCallback<uint32_t, double>());
251 tbtpContainer.clear();
252 tptp = CreateObject<SatTbtpMessage>();
253 tbtpContainer.push_back(tptp);
254 utAllocContainer.clear();
260 TracedCallback<uint32_t>(),
261 TracedCallback<uint32_t, uint32_t>(),
262 TracedCallback<uint32_t, double>());
280 for (uint32_t i = 0; i < 1000; i++)
282 for (uint32_t m = 2; m < 4; m++)
284 uint32_t bytesReq = 0;
285 uint32_t divider =
m_frameConf->GetCarrierMinPayloadInBytes() * 2;
288 std::rand() % divider,
289 std::rand() % divider,
290 std::rand() % divider,
291 std::rand() % divider,
293 (
bool)std::rand() % 2);
311 Ptr<SatTbtpMessage> tptp = CreateObject<SatTbtpMessage>();
313 tbtpContainer.push_back(tptp);
320 TracedCallback<uint32_t>(),
321 TracedCallback<uint32_t, uint32_t>(),
322 TracedCallback<uint32_t, double>());
336 tbtpContainer.clear();
337 tptp = CreateObject<SatTbtpMessage>();
338 tbtpContainer.push_back(tptp);
339 utAllocContainer.clear();
345 TracedCallback<uint32_t>(),
346 TracedCallback<uint32_t, uint32_t>(),
347 TracedCallback<uint32_t, double>());
362 Simulator::Destroy();
373 bool rcBasedAllocation,
377 uint16_t slotCount =
m_frameConf->GetTimeSlotCount();
378 uint16_t carrierCount =
m_frameConf->GetCarrierCount();
379 uint16_t slotsPerCarrier = slotCount / carrierCount;
380 uint32_t minCarrierBytes =
m_frameConf->GetCarrierMinPayloadInBytes();
382 uint32_t tbtpAllocatedBytes = 0;
383 uint32_t slotsAllocated = 0;
385 for (SatFrameAllocator::TbtpMsgContainer_t::const_iterator it = tbtpContainer.begin();
386 it != tbtpContainer.end();
391 for (SatTbtpMessage::DaTimeSlotConfContainer_t::const_iterator it2 = info.second.begin();
392 it2 != info.second.end();
395 tbtpAllocatedBytes +=
m_frameConf->GetWaveformConf()
396 ->GetWaveform((*it2)->GetWaveFormId())
397 ->GetPayloadInBytes();
400 slotsAllocated += info.second.size();
404 if (slotsAllocated > 0)
406 NS_TEST_ASSERT_MSG_EQ(utAllocContainer.at(req.
m_address).second,
408 "Control slot generation what expected!");
411 uint32_t utAllocContainerBytes = 0;
413 for (uint32_t i = 0; i < utAllocContainer.at(req.
m_address).first.size(); i++)
415 utAllocContainerBytes += utAllocContainer.at(req.
m_address).first.at(i);
420 NS_TEST_ASSERT_MSG_EQ(tbtpAllocatedBytes,
421 utAllocContainerBytes,
422 " TBTP bytes=" << tbtpAllocatedBytes
423 <<
", UT bytes=" << utAllocContainerBytes);
424 NS_ASSERT(tbtpAllocatedBytes == utAllocContainerBytes);
426 bool minBytesAllocated =
427 (utAllocContainerBytes >= std::min<uint32_t>(bytesReq, minCarrierBytes));
429 NS_TEST_ASSERT_MSG_EQ(minBytesAllocated,
true,
"Minimum bytes not allocated!");
430 NS_ASSERT(minBytesAllocated ==
true);
434 NS_TEST_ASSERT_MSG_EQ(utAllocContainer.empty(),
true,
"No allocations expected!");
435 NS_ASSERT(utAllocContainer.empty() ==
true);
438 uint32_t slotsExpected = 0;
443 std::ceil((
double)bytesReq / (
double)minCarrierBytes * (
double)slotsPerCarrier);
450 slotsExpected = std::min<uint32_t>(slotsExpected, slotsPerCarrier);
454 bool onlyCraRequested =
true;
456 for (uint32_t i = 0; i < req.
m_reqPerRc.size(); i++)
461 onlyCraRequested =
false;
466 (onlyCraRequested ==
false))
468 slotsExpected = slotsPerCarrier;
482 NS_TEST_ASSERT_MSG_EQ(slotsAllocated,
484 " slots allocated= " << slotsAllocated
485 <<
", slots expected= " << slotsExpected);
489 if (slotsExpected > 0)
491 NS_TEST_ASSERT_MSG_GT(slotsAllocated,
493 " slots allocated= " << slotsAllocated
494 <<
", at least one expected.");
498 NS_TEST_ASSERT_MSG_EQ(slotsAllocated,
500 " slots allocated= " << slotsAllocated
501 <<
", slots expected= " << slotsExpected);
514 uint32_t utBytesReq[6];
524 uint32_t waveformId[6];
525 double cnoThreshold = std::numeric_limits<double>::quiet_NaN();
527 for (uint32_t i = 0; i < 6; i++)
530 m_frameAllocator->GetBestWaveform(req[i].m_cno, waveformId[i], cnoThreshold);
533 bool allocationResult;
536 for (uint32_t n = 0; n < 5; n++)
538 for (uint32_t m = n + 1; m < 6; m++)
547 NS_TEST_ASSERT_MSG_EQ(
true, allocationResult,
"Allocation failed!");
551 NS_TEST_ASSERT_MSG_EQ(
true, allocationResult,
"Allocation failed!");
555 Ptr<SatTbtpMessage> tptp = CreateObject<SatTbtpMessage>();
557 tbtpContainer.push_back(tptp);
564 TracedCallback<uint32_t>(),
565 TracedCallback<uint32_t, uint32_t>(),
566 TracedCallback<uint32_t, double>());
570 std::make_pair(req[n].m_address, std::make_pair(req[n], utBytesReq[n])));
572 std::make_pair(req[m].m_address, std::make_pair(req[m], utBytesReq[m])));
580 for (uint32_t n = 0; n < 4; n++)
582 for (uint32_t m = n + 1; m < 5; m++)
584 for (uint32_t o = m + 2; o < 6; o++)
591 NS_TEST_ASSERT_MSG_EQ(
true, allocationResult,
"Allocation failed!");
596 NS_TEST_ASSERT_MSG_EQ(
true, allocationResult,
"Allocation failed!");
601 NS_TEST_ASSERT_MSG_EQ(
true, allocationResult,
"Allocation failed!");
605 Ptr<SatTbtpMessage> tptp = CreateObject<SatTbtpMessage>();
607 tbtpContainer.push_back(tptp);
614 TracedCallback<uint32_t>(),
615 TracedCallback<uint32_t, uint32_t>(),
616 TracedCallback<uint32_t, double>());
620 std::make_pair(req[n].m_address, std::make_pair(req[n], utBytesReq[n])));
622 std::make_pair(req[m].m_address, std::make_pair(req[m], utBytesReq[m])));
624 std::make_pair(req[m].m_address, std::make_pair(req[o], utBytesReq[o])));
637 uint16_t carrierCount =
m_frameConf->GetCarrierCount();
638 uint32_t minCarrierBytes =
m_frameConf->GetCarrierMinPayloadInBytes();
640 for (SatFrameAllocator::UtAllocInfoContainer_t::const_iterator it = utAllocContainer.begin();
641 it != utAllocContainer.end();
644 uint32_t bytesAllocated = 0;
646 for (std::vector<uint32_t>::const_iterator it2 = it->second.first.begin();
647 it2 != it->second.first.end();
650 bytesAllocated += *it2;
654 if (utAllocContainer.size() > carrierCount)
656 NS_TEST_ASSERT_MSG_GT(bytesAllocated, 0,
"Allocation not what expected!");
658 else if (reqInfo.at(it->first).second == minCarrierBytes)
660 NS_TEST_ASSERT_MSG_EQ(minCarrierBytes, bytesAllocated,
"Allocation not what expected!");
664 NS_TEST_ASSERT_MSG_NE(minCarrierBytes, bytesAllocated,
"Allocation not what expected!");
672 uint32_t minRbdcBytes,
685 req.
m_address = Mac48Address::Allocate();
697 uint32_t craBytesReq = 0;
700 uint32_t maxCraBytes =
m_frameConf->GetCarrierMinPayloadInBytes();
701 uint32_t minCarrierBytes = maxCraBytes;
705 maxCraBytes -=
m_frameAllocator->GetMostRobustWaveform()->GetPayloadInBytes();
708 if (craBytesReq < maxCraBytes)
710 uint32_t craBytesLeft = maxCraBytes - craBytesReq;
712 std::min<uint32_t>(minCarrierBytes * craBytes / 10, craBytesLeft);
719 req.
m_reqPerRc[0].m_minRbdcBytes = minCarrierBytes * minRbdcBytes / 10;
720 req.
m_reqPerRc[0].m_rbdcBytes = minCarrierBytes * rbdcBytes / 10;
721 req.
m_reqPerRc[0].m_vbdcBytes = minCarrierBytes * vbdcBytes / 10;
734 uint32_t divider = minCarrierBytes + 1;
737 for (uint32_t i = 1; i < rcCount; i++)
739 if (craBytesReq < maxCraBytes)
741 uint32_t craBytesLeft = maxCraBytes - craBytesReq;
742 req.
m_reqPerRc[i].m_craBytes = std::min<uint32_t>(std::rand() % divider, craBytesLeft);
749 req.
m_reqPerRc[i].m_minRbdcBytes = std::rand() % divider;
750 req.
m_reqPerRc[i].m_rbdcBytes = std::rand() % divider;
751 req.
m_reqPerRc[i].m_vbdcBytes = std::rand() % divider;
void CheckSingleUtTestResults(uint32_t bytesReq, SatFrameAllocator::SatFrameAllocReq req, bool allocated, SatSuperframeConf::ConfigType_t configType, SatFrameAllocator::TbtpMsgContainer_t &tbtpContainer, SatFrameAllocator::UtAllocInfoContainer_t &utAllocContainer, bool rcBasedAllocation, bool fcaEnabled, bool acmEnabled)