26 #include "ns3/assert.h"
27 #include "ns3/fatal-error.h"
57 : m_centerFrequency(
f),
85 static std::map<WifiSpectrumModelId, Ptr<SpectrumModel>>
90 uint16_t channelWidth,
91 uint32_t bandBandwidth,
92 uint16_t guardBandwidth)
94 NS_LOG_FUNCTION(centerFrequency << channelWidth << bandBandwidth << guardBandwidth);
97 std::map<WifiSpectrumModelId, Ptr<SpectrumModel>>::iterator it =
106 double centerFrequencyHz = centerFrequency * 1e6;
107 double bandwidth = (channelWidth + (2.0 * guardBandwidth)) * 1e6;
109 uint32_t numBands =
static_cast<uint32_t
>((bandwidth / bandBandwidth) + 0.5);
111 if (numBands % 2 == 0)
117 NS_ASSERT_MSG(numBands % 2 == 1,
"Number of bands should be odd");
118 NS_LOG_DEBUG(
"Num bands " << numBands <<
" band bandwidth " << bandBandwidth);
121 double startingFrequencyHz =
122 centerFrequencyHz - (numBands / 2 * bandBandwidth) - bandBandwidth / 2;
123 for (
size_t i = 0; i < numBands; i++)
126 double f = startingFrequencyHz + (i * bandBandwidth);
128 f += bandBandwidth / 2;
130 f += bandBandwidth / 2;
132 NS_LOG_DEBUG(
"creating band " << i <<
" (" << info.
fl <<
":" << info.
fc <<
":"
134 bands.push_back(info);
136 ret = Create<SpectrumModel>(std::move(bands));
147 uint16_t guardBandwidth)
150 uint16_t channelWidth = 22;
151 uint32_t bandBandwidth = 312500;
153 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
156 uint32_t nGuardBands =
157 static_cast<uint32_t
>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5);
158 uint32_t nAllocatedBands =
static_cast<uint32_t
>(((channelWidth * 1e6) / bandBandwidth) + 0.5);
161 double txPowerPerBand = txPowerW / nAllocatedBands;
162 for (
size_t i = 0; i < c->
GetSpectrumModel()->GetNumBands(); i++, vit++, bit++)
164 if ((i >= (nGuardBands / 2)) && (i <= ((nGuardBands / 2) + nAllocatedBands - 1)))
166 *vit = txPowerPerBand / (bit->fh - bit->fl);
174 uint16_t channelWidth,
176 uint16_t guardBandwidth,
177 double minInnerBandDbr,
178 double minOuterBandDbr,
179 double lowestPointDbr)
181 NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
182 << minOuterBandDbr << lowestPointDbr);
183 uint32_t bandBandwidth = 0;
184 uint32_t innerSlopeWidth = 0;
185 switch (channelWidth)
188 bandBandwidth = 312500;
189 innerSlopeWidth =
static_cast<uint32_t
>((2e6 / bandBandwidth) + 0.5);
192 bandBandwidth = 156250;
194 static_cast<uint32_t
>((1e6 / bandBandwidth) + 0.5);
197 bandBandwidth = 78125;
199 static_cast<uint32_t
>((5e5 / bandBandwidth) + 0.5);
202 NS_FATAL_ERROR(
"Channel width " << channelWidth <<
" should be correctly set.");
207 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
208 uint32_t nGuardBands =
209 static_cast<uint32_t
>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5);
210 uint32_t nAllocatedBands =
static_cast<uint32_t
>(((channelWidth * 1e6) / bandBandwidth) + 0.5);
217 double txPowerPerBandW = txPowerW / 52;
218 NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW <<
"W");
219 uint32_t start1 = (nGuardBands / 2) + 6;
220 uint32_t stop1 = start1 + 26 - 1;
221 uint32_t start2 = stop1 + 2;
222 uint32_t stop2 = start2 + 26 - 1;
225 std::vector<WifiSpectrumBand> subBands{
226 std::make_pair(start1, stop1),
227 std::make_pair(start2, stop2),
246 uint32_t centerFrequency,
247 uint16_t channelWidth,
249 uint16_t guardBandwidth,
250 double minInnerBandDbr,
251 double minOuterBandDbr,
252 double lowestPointDbr,
253 const std::vector<bool>& puncturedSubchannels)
255 NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
256 << minOuterBandDbr << lowestPointDbr);
257 uint32_t bandBandwidth = 312500;
259 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
260 uint32_t nGuardBands =
261 static_cast<uint32_t
>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5);
262 uint32_t nAllocatedBands =
static_cast<uint32_t
>(((channelWidth * 1e6) / bandBandwidth) + 0.5);
265 std::size_t num20MhzBands = channelWidth / 20;
266 std::size_t numAllocatedSubcarriersPer20MHz = 52;
267 NS_ASSERT(puncturedSubchannels.empty() || (puncturedSubchannels.size() == num20MhzBands));
268 double txPowerPerBandW = (txPowerW / numAllocatedSubcarriersPer20MHz) / num20MhzBands;
269 NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW <<
"W");
271 std::size_t numSubcarriersPer20MHz = (20 * 1e6) / bandBandwidth;
272 std::size_t numUnallocatedSubcarriersPer20MHz =
273 numSubcarriersPer20MHz - numAllocatedSubcarriersPer20MHz;
274 std::vector<WifiSpectrumBand> subBands;
275 subBands.resize(num20MhzBands *
277 uint32_t
start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2);
280 for (
auto it = subBands.begin(); it != subBands.end();)
282 if (!puncturedSubchannels.empty() && puncturedSubchannels.at(index++))
285 NS_LOG_DEBUG(
"20 MHz subchannel " << +index <<
" is punctured");
289 stop =
start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
293 stop =
start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
296 start =
stop + numUnallocatedSubcarriersPer20MHz;
300 uint32_t innerSlopeWidth =
static_cast<uint32_t
>(
301 (2e6 / bandBandwidth) +
322 uint16_t channelWidth,
324 uint16_t guardBandwidth,
325 double minInnerBandDbr,
326 double minOuterBandDbr,
327 double lowestPointDbr)
329 NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
330 << minOuterBandDbr << lowestPointDbr);
331 uint32_t bandBandwidth = 312500;
333 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
334 uint32_t nGuardBands =
335 static_cast<uint32_t
>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5);
336 uint32_t nAllocatedBands =
static_cast<uint32_t
>(((channelWidth * 1e6) / bandBandwidth) + 0.5);
339 std::size_t num20MhzBands = channelWidth / 20;
340 std::size_t numAllocatedSubcarriersPer20MHz = 56;
341 double txPowerPerBandW = (txPowerW / numAllocatedSubcarriersPer20MHz) / num20MhzBands;
342 NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW <<
"W");
344 std::size_t numSubcarriersPer20MHz = (20 * 1e6) / bandBandwidth;
345 std::size_t numUnallocatedSubcarriersPer20MHz =
346 numSubcarriersPer20MHz - numAllocatedSubcarriersPer20MHz;
347 std::vector<WifiSpectrumBand> subBands;
348 subBands.resize(num20MhzBands *
350 uint32_t
start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2);
352 for (
auto it = subBands.begin(); it != subBands.end();)
354 stop =
start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
358 stop =
start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
361 start =
stop + numUnallocatedSubcarriersPer20MHz;
365 uint32_t innerSlopeWidth =
static_cast<uint32_t
>(
366 (2e6 / bandBandwidth) +
387 uint32_t centerFrequency,
388 uint16_t channelWidth,
390 uint16_t guardBandwidth,
391 double minInnerBandDbr,
392 double minOuterBandDbr,
393 double lowestPointDbr,
394 const std::vector<bool>& puncturedSubchannels)
396 NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
397 << minOuterBandDbr << lowestPointDbr);
398 uint32_t bandBandwidth = 78125;
400 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
401 uint32_t nGuardBands =
402 static_cast<uint32_t
>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5);
403 uint32_t nAllocatedBands =
static_cast<uint32_t
>(((channelWidth * 1e6) / bandBandwidth) + 0.5);
406 double txPowerPerBandW = 0.0;
416 uint32_t innerSlopeWidth =
static_cast<uint32_t
>(
417 (1e6 / bandBandwidth) + 0.5);
418 std::vector<WifiSpectrumBand> subBands;
420 switch (channelWidth)
424 txPowerPerBandW = txPowerW / 242;
426 static_cast<uint32_t
>((5e5 / bandBandwidth) + 0.5);
430 start1 = (nGuardBands / 2) + 6;
431 stop1 = start1 + 121 - 1;
433 stop2 = start2 + 121 - 1;
434 subBands.emplace_back(start1, stop1);
435 subBands.emplace_back(start2, stop2);
439 txPowerPerBandW = txPowerW / 484;
443 start1 = (nGuardBands / 2) + 12;
444 stop1 = start1 + 242 - 1;
446 stop2 = start2 + 242 - 1;
447 subBands.emplace_back(start1, stop1);
448 subBands.emplace_back(start2, stop2);
452 txPowerPerBandW = txPowerW / 996;
456 start1 = (nGuardBands / 2) + 12;
457 stop1 = start1 + 498 - 1;
459 stop2 = start2 + 498 - 1;
460 subBands.emplace_back(start1, stop1);
461 subBands.emplace_back(start2, stop2);
465 txPowerPerBandW = txPowerW / (2 * 996);
466 start1 = (nGuardBands / 2) + 12;
467 stop1 = start1 + 498 - 1;
469 stop2 = start2 + 498 - 1;
470 start3 = stop2 + (2 * 12);
471 stop3 = start3 + 498 - 1;
473 stop4 = start4 + 498 - 1;
474 subBands.emplace_back(start1, stop1);
475 subBands.emplace_back(start2, stop2);
476 subBands.emplace_back(start3, stop3);
477 subBands.emplace_back(start4, stop4);
480 NS_FATAL_ERROR(
"ChannelWidth " << channelWidth <<
" unsupported");
485 uint32_t puncturedSlopeWidth =
static_cast<uint32_t
>(
486 (500e3 / bandBandwidth) + 0.5);
487 std::vector<WifiSpectrumBand> puncturedBands;
488 std::size_t subcarriersPerSuband = (20 * 1e6 / bandBandwidth);
489 uint32_t
start = (nGuardBands / 2);
490 uint32_t
stop =
start + subcarriersPerSuband - 1;
491 for (
auto puncturedSubchannel : puncturedSubchannels)
493 if (puncturedSubchannel)
495 puncturedBands.emplace_back(
start,
stop);
512 puncturedSlopeWidth);
520 uint16_t channelWidth,
522 uint16_t guardBandwidth,
525 NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << ru.first
527 uint32_t bandBandwidth = 78125;
529 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth));
534 double txPowerPerBandW = (txPowerW / (ru.second - ru.first + 1));
536 for (
size_t i = 0; i < numBands; i++, vit++, bit++)
538 if (i < ru.first || i > ru.second)
544 *vit = (txPowerPerBandW / (bit->fh - bit->fl));
553 uint16_t channelWidth,
554 uint32_t bandBandwidth,
556 uint16_t guardBandwidth)
559 GetSpectrumModel(centerFrequency, channelWidth, bandBandwidth, guardBandwidth);
571 const double kT_dBm_Hz = -174.0;
572 double kT_W_Hz =
DbmToW(kT_dBm_Hz);
573 double noiseFigureLinear = std::pow(10.0, noiseFigureDb / 10.0);
574 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
577 (*noisePsd) = noisePowerSpectralDensity;
584 uint16_t totalChannelWidth,
585 uint32_t bandBandwidth,
586 uint16_t guardBandwidth,
589 uint32_t startIndex = band.first;
590 uint32_t stopIndex = band.second;
591 NS_LOG_FUNCTION(centerFrequency << totalChannelWidth << bandBandwidth << guardBandwidth
592 << startIndex << stopIndex);
594 GetSpectrumModel(centerFrequency, totalChannelWidth, bandBandwidth, guardBandwidth));
599 for (
size_t i = startIndex; i <= stopIndex; i++, vit++, bit++)
603 NS_LOG_LOGIC(
"Added subbands " << startIndex <<
" to " << stopIndex <<
" to filter");
610 const std::vector<WifiSpectrumBand>& allocatedSubBands,
612 double txPowerPerBandW,
613 uint32_t nGuardBands,
614 uint32_t innerSlopeWidth,
615 double minInnerBandDbr,
616 double minOuterBandDbr,
617 double lowestPointDbr,
618 const std::vector<WifiSpectrumBand>& puncturedBands,
619 uint32_t puncturedSlopeWidth)
621 NS_LOG_FUNCTION(c << allocatedSubBands.front().first << allocatedSubBands.back().second
622 << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBands
623 << innerSlopeWidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr
624 << puncturedSlopeWidth);
625 uint32_t numSubBands = allocatedSubBands.size();
627 uint32_t numMaskBands = maskBand.second - maskBand.first + 1;
628 NS_ASSERT(numSubBands && numBands && numMaskBands);
629 NS_LOG_LOGIC(
"Power per band " << txPowerPerBandW <<
"W");
632 double txPowerRefDbm = (10.0 * std::log10(txPowerPerBandW * 1000.0));
633 double txPowerInnerBandMinDbm = txPowerRefDbm + minInnerBandDbr;
634 double txPowerMiddleBandMinDbm = txPowerRefDbm + minOuterBandDbr;
635 double txPowerOuterBandMinDbm =
636 txPowerRefDbm + lowestPointDbr;
639 uint32_t outerSlopeWidth =
642 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2);
645 maskBand.first + outerSlopeWidth - 1);
647 outerBandLeft.second + middleSlopeWidth);
648 WifiSpectrumBand innerBandLeft(allocatedSubBands.front().first - innerSlopeWidth,
649 allocatedSubBands.front().first -
652 innerBandLeft.first -
655 maskBand.second - outerSlopeWidth + 1,
658 outerBandRight.first - 1);
660 allocatedSubBands.back().second + innerSlopeWidth);
661 WifiSpectrumBand flatJunctionRight(innerBandRight.second + 1, middleBandRight.first - 1);
662 std::ostringstream ss;
663 ss <<
"outerBandLeft=[" << outerBandLeft.first <<
";" << outerBandLeft.second <<
"] "
664 <<
"middleBandLeft=[" << middleBandLeft.first <<
";" << middleBandLeft.second <<
"] "
665 <<
"flatJunctionLeft=[" << flatJunctionLeft.first <<
";" << flatJunctionLeft.second <<
"] "
666 <<
"innerBandLeft=[" << innerBandLeft.first <<
";" << innerBandLeft.second <<
"] "
667 <<
"subBands=[" << allocatedSubBands.front().first <<
";" << allocatedSubBands.back().second
669 if (!puncturedBands.empty())
671 ss <<
"puncturedBands=[" << puncturedBands.front().first <<
";"
672 << puncturedBands.back().second <<
"] ";
674 ss <<
"innerBandRight=[" << innerBandRight.first <<
";" << innerBandRight.second <<
"] "
675 <<
"flatJunctionRight=[" << flatJunctionRight.first <<
";" << flatJunctionRight.second
677 <<
"middleBandRight=[" << middleBandRight.first <<
";" << middleBandRight.second <<
"] "
678 <<
"outerBandRight=[" << outerBandRight.first <<
";" << outerBandRight.second <<
"] ";
681 ((allocatedSubBands.back().second - allocatedSubBands.front().first +
683 + 2 * (innerSlopeWidth + middleSlopeWidth + outerSlopeWidth) +
684 (flatJunctionLeft.second - flatJunctionLeft.first + 1)
685 + (flatJunctionRight.second - flatJunctionRight.first + 1)));
688 double innerSlope = (-1 * minInnerBandDbr) / innerSlopeWidth;
689 double middleSlope = (-1 * (minOuterBandDbr - minInnerBandDbr)) / middleSlopeWidth;
690 double outerSlope = (txPowerMiddleBandMinDbm - txPowerOuterBandMinDbm) / outerSlopeWidth;
691 double puncturedSlope = (-1 * minInnerBandDbr) / puncturedSlopeWidth;
696 double txPowerW = 0.0;
697 double previousTxPowerW = 0.0;
698 for (
size_t i = 0; i < numBands; i++, vit++, bit++)
700 if (i < maskBand.first || i > maskBand.second)
704 else if (i <= outerBandLeft.second &&
705 i >= outerBandLeft.first)
707 txPowerW =
DbmToW(txPowerOuterBandMinDbm + ((i - outerBandLeft.first) * outerSlope));
709 else if (i <= middleBandLeft.second && i >= middleBandLeft.first)
711 txPowerW =
DbmToW(txPowerMiddleBandMinDbm + ((i - middleBandLeft.first) * middleSlope));
713 else if (i <= flatJunctionLeft.second && i >= flatJunctionLeft.first)
715 txPowerW =
DbmToW(txPowerInnerBandMinDbm);
717 else if (i <= innerBandLeft.second && i >= innerBandLeft.first)
720 (!puncturedBands.empty() &&
721 (puncturedBands.front().first <= allocatedSubBands.front().first))
722 ?
DbmToW(txPowerInnerBandMinDbm)
724 DbmToW(txPowerInnerBandMinDbm + ((i - innerBandLeft.first) * innerSlope));
726 else if (i <= allocatedSubBands.back().second &&
727 i >= allocatedSubBands.front().first)
729 bool insideSubBand =
false;
730 for (uint32_t j = 0; !insideSubBand && j < numSubBands;
734 (i <= allocatedSubBands[j].second) && (i >= allocatedSubBands[j].
first);
738 bool insidePuncturedSubBand =
false;
740 for (; !insidePuncturedSubBand && j < puncturedBands.size();
743 insidePuncturedSubBand =
744 (i <= puncturedBands[j].second) && (i >= puncturedBands[j].
first);
746 if (insidePuncturedSubBand)
748 uint32_t startPuncturedSlope =
749 (puncturedBands[puncturedBands.size() - 1].second -
750 puncturedSlopeWidth);
751 if (i >= startPuncturedSlope)
753 txPowerW =
DbmToW(txPowerInnerBandMinDbm +
754 ((i - startPuncturedSlope) * puncturedSlope));
759 DbmToW(txPowerRefDbm - ((i - puncturedBands[0].
first) *
765 txPowerW = txPowerPerBandW;
770 txPowerW =
DbmToW(txPowerInnerBandMinDbm);
773 else if (i <= innerBandRight.second && i >= innerBandRight.first)
778 DbmToW(txPowerRefDbm - ((i - innerBandRight.first + 1) *
781 else if (i <= flatJunctionRight.second && i >= flatJunctionRight.first)
783 txPowerW =
DbmToW(txPowerInnerBandMinDbm);
785 else if (i <= middleBandRight.second && i >= middleBandRight.first)
787 txPowerW =
DbmToW(txPowerInnerBandMinDbm -
788 ((i - middleBandRight.first + 1) *
791 else if (i <= outerBandRight.second && i >= outerBandRight.first)
793 txPowerW =
DbmToW(txPowerMiddleBandMinDbm -
794 ((i - outerBandRight.first + 1) *
801 double txPowerDbr = 10 * std::log10(txPowerW / txPowerPerBandW);
803 *vit = txPowerW / (bit->fh - bit->fl);
804 previousTxPowerW = txPowerW;
806 NS_LOG_INFO(
"Added signal power to subbands " << allocatedSubBands.front().first <<
"-"
807 << allocatedSubBands.back().second);
815 double currentTxPowerW =
Integral(*c);
816 double normalizationRatio = currentTxPowerW / txPowerW;
817 NS_LOG_LOGIC(
"Current power: " << currentTxPowerW <<
"W vs expected power: " << txPowerW <<
"W"
818 <<
" -> ratio (C/E) = " << normalizationRatio);
822 *vit = (*vit) / normalizationRatio;
829 return std::pow(10.0, 0.1 * (dBm - 30.0));
835 double powerWattPerHertz = 0.0;
839 while (valueIt <= end)
841 powerWattPerHertz += *valueIt;
844 return powerWattPerHertz * (bandIt->fh - bandIt->fl);
866 for (
int i = -4; i < 13 + 7; i++)
869 bi.
fl = 2407.0e6 + i * 5.0e6;
870 bi.
fh = 2407.0e6 + (i + 1) * 5.0e6;
871 bi.
fc = (bi.
fl + bi.
fh) / 2;
898 double txPowerDensity = txPower / 20e6;
903 (*txPsd)[
channel - 1] = txPowerDensity * 1e-4;
904 (*txPsd)[
channel] = txPowerDensity * 1e-4;
905 (*txPsd)[
channel + 1] = txPowerDensity * 0.0015849;
906 (*txPsd)[
channel + 2] = txPowerDensity * 0.0015849;
907 (*txPsd)[
channel + 3] = txPowerDensity;
908 (*txPsd)[
channel + 4] = txPowerDensity;
909 (*txPsd)[
channel + 5] = txPowerDensity;
910 (*txPsd)[
channel + 6] = txPowerDensity;
911 (*txPsd)[
channel + 7] = txPowerDensity * 0.0015849;
912 (*txPsd)[
channel + 8] = txPowerDensity * 0.0015849;
913 (*txPsd)[
channel + 9] = txPowerDensity * 1e-4;
914 (*txPsd)[
channel + 10] = txPowerDensity * 1e-4;
double f(double x, void *params)
size_t GetNumBands() const
SpectrumModelUid_t GetUid() const
Values::const_iterator ConstValuesBegin() const
Values::iterator ValuesBegin()
Bands::const_iterator ConstBandsBegin() const
Ptr< const SpectrumModel > GetSpectrumModel() const
Static class to initialize the values for the 2.4 GHz Wi-Fi spectrum model.
WifiSpectrumModel5MhzInitializer()
virtual Ptr< SpectrumValue > CreateConstant(double psd)
Creates a SpectrumValue instance with a constant value for all frequencies.
virtual Ptr< SpectrumValue > CreateRfFilter(uint8_t channel)
Creates a SpectrumValue instance which represents the frequency response of the RF filter which is us...
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint8_t channel)
Creates a SpectrumValue instance that represents the TX Power Spectral Density of a wifi device corre...
virtual ~WifiSpectrumValue5MhzFactory()
Destructor.
static void CreateSpectrumMaskForOfdm(Ptr< SpectrumValue > c, const std::vector< WifiSpectrumBand > &allocatedSubBands, WifiSpectrumBand maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double minInnerBandDbr, double minOuterbandDbr, double lowestPointDbr, const std::vector< WifiSpectrumBand > &puncturedSubBands=std::vector< WifiSpectrumBand >{}, uint32_t puncturedSlopeWidth=0)
Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements fo...
virtual ~WifiSpectrumValueHelper()
Destructor.
static Ptr< SpectrumValue > CreateDuplicated20MhzTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
Create a transmit power spectral density corresponding to OFDM duplicated over multiple 20 MHz subcha...
static Ptr< SpectrumValue > CreateHtOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM High Throughput (HT) (802....
static Ptr< SpectrumValue > CreateOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM (802.11a/g).
static Ptr< SpectrumValue > CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
Create a transmit power spectral density corresponding to DSSS.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth)
Return a SpectrumModel instance corresponding to the center frequency and channel width.
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, double noiseFigure, uint16_t guardBandwidth)
Create a power spectral density corresponding to the noise.
static Ptr< SpectrumValue > CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, WifiSpectrumBand ru)
Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given R...
static double DbmToW(double dbm)
Convert from dBm to Watts.
static void NormalizeSpectrumMask(Ptr< SpectrumValue > c, double txPowerW)
Normalize the transmit spectrum mask generated by CreateSpectrumMaskForOfdm so that the total transmi...
static double GetBandPowerW(Ptr< SpectrumValue > psd, const WifiSpectrumBand &band)
Calculate the power of the specified band composed of uniformly-sized sub-bands.
static Ptr< SpectrumValue > CreateRfFilter(uint32_t centerFrequency, uint16_t totalChannelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth, WifiSpectrumBand band)
Create a spectral density corresponding to the RF filter.
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802....
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Ptr< SpectrumModel > g_WifiSpectrumModel5Mhz
static initializer for the class
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
static class ns3::WifiSpectrumModel5MhzInitializer g_WifiSpectrumModel5MhzInitializerInstance
initialization instance for WifiSpectrumModel5Mhz
bool operator<(const EventId &a, const EventId &b)
static std::map< WifiSpectrumModelId, Ptr< SpectrumModel > > g_wifiSpectrumModelMap
static initializer for the class
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
Wifi Spectrum Model structure.
uint32_t m_centerFrequency
center frequency (in MHz)
uint16_t m_guardBandwidth
guard band width (in MHz)
double m_bandBandwidth
width of each band (in Hz)
uint16_t m_channelWidth
channel width (in MHz)
WifiSpectrumModelId(uint32_t f, uint16_t w, double b, uint16_t g)
Constructor.