-
Notifications
You must be signed in to change notification settings - Fork 3
/
speed_test_sim.py
36 lines (29 loc) · 1 KB
/
speed_test_sim.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import time
from Simulator.simulator import Simulator
# Change these variables for testing
step_size = 10/10
simulate_seconds = 24*3600
alert_step_size = 1
# Testing of simulator object creation
start_time = time.process_time()
s = Simulator()
print("creating simulator object took {} seconds".format(round(time.process_time()-start_time, 3)))
# Testing the simulation itself
simulation_time = 0
start_time = time.process_time()
next_alert = alert_step_size
while(True):
s.update(step_size)
#s.get_cars()
simulation_time += step_size
if time.process_time() > next_alert:
print("simulation time: {}/{} seconds".format(round(simulation_time,3), simulate_seconds))
next_alert += alert_step_size
if simulation_time > simulate_seconds:
print("{} seconds of simulation with a step size of {} took {} real time seconds".format(
simulate_seconds,
round(step_size, 3),
round(time.process_time()-start_time, 3)
))
break
# s.show()