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

#include <DimensionalSNIR.h>

Inheritance diagram for inet::physicallayer::DimensionalSNIR:
inet::physicallayer::SNIRBase inet::physicallayer::ISNIR inet::physicallayer::IPrintableObject

Public Member Functions

 DimensionalSNIR (const DimensionalReception *reception, const DimensionalNoise *noise)
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual double getMin () const override
 
- Public Member Functions inherited from inet::physicallayer::SNIRBase
 SNIRBase (const IReception *reception, const INoise *noise)
 
virtual const IReceptiongetReception () const override
 
virtual const INoisegetNoise () const override
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Protected Member Functions

virtual double computeMin () const
 

Protected Attributes

double minSNIR
 
- Protected Attributes inherited from inet::physicallayer::SNIRBase
const IReceptionreception
 
const INoisenoise
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Constructor & Destructor Documentation

inet::physicallayer::DimensionalSNIR::DimensionalSNIR ( const DimensionalReception reception,
const DimensionalNoise noise 
)
24  :
26  minSNIR(NaN)
27 {
28 }
const IReception * reception
Definition: SNIRBase.h:32
const INoise * noise
Definition: SNIRBase.h:33
double minSNIR
Definition: DimensionalSNIR.h:32
#define NaN
Definition: INETMath.h:103
SNIRBase(const IReception *reception, const INoise *noise)
Definition: SNIRBase.cc:24

Member Function Documentation

double inet::physicallayer::DimensionalSNIR::computeMin ( ) const
protectedvirtual

Referenced by getMin().

39 {
40  const DimensionalNoise *dimensionalNoise = check_and_cast<const DimensionalNoise *>(noise);
41  const DimensionalReception *dimensionalReception = check_and_cast<const DimensionalReception *>(reception);
42  EV_DEBUG << "Reception power begin " << endl;
43  dimensionalReception->getPower()->print(EVSTREAM);
44  EV_DEBUG << "Reception power end" << endl;
45  const ConstMapping *noisePower = dimensionalNoise->getPower();
46  const ConstMapping *receptionPower = dimensionalReception->getPower();
47  const ConstMapping *snirMapping = MappingUtils::divide(*receptionPower, *noisePower);
48  const simtime_t startTime = reception->getStartTime();
49  const simtime_t endTime = reception->getEndTime();
50  Hz carrierFrequency = dimensionalReception->getCarrierFrequency();
51  Hz bandwidth = dimensionalReception->getBandwidth();
52  const DimensionSet& dimensions = receptionPower->getDimensionSet();
53  Argument startArgument(dimensions);
54  Argument endArgument(dimensions);
55  if (dimensions.hasDimension(Dimension::time)) {
56  startArgument.setTime(startTime);
57  // NOTE: to exclude the moment where the reception power starts to be 0 again
58  endArgument.setTime(MappingUtils::pre(endTime));
59  }
60  if (dimensions.hasDimension(Dimension::frequency)) {
61  startArgument.setArgValue(Dimension::frequency, (carrierFrequency - bandwidth / 2).get());
62  endArgument.setArgValue(Dimension::frequency, nexttoward((carrierFrequency + bandwidth / 2).get(), 0));
63  }
64  EV_DEBUG << "SNIR begin " << endl;
65  snirMapping->print(EVSTREAM);
66  EV_DEBUG << "SNIR end" << endl;
67  double minSNIR = MappingUtils::findMin(*snirMapping, startArgument, endArgument);
68  EV_DEBUG << "Computing minimum SNIR: start = " << startArgument << ", end = " << endArgument << " -> minimum SNIR = " << minSNIR << endl;
69  delete snirMapping;
70  return minSNIR;
71 }
pow< s,-1 > Hz
Definition: Units.h:766
static const Dimension time
Shortcut to the time Dimension, same as &#39;Dimension("time")&#39;, but spares the parsing of a string...
Definition: MappingBase.h:64
const IReception * reception
Definition: SNIRBase.h:32
const INoise * noise
Definition: SNIRBase.h:33
static simtime_t pre(simtime_t_cref t)
returns the closest value of simtime before passed value
Definition: MappingUtils.cc:426
double minSNIR
Definition: DimensionalSNIR.h:32
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
static Mapping * divide(const ConstMapping &f1, const ConstMapping &f2)
Definition: MappingUtils.cc:182
virtual const simtime_t getEndTime() const =0
Returns the time when the receiver ended to receive the corresponding transmission.
#define EVSTREAM
Definition: Compat.h:36
virtual const simtime_t getStartTime() const =0
Returns the time when the receiver started to receive the corresponding transmission.
static Argument::mapped_type findMin(const ConstMapping &m, Argument::mapped_type_cref cRetNotFound=cMinNotFound)
Iterates over the passed mapping and returns value at the key entry with the smallest value...
Definition: MappingUtils.cc:322
double inet::physicallayer::DimensionalSNIR::getMin ( ) const
overridevirtual

Implements inet::physicallayer::ISNIR.

74 {
75  if (std::isnan(minSNIR))
76  minSNIR = computeMin();
77  return minSNIR;
78 }
double minSNIR
Definition: DimensionalSNIR.h:32
virtual double computeMin() const
Definition: DimensionalSNIR.cc:38
std::ostream & inet::physicallayer::DimensionalSNIR::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::SNIRBase.

31 {
32  stream << "DimensionalSNIR";
33  if (level <= PRINT_LEVEL_DETAIL)
34  stream << ", minSNIR = " << minSNIR;
35  return SNIRBase::printToStream(stream, level);
36 }
double minSNIR
Definition: DimensionalSNIR.h:32
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: SNIRBase.cc:30

Member Data Documentation

double inet::physicallayer::DimensionalSNIR::minSNIR
mutableprotected

Referenced by computeMin(), getMin(), and printToStream().


The documentation for this class was generated from the following files: