configure bandwidth in mbps

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-04-12 18:28:03 +02:00
parent a5e4573599
commit d97b323674
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
3 changed files with 11 additions and 11 deletions

View File

@ -66,9 +66,9 @@ class Simulator:
end = offset+((j+1)*self.shape.chi)
r = set(rows[start:end])
c = set(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)
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:

View File

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

View File

@ -65,11 +65,10 @@ class1ratios = [0.8, 0.9]
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