Changes between Version 14 and Version 15 of TrafficModelATMSOverview
- Timestamp:
- 02/14/2019 09:08:50 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TrafficModelATMSOverview
v14 v15 1 1 = Traffic Model / FEP / ATMS Overview Document = 2 3 2 == Table of Contents == 4 5 1. [#terminology Terminology] 6 1. [#purpose Purpose] 7 1. [#architecture System Architecture] 8 1. [#overview Overview of System] 9 1. [#trafficmodeloverview Traffic Model] 10 1. [#fepsimoverview FEP Simulator] 11 1. [#atmsoverview ATMS] 12 1. [#systembehavior System Behavior] 13 1. [#whyfep Why do we need FEP Sim?] 14 1. [#detailedcomponentoverviews Detailed Component Overviews] 15 1. [#trafficmodeldetail Traffic Model] 16 1. [#trafficmodelbehavior Behavior] 17 1. [#trafficmodelclasses Traffic Model Classes] 18 1. [#differentabstractions Different Abstractions. FEP Line vs Highway] 19 1. [#fepsimdetail FEP Simulator] 20 1. [#realfep The Real FEP] 21 1. [#ourfep Our FEP Simulator] 22 1. [#atmsdetail ATMS] 23 1. [#protocols Protocols] 24 1. [#traffictofep Traffic Model to FEP Simulator] 25 1. [#exampletraffic Example Traffic Conditions Message] 26 1. [#feptoatms FEP Simulator to ATMS] 27 1. [#fepreply fep_reply structs] 28 1. [#trafficmessage Traffic Conditions Message Structure] 3 1. [#terminology Terminology] 4 1. [#purpose Purpose] 5 1. [#architecture System Architecture] 6 1. [#overview Overview of System] 7 1. [#trafficmodeloverview Traffic Model] 8 1. [#fepsimoverview FEP Simulator] 9 1. [#atmsoverview ATMS] 10 1. [#systembehavior System Behavior] 11 1. [#whyfep Why do we need FEP Sim?] 12 1. [#detailedcomponentoverviews Detailed Component Overviews] 13 1. [#trafficmodeldetail Traffic Model] 14 1. [#trafficmodelbehavior Behavior] 15 1. [#trafficmodelclasses Traffic Model Classes] 16 1. [#differentabstractions Different Abstractions. FEP Line vs Highway] 17 1. [#fepsimdetail FEP Simulator] 18 1. [#realfep The Real FEP] 19 1. [#ourfep Our FEP Simulator] 20 1. [#atmsdetail ATMS] 21 1. [#protocols Protocols] 22 1. [#traffictofep Traffic Model to FEP Simulator] 23 1. [#exampletraffic Example Traffic Conditions Message] 24 1. [#feptoatms FEP Simulator to ATMS] 25 1. [#fepreply fep_reply structs] 26 1. [#trafficmessage Traffic Conditions Message Structure] 29 27 30 28 == Terminology == #terminology 31 32 - FEP = Front End Processor 33 - ATMS = Advanced Traffic Management Server 34 - TMC = Traffic Management Control 35 - RPC = Remote Procedural Calls 29 * FEP = Front End Processor 30 * ATMS = Advanced Traffic Management Server 31 * TMC = Traffic Management Control 32 * RPC = Remote Procedural Calls 36 33 37 34 == Purpose == #purpose 38 39 An 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. 35 An 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. 40 36 41 37 This document provides an overview of the Traffic Model, the FEP Simulator, and the ATMS. Each of these components work together in the TMC Simulation System to simulate traffic conditions, and display them to trainees. This document will explain to the reader, at a high level, the system architecture and how the components work together to simulate the traffic conditions, an overview of each component, and lastly, the protocols between each component. 42 38 43 39 == System Architecture == #architecture 44 45 The [wiki:DeploymentDiagram System (Traffic Model / FEP / ATMS) Deployment/Component Diagram] is a UML Deployment / Component diagram which helps to describe the system architecture. 40 The [wiki:DeploymentDiagram System (Traffic Model / FEP / ATMS) Deployment/Component Diagram] is a UML Deployment / Component diagram which helps to describe the system architecture. 46 41 47 42 == Overview of System == #overview 48 49 43 === What is the Traffic Model? === #trafficmodeloverview 50 51 44 The 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. 52 45 53 46 === What is the FEP Simulator? === #fepsimoverview 54 55 The FEP Simulator simulates the actual FEP that is used in production systems at Cal Trans. The actual FEP gathers the real time highway sensor data and transmits it to the ATMS. The FEP Simulator will gather simulated highway sensor data from the traffic model and transmit it to the ATMS. It acts as a mediator between the Traffic Model and the ATMS. Its purpose is to receive the traffic condition data over a socket from the Traffic Model, parse and reformat this received data into fep_reply structs, and send the fep_reply structs to the ATMS via RPC. The FEP Simulator is a C++ program that runs on a Linux VM on the TMC network. 47 The FEP Simulator simulates the actual FEP that is used in production systems at Cal Trans. The actual FEP gathers the real time highway sensor data and transmits it to the ATMS. The FEP Simulator will gather simulated highway sensor data from the traffic model and transmit it to the ATMS. It acts as a mediator between the Traffic Model and the ATMS. Its purpose is to receive the traffic condition data over a socket from the Traffic Model, parse and reformat this received data into fep_reply structs, and send the fep_reply structs to the ATMS via RPC. The FEP Simulator is a C++ program that runs on a Linux VM on the TMC network. 56 48 57 49 === What is the ATMS? === #atmsoverview 58 59 50 The ATMS is a production server, purchased from Cal Trans, that accepts the fep_reply structs from the FEP Simulator via RPC. The ATMS accepts fep_reply structs, which contain traffic condition data, to feed the ATMS Client. The ATMS Client displays traffic condition data on an interactive map GUI to the trainees. 60 51 61 52 === System Behavior / How do these components work together? === #systembehavior 62 63 53 Reference the [wiki:TrafficFEPATMSActivityDiagram Traffic Model / FEP / ATMS Activity Diagram] while reading this section. It helps to describe system behavior. 64 54 … … 70 60 71 61 === Why do we need the FEP Simulator? === #whyfep 72 73 62 Why do we need the FEP Simulator as a mediator? Can't we just send the fep_replys directly to the ATMS via RPC? The short answer to this question is no. Java does not support RPC natively, whereas C and C++ do. It is possible to use RPCs with Java, but to do so it would require a great deal of work or money. Read more about this decision in the [wiki:LessonsLearned Lessons Learned Document]. 74 63 75 64 == Detailed Component Overviews == #detailedcomponentoverviews 76 77 65 This section will describe each component individually in more detail, to give a better understanding of how they work. 78 66 79 67 === Traffic Model === #trafficmodeldetail 80 81 68 Reference the [wiki:TrafficModelClassDiagram Traffic Model Class Diagram] while reading this section. 82 69 83 70 ==== Behavior ==== #trafficmodelbehavior 84 85 71 As 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 and instantiated upon CAD Server start up. Once instantiated, the Traffic Model Manager spawns an instance of the WriteToFEPThread, which sends the current traffic conditions of the Highways to the FEP Simulator by calling the Highways class' writeToFEP() method, on every 30 second interval. 86 72 … … 88 74 89 75 ==== Traffic Model Classes ==== #trafficmodelclasses 90 91 The 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. Stations do have an associated direction. Stations may or may not have Loop Detectors associated with the specified station direction, or the opposite specified direction. Hence, the undirected Highway abstraction. 92 93 The 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 ATMS Client (Green/Yellow/Red). This enum supplies the necessary volume and occupancy values to achieve the desired display color for a Loop Detector. 76 The 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. Stations do have an associated direction. Stations may or may not have Loop Detectors associated with the specified station direction, or the opposite specified direction. Hence, the undirected Highway abstraction. Diagram: [attachment:PeMS_data_sources.png PeMS data souces]. 77 78 The 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 ATMS Client (!Green/Yellow/Red). This enum supplies the necessary volume and occupancy values to achieve the desired display color for a Loop Detector. 94 79 95 80 ==== Different Abstractions. FEP Line vs Highway ==== #differentabstractions 96 97 It should be noted that the ATMS has no concept of the Highways and Highway abstraction, only FEPLines, Stations, and Loop Detectors. FEPLines, like the Highway Class, are also composed of Stations but are not a convenient abstraction because they only represent serial communication lines used to communicate with a geographic group of field stations. The FEPLines need to be represented because they contain necessary attributes that must be passed on to the FEP Simulator to populate the fep_reply structs. As a developer you will work within the Highways, Highway, Station, and LoopDetector abstraction. The Traffic Model communicates with the FEP Simulator / ATMS in the context of the FEPLine, Station, LoopDetector abstraction. 81 It should be noted that the ATMS has no concept of the Highways and Highway abstraction, only FEPLines, Stations, and Loop Detectors. FEPLines, like the Highway Class, are also composed of Stations but are not a convenient abstraction because they only represent serial communication lines used to communicate with a geographic group of field stations. The FEPLines need to be represented because they contain necessary attributes that must be passed on to the FEP Simulator to populate the fep_reply structs. As a developer you will work within the Highways, Highway, Station, and !LoopDetector abstraction. The Traffic Model communicates with the FEP Simulator / ATMS in the context of the FEPLine, Station, !LoopDetector abstraction. 98 82 99 83 The next section "FEP Simulator" will give a better understanding of FEPLines and why their representation is necessary in the simulation system. 100 84 101 85 === FEP Simulator === #fepsimdetail 102 103 86 Reference the [wiki:FEPSimClassDiagram FEP Simulator Class Diagram] while reading this section. It is not quite as helpful as the Traffic Model Class Diagram, because the FEP Simulator is really just a functional program. 104 87 105 88 ==== The Real FEP ==== #realfep 106 107 To understand how the FEP Simulator works, it helps to understand how the actual FEP works. The actual FEP "polls" field stations, over serial communication lines (FEPLines), for traffic data via RPC. For clarity, "polling" is the act of the FEP requesting traffic data from a field station. When "polled", the field station sends traffic data back to the FEP via RPC. Upon receipt of the traffic data from the field stations, the FEP then reformats the data into an fep_reply struct and sends it to the ATMS via RPC. 89 To understand how the FEP Simulator works, it helps to understand how the actual FEP works. The actual FEP "polls" field stations, over serial communication lines (FEPLines), for traffic data via RPC. For clarity, "polling" is the act of the FEP requesting traffic data from a field station. When "polled", the field station sends traffic data back to the FEP via RPC. Upon receipt of the traffic data from the field stations, the FEP then reformats the data into an fep_reply struct and sends it to the ATMS via RPC. 108 90 109 91 ==== Our FEP Simulator ==== #ourfep 110 111 92 In contrast, our FEP Simulator is not actually "polling" field stations, and instead just reads all traffic data over the socket from the CAD Server's Traffic Model. It is similar, however, in that it reformats traffic condition data into fep_reply structs and sends them to the ATMS via RPC. 112 93 … … 116 97 117 98 === ATMS === #atmsdetail 118 119 99 The ATMS is a complete production server purchased from CalTrans. We were unable to find detailed documentation about ATMS features other than its ability to receive fep_reply structs via RPC and feed the received data to the ATMS Client interactive map GUI. 120 100 121 101 == Protocols == #protocols 122 123 102 === Traffic Model to FEP Simulator === #traffictofep 124 125 103 The Traffic Model communicates with the FEP Simulator by sending the traffic conditions message over a socket connection. 126 104 … … 128 106 129 107 ==== Example Traffic Conditions Message ==== #exampletraffic 130 131 108 Example traffic conditions message (toCondensedFormat(false)) output: 109 132 110 {{{ 133 111 43 // "number of lines" … … 145 123 }}} 146 124 === FEP Simulator to ATMS === #feptoatms 147 148 125 The FEP Simulator communicates with the ATMS via RPC. It sends fep_reply structs which contain traffic condition data messages. Each fep_reply struct corresponds to a single FEPLine. 149 126 150 127 The FEP Simulator includes the generated rpc files: "fep.h", "fep_clnt.c", and "fep_xdr.c". These files need to be included to utilize RPC. 151 128 152 The method used to transfer the fep_replys, from the included rpc files, is named fep_reply_xfer_32(fep_reply *reply, CLIENT *clnt). 129 The method used to transfer the fep_replys, from the included rpc files, is named fep_reply_xfer_32(fep_reply *reply, CLIENT *clnt). 153 130 154 131 fep_reply structs contain metadata and an fep_answer_list struct. An fep_answer_list struct contains a fep_shortanswer_list struct. An fep_shortanswer_list struct contains an fep_shortanswer struct. An fep_shortanswer struct contains an fep_shortanswer_msg struct. The fep_shortanswer_msg contains a char array, which is the actual message that contains traffic condition data. All of these structs are defined in the "fep.h" file. The struct definitions are as follows: … … 173 150 }; 174 151 typedef struct fep_reply fep_reply; 175 }}}152 }}} 176 153 }}} 177 154 178 155 ==== fep_answer_list struct ==== 179 180 156 {{{ 181 157 #!div style="font-size: 80%" … … 189 165 }; 190 166 typedef struct fep_answer_list fep_answer_list; 191 }}} 192 }}} 167 }}} 168 }}} 169 193 170 ==== fep_shortanswer_list ==== 194 171 {{{ … … 200 177 }; 201 178 typedef struct fep_shortanswer_list fep_shortanswer_list; 202 }}}179 }}} 203 180 }}} 204 181 205 182 ==== fep_shortanswer ==== 206 207 183 {{{ 208 184 #!div style="font-size: 80%" … … 213 189 }; 214 190 typedef struct fep_shortanswer fep_shortanswer; 215 }}}191 }}} 216 192 }}} 217 193 … … 224 200 char message[MAXSHORTREPLYLEN]; 225 201 }; 226 }}}202 }}} 227 203 }}} 228 204 229 205 ==== Traffic Conditions Message Structure ==== #trafficmessage 230 231 206 As seen above in the fep_anser_short_msg struct, the traffic conditions message is a char[] array. The FEP Simulator uses the static packData(STATION*) method from the `DataPacker` class to pack the traffic condition data into a message. 232 207 … … 248 223 || 27 to Last Byte - 1 || VARIES || Dynamic data for loop detectors. If there is data for the loop detector, pack volume and occupancy into a two byte data packet using the packVOLOCC(vol, occ) method, insert at the current position, and increase the current position after doing so. || 249 224 || Last Byte || VARIES || check sum value || 250 251
