26#include "ns3/assert.h" 
   27#include "ns3/fatal-error.h" 
   68static std::map<WifiSpectrumModelId, Ptr<SpectrumModel>>
 
   73                                          uint16_t channelWidth,
 
   75                                          uint16_t guardBandwidth)
 
   77    NS_LOG_FUNCTION(centerFrequency << channelWidth << carrierSpacing << guardBandwidth);
 
   80    std::map<WifiSpectrumModelId, Ptr<SpectrumModel>>::iterator it =
 
   89        double centerFrequencyHz = centerFrequency * 1e6;
 
   90        double bandwidth = (channelWidth + (2.0 * guardBandwidth)) * 1e6;
 
   92        uint32_t numBands = 
static_cast<uint32_t>((bandwidth / carrierSpacing) + 0.5);
 
   94        if (numBands % 2 == 0)
 
  100        NS_ASSERT_MSG(numBands % 2 == 1, 
"Number of bands should be odd");
 
  101        NS_LOG_DEBUG(
"Num bands " << numBands << 
" band bandwidth " << carrierSpacing);
 
  104        double startingFrequencyHz =
 
  105            centerFrequencyHz - (numBands / 2 * carrierSpacing) - carrierSpacing / 2;
 
  106        for (
size_t i = 0; i < numBands; i++)
 
  109            double f = startingFrequencyHz + (i * carrierSpacing);
 
  111            f += carrierSpacing / 2;
 
  113            f += carrierSpacing / 2;
 
  115            NS_LOG_DEBUG(
"creating band " << i << 
" (" << info.
fl << 
":" << info.
fc << 
":" 
  117            bands.push_back(info);
 
  119        ret = Create<SpectrumModel>(std::move(bands));
 
  122    NS_LOG_LOGIC(
"returning SpectrumModel::GetUid () == " << ret->GetUid());
 
  130                                                          uint16_t guardBandwidth)
 
  133    uint16_t channelWidth = 22; 
 
  136        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  137    Values::iterator vit = c->ValuesBegin();
 
  138    Bands::const_iterator bit = c->ConstBandsBegin();
 
  140        static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
 
  141    uint32_t nAllocatedBands = 
static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
 
  142    NS_ASSERT(c->GetSpectrumModel()->GetNumBands() == (nAllocatedBands + nGuardBands + 1));
 
  144    double txPowerPerBand = txPowerW / nAllocatedBands;
 
  145    for (
size_t i = 0; i < c->GetSpectrumModel()->GetNumBands(); i++, vit++, bit++)
 
  147        if ((i >= (nGuardBands / 2)) && (i <= ((nGuardBands / 2) + nAllocatedBands - 1)))
 
  149            *vit = txPowerPerBand / (bit->fh - bit->fl);
 
  157                                                          uint16_t channelWidth,
 
  159                                                          uint16_t guardBandwidth,
 
  160                                                          double minInnerBandDbr,
 
  161                                                          double minOuterBandDbr,
 
  162                                                          double lowestPointDbr)
 
  164    NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
 
  165                                    << minOuterBandDbr << lowestPointDbr);
 
  168    switch (channelWidth)
 
  171        carrierSpacing = 312500;
 
  172        innerSlopeWidth = 
static_cast<uint32_t>((2e6 / carrierSpacing) + 0.5); 
 
  175        carrierSpacing = 156250;
 
  177            static_cast<uint32_t>((1e6 / carrierSpacing) + 0.5); 
 
  180        carrierSpacing = 78125;
 
  182            static_cast<uint32_t>((5e5 / carrierSpacing) + 0.5); 
 
  185        NS_FATAL_ERROR(
"Channel width " << channelWidth << 
" should be correctly set.");
 
  190        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  192        static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
 
  193    uint32_t nAllocatedBands = 
