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

This mathematical function provides the background noise power over space, time, and frequency. More...

#include <PowerFunctions.h>

Inheritance diagram for inet::physicallayer::BackgroundNoisePowerFunction:
inet::math::FunctionBase< WpHz, Domain< m, m, m, simsec, Hz > > inet::math::IFunction< WpHz, Domain< m, m, m, simsec, Hz > >

Public Member Functions

 BackgroundNoisePowerFunction (const IBackgroundNoise *backgroundNoise)
 
virtual WpHz getValue (const Point< m, m, m, simsec, Hz > &p) const override
 
virtual void partition (const Interval< m, m, m, simsec, Hz > &i, const std::function< void(const Interval< m, m, m, simsec, Hz > &, const IFunction< WpHz, Domain< m, m, m, simsec, Hz >> *)> f) const override
 
virtual void printStructure (std::ostream &os, int level=0) const override
 Prints the internal data structure of this function in a human readable form to the provided stream. More...
 
- Public Member Functions inherited from inet::math::FunctionBase< WpHz, Domain< m, m, m, simsec, Hz > >
virtual void partition (const typename Domain< m, m, m, simsec, Hz > ::I &i, const std::function< void(const typename Domain< m, m, m, simsec, Hz > ::I &, const IFunction< WpHz, Domain< m, m, m, simsec, Hz > > *)> callback) const override
 Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially simpler domain limited functions. More...
 
virtual Interval< WpHzgetRange () const override
 Returns the valid range of the function as an interval. More...
 
