Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gm uam #53

Open
wants to merge 31 commits into
base: gm_uam
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
66fb781
Modified trnAssign.bat to build AAM skims
jfdman Mar 30, 2022
e1d4a95
modified TransitSkims.job to build AAM skims
tedlini Mar 30, 2022
2bc82b3
modified PrepAssign.job to build AAM skims
tedlini Mar 30, 2022
3882c34
modified TransitAssign.job to build AAM skims
tedlini Mar 30, 2022
e231ad4
Modified tour and trip mode choice UECs to add advanced air mobility …
jfdman Mar 31, 2022
da40edf
Merge branch 'gm_uam' of https://github.com/RSGInc/travel-model-one i…
jfdman Mar 31, 2022
d16edf1
Updated jar file with new AAM mode!
jfdman Apr 1, 2022
64bebab
modified transferProhibitors_WLK_TRN_WLK.block to build AAM skims
tedlini Apr 1, 2022
b04940b
modified TransitSkims.job to build AAM skims
tedlini Apr 1, 2022
5325203
Merge branch 'gm_uam' of https://github.com/RSGInc/travel-model-one i…
tedlini Apr 1, 2022
b269bab
modified BuildTransitNetworks.job and Select_PNRs.awk for AAM skims
tedlini Apr 1, 2022
5bd2a8f
updated transferProhibitors_WLK_TRN_DRV.block
tedlini Apr 1, 2022
5f2c2bc
modified path settings for RSG setup; modified scripts to add aam mode
tedlini Apr 1, 2022
5470ed2
modified scripts to add aam mode
tedlini May 3, 2022
b53a751
AAM SP model estimated coefficients transferred into tour and trip mo…
jfdman Jun 10, 2022
7eb51b2
Updated tour and trip mode choice for AAM
tedlini Jun 17, 2022
61217f1
fixed treatment of income which, when negative, caused cost term for …
jfdman Jun 22, 2022
477be78
Initial working and debugged version of airport mode choice model, fo…
jfdman Jul 7, 2022
3abea1d
Updated the AirportModeChoice.block file to refer to actual data for …
jfdman Jul 8, 2022
c44c622
Now calculating percentages based on input airport trip tables, and d…
jfdman Jul 9, 2022
6dd4a1a
Modified AirportModeChoice.job to collapse trip table markets by peri…
jfdman Jul 9, 2022
8abf711
fixed bug in AirportModeChoice.job collapse trip tables.
jfdman Jul 9, 2022
4eb8139
Merge branch 'gm_uam' of https://github.com/RSGInc/travel-model-one i…
tedlini Jul 11, 2022
3b3cdf3
Merge branch 'gm_uam' of https://github.com/RSGInc/travel-model-one i…
tedlini Jul 11, 2022
267f42b
add AirportModeChoice.job to model run
tedlini Jul 21, 2022
65a0d94
Fixed drive AAM constant and AAM distance lookup in tour and trip mod…
tedlini Aug 4, 2022
c523009
Now with trip mode choice utilities and probabilities! To enable, set…
jfdman Dec 28, 2022
46d9339
added script to write out trip mode choice probabilities
tedlini Dec 28, 2022
0a363a6
updated AAM fare calc and summary scripts
tedlini Dec 28, 2022
bae7a47
Merge branch 'gm_uam' of https://github.com/RSGInc/travel-model-one i…
tedlini Dec 28, 2022
e6e2676
updated mode choice uec
tedlini Dec 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,119 @@ Any other branches are exploratory and not used in our planning work.

Please find a detailed User's Guide [here](https://github.com/BayAreaMetro/modeling-website/wiki/UsersGuide).

# Running advanced air mobility (AAM) models on a new machine
I. Installations

1. Make sure anaconda2 or 3 scripts folder is in path

set path=%PATH%;C:\ProgramData\Anaconda3\Scripts

2. create new conda environment in python 2.7 for dependencies:

conda create --prefix=C:\ProgramData\Anaconda3\envs\py27tm1 python=2.7

if encountering errors, try copying
1)libcrypto-1_1-x64.dll
2)libssl-1_1-x64.dll
from ...\Anaconda3\Library\bin to ...\Anaconda3\DLLs

3. Activate the environment.

activate py27tm1

4. Install packages

Follow MTC recommendation to download .whl file and install
https://github.com/BayAreaMetro/modeling-website/wiki/ComputingEnvironment
https://www.lfd.uci.edu/~gohlke/pythonlibs/