static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
 
  194    NS_ASSERT_MSG(c->GetSpectrumModel()->GetNumBands() == (nAllocatedBands + nGuardBands + 1),
 
  195                  "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
 
  200    double txPowerPerBandW = txPowerW / 52;
 
  201    NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW << 
"W");
 
  202    uint32_t start1 = (nGuardBands / 2) + 6;
 
  208    std::vector<WifiSpectrumBandIndices> subBands{
 
  209        std::make_pair(start1, stop1),
 
  210        std::make_pair(start2, stop2),
 
  230    uint16_t channelWidth,
 
  232    uint16_t guardBandwidth,
 
  233    double minInnerBandDbr,
 
  234    double minOuterBandDbr,
 
  235    double lowestPointDbr,
 
  236    const std::vector<bool>& puncturedSubchannels)
 
  238    NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
 
  239                                    << minOuterBandDbr << lowestPointDbr);
 
  242        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  244        static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
 
  245    uint32_t nAllocatedBands = 
static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
 
  246    NS_ASSERT_MSG(c->GetSpectrumModel()->GetNumBands() == (nAllocatedBands + nGuardBands + 1),
 
  247                  "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
 
  248    std::size_t num20MhzBands = channelWidth / 20;
 
  249    std::size_t numAllocatedSubcarriersPer20MHz = 52;
 
  250    NS_ASSERT(puncturedSubchannels.empty() || (puncturedSubchannels.size() == num20MhzBands));
 
  251    double txPowerPerBandW = (txPowerW / numAllocatedSubcarriersPer20MHz) / num20MhzBands;
 
  252    NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW << 
"W");
 
  254    std::size_t numSubcarriersPer20MHz = (20 * 1e6) / carrierSpacing;
 
  255    std::size_t numUnallocatedSubcarriersPer20MHz =
 
  256        numSubcarriersPer20MHz - numAllocatedSubcarriersPer20MHz;
 
  257    std::vector<WifiSpectrumBandIndices>
 
  259    subBands.resize(num20MhzBands *
 
  261    uint32_t start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2);
 
  264    for (
auto it = subBands.begin(); it != subBands.end();)
 
  266        if (!puncturedSubchannels.empty() && puncturedSubchannels.at(index++))
 
  269            NS_LOG_DEBUG(
"20 MHz subchannel " << +index << 
" is punctured");
 
  273        stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
 
  274        *it = std::make_pair(start, stop);
 
  277        stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
 
  278        *it = std::make_pair(start, stop);
 
  280        start = stop + numUnallocatedSubcarriersPer20MHz;
 
  285        (2e6 / carrierSpacing) +
 
  306                                                            uint16_t channelWidth,
 
  308                                                            uint16_t guardBandwidth,
 
  309                                                            double minInnerBandDbr,
 
  310                                                            double minOuterBandDbr,
 
  311                                                            double lowestPointDbr)
 
  313    NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
 
  314                                    << minOuterBandDbr << lowestPointDbr);
 
  317        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  319        static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
 
  320    uint32_t nAllocatedBands = 
static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
 
  321    NS_ASSERT_MSG(c->GetSpectrumModel()->GetNumBands() == (nAllocatedBands + nGuardBands + 1),
 
  322                  "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
 
  323    std::size_t num20MhzBands = channelWidth / 20;
 
  324    std::size_t numAllocatedSubcarriersPer20MHz = 56;
 
  325    double txPowerPerBandW = (txPowerW / numAllocatedSubcarriersPer20MHz) / num20MhzBands;
 
  326    NS_LOG_DEBUG(
"Power per band " << txPowerPerBandW << 
"W");
 
  328    std::size_t numSubcarriersPer20MHz = (20 * 1e6) / carrierSpacing;
 
  329    std::size_t numUnallocatedSubcarriersPer20MHz =
 
  330        numSubcarriersPer20MHz - numAllocatedSubcarriersPer20MHz;
 
  331    std::vector<WifiSpectrumBandIndices>
 
  333    subBands.resize(num20MhzBands *
 
  335    uint32_t start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2);
 
  337    for (
auto it = subBands.begin(); it != subBands.end();)
 
  339        stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
 
  340        *it = std::make_pair(start, stop);
 
  343        stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1;
 
  344        *it = std::make_pair(start, stop);
 
  346        start = stop + numUnallocatedSubcarriersPer20MHz;
 
  351        (2e6 / carrierSpacing) +
 
  373    uint16_t channelWidth,
 
  375    uint16_t guardBandwidth,
 
  376    double minInnerBandDbr,
 
  377    double minOuterBandDbr,
 
  378    double lowestPointDbr,
 
  379    const std::vector<bool>& puncturedSubchannels)
 
  381    NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr
 
  382                                    << minOuterBandDbr << lowestPointDbr);
 
  385        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  387        static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / carrierSpacing) + 0.5);
 
  388    uint32_t nAllocatedBands = 
