comparison python/traffic_engineering.py @ 36:571b11304ec9

corrected bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 12 Apr 2010 13:40:05 -0400
parents 388a5a25fe92
children 911b52744ceb
comparison
equal deleted inserted replaced
35:8cafee54466f 36:571b11304ec9
102 def computeInterGreen(perceptionReactionTime, initialSpeed, intersectionLength, vehicleAverageLength = 6, deceleration = 3): 102 def computeInterGreen(perceptionReactionTime, initialSpeed, intersectionLength, vehicleAverageLength = 6, deceleration = 3):
103 '''Computes the intergreen time (yellow/amber plus all red time) 103 '''Computes the intergreen time (yellow/amber plus all red time)
104 Deceleration is positive 104 Deceleration is positive
105 All variables should be in the same units''' 105 All variables should be in the same units'''
106 if deceleration > 0: 106 if deceleration > 0:
107 return [perceptionReactionTime+initialSpeed/(2*deceleration), (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