Getting started - tlumip/CALM GitHub Wiki
The CALM model is a collection of different travel modeling components. The core components of the model system are:
- JEMnR β ODOTβs trip-based household travel demand model, implemented in R.
- Visum and Python β Zone and network data management, as well as network skimming and assignment procedures.
- University model - a tour-based model implemented in Java, using the CT-RAMP Common Modeling Framework (CMF) library of tools.
- Commercial vehicle model (CVM) β ODOTβs trip-based commercial vehicle model implemented in R.
- External model β ODOTβs external travel model based on select link analysis flows from SWIM at each model external station location, implemented in R.
The model system is run from a DOS batch program, RunModel.bat.
The modeling machine must be capable of running Visum, but this model does not otherwise require extensive machine resources.
The model is configured to run on Windows, and uses Visum, Python, Java, and R. To ease installation and setup, complete installations of Python, Java, and R are included in a software dependency package and are used when running the model.
- Python is Visumβs preferred scripting tool, Java is used for the University model, and R is used for JEMnR, the commercial vehicle model, and the external model. The software dependency package includes the required third-party libraries as well.
- Visum is a commercial transport modeling software package developed by PTV.
First, download the model program files from GitHub. It is best to clone the GitHub repository CALM to the machine that the model is going to be run, either via the GitHub Desktop software or via command line with git installed. Cloning allows for easy updates by pull
ing down newer changes or push
ing up local changes. Alternatively, GitHub offers a simple ZIP download but this does not include git's version control features.
To clone with GitHub desktop, first sign in with a GitHub.com account with access to the repository. Click on File, then Clone a repository. Search for tlumip/CALM
, click on the correct result, and select a local folder location. Click Clone to start the download.
If using a command line, follow the directions below. Otherwise, skip to Software Dependencies.
# open a dos prompt, navigate to or create the desired directory, and type:
git clone https://github.com/tlumip/CALM.git
The CALM repository is currently private and requires user authentication to be cloned. When using the command line, GitHub requires users to authenticate using a Personal Access Token over HTTPS or public/private keys via SSH. Username and Password authentication is no longer allowed.
Complete installations of specific versions of Python, Java, and R are kept in a "dependency package." This ensures that the correct version of software is always available to the model directory regardless of software installed elsewhere on the computer. CALM uses the same dependency package developed for Southern Oregon Activity-based Model (SOABM), which includes the following software packages:
- Java JDK 1.8.0_111
-
Pandoc(SOABM visualizer requirement, but not used in CALM) - Python 2.7.3
- Python 3.7.4
- R 3.4.1
Neither git clone nor the GitHub ZIP file include the contents of the dependencies
folder. The dependencies are the same as those in SOABM and can be copied if available locally or obtained from the SOABM GitHub repository. A direct download of dependencies.zip
is available as well.
On initial checkout/download, the user will need to:
- Expand
dependencies.zip
into a directory at the same level as thetemplate
folder since it will be used by multiple scenarios. - Create and rename a copy of the
template
folder to create a new scenario.
7-zip is required to be installed in order to generate ZMX matrix files for the University model.
The directory structure for the CALM model consists of a software dependencies directory and a template model setup directory. The template directory can simply be copied to create a new scenario. The template directory structure is shown below. A brief description of the components of the directories follows.
The template directory should have a file structure as shown below (all paths relative to the root directory):
Following is a description of the model directory contents, including output folders created during model runs and an example scenario folder:
root/
β
βββ dependencies/
β βββ jdk1.8.0_111/ β Java installation directory
β βββ Pandoc/ - used only in SOABM
β βββ Python27/ β Python 2.7 installation directory
β βββ Python37/ β Python 3.7 installation directory
β βββ R-3.4.1/ β R installation directory
β
βββ template/
| βββ RunModel.bat β Script used to run model
| βββ modelRunner.R - Script for running JEMnR model components
| βββ VISUM_Runner.py - Script for skimming and assignment via Visum API
| βββ functiontable.csv - List of R scripts to source for necessary JEMnR functions
| βββ modelReport.html - JEMnR HTML model report
| βββ access/ - JEMnR intermediate files for accessibilities
| βββ inputs/ - JEMnR inputs including settings and TAZ data
| | βββ cvm/ - production, attraction, and friction factors for the Commercial Vehicle Model
| | βββ externalModel/ - external model inputs and select links
| | βββ PopSyn/ - population synthesis inputs
| | βββ RData/ - data read into R from CSV or OMX is stored here in RData format
| | βββ utilities/ - CSV files containing coefficients, factors, generation rates, or utilities for several model steps
| βββ modec/ - JEMnR intermediate files for mode choice
| | βββ ... contains output folders for each trip purpose, plus a common folder
| βββ outputs/ - skims, demand matrices, and loaded Visum networks
| | βββ matrices/ - OMX skim and demand matrices
| | βββ networks/ - loaded Visum networks for daily and peak periods
| βββ peaking/ - JEMnR intermediate files for P-A to O-D and TOD
| | βββ ... contains output folders for each trip purpose plus cvm and trip matrices in RData format
| βββ pregen/ - contains output household workers, children, and car ownership RData files
| βββ rcode/ - JEMnR source code
| | βββ access/ - accessibility scripts
| | βββ comVeh/ - Commercial Vehicle Model scripts
| | βββ modec/ - mode choice scripts
| | βββ OMX/ - Open Matrix (OMX) and Zip Matrix (ZMX) APIs for R
| | βββ peaking/ - Time-of-Day peaking and directional scripts
| | βββ pregen/ - accessibility; household workers, children, vehicle ownership models
| | βββ tripdist/ - trip distribution scripts
| | βββ tripgen/ - trip generation scripts
| | βββ university/ - scripts to split University and non-University populations and call the University model from R (does not contain University model code or executable)
| | βββ inputCheck_V4.R - runs logical checks on inputs and produces warning messages
| | βββ inputs.R - sets up common vectors and scalars, reads in CSV files as R objects
| | βββ inputsSave.R - converts inputs, including skims, to RData format
| | βββ jemnrFunctions.R - common functions used across JEMnR scripts
| | βββ ModelModules.r - main script controlling model flow
| | βββ modelReport.R - script to generate the HTML report
| | βββ writeToOMX.R - generates demand matrices in OMX format; replaces writeToBank.R
| βββ resultsAnalysis/ - images and supporting files for JEMnR HTML model report
| βββ tripdist/ - JEMnR intermediate files for trip distribution
| βββ tripgen/ - JEMnR intermediate files for trip generation
| βββ unimodel/ - University model inputs, scripts, Java binary
| | βββ ctlfiles/ - University model properties file and Utility Expression Calculators (UECs)
| | βββ documentation/ - University model documentation (Word documents)
| | βββ emmemat/ - output folder for model skims in ZMX format
| | βββ outputs/ - University model outputs folder
| | | βββ iter0/ - first iteration output (contains output CSV files)
| | | βββ iter1/ - second/final iteration output (contains output CSV files, copied one level up to outputs/)
| | | βββ householdsOut.csv - University population households output file
| | | βββ personsOut.csv - University population persons output file
| | | βββ workersByOccupationAndTAZ.csv - Number of workers by occupation for each TAZ for University population
| | | βββ parkingDemand.csv - University parking lot demand by zone, space type, and half-hour time period
| | | βββ UnmetParkingDemand.csv - University parking demand
| | | βββ tours.csv - disaggregate output tours list
| | | βββ trips.csv - disaggregate output trips list
| | βββ rpt/ - log files
| | βββ EMXtoZMX.py - Python script to convert Emme matrices to ZMX (no longer used)
| | βββ gpl.exe - helper executable
| | βββ households.csv - University population households input
| | βββ jar_context.txt - update notes regarding the Parking Lot Choice model
| | βββ lcogmc34.exe - (unknown executable)
| | βββ nextemod.bat - (unknown: maybe related to Emme EMX files, appears unused)
| | βββ Parking_Capacity.csv - University parking lot spaces by TAZ input
| | βββ persons.csv - University population persons input
| | βββ RunUniversityModel.cmd - batch file to run the University model
| | βββ ss11hRVMPOwithzeros.csv - households
| | βββ ss11pRVMPOwithzeros.csv - persons
| | βββ tazData.csv - University model TAZ input
| | βββ tpau.jar - University model Java archive
| | βββ UniTAZs.csv - list of University zone IDs
| | βββ universityAccessibilities.csv - University model logsums by market segment and trip purpose from each zone to all zones
| βββ visum/ - input version file and procedures
| βββ procedures/ - procedure sequences in XML format
| βββ CALM.ver - input version file for the Corvallis-Albany-Lebanon Model (if this file name changes, update the visumInputFile setting)
β
βββ scenario1/
βββ RunModel.bat
βββ ... Scenario folders have all the same contents as the template folder above
The access, modec, peaking, pregen, resultsAnalysis, tripdist, and tripgen folders are generated during a model run.
To create and run a new model scenario (run), do the following:
- Ensure the required dependencies folder is in place. See Software Dependencies for details.
- Create a scenario folder by duplicating the
template
folder and renaming the new folder. Every scenario is contained within its own folder, with a unique name. The dependencies folder must be at the same directory level as the template and scenario folder(s). This allows several scenario runs to make use of a single dependencies folder. - Edit the necessary input files for the scenario, which at a high level can be thought of as Network and Land Use changes:
- Network β If there are network revisions for the scenario, edit the input version file in Visum.
- If any edits are made in the version file, the user should ensure that the revised version file passes all relevant Network checks under the Calculate -> Network check function in Visum. All checks may not be necessary. Typically the user should be able to ensure the follow checks complete without issue:
- Isolated nodes
- Zones not connected for PrT
- Check network consistency (for all auto modes)
- Dead-end roads PrT (for all auto modes)
- Links without succeed. link (for all auto modes)
- Links with Capacity PrT = 0 or V0 = 0
- TAZ land use data β If there are population, employment, or other zone related revisions, edit
inputs/taz.csv
- Run the Scenario
- Open a DOS command prompt in the scenario folder: clear the location bar, then type
cmd
and hit enter to launch the command prompt or via Shift + Right click then Open Command Window Here (or "Open PowerShell Window Here") - Type
RunModel.bat
in the DOS window and hit enter to run the model (if in PowerShell type .\RunModel.bat). Prior to running the RunModel.bat file the user can consider if any changes to the bat file are needed such as the number of iterations. More information on making changes to the bat file can be found on the RunModel batch file page.
- Open a DOS command prompt in the scenario folder: clear the location bar, then type