static_cast<uint32_t>(((channelWidth * 1e6) / carrierSpacing) + 0.5);
 
  389    NS_ASSERT_MSG(c->GetSpectrumModel()->GetNumBands() == (nAllocatedBands + nGuardBands + 1),
 
  390                  "Unexpected number of bands " << c->GetSpectrumModel()->GetNumBands());
 
  391    double txPowerPerBandW = 0.0;
 
  402        (1e6 / carrierSpacing) + 0.5); 
 
  403    std::vector<WifiSpectrumBandIndices>
 
  406    switch (channelWidth)
 
  410        txPowerPerBandW = txPowerW / 242;
 
  412            static_cast<uint32_t>((5e5 / carrierSpacing) + 0.5); 
 
  416        start1 = (nGuardBands / 2) + 6;
 
  417        stop1 = start1 + 121 - 1;
 
  419        stop2 = start2 + 121 - 1;
 
  420        subBands.emplace_back(start1, stop1);
 
  421        subBands.emplace_back(start2, stop2);
 
  425        txPowerPerBandW = txPowerW / 484;
 
  429        start1 = (nGuardBands / 2) + 12;
 
  430        stop1 = start1 + 242 - 1;
 
  432        stop2 = start2 + 242 - 1;
 
  433        subBands.emplace_back(start1, stop1);
 
  434        subBands.emplace_back(start2, stop2);
 
  438        txPowerPerBandW = txPowerW / 996;
 
  442        start1 = (nGuardBands / 2) + 12;
 
  443        stop1 = start1 + 498 - 1;
 
  445        stop2 = start2 + 498 - 1;
 
  446        subBands.emplace_back(start1, stop1);
 
  447        subBands.emplace_back(start2, stop2);
 
  451        txPowerPerBandW = txPowerW / (2 * 996);
 
  452        start1 = (nGuardBands / 2) + 12;
 
  453        stop1 = start1 + 498 - 1;
 
  455        stop2 = start2 + 498 - 1;
 
  456        start3 = stop2 + (2 * 12);
 
  457        stop3 = start3 + 498 - 1;
 
  459        stop4 = start4 + 498 - 1;
 
  460        subBands.emplace_back(start1, stop1);
 
  461        subBands.emplace_back(start2, stop2);
 
  462        subBands.emplace_back(start3, stop3);
 
  463        subBands.emplace_back(start4, stop4);
 
  466        NS_FATAL_ERROR(
"ChannelWidth " << channelWidth << 
" unsupported");
 
  472        static_cast<uint32_t>((500e3 / carrierSpacing) +
 
  474    std::vector<WifiSpectrumBandIndices> puncturedBands;
 
  475    std::size_t subcarriersPerSuband = (20 * 1e6 / carrierSpacing);
 
  477    uint32_t stop = start + subcarriersPerSuband - 1;
 
  478    for (
auto puncturedSubchannel : puncturedSubchannels)
 
  480        if (puncturedSubchannel)
 
  482            puncturedBands.emplace_back(start, stop);
 
  485        stop = start + subcarriersPerSuband - 1;
 
  499                              puncturedSlopeWidth);
 
  507                                                              uint16_t channelWidth,
 
  509                                                              uint16_t guardBandwidth,
 
  512    NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << ru.first
 
  516        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth));
 
  519    Values::iterator vit = c->ValuesBegin();
 
  520    Bands::const_iterator bit = c->ConstBandsBegin();
 
  521    double txPowerPerBandW = (txPowerW / (ru.second - ru.first + 1)); 
 
  522    uint32_t numBands = c->GetSpectrumModel()->GetNumBands();
 
  523    for (
size_t i = 0; i < numBands; i++, vit++, bit++)
 
  525        if (i < ru.first || i > ru.second) 
 
  531            *vit = (txPowerPerBandW / (bit->fh - bit->fl));
 
  540                                                         uint16_t channelWidth,
 
  543                                                         uint16_t guardBandwidth)
 
  546        GetSpectrumModel(centerFrequency, channelWidth, carrierSpacing, guardBandwidth);
 
  558    const double kT_dBm_Hz = -174.0; 
 
  559    double kT_W_Hz = 
