Calibration Summaries - bellevuewa/BKRCast GitHub Wiki
Daysim summary is generated by a set of scripts written in R language. R is primarily used to process and summarize DaySim outputs. Various summaries are prepared for submodel outputs such as auto ownership, tour/trip modes, and times, among others. Summaries are written out to Excel spreadsheets that are then used in calibration and validation of the AB travel demand model.
It is a separate set of tools from BKRCast.
Installation of R
-
Install R and R Studio. Use 64-bit version if possible.
Recommended version:- R: 4.5.0
- RStudio: latest version
-
Install Java. If you are using 64-bit R, be sure to install 64-bit Java. If you are not sure which R you are using, install both 32-bit and 64-bit Java on your computer.
-
Install
Rtools
. Be sure to installrtools40-x86_64.exe
, which is compatible with R 4.1.1. -
Install required R libraries by using the following commands in R console:
Manually create a folderC:\Users\HDong\R\libs
on your local drive. Then in R studio console,
.libPaths('C:/Users/HDong/R/libs')
This line will direct R to install libraries in the designated folder.
install.packages("foreign")
install.packages("XLConnect")
install.packages("descr")
install.packages("Hmisc")
install.packages("data.table")
install.packages("plyr")
install.packages("reshape")
install.packages("Rcpp")
install.packages("sqlalchemy")
Note: Package
XLConnect
also installs dependencyXLConnectJars
which requires Java on the machine.
File Structure
Below is the list of folders under daysim_summaries folder.
Folder | Description |
---|---|
bkrcast_all | daysim summary for all area |
bkrcast_inbkr | daysim summary for internal BKR |
bkrcast_outbkr | daysim summary for outside of BKR |
compare | summary comparison between survey, Soundcast, bkrcast_all, bkrcast_inbkr, and bkrcast_outbkr |
Three folders are inside of bkrcast_all, bkrcast_inbkr or bkrcast_outbkr folder.
Folder | Description |
---|---|
data | 2014 PSRC household travel survey data |
template | output file templates |
output | output files |
Scripts
- Update
trips_filter.R
(under the root folder) by changing file path pointing to the right locations of daysim output files and supporting files. This script separates BKR internal of households, persons, person-days, tours and trips from externals. - Within each bkrcast_all, bkrcast_inbkr, and bkrcast_outbkr:
- Update “Daysim_output_config.R” by updating file path for DaySim outputs and survey data
- Update “main.R” at Line 18 for the working directory
- Update “Daysim_output_config.R” by updating file path for DaySim outputs and survey data
- Update
update_data.py
(under the root folder) by changing data folder path point to the right location of daysim_summaries folder.
xlrd=1.1.0
is required forupdate_data.py
. - Run
runBKRCastSummaries.bat
.
output files can be found from output subfolder of BKRCast_all, BKRCast_inbkr, or BKRCast_outbkr folder. Comparison files can be found in daysim_summaries/compare folder.
As an option, these scripts can be run individually in R Studio. Open “main.R” in R Studio, SELECT all code and click “Run”, otherwise it only runs the current line.