Tutorial Vehicle-Hours-Traveled (VHT)

Main Page > Tutorials > Vehicle-Hours-Traveled (VHT)

Vehicle-Hours-Traveled (VHT) is verified here. The detailed steps are as follow.

Step 1. Run the Simulation
 * 1) Open Swashsim (version 2019.12.6.1).
 * 2) Open the project file and the network file.
 * 3) Hit the Simulation Button.
 * 4) Set a warm-up time and a simulation duration.
 * 5) Select Link Performance Measure data, Detector Aggregate Measures Data, Vehicle Time Step Data and Detector Vehicle Actuation Data for output options.
 * 6) Click the Customize to select the links you want to verify.
 * 7) Hit the Run Simulation button.

Step 2. Verify the Link Data Calculations 1. Read the TSD file in Rstudio. data = read.csv(file = 'your TSD file path', header = TRUE) 2. Extract the records of vehicles on the subject link. Take Link 46 as example. linkdata=data[data[, 8]==46,]  # Volume 8 is LinkID. 3. For the records of vehicle i, use the SimTime (column 1) of the last record minus the Simtime of the first record, then we now get the travel time of vehicle i. 4. Sum the travel time of all the vehicles, note that the unit of this result is vehicle*second. allvehid=unique(linkdata[,2]) VHT=0 for(vehid in allvehid) {    veh=linkdata[linkdata[,2]==vehid,] VHT=VHT+veh[dim(veh)[1],1]-veh[1,1] } 5. Divide the result in step 3 by 3600 to transfer the unit into veh-h. print(VHT/3600) 6. The result should match the Veh Hours Traveled (column W) in the LinkResults file.