Skip to content

Instantly share code, notes, and snippets.

@tera-ny
Created October 13, 2021 14:15
Show Gist options
  • Save tera-ny/a84fd7a24116a72df52d6ef6d264a168 to your computer and use it in GitHub Desktop.
Save tera-ny/a84fd7a24116a72df52d6ef6d264a168 to your computer and use it in GitHub Desktop.
ネットワーク品質をシミュレートするシミュレータです。
def simulate(csv, c):
d_prev = 0
result_t = []
result_a = []
for row in csv:
a_i = float(row[0])
l_i = float(row[1])
s_i = l_i*8/c
d_i = max(d_prev, a_i) + s_i
t_i = d_i - a_i
d_prev = d_i
result_t.append(t_i * 1000)
result_a.append(a_i)
return [result_a, result_t]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment