diff --git a/DAS/simulator.py b/DAS/simulator.py index 1250558..b46a340 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,11 @@ 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: + val.logIDs() self.validators.append(val) assignedRows.sort() diff --git a/DAS/validator.py b/DAS/validator.py index eab4977..4e8d350 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 042ca50..7ab3f44 100644 --- a/smallConf.py +++ b/smallConf.py @@ -72,15 +72,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