adjacentlink / emane

Distributed wireless network emulation framework
Other
127 stars 37 forks source link

add lognormal fading model #198

Closed weston-nrl closed 3 years ago

weston-nrl commented 3 years ago

The Lognormal EMANE fading model was created to more accurately model Free Space Optical (FSO) loss, but is written in a purely statistical manner so it may have other uses. The model works by creating a constant series of fades, each of which has a constant fade depth that may or may not cause packet loss. The model keeps internal state on the time each fading period ends, and generates a new fading period once a packet arrives after the current fading period has ended. Fade depths (related to the effective pathloss experienced during the fade) are lognormally distributed (but constant during a given fading period). Fade lengths are normally distributed.

Some of the model parameters (thresholds, pathloss values) are used to relate the fading depth to EMANE-relevant pathloss to cause a corresponding amount of packet loss. Note that there is an inverse relationship for the fading depths and pathloss values -- lower values for fading depth result in 100% loss, while higher values result in no loss. For values between the thresholds, linear interpolation is done to calculate a corresponding pathloss value that may result in random probability drops during the fading period.

sgalgano commented 3 years ago

Thanks for the pull. I ran through some functional tests and all looks good. It's nice to have another fading model. Build and packaging tested on CentOS 7, CentOS 8, F33, and Ubuntu 20.04 LTS. All passed.

  1. Update your commit message to include a detailed explanation of the lognormal fading model and its parameters. As an example of the level of detail, see 298af954ce844503841fdb493ac45f1f302f0500, aab0b4f54ddac7a089df71e80122ced7bafb0271, 559ef4228aed56c37cf6ef91e42131b3c7094f74.

  2. Add braces to your conditional statements here and here. We don't have it documented anywhere but we always use braces in the emane source, even for single line conditional statements.

  3. Make sure you ./configure --with-testcases in order to engage the physical layer test cases during make. I included a patch you can apply to your pull that adds the target output changes. In this case, it just adds the new configuration parameters to the expected output.

Once updated I'll pull it in.

diff --git a/test/testcases/phyupstreamscenario001/testcase-target.txt b/test/testcases/phyupstreamscenario001/testcase-target.txt
index 923d9ab..71202b5 100644
--- a/test/testcases/phyupstreamscenario001/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario001/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
diff --git a/test/testcases/phyupstreamscenario002/testcase-target.txt b/test/testcases/phyupstreamscenario002/testcase-target.txt
index 05c082e..4ec105a 100644
--- a/test/testcases/phyupstreamscenario002/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario002/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
diff --git a/test/testcases/phyupstreamscenario003/testcase-target.txt b/test/testcases/phyupstreamscenario003/testcase-target.txt
index 26ad372..fb27960 100644
--- a/test/testcases/phyupstreamscenario003/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario003/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
diff --git a/test/testcases/phyupstreamscenario004/testcase-target.txt b/test/testcases/phyupstreamscenario004/testcase-target.txt
index 9be5a30..4c9e7b9 100644
--- a/test/testcases/phyupstreamscenario004/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario004/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
diff --git a/test/testcases/phyupstreamscenario005/testcase-target.txt b/test/testcases/phyupstreamscenario005/testcase-target.txt
index 61e62e7..f1a4448 100644
--- a/test/testcases/phyupstreamscenario005/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario005/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
diff --git a/test/testcases/phyupstreamscenario006/testcase-target.txt b/test/testcases/phyupstreamscenario006/testcase-target.txt
index b017523..319513f 100644
--- a/test/testcases/phyupstreamscenario006/testcase-target.txt
+++ b/test/testcases/phyupstreamscenario006/testcase-target.txt
@@ -7,6 +7,22 @@
 [1]    1
 [1]  excludesamesubidfromfilterenable:
 [1]    1
+[1]  fading.lognormal.dlthresh:
+[1]    0.250000
+[1]  fading.lognormal.dmu:
+[1]    5.000000
+[1]  fading.lognormal.dsigma:
+[1]    1.000000
+[1]  fading.lognormal.duthresh:
+[1]    0.750000
+[1]  fading.lognormal.lmean:
+[1]    0.005000
+[1]  fading.lognormal.lstddev:
+[1]    0.001000
+[1]  fading.lognormal.maxpathloss:
+[1]    100.000000
+[1]  fading.lognormal.minpathloss:
+[1]    0.000000
 [1]  fading.model:
 [1]    none
 [1]  fading.nakagami.distance0:
weston-nrl commented 3 years ago

Updates as requested, done via an amended commit to update the commit message.

Test case 2 is failing for me. Output is identical, except that the order of two of the ReceivePowerTable lines at the bottom is switched. However, it does that on the develop branch as-is (without these changes), so I'm guessing that's something specific to my system or caused by something else unrelated to my changes.