mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-05-21 06:17:39 +00:00
Switch to dictionary for the network matrices
This commit is contained in:
parent
94b47ceab5
commit
7540e8290d
26 changed files with 72 additions and 72 deletions
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue