Changes between Initial Version and Version 1 of TrafficModel


Ignore:
Timestamp:
06/23/2019 12:51:50 PM (7 years ago)
Author:
jdalbey
Comment:

v1

Legend:

Unmodified
Added
Removed
Modified
  • TrafficModel

    v1 v1  
     1= Traffic Model Overview Document = 
     2== Table of Contents == 
     3 1. [#purpose Purpose] 
     4 1. [#architecture System Architecture] 
     5 1. [#overview Overview of System] 
     6   1. [#cptmsoverview CPTMS] 
     7   1. [#systembehavior System Behavior] 
     8 1. [#detailedcomponentoverviews Detailed Component Overviews] 
     9   1. [#trafficmodeldetail Traffic Model] 
     10     1. [#trafficmodelbehavior Behavior] 
     11     1. [#trafficmodelclasses Traffic Model Classes] 
     12 1. [#highwaymap Highway Map] 
     13 1. [#highwaystatus Highway Status] 
     14 
     15== Purpose == #purpose 
     16An important function of the TMC simulator is to simulate the traffic flow that results from a simulated traffic incident.  The traffic flow is shown to the Cal Trans dispatcher as a road map with sensor locations displayed in different colors that correspond to stopped, slowed, or free flowing traffic.  In the real world, data from sensors embedded in highways is transmitted in real time to a computer called the ATMS which then determines the flow of traffic along a network of highways.  For the TMC Simulator there is no actual sensor data so this must be simulated with a traffic model.  In previous versions of the TMC Simulator the traffic model used was a commercial product called Paramics.  For a variety of technical, legal, and economic reasons the use of Paramics became infeasible and we choose to abandon it and develop our own solution. 
     17 
     18== System Architecture == #architecture 
     19The [wiki:DeploymentDiagram System (Traffic Model / FEP / ATMS) Deployment/Component Diagram] is a UML Deployment / Component diagram which helps to describe the system architecture. 
     20 
     21== Overview of System == #overview 
     22=== What is the Traffic Model? === #trafficmodeloverview 
     23The Traffic Model is a loose term that describes the components of the Java CAD Server that model the simulated traffic conditions of the highways during the simulation. It consists of the Traffic Model Manager and the Highways model. 
     24 
     25=== What is the CPTMS? === #cptmsoverview 
     26The CPTMS is a web application that mimics the functionalilty of a legacy ATMS (Automated Traffic Management System) that managed data collection from highway sensors. The CPTMS displays traffic condition information on an interactive, browser-based map for the trainees.  CPTMS is based on Google Maps API. 
     27 
     28=== System Behavior / How do these components work together? === #systembehavior 
     29Reference the [wiki:TrafficFEPATMSActivityDiagram Traffic Model / FEP / ATMS Activity Diagram] while reading this section. It helps to describe system behavior. 
     30 
     31When the CAD Server starts, the Traffic Model Manager and the Highways model are instantiated. The Traffic Model Manager spawns a thread, the !WriteToJsonThread, which outputs the current traffic conditions on 30 second intervals.  To do so, the !WriteToJsonThread calls upon the Highways class's writeToJson() method. 
     32 
     33The CPTMS (running on a separate Apache web server) reads the json data and the traffic conditions are displayed to trainees on the interactive map. 
     34 
     35== Traffic Model == #trafficmodeldetail 
     36Reference the [wiki:TrafficModelClassDiagram Traffic Model Class Diagram] while reading this section. 
     37 
     38==== Behavior ==== #trafficmodelbehavior 
     39As previously stated, the Traffic Model consists of the Traffic Model Manager and the Highways model. The Traffic Model Manager contains an instance of the Highways class. Both the Traffic Model Manager and the Highways model are instantiated upon CAD Server start up. Once instantiated, the Traffic Model Manager spawns an instance of the !WriteToJsonThread, which sends the current traffic conditions of the Highways to the CPTMS by calling the Highways class' writeToJson() method every 30 seconds. 
     40 
     41The Traffic Model Manager also loads Traffic Events from a batch file into a queue, the eventsQueue, when instantiated. The Traffic Events batch file is specified in the Traffic Model Manager's properties file. A Traffic Event changes the current traffic conditions at a specified location. As the simulation runs, the Traffic Model Manager queries the Coordinator object for the current simulation time, and then checks the queue to see if there are Traffic Events that should be applied to the Highways model at the current simulation time.  When a traffic event occurs the manager requests the Highways model to update itself by altering the state of traffic flow values at specific locations on the highway network. 
     42 
     43==== Traffic Model Classes ==== #trafficmodelclasses 
     44The Highways and Highway classes were developed to give developers an abstraction of the traffic network that was feasible to work with. A Highway is undirected, meaning it does not have an associated (N/S/W/E) direction and represents traffic in both directions on the highway. A Highway is an aggregation of all of the Stations on a highway, sorted by postmile value.  As of r280 on Feb 26, 2019, "Station" now represents a Vehicle Detection Station, which is a logical grouping of all loop detectors for one direction.  So it DOES have an associated direction and all the loop detectors it monitors are going that direction.  Please refer to this diagram: [attachment:PeMS_data_sources.png PeMS data sources]. 
     45 
     46The Highways, Highway, and Station classes are all immutable. None of them contain dynamic data. The only class in the Highways model that contains dynamic values is the !LoopDetector class. The dynamic values in the !LoopDetector class are volume and occupancy. The volume field is an int, and the occupancy field is a float in the [0,1] range. The DOTCOLOR enum (specified in the !LoopDetector class) represents the colors shown on the CPTMS map (!Green/Yellow/Red). This enum supplies the necessary volume and occupancy values to achieve the desired display color for a Loop Detector. 
     47 
     48== Highway Map File == #highwaymap 
     49When the simulation starts it creates the Highway Model by reading a preconfigured static data file we call the highway map file.  This file contains all the information needed to create the highway model described above. 
     50 
     51The highway map file is created from a VDS metadata file downloaded from the [http://pems.dot.ca.gov/?dnode=Clearinghouse PeMS Data Clearinghouse]. 
     52 
     53[wiki:CPTMS] provides directions for how to create the highway map (postmile) file. Currently the file resides in `config/vds_data/postmile_coordinates.txt`. 
     54 
     55{{{ 
     561 S 12.39,33.565462,-117.828018,1 SB REEF POINT DR,-0.547592,-0.836745 
     571 N 12.39,33.565462,-117.828018,1 SB REEF POINT DR,0.547592,0.836745 
     581 S 12.78,33.568992,-117.833412,1 SB CRYSTAL HEIGHTS,-0.713433,-0.700723 
     591 N 12.78,33.568992,-117.833412,1 SB CRYSTAL HEIGHTS,0.71338,0.700778 
     601 S 13.36,33.575503,-117.839807,1 SB LOS TRANCOS,-0.713433,-0.700723 
     611 N 13.36,33.575502,-117.839807,1 SB LOS TRANCOS,0.71338,0.700778 
     62... 
     63 
     64}}} 
     65== Highway Status File == #highwaystatus 
     66The output from the Traffic Manager is the traffic conditions (or highway status) file.  It lists dynamic VDS info in a format suitable for processing by the CPTMS app. It is ordered by highway and postmile. 
     67 
     68Currently the CPTMS doesn't actually display lane-level details.  See attachment for Data Flow Diagram. 
     69 
     70{{{ 
     71{ 
     72  "type": "FeatureCollection", 
     73  "features": [ 
     74{ 
     75   "type": "Feature", 
     76   "id": "1 N 12.39", 
     77   "geometry": 
     78       { 
     79        "type": "Point", 
     80        "coordinates": [-117.828018,33.565462] 
     81       }, 
     82   "properties":  
     83       {"street": "1 SB REEF POINT DR", "color": "lime", "perpx": "0.547592", "perpy": "0.836745"} 
     84},   
     85{ 
     86   "type": "Feature", 
     87   "id": "1 N 12.78", 
     88   "geometry": 
     89       { 
     90        "type": "Point", 
     91        "coordinates": [-117.833412,33.568992] 
     92       }, 
     93   "properties":  
     94       {"street": "1 SB CRYSTAL HEIGHTS", "color": "lime", "perpx": "0.71338", "perpy": "0.700778"} 
     95}, 
     96... 
     97 
     98}}}