virtual Interval< WpHzgetRange (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual Domain< m, m, m, simsec, Hz > ::I getDomain () const override
 Returns the valid domain of the function as an interval. More...
 
virtual bool isFinite () const override
 Returns true if the function value is finite in the whole domain. More...
 
virtual bool isFinite (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns true if the function value is finite in the given domain. More...
 
virtual bool isNonZero () const override
 Returns true if the function value is non-zero in the whole domain. More...
 
virtual bool isNonZero (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns true if the function value is non-zero in the given domain. More...
 
virtual WpHz getMin () const override
 Returns the minimum value for the whole domain. More...
 
virtual WpHz getMin (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns the minimum value for the given domain. More...
 
virtual WpHz getMax () const override
 Returns the maximum value for the whole domain. More...
 
virtual WpHz getMax (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns the maximum value for the given domain. More...
 
virtual WpHz getMean () const override
 Returns the mean value for the whole domain. More...
 
virtual WpHz getMean (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns the mean value for the given domain. More...
 
virtual WpHz getIntegral () const override
 Returns the integral value for the whole domain. More...
 
virtual WpHz getIntegral (const typename Domain< m, m, m, simsec, Hz > ::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > > > add (const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > > > subtract (const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > > > multiply (const Ptr< const IFunction< double, Domain< m, m, m, simsec, Hz > >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, Domain< m, m, m, simsec, Hz > > > divide (const Ptr< const IFunction< WpHz, Domain< m, m, m, simsec, Hz > >> &o) const override
 Divides this function with the provided function. More...
 
virtual std::ostream & printOn (std::ostream &os) const override
 
virtual void print (std::ostream &os, int level=0) const override
 Prints this function in human readable form to the provided stream for the whole domain. More...
 
virtual void print (std::ostream &os, const typename Domain< m, m, m, simsec, Hz > ::I &i, int level=0) const override
 Prints this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartitioning (std::ostream &os, const typename Domain< m, m, m, simsec, Hz > ::I &i, int level) const override
 Prints the partitioning of this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartition (std::ostream &os, const typename Domain< m, m, m, simsec, Hz > ::I &i, int level=0) const override
 Prints a single partition of this function in a human readable form to the provided stream for the given domain. More...
 
- Public Member Functions inherited from inet::math::IFunction< WpHz, Domain< m, m, m, simsec, Hz > >
virtual ~IFunction ()
 
virtual WpHz getValue (const typename Domain< m, m, m, simsec, Hz > ::P &p) const=0
 Returns the value of the function at the given point. More...
 

Protected Attributes

Ptr< const IFunction< WpHz, Domain< simsec, Hz > > > powerFunction
 

Detailed Description

This mathematical function provides the background noise power over space, time, and frequency.

Constructor & Destructor Documentation

◆ BackgroundNoisePowerFunction()

inet::physicallayer::BackgroundNoisePowerFunction::BackgroundNoisePowerFunction ( const IBackgroundNoise backgroundNoise)
inline
234  {
235  Hz minFrequency = Hz(0);
236  Hz maxFrequency = GHz(10);
237  Coord minPosition;
238  Coord maxPosition;
239  BandListening listening(nullptr, 0, getUpperBound<simtime_t>(), minPosition, maxPosition, (minFrequency + maxFrequency) / 2, maxFrequency - minFrequency);
240  auto noise = backgroundNoise->computeNoise(&listening);
241  if (auto dimensionalNoise = dynamic_cast<const DimensionalNoise *>(noise))
242  powerFunction = dimensionalNoise->getPower();
243  else
244  throw cRuntimeError("TODO");
245  }

Member Function Documentation

◆ getValue()

virtual WpHz inet::physicallayer::BackgroundNoisePowerFunction::getValue ( const Point< m, m, m, simsec, Hz > &  p) const
inlineoverridevirtual
247  {
248  return powerFunction->getValue(Point<simsec, Hz>(std::get<3>(p), std::get<4>(p)));
249  }

◆ partition()

virtual void inet::physicallayer::BackgroundNoisePowerFunction::partition ( const Interval< m, m, m, simsec, Hz > &  i,
const std::function< void(const Interval< m, m, m, simsec, Hz > &, const IFunction< WpHz, Domain< m, m, m, simsec, Hz >> *)>  f 
) const
inlineoverridevirtual
251  {
252  const auto& lower = i.getLower();
253  const auto& upper = i.getUpper();
254  if ((i.getFixed() & 0b11100) == 0b11100) {
255  Point<simsec, Hz> l1(std::get<3>(lower), std::get<4>(i.getLower()));
256  Point<simsec, Hz> u1(std::get<3>(upper), std::get<4>(i.getUpper()));
257  Interval<simsec, Hz> i1(l1, u1, i.getLowerClosed() & 0b11, i.getUpperClosed() & 0b11, i.getFixed() & 0b11);
258  powerFunction->partition(i1, [&] (const Interval<simsec, Hz>& i2, const IFunction<WpHz, Domain<simsec, Hz>> *f2) {
260  Point<m, m, m, simsec, Hz>(std::get<0>(lower), std::get<1>(lower), std::get<2>(lower), std::get<0>(i2.getLower()), std::get<1>(i2.getLower())),
261  Point<m, m, m, simsec, Hz>(std::get<0>(upper), std::get<1>(upper), std::get<2>(upper), std::get<0>(i2.getUpper()), std::get<1>(i2.getUpper())),
262  0b11100 | i2.getLowerClosed(),
263  0b11100 | i2.getUpperClosed(),
264  0b11100 | i2.getFixed());
265  if (auto f2c = dynamic_cast<const ConstantFunction<WpHz, Domain<simsec, Hz>> *>(f2)) {
266  ConstantFunction<WpHz, Domain<m, m, m, simsec, Hz>> g(f2c->getConstantValue());
267  f(i3, &g);
268  }
269  else if (auto f2l = dynamic_cast<const UnilinearFunction<WpHz, Domain<simsec, Hz>> *>(f2)) {
270  UnilinearFunction<WpHz, Domain<m, m, m, simsec, Hz>> g(i3.getLower(), i3.getUpper(), f2l->getValue(i2.getLower()), f2l->getValue(i2.getUpper()), f2l->getDimension() + 3);
271  f(i3, &g);
272  }
273  else
274  throw cRuntimeError("TODO");
275  });
276  }
277  else
279  }

◆ printStructure()

virtual void inet::physicallayer::BackgroundNoisePowerFunction::printStructure ( std::ostream &  os,
int  level = 0 
) const
inlineoverridevirtual

Prints the internal data structure of this function in a human readable form to the provided stream.

Reimplemented from inet::math::FunctionBase< WpHz, Domain< m, m, m, simsec, Hz > >.

281  {
282  os << "(BackgroundNoisePower\n" << std::string(level + 2, ' ');
283  powerFunction->printStructure(os, level + 2);
284  os << ")";
285  }

Member Data Documentation

◆ powerFunction

Ptr<const IFunction<WpHz, Domain<simsec, Hz> > > inet::physicallayer::BackgroundNoisePowerFunction::powerFunction
protected

The documentation for this class was generated from the following file:
inet::math::Interval::getLowerClosed
unsigned char getLowerClosed() const
Definition: Interval.h:117
inet::units::units::Hz
pow< s, -1 > Hz
Definition: Units.h:935
inet::math::Point
N-dimensional point.
Definition: Point.h:93
inet::physicallayer::BackgroundNoisePowerFunction::powerFunction
Ptr< const IFunction< WpHz, Domain< simsec, Hz > > > powerFunction
Definition: PowerFunctions.h:231
inet::math::Interval
N-dimensional interval (cuboid), given by its two opposite corners.
Definition: Interval.h:26
inet::math::IFunction
This interface represents a mathematical function from domain D to range R.
Definition: IFunction.h:26
inet::units::units::g
milli< kg >::type g
Definition: Units.h:1071
inet::math::ConstantFunction
Definition: PrimitiveFunctions.h:19
inet::units::units::WpHz
compose< W, pow< Hz, -1 > > WpHz
Definition: Units.h:940
inet::math::Interval::getUpperClosed
unsigned char getUpperClosed() const
Definition: Interval.h:118
inet::units::units::GHz
giga< Hz >::type GHz
Definition: Units.h:1084
inet::math::Interval::getFixed
unsigned char getFixed() const
Definition: Interval.h:119
inet::math::Interval::getLower
const Point< T ... > & getLower() const
Definition: Interval.h:115
inet::math::FunctionBase::partition
virtual void partition(const typename D::I &i, const std::function< void(const typename D::I &, const IFunction< R, D > *)> callback) const override
Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially...
Definition: FunctionBase.h:39
inet::math::Domain
This class represents the domain of a mathematical function.
Definition: Domain.h:24
inet::math::Interval::getUpper
const Point< T ... > & getUpper() const
Definition: Interval.h:116
inet::math::UnilinearFunction
Linear in one dimension and constant in the others.
Definition: PrimitiveFunctions.h:57
inet::units::value
Definition: Units.h:81