pip install E:\Projects\Clients\gm\models\python_packages\Shapely-1.6.4.post2-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\numpy-1.16.6+mkl-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\pandas-0.24.2-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\SimpleParse-2.2.0-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\xlrd-2.0.1-py2.py3-none-any.whl
pip install E:\Projects\Clients\gm\models\python_packages\xlwt-1.3.0-py2.py3-none-any.whl
pip install E:\Projects\Clients\gm\models\python_packages\xlutils-2.0.0-py2.py3-none-any.whl
pip install E:\Projects\Clients\gm\models\python_packages\pywin32-228-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\rpy2-2.7.8-cp27-none-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\Rtree-0.9.3-cp27-cp27m-win_amd64.whl
pip install E:\Projects\Clients\gm\models\python_packages\XlsxWriter-1.2.7-py2.py3-none-any.whl

conda install geopandas
pip install dbfpy

if getting this error ImportError: Missing required dependencies ['pytz'], try
pip install python-dateutil pytz --force-reinstall --upgrade

5. make sure that the VoyagerAPI is installed

https://communities.bentley.com/products/mobility-simulation-analytics/m/cube-files/275055
path is set in \ctramp\runtime\SetPath.bat

6. make sure that network-wrangler is in your path. First clone network-wrangler to your repository using tortoise git:

https://github.com/BayAreaMetro/NetworkWrangler.git

then make sure it is added to the PYTHONPATH in SetPath.bat

7. make sure utils directory is on machine and point to gawk executable in SetPath.bat

8. make sure COMPATH, R_LIB, PYTHON_PATH, RUNTIME, PATH, and M_DIR in SetPath.bat are updated

SET COMMPATH=%MODEL_DIR%
set PYTHON_PATH=C:\ProgramData\Anaconda3
set RUNTIME=%CD%\CTRAMP\runtime
set PATH=%RUNTIME%;%JAVA_PATH%\bin;%TPP_PATH%;%GAWK_PATH%\bin;%PYTHON_PATH%\envs\py27tm1;%PYTHON_PATH%\condabin;%PYTHON_PATH%\envs
set M_DIR=E:\Projects\Clients\gm\models\2035_TM152_FBP_Plus_24

9. import NetworkWrangler

https://github.com/BayAreaMetro/modeling-website/wiki/Network-Building-with-NetworkWrangler#build-a-future

II. Steps for Results Summary (not necessary for model run)

1. Install R packages scales, dplyr, shapes, tidyr

2. If running RunResults.py (currently commented), update travel-model-one-master path to E:\\Projects\\Clients\\gm\\models\\travel-model-one\\

3. pip install these packages
pip install simpledbf
pip install xlwings
pip install openpyxl
If getting ImportError: No module named win32api, try pip install --upgrade pywin32==224

III. Set up and run base model without AAM

