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

#include <Ieee802154UwbIrReceiver.h>

Inheritance diagram for inet::physicallayer::Ieee802154UwbIrReceiver:
inet::physicallayer::ReceiverBase inet::physicallayer::IReceiver inet::IPrintableObject

Public Member Functions

 Ieee802154UwbIrReceiver ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
virtual const IListeningcreateListening (const IRadio *radio, const simtime_t startTime, const simtime_t endTime, const Coord &startPosition, const Coord &endPosition) const override
 Returns a description of how the receiver is listening on the medium. More...
 
virtual const IListeningDecisioncomputeListeningDecision (const IListening *listening, const IInterference *interference) const override
 Returns the result of the listening process specifying the reception state of the receiver. More...
 
virtual bool computeIsReceptionAttempted (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference) const override
 Returns whether the reception of the provided part is actually attempted or ignored by the receiver. More...
 
virtual bool computeIsReceptionSuccessful (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference, const ISnir *snir) const override
 Returns whether the reception of the provided part is actually successful or failed by the receiver. More...
 
virtual const IReceptionDecisioncomputeReceptionDecision (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference, const ISnir *snir) const override
 Returns the reception decision for the transmission part that specifies whether the reception is possible, attempted, and successful. More...
 
- Public Member Functions inherited from inet::physicallayer::ReceiverBase
 ReceiverBase ()
 
virtual W getMinInterferencePower () const override
 Returns the minimum interference power below which receptions are to be ignored while computing the interference. More...
 
virtual W getMinReceptionPower () const override
 Returns the minimum reception power below which successful reception is definitely not possible. More...
 
virtual bool computeIsReceptionPossible (const IListening *listening, const ITransmission *transmission) const override
 Returns whether the reception of the provided transmission is possible or not independently of the reception conditions. More...
 
virtual bool computeIsReceptionPossible (const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part) const override
 Returns whether the reception of the provided part is possible or not. More...
 
virtual const IReceptionResultcomputeReceptionResult (const IListening *listening, const IReception *reception, const IInterference *interference, const ISnir *snir, const std::vector< const IReceptionDecision * > *decisions) const override
 Returns the complete result of the reception process for the provided reception. More...
 
- 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
 
virtual std::vector< bool > * decode (const IReception *reception, const std::vector< const IReception * > *interferingReceptions, const INoise *backgroundNoise) const
 
virtual std::pair< double, double > integrateWindow (simtime_t_cref pNow, simtime_t_cref burst, const IReception *reception, const std::vector< const IReception * > *interferingReceptions, const INoise *backgroundNoise) const
 
- Protected Member Functions inherited from inet::physicallayer::ReceiverBase
virtual int numInitStages () const override
 
virtual W computeSignalPower (const IListening *listening, const ISnir *snir, const IInterference *interference) const
 
virtual PacketcomputeReceivedPacket (const ISnir *snir, bool isReceptionSuccessful) const
 

Protected Attributes

Ieee802154UwbIrMode cfg
 

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) }
 

Constructor & Destructor Documentation

◆ Ieee802154UwbIrReceiver()

inet::physicallayer::Ieee802154UwbIrReceiver::Ieee802154UwbIrReceiver ( )
22  :
23  ReceiverBase()
24 {
25 }

Member Function Documentation

◆ computeIsReceptionAttempted()

bool inet::physicallayer::Ieee802154UwbIrReceiver::computeIsReceptionAttempted ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part,
const IInterference interference 
) const
overridevirtual

Returns whether the reception of the provided part is actually attempted or ignored by the receiver.

For example, it might check that the radio is not already receiving another signal.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Reimplemented from inet::physicallayer::ReceiverBase.

50 {
51  return true;
52 }

◆ computeIsReceptionSuccessful()

bool inet::physicallayer::Ieee802154UwbIrReceiver::computeIsReceptionSuccessful ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part,
const IInterference interference,
const ISnir snir 
) const
overridevirtual

Returns whether the reception of the provided part is actually successful or failed by the receiver.

For example, it might compute the error rate and draw a random number to make the decision.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Implements inet::physicallayer::IReceiver.

