Closed Theodore-Chatziioannou closed 2 years ago
agree that the speed handler code was difficult to follow, so I implemented a relatively more extensive refactoring. Hopefully now it is more clear.
Thanks, Theo! Really appreciate the additional clarity!
Addresses issue #184 :
While analysing a Londinium test, I found that delays calculated with the vehicle log were not matching the delays calculated using the link speeds handler.
The reason is that the link speeds handler is not averaging the vehicle speeds correctly. The elara handler is calculating:
speed = Σ(speed_i) / n
, while the correct formula for averaging speeds is :speed = (total distance travelled) / (total time travelled) = (n*d) / (Σ(t_i)) = (n*d) / (Σ(d/speed_i)) = n / Σ(1 / speed_i)
, where d = distance, t=travel time, i denotes a vehicle, and n = number of vehicles.