Architecture Specification Document



| |

|Traffic Simulator |

|Architecture Specification Document |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

|Khalid AlHokail |

|Luke Bay |

|James Grady |

|Michael Murphy |

| |

|Version 1.0 |

| |

|20/3/2007 |

Table of Contents

1. Architecture Diagram 4

2. Component’s Description 4

2.1. Traffic Simulator 4

2.1.1. Data Display Plots 4

2.1.2. Data Storage 5

2.1.3. Assignment 6

2.1.4. Constraint Evaluator 7

2.1.5. User Interface 7

2.2. Map Model 8

2.2.1. Load_Graph 8

2.2.2. Load_Intersection_Rules 8

2.2.3. Load_Road_Properties 8

2.2.4. Segment_Divider 9

2.2.5. Draw_2D_Map 9

2.2.6. Start_End_Construction 10

2.2.7. Refresh_Map 10

2.3. Driving Model 11

2.3.1. Max_Population_Array 11

2.3.2. Current_Population_Array 11

2.3.3. Migration_Scheduler 12

2.3.4. Migration_Traffic_Generator 12

2.3.5. Random_Traffic_Generator 13

2.4. Traffic Light Control 13

2.4.1. Light_Cycle_Timer 13

2.4.2. Traffic_Light_Cycler 14

2.5. Decision Model 14

2.5.1. Route_Generator_General 14

2.5.2. Route_Generator_Blockage_Rerouter 15

2.5.3. Traffic_Incident_Generator 15

2.5.4. Traffic_Incident_Update_Map_Model 16

2.5.5. Traffic_Incident_Update_2D_Map 17

2.5.6. Traffic_Incident_Monitor_Collisions 17

2.5.7. Vehicle_Speed_Adapter 18

2.5.8. Map_Reader 18

3. Justification 19

3.1. Traffic Simulator 19

3.2. Map Model 20

3.3. Driving Model 21

3.4. Traffic Light Control 21

3.5. Decision Model 21

4. Component’s Responsibilities 22

4.1. Traffic Simulator 22

4.2. Map Model 22

4.3. Driving Model 22

4.4. Traffic Light Control 23

4.5. Decision Model 23

Architecture Diagram

[pic]

Component’s Description

1 Traffic Simulator

1 Data Display Plots

1 Description

This component is responsible of displaying information to the user such as message boxes and current population and traffic distribution.

2 Components on which it depends

• User Interface

3 Components that depend on it

• Draw_2D_Map

4 SRS requirements that map to this component

• 2.1.3 The time of day shall be displayed to the user.

• 4.2.3 The status of the vehicle shall be displayed (start node, current node, next node, end node, edge position, speed).

• 4.2.6 Traffic incidents shall be represented on the 2D map.

2 Data Storage

1 Description

The component is responsible of storing and loading the graph along with all the properties and any changes that occur on the graph. If any component needs to change something on the graph, such as adding a construction or creating an accident, it should go through this component.

2 Components on which it depends

• None

3 Components that depend on it

• Assignment

• Load Map

• Load_Intersection_Rules

• Load_Road_Properties

• Start_End_Construction

• Max_Population_Array

4 SRS requirements that map to this component

• 1.1.2.6 If the constraint evaluator determines the value is invalid, an exception will be generated by the assignment and no assignment will be performed.

• 1.2.1.1 Legal turns are stored in each node.

• 1.2.2.2 Each node will include all the allowed turns that can be made from that particular node.

• 1.2.2.3 Allowed turns are stored as an enumeration (e.g. Left, Right, Straight means that this node only allows Left, Right or going straight, and doesn’t allow anything else).

• 1.3.1.1 Lane capacity represents the number of lanes on an edge.

• 1.4.1.1 Maximum allowed capacity is same as the lane capacity defined in 1.3.1.

• 2.1.3.1 The format of the time shall be mm/dd/yyyy hh:mm:ss.

