Created
October 13, 2021 14:15
-
-
Save tera-ny/a84fd7a24116a72df52d6ef6d264a168 to your computer and use it in GitHub Desktop.
ネットワーク品質をシミュレートするシミュレータです。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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