55 {
56  std::vector<bool> *bits = decode(reception, interference->getInterferingReceptions(), interference->getBackgroundNoise());
57  int bitLength = bits->size() - 48 - 8;
58  bool isReceptionSuccessful = true;
59  for (int i = 0; i < bitLength; i++) {
60  bool bitValue = bits->at(i);
61  EV_INFO << "Received bit at " << i << " is " << (int)bitValue << endl;
62  }
63  // KLUDGE check fake CRC
64  for (int i = 0; i < 8; i++) {
65  for (int j = 0; j + i < bitLength; j += 8)
66  bits->at(bitLength + i) = bits->at(bitLength + i) ^ bits->at(j + i);
67  isReceptionSuccessful &= !bits->at(bitLength + i);
68  }
69  delete bits;
70  return isReceptionSuccessful;
71 }

Referenced by computeReceptionDecision().

◆ computeListeningDecision()

const IListeningDecision * inet::physicallayer::Ieee802154UwbIrReceiver::computeListeningDecision ( const IListening listening,
const IInterference interference 
) const
overridevirtual

Returns the result of the listening process specifying the reception state of the receiver.

This function must be purely functional and support optimistic parallel computation.

Implements inet::physicallayer::IReceiver.

45 {
46  return new ListeningDecision(listening, true);
47 }

◆ computeReceptionDecision()

const IReceptionDecision * inet::physicallayer::Ieee802154UwbIrReceiver::computeReceptionDecision ( const IListening listening,
const IReception reception,
IRadioSignal::SignalPart  part,
const IInterference interference,
const ISnir snir 
) const
overridevirtual

Returns the reception decision for the transmission part that specifies whether the reception is possible, attempted, and successful.

This function may be called before the reception actually starts at the receiver, thus it must be purely functional and support optimistic parallel computation.

Reimplemented from inet::physicallayer::ReceiverBase.

74 {
75  bool isReceptionSuccessful = computeIsReceptionSuccessful(listening, reception, part, interference, snir);
76  return new ReceptionDecision(reception, part, true, true, isReceptionSuccessful);
77 }

◆ createListening()

const IListening * inet::physicallayer::Ieee802154UwbIrReceiver::createListening ( const IRadio radio,
const simtime_t  startTime,
const simtime_t  endTime,
const Coord startPosition,
const Coord endPosition 
) const
overridevirtual

Returns a description of how the receiver is listening on the medium.

Implements inet::physicallayer::IReceiver.

40 {
41  return new BandListening(radio, startTime, endTime, startPosition, endPosition, cfg.centerFrequency, cfg.bandwidth);
42 }

◆ decode()

std::vector< bool > * inet::physicallayer::Ieee802154UwbIrReceiver::decode ( const IReception reception,
const std::vector< const IReception * > *  interferingReceptions,
const INoise backgroundNoise 
) const
protectedvirtual
80 {
81  simtime_t now, offset;
82  simtime_t aSymbol, shift, burst;
83  // times are absolute
84  offset = reception->getStartTime() + cfg.preambleLength;
85  shift = cfg.shift_duration;
86  aSymbol = cfg.data_symbol_duration;
87  burst = cfg.burst_duration;
88  now = offset + cfg.pulse_duration / 2;
89  std::pair<double, double> energyZero, energyOne;
90  // Loop to decode each bit value
91  int symbol;
92  double packetSNIR = 0;
93  std::vector<bool> *bits = new std::vector<bool>();
94  simtime_t duration = reception->getEndTime() - reception->getStartTime();
95  for (symbol = 0; cfg.preambleLength + symbol * aSymbol < duration; symbol++) {
96  // sample in window zero
97  now = now + cfg.getHoppingPos(symbol) * cfg.burst_duration;
98  energyZero = integrateWindow(now, burst, reception, interferingReceptions, backgroundNoise);
99  // sample in window one
100  now = now + shift;
101  energyOne = integrateWindow(now, burst, reception, interferingReceptions, backgroundNoise);
102  int decodedBit;
103  if (energyZero.second > energyOne.second) {
104  decodedBit = 0;
105  packetSNIR = packetSNIR + energyZero.first;
106  }
107  else {
108  decodedBit = 1;
109  packetSNIR = packetSNIR + energyOne.first;
110  }
111  bits->push_back(decodedBit);
112  now = offset + (symbol + 1) * aSymbol + cfg.pulse_duration / 2;
113  }
114  // TODO review this whole SNR computation, seems to be wrong (from MiXiM)
115  packetSNIR = packetSNIR / (symbol + 1);
116  // TODO double snirLastPacket = 10 * log10(packetSNIR); // convert to dB
117  // TODO return SNIR?
118  return bits;
119 }

Referenced by computeIsReceptionSuccessful().

◆ initialize()

void inet::physicallayer::Ieee802154UwbIrReceiver::initialize ( int  stage)
overrideprotectedvirtual
28 {
29  if (stage == INITSTAGE_LOCAL) {
31  }
32 }

◆ integrateWindow()

std::pair< double, double > inet::physicallayer::Ieee802154UwbIrReceiver::integrateWindow ( simtime_t_cref  pNow,
simtime_t_cref  burst,
const IReception reception,
const std::vector< const IReception * > *  interferingReceptions,
const INoise backgroundNoise 
) const
protectedvirtual
128 {
129  std::pair<double, double> energy = std::make_pair(0.0, 0.0); // first: stores SNIR, second: stores total captured window energy
130  simtime_t windowEnd = pNow + burst;
131  const double peakPulsePower = 1.3E-3; // 1.3E-3 W peak power of pulse to reach 0dBm during burst; // peak instantaneous power of the transmitted pulse (A=0.6V) : 7E-3 W. But peak limit is 0 dBm
132  // Triangular baseband pulses
133  // we sample at each pulse peak
134  // get the interpolated values of amplitude for each interferer
135  // and add these to the peak with a random phase
136  // we sample one point per pulse
137  // caller has already set our time reference ("now") at the peak of the pulse
138  for (simtime_t now = pNow; now < windowEnd; now += cfg.pulse_duration) {
139  double signalValue = 0; // electric field from tracked signal [V/m²]
140  double resPower = 0; // electric field at antenna = combination of all arriving electric fields [V/m²]
141  double vEfield = 0; // voltage at antenna caused by electric field Efield [V]
142  double vmeasured = 0; // voltage measured by energy-detector [V], including thermal noise
143  double vmeasured_square = 0; // to the square [V²]
144  double snir = 0; // burst SNIR estimate
145  double vThermalNoise = 0; // thermal noise realization
146  // consider signal power
147  const DimensionalReception *dimensionalSignalReception = check_and_cast<const DimensionalReception *>(reception);
148  const Ptr<const IFunction<WpHz, Domain<simsec, Hz>>>& signalPower = dimensionalSignalReception->getPower();
149  Interval<simsec, Hz> interval(Point<simsec, Hz>(simsec(now), Hz(3.1)), Point<simsec, Hz>(simsec(now), Hz(10.6)), 0b10, 0b10, 0b10);
150  double measure = signalPower->getMean(interval).get() * peakPulsePower; // TODO de-normalize (peakPulsePower should be in AirFrame or in Signal, to be set at run-time)
151  signalValue = measure * 0.5; // we capture half of the maximum possible pulse energy to account for self interference
152  resPower = resPower + signalValue;
153  // consider all interferers at this point in time
154  for (const auto& interferingReception : *interferingReceptions) {
155  const DimensionalReception *dimensionalInterferingReception = check_and_cast<const DimensionalReception *>(interferingReception);
156  const Ptr<const IFunction<WpHz, Domain<simsec, Hz>>>& interferingPower = dimensionalInterferingReception->getPower();
157  double measure = interferingPower->getMean(interval).get() * peakPulsePower; // TODO de-normalize (peakPulsePower should be in AirFrame or in Signal, to be set at run-time)
158  // measure = measure * uniform(0, +1); // random point of Efield at sampling (due to pulse waveform and self interference)
159  // take a random point within pulse envelope for interferer
160  resPower = resPower + measure * uniform(-1, +1);
161  }
162 // double attenuatedPower = resPower / 10; // 10 dB = 6 dB implementation loss + 5 dB noise factor
163  vEfield = sqrt(50 * resPower); // P=V²/R
164  // add thermal noise realization
165  const DimensionalNoise *dimensionalBackgroundNoise = check_and_cast<const DimensionalNoise *>(backgroundNoise);
166  vThermalNoise = dimensionalBackgroundNoise->getPower()->getMean(interval).get();
167  vmeasured = vEfield + vThermalNoise;
168  vmeasured_square = pow(vmeasured, 2);
169  // signal + interference + noise
170  energy.second = energy.second + vmeasured_square; // collect this contribution
171  // Now evaluates signal to noise ratio
172  // signal converted to antenna voltage squared
173  // TODO review this SNIR computation
174  snir = signalValue / 2.0217E-12;
175  energy.first = energy.first + snir;
176 
177  } // consider next point in time
178  return energy;
179 }

