From 99e051e6fc669b27e791a99b8971f4eaca7063cb Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Fri, 3 Mar 2023 18:41:12 +0100 Subject: [PATCH] adding uplinkBw configuration Signed-off-by: Csaba Kiraly --- DAS/shape.py | 3 ++- DAS/validator.py | 2 +- config_example.py | 13 +++++++++---- study.py | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DAS/shape.py b/DAS/shape.py index 1dd19b2..de22c90 100644 --- a/DAS/shape.py +++ b/DAS/shape.py @@ -3,7 +3,7 @@ class Shape: """This class represents a set of parameters for a specific simulation.""" - def __init__(self, blockSize, numberValidators, failureRate, chi, netDegree, run): + def __init__(self, blockSize, numberValidators, failureRate, chi, netDegree, bwUplink, run): """Initializes the shape with the parameters passed in argument.""" self.run = run self.numberValidators = numberValidators @@ -12,6 +12,7 @@ class Shape: self.netDegree = netDegree self.chi = chi self.randomSeed = "" + self.bwUplink = bwUplink def __repr__(self): """Returns a printable representation of the shape""" diff --git a/DAS/validator.py b/DAS/validator.py index 7b52e58..4647df5 100644 --- a/DAS/validator.py +++ b/DAS/validator.py @@ -77,7 +77,7 @@ class Validator: # Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?) # 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11 # TODO: this should be a parameter - self.bwUplink = 110 if not self.amIproposer else 2200 # approx. 10Mbps and 200Mbps + self.bwUplink = shape.bwUplink if not self.amIproposer else 2200 # approx. 10Mbps and 200Mbps 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/config_example.py b/config_example.py index 248a8e9..0967a4f 100644 --- a/config_example.py +++ b/config_example.py @@ -42,6 +42,10 @@ netDegrees = range(6, 9, 2) # Number of rows and columns a validator is interested in chis = range(4, 9, 2) +# Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?) +# 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11 +bwUplinks = [11, 110] + # Set to True if you want your run to be deterministic, False if not deterministic = False @@ -55,7 +59,8 @@ def nextShape(): for blockSize in blockSizes: for nv in numberValidators: for netDegree in netDegrees: - # Network Degree has to be an even number - if netDegree % 2 == 0: - shape = Shape(blockSize, nv, fr, chi, netDegree, run) - yield shape + for bwUplink in bwUplinks: + # Network Degree has to be an even number + if netDegree % 2 == 0: + shape = Shape(blockSize, nv, fr, chi, netDegree, bwUplink, run) + yield shape diff --git a/study.py b/study.py index e24fb46..2503895 100644 --- a/study.py +++ b/study.py @@ -40,7 +40,7 @@ def study(): print("You need to pass a configuration file in parameter") exit(1) - shape = Shape(0, 0, 0, 0, 0, 0) + shape = Shape(0, 0, 0, 0, 0, 0, 0) sim = Simulator(shape, config) sim.initLogger() results = []