260 const std::vector<MHz_u>& centerFrequencies,
263 MHz_u guardBandwidth,
267 const std::vector<bool>& puncturedSubchannels)
270 (channelWidth == 160 && centerFrequencies.size() <= 2),
271 "PSD for non-contiguous channels is only possible when the total width is 160 "
272 "MHz and cannot be made of more than 2 segments");
274 << channelWidth << txPower << guardBandwidth << minInnerBand << minOuterBand
276 const Hz_u carrierSpacing = 312500;
278 GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth));
281 guardBandwidth /= centerFrequencies.size();
282 const auto nGuardBands =
283 static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
284 const auto nAllocatedBands =
285 static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
286 const auto separationWidth = std::abs(centerFrequencies.back() - centerFrequencies.front());
287 const auto unallocatedWidth = separationWidth > 0 ? (separationWidth - (channelWidth / 2)) : 0;
288 const auto nUnallocatedBands =
289 static_cast<uint32_t>(((unallocatedWidth * 1e6) / carrierSpacing) + 0.5);
291 (nAllocatedBands + nGuardBands + nUnallocatedBands + 1),
292 "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
293 std::size_t num20MhzBands = channelWidth / 20;
294 std::size_t numAllocatedSubcarriersPer20MHz = 52;
295 NS_ASSERT(puncturedSubchannels.empty() || (puncturedSubchannels.size() == num20MhzBands));
296 const auto txPowerPerBand = (txPower / numAllocatedSubcarriersPer20MHz) / num20MhzBands;
297 NS_LOG_DEBUG(
"Power per band " << txPowerPerBand <<
"W");
299 std::size_t numSubcarriersPer20MHz = (20 * 1e6) / carrierSpacing;
300 std::size_t numUnallocatedSubcarriersPer20MHz =
301 numSubcarriersPer20MHz - numAllocatedSubcarriersPer20MHz;
302 std::vector<std::vector<WifiSpectrumBandIndices>> subBandsPerSegment(
303 centerFrequencies.size());
304 for (std::size_t i = 0; i < centerFrequencies.size(); ++i)
306 subBandsPerSegment.at(i).resize(
307 num20MhzBands * 2 / centerFrequencies.size());
310 std::vector<std::vector<WifiSpectrumBandIndices>> puncturedBandsPerSegment;
311 uint32_t start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2);
314 for (
auto& subBands : subBandsPerSegment)
316 puncturedBandsPerSegment.emplace_back();
317 for (
auto it = subBands.begin(); it != subBands.end();)
319 stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
320 *it = std::make_pair(start, stop);
324 stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
325 *it = std::make_pair(start, stop);
327 start = stop + numUnallocatedSubcarriersPer20MHz;
329 if (!puncturedSubchannels.empty() && puncturedSubchannels.at(index++))
331 puncturedBandsPerSegment.back().emplace_back(puncturedStart, puncturedStop);
334 start += nUnallocatedBands;
338 auto innerSlopeWidth =
static_cast<uint32_t>(
339 (2e6 / carrierSpacing) +
342 const auto puncturedSlopeWidth =
343 static_cast<uint32_t>((500e3 / carrierSpacing) +
356 puncturedBandsPerSegment,
357 puncturedSlopeWidth);
475 const std::vector<MHz_u>& centerFrequencies,
478 MHz_u guardBandwidth,
482 const std::vector<bool>& puncturedSubchannels)
485 centerFrequencies.size() == 1 || channelWidth == 160,
486 "PSD for non-contiguous channels is only possible when the total width is 160 MHz");
488 << channelWidth << txPower << guardBandwidth << minInnerBand << minOuterBand
490 const Hz_u carrierSpacing = 78125;
492 GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth));
495 guardBandwidth /= centerFrequencies.size();
496 const auto nGuardBands =
497 static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
498 const auto separationWidth = std::abs(centerFrequencies.back() - centerFrequencies.front());
499 const auto unallocatedWidth = separationWidth > 0 ? (separationWidth - (channelWidth / 2)) : 0;
500 const auto nUnallocatedBands =
501 static_cast<uint32_t>(((unallocatedWidth * 1e6) / carrierSpacing) + 0.5);
502 const auto nAllocatedBands =
503 static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
505 (nAllocatedBands + nGuardBands + nUnallocatedBands + 1),
506 "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
507 Watt_u txPowerPerBand = 0.0;
517 auto innerSlopeWidth =
static_cast<uint32_t>(
518 (1e6 / carrierSpacing) + 0.5);
519 std::vector<std::vector<WifiSpectrumBandIndices>> subBandsPerSegment(
520 centerFrequencies.size());
522 switch (
static_cast<uint16_t
>(channelWidth))
526 txPowerPerBand = txPower / 242;
528 static_cast<uint32_t>((5e5 / carrierSpacing) + 0.5);
532 start1 = (nGuardBands / 2) + 6;
533 stop1 = start1 + 121 - 1;
535 stop2 = start2 + 121 - 1;
536 subBandsPerSegment.at(0).emplace_back(start1, stop1);
537 subBandsPerSegment.at(0).emplace_back(start2, stop2);
541 txPowerPerBand = txPower / 484;
545 start1 = (nGuardBands / 2) + 12;
546 stop1 = start1 + 242 - 1;
548 stop2 = start2 + 242 - 1;
549 subBandsPerSegment.at(0).emplace_back(start1, stop1);
550 subBandsPerSegment.at(0).emplace_back(start2, stop2);
554 txPowerPerBand = txPower / 996;
558 start1 = (nGuardBands / 2) + 12;
559 stop1 = start1 + 498 - 1;
561 stop2 = start2 + 498 - 1;
562 subBandsPerSegment.at(0).emplace_back(start1, stop1);
563 subBandsPerSegment.at(0).emplace_back(start2, stop2);
567 "It is not possible to create a PSD made of more than 2 segments for a width "
570 txPowerPerBand = txPower / (2 * 996);
571 start1 = (nGuardBands / 2) + 12;
572 stop1 = start1 + 498 - 1;
574 stop2 = start2 + 498 - 1;
575 start3 = stop2 + (2 * 12) + nUnallocatedBands;
576 stop3 = start3 + 498 - 1;
578 stop4 = start4 + 498 - 1;
579 subBandsPerSegment.at(0).emplace_back(start1, stop1);
580 subBandsPerSegment.at(0).emplace_back(start2, stop2);
581 subBandsPerSegment.at(subBandsPerSegment.size() - 1).emplace_back(start3, stop3);
582 subBandsPerSegment.at(subBandsPerSegment.size() - 1).emplace_back(start4, stop4);
586 NS_FATAL_ERROR(
"ChannelWidth " << channelWidth <<
" unsupported");
591 auto puncturedSlopeWidth =
592 static_cast<uint32_t>((500e3 / carrierSpacing) +
594 std::vector<std::vector<WifiSpectrumBandIndices>> puncturedBandsPerSegment;
595 std::size_t subcarriersPerSuband = (20 * 1e6 / carrierSpacing);
597 uint32_t stop = start + subcarriersPerSuband - 1;
598 if (!puncturedSubchannels.empty())
600 for (std::size_t i = 0; i < subBandsPerSegment.size(); ++i)
602 puncturedBandsPerSegment.emplace_back();
605 std::size_t prevPsdIndex = 0;
606 for (std::size_t i = 0; i < puncturedSubchannels.size(); ++i)
608 std::size_t psdIndex = (puncturedBandsPerSegment.size() == 1)
610 : ((i < (puncturedSubchannels.size() / 2)) ? 0 : 1);
611 if (psdIndex != prevPsdIndex)
613 start += nUnallocatedBands;
614 stop += nUnallocatedBands;
616 if (puncturedSubchannels.at(i))
618 puncturedBandsPerSegment.at(psdIndex).emplace_back(start, stop);
621 stop = start + subcarriersPerSuband - 1;
622 prevPsdIndex = psdIndex;
635 puncturedBandsPerSegment,
636 puncturedSlopeWidth);
688 const std::vector<std::vector<WifiSpectrumBandIndices>>& allocatedSubBandsPerSegment,
696 const std::vector<std::vector<WifiSpectrumBandIndices>>& puncturedBandsPerSegment,
700 "Only PSDs for up to 2 frequency segments are supported");
701 NS_ASSERT(puncturedBandsPerSegment.empty() ||
702 (puncturedBandsPerSegment.size() == allocatedSubBandsPerSegment.size()));
704 << allocatedSubBandsPerSegment.front().back().second << maskBand.first
705 << maskBand.second << txPowerPerBand << nGuardBands << innerSlopeWidth
706 << minInnerBand << minOuterBand << lowestPoint << puncturedSlopeWidth);
707 uint32_t numSubBands = allocatedSubBandsPerSegment.front().size();
708 uint32_t numBands = c->GetSpectrumModel()->GetNumBands();
709 uint32_t numMaskBands = maskBand.second - maskBand.first + 1;
710 NS_ASSERT(numSubBands && numBands && numMaskBands);
711 NS_LOG_LOGIC(
"Power per band " << txPowerPerBand <<
"W");
714 dBm_u txPowerRef = (10.0 * std::log10(txPowerPerBand * 1000.0));
715 dBm_u txPowerInnerBandMin = txPowerRef + minInnerBand;
716 dBm_u txPowerMiddleBandMin = txPowerRef + minOuterBand;
717 dBm_u txPowerOuterBandMin =
718 txPowerRef + lowestPoint;
724 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2);
726 std::vector<WifiSpectrumBandIndices> outerBandsLeft;
727 std::vector<WifiSpectrumBandIndices> middleBandsLeft;
728 std::vector<WifiSpectrumBandIndices> flatJunctionsLeft;
729 std::vector<WifiSpectrumBandIndices> innerBandsLeft;
730 std::vector<WifiSpectrumBandIndices> allocatedSubBands;
731 std::vector<WifiSpectrumBandIndices> innerBandsRight;
732 std::vector<WifiSpectrumBandIndices> flatJunctionsRight;
733 std::vector<WifiSpectrumBandIndices> middleBandsRight;
734 std::vector<WifiSpectrumBandIndices> outerBandsRight;
735 std::optional<WifiSpectrumBandIndices> betweenPsdsBand;
737 allocatedSubBands.emplace_back(allocatedSubBandsPerSegment.front().front().first,
738 allocatedSubBandsPerSegment.front().back().second);
739 outerBandsLeft.emplace_back(maskBand.first,
741 maskBand.first + outerSlopeWidth - 1);
742 middleBandsLeft.emplace_back(outerBandsLeft.front().second + 1,
743 outerBandsLeft.front().second + middleSlopeWidth);
744 innerBandsLeft.emplace_back(allocatedSubBands.front().first - innerSlopeWidth,
745 allocatedSubBands.front().first -
747 flatJunctionsLeft.emplace_back(middleBandsLeft.front().second + 1,
748 innerBandsLeft.front().first -
751 flatJunctionsLeft.front().second - flatJunctionsLeft.front().first + 1;
752 innerBandsRight.emplace_back(allocatedSubBands.front().second + 1,
753 allocatedSubBands.front().second + innerSlopeWidth);
754 flatJunctionsRight.emplace_back(innerBandsRight.front().second + 1,
755 innerBandsRight.front().second + flatJunctionWidth);
756 middleBandsRight.emplace_back(flatJunctionsRight.front().second + 1,
757 flatJunctionsRight.front().second + middleSlopeWidth);
758 outerBandsRight.emplace_back(middleBandsRight.front().second + 1,
759 middleBandsRight.front().second + outerSlopeWidth);
761 if (allocatedSubBandsPerSegment.size() > 1)
763 const auto offset = (((allocatedSubBandsPerSegment.front().back().second -
764 allocatedSubBandsPerSegment.front().front().first) /
766 (allocatedSubBandsPerSegment.back().front().first -
767 allocatedSubBandsPerSegment.front().back().second) +
768 ((allocatedSubBandsPerSegment.back().back().second -
769 allocatedSubBandsPerSegment.back().front().first) /
771 outerBandsLeft.emplace_back(outerBandsLeft.front().first + offset,
772 outerBandsLeft.front().second + offset);
773 middleBandsLeft.emplace_back(middleBandsLeft.front().first + offset,
774 middleBandsLeft.front().second + offset);
775 flatJunctionsLeft.emplace_back(flatJunctionsLeft.front().first + offset,
776 flatJunctionsLeft.front().second + offset);
777 innerBandsLeft.emplace_back(innerBandsLeft.front().first + offset,
778 innerBandsLeft.front().second + offset);
779 allocatedSubBands.emplace_back(allocatedSubBands.front().first + offset,
780 allocatedSubBands.front().second + offset);
781 innerBandsRight.emplace_back(innerBandsRight.front().first + offset,
782 innerBandsRight.front().second + offset);
783 flatJunctionsRight.emplace_back(flatJunctionsRight.front().first + offset,
784 flatJunctionsRight.front().second + offset);
785 middleBandsRight.emplace_back(middleBandsRight.front().first + offset,
786 middleBandsRight.front().second + offset);
787 outerBandsRight.emplace_back(outerBandsRight.front().first + offset,
788 outerBandsRight.front().second + offset);
789 betweenPsdsBand.emplace(middleBandsRight.front().first, middleBandsLeft.back().second);
792 std::ostringstream ss;
793 for (std::size_t i = 0; i < allocatedSubBandsPerSegment.size(); ++i)
795 if (allocatedSubBandsPerSegment.size() > 1)
797 ss <<
"PSD" << i + 1 <<
": ";
799 ss <<
"outerBandLeft=[" << outerBandsLeft.at(i).first <<
";" << outerBandsLeft.at(i).second
801 <<
"middleBandLeft=[" << middleBandsLeft.at(i).first <<
";"
802 << middleBandsLeft.at(i).second <<
"] "
803 <<
"flatJunctionLeft=[" << flatJunctionsLeft.at(i).first <<
";"
804 << flatJunctionsLeft.at(i).second <<
"] "
805 <<
"innerBandLeft=[" << innerBandsLeft.at(i).first <<
";" << innerBandsLeft.at(i).second
807 <<
"allocatedBand=[" << allocatedSubBands.at(i).first <<
";"
808 << allocatedSubBands.at(i).second <<
"] ";
809 if (!puncturedBandsPerSegment.empty() && !puncturedBandsPerSegment.at(i).empty())
811 ss <<
"puncturedBands=[" << puncturedBandsPerSegment.at(i).front().first <<
";"
812 << puncturedBandsPerSegment.at(i).back().second <<
"] ";
814 ss <<
"innerBandRight=[" << innerBandsRight.at(i).first <<
";"
815 << innerBandsRight.at(i).second <<
"] "
816 <<
"flatJunctionRight=[" << flatJunctionsRight.at(i).first <<
";"
817 << flatJunctionsRight.at(i).second <<
"] "
818 <<
"middleBandRight=[" << middleBandsRight.at(i).first <<
";"
819 << middleBandsRight.at(i).second <<
"] "
820 <<
"outerBandRight=[" << outerBandsRight.at(i).first <<
";"
821 << outerBandsRight.at(i).second <<
"] ";
823 if (allocatedSubBandsPerSegment.size() > 1)
826 <<
"outerBandLeft=[" << outerBandsLeft.front().first <<
";"
827 << outerBandsLeft.front().second <<
"] "
828 <<
"middleBandLeft=[" << middleBandsLeft.front().first <<
";"
829 << middleBandsLeft.front().second <<
"] "
830 <<
"flatJunctionLeft=[" << flatJunctionsLeft.front().first <<
";"
831 << flatJunctionsLeft.front().second <<
"] "
832 <<
"innerBandLeft=[" << innerBandsLeft.front().first <<
";"
833 << innerBandsLeft.front().second <<
"] "
834 <<
"allocatedBandInPsd1=[" << allocatedSubBands.front().first <<
";"
835 << allocatedSubBands.front().second <<
"] ";
836 if (!puncturedBandsPerSegment.empty() && !puncturedBandsPerSegment.front().empty())
838 ss <<
"puncturedBandsInPsd1=[" << puncturedBandsPerSegment.front().front().first <<
";"
839 << puncturedBandsPerSegment.front().back().second <<
"] ";
841 ss <<
"flatJunctionRightPsd1=[" << flatJunctionsRight.front().first <<
";"
842 << flatJunctionsRight.front().second <<
"] "
843 <<
"linearSum=[" << betweenPsdsBand->first <<
";" << betweenPsdsBand->second <<
"] "
844 <<
"flatJunctionLeftPsd2=[" << flatJunctionsLeft.back().first <<
";"
845 << flatJunctionsLeft.back().second <<
"] "
846 <<
"innerBandLeftPsd2=[" << innerBandsLeft.back().first <<
";"
847 << innerBandsLeft.back().second <<
"] "
848 <<
"allocatedBandInPsd2=[" << allocatedSubBands.back().first <<
";"
849 << allocatedSubBands.back().second <<
"] ";
850 if (!puncturedBandsPerSegment.empty() && !puncturedBandsPerSegment.back().empty())
852 ss <<
"puncturedBandsInPsd2=[" << puncturedBandsPerSegment.back().front().first <<
";"
853 << puncturedBandsPerSegment.back().back().second <<
"] ";
855 ss <<
"innerBandRight=[" << innerBandsRight.back().first <<
";"
856 << innerBandsRight.back().second <<
"] "
857 <<
"flatJunctionRight=[" << flatJunctionsRight.back().first <<
";"
858 << flatJunctionsRight.back().second <<
"] "
859 <<
"middleBandRight=[" << middleBandsRight.back().first <<
";"
860 << middleBandsRight.back().second <<
"] "
861 <<
"outerBandRight=[" << outerBandsRight.back().first <<
";"
862 << outerBandsRight.back().second <<
"] ";
865 NS_ASSERT(maskBand.second == outerBandsRight.back().second);
867 ((allocatedSubBandsPerSegment.back().back().second -
868 allocatedSubBandsPerSegment.front().front().first +
870 + 2 * (innerSlopeWidth + middleSlopeWidth + outerSlopeWidth + flatJunctionWidth)));
873 double innerSlope = (-1.0 * minInnerBand) / innerSlopeWidth;
874 double middleSlope = (-1.0 * (minOuterBand - minInnerBand)) / middleSlopeWidth;
875 double outerSlope = (txPowerMiddleBandMin - txPowerOuterBandMin) / outerSlopeWidth;
876 double puncturedSlope = (-1.0 * minInnerBand) / puncturedSlopeWidth;
879 Watt_u previousTxPower = 0.0;
880 std::vector<Watt_u> txPowerValues(numBands);
881 NS_ASSERT(txPowerValues.size() == numBands);
882 for (
size_t i = 0; i < numBands; ++i)
885 (allocatedSubBandsPerSegment.size() == 1) ? 0 : ((i < (numBands / 2)) ? 0 : 1);
887 if (i < maskBand.first || i > maskBand.second)
891 else if (betweenPsdsBand.has_value() &&
892 (i <= betweenPsdsBand->second && i >= betweenPsdsBand->first))
895 std::vector<double> txPowerWPsds(2);
896 if (i <= middleBandsRight.at(0).second && i >= middleBandsRight.at(0).first)
899 DbmToW(txPowerInnerBandMin -
900 ((i - middleBandsRight.at(0).first + 1) *
903 else if (i <= outerBandsRight.at(0).second && i >= outerBandsRight.at(0).first)
906 DbmToW(txPowerMiddleBandMin -
907 ((i - outerBandsRight.at(0).first + 1) *
910 else if (i > outerBandsRight.at(0).second)
912 txPower =
DbmToW(txPowerOuterBandMin);
920 if (i < outerBandsLeft.at(1).first)
922 txPower =
DbmToW(txPowerOuterBandMin);
924 else if (i <= outerBandsLeft.at(1).second && i >= outerBandsLeft.at(1).first)
927 DbmToW(txPowerOuterBandMin + ((i - outerBandsLeft.at(1).first) * outerSlope));
929 else if (i <= middleBandsLeft.at(1).second && i >= middleBandsLeft.at(1).first)
931 txPowerWPsds.at(1) =
DbmToW(txPowerMiddleBandMin +
932 ((i - middleBandsLeft.at(1).first) * middleSlope));
939 txPower = std::accumulate(txPowerWPsds.cbegin(), txPowerWPsds.cend(), 0.0);
940 txPower = std::max(
DbmToW(txPowerRef - 25.0), txPower);
941 txPower = std::min(
DbmToW(txPowerRef - 20.0), txPower);
943 else if (i <= outerBandsLeft.at(psdIndex).second &&
944 i >= outerBandsLeft.at(psdIndex)
947 txPower =
DbmToW(txPowerOuterBandMin +
948 ((i - outerBandsLeft.at(psdIndex).first) * outerSlope));
950 else if (i <= middleBandsLeft.at(psdIndex).second &&
951 i >= middleBandsLeft.at(psdIndex).first)
953 txPower =
DbmToW(txPowerMiddleBandMin +
954 ((i - middleBandsLeft.at(psdIndex).first) * middleSlope));
956 else if ((i <= flatJunctionsLeft.at(psdIndex).second &&
957 i >= flatJunctionsLeft.at(psdIndex).first) ||
958 (i <= flatJunctionsRight.at(psdIndex).second &&
959 i >= flatJunctionsRight.at(psdIndex).first))
961 txPower =
DbmToW(txPowerInnerBandMin);
963 else if (i <= innerBandsLeft.at(psdIndex).second && i >= innerBandsLeft.at(psdIndex).first)
965 txPower = (!puncturedBandsPerSegment.empty() &&
966 !puncturedBandsPerSegment.at(psdIndex).empty() &&
967 (puncturedBandsPerSegment.at(psdIndex).front().first <=
968 allocatedSubBandsPerSegment.at(psdIndex).front().first))
969 ?
DbmToW(txPowerInnerBandMin)
971 DbmToW(txPowerInnerBandMin +
972 ((i - innerBandsLeft.at(psdIndex).first) * innerSlope));
974 else if ((i <= allocatedSubBandsPerSegment.at(psdIndex).back().second &&
975 i >= allocatedSubBandsPerSegment.at(psdIndex).front().first))
978 bool insideSubBand =
false;
979 for (
uint32_t j = 0; !insideSubBand && j < numSubBands;
982 insideSubBand = (i <= allocatedSubBandsPerSegment.at(psdIndex)[j].second) &&
983 (i >= allocatedSubBandsPerSegment.at(psdIndex)[j].first);
987 bool insidePuncturedSubBand =
false;
989 std::size_t puncturedBandSize = !puncturedBandsPerSegment.empty()
990 ? puncturedBandsPerSegment.at(psdIndex).size()
992 for (; !insidePuncturedSubBand && j < puncturedBandSize;
995 insidePuncturedSubBand =
996 (i <= puncturedBandsPerSegment.at(psdIndex).at(j).second) &&
997 (i >= puncturedBandsPerSegment.at(psdIndex).at(j).first);
999 if (insidePuncturedSubBand)
1002 (puncturedBandsPerSegment.at(psdIndex)
1003 .at(puncturedBandsPerSegment.at(psdIndex).size() - 1)
1005 puncturedSlopeWidth);
1006 if (i >= startPuncturedSlope)
1008 txPower =
DbmToW(txPowerInnerBandMin +
1009 ((i - startPuncturedSlope) * puncturedSlope));
1014 DbmToW(txPowerInnerBandMin),
1016 ((i - puncturedBandsPerSegment.at(psdIndex).at(0).first) *
1022 txPower = txPowerPerBand;
1027 txPower =
DbmToW(txPowerInnerBandMin);
1030 else if (i <= innerBandsRight.at(psdIndex).second &&
1031 i >= innerBandsRight.at(psdIndex).first)
1036 DbmToW(txPowerRef - ((i - innerBandsRight.at(psdIndex).first + 1) *
1039 else if (i <= middleBandsRight.at(psdIndex).second &&
1040 i >= middleBandsRight.at(psdIndex).first)
1042 txPower =
DbmToW(txPowerInnerBandMin -
1043 ((i - middleBandsRight.at(psdIndex).first + 1) *
1046 else if (i <= outerBandsRight.at(psdIndex).second &&
1047 i >= outerBandsRight.at(psdIndex).first)
1049 txPower =
DbmToW(txPowerMiddleBandMin -
1050 ((i - outerBandsRight.at(psdIndex).first + 1) *
1057 NS_LOG_LOGIC(i <<
" -> " << (10 * std::log10(txPower / txPowerPerBand)));
1058 previousTxPower = txPower;
1059 txPowerValues.at(i) = txPower;
1063 auto vit = c->ValuesBegin();
1064 auto bit = c->ConstBandsBegin();
1065 const auto invBandwidth = 1 / (bit->fh - bit->fl);
1066 for (
auto txPowerValue : txPowerValues)
1068 *vit = txPowerValue * invBandwidth;
1073 for (
const auto& allocatedSubBands : allocatedSubBandsPerSegment)
1075 NS_LOG_INFO(
"Added signal power to subbands " << allocatedSubBands.front().first <<
"-"
1076 << allocatedSubBands.back().second);