diff --git a/model-files/RunCoreSummaries.bat b/model-files/RunCoreSummaries.bat index 2474d6c69..cfe573b20 100644 --- a/model-files/RunCoreSummaries.bat +++ b/model-files/RunCoreSummaries.bat @@ -50,22 +50,22 @@ if %NEED_SUMMARY% GTR 0 ( echo. :: convert the summaries to tde for just this dir -for %%X in ("%TARGET_DIR%\core_summaries\*.rdata") DO ( - if not exist "%TARGET_DIR%\core_summaries\%%~nX.tde" ( - python "%CODE_DIR%\RdataToTableauExtract.py" "%TARGET_DIR%\core_summaries" "%TARGET_DIR%\core_summaries" %%~nxX - if %ERRORLEVEL% GTR 0 goto done +@REM for %%X in ("%TARGET_DIR%\core_summaries\*.rdata") DO ( +@REM if not exist "%TARGET_DIR%\core_summaries\%%~nX.tde" ( +@REM python "%CODE_DIR%\RdataToTableauExtract.py" "%TARGET_DIR%\core_summaries" "%TARGET_DIR%\core_summaries" %%~nxX +@REM if %ERRORLEVEL% GTR 0 goto done - echo. - ) -) +@REM echo. +@REM ) +@REM ) :: convert the avgload5period.csv -if not exist "%TARGET_DIR%\core_summaries\avgload5period.tde" ( - python "%CODE_DIR%\csvToTableauExtract.py" "%TARGET_DIR%\hwy\iter%ITER%" "%TARGET_DIR%\core_summaries" avgload5period.csv - if %ERRORLEVEL% GTR 0 goto done +@REM if not exist "%TARGET_DIR%\core_summaries\avgload5period.tde" ( +@REM python "%CODE_DIR%\csvToTableauExtract.py" "%TARGET_DIR%\hwy\iter%ITER%" "%TARGET_DIR%\core_summaries" avgload5period.csv +@REM if %ERRORLEVEL% GTR 0 goto done - echo. -) +@REM echo. +@REM ) :: create trn\trnline.csv if not exist "%TARGET_DIR%\trn\trnline.csv" ( @@ -74,18 +74,18 @@ if not exist "%TARGET_DIR%\trn\trnline.csv" ( ) :: convert the transit files -if not exist "%TARGET_DIR%\core_summaries\trnline.tde" ( - FOR %%H in (EA AM MD PM EV) DO ( - FOR %%J in (loc lrf exp hvy com) DO ( - rem walk -> transit -> walk - python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_wlk_%%J_wlk.csv - rem drive -> transit -> walk - python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_drv_%%J_wlk.csv - rem walk -> transit -> drive - python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_wlk_%%J_drv.csv - ) - ) -) +@REM if not exist "%TARGET_DIR%\core_summaries\trnline.tde" ( +@REM FOR %%H in (EA AM MD PM EV) DO ( +@REM FOR %%J in (loc lrf exp hvy com) DO ( +@REM rem walk -> transit -> walk +@REM python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_wlk_%%J_wlk.csv +@REM rem drive -> transit -> walk +@REM python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_drv_%%J_wlk.csv +@REM rem walk -> transit -> drive +@REM python "%CODE_DIR%\csvToTableauExtract.py" --header "name,mode,owner,frequency,line time,line dist,total boardings,passenger miles,passenger hours,path id" --output trnline.tde --join "%CODE_DIR%\reference-transit-modes.csv" --append "%TARGET_DIR%\trn\TransitAssignment.iter%ITER%" "%TARGET_DIR%\core_summaries" trnline%%H_wlk_%%J_drv.csv +@REM ) +@REM ) +@REM ) endlocal diff --git a/model-files/RunModel.bat b/model-files/RunModel.bat index 703a2db6b..61c81be58 100644 --- a/model-files/RunModel.bat +++ b/model-files/RunModel.bat @@ -23,6 +23,7 @@ call CTRAMP\runtime\SetPath.bat 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=192.168.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 @@ -205,7 +206,7 @@ runtpp CTRAMP\scripts\skims\NonMotorizedSkims.job if ERRORLEVEL 2 goto done :: Step 4.5: Build initial transit files -set PYTHONPATH=%USERPROFILE%\Documents\GitHub\NetworkWrangler;%USERPROFILE%\Documents\GitHub\NetworkWrangler\_static +::set PYTHONPATH=%USERPROFILE%\Documents\GitHub\NetworkWrangler;%USERPROFILE%\Documents\GitHub\NetworkWrangler\_static python CTRAMP\scripts\skims\transitDwellAccess.py NORMAL NoExtraDelay Simple complexDwell %COMPLEXMODES_DWELL% complexAccess %COMPLEXMODES_ACCESS% if ERRORLEVEL 2 goto done @@ -216,7 +217,7 @@ if ERRORLEVEL 2 goto done :: :: ------------------------------------------------------------------------------------------------------ -: iter0 +:iter0 :: Set the iteration parameters set ITER=0 @@ -234,13 +235,16 @@ set PREV_WGT=0.00 call CTRAMP\RunIteration.bat if ERRORLEVEL 2 goto done +:: called again due to python2 not getting activated in conda env... +call CTRAMP\runtime\SetPath.bat + :: ------------------------------------------------------------------------------------------------------ :: :: Step 7: Prepare for iteration 1 and execute RunIteration batch file :: :: ------------------------------------------------------------------------------------------------------ -: iter1 +:iter1 :: Set the iteration parameters set ITER=1 @@ -258,13 +262,16 @@ if ERRORLEVEL 1 goto done call CTRAMP\RunIteration.bat if ERRORLEVEL 2 goto done +:: called again due to python2 not getting activated in conda env... +call CTRAMP\runtime\SetPath.bat + :: ------------------------------------------------------------------------------------------------------ :: :: Step 8: Prepare for iteration 2 and execute RunIteration batch file :: :: ------------------------------------------------------------------------------------------------------ -: iter2 +:iter2 :: Set the iteration parameters set ITER=2 @@ -282,6 +289,8 @@ if ERRORLEVEL 1 goto done call CTRAMP\RunIteration.bat if ERRORLEVEL 2 goto done +:: called again due to python2 not getting activated in conda env... +call CTRAMP\runtime\SetPath.bat :: ------------------------------------------------------------------------------------------------------ :: @@ -307,6 +316,9 @@ if ERRORLEVEL 1 goto done call CTRAMP\RunIteration.bat if ERRORLEVEL 2 goto done +:: called again due to python2 not getting activated in conda env... +call CTRAMP\runtime\SetPath.bat + :: Shut down java C:\Windows\SysWOW64\taskkill /f /im "java.exe" @@ -374,7 +386,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 diff --git a/model-files/RunPPANetworkQAQC.bat b/model-files/RunPPANetworkQAQC.bat new file mode 100644 index 000000000..7c196c0c9 --- /dev/null +++ b/model-files/RunPPANetworkQAQC.bat @@ -0,0 +1,336 @@ +::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +:: 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 + +:: --------TrnAssignment Setup -- Fast Configuration +:: NOTE the blank ones should have a space +set TRNCONFIG=FAST +set COMPLEXMODES_DWELL= +set COMPLEXMODES_ACCESS= + +:: 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 + +:: Assign the demand matrices to the highway network +runtpp CTRAMP\scripts\assign\HwyAssign.job +if ERRORLEVEL 2 goto done + +:: ------------------------------------------------------------------------------------------------------ +:: +:: 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 goto done + +:: Create the transit networks +runtpp ..\..\CTRAMP\scripts\skims\BuildTransitNetworks.job +if ERRORLEVEL 2 goto done + + +:transitSubAssign + +:: Assign the transit trips to the transit network +runtpp ..\..\CTRAMP\scripts\assign\TransitAssign_NetworkQAQC.job +if ERRORLEVEL 2 goto done +:: And skim +runtpp ..\..\CTRAMP\scripts\skims\TransitSkims.job +if ERRORLEVEL 2 goto done + +:: 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 .. + + +:: Move assigned networks to a iteration-specific directory +mkdir hwy\iter%ITER% + +move hwy\LOADEA.net hwy\iter%ITER%\LOADEA.net +move hwy\LOADAM.net hwy\iter%ITER%\LOADAM.net +move hwy\LOADMD.net hwy\iter%ITER%\LOADMD.net +move hwy\LOADPM.net hwy\iter%ITER%\LOADPM.net +move hwy\LOADEV.net hwy\iter%ITER%\LOADEV.net + +:: Give the default TP+ variables more intuitive names +runtpp CTRAMP\scripts\feedback\RenameAssignmentVariables.job +if ERRORLEVEL 2 goto done + +:: Average the demand for this and the previous iteration and compute a speed estimate for each link +IF %ITER% GTR 1 ( + runtpp CTRAMP\scripts\feedback\AverageNetworkVolumes.job + if ERRORLEVEL 2 goto done + runtpp CTRAMP\scripts\feedback\CalculateSpeeds.job + if ERRORLEVEL 2 goto done +) ELSE ( + copy hwy\iter%ITER%\LOADEA_renamed.net hwy\iter%ITER%\avgLOADEA.net /Y + copy hwy\iter%ITER%\LOADAM_renamed.net hwy\iter%ITER%\avgLOADAM.net /Y + copy hwy\iter%ITER%\LOADMD_renamed.net hwy\iter%ITER%\avgLOADMD.net /Y + copy hwy\iter%ITER%\LOADPM_renamed.net hwy\iter%ITER%\avgLOADPM.net /Y + copy hwy\iter%ITER%\LOADEV_renamed.net hwy\iter%ITER%\avgLOADEV.net /Y +) + +:: Compute network statistics to measure convergence +runtpp CTRAMP\scripts\feedback\TestNetworkConvergence.job +if ERRORLEVEL 2 goto done + +:: Combine the time-of-day-specific networks into a single network +runtpp CTRAMP\scripts\feedback\MergeNetworks.job +if ERRORLEVEL 2 goto done + +:: Place a copy of the loaded networks into the root \hwy directory for access by the next iteration +copy hwy\iter%ITER%\avgLOADEA.net hwy\avgLOADEA.net /Y +copy hwy\iter%ITER%\avgLOADAM.net hwy\avgLOADAM.net /Y +copy hwy\iter%ITER%\avgLOADMD.net hwy\avgLOADMD.net /Y +copy hwy\iter%ITER%\avgLOADPM.net hwy\avgLOADPM.net /Y +copy hwy\iter%ITER%\avgLOADEV.net hwy\avgLOADEV.net /Y + +:: Delete temporary files +del hwy\iter%ITER%\x*.net + + +:: 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 + + +:: Close the cube cluster +Cluster "%COMMPATH%\CTRAMP" 1-48 Close Exit + +:success +ECHO FINISHED SUCCESSFULLY! + +goto donedone + +:: this is the done for errors +:done +ECHO ERRORED OUT!!. + +:donedone \ No newline at end of file diff --git a/model-files/SetUpModel.bat b/model-files/SetUpModel.bat index 32cb8e271..77278a6bc 100644 --- a/model-files/SetUpModel.bat +++ b/model-files/SetUpModel.bat @@ -8,7 +8,7 @@ SET computer_prefix=%computername:~0,4% :: copy over CTRAMP -set GITHUB_DIR=\\mainmodel\MainModelShare\travel-model-one-1.5.1.8 +set GITHUB_DIR=E:\code\TM151\travel-model-one mkdir CTRAMP\model mkdir CTRAMP\runtime mkdir CTRAMP\scripts @@ -21,6 +21,7 @@ copy /Y "%GITHUB_DIR%\model-files\RunModel.bat" . copy /Y "%GITHUB_DIR%\model-files\RunIteration.bat" CTRAMP copy /Y "%GITHUB_DIR%\model-files\RunLogsums.bat" . copy /Y "%GITHUB_DIR%\model-files\RunCoreSummaries.bat" . +copy /Y "%GITHUB_DIR%\model-files\RunPPANetworkQAQC.bat" . copy /Y "%GITHUB_DIR%\utilities\PBA40\RunMetrics.bat" . copy /Y "%GITHUB_DIR%\utilities\PBA40\RunScenarioMetrics.bat" . copy /Y "%GITHUB_DIR%\utilities\PBA40\ExtractKeyFiles.bat" . @@ -29,7 +30,7 @@ if "%COMPUTER_PREFIX%" == "WIN-" (copy "%GITHUB_DIR%\utilities\monitoring\not if "%COMPUTER_PREFIX%" == "WIN-" set HOST_IP_ADDRESS=10.0.0.33 :: copy over INPUTs from baseline -set MODEL_SETUP_BASE_DIR=M:\Application\Model One\RTP2021\ProjectPerformanceAssessment\Projects\2050_TM151_PPA_CG_11 +set MODEL_SETUP_BASE_DIR=Z:\RTP2025_PPA\Projects\2050_TM151_PPA_CG_17 c:\windows\system32\Robocopy.exe /E "%MODEL_SETUP_BASE_DIR%\INPUT\landuse" INPUT\landuse c:\windows\system32\Robocopy.exe /E "%MODEL_SETUP_BASE_DIR%\INPUT\logsums" INPUT\logsums c:\windows\system32\Robocopy.exe /E "%MODEL_SETUP_BASE_DIR%\INPUT\metrics" INPUT\metrics @@ -43,44 +44,44 @@ copy /Y "%MODEL_SETUP_BASE_DIR%\INPUT\params.properties" copy /Y "%MODEL_SETUP_BASE_DIR%\OUTPUT\main\ShadowPricing_7.csv" INPUT\logsums :: copy over project specific inputs -set MODEL_SETUP_DIR=M:\Application\Model One\RTP2021\ProjectPerformanceAssessment\Projects\2202_BART_DMU_Brentwood\2050_TM151_PPA_CG_11_666_Project +set MODEL_SETUP_DIR=Z:\RTP2025_PPA\Projects\2050_TM151_PPA_CG_17\INPUT c:\windows\system32\Robocopy.exe /E "%MODEL_SETUP_DIR%\hwy" INPUT\hwy c:\windows\system32\Robocopy.exe /E "%MODEL_SETUP_DIR%\trn" INPUT\trn :: set the location of the output folder; this is where the extractor directory will be copied to -set M_DIR=%MODEL_SETUP_DIR% +@REM set M_DIR=%MODEL_SETUP_DIR% :: copy this batch file itself to M -copy SetUpModel.bat "%M_DIR%\SetUpModel.bat" +@REM copy SetUpModel.bat "%M_DIR%\SetUpModel.bat" ::----------------------------------------------------------------------- :: add folder name to the command prompt window ::----------------------------------------------------------------------- -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 +@REM set MODEL_DIR=%CD% +@REM set PROJECT_DIR=%~p0 +@REM set PROJECT_DIR2=%PROJECT_DIR:~0,-1% +@REM :: get the base dir only +@REM for %%f in (%PROJECT_DIR2%) do set myfolder=%%~nxf -title %myfolder% +@REM title %myfolder% -::----------------------------------------------------------------------- -:: create a shortcut of the project directory using a temporary VBScript -::----------------------------------------------------------------------- +@REM ::----------------------------------------------------------------------- +@REM :: create a shortcut of the project directory using a temporary VBScript +@REM ::----------------------------------------------------------------------- -set TEMP_SCRIPT="%CD%\temp_script_to_create_shortcut.vbs" -set PROJECT_DIR=%~p0 -set ALPHABET=%computername:~7,1% +@REM set TEMP_SCRIPT="%CD%\temp_script_to_create_shortcut.vbs" +@REM set PROJECT_DIR=%~p0 +@REM set ALPHABET=%computername:~7,1% -echo Set oWS = WScript.CreateObject("WScript.Shell") >> %TEMP_SCRIPT% -echo sLinkFile = "%M_DIR%/model_run_on_%computername%.lnk" >> %TEMP_SCRIPT% -echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %TEMP_SCRIPT% -echo oLink.TargetPath = "M:" >> %TEMP_SCRIPT% -echo oLink.TargetPath = "\\%computername%\%PROJECT_DIR%" >> %TEMP_SCRIPT% +@REM echo Set oWS = WScript.CreateObject("WScript.Shell") >> %TEMP_SCRIPT% +@REM echo sLinkFile = "%M_DIR%/model_run_on_%computername%.lnk" >> %TEMP_SCRIPT% +@REM echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %TEMP_SCRIPT% +@REM echo oLink.TargetPath = "M:" >> %TEMP_SCRIPT% +@REM echo oLink.TargetPath = "\\%computername%\%PROJECT_DIR%" >> %TEMP_SCRIPT% -echo oLink.Save >> %TEMP_SCRIPT% +@REM echo oLink.Save >> %TEMP_SCRIPT% -::C:\Windows\SysWOW64\cscript.exe /nologo %TEMP_SCRIPT% -C:\Windows\SysWOW64\cscript.exe %TEMP_SCRIPT% -del %TEMP_SCRIPT% \ No newline at end of file +@REM ::C:\Windows\SysWOW64\cscript.exe /nologo %TEMP_SCRIPT% +@REM C:\Windows\SysWOW64\cscript.exe %TEMP_SCRIPT% +@REM del %TEMP_SCRIPT% \ No newline at end of file diff --git a/model-files/runtime/SetPath.bat b/model-files/runtime/SetPath.bat index ce7d64274..76a7a6531 100644 --- a/model-files/runtime/SetPath.bat +++ b/model-files/runtime/SetPath.bat @@ -2,7 +2,7 @@ :: Utility to set the path. Used in RunModel as well as RunMain and RunNodeX. :: The commpath -SET COMMPATH=X:\COMMPATH +SET COMMPATH=%CD% if "%COMPUTER_PREFIX%" == "WIN-" ( SET COMMPATH=D:\COMMPATH ) @@ -11,30 +11,40 @@ if "%COMPUTER_PREFIX%" == "WIN-" ( set JAVA_PATH=C:\Program Files\Java\jdk1.8.0_181 :: The location of the GAWK binary executable files -set GAWK_PATH=X:\UTIL\Gawk +set GAWK_PATH=E:\code\TM151\travel-model-one\utilities\gawk if "%COMPUTER_PREFIX%" == "WIN-" ( set GAWK_PATH=C:\Software\Gawk ) :: The location of R and R libraries -set R_HOME=C:\Program Files\R\R-3.5.2 -set R_LIB=C:/Users/mtcpb/Documents/R/win-library/3.5 +set R_HOME=C:\Program Files\R\R-4.3.1 +set R_LIB=C:\Users\david.hensle\AppData\Local\R\win-library\4.3 if "%COMPUTER_PREFIX%" == "WIN-" ( set R_LIB=C:/Users/Administrator/Documents/R/win-library/3.5 ) :: The location of the RUNTPP executable from Citilabs -set TPP_PATH=C:\Program Files\Citilabs\CubeVoyager;C:\Program Files\Citilabs\VoyagerFileAPI +set TPP_PATH=C:\Program Files\Citilabs\CubeVoyager;C:\Program Files\Citilabs\VoyagerAPI\Dlls\x64 :: The location of python -set PYTHON_PATH=C:\Python27 +::set PYTHON_PATH=C:\Python27 :: The location of the MTC.JAR file set RUNTIME=CTRAMP/runtime +:: The location of Anaconda; this run will use the conda environment tm15-python310 +set CONDA_PATH=C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\ProgramData\Anaconda3\bin;C:\ProgramData\Anaconda3\condabin +set ENV_NAME=tm151-python27 + :: Add these variables to the PATH environment variable, moving the current path to the back -set PATH=%RUNTIME%;%JAVA_PATH%/bin;%TPP_PATH%;%GAWK_PATH%/bin;%PYTHON_PATH% +set PATH=%RUNTIME%;%JAVA_PATH%/bin;%TPP_PATH%;%GAWK_PATH%/bin;%CONDA_PATH% :: Set the Java classpath (locations where Java needs to find configuration and JAR files) set CLASSPATH=%RUNTIME%/config;%RUNTIME%;%RUNTIME%/config/jppf-2.4/jppf-2.4-admin-ui/lib/*;%RUNTIME%/mtc.jar +:: Activate the correct conda environment -- this will update the PATH +call activate %ENV_NAME% + +:: Deactivating and re-activating seems necessary for the python 2 env to work correctly.. +call conda deactivate +call activate %ENV_NAME% \ No newline at end of file diff --git a/model-files/scripts/assign/TransitAssign_NetworkQAQC.job b/model-files/scripts/assign/TransitAssign_NetworkQAQC.job new file mode 100644 index 000000000..aa2140672 --- /dev/null +++ b/model-files/scripts/assign/TransitAssign_NetworkQAQC.job @@ -0,0 +1,326 @@ +; ---------------------------------------------------------------------------------------------------------------- +; +; TransitAssign_NetworkQAQC.job +; +; TP+ script to perform a transit assignment. This script differs from TransitAssign.job by just assigning a +; demand matrix of 0.1 for all zones. Used to QAQC network projects for PPA runs. +; +; version: Travel Model One +; authors: david.hensle@rsginc.com (Oct2023) +; +; ---------------------------------------------------------------------------------------------------------------- + +token_model_dir = '%MODEL_DIR%' + +run pgm = matrix + FILEO MATO[1] = dummy_assign_matrix.tpp, MO=1 + PAR ZONES=1454 + MW[1] = 0.1 +endrun + +; time period loop +loop period = 1, 5 + + ; initialize counter to so that no more than 18 tasks are created + counter = 0 + + ; set a list of origins to trace (comma-separated) + token_debug_origin_list = '240' + + ; set a list of destinations to trace (comma-separated) + token_debug_destination_list = '22' + + if (period = 1) + token_period = 'ea' + + elseif (period = 2) + token_period = 'am' + + elseif (period = 3) + token_period = 'md' + + elseif (period = 4) + token_period = 'pm' + + elseif (period = 5) + token_period = 'ev' + + endif + + ; access/egress loop (walk/walk, auto/walk, walk/auto) + loop accegg = 1,3 + + if (accegg = 1) + token_access = 'wlk' + token_egress = 'wlk' + token_boardpen = 'factor boardpen = 0, 20, 45, 50, 60' + elseif (accegg = 2) + token_access = 'drv' + token_egress = 'wlk' + token_boardpen = 'factor boardpen = 0, 30, 45, 50, 60' + elseif (accegg = 3) + token_access = 'wlk' + token_egress = 'drv' + token_boardpen = 'factor boardpen = 0, 30, 45, 50, 60' + endif + + ; line haul loop + loop path = 1, 5 + + ; commuter rail or long-haul premium + if (path = 1) + + ; drive access/egress links to this mode (';' means no) + ; allow higher-class PNRs to be read in case of shared lots + token_drivelinks_express_bus = ';' + token_drivelinks_light_rail = ';' + token_drivelinks_ferry = ';' + token_drivelinks_heavy_rail = ';' + token_drivelinks_commuter_rail = ' ' + + ; no KNR access links to local bus + token_bus_acclinks_KNR = ';' + + ; no transit modes are excluded from this path + token_skipmodes = '; do not skip any modes for this path' + + ; mode-specific perceived time factors + ; support loc bus exp bus ferry lt rail hvy rail com rail + token_modefac = 'modefac = 9*2.0, 70*1.5, 20*1.2, 10*1.1, 10*1.1, 10*1.1, 10*1.0' + + ; three-letter path name + token_path = 'com' + + ; heavy rail or medium-haul premium + elseif (path = 2) + + ; drive access/egress links to this mode (';' means no) + ; allow higher-class PNRs to be read in case of shared lots + token_drivelinks_express_bus = ';' + token_drivelinks_light_rail = ';' + token_drivelinks_ferry = ';' + token_drivelinks_heavy_rail = ' ' + token_drivelinks_commuter_rail = ' ' + + ; no KNR access links to local bus + token_bus_acclinks_KNR = ';' + + ; commuter rail excluded from this path + token_skipmodes = 'skipmodes = 130-139' + + ; mode-specific perceived time factors + ; support loc bus exp bus ferry lt rail hvy rail com rail + token_modefac = 'modefac = 9*2.0, 70*1.5, 20*1.2, 10*1.1, 10*1.1, 10*1.0, 10*1.5' + + ; three-letter path name + token_path = 'hvy' + + ; express bus or medium-haul basic + elseif (path = 3) + + ; drive access/egress links to this mode (';' means no) + ; allow higher-class PNRs to be read in case of shared lots + token_drivelinks_express_bus = ' ' + token_drivelinks_light_rail = ';' + token_drivelinks_ferry = ';' + token_drivelinks_heavy_rail = ' ' + token_drivelinks_commuter_rail = ' ' + + ; KNR access links to local bus + token_bus_acclinks_KNR = ';' + + ; commuter rail and heavy rail excluded from this path + token_skipmodes = 'skipmodes = 130-139,120-139' + + ; mode-specific perceived time factors + ; support loc bus exp bus ferry lt rail hvy rail com rail + token_modefac = 'modefac = 9*2.0, 70*1.5, 20*1.0, 10*1.5, 10*1.5, 10*1.5, 10*1.5' + + ; three-letter path name + token_path = 'exp' + + + ; light rail (or ferry) or short-haul premium + elseif (path = 4) + + ; drive access/egress links to this mode (';' means no) + ; allow higher-class PNRs to be read in case of shared lots + token_drivelinks_express_bus = ' ' + token_drivelinks_light_rail = ' ' + token_drivelinks_ferry = ' ' + token_drivelinks_heavy_rail = ' ' + token_drivelinks_commuter_rail = ' ' + + ; no KNR access links to local bus + token_bus_acclinks_KNR = ';' + + ; commuter rail, heavy rail, and express bus excluded from this path + token_skipmodes = 'skipmodes = 130-139,120-139,80-99' + + ; mode-specific perceived time factors + ; support loc bus exp bus ferry lt rail hvy rail com rail + token_modefac = 'modefac = 9*2.0, 70*1.5, 20*1.5, 10*1.0, 10*1.0, 10*1.5, 10*1.5' + + ; three-letter path name + token_path = 'lrf' + + ; local bus or short-haul basic + elseif (path = 5) + + ; drive access/egress links to this mode (';' means no) + ; allow higher-class PNRs to be read in case of shared lots + token_drivelinks_express_bus = ' ' + token_drivelinks_light_rail = ' ' + token_drivelinks_ferry = ' ' + token_drivelinks_heavy_rail = ' ' + token_drivelinks_commuter_rail = ' ' + + ; KNR access links to local bus + token_bus_acclinks_KNR = ' ' + + ; commuter rail, heavy rail, express bus, light rail, and ferry excluded from this path + token_skipmodes = 'skipmodes = 130-139,120-139,80-99,100-119' + + ; mode-specific perceived time factors + ; support loc bus exp bus ferry lt rail hvy rail com rail + token_modefac = 'modefac = 9*2.0, 70*1.0, 20*1.5, 10*1.5, 10*1.5, 10*1.5, 10*1.5' + + ; three-letter path name + token_path = 'loc' + + + endif + + ; increment the counter used to identify the process number + counter = counter + 1 + + ; distribute the tasks + DistributeMultistep processid = "ctramp", processnum = @counter@, commpath = '%COMMPATH%' + + run pgm = trnbuild + + ; use the highway network with the computed bus times + filei neti = @token_period@_transit_background.net + + ; read in the 23-table matrix created by prepAssign.job (see header for content details) + ; Not reading for network QAQC + ; filei mati = "@token_model_dir@\main\trips@token_period@.tpp" + filei mati = "dummy_assign_matrix.tpp" + + ; path parameter: do not list (write out) all of the subsequent input + parameters listinput = no + + ; read in the fare matrices + read file = "@token_model_dir@\trn\transit_faremat.block" + read file = "@token_model_dir@\trn\farelinks.far" + read file = "@token_model_dir@\trn\xfare.far" + + ; output the link volumes + fileo linko = trnlink@token_period@_@token_access@_@token_path@_@token_egress@.dbf + fileo linkvolo = trnlink@token_period@_@token_access@_@token_path@_@token_egress@.csv, format = csv + + ; output the line volumes + fileo linevolo = trnline@token_period@_@token_access@_@token_path@_@token_egress@.csv, + id = @token_period@_@token_access@_@token_path@_@token_egress@, format = csv + + ; the bus times are based on those computed in the highway network + hwytime = BUS_TIME + + + ; read the transit line and link files + read file = "@token_model_dir@\trn\transitLines.link" + read file = transit@token_period@.lin + + ; read in the generated support links + read file = @token_period@_transit_suplinks_walk.dat + + ; read in the generated drive access/egress links for this mode + @token_drivelinks_express_bus@ read file = @token_period@_transit_suplinks_express_bus.dat + @token_drivelinks_light_rail@ read file = @token_period@_transit_suplinks_light_rail.dat + @token_drivelinks_ferry@ read file = @token_period@_transit_suplinks_ferry.dat + @token_drivelinks_heavy_rail@ read file = @token_period@_transit_suplinks_heavy_rail.dat + @token_drivelinks_commuter_rail@ read file = @token_period@_transit_suplinks_commuter_rail.dat + + ; read in the generated KNR links for local bus + @token_bus_acclinks_KNR@ READ FILE = @token_period@_bus_acclinks_KNR.DAT + + ; set the service headways + freqperiod = @period@ + + ; we do not need access links built + zoneaccess generate = no + + ; path parameter: 0 - best path by mode; 1 - single best path + parameters pathstyle = 0 + + ; path parameter: we want to build paths + parameters buildpaths = t + + ; path parameter: assumed walking speed is 3.0 miles per hour + parameters walkspeed = 3.0 + + + ; path parameter: we do not use the route time coded in the line files; bus times are a function of highway times + parameters useruntime = n + + ; path parameter: the maximum path time for a single route is 3 hours or 180 minutes + parameters maxruntime = 180 + + ; path parameter: the maximum perceived path time for a single route is 5 hours or 300 minutes + parameters maxpathtime = 300 + + ; perceived time factors: first boarding is free; second, third, and fourth boarding adds fiftenn perceived minutes; + ; discourage more than four transfers with a 60 minute penalty + @token_boardpen@ + + ; perceived time factors: initial wait time is equivalent to 2.8 minutes of ride time for modes 10 through 255 + factor iwaitfac = 9*0, 130*2.8 + + ; perceived time factors: transfer wait time is equivalent to 2.8 minutes of ride time for modes 1 through 255 + factor xwaitfac = 139*2.8 + + ; use token_skipmodes to remove modes from the network per the hierarchy + @token_skipmodes@ + + ; perceived time factors: slow down non-key modes by 50 percent; walk and drive by 100 percent; use token_modefac + @token_modefac@ + + ; combine paths if runtimes differ by less than 5 minutes + read file = "@token_model_dir@\ctramp\scripts\block\transit_combined_headways.block" + + ; read in the transfer prohibitors file + read file = "@token_model_dir@\ctramp\scripts\block\transferprohibitors_@token_access@_trn_@token_egress@.block" + + ; assigning a "ones" matrix for transit assignment testing + ; mw[1] = .1 + trips matrix = mi.1.1, assign = true + + ; specify which paths to trace + trace = (i = @token_debug_origin_list@ && j = @token_debug_destination_list@) + + endrun + + enddistributemultistep + + endloop ; line haul loop + + endloop ; access/egress mode loop + + wait4files files = ctramp1.script.end, + ctramp2.script.end, + ctramp3.script.end, + ctramp4.script.end, + ctramp5.script.end, + ctramp6.script.end, + ctramp7.script.end, + ctramp8.script.end, + ctramp9.script.end, + ctramp10.script.end, + ctramp11.script.end, + ctramp12.script.end, + ctramp13.script.end, + ctramp14.script.end, + ctramp15.script.end, + printfiles = save, DelDistribFiles = t, CheckReturnCode = t + +endloop ; time of day diff --git a/model-files/scripts/block/SpeedCapacity_1hour.block b/model-files/scripts/block/SpeedCapacity_1hour.block index fe4dfda66..b8efcb502 100644 --- a/model-files/scripts/block/SpeedCapacity_1hour.block +++ b/model-files/scripts/block/SpeedCapacity_1hour.block @@ -4,6 +4,7 @@ SPDCAP CAPACITY[21] = 1950, 2100, 1600, 700, 1550, 0, 1000, 2200, 2200, 1700 SPDCAP CAPACITY[31] = 1950, 2100, 1600, 700, 1550, 0, 1000, 2200, 1950, 1000 SPDCAP CAPACITY[41] = 2000, 2150, 1650, 900, 1550, 0, 1050, 2250, 2000, 1050 SPDCAP CAPACITY[51] = 2000, 2150, 1650, 950, 1550, 0, 1050, 2250, 2050, 1100 +SPDCAP CAPACITY[61] = 2000, 2150 SPDCAP SPEED[01] = 40, 55, 40, 10, 30, 18, 20, 55, 55, 40 SPDCAP SPEED[11] = 40, 55, 40, 15, 30, 18, 25, 55, 60, 45 @@ -11,6 +12,6 @@ SPDCAP SPEED[21] = 45, 60, 45, 20, 35, 18, 30, 60, 65, 55 SPDCAP SPEED[31] = 45, 60, 45, 25, 35, 18, 30, 60, 50, 25 SPDCAP SPEED[41] = 50, 65, 50, 30, 40, 18, 35, 65, 45, 30 SPDCAP SPEED[51] = 50, 65, 55, 35, 40, 18, 40, 65, 50, 40 -SPDCAP SPEED[61] = 0, 0, 0 +SPDCAP SPEED[61] = 50, 75 -REPORT SPEED = YES CAPACITY = YES ;report speed/capacity tables in network +REPORT SPEED = YES CAPACITY = YES ;report speed/capacity tables in network \ No newline at end of file diff --git a/model-files/scripts/preprocess/RuntimeConfiguration.py b/model-files/scripts/preprocess/RuntimeConfiguration.py index 390d14f2a..4a17cf03a 100644 --- a/model-files/scripts/preprocess/RuntimeConfiguration.py +++ b/model-files/scripts/preprocess/RuntimeConfiguration.py @@ -545,7 +545,7 @@ def config_distribution(replacements): shutil.copy2(os.path.join("CTRAMP","scripts","block","HwyIntraStep_64.block"), os.path.join("CTRAMP","scripts","block","HwyIntraStep.block")) - elif hostname in ['MODEL2-A','MODEL2-B','MODEL2-C','MODEL2-D','PORMDLPPW01','PORMDLPPW02'] or hostname.startswith("WIN-"): + elif hostname in ['MODEL2-A','MODEL2-B','MODEL2-C','MODEL2-D','PORMDLPPW01','PORMDLPPW02'] or hostname.startswith("WIN-") or hostname.startswith("azmdl"): # accessibilities: 48 logical processors filepath = os.path.join("CTRAMP","runtime","accessibilities.properties") replacements[filepath]["(\nnum.acc.threads[ \t]*=[ \t]*)(\S*)"] = r"\g<1>48" @@ -589,7 +589,7 @@ def config_distribution(replacements): shutil.copy2(os.path.join("CTRAMP","scripts","block","HwyIntraStep_64.block"), os.path.join("CTRAMP","scripts","block","HwyIntraStep.block")) - elif hostname in ['MODEL2-A','MODEL2-B','MODEL2-C','MODEL2-D','PORMDLPPW01','PORMDLPPW02'] or hostname.startswith("WIN-"): + elif hostname in ['MODEL2-A','MODEL2-B','MODEL2-C','MODEL2-D','PORMDLPPW01','PORMDLPPW02'] or hostname.startswith("WIN-") or hostname.startswith("azmdl"): # accessibilities: 48 logical processors filepath = os.path.join("CTRAMP","runtime","accessibilities.properties") replacements[filepath]["(\nnum.acc.threads[ \t]*=[ \t]*)(\S*)"] = r"\g<1>48" diff --git a/tm151-python27.yml b/tm151-python27.yml new file mode 100644 index 000000000..99f29b7dd Binary files /dev/null and b/tm151-python27.yml differ diff --git a/utilities/PBA40/ExtractKeyFiles.bat b/utilities/PBA40/ExtractKeyFiles.bat index d4f6fb718..0a23840b6 100644 --- a/utilities/PBA40/ExtractKeyFiles.bat +++ b/utilities/PBA40/ExtractKeyFiles.bat @@ -6,121 +6,121 @@ :: :: lmz - Create version for PBAU (Plan Bay Area Update) :: -:: This just pulls output into extractor\ +:: This just pulls output into OUTPUT\ :: :: See also CopyFilesToM.bat, which is meant to run afterwards ::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -echo STARTED EXTRACTOR RUN %DATE% %TIME% >> logs\feedback.rpt +echo STARTED OUTPUT RUN %DATE% %TIME% >> logs\feedback.rpt :: Create the needed directories -mkdir extractor +mkdir OUTPUT :: Assume this is set already :: set ITER=3 :: Highway assignment results -copy hwy\iter%ITER%\avgload5period.net extractor\avgload5period.net -copy hwy\iter%ITER%\avgload5period.csv extractor\avgload5period.csv -copy hwy\iter%ITER%\avgload5period_vehclasses.csv extractor\avgload5period_vehclasses.csv +copy hwy\iter%ITER%\avgload5period.net OUTPUT\avgload5period.net +copy hwy\iter%ITER%\avgload5period.csv OUTPUT\avgload5period.csv +copy hwy\iter%ITER%\avgload5period_vehclasses.csv OUTPUT\avgload5period_vehclasses.csv :: Transit assignment results -mkdir extractor\trn -copy trn\TransitAssignment.iter3\trnline*.csv extractor\trn -copy trn\trnlink*.dbf extractor\trn -copy trn\trnlink.csv extractor\trn -copy trn\trnline.csv extractor\trn -copy trn\quickboards.xls extractor\trn +mkdir OUTPUT\trn +copy trn\TransitAssignment.iter3\trnline*.csv OUTPUT\trn +copy trn\trnlink*.dbf OUTPUT\trn +copy trn\trnlink.csv OUTPUT\trn +copy trn\trnline.csv OUTPUT\trn +copy trn\quickboards.xls OUTPUT\trn :: Demand results -copy main\householdData_%ITER%.csv extractor\main\householdData_%ITER%.csv -copy main\personData_%ITER%.csv extractor\main\personData_%ITER%.csv -copy main\indivTripData_%ITER%.csv extractor\main\indivTripData_%ITER%.csv -copy main\indivTourData_%ITER%.csv extractor\main\indivTourData_%ITER%.csv -copy main\jointTripData_%ITER%.csv extractor\main\jointTripData_%ITER%.csv -copy main\jointTourData_%ITER%.csv extractor\main\jointTourData_%ITER%.csv -copy main\wsLocResults_%ITER%.csv extractor\main\wsLocResults_%ITER%.csv +copy main\householdData_%ITER%.csv OUTPUT\main\householdData_%ITER%.csv +copy main\personData_%ITER%.csv OUTPUT\main\personData_%ITER%.csv +copy main\indivTripData_%ITER%.csv OUTPUT\main\indivTripData_%ITER%.csv +copy main\indivTourData_%ITER%.csv OUTPUT\main\indivTourData_%ITER%.csv +copy main\jointTripData_%ITER%.csv OUTPUT\main\jointTripData_%ITER%.csv +copy main\jointTourData_%ITER%.csv OUTPUT\main\jointTourData_%ITER%.csv +copy main\wsLocResults_%ITER%.csv OUTPUT\main\wsLocResults_%ITER%.csv :: Report results -copy logs\HwySkims.debug extractor\HwySkims.debug -copy logs\feedback.rpt extractor\feedback.rpt -copy logs\SpeedErrors.log extractor\SpeedErrors.log +copy logs\HwySkims.debug OUTPUT\HwySkims.debug +copy logs\feedback.rpt OUTPUT\feedback.rpt +copy logs\SpeedErrors.log OUTPUT\SpeedErrors.log :: Skim databases -:: mkdir extractor\skimDB -:: copy database\*.csv extractor\skimDB\*.csv +:: mkdir OUTPUT\skimDB +:: copy database\*.csv OUTPUT\skimDB\*.csv :: Trip tables -mkdir extractor\main -copy main\tripsEA.tpp extractor\main -copy main\tripsAM.tpp extractor\main -copy main\tripsMD.tpp extractor\main -copy main\tripsPM.tpp extractor\main -copy main\tripsEV.tpp extractor\main -copy main\ShadowPricing_7.csv extractor\main - -mkdir extractor\nonres -copy nonres\ixDaily2015.tpp extractor\nonres -copy nonres\ixDailyx4.tpp extractor\nonres - -:: copy skims\hwyskmEA.tpp extractor\emfac\hwyskmEA.tpp -:: copy skims\hwyskmAM.tpp extractor\emfac\hwyskmAM.tpp -:: copy skims\hwyskmMD.tpp extractor\emfac\hwyskmMD.tpp -:: copy skims\hwyskmPM.tpp extractor\emfac\hwyskmPM.tpp -:: copy skims\hwyskmEV.tpp extractor\emfac\hwyskmEV.tpp - -:: copy skims\com_hwyskimEA.tpp extractor\emfac\com_hwyskimEA.tpp -:: copy skims\com_hwyskimAM.tpp extractor\emfac\com_hwyskimAM.tpp -:: copy skims\com_hwyskimMD.tpp extractor\emfac\com_hwyskimMD.tpp -:: copy skims\com_hwyskimPM.tpp extractor\emfac\com_hwyskimPM.tpp -:: copy skims\com_hwyskimEV.tpp extractor\emfac\com_hwyskimEV.tpp - -:: copy nonres\tripsTrkEA.tpp extractor\emfac\tripsTrkEA.tpp -:: copy nonres\tripsTrkAM.tpp extractor\emfac\tripsTrkAM.tpp -:: copy nonres\tripsTrkMD.tpp extractor\emfac\tripsTrkMD.tpp -:: copy nonres\tripsTrkPM.tpp extractor\emfac\tripsTrkPM.tpp -:: copy nonres\tripsTrkEV.tpp extractor\emfac\tripsTrkEV.tpp +mkdir OUTPUT\main +copy main\tripsEA.tpp OUTPUT\main +copy main\tripsAM.tpp OUTPUT\main +copy main\tripsMD.tpp OUTPUT\main +copy main\tripsPM.tpp OUTPUT\main +copy main\tripsEV.tpp OUTPUT\main +copy main\ShadowPricing_7.csv OUTPUT\main + +mkdir OUTPUT\nonres +copy nonres\ixDaily2015.tpp OUTPUT\nonres +copy nonres\ixDailyx4.tpp OUTPUT\nonres + +:: copy skims\hwyskmEA.tpp OUTPUT\emfac\hwyskmEA.tpp +:: copy skims\hwyskmAM.tpp OUTPUT\emfac\hwyskmAM.tpp +:: copy skims\hwyskmMD.tpp OUTPUT\emfac\hwyskmMD.tpp +:: copy skims\hwyskmPM.tpp OUTPUT\emfac\hwyskmPM.tpp +:: copy skims\hwyskmEV.tpp OUTPUT\emfac\hwyskmEV.tpp + +:: copy skims\com_hwyskimEA.tpp OUTPUT\emfac\com_hwyskimEA.tpp +:: copy skims\com_hwyskimAM.tpp OUTPUT\emfac\com_hwyskimAM.tpp +:: copy skims\com_hwyskimMD.tpp OUTPUT\emfac\com_hwyskimMD.tpp +:: copy skims\com_hwyskimPM.tpp OUTPUT\emfac\com_hwyskimPM.tpp +:: copy skims\com_hwyskimEV.tpp OUTPUT\emfac\com_hwyskimEV.tpp + +:: copy nonres\tripsTrkEA.tpp OUTPUT\emfac\tripsTrkEA.tpp +:: copy nonres\tripsTrkAM.tpp OUTPUT\emfac\tripsTrkAM.tpp +:: copy nonres\tripsTrkMD.tpp OUTPUT\emfac\tripsTrkMD.tpp +:: copy nonres\tripsTrkPM.tpp OUTPUT\emfac\tripsTrkPM.tpp +:: copy nonres\tripsTrkEV.tpp OUTPUT\emfac\tripsTrkEV.tpp :: Save the control file -copy CTRAMP\runtime\mtcTourBased.properties extractor\mtcTourBased.properties -copy CTRAMP\runtime\mtcTourBased.properties extractor\logsums.properties +copy CTRAMP\runtime\mtcTourBased.properties OUTPUT\mtcTourBased.properties +copy CTRAMP\runtime\mtcTourBased.properties OUTPUT\logsums.properties :: Accessibility files -mkdir extractor\accessibilities -copy accessibilities\nonMandatoryAccessibilities.csv extractor\accessibilities -copy accessibilities\mandatoryAccessibilities.csv extractor\accessibilities -copy skims\accessibility.csv extractor\accessibilities +mkdir OUTPUT\accessibilities +copy accessibilities\nonMandatoryAccessibilities.csv OUTPUT\accessibilities +copy accessibilities\mandatoryAccessibilities.csv OUTPUT\accessibilities +copy skims\accessibility.csv OUTPUT\accessibilities :: Accessibility files - model results -mkdir extractor\logsums -copy logsums\householdData_%ITER%.csv extractor\logsums -copy logsums\personData_%ITER%.csv extractor\logsums -copy logsums\indivTripData_%ITER%.csv extractor\logsums -copy logsums\indivTourData_%ITER%.csv extractor\logsums -copy logsums\wsLocResults_%ITER%.csv extractor\logsums +mkdir OUTPUT\logsums +copy logsums\householdData_%ITER%.csv OUTPUT\logsums +copy logsums\personData_%ITER%.csv OUTPUT\logsums +copy logsums\indivTripData_%ITER%.csv OUTPUT\logsums +copy logsums\indivTourData_%ITER%.csv OUTPUT\logsums +copy logsums\wsLocResults_%ITER%.csv OUTPUT\logsums :: summaries from logsumJoiner -copy logsums\shopDCLogsum.csv extractor\logsums -copy logsums\tour_shopDCLogsum.csv extractor\logsums -copy logsums\workDCLogsum.csv extractor\logsums -copy logsums\person_workDCLogsum.csv extractor\logsums -copy logsums\mandatoryAccessibilities.csv extractor\logsums -copy logsums\nonMandatoryAccessibilities.csv extractor\logsums +copy logsums\shopDCLogsum.csv OUTPUT\logsums +copy logsums\tour_shopDCLogsum.csv OUTPUT\logsums +copy logsums\workDCLogsum.csv OUTPUT\logsums +copy logsums\person_workDCLogsum.csv OUTPUT\logsums +copy logsums\mandatoryAccessibilities.csv OUTPUT\logsums +copy logsums\nonMandatoryAccessibilities.csv OUTPUT\logsums :: Core summaries -mkdir extractor\core_summaries -copy core_summaries\*.* extractor\core_summaries -mkdir extractor\updated_output -copy updated_output\*.* extractor\updated_output +mkdir OUTPUT\core_summaries +copy core_summaries\*.* OUTPUT\core_summaries +mkdir OUTPUT\updated_output +copy updated_output\*.* OUTPUT\updated_output :: metrics -mkdir extractor\metrics -copy metrics extractor\metrics +mkdir OUTPUT\metrics +copy metrics OUTPUT\metrics if exist metrics\ITHIM ( - mkdir extractor\metrics\ITHIM - copy metrics\ITHIM\*.* extractor\metrics\ITHIM + mkdir OUTPUT\metrics\ITHIM + copy metrics\ITHIM\*.* OUTPUT\metrics\ITHIM ) :success -echo ExtractKeyFiles into extractor for PBAU Complete -echo ENDED EXTRACTOR RUN %DATE% %TIME% >> logs\feedback.rpt +echo ExtractKeyFiles into OUTPUT for PBAU Complete +echo ENDED OUTPUT RUN %DATE% %TIME% >> logs\feedback.rpt :done \ No newline at end of file diff --git a/utilities/PBA40/RunMetrics.bat b/utilities/PBA40/RunMetrics.bat index 21571ca8d..25eb74a1b 100644 --- a/utilities/PBA40/RunMetrics.bat +++ b/utilities/PBA40/RunMetrics.bat @@ -171,10 +171,21 @@ if not exist metrics\transit_boards_miles.csv ( rem Input: trn\quickboards.xls rem Output: metrics\transit_board_miles.csv call python "%CODE_DIR%\transit.py" trn\quickboards.xls + IF ERRORLEVEL 2 goto error +) + +if not exist metrics\transit_crowding.csv ( + rem Summarize quickboards output to pull daily boardings and passenger miles + rem Input: trn\quickboards.xls + rem Output: metrics\transit_board_miles.csv + call python "%CODE_DIR%\transitcrowding.py" "%CD%" + IF ERRORLEVEL 2 goto error ) -if not exist "%ALL_PROJECT_METRICS_DIR%" (mkdir "%ALL_PROJECT_METRICS_DIR%") -python "%CODE_DIR%\RunResults.py" metrics "%ALL_PROJECT_METRICS_DIR%" +:: if not exist "%ALL_PROJECT_METRICS_DIR%" (mkdir "%ALL_PROJECT_METRICS_DIR%") +:: all project metrics dir set as default value in RunResults.py, can optionally pass with --all_projects_dir +python "%CODE_DIR%\RunResults.py" "%CD%" +IF ERRORLEVEL 2 goto error :cleanup move *.PRN logs diff --git a/utilities/PBA40/metrics/RunResults.py b/utilities/PBA40/metrics/RunResults.py index 79030f1b1..ba7489276 100644 --- a/utilities/PBA40/metrics/RunResults.py +++ b/utilities/PBA40/metrics/RunResults.py @@ -46,7 +46,7 @@ class RunResults: REQUIRED_KEYS = [ 'Project ID' , # String identifier for the project 'Project Name', # Descriptive name for the project - 'County' , # County where the project is located + # 'County' , # County where the project is located 'Project Type', # Categorization of the project 'Project Mode', # Road or transit submode. Used for Out-of-vehicle Transit Travel Time adjustments 'Future' , # Future scenario to run the project @@ -126,7 +126,7 @@ class RunResults: - def __init__(self, rundir, overwrite_config=None): + def __init__(self, rundir, overwrite_config=None, find_base_in_Z_drive=False): """ Parameters ---------- @@ -138,24 +138,33 @@ def __init__(self, rundir, overwrite_config=None): Read configuration and input data. """ - self.ppa_master_input = "L:\\RTP2021_PPA\\Projects\\PPAMasterInput.xlsx" + self.ppa_master_input = "Z:\\RTP2025_PPA\\Projects\\PPAMasterInput.xlsx" # read the configs - self.rundir = os.path.join(os.path.abspath(rundir), 'OUTPUT', 'metrics') + # self.rundir = os.path.join(os.path.abspath(rundir), 'OUTPUT', 'metrics') + self.rundir = os.path.abspath('metrics') # if this is a baseline run, then read from configs_base sheet of master input file # else this is a project run, then read from configs_projects sheet of master input file #if 'CaltrainMod_00' not in rundir: #for RTFF + print("rundir:", rundir) if len(rundir) > 22: configs_df = pd.read_excel(self.ppa_master_input, sheet_name='configs_projects', header=0) configs_df = configs_df.drop(['Base Model', 'Base ID', 'Future Run', 'Iteration', 'Full Name'], axis=1) configs_df.insert(0,'Folder','') - configs_df['Folder'] = configs_df[['Foldername - Project', 'Foldername - Future']].apply(lambda x: '\\'.join(x), axis=1) + # configs_df['Folder'] = configs_df[['Foldername - Project', 'Foldername - Future']].apply(lambda x: '\\'.join(x), axis=1) + configs_df['Folder'] = configs_df['Foldername - Future'] configs_df.drop(['Foldername - Project', 'Foldername - Future'], axis=1) else: configs_df = pd.read_excel(self.ppa_master_input, sheet_name='configs_base', header=0) + if find_base_in_Z_drive: + self.rundir = os.path.join('Z:\\RTP2025_PPA\\Projects', rundir, 'OUTPUT', 'metrics') + + print("self.rundir:", self.rundir) + configs_df = configs_df.T configs_df.columns = configs_df.iloc[0] configs_df = configs_df[1:] + # print("cols:", configs_df.columns) self.config = configs_df[[rundir]].iloc[:,0] self.config['Project Run Dir'] = self.rundir @@ -217,44 +226,44 @@ def __init__(self, rundir, overwrite_config=None): print("") # read the csvs self.auto_times = \ - pd.read_table(os.path.join(self.rundir, "auto_times.csv"), + pd.read_csv(os.path.join(self.rundir, "auto_times.csv"), sep=",", index_col=[0,1]) # print self.auto_times self.autos_owned = \ - pd.read_table(os.path.join(self.rundir, "autos_owned.csv"), + pd.read_csv(os.path.join(self.rundir, "autos_owned.csv"), sep=",") self.autos_owned['total autos'] = self.autos_owned['households']*self.autos_owned['autos'] self.autos_owned.set_index(['incQ','autos'],inplace=True) # print self.autos_owned self.parking_costs = \ - pd.read_table(os.path.join(self.rundir, "parking_costs.csv"), + pd.read_csv(os.path.join(self.rundir, "parking_costs.csv"), sep=",") # print self.parking_costs.head() self.vmt_vht_metrics = \ - pd.read_table(os.path.join(self.rundir, "vmt_vht_metrics.csv"), + pd.read_csv(os.path.join(self.rundir, "vmt_vht_metrics.csv"), sep=",", index_col=[0,1]) # print self.vmt_vht_metrics self.nonmot_times = \ - pd.read_table(os.path.join(self.rundir, "nonmot_times.csv"), + pd.read_csv(os.path.join(self.rundir, "nonmot_times.csv"), sep=",", index_col=[0,1,2]) # print self.nonmot_times self.transit_boards_miles = \ - pd.read_table(os.path.join(self.rundir, "transit_boards_miles.csv"), + pd.read_csv(os.path.join(self.rundir, "transit_boards_miles.csv"), sep=",", index_col=0) # print self.transit_boards_miles self.transit_times_by_acc_mode_egr = \ - pd.read_table(os.path.join(self.rundir, "transit_times_by_acc_mode_egr.csv"), + pd.read_csv(os.path.join(self.rundir, "transit_times_by_acc_mode_egr.csv"), sep=",", index_col=[0,1,2,3]) # print self.transit_times_by_acc_mode_egr self.transit_times_by_mode_income = \ - pd.read_table(os.path.join(self.rundir, "transit_times_by_mode_income.csv"), + pd.read_csv(os.path.join(self.rundir, "transit_times_by_mode_income.csv"), sep=",", index_col=[0,1]) # print self.transit_times_by_mode_income @@ -317,15 +326,15 @@ def __init__(self, rundir, overwrite_config=None): # on M roadway_netfile = os.path.abspath(os.path.join(self.rundir, "..", "avgload5period_vehclasses.csv")) if os.path.exists(roadway_netfile): - self.roadways_df = pd.read_table(roadway_netfile, sep=",") + self.roadways_df = pd.read_csv(roadway_netfile, sep=",") #print "Read roadways from %s" % roadway_netfile roadway_read = True # on model machine for reading baseline if not roadway_read: - roadway_netfile = os.path.abspath(os.path.join(self.rundir, "..", "extractor", "avgload5period_vehclasses.csv")) + roadway_netfile = os.path.abspath(os.path.join(self.rundir, "..", "OUTPUT", "avgload5period_vehclasses.csv")) if os.path.exists(roadway_netfile): - self.roadways_df = pd.read_table(roadway_netfile, sep=",") + self.roadways_df = pd.read_csv(roadway_netfile, sep=",") print "Read roadways from %s" % roadway_netfile roadway_read = True @@ -337,7 +346,7 @@ def __init__(self, rundir, overwrite_config=None): sys.exit(2) roadway_netfile = os.path.abspath(os.path.join(self.rundir, "..", "hwy", "iter%s" % os.environ['ITER'], "avgload5period_vehclasses.csv")) - self.roadways_df = pd.read_table(roadway_netfile, sep=",") + self.roadways_df = pd.read_csv(roadway_netfile, sep=",") print "Read roadways from %s" % roadway_netfile roadway_read = True @@ -355,7 +364,7 @@ def __init__(self, rundir, overwrite_config=None): for filename in ['mandatoryAccessibilities', 'nonMandatoryAccessibilities']: accessibilities = \ - pd.read_table(os.path.join(self.rundir, "..", "logsums", "%s.csv" % filename), + pd.read_csv(os.path.join(self.rundir, "..", "logsums", "%s.csv" % filename), sep=",") accessibilities.drop('destChoiceAlt', axis=1, inplace=True) accessibilities.set_index(['taz','subzone'], inplace=True) @@ -383,7 +392,7 @@ def __init__(self, rundir, overwrite_config=None): self.nonmandatoryAccessibilities = accessibilities self.accessibilityMarkets = \ - pd.read_table(os.path.join(self.rundir, "..", "core_summaries", "AccessibilityMarkets.csv"), + pd.read_csv(os.path.join(self.rundir, "..", "core_summaries", "AccessibilityMarkets.csv"), sep=",") self.accessibilityMarkets.rename(columns={'num_persons':'%s_num_persons' % col_prefix, @@ -416,7 +425,8 @@ def createBaseRunResults(self): print self.base_dir #print base_overwrite_config self.base_results = RunResults(rundir = self.base_dir, - overwrite_config=base_overwrite_config) + overwrite_config=base_overwrite_config, + find_base_in_Z_drive=True) def updateDailyMetrics(self): """ @@ -682,7 +692,7 @@ def calculateConsumerSurplus(config, daily_results, # copy Tableau template into the project folder for mapping cs_tableau_filename = os.path.join(debug_dir, "consumer_surplus_{}.twb".format(config['Foldername - Future'])) - cs_tableau_template="\\\\mainmodel\\MainModelShare\\travel-model-one-master\\utilities\\PBA40\\metrics\\consumer_surplus.twb" + cs_tableau_template="Z:\\RTP2025_PPA\\code\\TM151\\travel-model-one\\utilities\\PBA40\\metrics\\consumer_surplus.twb" copyfile(cs_tableau_template, cs_tableau_filename) print("Copied file to {}".format(cs_tableau_filename)) @@ -1557,11 +1567,14 @@ def calculateBenefitCosts(self, project_dir, all_projects_dir): ################################################# self.bc_metrics.name = 'values' - all_proj_filename = os.path.join(os.getcwd(), all_projects_dir, csv_name) + all_proj_filename = os.path.join(all_projects_dir, csv_name) self.bc_metrics.to_csv(all_proj_filename, header=True, float_format='%.5f') - print("Wrote the bc metrics csv %s" % csv_name) + print("Wrote the bc metrics csv %s" % all_proj_filename) + self.bc_metrics.to_csv(os.path.join(os.getcwd(), "metrics", csv_name), header=True, float_format='%.5f') + print("Wrote the bc metrics csv %s" % os.path.join(os.getcwd(), "metrics", csv_name)) - copyfile(BC_detail_workbook, os.path.join(project_folder_name,"..","..","all_projects_bc_workbooks", workbook_name)) + # copyfile(BC_detail_workbook, os.path.join(project_folder_name,"..","..","all_projects_bc_workbooks", workbook_name)) + copyfile(BC_detail_workbook, os.path.join(all_projects_dir, workbook_name)) print("Copied BC workbook into all_projects_bc_workbooks directory") @@ -2576,11 +2589,15 @@ def writeCostsWorksheet(self, workbook, bc_metrics, scen_minus_baseline=True): parser = argparse.ArgumentParser(usage=USAGE) parser.add_argument('project_dir', help="The directory with the run results csvs.") - parser.add_argument('all_projects_dir', - help="The directory in which to write the Benefit/Cost summary Series") + parser.add_argument('--all_projects_dir', + help="The directory in which to write the Benefit/Cost summary Series", + default="Z:\\RTP2025_PPA\\Projects\\all_project_metrics") args = parser.parse_args(sys.argv[1:]) - rr = RunResults(args.project_dir) + project_dir = os.path.basename(args.project_dir) + + # rr = RunResults(args.project_dir) + rr = RunResults(project_dir) rr.createBaseRunResults() rr.calculateDailyMetrics() @@ -2589,13 +2606,18 @@ def writeCostsWorksheet(self, workbook, bc_metrics, scen_minus_baseline=True): rr.base_results.calculateDailyMetrics() rr.updateDailyMetrics() - # save the quick summary + # save the quick summary locally and to all_project_dir + assert os.path.exists(args.all_projects_dir), "Cannot find output directory %s" % args.all_projects_dir if rr.base_dir: - quicksummary_csv = os.path.join(os.getcwd(),args.all_projects_dir, "quicksummary_%s_base%s.csv" % (rr.config.loc['Project ID'], rr.config.loc['base_dir'])) + quicksummary_csv = os.path.join(args.all_projects_dir, "quicksummary_%s_base%s.csv" % (rr.config.loc['Project ID'], rr.config.loc['base_dir'])) + rr.quick_summary.to_csv(quicksummary_csv, float_format='%.5f', header=False) + quicksummary_csv = os.path.join(os.getcwd(), "metrics", "quicksummary_%s_base%s.csv" % (rr.config.loc['Project ID'], rr.config.loc['base_dir'])) + rr.quick_summary.to_csv(quicksummary_csv, float_format='%.5f', header=False) else: - quicksummary_csv = os.path.join(os.getcwd(),args.all_projects_dir, "quicksummary_base%s.csv" % rr.config.loc['Project ID']) + quicksummary_csv = os.path.join(args.all_projects_dir, "quicksummary_base%s.csv" % rr.config.loc['Project ID']) + rr.quick_summary.to_csv(quicksummary_csv, float_format='%.5f', header=False) + quicksummary_csv = os.path.join(os.getcwd(), "metrics", "quicksummary_base%s.csv" % rr.config.loc['Project ID']) + rr.quick_summary.to_csv(quicksummary_csv, float_format='%.5f', header=False) - rr.quick_summary.to_csv(quicksummary_csv, float_format='%.5f') - #print rr.quick_summary rr.calculateBenefitCosts(args.project_dir, args.all_projects_dir) diff --git a/utilities/PBA40/metrics/transitcrowding.py b/utilities/PBA40/metrics/transitcrowding.py index 3f9e30d35..bfd8031b8 100644 --- a/utilities/PBA40/metrics/transitcrowding.py +++ b/utilities/PBA40/metrics/transitcrowding.py @@ -236,7 +236,8 @@ def move_pseudo_line_ridership(trn_link_df, pseudo_lines): ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')) logger.addHandler(ch) # file handler - fh = logging.FileHandler(os.path.join(my_args.project_dir, "OUTPUT", "metrics", LOG_FILE), mode='w') + # fh = logging.FileHandler(os.path.join(my_args.project_dir, "OUTPUT", "metrics", LOG_FILE), mode='w') + fh = logging.FileHandler(os.path.join(my_args.project_dir, "metrics", LOG_FILE), mode='w') fh.setLevel(logging.DEBUG) fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')) logger.addHandler(fh) @@ -244,7 +245,8 @@ def move_pseudo_line_ridership(trn_link_df, pseudo_lines): logging.info("Args: {}".format(my_args)) # import seat capacities from lookup file - seatcap_file = "\\\\mainmodel\\MainModelShare\\travel-model-one-master\\utilities\\PBA40\\metrics\\transitSeatCap.csv" + # seatcap_file = "\\\\mainmodel\\MainModelShare\\travel-model-one-master\\utilities\\PBA40\\metrics\\transitSeatCap.csv" + seatcap_file = os.path.join(os.getcwd(), "CTRAMP", "scripts", "metrics", "transitSeatCap.csv") transit_seatcap_df = pd.read_csv(seatcap_file) transit_seatcap_df.columns=transit_seatcap_df.columns.str.replace('%','pct') transit_seatcap_df.rename(columns={"VEHTYPE":"veh_type_updated", "100pctCapacity":"standcap"},inplace=True) @@ -253,7 +255,8 @@ def move_pseudo_line_ridership(trn_link_df, pseudo_lines): # read the transit files all_trn_df = pd.DataFrame() for timeperiod in ['AM','EA','EV','MD','PM']: - trn_file = os.path.join(my_args.project_dir, 'OUTPUT', 'trn', 'trnlink{}_ALLMSA.dbf'.format(timeperiod)) + # trn_file = os.path.join(my_args.project_dir, 'OUTPUT', 'trn', 'trnlink{}_ALLMSA.dbf'.format(timeperiod)) + trn_file = os.path.join(my_args.project_dir, 'trn', 'trnlink{}_ALLMSA.dbf'.format(timeperiod)) dbf = simpledbf.Dbf5(trn_file) trn_df = dbf.to_dataframe() trn_df["period"] = timeperiod @@ -360,12 +363,14 @@ def move_pseudo_line_ridership(trn_link_df, pseudo_lines): all_trn_df.sort_values(by=["MODE","NAME","period","SEQ"], inplace=True) # writing file with all columns into output\metrics folder of the project - transit_crowding_filename = os.path.join(my_args.project_dir, 'OUTPUT', 'metrics', "transit_crowding_complete.csv") + # transit_crowding_filename = os.path.join(my_args.project_dir, 'OUTPUT', 'metrics', "transit_crowding_complete.csv") + transit_crowding_filename = os.path.join(my_args.project_dir, 'metrics', "transit_crowding_complete.csv") all_trn_df.to_csv(transit_crowding_filename, header=True, index=False) logging.info("Wrote {} lines to {}".format(len(all_trn_df), transit_crowding_filename)) # writing essential columns into output\metrics folder of the project - transit_crowding_filename = os.path.join(my_args.project_dir, 'OUTPUT', 'metrics', "transit_crowding.csv") + # transit_crowding_filename = os.path.join(my_args.project_dir, 'OUTPUT', 'metrics', "transit_crowding.csv") + transit_crowding_filename = os.path.join(my_args.project_dir, 'metrics', "transit_crowding.csv") all_trn_df[['NAME', 'SYSTEM','SEQ','A','B','AB_BRDA','period','ivtt_hours',\ 'effective_ivtt_ukdft','effective_ivtt_metrolinx', 'effective_ivtt_metrolinx_max2pt5',\ 'crowding_penalty_hrs_ukdft', 'crowding_penalty_hrs_metrolinx', 'crowding_penalty_hrs_metrolinx_max2pt5' diff --git a/utilities/gawk/bin/gawk.exe b/utilities/gawk/bin/gawk.exe new file mode 100644 index 000000000..bdedce581 Binary files /dev/null and b/utilities/gawk/bin/gawk.exe differ