DbmToW(kT_dBm_Hz);
 
  560    double noiseFigureLinear = std::pow(10.0, noiseFigureDb / 10.0);
 
  561    double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
 
  564    (*noisePsd) = noisePowerSpectralDensity;
 
  572    const std::vector<WifiSpectrumBandIndices>& allocatedSubBands,
 
  574    double txPowerPerBandW,
 
  577    double minInnerBandDbr,
 
  578    double minOuterBandDbr,
 
  579    double lowestPointDbr,
 
  580    const std::vector<WifiSpectrumBandIndices>& puncturedBands,
 
  583    NS_LOG_FUNCTION(c << allocatedSubBands.front().first << allocatedSubBands.back().second
 
  584                      << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBands
 
  585                      << innerSlopeWidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr
 
  586                      << puncturedSlopeWidth);
 
  587    uint32_t numSubBands = allocatedSubBands.size();
 
  588    uint32_t numBands = c->GetSpectrumModel()->GetNumBands();
 
  589    uint32_t numMaskBands = maskBand.second - maskBand.first + 1;
 
  590    NS_ASSERT(numSubBands && numBands && numMaskBands);
 
  591    NS_LOG_LOGIC(
"Power per band " << txPowerPerBandW << 
"W");
 
  594    double txPowerRefDbm = (10.0 * std::log10(txPowerPerBandW * 1000.0));
 
  595    double txPowerInnerBandMinDbm = txPowerRefDbm + minInnerBandDbr;
 
  596    double txPowerMiddleBandMinDbm = txPowerRefDbm + minOuterBandDbr;
 
  597    double txPowerOuterBandMinDbm =
 
  598        txPowerRefDbm + lowestPointDbr; 
 
  604    uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2);
 
  608        maskBand.first + outerSlopeWidth - 1);
 
  610                                           outerBandLeft.second + middleSlopeWidth);
 
  612        allocatedSubBands.front().first - innerSlopeWidth,
 
  613        allocatedSubBands.front().first -
 
  616        middleBandLeft.second + 1,
 
  617        innerBandLeft.first - 1); 
 
  619        maskBand.second - outerSlopeWidth + 1,
 
  622                                            outerBandRight.first - 1);
 
  624                                           allocatedSubBands.back().second + innerSlopeWidth);
 
  626    std::ostringstream ss;
 
  627    ss << 
"outerBandLeft=[" << outerBandLeft.first << 
";" << outerBandLeft.second << 
"] " 
  628       << 
"middleBandLeft=[" << middleBandLeft.first << 
";" << middleBandLeft.second << 
"] " 
  629       << 
"flatJunctionLeft=[" << flatJunctionLeft.first << 
";" << flatJunctionLeft.second << 
"] " 
  630       << 
"innerBandLeft=[" << innerBandLeft.first << 
";" << innerBandLeft.second << 
"] " 
  631       << 
"subBands=[" << allocatedSubBands.front().first << 
";" << allocatedSubBands.back().second
 
  633    if (!puncturedBands.empty())
 
  635        ss << 
"puncturedBands=[" << puncturedBands.front().first << 
";" 
  636           << puncturedBands.back().second << 
"] ";
 
  638    ss << 
"innerBandRight=[" << innerBandRight.first << 
";" << innerBandRight.second << 
"] " 
  639       << 
"flatJunctionRight=[" << flatJunctionRight.first << 
";" << flatJunctionRight.second
 
  641       << 
"middleBandRight=[" << middleBandRight.first << 
";" << middleBandRight.second << 
"] " 
  642       << 
"outerBandRight=[" << outerBandRight.first << 
";" << outerBandRight.second << 
"] ";
 
  645              ((allocatedSubBands.back().second - allocatedSubBands.front().first +
 
  647               + 2 * (innerSlopeWidth + middleSlopeWidth + outerSlopeWidth) +
 
  648               (flatJunctionLeft.second - flatJunctionLeft.first + 1) 
 
  649               + (flatJunctionRight.second - flatJunctionRight.first + 1)));
 
  652    double innerSlope = (-1 * minInnerBandDbr) / innerSlopeWidth;
 
  653    double middleSlope = (-1 * (minOuterBandDbr - minInnerBandDbr)) / middleSlopeWidth;
 
  654    double outerSlope = (txPowerMiddleBandMinDbm - txPowerOuterBandMinDbm) / outerSlopeWidth;
 
  655    double puncturedSlope = (-1 * minInnerBandDbr) / puncturedSlopeWidth;
 
  658    Values::iterator vit = c->ValuesBegin();
 
  659    Bands::const_iterator bit = c->ConstBandsBegin();
 
  660    double txPowerW = 0.0;
 
  661    double previousTxPowerW = 0.0;
 
  662    for (
size_t i = 0; i < numBands; i++, vit++, bit++)
 
  664        if (i < maskBand.first || i > maskBand.second) 
 
  668        else if (i <= outerBandLeft.second &&
 
  669                 i >= outerBandLeft.first) 
 
  671            txPowerW = 
DbmToW(txPowerOuterBandMinDbm + ((i - outerBandLeft.first) * outerSlope));
 
  673        else if (i <= middleBandLeft.second && i >= middleBandLeft.first)
 
  675            txPowerW = 
DbmToW(txPowerMiddleBandMinDbm + ((i - middleBandLeft.first) * middleSlope));
 
  677        else if (i <= flatJunctionLeft.second && i >= flatJunctionLeft.first)
 
  679            txPowerW = 
DbmToW(txPowerInnerBandMinDbm);
 
  681        else if (i <= innerBandLeft.second && i >= innerBandLeft.first)
 
  684                (!puncturedBands.empty() &&
 
  685                 (puncturedBands.front().first <= allocatedSubBands.front().first))
 
  686                    ? 
DbmToW(txPowerInnerBandMinDbm)
 
  688                    DbmToW(txPowerInnerBandMinDbm + ((i - innerBandLeft.first) * innerSlope));
 
  690        else if (i <= allocatedSubBands.back().second &&
 
  691                 i >= allocatedSubBands.front().first) 
 
  693            bool insideSubBand = 
