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

Transit 2050+ #64

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion model-files/RunIteration.bat
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ del hwy\iter%ITER%\x*.net

echo FINISHED ITERATION %ITER% %DATE% %TIME% >> logs\feedback.rpt

python "CTRAMP\scripts\notify_slack.py" "Finished iteration %ITER% in %MODEL_DIR%"
@REM python "CTRAMP\scripts\notify_slack.py" "Finished iteration %ITER% in %MODEL_DIR%"

:done
11 changes: 6 additions & 5 deletions model-files/RunModel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ C:\Windows\System32\where python
Cluster "%COMMPATH%\CTRAMP" 1-48 Starthide Exit

:: Set the IP address of the host machine which sends tasks to the client machines
set HOST_IP_ADDRESS=10.6.0.4
if %computername%==MODEL2-A set HOST_IP_ADDRESS=10.1.1.206
if %computername%==MODEL2-B set HOST_IP_ADDRESS=192.168.1.207
if %computername%==MODEL2-C set HOST_IP_ADDRESS=192.168.1.208
Expand Down Expand Up @@ -112,7 +113,7 @@ if %FUTURE%==X (
echo on
echo turn echo back on

python "CTRAMP\scripts\notify_slack.py" "Starting *%MODEL_DIR%*"
@REM python "CTRAMP\scripts\notify_slack.py" "Starting *%MODEL_DIR%*"

set MAXITERATIONS=3
:: --------TrnAssignment Setup -- Standard Configuration
Expand Down Expand Up @@ -430,7 +431,7 @@ if ERRORLEVEL 2 goto done

:: Extract key files
call extractkeyfiles
c:\windows\system32\Robocopy.exe /E extractor "%M_DIR%\OUTPUT"
@REM c:\windows\system32\Robocopy.exe /E extractor "%M_DIR%\OUTPUT"


: cleanup
Expand All @@ -453,7 +454,7 @@ call Run_QAQC
:success
ECHO FINISHED SUCCESSFULLY!

python "CTRAMP\scripts\notify_slack.py" "Finished *%MODEL_DIR%*"
@REM python "CTRAMP\scripts\notify_slack.py" "Finished *%MODEL_DIR%*"

if "%COMPUTER_PREFIX%" == "WIN-" (

Expand All @@ -463,7 +464,7 @@ if "%COMPUTER_PREFIX%" == "WIN-" (
cd %myfolder%

rem shutdown
python "CTRAMP\scripts\notify_slack.py" "Finished *%MODEL_DIR%* - shutting down"
@REM python "CTRAMP\scripts\notify_slack.py" "Finished *%MODEL_DIR%* - shutting down"
C:\Windows\System32\shutdown.exe /s
)

Expand All @@ -475,6 +476,6 @@ goto donedone
ECHO FINISHED.

:: if we got here and didn't shutdown -- assume something went wrong
python "CTRAMP\scripts\notify_slack.py" ":exclamation: Error in *%MODEL_DIR%*"
@REM python "CTRAMP\scripts\notify_slack.py" ":exclamation: Error in *%MODEL_DIR%*"

:donedone
290 changes: 290 additions & 0 deletions model-files/RunPPANetworkQAQC.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: RunPPANetworkQAQC.bat
::
:: MS-DOS batch file to run a dummy assignment for testing projects for PPA.
::
::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


:: Set the path
call CTRAMP\runtime\SetPath.bat
:: Which conda am I running?
C:\Windows\System32\where python

:: Start the cube cluster
Cluster "%COMMPATH%\CTRAMP" 1-48 Starthide Exit

:: Set the IP address of the host machine which sends tasks to the client machines
set HOST_IP_ADDRESS=10.6.0.4

:: for AWS, this will be "WIN-"
SET computer_prefix=%computername:~0,4%
set INSTANCE=%COMPUTERNAME%
set MAXITERATIONS=1

:: Figure out the model year
set MODEL_DIR=%CD%
set PROJECT_DIR=%~p0
set PROJECT_DIR2=%PROJECT_DIR:~0,-1%
:: get the base dir only
for %%f in (%PROJECT_DIR2%) do set myfolder=%%~nxf
:: the first four characters are model year
set MODEL_YEAR=%myfolder:~0,4%

:: MODEL YEAR ------------------------- make sure it's numeric --------------------------------
set /a MODEL_YEAR_NUM=%MODEL_YEAR% 2>nul
if %MODEL_YEAR_NUM%==%MODEL_YEAR% (
echo Numeric model year [%MODEL_YEAR%]
) else (
echo Couldn't determine numeric model year from project dir [%PROJECT_DIR%]
echo Guessed [%MODEL_YEAR%]
exit /b 2
)
:: MODEL YEAR ------------------------- make sure it's in [2000,3000] -------------------------
if %MODEL_YEAR% LSS 2000 (
echo Model year [%MODEL_YEAR%] is less than 2000
exit /b 2
)
if %MODEL_YEAR% GTR 3000 (
echo Model year [%MODEL_YEAR%] is greater than 3000
exit /b 2
)

set PROJECT=%myfolder:~11,3%
set FUTURE_ABBR=%myfolder:~15,2%
set FUTURE=X

:: FUTURE ------------------------- make sure FUTURE_ABBR is one of the five [RT,CG,BF] -------------------------
:: The long names are: BaseYear ie 2015, Blueprint aka PBA50, CleanAndGreen, BackToTheFuture, or RisingTidesFallingFortunes

if %PROJECT%==PPA (
if %FUTURE_ABBR%==RT (set FUTURE=RisingTidesFallingFortunes)
if %FUTURE_ABBR%==CG (set FUTURE=CleanAndGreen)
if %FUTURE_ABBR%==BF (set FUTURE=BackToTheFuture)
)

echo on
echo FUTURE = %FUTURE%

echo off
if %FUTURE%==X (
echo on
echo Couldn't determine FUTURE name.
echo Make sure the name of the project folder conform to the naming convention.
exit /b 2
)

echo on
echo turn echo back on


:: ------------------------------------------------------------------------------------------------------
::
:: Step 2: Create the directory structure
::
:: ------------------------------------------------------------------------------------------------------

:: Create the working directories
mkdir hwy
mkdir trn
mkdir skims
mkdir landuse
mkdir popsyn
mkdir nonres
mkdir main
mkdir logs
mkdir database
mkdir logsums

:: Stamp the feedback report with the date and time of the model start
echo STARTED MODEL RUN %DATE% %TIME% >> logs\feedback.rpt

:: Move the input files, which are not accessed by the model, to the working directories
copy INPUT\hwy\ hwy\
copy INPUT\trn\ trn\
copy INPUT\landuse\ landuse\
copy INPUT\popsyn\ popsyn\
copy INPUT\nonres\ nonres\
copy INPUT\warmstart\main\ main\
copy INPUT\warmstart\nonres\ nonres\
copy INPUT\logsums logsums\
copy INPUT\telecommute_constants.csv main\telecommute_constants.csv
copy INPUT\telecommute_constants.csv main\telecommute_constants_00.csv


:: ------------------------------------------------------------------------------------------------------
::
:: Preprocessing
::
:: ------------------------------------------------------------------------------------------------------


:: Runtime configuration: set project directory, auto operating cost,
:: and synthesized household/population files in the appropriate places
python CTRAMP\scripts\preprocess\RuntimeConfiguration.py
if ERRORLEVEL 1 goto done

:: Set the prices in the roadway network (convert csv to dbf first)
python CTRAMP\scripts\preprocess\csvToDbf.py hwy\tolls.csv hwy\tolls.dbf
IF ERRORLEVEL 1 goto done

:: Set the prices in the roadway network
runtpp CTRAMP\scripts\preprocess\SetTolls.job
if ERRORLEVEL 2 goto done

:: Set a penalty to dummy links connecting HOV/HOT lanes and general purpose lanes
runtpp CTRAMP\scripts\preprocess\SetHovXferPenalties.job
if ERRORLEVEL 2 goto done

:: Create time-of-day-specific
runtpp CTRAMP\scripts\preprocess\CreateFiveHighwayNetworks.job
if ERRORLEVEL 2 goto done

:: ------------------------------------------------------------------------------------------------------
::
:: Non-Motorized Skims
::
:: ------------------------------------------------------------------------------------------------------

:: Translate the roadway network into a non-motorized network
runtpp CTRAMP\scripts\skims\CreateNonMotorizedNetwork.job
if ERRORLEVEL 2 goto done

:: Build the skim tables
runtpp CTRAMP\scripts\skims\NonMotorizedSkims.job
if ERRORLEVEL 2 goto done

:: Step 4.5: Build initial transit files
python CTRAMP\scripts\skims\transitDwellAccess.py NORMAL NoExtraDelay Simple complexDwell %COMPLEXMODES_DWELL% complexAccess %COMPLEXMODES_ACCESS%
if ERRORLEVEL 2 goto done

set ITER=0
set PREV_ITER=0
set WGT=1.0
set PREV_WGT=0.00

:: ------------------------------------------------------------------------------------------------------
::
:: Subset taken from trnAssign.bat
::
:: ------------------------------------------------------------------------------------------------------
:trnAssign

set ALLTIMEPERIODS=AM MD PM EV EA
set TRNASSIGNITER=0
set PREVTRNASSIGNITER=NEG1
set PHTDIFFCOND=0.0001
set VOLDIFFCOND=0.005
set TRNASSIGNMODE=NORMAL
set TOTMAXTRNITERS=30
set MAXPATHTIME=240
set PCT=%%
set TRN_ERRORLEVEL=0

:: AverageNetworkVolumes.job uses PREV_ITER=1 for ITER=1
set PREV_TRN_ITER=%PREV_ITER%
IF %ITER% EQU 1 SET PREV_TRN_ITER=0

set ALLTRIPMODES=wlk_com_wlk drv_com_wlk wlk_com_drv wlk_hvy_wlk drv_hvy_wlk wlk_hvy_drv wlk_lrf_wlk drv_lrf_wlk wlk_lrf_drv wlk_exp_wlk drv_exp_wlk wlk_exp_drv wlk_loc_wlk drv_loc_wlk wlk_loc_drv
set ALLTOURMODES=wlk_trn_wlk drv_trn_wlk wlk_trn_drv
IF NOT DEFINED TRNFASTERTHANFREEFLOW (set TRNFASTERTHANFREEFLOW=0)


mkdir trn\TransitAssignment.iter%ITER%
cd trn\TransitAssignment.iter%ITER%

:copyTransitLin
:: bring in the latest transit files -- original if postprocessing
IF %ITER% EQU POSTPROC (
FOR %%H in (%ALLTIMEPERIODS%) DO copy /y ..\transitOriginal%%H.lin transit%%H_0.lin
)
IF NOT %ITER% EQU POSTPROC (
IF %ITER% EQU 0 (
FOR %%H in (%ALLTIMEPERIODS%) DO copy /y ..\transitOriginal%%H.lin transit%%H_0.lin
)
:: otherwise go from where the previous iteration left off
IF %ITER% GTR 0 (
FOR %%H in (%ALLTIMEPERIODS%) DO copy /y ..\TransitAssignment.iter%PREV_TRN_ITER%\transit%%H.lin transit%%H_0.lin
)
)
FOR %%H in (%ALLTIMEPERIODS%) DO (
copy /y transit%%H_0.lin transit%%H.lin
set LASTITER_%%H=0
set LASTSUBDIR_%%H=Subdir0
)

:: for fast config, only do 1
:: for standard config, keep it short for initial assign
if "%TRNCONFIG%"=="FAST" (set MAXTRNITERS=0)
if "%TRNCONFIG%"=="STANDARD" (
set MAXTRNITERS=%TOTMAXTRNITERS%
IF %ITER% EQU 0 (set MAXTRNITERS=4)
)
IF %ITER% EQU POSTPROC (set TRNASSIGNMODE=POSTPROC)
IF %ITER% EQU %MAXITERATIONS% (set PHTDIFFCOND=0)

echo START TRNASSIGN BuildTransitNetworks %DATE% %TIME% >> ..\..\logs\feedback.rpt

:: Prepare the highway network for use by the transit network
runtpp ..\..\CTRAMP\scripts\skims\PrepHwyNet.job
if ERRORLEVEL 2 (
set TRN_ERRORLEVEL=2
goto donedone
)

:: Create the transit networks
runtpp ..\..\CTRAMP\scripts\skims\BuildTransitNetworks.job
if ERRORLEVEL 2 (
set TRN_ERRORLEVEL=2
goto donedone
)


:transitSubAssign

:: Assign the transit trips to the transit network
runtpp ..\..\CTRAMP\scripts\assign\TransitAssign_NetworkQAQC.job
if ERRORLEVEL 2 (
set TRN_ERRORLEVEL=2
echo ERRORLEVEL is %ERRORLEVEL%
goto donedone
)
:: And skim
runtpp ..\..\CTRAMP\scripts\skims\TransitSkims.job
if ERRORLEVEL 2 (
set TRN_ERRORLEVEL=2
echo ERRORLEVEL is %ERRORLEVEL%
goto donedone
)

:: Copy skims to skim folder and rename
FOR %%A in (%ALLTRIPMODES% %ALLTOURMODES%) DO (
copy /y trnskmea_%%A.avg.iter%LASTITER_EA%.tpp ..\..\skims\trnskmea_%%A.tpp
copy /y trnskmam_%%A.avg.iter%LASTITER_AM%.tpp ..\..\skims\trnskmam_%%A.tpp
copy /y trnskmmd_%%A.avg.iter%LASTITER_MD%.tpp ..\..\skims\trnskmmd_%%A.tpp
copy /y trnskmpm_%%A.avg.iter%LASTITER_PM%.tpp ..\..\skims\trnskmpm_%%A.tpp
copy /y trnskmev_%%A.avg.iter%LASTITER_EV%.tpp ..\..\skims\trnskmev_%%A.tpp
)

cd ..
cd ..

:: Create the automobile level-of-service matrices
runtpp CTRAMP\scripts\skims\HwySkims.job
if ERRORLEVEL 2 goto done

:: Create accessibility measures for use by the automobile ownership sub-model
runtpp CTRAMP\scripts\skims\Accessibility.job
if ERRORLEVEL 2 goto done


:success
ECHO FINISHED SUCCESSFULLY!

goto donedone

:: this is the done for errors
:done
ECHO ERRORED OUT!!.

:donedone
Loading