INET Framework for OMNeT++/OMNEST
inet::physicallayer::IsotropicScalarBackgroundNoise Class Reference

#include <IsotropicScalarBackgroundNoise.h>

Inheritance diagram for inet::physicallayer::IsotropicScalarBackgroundNoise:
inet::physicallayer::IBackgroundNoise inet::IPrintableObject

Public Member Functions

virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
virtual W getPower () const
 
virtual const INoisecomputeNoise (const IListening *listening) const override
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Member Functions

virtual void initialize (int stage) override
 

Protected Attributes

W power = W(NaN)
 
Hz bandwidth = Hz(NaN)
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 

Member Function Documentation

◆ computeNoise()

const INoise * inet::physicallayer::IsotropicScalarBackgroundNoise::computeNoise ( const IListening listening) const
overridevirtual

Implements inet::physicallayer::IBackgroundNoise.

39 {
40  const BandListening *bandListening = check_and_cast<const BandListening *>(listening);
41  simtime_t startTime = listening->getStartTime();
42  simtime_t endTime = listening->getEndTime();
43  Hz centerFrequency = bandListening->getCenterFrequency();
44  Hz listeningBandwidth = bandListening->getBandwidth();
45  if (std::isnan(bandwidth.get()))
46  bandwidth = listeningBandwidth;
47  else if (bandwidth != listeningBandwidth)
48  throw cRuntimeError("Background noise bandwidth doesn't match listening bandwidth");
49  std::map<simtime_t, W> *powerChanges = new std::map<simtime_t, W>();
50  powerChanges->insert(std::pair<simtime_t, W>(startTime, power));
51  powerChanges->insert(std::pair<simtime_t, W>(endTime, -power));
52  return new ScalarNoise(startTime, endTime, centerFrequency, bandwidth, powerChanges);
53 }

◆ getPower()

virtual W inet::physicallayer::IsotropicScalarBackgroundNoise::getPower ( ) const
inlinevirtual
28 { return power; }

◆ initialize()

void inet::physicallayer::IsotropicScalarBackgroundNoise::initialize ( int  stage)
overrideprotectedvirtual
20 {
21  cModule::initialize(stage);
22  if (stage == INITSTAGE_LOCAL) {
23  power = mW(math::dBmW2mW(par("power")));
24  bandwidth = Hz(par("bandwidth"));
25  }
26 }

◆ printToStream()

std::ostream & inet::physicallayer::IsotropicScalarBackgroundNoise::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

29 {
30  stream << "IsotropicScalarBackgroundNoise";
31  if (level <= PRINT_LEVEL_DETAIL) {
32  stream << EV_FIELD(power);
33  stream << EV_FIELD(bandwidth);
34  }
35  return stream;
36 }

Member Data Documentation

◆ bandwidth

Hz inet::physicallayer::IsotropicScalarBackgroundNoise::bandwidth = Hz(NaN)
mutableprotected

◆ power

W inet::physicallayer::IsotropicScalarBackgroundNoise::power = W(NaN)
protected

The documentation for this class was generated from the following files:
inet::physicallayer::IsotropicScalarBackgroundNoise::bandwidth
Hz bandwidth
Definition: IsotropicScalarBackgroundNoise.h:21
inet::units::units::Hz
pow< s, -1 > Hz
Definition: Units.h:935
inet::IPrintableObject::PRINT_LEVEL_DETAIL
@ PRINT_LEVEL_DETAIL
Definition: IPrintableObject.h:24
inet::math::dBmW2mW
double dBmW2mW(double dBm)
Converts a dBmW value to mW.
Definition: INETMath.h:163
inet::units::units::mW
milli< W >::type mW
Definition: Units.h:1080
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::physicallayer::IsotropicScalarBackgroundNoise::power
W power
Definition: IsotropicScalarBackgroundNoise.h:20
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::units::value::get
const value_type & get() const
Definition: Units.h:108