1. Create a new folder named 2035_TM152_FBP_Plus_24
2. Run the following command (conda env is activated in RunModel.bat, so it's not necessary to activate env prior to the model run)

cd /d E:\Projects\Clients\gm\models\2035_TM152_FBP_Plus_24
SetUpModel_2035_TM152_FBP_Plus_24.bat
RunModel.bat

IV. Set up AAM model run
1. update path and run Num_tours_sorted.ipynb
2. update path and run k-means.ipynb
3. update path and run generate_transitLines.ipynb
4. Open freeflow.net in Cube -> Play Edit Log -> AAM_nodes.log in INPUT\2035_TM152_FBP_Plus_24_aam_50v\hwy, Save
5. create a new folder 2035_TM152_FBP_Plus_24_aam_50v_500cpm (50 vertiports, AAM fare 500 cents per mile) in E:\Projects\Clients\gm\models
6. Copy SetUpModel_2035_TM152_FBP_Plus_24_aam_50v.bat from a previous run to this folder and update AAM_INPUT path

V. Run AAM model
1. Run the following command
cd /d E:\Projects\Clients\gm\models\2035_TM152_FBP_Plus_24_aam_50v_500cpm
SetUpModel_2035_TM152_FBP_Plus_24_aam_50v.bat (copies all files and add AAM input files)
RunModel.bat

VI. Set up and run fare sensitivity scenario on the same AAM network (only runs the final iteration)
1. Copy AAM full run, remove output folder, metrics folder, extractor folder, iter0 and iter1 folder in hwy and trn folder, and nonres\airport_by_mode_TOD.csv
2. Change the folder name based on naming convention 2035_TM152_FBP_Plus_24_aam_50v_800cpm
3. Copy RunCoreSummariesShortRun.bat, RunLogsumsShortRun.bat, RunMetricsShortRun.bat, RunScenarioMetricsShortRun.bat and CTRAMP\RunIterationShortRun.bat
4. Update Project.Directory and AAM.cost.per.mile in accessibilities.properties, logsums.properties, and mtcTourBased.properties in CTRAMP\runtime
-AAM.cost.per.mile is in year 2000 cents (496), while fare in folder name (800) is in year 2019 cents
5. Update AAM.costPerMile in CTRAMP\scripts\block\AirportModeChoice.block (4.96, unit: year 2000 dollars per mile)
6. Copy and run RunAAMModel.bat

VII. Results Summary
1. Save dist_list_50v.csv and taz-superdistrict-county.csv in analysis\Inputs
2. Run Summarize_trips_TM1.5_AAM_50v_500cpm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public class HouseholdDataWriter {
private final String databaseStringFormat = "'%s'";
private String stringFormat = fileStringFormat;

private boolean saveUtilsProbsFlag = false;
private boolean saveTourUtilsProbsFlag = false;
private boolean saveTripUtilsProbsFlag = false;

private ResourceBundle resourceBundle;
private ModelStructure modelStructure;
Expand All @@ -77,12 +78,18 @@ public HouseholdDataWriter( ResourceBundle resourceBundle, ModelStructure modelS
this.iteration = iteration;

// default is to not save the tour mode choice utils and probs for each tour
String saveUtilsProbsString = resourceBundle.getString( CtrampApplication.PROPERTIES_SAVE_TOUR_MODE_CHOICE_UTILS );
if ( saveUtilsProbsString != null ) {
if ( saveUtilsProbsString.equalsIgnoreCase( "true" ) )
saveUtilsProbsFlag = true;
String saveTourUtilsProbsString = resourceBundle.getString( CtrampApplication.PROPERTIES_SAVE_TOUR_MODE_CHOICE_UTILS );
if ( saveTourUtilsProbsString != null ) {
if ( saveTourUtilsProbsString.equalsIgnoreCase( "true" ) )
saveTourUtilsProbsFlag = true;
}

// default is to not save the trip mode choice utils and probs for each trip
String saveTripUtilsProbsString = resourceBundle.getString( CtrampApplication.PROPERTIES_SAVE_TRIP_MODE_CHOICE_UTILS );
if ( saveTripUtilsProbsString != null ) {
if ( saveTripUtilsProbsString.equalsIgnoreCase( "true" ) )
saveTripUtilsProbsFlag = true;
}
}

//NOTE - this method should not be called simultaneously with the file one one as the string format is changed
Expand Down Expand Up @@ -474,7 +481,7 @@ private List<String> formIndivTourColumnNames() {
data.add("origSharedTNCWait");
data.add("destSharedTNCWait");

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "util_%d", i );
Expand Down Expand Up @@ -517,7 +524,7 @@ private List<String> formJointTourColumnNames() {
data.add("origSharedTNCWait");
data.add("destSharedTNCWait");

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "util_%d", i );
Expand Down Expand Up @@ -563,7 +570,7 @@ private List<SqliteDataTypes> formIndivTourColumnTypes() {
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
Expand Down Expand Up @@ -604,7 +611,7 @@ private List<SqliteDataTypes> formJointTourColumnTypes() {
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
Expand Down Expand Up @@ -649,7 +656,7 @@ private List<String> formIndivTourDataEntry(Tour t) {
data.add(string(t.getOrigTNCSharedWait()));
data.add(string(t.getDestTNCSharedWait()));

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = t.getTourModalUtilities();
for ( int i=0; i < utils.length; i++ )
Expand Down Expand Up @@ -695,7 +702,7 @@ private List<String> formJointTourDataEntry(Tour t) {
data.add(string(t.getOrigTNCSharedWait()));
data.add(string(t.getDestTNCSharedWait()));

if ( saveUtilsProbsFlag ) {
if ( saveTourUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = t.getTourModalUtilities();
for ( int i=0; i < utils.length; i++ )
Expand Down Expand Up @@ -791,6 +798,20 @@ private List<String> formIndivTripColumnNames() {
data.add("taxiWait");
data.add("singleTNCWait");
data.add("sharedTNCWait");

if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "util_%d", i );
data.add( colName );
}

for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "prob_%d", i );
data.add( colName );
}
}

return data;
}

Expand Down Expand Up @@ -818,6 +839,18 @@ private List<String> formJointTripColumnNames() {
data.add("taxiWait");
data.add("singleTNCWait");
data.add("sharedTNCWait");
if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "util_%d", i );
data.add( colName );
}

for ( int i=1; i <= numModeAlts; i++ ) {
String colName = String.format( "prob_%d", i );
data.add( colName );
}
}
return data;
}

Expand Down Expand Up @@ -905,6 +938,18 @@ private List<SqliteDataTypes> formIndivTripColumnTypes() {
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);

if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
}

