From 9f637e9440ea4ac4aa640f4b83c8fe4496fb4fa5 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 10 Nov 2023 14:55:52 +0100 Subject: [PATCH] Debug interferences --- esds/simulator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/esds/simulator.py b/esds/simulator.py index 93d8e81..3433d72 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -269,14 +269,14 @@ class Simulator: com_sender=int(com[0]) com_receiver=int(com[1]) # All cases where interferences occurs: - receiver_is_sending=(receiver==com_sender) + receiver_is_sending=(receiver==com_sender and sender!=receiver) # We check also if we are not dealing with the special communication where sender==receiver receiver_is_receiving=(receiver==com_receiver and sender!=com_sender) # We check also if its not our own communication sender_is_receiving=(sender==com_receiver and com_sender!=com_sender) # We check also if its not our own communication # Apply rules: if receiver_is_sending or receiver_is_receiving or sender_is_receiving: status=True if com_sender != com_receiver: - event[2][10]=RCode.INTERFERENCES # Tell the sender/receiver interferences occured + event[2][10]=RCode.INTERFERENCES # Tell the sender/receiver interferences occurred return status def sync_node_blocking(self, node): @@ -337,14 +337,15 @@ class Simulator: for dst in self.list_receivers(nsrc,interface): if interface in self.nodes[dst]["interfaces"] and self.nodes[dst]["turned_on"]: duration=datasize*8/self.netmat[interface]["bandwidth"][src,dst]+self.netmat[interface]["latency"][src,dst] + rcode=RCode.SUCCESS + if self.interferences: + rcode=RCode.INTERFERENCES if self.handle_interferences(src,dst, interface) else RCode.SUCCESS if src == dst: # This event (where src == dst) is used to notify the sender when data is received! # Correspond to the diagonal of the network matrices (bandwidth and latency) self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,RCode.SUCCESS)) else: - self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,RCode.SUCCESS)) - if self.interferences: - self.handle_interferences(src,dst, interface) + self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,rcode)) return(RCode.SUCCESS) def list_receivers(self,node,interface): """