changeset 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 f03ec4697a09
children 626560624d55
files python/traffic_engineering.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/python/traffic_engineering.py	Tue Apr 19 02:01:09 2011 -0400
+++ b/python/traffic_engineering.py	Thu Apr 28 15:07:21 2011 -0400
@@ -171,3 +171,13 @@
 def uniformDelay(cycleLength, effectiveGreen, saturationDegree):
     '''Computes the uniform delay'''
     return 0.5*cycleLength*(1-float(effectiveGreen)/cycleLength)/(1-float(effectiveGreen*saturationDegree)/cycleLength)
+
+#########################
+# misc
+#########################
+
+def timeChangingSpeed(v0, vf, a, TPR):
+    return TPR+(vf-v0)/a
+
+def distanceChangingSpeed(v0, vf, a, TPR):
+    return TPR*v0+(vf*vf-v0*v0)/(2*a)