Mercurial Hosting > traffic-intelligence
changeset 316:c5518a35df5f
merged
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 12 Apr 2013 15:22:00 -0400 |
parents | 82b9be447608 (diff) 43e62b9cb652 (current diff) |
children | d280b881e860 |
files | |
diffstat | 2 files changed, 9 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/python/cvutils.py Thu Apr 11 22:50:04 2013 -0400 +++ b/python/cvutils.py Fri Apr 12 15:22:00 2013 -0400 @@ -173,7 +173,7 @@ def projectArray(homography, points): '''Returns the coordinates of the projected points (format 2xN points) through homography''' - from numpy.core._dotblas import dot + from numpy.core import dot from numpy.core.multiarray import array from numpy.lib.function_base import append
--- a/python/traffic_engineering.py Thu Apr 11 22:50:04 2013 -0400 +++ b/python/traffic_engineering.py Fri Apr 12 15:22:00 2013 -0400 @@ -159,11 +159,16 @@ self.types = types self.proportions = proportions self.equivalents = equivalents - self.nLanes = nLanes # unused + self.nLanes = nLanes else: print('Proportions do not sum to 1') pass + def checkProtected(self, opposedThroughMvt): + '''Checks if this left movement should be protected, + ie if one of the main two conditions on left turn is verified''' + return self.volume >= 200 or self.volume*opposedThroughMvt.volume/opposedThroughMvt.nLanes > 50000 + def getPCUVolume(self): '''Returns the passenger-car equivalent for the input volume''' v = 0 @@ -182,15 +187,6 @@ def getTVUVolume(self): return self.mvtEquivalent*self.volume.getPCUVolume() -class IntersectionApproach: # should probably not be used - def __init__(self, leftTurnVolume, throughVolume, rightTurnVolume): - self.leftTurnVolume = leftTurnVolume - self.throughVolume = throughVolume - self.rightTurnVolume = rightTurnVolume - - def getTVUVolume(self, leftTurnEquivalent = 1, throughEquivalent = 1, rightTurnEquivalent = 1): - return self.leftTurnVolume.getPCUVolume()*leftTurnEquivalent+self.throughVolume.getPCUVolume()*throughEquivalent+self.rightTurnVolume.getPCUVolume()*rightTurnEquivalent - class LaneGroup: '''Class that represents a group of mouvements''' @@ -204,11 +200,6 @@ def getCharge(self, saturationVolume): return self.getTVUVolume()/(self.nLanes*saturationVolume) -def checkProtectedLeftTurn(leftMvt, opposedThroughMvt): - '''Checks if one of the main two conditions on left turn is verified - The lane groups should contain left and through movement''' - return leftMvt.volume >= 200 or leftMvt.volume*opposedThroughMvt.volume/opposedThroughMvt.nLanes > 50000 - def optimalCycle(lostTime, criticalCharge): return (1.5*lostTime+5)/(1-criticalCharge) @@ -226,9 +217,7 @@ self.saturationVolume = saturationVolume def computeCriticalCharges(self): - self.criticalCharges = [] - for phase in self.phases: - self.criticalCharges.append(max([lg.getCharge(self.saturationVolume) for lg in phase])) + self.criticalCharges = [max([lg.getCharge(self.saturationVolume) for lg in phase]) for phase in self.phases] self.criticalCharge = sum(self.criticalCharges) def computeOptimalCycle(self): @@ -242,7 +231,7 @@ return self.C def computeEffectiveGreen(self): - from numpy import round + #from numpy import round #self.computeCycle() # in case it was not done before effectiveGreenTime = self.C-self.lostTime self.effectiveGreens = [round(c*effectiveGreenTime/self.criticalCharge,1) for c in self.criticalCharges]