This commit is contained in:
Loic Guegan 2022-09-11 14:56:10 +02:00
parent a8281ebfd3
commit 918cc9a448

View file

@ -26,7 +26,7 @@ class Simulator:
be handle before any other one. That way after a wait, nodes a ready perform receivet() with timeout=0. be handle before any other one. That way after a wait, nodes a ready perform receivet() with timeout=0.
""" """
def __init__(self,netmat,debug_file_path="./esds.debug"): def __init__(self,netmat):
""" """
Format of netmat: { "interface": {"bandwidth": numpy_matrix_2D, "latency": numpy_matrix_2D, "is_wired":bool}} Format of netmat: { "interface": {"bandwidth": numpy_matrix_2D, "latency": numpy_matrix_2D, "is_wired":bool}}
For wireless interfaces the diagonals of the bandwidth and latency matrices are very important. For wireless interfaces the diagonals of the bandwidth and latency matrices are very important.
@ -45,7 +45,7 @@ class Simulator:
self.events_dirty=True # For optimization reasons self.events_dirty=True # For optimization reasons
self.startat=-1 self.startat=-1
self.time=0 self.time=0
self.debug_file_path=debug_file_path self.debug_file_path="./esds.debug"
self.precision=".3f" self.precision=".3f"
self.interferences=True self.interferences=True
self.wait_end_nodes=list() # Keep track of nodes that wait for the end of the simulation self.wait_end_nodes=list() # Keep track of nodes that wait for the end of the simulation
@ -354,13 +354,14 @@ class Simulator:
self.events=np.concatenate([self.events,[np.array([event_type,event_ts,np.array(event,dtype=object),priority],dtype=object)]]) # Add new events self.events=np.concatenate([self.events,[np.array([event_type,event_ts,np.array(event,dtype=object),priority],dtype=object)]]) # Add new events
self.sort_events() self.sort_events()
def run(self, breakpoints=[],breakpoint_callback=lambda s:None,breakpoints_every=None,debug=False,interferences=True): def run(self, breakpoints=[],breakpoint_callback=lambda s:None,breakpoints_every=None,debug=False,interferences=True,debug_file_path="./esds.debug"):
""" """
Run the simulation with the created nodes Run the simulation with the created nodes
""" """
##### Setup simulation ##### Setup simulation
self.startat=time.time() self.startat=time.time()
self.interferences=interferences self.interferences=interferences
self.debug_file_path=debug_file_path
for bp in breakpoints: for bp in breakpoints:
self.add_event(2,bp,0,1) self.add_event(2,bp,0,1)
if breakpoints_every != None: if breakpoints_every != None: