From e311aaa2bed717f28668eece5505fd0f9ad5a293 Mon Sep 17 00:00:00 2001 From: Loïc Guégan Date: Thu, 24 Oct 2024 11:19:11 +0200 Subject: Fixing bug in interferences --- esds/simulator.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'esds') diff --git a/esds/simulator.py b/esds/simulator.py index 14ee7b4..f98bff9 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -268,11 +268,21 @@ class Simulator: if event_type==0 and com[2] == interface: com_sender=int(com[0]) com_receiver=int(com[1]) - # All cases where interferences occurs: - 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: + #### All CASES WHERE INTERFERENCES OCCUR + # receiver_is_sending + # 1) check if current com receiver already sending + # 2) if yes, we check if current com is one that should be marked as interterference (current com is actually involving the receiver) see interferences_bug1 test + # 3) ensure not dealing with the special com (where sender is the receiver) + receiver_is_sending=(receiver==com_sender and com_receiver==receiver and sender!=receiver) + # receiver_is_receiving + # 1) check if the current com receiver is already receiving (thus interference) + # 2) ensure not dealing with the special com (where sender is the receiver) + receiver_is_receiving=(com_receiver==receiver and sender!=com_sender) + # sender_is_receiving + # 1) check if current com receiver is the one who started sending + # 2) ensure not dealing with the special com (where sender is the receiver) + sender_is_receiving=(com_receiver==sender and com_sender!=com_sender) + ##### Update com return code if receiver_is_sending or receiver_is_receiving or sender_is_receiving: status=True if com_sender != com_receiver: -- cgit v1.2.3