mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-06 10:06:28 +02:00
Debug interferences
This commit is contained in:
parent
655d1df4d1
commit
9f637e9440
1 changed files with 6 additions and 5 deletions
|
@ -269,14 +269,14 @@ class Simulator:
|
||||||
com_sender=int(com[0])
|
com_sender=int(com[0])
|
||||||
com_receiver=int(com[1])
|
com_receiver=int(com[1])
|
||||||
# All cases where interferences occurs:
|
# 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
|
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
|
sender_is_receiving=(sender==com_receiver and com_sender!=com_sender) # We check also if its not our own communication
|
||||||
# Apply rules:
|
# Apply rules:
|
||||||
if receiver_is_sending or receiver_is_receiving or sender_is_receiving:
|
if receiver_is_sending or receiver_is_receiving or sender_is_receiving:
|
||||||
status=True
|
status=True
|
||||||
if com_sender != com_receiver:
|
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
|
return status
|
||||||
|
|
||||||
def sync_node_blocking(self, node):
|
def sync_node_blocking(self, node):
|
||||||
|
@ -337,14 +337,15 @@ class Simulator:
|
||||||
for dst in self.list_receivers(nsrc,interface):
|
for dst in self.list_receivers(nsrc,interface):
|
||||||
if interface in self.nodes[dst]["interfaces"] and self.nodes[dst]["turned_on"]:
|
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]
|
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:
|
if src == dst:
|
||||||
# This event (where src == dst) is used to notify the sender when data is received!
|
# 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)
|
# 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))
|
self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,RCode.SUCCESS))
|
||||||
else:
|
else:
|
||||||
self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,RCode.SUCCESS))
|
self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True,False,rcode))
|
||||||
if self.interferences:
|
|
||||||
self.handle_interferences(src,dst, interface)
|
|
||||||
return(RCode.SUCCESS)
|
return(RCode.SUCCESS)
|
||||||
def list_receivers(self,node,interface):
|
def list_receivers(self,node,interface):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue