From 06e70e1b40033610e6dadafed1b47a1765123e12 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Tue, 18 Apr 2023 15:53:38 +0200 Subject: [PATCH] configure bandwidth in mbps Signed-off-by: Csaba Kiraly --- DAS/simulator.py | 4 ++-- DAS/validator.py | 9 +++++---- smallConf.py | 12 +++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/DAS/simulator.py b/DAS/simulator.py index 0a3073e..73d9afc 100644 --- a/DAS/simulator.py +++ b/DAS/simulator.py @@ -81,7 +81,7 @@ class Simulator: end = offset+((j+1)*self.shape.chi*self.shape.vpn2) r = rows[start:end] c = columns[start:end] - val = Validator(i, int(not i!=0), self.logger, self.shape, r, c) + val = Validator(i, int(not i!=0), self.logger, self.shape, self.config, r, c) self.logger.debug("Node %d has row IDs: %s" % (val.ID, val.rowIDs), extra=self.format) self.logger.debug("Node %d has column IDs: %s" % (val.ID, val.columnIDs), extra=self.format) assignedRows = assignedRows + list(r) @@ -90,7 +90,7 @@ class Simulator: self.nodeColumns.append(val.columnIDs) else: - val = Validator(i, int(not i!=0), self.logger, self.shape) + val = Validator(i, int(not i!=0), self.logger, self.shape, self.config) if i == self.proposerID: val.initBlock() else: diff --git a/DAS/validator.py b/DAS/validator.py index bd7769e..7b5d0cc 100644 --- a/DAS/validator.py +++ b/DAS/validator.py @@ -38,7 +38,7 @@ class Validator: """It returns the validator ID.""" return str(self.ID) - def __init__(self, ID, amIproposer, logger, shape, rows = None, columns = None): + def __init__(self, ID, amIproposer, logger, shape, config, rows = None, columns = None): """It initializes the validator with the logger shape and rows/columns. If rows/columns are specified these are observed, otherwise (default) @@ -87,15 +87,16 @@ class Validator: self.statsRxDupInSlot = 0 self.statsRxDupPerSlot = [] - # Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?) - # 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11 - # TODO: this should be a parameter + # Set uplink bandwidth. + # Assuming segments of ~560 bytes and timesteps of 50ms, we get + # 1 Mbps ~= 1e6 mbps * 0.050 s / (560*8) bits ~= 11 segments/timestep if self.amIproposer: self.bwUplink = shape.bwUplinkProd elif self.nodeClass == 1: self.bwUplink = shape.bwUplink1 else: self.bwUplink = shape.bwUplink2 + self.bwUplink *= 1e3 / 8 * config.stepDuration / config.segmentSize self.repairOnTheFly = True self.sendLineUntil = (self.shape.blockSize + 1) // 2 # stop sending on a p2p link if at least this amount of samples passed diff --git a/smallConf.py b/smallConf.py index 782a2c0..7ebecba 100644 --- a/smallConf.py +++ b/smallConf.py @@ -69,15 +69,17 @@ class1ratios = [0.8] validatorsPerNode1 = [1] validatorsPerNode2 = [500] -# Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?) -# 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11 -bwUplinksProd = [2200] -bwUplinks1 = [110] -bwUplinks2 = [2200] +# Set uplink bandwidth in megabits/second +bwUplinksProd = [200] +bwUplinks1 = [10] +bwUplinks2 = [200] # Step duration in miliseconds (Classic RTT is about 100ms) stepDuration = 50 +# Segment size in bytes (with proof) +segmentSize = 560 + # Set to True if you want your run to be deterministic, False if not deterministic = True