diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py old mode 100644 new mode 100755 index 04c8c2f84..c04f8ba31 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -27,6 +27,9 @@ cpp_examples = [ ("wifi-wired-bridging", "True", "True"), ("power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10", "True", "True"), ("power-adaptation-distance --manager=ns3::AparfWifiManager --outputFileName=aparf --steps=5 --stepsSize=10", "True", "True"), + ("ofdm-ht-validation", "True", "True"), + ("ofdm-validation", "True", "True"), + ("ofdm-vht-validation", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/examples/wireless/ofdm-ht-validation.cc b/examples/wireless/ofdm-ht-validation.cc index 466c36308..d4b834972 100644 --- a/examples/wireless/ofdm-ht-validation.cc +++ b/examples/wireless/ofdm-ht-validation.cc @@ -15,6 +15,12 @@ * * Authors: Sébastien Deronne */ + +// This example is used to validate NIST and YANS error rate models for HT rates. +// +// It ouputs plots of the Frame Success Rate versus the Signal-to-noise ratio for +// both NIST and YANS error rate models and for every HT MCS value. + #include "ns3/core-module.h" #include "ns3/yans-error-rate-model.h" #include "ns3/nist-error-rate-model.h" @@ -65,7 +71,17 @@ int main (int argc, char *argv[]) { double ps = yans->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); yansdataset.Add (snr, ps); + if (ps < 0 || ps > 1) + { + //error + return 0; + } ps = nist->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); + if (ps < 0 || ps > 1) + { + //error + return 0; + } nistdataset.Add (snr, ps); } diff --git a/examples/wireless/ofdm-validation.cc b/examples/wireless/ofdm-validation.cc index 3b2081b42..710e6faf5 100644 --- a/examples/wireless/ofdm-validation.cc +++ b/examples/wireless/ofdm-validation.cc @@ -17,6 +17,12 @@ * * Author: Gary Pei */ + +// This example is used to validate NIST and YANS error rate models for OFDM rates. +// +// It ouputs plots of the Frame Success Rate versus the Signal-to-noise ratio for +// both NIST and YANS error rate models and for every OFDM mode. + #include "ns3/core-module.h" #include "ns3/yans-error-rate-model.h" #include "ns3/nist-error-rate-model.h" @@ -66,7 +72,17 @@ int main (int argc, char *argv[]) { double ps = yans->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); yansdataset.Add (snr, ps); + if (ps < 0 || ps > 1) + { + //error + return 0; + } ps = nist->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); + if (ps < 0 || ps > 1) + { + //error + return 0; + } nistdataset.Add (snr, ps); } diff --git a/examples/wireless/ofdm-vht-validation.cc b/examples/wireless/ofdm-vht-validation.cc index b66d2f25e..f67260027 100644 --- a/examples/wireless/ofdm-vht-validation.cc +++ b/examples/wireless/ofdm-vht-validation.cc @@ -15,6 +15,13 @@ * * Authors: Sébastien Deronne */ + +// This example is used to validate NIST and YANS error rate models for VHT rates. +// +// It ouputs plots of the Frame Success Rate versus the Signal-to-noise ratio for +// both NIST and YANS error rate models and for every VHT MCS value (MCS 9 is not +// included since it is forbidden for 20 MHz channels). + #include "ns3/core-module.h" #include "ns3/yans-error-rate-model.h" #include "ns3/nist-error-rate-model.h" @@ -64,8 +71,18 @@ int main (int argc, char *argv[]) for (double snr = -5.0; snr <= 30.0; snr += 0.1) { double ps = yans->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); + if (ps < 0 || ps > 1) + { + //error + return 0; + } yansdataset.Add (snr, ps); ps = nist->GetChunkSuccessRate (WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8); + if (ps < 0 || ps > 1) + { + //error + return 0; + } nistdataset.Add (snr, ps); }