comparison python/traffic_engineering.py @ 992:2cd1ce245024

update to python 3
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 13 Apr 2018 16:48:02 -0400
parents 9f8e9fb5621b
children
comparison
equal deleted inserted replaced
991:9b601e9e9735 992:2cd1ce245024
302 Deceleration is positive 302 Deceleration is positive
303 All variables should be in the same units''' 303 All variables should be in the same units'''
304 if deceleration > 0: 304 if deceleration > 0:
305 return [perceptionReactionTime+float(initialSpeed)/(2*deceleration), float(intersectionLength+vehicleAverageLength)/initialSpeed] 305 return [perceptionReactionTime+float(initialSpeed)/(2*deceleration), float(intersectionLength+vehicleAverageLength)/initialSpeed]
306 else: 306 else:
307 print 'Issue deceleration should be strictly positive' 307 print('Issue deceleration should be strictly positive')
308 return None 308 return None
309 309
310 def uniformDelay(cycleLength, effectiveGreen, saturationDegree): 310 def uniformDelay(cycleLength, effectiveGreen, saturationDegree):
311 '''Computes the uniform delay''' 311 '''Computes the uniform delay'''
312 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)**2/(1-float(effectiveGreen*saturationDegree)/cycleLength) 312 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)**2/(1-float(effectiveGreen*saturationDegree)/cycleLength)