Referenced by decode().

◆ printToStream()

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

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

35 {
36  return stream << "Ieee802154UwbIrReceiver";
37 }

Member Data Documentation

◆ cfg

Ieee802154UwbIrMode inet::physicallayer::Ieee802154UwbIrReceiver::cfg
protected

The documentation for this class was generated from the following files:
inet::physicallayer::Ieee802154UwbIrMode::bandwidth
Hz bandwidth
Definition: Ieee802154UwbIrMode.h:87
inet::units::values::simsec
value< simtime_t, units::s > simsec
Definition: Units.h:1236
inet::units::units::Hz
pow< s, -1 > Hz
Definition: Units.h:935
inet::physicallayer::Ieee802154UwbIrMode::cfg_mandatory_16M
static const Ieee802154UwbIrMode cfg_mandatory_16M
Definition: Ieee802154UwbIrMode.h:47
inet::physicallayer::Ieee802154UwbIrMode::preambleLength
double preambleLength
Definition: Ieee802154UwbIrMode.h:85
inet::physicallayer::Ieee802154UwbIrMode::centerFrequency
Hz centerFrequency
Definition: Ieee802154UwbIrMode.h:86
inet::units::sqrt
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:272
inet::physicallayer::Ieee802154UwbIrMode::burst_duration
double burst_duration
Definition: Ieee802154UwbIrMode.h:84
inet::physicallayer::Ieee802154UwbIrReceiver::cfg
Ieee802154UwbIrMode cfg
Definition: Ieee802154UwbIrReceiver.h:24
inet::physicallayer::ReceiverBase::ReceiverBase
ReceiverBase()
Definition: ReceiverBase.h:29
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::physicallayer::Ieee802154UwbIrReceiver::integrateWindow
virtual std::pair< double, double > integrateWindow(simtime_t_cref pNow, simtime_t_cref burst, const IReception *reception, const std::vector< const IReception * > *interferingReceptions, const INoise *backgroundNoise) const
Definition: Ieee802154UwbIrReceiver.cc:127
inet::physicallayer::Ieee802154UwbIrMode::shift_duration
double shift_duration
Definition: Ieee802154UwbIrMode.h:82
inet::physicallayer::Ieee802154UwbIrMode::data_symbol_duration
double data_symbol_duration
Definition: Ieee802154UwbIrMode.h:81
inet::physicallayer::Ieee802154UwbIrReceiver::computeIsReceptionSuccessful
virtual bool computeIsReceptionSuccessful(const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part, const IInterference *interference, const ISnir *snir) const override
Returns whether the reception of the provided part is actually successful or failed by the receiver.
Definition: Ieee802154UwbIrReceiver.cc:54
inet::physicallayer::Ieee802154UwbIrReceiver::decode
virtual std::vector< bool > * decode(const IReception *reception, const std::vector< const IReception * > *interferingReceptions, const INoise *backgroundNoise) const
Definition: Ieee802154UwbIrReceiver.cc:79
inet::physicallayer::Ieee802154UwbIrMode::getHoppingPos
int getHoppingPos(int sym) const
Definition: Ieee802154UwbIrMode.cc:106
inet::physicallayer::Ieee802154UwbIrMode::pulse_duration
double pulse_duration
Definition: Ieee802154UwbIrMode.h:83