• 2.2.1.1 A random number, > 10, of start and end nodes shall be generated, and each of these nodes shall be outside the boundary of the displayed map.

• 2.2.1.2 Each of these nodes shall be associated with 2 double arrays.

• 3.1.1 The rules of the location shall dictate the order in which the lights will cycle.

• 3.2.1.1 The enumeration shall contain the colors Red, Yellow, and Green.

• 3.2.2.3 When the cycle time has passed, the stored color of the light will change.

• 3.2.2.6 The user must be able to change the cycle time of each light, individually.

• 4.1.1.4 Each edge will have a value proportional to its length. Edges are instantiated as contiguous road segments, and each edge has its own speed limit.

• 4.4.1.3 The waypoints shall be stored in an array such that element 0 is the start node, element n is the end node, and elements 1 to n-1 are the nodes which, when followed in order, connect the edges of the graph. These edges, which are a mathematical construct, correspond to the path the driver will follow. This path is represented by (a subset of the) connected road segments displayed on the screen.

3 Assignment

1 Description

If an assignment needs to be done by the user in the application, it should go through the Assignment component. This component will consult the Constraint Evaluator, first for the validity of the assignment. And based on Constraint Evaluator’s response, the Assignment will react either by assigning the value or rejecting the assignment.

2 Components on which it depends

• Data Storage

• Constraint Evaluator

3 Components that depend on it

• None

4 SRS requirements that map to this component

• 1.1.2.5 If the constraint evaluator determines that the value is valid, assignment is performed.

4 Constraint Evaluator

1 Description

This component is responsible of checking the validity of the data that was input by the user. If the input is valid then it returns True, otherwise returns False.

2 Components on which it depends

• None

3 Components that depend on it

• Assignment

4 SRS requirements that map to this component

• 1.1.2.4 Assignment must consult the constraint evaluator.

5 User Interface

1 Description

This component is the part that is visible to the user where he can see the drawn map with all the information on it. It also enables the user to input some changes to the map, such as starting or ending a construction.

2 Components on which it depends

• None

3 Components that depend on it

• Start_End_Construction

• Max_Population_Array

• Migration_Scheduler

4 SRS requirements that map to this component

• 1.1.2.1 A value of a property can be produced by a system entity or a user.

2 Map Model

1 Load_Graph

1 Description

This component will be used during the startup of the application where it will load the graph from a file into the memory. It will create all the nodes and edges and connect them.

2 Components on which it depends

• Data Storage

3 Components that depend on it

• Load_Intersection_Rules

• Load_Road_Properties

• Draw_2D_Map

4 SRS requirements that map to this component

• 1.1 Graph

2 Load_Intersection_Rules

1 Description

After loading the graph, each node will be loaded with its rules. The rules are stored in a file and will be read by this component.

2 Components on which it depends

• Load_Graph

• Data Storage

3 Components that depend on it

• None

4 SRS requirements that map to this component

• 1.2 Rules for Intersections

3 Load_Road_Properties

1 Description

After loading the graph, each edge will be loaded with its properties such as number of lanes and road length. The properties are stored in a file and will be read by this component.

2 Components on which it depends

• Load_Graph

• Data Storage

3 Components that depend on it

• Segment_Divider

• Draw_2D_Map

4 SRS requirements that map to this component

• 1.3 Number of Lanes.

4 Segment_Divider

1 Description

After loading the road properties, the Segment_Divider will take a road as an input and will divide it into car-length segments (where 1 segment represents 8 feet) depending on the road length.

2 Components on which it depends

• Load_Road_Properties

3 Components that depend on it

• None

4 SRS requirements that map to this component

• 1.3.2.2 A system entity called segment divider is responsible for dividing the lane into segments.

5 Draw_2D_Map

1 Description

When the graph is loaded and each node and edge has all the properties set, this component will draw the graph for the user as a 2D map. The map will display each edge as a road and each node as an intersection visually representing its length, number of lanes, the status of each segment on the road, traffic lights, and cars.

2 Components on which it depends

• Load_Graph

• Load_Road_Properties

• Data Display Plots

3 Components that depend on it

• Refresh_Map

4 SRS requirements that map to this component

• 1.1 Graph

• 1.2.1.2 There shall be a directed edge for each direction a car may travel.

• 1.3.2.1 Each segment will accommodate only one car at the same time.

• 1.3.2.3 Each lane segment shall correspond to a real world segment that is 8 feet long by 5 feet wide.

• 1.4.1.2 A drivable lane is a lane that has not been closed because of a collision.

• 1.5 2D Map - Visualize Flow (over time)

• 4.2.6 Traffic incidents shall be represented on the 2D map.

6 Start_End_Construction

1 Description

This component will take an edge as an input, the lane on that edge and a flag indicating whether to start or end a construction. If a construction needs to be started, the lane that was taken as an input is closed, and if a construction is finished, the lane that was taken as an input is opened.

2 Components on which it depends

• Data Storage

• User Interface

3 Components that depend on it

• None

4 SRS requirements that map to this component

• 1.4.2 The number of drivable lanes shall be updated in real time when a lane is closed or opened.

7 Refresh_Map

1 Description

Every specific amount of time, this component will call the Draw_2D_map to show the updates on the map.

2 Components on which it depends

• Draw_2D_Map

3 Components that depend on it

• None

4 SRS requirements that map to this component

• None

3 Driving Model

1 Max_Population_Array

1 Description

This array determines the maximum number of residential and commercial drivers that can be assigned to a population node. These values shall be determined by the user.

2 Components on which it depends

• User Interface

• Data Storage

3 Components that depend on it

• Current population array

• Migration_Traffic_Generator

• Random_Traffic_Generator

4 SRS Requirements that map to this component

• 2.2.1 Static population distributions shall be provided.

2 Current_Population_Array

1 Description

This is an array that keeps track of the changing population of each population node. In addition to the residential and commercial values, there is a third value in the array. The third value keeps track of what percentage of the total population is currently present in the population node.

2 Components on which it depends

• Static population array

3 Components that depend on it

• Migration_Traffic_Generator

• Random_Traffic_Generator

4 SRS Requirements that map to this component

• 2.2.1.2.b Array2 = [rcur, wcur] where rcur is the current number of residents for the associated node, and wcur is the current number of workers for that node.

3 Migration_Scheduler

1 Description

This component is responsible for triggering a migration event and the appropriate migration type. The migration scheduler observes the clock and at times set by the user a to work or a to home migration will occur.

2 Components on which it depends

• Time

• User interface

3 Components that depend on it

• Migration_Traffic_Generator

4 SRS Requirements that map to this component

• 2.3.1.2 For each day there will be a traffic migration from home nodes to work nodes in the morning, and, in reverse, from work nodes to home nodes in the evening.

4 Migration_Traffic_Generator

1 Description

The migration traffic generator is responsible for generating the traffic during rush hour periods. When a rush hour event is triggered this component randomly selects a population node and generates a vehicle with a destination node of a random population node.

2 Components on which it depends

• Time

• Set population array

• Current population array

3 Components that depend on it

• none

4 SRS Requirements that map to this component

• 2.3.1.2. For each day there will be a traffic migration from home nodes to work nodes in the morning, and, in reverse, from work nodes to home nodes in the evening.

5 Random_Traffic_Generator

1 Description

The Random_Traffic_Generator is responsible for generating traffic between migration periods. At random intervals traffic is generated from one population node to another.

2 Components on which it depends

• Current Population array

3 Components that depend on it

• none

4 SRS Requirements that map to this component

• 2.3.1.1 Throughout the day, there will be random traffic migrations chosen from random start nodes to random end nodes.

4 Traffic Light Control

1 Light_Cycle_Timer

1 Description

