adding uplinkBw configuration

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-03-03 18:41:12 +01:00
parent d9d79f9245
commit 99e051e6fc
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
4 changed files with 13 additions and 7 deletions

View File

@ -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"""

View File

@ -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

View File

@ -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

View File

@ -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 = []