From 03813b36bc423bf5891be4c3311fbdc020cb8835 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Thu, 26 Jan 2023 10:08:19 +0100 Subject: [PATCH] fix receive info propagation Make sure info about what is being sent is not propagated too fast. In this base model, a node knows that something was sent after one timestep. This requires keeping separating receiving from received and updating only once per timestep. Signed-off-by: Csaba Kiraly --- DAS/validator.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/DAS/validator.py b/DAS/validator.py index ddfaec2..950fdea 100644 --- a/DAS/validator.py +++ b/DAS/validator.py @@ -14,6 +14,7 @@ class Neighbor: def __init__(self, v, blockSize): self.node = v + self.receiving = zeros(blockSize) self.received = zeros(blockSize) self.sent = zeros(blockSize) @@ -107,7 +108,7 @@ class Validator: def receiveColumn(self, id, column, src): if id in self.columnIDs: # register receive so that we are not sending back - self.columnNeighbors[id][src].received |= column + self.columnNeighbors[id][src].receiving |= column self.receivedBlock.mergeColumn(id, column) self.statsRxInSlot += column.count(1) else: @@ -116,7 +117,7 @@ class Validator: def receiveRow(self, id, row, src): if id in self.rowIDs: # register receive so that we are not sending back - self.rowNeighbors[id][src].received |= row + self.rowNeighbors[id][src].receiving |= row self.receivedBlock.mergeRow(id, row) self.statsRxInSlot += row.count(1) else: @@ -142,6 +143,15 @@ class Validator: self.block.merge(self.receivedBlock) + for neighs in self.rowNeighbors.values(): + for neigh in neighs.values(): + neigh.received |= neigh.receiving + neigh.receiving.setall(0) + + for neighs in self.columnNeighbors.values(): + for neigh in neighs.values(): + neigh.received |= neigh.receiving + neigh.receiving.setall(0) def updateStats(self): self.logger.debug("Stats: tx %d, rx %d", self.statsTxInSlot, self.statsRxInSlot, extra=self.format) self.statsRxPerSlot.append(self.statsRxInSlot)