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::physicallayer::IPrintableObject

Public Member Functions

 Ieee802154UWBIRReceiver ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) 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...
 
virtual const ReceptionIndicationcomputeReceptionIndication (const ISNIR *snir) const override
 Returns the reception indication (control info) that is sent up to the MAC. 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 override
 Returns the complete result of the reception process for the provided reception. More...
 
virtual ReceptionIndicationcreateReceptionIndication () const
 Returns an empty reception indication (control info). More...
 
- 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 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
 

Protected Attributes

Ieee802154UWBIRMode cfg
 

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::Ieee802154UWBIRReceiver::Ieee802154UWBIRReceiver ( )
31  :
32  ReceiverBase()
33 {
34 }
ReceiverBase()
Definition: ReceiverBase.h:35

Member Function Documentation

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.

60 {
61  return true;
62 }
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.

Referenced by computeReceptionDecision().

65 {
66  std::vector<bool> *bits = decode(reception, interference->getInterferingReceptions(), interference->getBackgroundNoise());
67  int bitLength = bits->size() - 48 - 8;
68  bool isReceptionSuccessful = true;
69  for (int i = 0; i < bitLength; i++) {
70  bool bitValue = bits->at(i);
71  EV_INFO << "Received bit at " << i << " is " << (int)bitValue << endl;
72  }
73  // KLUDGE: check fake CRC
74  for (int i = 0; i < 8; i++) {
75  for (int j = 0; j + i < bitLength; j += 8)
76  bits->at(bitLength + i) = bits->at(bitLength + i) ^ bits->at(j + i);
77  isReceptionSuccessful &= !bits->at(bitLength + i);
78  }
79  delete bits;
80  return isReceptionSuccessful;
81 }
virtual std::vector< bool > * decode(const IReception *reception, const std::vector< const IReception * > *interferingReceptions, const INoise *backgroundNoise) const
Definition: Ieee802154UWBIRReceiver.cc:94
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.

55 {
56  return new ListeningDecision(listening, true);
57 }
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.

84 {
85  bool isReceptionSuccessful = computeIsReceptionSuccessful(listening, reception, part, interference, snir);
86  return new ReceptionDecision(reception, part, true, true, isReceptionSuccessful);
87 }
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:64
const ReceptionIndication * inet::physicallayer::Ieee802154UWBIRReceiver::computeReceptionIndication ( const ISNIR snir) const
overridevirtual

Returns the reception indication (control info) that is sent up to the MAC.

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.

90 {
91  return new ReceptionIndication();
92 }
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.

50 {
51  return new BandListening(radio, startTime, endTime, startPosition, endPosition, cfg.centerFrequency, cfg.bandwidth);
52 }
Hz bandwidth
Definition: Ieee802154UWBIRMode.h:94
Ieee802154UWBIRMode cfg
Definition: Ieee802154UWBIRReceiver.h:35
Hz centerFrequency
Definition: Ieee802154UWBIRMode.h:93
std::vector< bool > * inet::physicallayer::Ieee802154UWBIRReceiver::decode ( const IReception reception,
const std::vector< const IReception * > *  interferingReceptions,
const INoise backgroundNoise 
) const
protectedvirtual

Referenced by computeIsReceptionSuccessful().

95 {
96  simtime_t now, offset;
97  simtime_t aSymbol, shift, burst;
98  // times are absolute
99  offset = reception->getStartTime() + cfg.preambleLength;
100  shift = cfg.shift_duration;
101  aSymbol = cfg.data_symbol_duration;
102  burst = cfg.burst_duration;
103  now = offset + cfg.pulse_duration / 2;
104  std::pair<double, double> energyZero, energyOne;
105  // Loop to decode each bit value
106  int symbol;
107  double packetSNIR = 0;
108  std::vector<bool> *bits = new std::vector<bool>();
109  simtime_t duration = reception->getEndTime() - reception->getStartTime();
110  for (symbol = 0; cfg.preambleLength + symbol * aSymbol < duration; symbol++) {
111  // sample in window zero
112  now = now + cfg.getHoppingPos(symbol) * cfg.burst_duration;
113  energyZero = integrateWindow(now, burst, reception, interferingReceptions, backgroundNoise);
114  // sample in window one
115  now = now + shift;
116  energyOne = integrateWindow(now, burst, reception, interferingReceptions, backgroundNoise);
117  int decodedBit;
118  if (energyZero.second > energyOne.second) {
119  decodedBit = 0;
120  packetSNIR = packetSNIR + energyZero.first;
121  }
122  else {
123  decodedBit = 1;
124  packetSNIR = packetSNIR + energyOne.first;
125  }
126  bits->push_back(decodedBit);
127  now = offset + (symbol + 1) * aSymbol + cfg.pulse_duration / 2;
128  }
129  // TODO: review this whole SNR computation, seems to be wrong (from MiXiM)
130  packetSNIR = packetSNIR / (symbol + 1);
131  // TODO: double snirLastPacket = 10 * log10(packetSNIR); // convert to dB
132  // TODO: return SNIR?
133  return bits;
134 }
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:142
double burst_duration
Definition: Ieee802154UWBIRMode.h:91
int getHoppingPos(int sym) const
Definition: Ieee802154UWBIRMode.cc:109
double pulse_duration
Definition: Ieee802154UWBIRMode.h:90
double shift_duration
Definition: Ieee802154UWBIRMode.h:89
Ieee802154UWBIRMode cfg
Definition: Ieee802154UWBIRReceiver.h:35
double data_symbol_duration
Definition: Ieee802154UWBIRMode.h:88
double preambleLength
Definition: Ieee802154UWBIRMode.h:92
void inet::physicallayer::Ieee802154UWBIRReceiver::initialize ( int  stage)
overrideprotectedvirtual
37 {
38  if (stage == INITSTAGE_LOCAL)
39  {
41  }
42 }
static const Ieee802154UWBIRMode cfg_mandatory_16M
Definition: Ieee802154UWBIRMode.h:50
Local initializations.
Definition: InitStages.h:35
Ieee802154UWBIRMode cfg
Definition: Ieee802154UWBIRReceiver.h:35
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

