Mercurial Hosting > traffic-intelligence
diff python/storage.py @ 527:37830a831818
loading from VISSIM trajectory data works
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sat, 21 Jun 2014 14:46:20 -0400 |
parents | 21bdeb29f855 |
children | 95276d310972 |
line wrap: on
line diff
--- a/python/storage.py Fri Jun 20 17:45:32 2014 -0400 +++ b/python/storage.py Sat Jun 21 14:46:20 2014 -0400 @@ -419,8 +419,12 @@ finally: self.sechead = None else: return self.fp.readline() -def loadTrajectoriesFromVissimFile(filename, simulationStepsPerTimeUnit, nObjects = -1, sequenceNum = -1): +def loadTrajectoriesFromVissimFile(filename, simulationStepsPerTimeUnit, nObjects = -1): '''Reads data from VISSIM .fzp trajectory file + simulationStepsPerTimeUnit is the number of simulation steps per unit of time used by VISSIM + for example, there seems to be 5 simulation steps per simulated second in VISSIM, + so simulationStepsPerTimeUnit should be 5, + so that all times correspond to the number of the simulation step (and can be stored as integers) Assumed to be sorted over time''' objects = {} # dictionary of objects index by their id @@ -438,7 +442,7 @@ instant = int(float(data[0])*simulationStepsPerTimeUnit) s = float(data[4]) y = float(data[5]) - lane = int(data[3]) + lane = data[2]+'_'+data[3] if objNum not in objects: objects[objNum] = moving.MovingObject(num = objNum, timeInterval = moving.TimeInterval(instant, instant)) objects[objNum].curvilinearPositions = moving.CurvilinearTrajectory()