From 7540e8290d4b770b23d94da734b6ddf9e208c287 Mon Sep 17 00:00:00 2001
From: Loic Guegan <manzerbredes@mailbox.org>
Date: Fri, 10 Jun 2022 19:49:19 +0200
Subject: [PATCH] Switch to dictionary for the network matrices

---
 esds.py                                       | 66 ++++++++-----------
 example/simulator.py                          |  2 +-
 tests/hidden_node_2s1r/simulator.py           |  2 +-
 .../mobility_eth0_bandwidth_1s1r/simulator.py |  6 +-
 .../mobility_eth0_bandwidth_2s1r/simulator.py |  6 +-
 tests/mobility_eth0_latency_1s1r/simulator.py |  8 ++-
 tests/mobility_eth0_latency_2s1r/simulator.py |  6 +-
 .../simulator.py                              |  7 +-
 .../mobility_wlan0_latency_1s1r/simulator.py  |  7 +-
 tests/simple_breakpoints_auto_1n/simulator.py |  2 +-
 .../simple_breakpoints_manual_1n/simulator.py |  2 +-
 .../simulator.py                              |  2 +-
 tests/simple_log_5n/simulator.py              |  2 +-
 tests/simple_read_clock_2n/simulator.py       |  2 +-
 tests/simple_read_eth0_ncom_2s1r/simulator.py |  2 +-
 .../simple_read_wlan0_ncom_2s1r/simulator.py  |  2 +-
 tests/simple_receivet_eth0_1s1r/simulator.py  |  2 +-
 tests/simple_send_eth0_1s1r/simulator.py      |  2 +-
 tests/simple_send_eth0_2s1r/simulator.py      |  2 +-
 tests/simple_send_eth0_3s1r/simulator.py      |  2 +-
 tests/simple_send_wlan0_1s2r/simulator.py     |  2 +-
 tests/simple_send_wlan0_2s1r/simulator.py     |  2 +-
 tests/simple_sendt_eth0_1s1r/simulator.py     |  2 +-
 tests/simple_sendt_wlan0_1s2r/simulator.py    |  2 +-
 tests/simple_wait_2n/simulator.py             |  2 +-
 tests/simple_wait_end_3n/simulator.py         |  2 +-
 26 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/esds.py b/esds.py
