comparison python/traffic_engineering.py @ 87:f234154207d4

distance and time to change speed
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 28 Apr 2011 15:07:21 -0400
parents 930a6282c9a9
children 2bf5b76320c0
comparison
equal deleted inserted replaced
86:f03ec4697a09 87:f234154207d4
169 return None 169 return None
170 170
171 def uniformDelay(cycleLength, effectiveGreen, saturationDegree): 171 def uniformDelay(cycleLength, effectiveGreen, saturationDegree):
172 '''Computes the uniform delay''' 172 '''Computes the uniform delay'''
173 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength) 173 return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength)
174
175 #########################
176 # misc
177 #########################
178
179 def timeChangingSpeed(v0, vf, a, TPR):
180 return TPR+(vf-v0)/a
181
182 def distanceChangingSpeed(v0, vf, a, TPR):
183 return TPR*v0+(vf*vf-v0*v0)/(2*a)