for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
}
}

return data;
}

Expand Down Expand Up @@ -932,6 +977,18 @@ private List<SqliteDataTypes> formJointTripColumnTypes() {
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);

if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
}

for ( int i=1; i <= numModeAlts; i++ ) {
data.add( SqliteDataTypes.REAL );
}
}

return data;
}

Expand Down Expand Up @@ -1006,6 +1063,22 @@ else if ( ! s.isInboundStop() && s.getStopId() == t.getNumOutboundStops() ) {
data.add(string(s.getOrigSingleTNCWait()));
data.add(string(s.getOrigSharedTNCWait()));

if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = s.getTripModalUtilities();
for ( int i=0; i < utils.length; i++ )
data.add(string(utils[i]));
for ( int i=utils.length; i < numModeAlts; i++ )
data.add( "-999" );

float[] probs = s.getTripModalProbabilities();
for ( int i=0; i < probs.length; i++ )
data.add(string(probs[i]));
for ( int i=probs.length; i < numModeAlts; i++ )
data.add( "0.0" );
}


return data;
}

Expand Down Expand Up @@ -1091,7 +1164,21 @@ else if ( ! s.isInboundStop() && s.getStopId() == t.getNumOutboundStops() ) {
data.add(string(s.getOrigSingleTNCWait()));
data.add(string(s.getOrigSharedTNCWait()));


if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = s.getTripModalUtilities();
for ( int i=0; i < utils.length; i++ )
data.add(string(utils[i]));
for ( int i=utils.length; i < numModeAlts; i++ )
data.add( "-999" );

float[] probs = s.getTripModalProbabilities();
for ( int i=0; i < probs.length; i++ )
data.add(string(probs[i]));
for ( int i=probs.length; i < numModeAlts; i++ )
data.add( "0.0" );
}

return data;
}

Expand Down Expand Up @@ -1144,7 +1231,21 @@ private List<String> formTourAsIndivTripDataEntry(Tour t, boolean inbound) {
data.add(string((inbound ? t.getDestTNCSingleWait() : t.getOrigTNCSingleWait())));
data.add(string((inbound ? t.getDestTNCSharedWait() : t.getOrigTNCSharedWait())));


if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = t.getTourModalUtilities();
for ( int i=0; i < utils.length; i++ )
data.add(string(utils[i]));
for ( int i=utils.length; i < numModeAlts; i++ )
data.add( "-999" );

float[] probs = t.getTourModalProbabilities();
for ( int i=0; i < probs.length; i++ )
data.add(string(probs[i]));
for ( int i=probs.length; i < numModeAlts; i++ )
data.add( "0.0" );
}

return data;
}

Expand Down Expand Up @@ -1206,6 +1307,21 @@ private List<String> formTourAsJointTripDataEntry(Tour t, boolean inbound) {
data.add(string((inbound ? t.getDestTNCSingleWait() : t.getOrigTNCSingleWait())));
data.add(string((inbound ? t.getDestTNCSharedWait() : t.getOrigTNCSharedWait())));

if ( saveTripUtilsProbsFlag ) {
int numModeAlts = modelStructure.getMaxTourModeIndex();
float[] utils = t.getTourModalUtilities();
for ( int i=0; i < utils.length; i++ )
data.add(string(utils[i]));
for ( int i=utils.length; i < numModeAlts; i++ )
data.add( "-999" );

float[] probs = t.getTourModalProbabilities();
for ( int i=0; i < probs.length; i++ )
data.add(string(probs[i]));
for ( int i=probs.length; i < numModeAlts; i++ )
data.add( "0.0" );
}

return data;
}

Expand Down
Loading