index d297554..c28aa28 100644
--- a/esds.py
+++ b/esds.py
@@ -190,13 +190,14 @@ class Simulator:
     one may not gives accurate results because of missing entries in the nodes received queues.
     """
     
-    def __init__(self,B_wlan0,L_wlan0,B_eth0,L_eth0):
-        self.B_wlan0=B_wlan0
-        self.L_wlan0=L_wlan0
-        self.B_eth0=B_eth0
-        self.L_eth0=L_eth0
+    def __init__(self,netmat):
+        """
+        Format of netmat: { "wlan0": (BW,L), "eth0": (BW,L) }
+        Where BW are the bandwidth matrices and L the latency matrices
+        """
+        self.netmat=netmat
         self.nodes=list()
-        self.sharing=np.zeros(len(B_eth0))
+        self.sharing=np.zeros(len(netmat["eth0"]["bandwidth"]))
         self.events=np.empty((0,4),dtype=object)
         self.events_dirty=True # For optimization reasons
         self.startat=-1
@@ -207,44 +208,29 @@ class Simulator:
         self.wait_end_nodes=list() # Keep track of nodes that wait for the end of the simulation
         self.time_truncated=format(self.time,self.precision) # Truncated version is used in log print
 
-    def update_network(self,B_wlan0,L_wlan0,B_eth0,L_eth0):
+    def update_network(self,netmat):
         for event in self.events:
             if int(event[0]) == 0:
                 cur_event=event[2]
                 ts=float(event[1])
                 src_id,dst_id,interface, data, datasize,duration, datasize_remaining,start_at=cur_event
-                if interface == "wlan0":
-                    new_bw=B_wlan0[int(src_id),int(dst_id)]
-                    old_bw=self.B_wlan0[int(src_id),int(dst_id)]
-                    new_lat=L_wlan0[int(src_id),int(dst_id)]
-                    old_lat=self.L_wlan0[int(src_id),int(dst_id)]
-                    if new_bw != old_bw or new_lat != old_lat:
-                        new_datasize_remaining=float(datasize_remaining)*((ts-self.time)/float(duration))
-                        if new_datasize_remaining > 0:
-                            latency_factor=new_datasize_remaining/float(datasize)
+                new_bw=netmat[interface]["bandwidth"][int(src_id),int(dst_id)]
+                old_bw=self.netmat[interface]["bandwidth"][int(src_id),int(dst_id)]
+                new_lat=netmat[interface]["latency"][int(src_id),int(dst_id)]
+                old_lat=self.netmat[interface]["latency"][int(src_id),int(dst_id)]
+                if new_bw != old_bw or new_lat != old_lat:
+                    new_datasize_remaining=float(datasize_remaining)*((ts-self.time)/float(duration))
+                    if new_datasize_remaining > 0:
+                        latency_factor=new_datasize_remaining/float(datasize)
+                        if interface == "wlan0":
                             new_duration=new_datasize_remaining*8/new_bw+new_lat*latency_factor
-                            event[1]=self.time+new_duration
-                            event[2][6]=new_datasize_remaining
-                            event[2][5]=new_duration
-                else:
-                    new_bw=B_eth0[int(src_id),int(dst_id)]
-                    old_bw=self.B_eth0[int(src_id),int(dst_id)]
-                    new_lat=L_eth0[int(src_id),int(dst_id)]
-                    old_lat=self.L_eth0[int(src_id),int(dst_id)]
-                    if new_bw != old_bw or new_lat != old_lat:
-                        new_datasize_remaining=float(datasize_remaining)*((ts-self.time)/float(duration))
-                        if new_datasize_remaining > 0:
-                            latency_factor=new_datasize_remaining/float(datasize)
+                        else:
                             new_duration=new_datasize_remaining*8/(new_bw/self.sharing[int(dst_id)])+new_lat*latency_factor
-                            event[1]=self.time+new_duration
-                            event[2][6]=new_datasize_remaining
-                            event[2][5]=new_duration
-
-        self.B_wlan0=B_wlan0
-        self.L_wlan0=L_wlan0
-        self.B_eth0=B_eth0
-        self.L_eth0=L_eth0
-
+                        event[1]=self.time+new_duration
+                        event[2][6]=new_datasize_remaining
+                        event[2][5]=new_duration
+        self.netmat=netmat
+            
     def debug(self):
         """
         Log all the informations for debugging
@@ -467,7 +453,7 @@ class Simulator:
             self.log("Send "+str(datasize)+" bytes on "+interface,node=src)
             for dst in self.list_wireless_receivers(nsrc):
                 if self.nodes[dst]["turned_on"]:
-                    duration=datasize*8/self.B_wlan0[src,dst]+self.L_wlan0[src,dst]
+                    duration=datasize*8/self.netmat["wlan0"]["bandwidth"][src,dst]+self.netmat["wlan0"]["latency"][src,dst]
                     if src == dst:
                         self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time))
                     elif not self.interferences:
@@ -479,7 +465,7 @@ class Simulator:
                 self.log("Send "+str(datasize)+" bytes to n"+str(dst)+" on "+interface,node=src)
                 self.update_sharing(dst,1) # Update sharing first
                 # Note that in the following we send more data than expected to handle bandwidth sharing (datasize*8*sharing):
-                duration=datasize*8/(self.B_eth0[src,dst]/self.sharing[dst])+self.L_eth0[src,dst]
+                duration=datasize*8/(self.netmat["eth0"]["bandwidth"][src,dst]/self.sharing[dst])+self.netmat["eth0"]["latency"][src,dst]
                 self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time))
             else:
                 nsrc["state"]="request" # Try later when node is on
@@ -489,7 +475,7 @@ class Simulator:
         """
         Deduce reachable receivers from the bandwidth matrix
         """
-        selector = self.B_wlan0[node.node_id,] > 0
+        selector = self.netmat["wlan0"]["bandwidth"][node.node_id,] > 0
         return np.arange(0,selector.shape[0])[selector]
 
             
diff --git a/example/simulator.py b/example/simulator.py
index 40a37a8..fb1b94f 100755
--- a/example/simulator.py
+++ b/example/simulator.py
@@ -26,7 +26,7 @@ B=np.full((n,n),5) # 5Mbps
 L=np.full((n,n),0) # 0s
 
 ##### Create the simulator
-s=esds.Simulator(B,L,B,L)
+s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L},"eth0":{"bandwidth":B, "latency":L}})
 
 ##### Instantiate nodes
 uptime=180 # 180s uptime
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")