false;
 
  694            for (
uint32_t j = 0; !insideSubBand && j < numSubBands;
 
  698                    (i <= allocatedSubBands[j].second) && (i >= allocatedSubBands[j].
first);
 
  702                bool insidePuncturedSubBand = 
false;
 
  704                for (; !insidePuncturedSubBand && j < puncturedBands.size();
 
  707                    insidePuncturedSubBand =
 
  708                        (i <= puncturedBands[j].second) && (i >= puncturedBands[j].
first);
 
  710                if (insidePuncturedSubBand)
 
  713                        (puncturedBands[puncturedBands.size() - 1].second -
 
  714                         puncturedSlopeWidth); 
 
  715                    if (i >= startPuncturedSlope)
 
  717                        txPowerW = 
DbmToW(txPowerInnerBandMinDbm +
 
  718                                          ((i - startPuncturedSlope) * puncturedSlope));
 
  722                        txPowerW = std::max(
DbmToW(txPowerInnerBandMinDbm),
 
  723                                            DbmToW(txPowerRefDbm - ((i - puncturedBands[0].
first) *
 
  729                    txPowerW = txPowerPerBandW;
 
  734                txPowerW = 
DbmToW(txPowerInnerBandMinDbm);
 
  737        else if (i <= innerBandRight.second && i >= innerBandRight.first)
 
  742                DbmToW(txPowerRefDbm - ((i - innerBandRight.first + 1) *
 
  745        else if (i <= flatJunctionRight.second && i >= flatJunctionRight.first)
 
  747            txPowerW = 
DbmToW(txPowerInnerBandMinDbm);
 
  749        else if (i <= middleBandRight.second && i >= middleBandRight.first)
 
  751            txPowerW = 
DbmToW(txPowerInnerBandMinDbm -
 
  752                              ((i - middleBandRight.first + 1) *
 
  755        else if (i <= outerBandRight.second && i >= outerBandRight.first)
 
  757            txPowerW = 
DbmToW(txPowerMiddleBandMinDbm -
 
  758                              ((i - outerBandRight.first + 1) *
 
  765        double txPowerDbr = 10 * std::log10(txPowerW / txPowerPerBandW);
 
  767        *vit = txPowerW / (bit->fh - bit->fl);
 
  768        previousTxPowerW = txPowerW;
 
  770    NS_LOG_INFO(
"Added signal power to subbands " << allocatedSubBands.front().first << 
"-" 
  771                                                  << allocatedSubBands.back().second);
 
  779    double currentTxPowerW = 
Integral(*c);
 
  780    double normalizationRatio = currentTxPowerW / txPowerW;
 
  781    NS_LOG_LOGIC(
"Current power: " << currentTxPowerW << 
"W vs expected power: " << txPowerW << 
"W" 
  782                                   << 
" -> ratio (C/E) = " << normalizationRatio);
 
  783    Values::iterator vit = c->ValuesBegin();
 
  784    for (
size_t i = 0; i < c->GetSpectrumModel()->GetNumBands(); i++, vit++)
 
  786        *vit = (*vit) / normalizationRatio;
 
  793    return std::pow(10.0, 0.1 * (dBm - 30.0));
 
  799    double powerWattPerHertz = 0.0;
 
  800    auto valueIt = psd->ConstValuesBegin() + band.first;
 
  801    auto end = psd->ConstValuesBegin() + band.second;
 
  802    auto bandIt = psd->ConstBandsBegin() + band.first;
 
  803    while (valueIt <= end)
 
  805        powerWattPerHertz += *valueIt;
 
  808    return powerWattPerHertz * (bandIt->fh - bandIt->fl);
 
  826    return !(left == right);
 
double f(double x, void *params)
 
Smart pointer class similar to boost::intrusive_ptr.
 
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, double noiseFigure, uint16_t guardBandwidth)
Create a power spectral density corresponding to the noise.
 
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 void CreateSpectrumMaskForOfdm(Ptr< SpectrumValue > c, const std::vector< WifiSpectrumBandIndices > &allocatedSubBands, const WifiSpectrumBandIndices &maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double minInnerBandDbr, double minOuterbandDbr, double lowestPointDbr, const std::vector< WifiSpectrumBandIndices > &puncturedSubBands=std::vector< WifiSpectrumBandIndices >{}, uint32_t puncturedSlopeWidth=0)
Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements fo...
 
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< SpectrumModel > GetSpectrumModel(uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, uint16_t guardBandwidth)
Return a SpectrumModel instance corresponding to the center frequency and channel width.
 
static Ptr< SpectrumValue > CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
Create a transmit power spectral density corresponding to DSSS.
 
static double GetBandPowerW(Ptr< SpectrumValue > psd, const WifiSpectrumBandIndices &band)
Calculate the power of the specified band composed of uniformly-sized sub-bands.
 
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 Ptr< SpectrumValue > CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, const WifiSpectrumBandIndices &ru)
Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given R...
 
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.
 
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
 
bool operator==(const EventId &a, const EventId &b)
 
std::ostream & operator<<(std::ostream &os, const Angles &a)
 
double Integral(const SpectrumValue &arg)
 
std::vector< BandInfo > Bands
Container of BandInfo.
 
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
 
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
 
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
 
uint16_t maxFrequency
the maximum frequency in MHz
 
uint16_t minFrequency
the minimum frequency in MHz
 
Wifi Spectrum Model structure.
 
uint32_t m_centerFrequency
center frequency (in MHz)
 
uint16_t m_guardBandwidth
guard band width (in MHz)
 
uint16_t m_channelWidth
channel width (in MHz)
 
uint32_t m_carrierSpacing
carrier spacing (in Hz)