Referenced by decode().

143 {
144  std::pair<double, double> energy = std::make_pair(0.0, 0.0); // first: stores SNIR, second: stores total captured window energy
145  Argument arg;
146  simtime_t windowEnd = pNow + burst;
147  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
148  // Triangular baseband pulses
149  // we sample at each pulse peak
150  // get the interpolated values of amplitude for each interferer
151  // and add these to the peak with a random phase
152  // we sample one point per pulse
153  // caller has already set our time reference ("now") at the peak of the pulse
154  for (simtime_t now = pNow; now < windowEnd; now += cfg.pulse_duration) {
155  double signalValue = 0; // electric field from tracked signal [V/m²]
156  double resPower = 0; // electric field at antenna = combination of all arriving electric fields [V/m²]
157  double vEfield = 0; // voltage at antenna caused by electric field Efield [V]
158  double vmeasured = 0; // voltage measured by energy-detector [V], including thermal noise
159  double vmeasured_square = 0; // to the square [V²]
160  double snir = 0; // burst SNIR estimate
161  double vThermalNoise = 0; // thermal noise realization
162  arg.setTime(now);
163  // consider signal power
164  const DimensionalReception *dimensionalSignalReception = check_and_cast<const DimensionalReception *>(reception);
165  const ConstMapping *const signalPower = dimensionalSignalReception->getPower();
166  double measure = signalPower->getValue(arg) * peakPulsePower; //TODO: de-normalize (peakPulsePower should be in AirFrame or in Signal, to be set at run-time)
167  signalValue = measure * 0.5; // we capture half of the maximum possible pulse energy to account for self interference
168  resPower = resPower + signalValue;
169  // consider all interferers at this point in time
170  for (const auto & interferingReception : *interferingReceptions) {
171  const DimensionalReception *dimensionalInterferingReception = check_and_cast<const DimensionalReception *>(interferingReception);
172  const ConstMapping *const interferingPower = dimensionalInterferingReception->getPower();
173  double measure = interferingPower->getValue(arg) * peakPulsePower; //TODO: de-normalize (peakPulsePower should be in AirFrame or in Signal, to be set at run-time)
174 // measure = measure * uniform(0, +1); // random point of Efield at sampling (due to pulse waveform and self interference)
175  // take a random point within pulse envelope for interferer
176  resPower = resPower + measure * uniform(-1, +1);
177  }
178 // double attenuatedPower = resPower / 10; // 10 dB = 6 dB implementation loss + 5 dB noise factor
179  vEfield = sqrt(50*resPower); // P=V²/R
180  // add thermal noise realization
181  const DimensionalNoise *dimensionalBackgroundNoise = check_and_cast<const DimensionalNoise *>(backgroundNoise);
182  vThermalNoise = dimensionalBackgroundNoise->getPower()->getValue(arg);
183  vmeasured = vEfield + vThermalNoise;
184  vmeasured_square = pow(vmeasured, 2);
185  // signal + interference + noise
186  energy.second = energy.second + vmeasured_square; // collect this contribution
187  // Now evaluates signal to noise ratio
188  // signal converted to antenna voltage squared
189  // TODO: review this SNIR computation
190  snir = signalValue / 2.0217E-12;
191  energy.first = energy.first + snir;
192 
193  } // consider next point in time
194  return energy;
195 }
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
double pulse_duration
Definition: Ieee802154UWBIRMode.h:90
Ieee802154UWBIRMode cfg
Definition: Ieee802154UWBIRReceiver.h:35
std::ostream & inet::physicallayer::Ieee802154UWBIRReceiver::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::IPrintableObject.

45 {
46  return stream << "Ieee802154UWBIRReceiver";
47 }

Member Data Documentation

Ieee802154UWBIRMode inet::physicallayer::Ieee802154UWBIRReceiver::cfg
protected

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