The light cycle timer counts down from the current light color’s duration to zero. When the cycle timer reaches zero the light shall cycle to the next color. The cycle time shall be expressed in milliseconds and the timer shall count down in real time.

2 Components on which it depends

• Time

3 Components that depend on it

• Traffic Light Cycler

4 SRS requirements that map to this component

• 3.2.2 Each traffic light shall have a separate timing.

2 Traffic_Light_Cycler

1 Description

The Traffic Light Cycler is a function that changes the light color enumeration after the light’s cycle time has reached zero. The enumeration will cycle to the next color dictated by the location of the traffic light.

2 Components on which it depends

• Light Cycle Timer

3 Components that depend on it

• Draw_2D_Map

4 SRS requirements that map to this component

• 3.2.1 The lights shall be represented by enumerations and guide the drivers at intersections.

5 Decision Model

1 Route_Generator_General

1 Description

Given a graph with a start node and an end node, this component shall compute the shortest path connecting the nodes.

2 Components on which it depends

• Map_Reader

3 Components that depend on it

• Route_Generator_Blockage_Rerouter

4 SRS requirements that map to this component

• 4.4.1.1 Each driver shall follow a path in the directed graph, G, where a path is a sequence of vertices (nodes) such that for each i from 0 to n-1 is an edge in G.

• 4.4.1.2 The waypoints shall be generated using Dijkstra’s algorithm.

• 4.4.1.3 The waypoints shall be stored in an array such that element 0 is the start node, element n is the end node, and elements 1 to n -1 are the nodes which, when followed in order, connect the edges of the graph. These edges, which are a mathematical construct, correspond to the path the driver will follow. This path is represented by (a subset of the) connected road segments displayed on the screen.

• 4.4.1.4 At each node, the vehicle will read the allowable turns.

2 Route_Generator_Blockage_Rerouter

1 Description

When a vehicle finds that the next road segment in its path contains a stopped vehicle (which could result from a traffic incident or a red light), this component will search for a legal sub-route that connects with one of the nodes not yet visited in the vehicle’s original route.

2 Components on which it depends

• Map_Reader

• Route_Generator_General

3 Components that depend on it

• Refresh_Map

4 SRS requirements that map to this component

• 4.2.1.1 When a vehicle is in motion and tries to move onto a blocked segment, it will stop and move to an adjacent open lane if one exists.

• 4.4.1.5 In the case that the vehicle is unable to take a needed turn, it will travel to a node that is non-blocked and adjacent.

• 4.4.1.6 Once the vehicle has selected the new node to travel to, it will generate a new route, using Dijkstra’s algorithm, with the node it is traveling to as a new start node and with the original end node.

• 4.4.1.7 If a vehicle cannot make a needed turn and there are no other reachable nodes, the vehicle stops and waits for the turn to become available.

3 Traffic_Incident_Generator

1 Description

Using the values in SRS 4.2.1.4 for a vehicle located at a non-intersection and the values in SRS 4.2.4.2 for a vehicle located at a non-intersection of the SRS, this component shall compute the probability that a vehicle shall cause a traffic incident.

2 Components on which it depends

• Map_Reader

3 Components that depend on it

• Traffic_Incident_Update_Map_Model

• Traffic_Incident_Update_2D_Map

4 SRS requirements that map to this component

• 4.2.4.1 The probability that a vehicle will cause an accident is a random number p, such that 0 ≤ p ≤ 0.001 for a roadway segment that is not an intersection.

• 4.2.4.2 The probability that a vehicle will cause an accident is a random number p, such that 0 ≤ p ≤ 0.005 for an intersection. An accident at an intersection will only occur if the portion of the intersection that is perpendicular to the vehicle’s direction is spanned by stalled traffic.

4 Traffic_Incident_Update_Map_Model

1 Description

When a traffic incident occurs, this component updates the map model by setting the road segment on which the incident occurred to blocked status.

2 Components on which it depends

• Traffic_Incident_Generator

• Traffic_Incident_Monitor_Collisions

3 Components that depend on it

• Refresh_Map

4 SRS requirements that map to this component

• 4.2.5.1 Accidents located on a roadway will block the roadway segment that the accident occurred on. The blockage will not allow vehicles to travel on the blocked segment.

• 4.2.5.2 Road segment closures shall be displayed as a black road segments.

• 4.2.5.3 Accidents located on an intersection will restrict the allowable turns by blocking the roadway segment directly behind and the segment to the right of where the collision occurred in the intersection. So, if there is an accident in an intersection, then oncoming traffic cannot make a left turn at that intersection.

• 4.2.5.4 The blocked segments of an intersection shall be displayed as black segments.

5 Traffic_Incident_Update_2D_Map

1 Description

When a traffic incident occurs, this component directs the 2D map to show a flashing red Ø at incident’s road segment and to color road segments black that contain stopped vehicles.

2 Components on which it depends

• Traffic_Incident_Generator

• Traffic_Incident_Monitor_Collisions

3 Components that depend on it

• Refresh_Map

4 SRS requirements that map to this component

• 4.2.6.3 Each traffic incident shall be displayed as a flashing red Ø.

6 Traffic_Incident_Monitor_Collisions

1 Description

The component acts a listener to the platform’s Detect Object Collisions module and calls Traffic_Incident_Update_Map_Model and Traffic_Incident_Update_2D_Map when an event occurs.

2 Components on which it depends

• Detect Object Collisions

3 Components that depend on it

• Traffic_Incident_Update_Map_Model

• Traffic_Incident_Update_2D_Map

4 SRS requirements that map to this component

• 4.2.6.1 If two or more moving objects (cars) occupy the same space, then a collision occurs.

• 4.2.6.2 If a car on segment i collides with a car on segment i + 1, both cars will occupy segment i + 1.

7 Vehicle_Speed_Adapter

1 Description

Using the equation in SRS 4.3.1.2, this component, when queried by a specific vehicle on a specific road segment, shall return the speed that vehicle should be travelling.

2 Components on which it depends

• Data Storage

3 Components that depend on it

• Refresh Map

4 SRS requirements that map to this component

• 4.2.2.1 Vehicles will not stop unless they are a part of a traffic incident or are blocked by traffic congestion.

• 4.2.3.1 Vehicles shall never stop because of a lack of fuel.

• 4.3.1.1 On segments that have traffic incidents or red lights; drivers will travel at 0% of the speed limit.

• 4.3.1.2 For a car at segment i, let

[pic]

be 1 + the number of cars in the 20 contiguous segments that precede and succeed segment i. Then, the car at segment i will travel at p = [pic] of the speed limit. If segment i has fewer than 20 contiguous preceding or succeeding segments, then the value used by the summation for each non-existing segmentj is 0. The author generated the equation for p by entering estimations of empirical observations into an Excel spreadsheet, using Excel to produce an exponential trend line, and altering that trend line until R2, the coefficient of determination, = 1.

• 4.3.1.3 If a car travels from road segment i that has speed limit j to road segment i +1 that has speed limit k, where j ≠ k, then the car’s change in speed from one segment to the next shall be instantaneous.

8 Map_Reader

1 Description

The component returns a representation of the graph’s instantiation. This representation shall contain the graph’s nodes, edge lengths, edge connections, and data for each road segment.

2 Components on which it depends

• Data Storage

3 Components that depend on it

• Route_Generator_General

• Route_Generator_Blockage_Rerouter

• Traffic_Incident_Generator

• Vehicle_Speed_Adapter

4 SRS requirements that map to this component

• 4.1.1.1 The driver shall be able to read the properties of edges and nodes.

• 4.1.1.2 The driver can only drive on roads, and roads are represented as edges.

• 4.1.1.3 The driver can only travel from one node to another if these nodes are connected by an edge.

• 4.1.1.4 Each edge will have a value proportional to its length. Edges are instantiated as contiguous road segments, and each edge has its own speed limit.

Justification

1 Traffic Simulator

The Data Display Plots component is responsible for displaying the information along with the Draw_2D_Map component to the user, and since it is responsible for displaying only one thing, no further subdivision need to happen.

The component that has the responsibility for changing data on the graph or loading data from the graph is Data Storage. Every component that needs to access the graph should go through this component.

Because our application needs to take input from the user, we need to check the validity of that input before assigning it. It is the responsibility of the Assignment component to take the input and check its validity before storing it. And, since there are two jobs, we have separated them into the Assignment component and the Constraint Evaluator component. The second component returns either True or False indicating whether the data is valid or not.

We created a User Interface component because we think that it is an entity on its own. It has a responsibility for interacting with the user, taking input from him, and displaying output to him.

2 Map Model

The Load_Graph component is an important part of the map model because it is impossible to keep the graph in the memory all the time. That is why we need to create a component responsible for loading the graph from the file into the memory. This component can’t be profitably divided into more sub-components.

After loading the map into the memory, each node needs to be loaded with its rules, which is the job of the Load_Intersection_Rules component. This component reads the rules from a file and assigns the values to each node. This component is already simple and needs no further division except for the assignment part which is handled by the assignment component.

The same thing applies to the Load_Road_Properties component. This component reads the properties from a file and assigns each edge with its properties. Similar to the Load_Intersection_Rules component, this component is simple and needs no further division, except for the assignment part, which is handled by the assignment component.

The Segment_Divider component is important because it takes a road and divides it into car length segments. Each segment can only accommodate one car at a time. This component is simple enough and needs no more sub-divisions.

Draw_2D_Map is a component that is responsible for displaying the data to the user in the user interface, and since the data we need to display consists of the map and the information, we separated a second component called Data Display Plots.

The component Start_End_Construction gives the user the ability to close or open roads by starting or ending construction. Because it simply increases or decreases the number of drivable lanes, there is no need to separate it into two components.

At each iteration of time, the last component, Refresh_Map, is responsible for calling the Draw_2D_Map every specific amount of time. The reason that this component is not within the Draw_2D_Map is that we don’t want it to be responsible for time. It should be separate.

3 Driving Model

The driving model populates the map and does so through the use of a traffic generator. By using two types of traffic generators, we can simulate random traffic patterns and migration patterns. The migration traffic generator is used to simulate rush hours when roads are at or near full capacity, and the random traffic generator randomizes patterns based on people’s locations. Both generators use arrays to generate traffic.

The max population array is the total number of commercial and residential people that can occupy a population node. This will allow users to designate areas that have high residential populations and low commercial populations, or vice versa. The current population array keeps track of what percentage of a population is in a population node at any time. This will guide the random traffic generator as to where the majority of traffic should be originating from. The scheduler is needed to keep rush hours consistent.

4 Traffic Light Control

The traffic light control system can be broken into a component that controls the lights’ timing and a component that cycles the lights’ colors. The light cycle timer is responsible for keeping the traffic light’s timing for each light color. The traffic light cycler is responsible for changing the light color when necessary. These two components are necessary to ensure that lights change at the correct time and to the correct color.

5 Decision Model

The route generator, which was a singular component, has two reasonable divisions. The first component, Route_Generator_General, is the algorithm that calculates the path and the second component, Route_Generator_Blockage_Rerouter, handles the special case of when a portion of the path is blocked.

Traffic incidents have four reasonable divisions. The first, Traffic_Incident_Generator, generates incidents. The second, Traffic_Incident_Monitor_Collisions, listens for incidents. And the third and fourth, Traffic_Incident_Update_Map_Model and Traffic_Incident_Update_2D_Map update the map model and the 2D map, respectively.

It seems that any vehicle, regardless of its location, should be able to make a single query to discover what its current speed should be, and Vehicle_Speed_Adapter provides this functionality.

Rather than having several components read elements of the map, the Map_Reader reads the whole map, and the other components call its methods.

Component’s Responsibilities

1 Traffic Simulator

This part contains all the shared components by all other models. All models need to read and write to the graph, so we included the Data Storage component. Also, all components need to display information to the user, which is why we included the Data Display Plots.

The assignment and constraint evaluator should be in this section because the input from the user must be validated before storing. And our last component in this section is the User Interface. We think that it needs to communicate with all the components taking input from or providing output to all other models.

2 Map Model

The map model is responsible for the environment. It creates roads and intersections and sets the static rules at each part of the map. That is why we have components such as Load_Graph, Load_Intersection_Rules, Load_Road_Properties and Segment_Divider. And since it is the map model’s responsibility to maintain the map, it is also its responsibility to display it to the user. That is why we included components such as Draw_2D_Map and Refresh_Map. One last component that is found here is the Start_End_Construction, which is responsible for changing properties of the roads, thus its inclusion.

3 Driving Model

The driving model is the component that is responsible for populating the map with drivers. In order to accomplish this, the driving model comprises three general parts. The first part is the population arrays, the second is the traffic generators, and finally there is the migration scheduler.

There are two population arrays. The first array is the max population array, which is the maximum number of residential or commercial drivers allowed in a population node, and the values in this array are static. The second array is the current population array. It keeps track of how many residential or commercial drivers are in a population node. The current population node also keeps track of what percentage of the total population is present in population node.

Traffic is generated by the traffic generators. The random traffic generator produces random traffic; it will be influenced by the population percentages in the current population array. More traffic will be generated from population nodes with higher population percentages.

The migration traffic generator is responsible for rush hour events. When a rush hour event is triggered, this component randomly selects a population node and generates a vehicle with a destination node of a random population node. Depending on the direction of the migration, the generator decrements the residential or commercial values in the current population array. For example, the morning rush hour triggers a migration from residential to commercial areas, so the migration traffic generator checks if the current residential population value of a random population node is greater than zero. If it is, the generator decrements it and then selects a random destination node and checks if the current commercial population value of the destination area has reached its maximum value. If it has not then it increments the current commercial population value of the destination node and generates a car. If either of the conditions above is not met, then the traffic generator either will randomly chose a new start and destination node.

Finally the migration scheduler is responsible for triggering the migration events. The scheduler will check the clock to see if it should start the migration traffic generator and in which direction it should send the traffic, for example at 8:00 am it starts a to work migration and at 5:00 pm it starts a to home migration.

4 Traffic Light Control

Because all traffic lights simply change color over time in the simulation, two components suffice: one for timing and another for color changing. Only one timing component is needed because only one light color needs to be timed at one time per traffic light. The traffic light cycler will listen to the traffic light timer when cycling between light colors. These components are closely related and cannot be decomposed further.

5 Decision Model

One component computes one algorithm: that is why Route_Generator_General needs no further divisions.

Several things are considered when changing a vehicle’s route, but they are tidily handled by one component, the Route_Generator_Blockage_Rerouter, and they all contribute to a single decision: which new route is chosen.

For each car the Traffic_Incident_Generator simply determines if an indecent shall occur based on random probabilities, which tend to be higher for cars at intersections. To divide it into two components, one for intersections and the other for non-intersections, would add no benefits.

When a traffic incident occurs, maps need to be updated. However, the map model and the 2D map are conceptually different and require disparate elements to be updated, so it is appropriate to separate map updating into two components: the Traffic_Incident_Update_Map_Model for the representation of what the user will see and the Traffic_Incident_Update_2D_Map for what the user actually sees.

There should be a single event listener, Traffic_Incident_Monitor_Collisions, for single event– vehicle (object) collisions. And assigning vehicle speeds can be done well by a single component, the Vehicle_Speed_Adapter. Finally, reading the map data, on which most of the other components depend, can also be done by a single component, the Map_Reader.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download