diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-10 19:49:19 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-10 19:49:19 +0200 |
| commit | 7540e8290d4b770b23d94da734b6ddf9e208c287 (patch) | |
| tree | 9d48046efac403cd5df78a5270a6ffdbfdc20235 /tests | |
| parent | 94b47ceab5c910a6f17b5a4b69d2e14161be073e (diff) | |
Switch to dictionary for the network matrices
Diffstat (limited to 'tests')
24 files changed, 45 insertions, 31 deletions
diff --git a/tests/hidden_node_2s1r/simulator.py b/tests/hidden_node_2s1r/simulator.py index bfe68ba..e839b4b 100755 --- a/tests/hidden_node_2s1r/simulator.py +++ b/tests/hidden_node_2s1r/simulator.py @@ -13,7 +13,7 @@ B[0,2]=0 B[2,0]=0 L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/mobility_eth0_bandwidth_1s1r/simulator.py b/tests/mobility_eth0_bandwidth_1s1r/simulator.py index 6d9d5fc..e27616d 100755 --- a/tests/mobility_eth0_bandwidth_1s1r/simulator.py +++ b/tests/mobility_eth0_bandwidth_1s1r/simulator.py @@ -26,13 +26,15 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0*2,simulator.L_wlan0,simulator.B_eth0*2,simulator.L_eth0) + new_bw_wlan0=simulator.netmat["wlan0"]["bandwidth"]*2 + new_bw_eth0=simulator.netmat["eth0"]["bandwidth"]*2 + simulator.update_network({"wlan0":{"bandwidth":new_bw_wlan0, "latency":L},"eth0":{"bandwidth":new_bw_eth0, "latency":L}}) s.run(breakpoints_every=1/2,breakpoint_callback=callback) diff --git a/tests/mobility_eth0_bandwidth_2s1r/simulator.py b/tests/mobility_eth0_bandwidth_2s1r/simulator.py index bc0712d..7bed772 100755 --- a/tests/mobility_eth0_bandwidth_2s1r/simulator.py +++ b/tests/mobility_eth0_bandwidth_2s1r/simulator.py @@ -28,7 +28,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") @@ -36,6 +36,8 @@ s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0*2,simulator.L_wlan0,simulator.B_eth0*2,simulator.L_eth0) + new_bw_wlan0=simulator.netmat["wlan0"]["bandwidth"]*2 + new_bw_eth0=simulator.netmat["eth0"]["bandwidth"]*2 + simulator.update_network({"wlan0":{"bandwidth":new_bw_wlan0, "latency":L},"eth0":{"bandwidth":new_bw_eth0, "latency":L}}) s.run(breakpoints_every=1,breakpoint_callback=callback,debug=True) diff --git a/tests/mobility_eth0_latency_1s1r/simulator.py b/tests/mobility_eth0_latency_1s1r/simulator.py index f25e231..6995691 100755 --- a/tests/mobility_eth0_latency_1s1r/simulator.py +++ b/tests/mobility_eth0_latency_1s1r/simulator.py @@ -27,13 +27,15 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0,simulator.L_wlan0+1/2,simulator.B_eth0,simulator.L_eth0+1/2) - + new_lat_wlan0=simulator.netmat["wlan0"]["latency"]+1/2 + new_lat_eth0=simulator.netmat["eth0"]["latency"]+1/2 + simulator.update_network({"wlan0":{"bandwidth":B, "latency":new_lat_wlan0},"eth0":{"bandwidth":B, "latency":new_lat_eth0}}) + s.run(breakpoints_every=1/2,breakpoint_callback=callback) diff --git a/tests/mobility_eth0_latency_2s1r/simulator.py b/tests/mobility_eth0_latency_2s1r/simulator.py index ccc2a63..32ea84b 100755 --- a/tests/mobility_eth0_latency_2s1r/simulator.py +++ b/tests/mobility_eth0_latency_2s1r/simulator.py @@ -29,7 +29,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") @@ -37,6 +37,8 @@ s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0,simulator.L_wlan0+0.5,simulator.B_eth0,simulator.L_eth0+0.5) + new_lat_wlan0=simulator.netmat["wlan0"]["latency"]+1/2 + new_lat_eth0=simulator.netmat["eth0"]["latency"]+1/2 + simulator.update_network({"wlan0":{"bandwidth":B, "latency":new_lat_wlan0},"eth0":{"bandwidth":B, "latency":new_lat_eth0}}) s.run(breakpoints_every=1,breakpoint_callback=callback,debug=True) diff --git a/tests/mobility_wlan0_bandwidth_1s1r/simulator.py b/tests/mobility_wlan0_bandwidth_1s1r/simulator.py index 6d9d5fc..471f73b 100755 --- a/tests/mobility_wlan0_bandwidth_1s1r/simulator.py +++ b/tests/mobility_wlan0_bandwidth_1s1r/simulator.py @@ -26,13 +26,16 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0*2,simulator.L_wlan0,simulator.B_eth0*2,simulator.L_eth0) + new_bw_wlan0=simulator.netmat["wlan0"]["bandwidth"]*2 + new_bw_eth0=simulator.netmat["eth0"]["bandwidth"]*2 + simulator.update_network({"wlan0":{"bandwidth":new_bw_wlan0, "latency":L},"eth0":{"bandwidth":new_bw_eth0, "latency":L}}) + s.run(breakpoints_every=1/2,breakpoint_callback=callback) diff --git a/tests/mobility_wlan0_latency_1s1r/simulator.py b/tests/mobility_wlan0_latency_1s1r/simulator.py index f25e231..1dd2832 100755 --- a/tests/mobility_wlan0_latency_1s1r/simulator.py +++ b/tests/mobility_wlan0_latency_1s1r/simulator.py @@ -27,13 +27,16 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") def callback(simulator): simulator.log("Network update!") - simulator.update_network(simulator.B_wlan0,simulator.L_wlan0+1/2,simulator.B_eth0,simulator.L_eth0+1/2) + new_lat_wlan0=simulator.netmat["wlan0"]["latency"]+1/2 + new_lat_eth0=simulator.netmat["eth0"]["latency"]+1/2 + simulator.update_network({"wlan0":{"bandwidth":B, "latency":new_lat_wlan0},"eth0":{"bandwidth":B, "latency":new_lat_eth0}}) + s.run(breakpoints_every=1/2,breakpoint_callback=callback) diff --git a/tests/simple_breakpoints_auto_1n/simulator.py b/tests/simple_breakpoints_auto_1n/simulator.py index 99cdafc..85eb277 100755 --- a/tests/simple_breakpoints_auto_1n/simulator.py +++ b/tests/simple_breakpoints_auto_1n/simulator.py @@ -9,7 +9,7 @@ import numpy as np n=2 B=np.full((2,2),n) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_breakpoints_manual_1n/simulator.py b/tests/simple_breakpoints_manual_1n/simulator.py index 1b27c88..75ec214 100755 --- a/tests/simple_breakpoints_manual_1n/simulator.py +++ b/tests/simple_breakpoints_manual_1n/simulator.py @@ -9,7 +9,7 @@ import numpy as np n=2 B=np.full((n,n),n) L=np.full((n,n),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_breakpoints_manual_no_callback_1n/simulator.py b/tests/simple_breakpoints_manual_no_callback_1n/simulator.py index 85cfeb4..1614155 100755 --- a/tests/simple_breakpoints_manual_no_callback_1n/simulator.py +++ b/tests/simple_breakpoints_manual_no_callback_1n/simulator.py @@ -9,7 +9,7 @@ import numpy as np n=2 B=np.full((n,n),n) L=np.full((n,n),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_log_5n/simulator.py b/tests/simple_log_5n/simulator.py index 3f7775b..9d53a6f 100755 --- a/tests/simple_log_5n/simulator.py +++ b/tests/simple_log_5n/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((5,5),5) L=np.full((5,5),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_read_clock_2n/simulator.py b/tests/simple_read_clock_2n/simulator.py index 9690b3f..192096a 100755 --- a/tests/simple_read_clock_2n/simulator.py +++ b/tests/simple_read_clock_2n/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((2,2),2) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_read_eth0_ncom_2s1r/simulator.py b/tests/simple_read_eth0_ncom_2s1r/simulator.py index c5ee571..fe53f77 100755 --- a/tests/simple_read_eth0_ncom_2s1r/simulator.py +++ b/tests/simple_read_eth0_ncom_2s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),3) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") diff --git a/tests/simple_read_wlan0_ncom_2s1r/simulator.py b/tests/simple_read_wlan0_ncom_2s1r/simulator.py index c5ee571..fe53f77 100755 --- a/tests/simple_read_wlan0_ncom_2s1r/simulator.py +++ b/tests/simple_read_wlan0_ncom_2s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),3) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") diff --git a/tests/simple_receivet_eth0_1s1r/simulator.py b/tests/simple_receivet_eth0_1s1r/simulator.py index e80e7a1..3429bc6 100755 --- a/tests/simple_receivet_eth0_1s1r/simulator.py +++ b/tests/simple_receivet_eth0_1s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/simple_send_eth0_1s1r/simulator.py b/tests/simple_send_eth0_1s1r/simulator.py index 39be96c..e091edf 100755 --- a/tests/simple_send_eth0_1s1r/simulator.py +++ b/tests/simple_send_eth0_1s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/simple_send_eth0_2s1r/simulator.py b/tests/simple_send_eth0_2s1r/simulator.py index 9980b2a..f23eec3 100755 --- a/tests/simple_send_eth0_2s1r/simulator.py +++ b/tests/simple_send_eth0_2s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") diff --git a/tests/simple_send_eth0_3s1r/simulator.py b/tests/simple_send_eth0_3s1r/simulator.py index cc09486..f9684c6 100755 --- a/tests/simple_send_eth0_3s1r/simulator.py +++ b/tests/simple_send_eth0_3s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((4,4),8) L=np.full((4,4),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") diff --git a/tests/simple_send_wlan0_1s2r/simulator.py b/tests/simple_send_wlan0_1s2r/simulator.py index 0778101..50d1732 100755 --- a/tests/simple_send_wlan0_1s2r/simulator.py +++ b/tests/simple_send_wlan0_1s2r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/simple_send_wlan0_2s1r/simulator.py b/tests/simple_send_wlan0_2s1r/simulator.py index 9980b2a..f23eec3 100755 --- a/tests/simple_send_wlan0_2s1r/simulator.py +++ b/tests/simple_send_wlan0_2s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("sender") diff --git a/tests/simple_sendt_eth0_1s1r/simulator.py b/tests/simple_sendt_eth0_1s1r/simulator.py index 39be96c..e091edf 100755 --- a/tests/simple_sendt_eth0_1s1r/simulator.py +++ b/tests/simple_sendt_eth0_1s1r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((2,2),8) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/simple_sendt_wlan0_1s2r/simulator.py b/tests/simple_sendt_wlan0_1s2r/simulator.py index 0778101..50d1732 100755 --- a/tests/simple_sendt_wlan0_1s2r/simulator.py +++ b/tests/simple_sendt_wlan0_1s2r/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),8) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("sender") s.create_node("receiver") diff --git a/tests/simple_wait_2n/simulator.py b/tests/simple_wait_2n/simulator.py index 9690b3f..192096a 100755 --- a/tests/simple_wait_2n/simulator.py +++ b/tests/simple_wait_2n/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((2,2),2) L=np.full((2,2),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") diff --git a/tests/simple_wait_end_3n/simulator.py b/tests/simple_wait_end_3n/simulator.py index 6b68c46..4ffa44c 100755 --- a/tests/simple_wait_end_3n/simulator.py +++ b/tests/simple_wait_end_3n/simulator.py @@ -8,7 +8,7 @@ import numpy as np B=np.full((3,3),2) L=np.full((3,3),0) -s=esds.Simulator(B,L,B,L) +s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}}) s.create_node("node") s.create_node("node") |
