comparison python/traffic_engineering.py @ 37:911b52744ceb

added uniform delay function
author Nicolas Saunier <nico@confins.net>
date Mon, 12 Apr 2010 15:54:20 -0400
parents 571b11304ec9
children 930a6282c9a9
comparison
equal deleted inserted replaced
36:571b11304ec9 37:911b52744ceb
106 if deceleration > 0: 106 if deceleration > 0:
107 return [perceptionReactionTime+float(initialSpeed)/(2*deceleration), float(intersectionLength+vehicleAverageLength)/initialSpeed] 107 return [perceptionReactionTime+float(initialSpeed)/(2*deceleration), float(intersectionLength+vehicleAverageLength)/initialSpeed]
108 else: 108 else:
109 print 'Issue deceleration should be strictly positive' 109 print 'Issue deceleration should be strictly positive'
110 return None 110 return None
111
112 def uniformDelay(cycleLength, effectiveGreen, saturationDegree):
113 '''Computes the uniform delay'''
114 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength)