Simulation Logic Flow

Main Page > Technical Documentation > Simulation Logic Flow

This section provides an overview of the sequence of steps that SwashSim employs to facilitate a simulation run.

Network Creation Before a simulation can be started, a valid network must be created and loaded into the simulation engine. More information about network creation is contained in Sections 8 (Network Structure) and 9 (Network Setup) of the technical documentation.

First Vehicle Entry

The set of entry nodes present in the network is looped through and for each one, the following are determined:
 * 1) the entry time into the network for the first vehicle to arrive; More information on this process is provided in Section 6 (Vehicle Generation).
 * 2) the fleet type (small auto, large truck, etc.) of the first vehicle to arrive
 * 3) the specific vehicle model type (e.g., Honda Civic); a vehicle model is identified randomly from all vehicle models available for simulation within the determined fleet type (see Section 4 (Vehicles) for more information)
 * 4) the assigned lane Id of the entering vehicle; the vehicle fleet type may influence this assignment if there are certain vehicle type lane restrictions (e.g., HOV lane, truck-only lane, no trucks allowed lane)
 * 5) the driver type for the entering vehicle; the lane assignment may influence the driver type assignment if policies such as 'slower drivers keep right' are in place for the downstream link(s)
 * 6) the desired speed for the entering vehicle/driver; the driver and vehicle types influence this setting

Simulation Time Loop The simulation time step is 0.1 s (i.e., calculations are performed 10 times per second). The program starts the execution of the simulation time loop. This loop starts at zero and ends at the total of the warm-up and simulation duration times. If the warm-up time is 900 s and the simulation duration is 3600 s, then the total simulation will be 4500 s (75 min). Since the simulation time step is 0.1 s, a total of 45,000 iterations of the simulation time loop will be performed.

Inside of the simulation time loop, the following actions are performed: Check whether entry time of the next vehicle at each entry node is equal to, or greater than, the simulation time; if so:

Create new vehicle
 * 1) Create new vehicle (per previously determined characteristics--fleet type, model type, driver type, assigned entry link lane, desired speed) and insert into the network at the corresponding entry node
 * 2) If a vehicle is downstream of the entering vehicle in the same lane, set the leader ID property of the entering vehicle accordingly and calculate the distance to this leader vehicle
 * 3) For the given entry speed, determine the appropriate transmission gear
 * 4) Determine engine RPM and torque/power output for the given vehicle speed and transmission gear
 * 5) Determine position of vehicle on entry link--this will be slightly downstream of beginning of link (i.e., entry node location) if the vehicle entry time was not an even increment of the simulation time step
 * 6) Identify if vehicle is considered to be in a platoon (i.e., reasonably close to a leading vehicle); More information about this process can be found in Section 7.3 (Car Following).
 * 7) Determine the time of the next vehicle to enter at the entry node for which a vehicle just entered
 * 8) For this next vehicle to enter the network, perform the same steps, 2-6, under the 'First Vehicle Entry' section

Update Status of Control Points

 If traffic signals are present in the network, update the status of the control points associated with the traffic signals More information about signalized intersection control can be found in Section 15 (Traffic Signal Operations) .   If ramp metering signals are present in the network, update the status of the control points associated with the ramp metering signals More information about ramp metering control can be found in Section 14 (Ramp Metering) .   If unsignalized intersections are present (2-way stop, all-way stop, roundabout), update the status of the control points associated with these intersections More information about gap acceptance logic for unsignalized intersections, and permitted left turns at signalized intersections, can be found in see Section 17 (Gap Acceptance) .  </li> </ol>

Update Vehicle Properties When one or more vehicles are present in the network, perform the following actions for each vehicle: Check Detector Status
 * 1) If it is possible for the vehicle to consider a lane change (e.g., it is on a link with more than one lane), call the lane changing logic and identify the desired lane for the next time step (i.e., the 'target lane'); More information about the lane changing logic can be found in Section 7.4 (Lane Changing) ; If not, the target lane ID is set equal to current lane ID
 * 2) Update leader and follower ID's as necessary for lane changes
 * 3) Calculate acceleration
 * 4) this a function of acceleration mode, which is a function of platoon status, control points, etc.
 * 5) Calculate velocity
 * 6) Calculate position
 * 7) If the emissions/fuel consumption calculation feature is enabled, the corresponding calculations are performed
 * 8) Check if a vehicle has exited its current travel link; if so:
 * 9) Move it onto its target link
 * 10) Set desired speed for new link; For more information, see Section 7.1 (Vehicle Movement Logic).
 * 11) Regular tangent links
 * 12) Regular curved links
 * 13) Passing in oncoming lane of two-lane highway
 * 14) Truck speed on downgrade
 * 15) Set turning movement and new target link
 * 16) Random based on end-of-link turning percentages
 * 17) Route assignment--see Section 16 (Route Assignment) for more information.
 * 1) Check if a vehicle has crossed a detector; if so, update detector measurements

End of Simulation Run When the simulation time loop has completed, any requested performance measure outputs are calculated and then written to the specified project output folder