Skip to content

Commit

Permalink
phy: rename sensitivity/noise parameters and change values used in tu…
Browse files Browse the repository at this point in the history
…torial simulation
  • Loading branch information
sommer committed Dec 31, 2018
1 parent a954385 commit 8affb26
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions examples/veins/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ sim-time-limit = 200s

*.**.nic.mac1609_4.txPower = 20mW
*.**.nic.mac1609_4.bitrate = 6Mbps
*.**.nic.phy80211p.sensitivity = -89dBm
*.**.nic.phy80211p.minPowerLevel = -110dBm

*.**.nic.phy80211p.useThermalNoise = true
*.**.nic.phy80211p.thermalNoise = -110dBm
*.**.nic.phy80211p.useNoiseFloor = true
*.**.nic.phy80211p.noiseFloor = -98dBm

*.**.nic.phy80211p.decider = xmldoc("config.xml")
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
Expand Down
6 changes: 3 additions & 3 deletions src/veins/base/phyLayer/BaseDecider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ simtime_t BaseDecider::processNewSignal(AirFrame* frame)
double recvPower = signal.getMax();

// check whether signal is strong enough to receive
if (recvPower < sensitivity) {
EV_TRACE << "Signal is too weak (" << recvPower << " < " << sensitivity << ") -> do not receive." << endl;
if (recvPower < minPowerLevel) {
EV_TRACE << "Signal is too weak (" << recvPower << " < " << minPowerLevel << ") -> do not receive." << endl;
// Signal too weak, we can't receive it, tell PhyLayer that we don't want it again
return notAgain;
}

// Signal is strong enough, receive this Signal and schedule it
EV_TRACE << "Signal is strong enough (" << recvPower << " > " << sensitivity << ") -> Trying to receive AirFrame." << endl;
EV_TRACE << "Signal is strong enough (" << recvPower << " > " << minPowerLevel << ") -> Trying to receive AirFrame." << endl;

currentSignal.first = frame;
currentSignal.second = EXPECT_END;
Expand Down
12 changes: 6 additions & 6 deletions src/veins/base/phyLayer/BaseDecider.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class VEINS_API BaseDecider : public Decider {
EXPECT_END,
};

/** @brief sensitivity value for receiving an AirFrame */
double sensitivity;
/** @brief minPowerLevel value for receiving an AirFrame */
double minPowerLevel;

/** @brief Pair of a AirFrame and the state it is in. */
typedef std::pair<AirFrame*, int> ReceivedSignal;
Expand All @@ -79,11 +79,11 @@ class VEINS_API BaseDecider : public Decider {
/**
* @brief Initializes the decider with the passed values.
*
* Needs a pointer to its physical layer, the sensitivity, and the index of the host.
* Needs a pointer to its physical layer, the minPowerLevel, and the index of the host.
*/
BaseDecider(cComponent* owner, DeciderToPhyInterface* phy, double sensitivity, int myIndex)
BaseDecider(cComponent* owner, DeciderToPhyInterface* phy, double minPowerLevel, int myIndex)
: Decider(owner, phy)
, sensitivity(sensitivity)
, minPowerLevel(minPowerLevel)
, isChannelIdle(true)
, myIndex(myIndex)
{
Expand All @@ -110,7 +110,7 @@ class VEINS_API BaseDecider : public Decider {
* handle the signal again.
*
* Default implementation checks if the signals receiving power
* is above the sensitivity of the radio and we are not already trying
* is above the minPowerLevel of the radio and we are not already trying
* to receive another AirFrame. If thats the case it waits for the end
* of the signal.
*/
Expand Down
18 changes: 9 additions & 9 deletions src/veins/base/phyLayer/BasePhyLayer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ void BasePhyLayer::initialize(int stage)
upperControlOut = findGate("upperControlOut");
upperControlIn = findGate("upperControlIn");

if (par("useThermalNoise").boolValue()) {
thermalNoiseValue = FWMath::dBm2mW(par("thermalNoise").doubleValue());
if (par("useNoiseFloor").boolValue()) {
noiseFloorValue = FWMath::dBm2mW(par("noiseFloor").doubleValue());
}
else {
thermalNoiseValue = 0;
noiseFloorValue = 0;
}
sensitivity = par("sensitivity").doubleValue();
sensitivity = FWMath::dBm2mW(sensitivity);
minPowerLevel = par("minPowerLevel").doubleValue();
minPowerLevel = FWMath::dBm2mW(minPowerLevel);

recordStats = par("recordStats").boolValue();

Expand All @@ -72,8 +72,8 @@ void BasePhyLayer::initialize(int stage)
throw cRuntimeError("Could not find BaseWorldUtility module");
}

if (cc->hasPar("sat") && (sensitivity - FWMath::dBm2mW(cc->par("sat").doubleValue())) < -0.000001) {
throw cRuntimeError("Sensitivity can't be smaller than the signal attenuation threshold (sat) in ConnectionManager. Please adjust your omnetpp.ini file accordingly.");
if (cc->hasPar("sat") && (minPowerLevel - FWMath::dBm2mW(cc->par("sat").doubleValue())) < -0.000001) {
throw cRuntimeError("minPowerLevel can't be smaller than the signal attenuation threshold (sat) in ConnectionManager. Please adjust your omnetpp.ini file accordingly.");
}

initializeAnalogueModels(par("analogueModels").xmlValue());
Expand Down Expand Up @@ -748,9 +748,9 @@ void BasePhyLayer::getChannelInfo(simtime_t_cref from, simtime_t_cref to, AirFra
channelInfo.getAirFrames(from, to, out);
}

double BasePhyLayer::getThermalNoiseValue()
double BasePhyLayer::getNoiseFloorValue()
{
return thermalNoiseValue;
return noiseFloorValue;
}

void BasePhyLayer::sendControlMsgToMac(cMessage* msg)
Expand Down
8 changes: 4 additions & 4 deletions src/veins/base/phyLayer/BasePhyLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class VEINS_API BasePhyLayer : public ChannelAccess, public DeciderToPhyInterfac
}

int protocolId = PROTOCOL_ID_GENERIC; ///< The ID of the protocol this phy can transceive.
double thermalNoiseValue = 0; ///< Defines the strength of the thermal noise.
double sensitivity; ///< The sensitivity describes the minimum strength a signal must have to be received.
double noiseFloorValue = 0; ///< Catch-all for all factors negatively impacting SINR (e.g., thermal noise, noise figure, ...)
double minPowerLevel; ///< The minimum receive power needed to even attempt decoding a frame.
bool recordStats; ///< Stores if tracking of statistics (esp. cOutvectors) is enabled.
ChannelInfo channelInfo; ///< Channel info keeps track of received AirFrames and provides information about currently active AirFrames at the channel.
std::unique_ptr<Radio> radio; ///< The state machine storing the current radio state (TX, RX, SLEEP).
Expand Down Expand Up @@ -406,9 +406,9 @@ class VEINS_API BasePhyLayer : public ChannelAccess, public DeciderToPhyInterfac
void getChannelInfo(simtime_t_cref from, simtime_t_cref to, AirFrameVector& out) override;

/**
* Return thermal noise power level (in mW).
* Return noise floor level (in mW).
*/
double getThermalNoiseValue() override;
double getNoiseFloorValue() override;

/**
* Send the given message to via the control gate to the mac.
Expand Down
6 changes: 3 additions & 3 deletions src/veins/base/phyLayer/BasePhyLayer.ned
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ simple BasePhyLayer like IWirelessPhy
bool recordStats = default(false); //enable/disable tracking of statistics (eg. cOutvectors)

bool usePropagationDelay; //Should transmission delay be simulated?
double thermalNoise @unit(dBm); //the strength of the thermal noise [dBm]
bool useThermalNoise; //should thermal noise be considered?
double noiseFloor @unit(dBm); // catch-all for all factors negatively impacting SINR (e.g., thermal noise, noise figure, ...)
bool useNoiseFloor; // should a noise floor be considered when calculating SINR?


xml antenna = default(xml("<root><Antenna type=\"IsotropicAntenna\" id=\"default_isotropic\"></Antenna></root>"));
Expand All @@ -22,7 +22,7 @@ simple BasePhyLayer like IWirelessPhy
xml analogueModels; //Specification of the analogue models to use and their parameters
xml decider; //Specification of the decider to use and its parameters

double sensitivity @unit(dBm); //The sensitivity of the physical layer [dBm]
double minPowerLevel @unit(dBm); // The minimum receive power needed to even attempt decoding a frame

//# switch times [s]:
double timeRXToTX = default(0) @unit(s); // Elapsed time to switch from receive to send state
Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/phyLayer/DeciderToPhyInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class VEINS_API DeciderToPhyInterface {
virtual void getChannelInfo(simtime_t_cref from, simtime_t_cref to, AirFrameVector& out) = 0;

/**
* @brief Returns a constant which defines the thermal noise in
* @brief Returns a constant which defines the noise floor in
* the passed time frame (in mW).
*/
virtual double getThermalNoiseValue() = 0;
virtual double getNoiseFloorValue() = 0;

/**
* @brief Called by the Decider to send a control message to the MACLayer
Expand Down
6 changes: 3 additions & 3 deletions src/veins/base/phyLayer/IWirelessPhy.ned
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ moduleinterface IWirelessPhy extends IChannelAccess
bool recordStats; //enable/disable tracking of statistics (eg. cOutvectors)

bool usePropagationDelay; //Should transmission delay be simulated?
double thermalNoise @unit(dBm); //the strength of the thermal noise [dBm]
bool useThermalNoise; //should thermal noise be considered?
double noiseFloor @unit(dBm); // catch-all for all factors negatively impacting SINR (e.g., thermal noise, noise figure, ...)
bool useNoiseFloor; // should a noise floor be considered when calculating SINR?

xml analogueModels; //Specification of the analogue models to use and their parameters
xml decider; //Specification of the decider to use and its parameters

double sensitivity @unit(dBm); //The sensitivity of the physical layer [dBm]
double minPowerLevel @unit(dBm); // The minimum receive power needed to even attempt decoding a frame

//# switch times [s]:
double timeRXToTX @unit(s); // Elapsed time to switch from receive to send state
Expand Down
4 changes: 2 additions & 2 deletions src/veins/modules/messages/AirFrame11p.msg
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace Veins;
class AirFrame;

//
// Extension of base AirFrame message to have the underSensitivity field
// Extension of base AirFrame message to have the underMinPowerLevel field
//
message AirFrame11p extends AirFrame {
bool underSensitivity = false;
bool underMinPowerLevel = false;
bool wasTransmitting = false;
}
18 changes: 9 additions & 9 deletions src/veins/modules/phy/Decider80211p.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ simtime_t Decider80211p::processNewSignal(AirFrame* msg)

signalStates[frame] = EXPECT_END;

if (signal.smallerAtCenterFrequency(sensitivity)) {
if (signal.smallerAtCenterFrequency(minPowerLevel)) {

// annotate the frame, so that we won't try decoding it at its end
frame->setUnderSensitivity(true);
frame->setUnderMinPowerLevel(true);
// check channel busy status. a superposition of low power frames might turn channel status to busy
if (cca(simTime(), nullptr) == false) {
setChannelIdleStatus(false);
Expand All @@ -73,14 +73,14 @@ simtime_t Decider80211p::processNewSignal(AirFrame* msg)
if (!currentSignal.first) {
// NIC is not yet synced to any frame, so lock and try to decode this frame
currentSignal.first = frame;
EV_TRACE << "AirFrame: " << frame->getId() << " with (" << recvPower << " > " << sensitivity << ") -> Trying to receive AirFrame." << std::endl;
EV_TRACE << "AirFrame: " << frame->getId() << " with (" << recvPower << " > " << minPowerLevel << ") -> Trying to receive AirFrame." << std::endl;
if (notifyRxStart) {
phy->sendControlMsgToMac(new cMessage("RxStartStatus", MacToPhyInterface::PHY_RX_START));
}
}
else {
// NIC is currently trying to decode another frame. this frame will be simply treated as interference
EV_TRACE << "AirFrame: " << frame->getId() << " with (" << recvPower << " > " << sensitivity << ") -> Already synced to another AirFrame. Treating AirFrame as interference." << std::endl;
EV_TRACE << "AirFrame: " << frame->getId() << " with (" << recvPower << " > " << minPowerLevel << ") -> Already synced to another AirFrame. Treating AirFrame as interference." << std::endl;
}

// channel turned busy
Expand Down Expand Up @@ -118,7 +118,7 @@ DeciderResult* Decider80211p::checkIfSignalOk(AirFrame* frame)
AirFrameVector airFrames;
getChannelInfo(start, end, airFrames);

double noise = phy->getThermalNoiseValue();
double noise = phy->getNoiseFloorValue();

// Make sure to use the adjusted starting-point (which ignores the preamble)
double sinrMin = SignalUtils::getMinSINR(start, end, frame, airFrames, noise);
Expand Down Expand Up @@ -260,7 +260,7 @@ bool Decider80211p::cca(simtime_t_cref time, AirFrame* exclude)

// In the reference implementation only centerFrequenvy - 5e6 (half bandwidth) is checked!
// Although this is wrong, the same is done here to reproduce original results
double minPower = phy->getThermalNoiseValue();
double minPower = phy->getNoiseFloorValue();
bool isChannelIdle = minPower < ccaThreshold;
if (airFrames.size() > 0) {
size_t usedFreqIndex = airFrames.front()->getSignal().getSpectrum().indexOf(centerFrequency - 5e6);
Expand All @@ -287,7 +287,7 @@ simtime_t Decider80211p::processSignalEnd(AirFrame* msg)

DeciderResult* result;

if (frame->getUnderSensitivity()) {
if (frame->getUnderMinPowerLevel()) {
// this frame was not even detected by the radio card
result = new DeciderResult80211(false, 0, 0, recvPower_dBm);
}
Expand Down Expand Up @@ -323,8 +323,8 @@ simtime_t Decider80211p::processSignalEnd(AirFrame* msg)
phy->sendUp(frame, result);
}
else {
if (frame->getUnderSensitivity()) {
EV_TRACE << "packet was not detected by the card. power was under sensitivity threshold\n";
if (frame->getUnderMinPowerLevel()) {
EV_TRACE << "packet was not detected by the card. power was under minPowerLevel threshold\n";
}
else if (whileSending) {
EV_TRACE << "packet was received while sending, sending it as control message to upper layer\n";
Expand Down
6 changes: 3 additions & 3 deletions src/veins/modules/phy/Decider80211p.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ class Decider80211p : public BaseDecider {
public:
/**
* @brief Initializes the Decider with a pointer to its PhyLayer and
* specific values for threshold and sensitivity
* specific values for threshold and minPowerLevel
*/
Decider80211p(cComponent* owner, DeciderToPhyInterface* phy, double sensitivity, double ccaThreshold, bool allowTxDuringRx, double centerFrequency, int myIndex = -1, bool collectCollisionStatistics = false)
: BaseDecider(owner, phy, sensitivity, myIndex)
Decider80211p(cComponent* owner, DeciderToPhyInterface* phy, double minPowerLevel, double ccaThreshold, bool allowTxDuringRx, double centerFrequency, int myIndex = -1, bool collectCollisionStatistics = false)
: BaseDecider(owner, phy, minPowerLevel, myIndex)
, ccaThreshold(ccaThreshold)
, allowTxDuringRx(allowTxDuringRx)
, centerFrequency(centerFrequency)
Expand Down
2 changes: 1 addition & 1 deletion src/veins/modules/phy/PhyLayer80211p.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ unique_ptr<AnalogueModel> PhyLayer80211p::initializeVehicleObstacleShadowing(Par
unique_ptr<Decider> PhyLayer80211p::initializeDecider80211p(ParameterMap& params)
{
double centerFreq = params["centerFrequency"];
auto dec = make_unique<Decider80211p>(this, this, sensitivity, ccaThreshold, allowTxDuringRx, centerFreq, findHost()->getIndex(), collectCollisionStatistics);
auto dec = make_unique<Decider80211p>(this, this, minPowerLevel, ccaThreshold, allowTxDuringRx, centerFreq, findHost()->getIndex(), collectCollisionStatistics);
dec->setPath(getParentModule()->getFullPath());
return unique_ptr<Decider>(std::move(dec));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ sim-time-limit = 100s
*.**.nic.mac1609_4.txPower = 20mW
*.**.nic.mac1609_4.bitrate = 18Mbps

*.**.nic.phy80211p.sensitivity = -89dBm
*.**.nic.phy80211p.useThermalNoise = true
*.**.nic.phy80211p.thermalNoise = -110dBm
*.**.nic.phy80211p.minPowerLevel = -110dBm
*.**.nic.phy80211p.useNoiseFloor = true
*.**.nic.phy80211p.noiseFloor = -98dBm
*.**.nic.phy80211p.decider = xmldoc("config.xml")
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
*.**.nic.phy80211p.usePropagationDelay = true
Expand Down

0 comments on commit 8affb26

Please sign in to comment.