comparison python/traffic_engineering.py @ 493:850ed17c7b2f

added some computation of delay
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 23 Apr 2014 23:35:52 -0400
parents 7828fec8bbd2
children 3b13ec964476
comparison
equal deleted inserted replaced
492:30fb60428e09 493:850ed17c7b2f
264 264
265 def uniformDelay(cycleLength, effectiveGreen, saturationDegree): 265 def uniformDelay(cycleLength, effectiveGreen, saturationDegree):
266 '''Computes the uniform delay''' 266 '''Computes the uniform delay'''
267 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength) 267 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength)
268 268
269 def overflowDelay(T, X, c, k=0.5, I=1):
270 '''Computes the overflow delay (HCM)
271 T in hours
272 c capacity of the lane group
273 k default for fixed time signal
274 I=1 for isolated intersection (Poisson arrival)'''
275 from math import sqrt
276 return 900*T*(X - 1 + sqrt((X - 1)**2 + 8*k*I*X/(c*T)))
277
269 ######################### 278 #########################
270 # misc 279 # misc
271 ######################### 280 #########################
272 281
273 def timeChangingSpeed(v0, vf, a, TPR): 282 def timeChangingSpeed(v0, vf, a, TPR):