forked from Metropolitan-Council/metc-asim-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmet_council_model.bat
831 lines (711 loc) · 20.8 KB
/
met_council_model.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO OFF
::SetLocal EnableDelayedExpansion
:: ----------------------------------------------------------------------------
::
:: Step 1: Set the necessary path variables
::
:: ----------------------------------------------------------------------------
:: Parameters are found in set_parameters.bat
:: Future work could move this to a folder and name parameter files after model run
CALL .\set_parameters.bat
COPY .\set_parameters.bat %SCENARIO_DIR%\set_parameters.txt
:: ----------------------------------------------------------------------------
::
:: Step 2: Networks and initial skims
::
:: ----------------------------------------------------------------------------
:: Generate zonal data for model run
COPY "%zone_attribs%" "%SCENARIO_DIR%\zones.dbf"
:: Make Networks
:: Filter the all_link and all_node shape files to create separate
:: highway, bike, and walk networks.
::%beginComment%
::???runtpp %SCRIPT_PATH%\make_complete_network_from_file.s
::???%check_cube_errors%
::???runtpp %SCRIPT_PATH%\make_highway_network_from_file.s
::???%check_cube_errors%
::???runtpp %SCRIPT_PATH%\make_bike_network_from_file.s
::???%check_cube_errors%
::???runtpp %SCRIPT_PATH%\make_walk_network_from_file.s
::???%check_cube_errors%
:: FullMakeNetwork15.s uses hard codes that should be adjusted to match model years.
::???runtpp %SCRIPT_PATH%\FullMakeNetwork15.s
::%check_cube_errors%
::endComment
ECHO HIGHWAY
:: HIGHWAY
:: No current option to copy skims as a warm start, could be added.
::%beginComment%
:: Export highway network from temp file (candidate for streamlining)
runtpp %SCRIPT_PATH%\BNNET00B.s
%check_cube_errors%
ECHO INITIAL NETWORKS AND INITIAL SKIMS
:: NON-MOTORIZED
:: Skim bike and walk networks
::%beginComment%
runtpp %SCRIPT_PATH%\NMNET00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\NMHWY00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\NMHWY00B.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\NMMAT00A.s
%check_cube_errors%
::endComment
:: HIGHWAY
:: No current option to copy skims as a warm start, could be added.
::%beginComment%
:: Export highway network from temp file (candidate for streamlining)
::??runtpp %SCRIPT_PATH%\BNNET00B.s
::??%check_cube_errors%
:: Set drive link speeds capacities, alpha/beta parameters
:initialSkim
ECHO Initial Skims
runtpp %SCRIPT_PATH%\HNNET00B.s
%check_cube_errors%
:: Set managed lanes (comments cannot go inside for loops)
FOR /L %%I IN (1, 1, 6) DO (
SET TOD=%%I
IF %%I EQU 1 (SET NETNAME=Overnight 7:00 PM to 5:00 AM)
IF %%I EQU 2 (SET NETNAME=Reverse Lane Change Over 5:00 AM to 6:00 AM and 1:00 PM to 2:00 PM)
IF %%I EQU 3 (SET NETNAME=AM Peak Period 6:00 AM to 10:00 AM)
IF %%I EQU 4 (SET NETNAME=Mid Day Period 10:00 AM to 1:00 PM)
IF %%I EQU 5 (SET NETNAME=Pre PM Peak Period 2:00 PM to 3:00 PM)
IF %%I EQU 6 (SET NETNAME=PM Peak Period 3:00 PM to 7:00 PM)
runtpp %SCRIPT_PATH%\HNNET00C.s
:: Need to test how exitRun works inside loop
%check_cube_errors%
)
IF %FREE_FLOW%==1 (goto initialSkim) else (goto copySkims)
::: Skim free flow network
runtpp %SCRIPT_PATH%\FFHWY00A.s
%check_cube_errors%
:: Copy skims to all time periods
runtpp %SCRIPT_PATH%\FFPIL00A.s
%check_cube_errors%
::endComment
ECHO TRANSIT
:: No current option to copy skims as a warm start, could be added.
::%beginComment%
:: extract link and node dbfs, set rail zone nodes
runtpp %SCRIPT_PATH%\TSNET00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSNET00B.s
%check_cube_errors%
:: Calculate transit speeds for each period
:: Build walk access, transfer access, and drive access connectors for each period
:: Skim walk transit and drive transit
FOR /L %%I IN (1, 1, 2) DO (
SET TOD=%%I
IF %%I EQU 1 (
SET TPER=PK
)
IF %%I EQU 2 (
SET TPER=OP
)
runtpp %SCRIPT_PATH%\TSNET00C.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPTR00D.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPTR00F.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPTR00H.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPIL00C.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPTR00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSPTR00C.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSMAT00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TSMAT00C.s
%check_cube_errors%
)
goto ancillary
:copySkims
runtpp %SCRIPT_PATH%\CSPIL00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TCPIL00E.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\TCNET00B.S
%check_cube_errors%
::endComment
:ancillary
:: ----------------------------------------------------------------------------
::
:: Step 3: Trucks and Special Generators
::
:: ----------------------------------------------------------------------------
ECHO INITIALIZE TRUCK AND SPECIAL GENERATOR
::%beginComment%
:: Quick response freight manual routine
runtpp %SCRIPT_PATH%\TSGEN00A.s
%check_cube_errors%
:: External auto allocation and mode choice
runtpp %SCRIPT_PATH%\TSMAT00H.s
%check_cube_errors%
:: Build distribution matrix for auto EE IPF
runtpp %SCRIPT_PATH%\TSMAT00I.s
%check_cube_errors%
:: Fratar station targets using distribution from survey
runtpp %SCRIPT_PATH%\TSFRA00A.s
%check_cube_errors%
:: Generate airport trips
runtpp %SCRIPT_PATH%\TSMAT00K.s
%check_cube_errors%
:: Create special generator matrix
runtpp %SCRIPT_PATH%\TSMAT00L.s
%check_cube_errors%
:: Fratar EE trucks from FAF
runtpp %SCRIPT_PATH%\TSFRA00B.s
%check_cube_errors%
:: Split freight into truck types
runtpp %SCRIPT_PATH%\TSMAT00M.s
%check_cube_errors%
::endComment
::now
:: ----------------------------------------------------------------------------
::
:: Step 4: Start the Model Feedback Loop
::
:: ----------------------------------------------------------------------------
:: MODEL LOOP
:: Iteration loop returns to HERE
:head
:: ----------------------------------------------------------------------------
::
:: Step 4a: Create Exogenous Variables (updated for ASIM)
::
:: ----------------------------------------------------------------------------
ECHO CREATE EXOGENOUS VARIABLES
::%beginComment%
IF %ITER% EQU 1 (COPY %SCENARIO_DIR%\zones.dbf %SCENARIO_DIR%\zones_%PREV_ITER%.dbf)
::%check_cube_errors%
:: Highway Accessibility
::runtpp %SCRIPT_PATH%\EVMAT00A.s
::%check_cube_errors%
:: Transit Accessibility
::runtpp %SCRIPT_PATH%\EVMAT00B.s
::%check_cube_errors%
:: Distance to external stations
::runtpp %SCRIPT_PATH%\EVMAT00C.s
::%check_cube_errors%
:: School TAZs
::runtpp %SCRIPT_PATH%\EVMAT00D.s
::%check_cube_errors%
:: University enrollment
::runtpp %SCRIPT_PATH%\EVMAT00E.s
::%check_cube_errors%
:: Update zonal database
::runtpp %SCRIPT_PATH%\EVMAT00F.s
::%check_cube_errors%
::endComment
:: Prepare skims for ActivitySim
:ASim
runtpp %SCRIPT_PATH%\EVMAT00G.s
%check_cube_errors%
:: Prepare sedata for ActivitySim
ECHO Prep
ECHO Python Path: %PYTHON_PATH%
ECHO Script Path: %SCRIPT_PATH%
ECHO Scenario Dir: %SCENARIO_DIR%
"%PYTHON_PATH%\python.exe" "%SCRIPT_PATH%\EVMAT00H.py" "%SCENARIO_DIR%\set_parameters.txt"
%check_cube_errors%
:: Run ActivitySim
%PYTHON_PATH%\python.exe ActivitySim\simulation.py -c ActivitySim\configs -d ActivitySim\data -o ActivitySim\output
%check_python_errors%
echo Iteration=%ITER%
:: Output ActivitySim Matrices
for /L %%I IN (1, 1, 11) DO (
SET TOD=%%I
IF %%I EQU 1 (SET PER=AM1)
IF %%I EQU 2 (SET PER=AM2)
IF %%I EQU 3 (SET PER=AM3)
IF %%I EQU 4 (SET PER=AM4)
IF %%I EQU 5 (SET PER=MD)
IF %%I EQU 6 (SET PER=PM1)
IF %%I EQU 7 (SET PER=PM2)
IF %%I EQU 8 (SET PER=PM3)
IF %%I EQU 9 (SET PER=PM4)
IF %%I EQU 10 (SET PER=EV)
IF %%I EQU 11 (SET PER=ON)
runtpp %SCRIPT_PATH%\ASPIL00A.S
%check_cube_errors%
)
echo Iteration=%ITER%
::Convert Transit Trip Tables
for /L %%I IN (1, 1, 2) DO (
IF %%I EQU 1 (SET TPER=PK)
IF %%I EQU 2 (SET TPER=OP)
runtpp %SCRIPT_PATH%\ASPIL00B.S
%check_cube_errors%
)
echo Iteration=%ITER%
:: ----------------------------------------------------------------------------
::
:: Step 4c: Freight Externals and Special Generator Distribution
::
:: ----------------------------------------------------------------------------
::%beginComment%
ECHO FREIGHT
:: Create weighted skim times
runtpp %SCRIPT_PATH%\FTMAT00A.s
%check_cube_errors%
:: Truck gravity model
runtpp %SCRIPT_PATH%\FTTRD00A.s
%check_cube_errors%
:: Time period splits
runtpp %SCRIPT_PATH%\FTMAT00B.s
%check_cube_errors%
::endComment
ECHO EXTERNAL AUTOS
::%beginComment%
:: Auto EI/IE destination choice
runtpp %SCRIPT_PATH%\EEMAT00A.s
%check_cube_errors%
:: Combine EI/IE trips with tranpose and EE
runtpp %SCRIPT_PATH%\EEMAT00B.s
%check_cube_errors%
echo Iteration=%ITER%
:: Loop through time periods, sum trips from each time period
for /L %%I IN (1, 1, 11) DO (
SET TOD=%%I
IF %%I EQU 1 (SET PER=AM1)
IF %%I EQU 2 (SET PER=AM2)
IF %%I EQU 3 (SET PER=AM3)
IF %%I EQU 4 (SET PER=AM4)
IF %%I EQU 5 (SET PER=MD)
IF %%I EQU 6 (SET PER=PM1)
IF %%I EQU 7 (SET PER=PM2)
IF %%I EQU 8 (SET PER=PM3)
IF %%I EQU 9 (SET PER=PM4)
IF %%I EQU 10 (SET PER=EV)
IF %%I EQU 11 (SET PER=ON)
runtpp %SCRIPT_PATH%\EEMAT00D.s
%check_cube_errors%
)
echo Iteration=%ITER%
:: Split trips by TOD
runtpp %SCRIPT_PATH%\EEMAT00E.s
%check_cube_errors%
::endComment
::%beginComment%
:: SPECIAL GENERATORS
:: Data from AirportModECHOiceParams.txt
for /L %%I IN (1, 1, 11) DO (
SET TOD=%%I
IF %%I EQU 1 (
SET PER=AM1
SET HPER=AM
SET TPER=PK
)
IF %%I EQU 2 (
SET PER=AM2
SET HPER=AM
SET TPER=PK
)
IF %%I EQU 3 (
SET PER=AM3
SET HPER=AM
SET TPER=PK
)
IF %%I EQU 4 (
SET PER=AM4
SET HPER=AM
SET TPER=PK
)
IF %%I EQU 5 (
SET PER=MD
SET HPER=MD
SET TPER=OP
)
IF %%I EQU 6 (
SET PER=PM1
SET HPER=PM
SET TPER=PK
)
IF %%I EQU 7 (
SET PER=PM2
SET HPER=PM
SET TPER=PK
)
IF %%I EQU 8 (
SET PER=PM3
SET HPER=PM
SET TPER=PK
)
IF %%I EQU 9 (
SET PER=PM4
SET HPER=PM
SET TPER=PK
)
IF %%I EQU 10 (
SET PER=EV
SET HPER=NT
SET TPER=OP
)
IF %%I EQU 11 (
SET PER=ON
SET HPER=NT
SET TPER=OP
)
:: Airport mode choice
:: Seeing errors from SGMAT00A.s - should we add a zero out option to prevent divide by 0 errors?
runtpp %SCRIPT_PATH%\SGMAT00A.s
%check_cube_errors%
:: Return trips from airport
runtpp %SCRIPT_PATH%\SGMAT00B.s
%check_cube_errors%
)
::endComment
echo Iteration=%ITER%
::%beginComment%
:: ----------------------------------------------------------------------------
::
:: Step 4d: Assignment and Skimming
::
:: ----------------------------------------------------------------------------
:: HIGHWAY skims
:: Start cube cluster
runtpp %SCRIPT_PATH%\HAPIL00D.s
%check_cube_errors%
:: Aggregate trip tables for interim assignment
runtpp %SCRIPT_PATH%\HAMAT00E.s
%check_cube_errors%
:: Aggregtate truck trip tables for interim assignment
runtpp %SCRIPT_PATH%\HAMAT00G.s
%check_cube_errors%
:: Aggregtate IE/EI trip tables for interim assignment
runtpp %SCRIPT_PATH%\HAMAT00I.s
%check_cube_errors%
:: Aggregate SPC trip tables for interim assignment
runtpp %SCRIPT_PATH%\HAMAT00K.s
%check_cube_errors%
:: Loop over time of day
FOR /L %%I IN (1, 1, 4) DO (
SET TOD=%%I
IF %%I EQU 1 (
SET PER=AM
SET ASSIGNNAME=AM Peak Period
SET HWY_NET=HWY_NET_3.net
SET NETNAME=AM Peak Period 6:00 AM to 10:00 AM
SET CAPFAC=3.75
)
IF %%I EQU 2 (
SET PER=MD
SET ASSIGNNAME=Mid Day Peak Period
SET HWY_NET=HWY_NET_4.net
SET NETNAME=Mid Day Period 10:00 AM to 3:00 PM
SET CAPFAC=4.48
)
IF %%I EQU 3 (
SET PER=PM
SET ASSIGNNAME=PM Peak Period
SET HWY_NET=HWY_NET_6.net
SET NETNAME=PM Peak Period 3:00 PM to 7:00 PM
SET CAPFAC=3.9
)
IF %%I EQU 4 (
SET PER=NT
SET ASSIGNNAME=Night
SET HWY_NET=HWY_NET_1.net
SET NETNAME=AM Peak Period 7:00 PM to 6:00 AM
SET CAPFAC=4.65
)
:: Record stats and convert to vehicle trip tables
runtpp %SCRIPT_PATH%\HAMAT00A.s
%check_cube_errors%
:: Highway assignment
runtpp %SCRIPT_PATH%\HAHWY00A.s
%check_cube_errors%
:: Create highway skims
runtpp %SCRIPT_PATH%\HAMAT00C.s
%check_cube_errors%
)
:: End cube cluster
runtpp %SCRIPT_PATH%\HAPIL00B.s
%check_cube_errors%
:endComment
echo Iteration=%ITER%
:: HWY Assignment Post-Processor
:: Combine convergence assignment networks
runtpp %SCRIPT_PATH%\CANET00A.s
%check_cube_errors%
:: export link dbf
runtpp %SCRIPT_PATH%\CANET00B.s
%check_cube_errors%
:: Export files to csv
runtpp %SCRIPT_PATH%\CAMAT00A.s
%check_cube_errors%
::endComment
:: TRANSIT skimming
echo Iteration=%ITER%
::%beginComment%
::now
:: Calculate transit speeds for period
runtpp %SCRIPT_PATH%\TSNET00F_loop.s
%check_cube_errors%
:: Build period walk access connectors
runtpp %SCRIPT_PATH%\TSPTR00N_loop.s
%check_cube_errors%
:: Build period transfer access connectors
runtpp %SCRIPT_PATH%\TSPTR00S_loop.s
%check_cube_errors%
:: Build period drive access connectors
runtpp %SCRIPT_PATH%\TSPTR00U_loop.s
%check_cube_errors%
SET I=1
:trnntlloop
SET TOD=%I%
IF %I% EQU 1 (
SET TPER=PK
SET ASSIGNNAME=Peak Period
SET PER=AM
)
IF %I% EQU 2 (
SET TPER=OP
SET ASSIGNNAME=OffPeak Period
SET PER=MD
)
:: Copy temp files to non-transit leg files
COPY %SCENARIO_DIR%\XIT_WKACC_NTL_%ITER%_%TPER%.tmp+%TRANSIT_FOLDER%\WalkOverrides.txt %SCENARIO_DIR%\XIT_WKACC_NTL_%ITER%_%TPER%.ntl
COPY %SCENARIO_DIR%\XIT_XFER_NTL_%ITER%_%TPER%.tmp+%TRANSIT_FOLDER%\TransferOverrides.txt %SCENARIO_DIR%\XIT_XFER_NTL_%ITER%_%TPER%.ntl
COPY %SCENARIO_DIR%\XIT_DRACC_NTL_%ITER%_%TPER%.tmp+%TRANSIT_FOLDER%\DriveOverrides.txt %SCENARIO_DIR%\XIT_DRACC_NTL_%ITER%_%TPER%.ntl
IF %I% EQU 1 (SET I=2 & GOTO trnntlloop)
:: Walk transit skim step 1
runtpp %SCRIPT_PATH%\TSPTR00J_loop.s
%check_cube_errors%
:: Drive transit skim step 1
runtpp %SCRIPT_PATH%\TSPTR00L_loop.s
%check_cube_errors%
:: Walk transit skim step 2
runtpp %SCRIPT_PATH%\TSMAT00E_loop.s
%check_cube_errors%
:: Drive transit skim step 2
runtpp %SCRIPT_PATH%\TSMAT00G_loop.s
%check_cube_errors%
@ECHO OFF
::now
::runtpp %SCRIPT_PATH%\TSPIL00E.S
:: ----------------------------------------------------------------------------
::
:: Step 4e: Check Convergence and Final Assignment
::
:: ----------------------------------------------------------------------------
:: CHECK CONVERGENCE
::%beginComment%
:: Skip convergence tests on first iteration, "unbuil network"
IF %ITER% EQU 1 (
FOR /L %%I IN (1,1,4) DO (
IF %%I EQU 1 (SET PER=NT)
IF %%I EQU 2 (SET PER=AM)
IF %%I EQU 3 (SET PER=MD)
IF %%I EQU 4 (SET PER=PM)
runtpp %SCRIPT_PATH%\IINET00C.s
%check_cube_errors%
)
)
::endComment
::%beginComment%
:: After first iteration, check convergence criteria
IF %ITER% GEQ 2 (
@ECHO. >> %SCENARIO_DIR%\converge.txt
@ECHO. >> %SCENARIO_DIR%\converge.txt
@ECHO Checking convergence for iteration %ITER% >> %SCENARIO_DIR%\converge.txt
@ECHO %date% %time% >> %SCENARIO_DIR%\converge.txt
SET error_flag=0
FOR /L %%I IN (1,1,4) DO (
IF %%I EQU 1 (SET PER=NT)
IF %%I EQU 2 (SET PER=AM)
IF %%I EQU 3 (SET PER=MD)
IF %%I EQU 4 (SET PER=PM)
runtpp %SCRIPT_PATH%\CCNET00D.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\CCMAT00A.s
%check_cube_errors%
@ECHO. >> %SCENARIO_DIR%\converge.txt
@type %SCENARIO_DIR%\converge_%ITER%_!PER!.txt >> %SCENARIO_DIR%\converge.txt
@ECHO. >> %SCENARIO_DIR%\converge_%ITER%_!PER!.txt
FOR /f "tokens=*" %%a IN (TPPL.VAR) DO (
SET %%a
)
)
IF !OP._ERRLINKS! GTR %conv_LinkPerc% (
SET error_flag=1
)
IF !MD._ERRLINKS! GTR %conv_LinkPerc% (
SET error_flag=1
)
IF !AM._ERRLINKS! GTR %conv_LinkPerc% (
SET error_flag=1
)
IF !PM._ERRLINKS! GTR %conv_LinkPerc% (
SET error_flag=1
)
ECHO.
ECHO Iteration %ITER%: error flag !error_flag!
ECHO.
IF !error_flag! EQU 1 (
@ECHO Iteration %ITER% Not Converged >> %SCENARIO_DIR%\converge.txt
)
IF !error_flag! EQU 0 (
@ECHO Iteration %ITER% Converged! >> %SCENARIO_DIR%\converge.txt
SET CONV=1
)
IF %ITER% EQU %max_feedback% (
@ECHO. >> %SCENARIO_DIR%\converge.txt
ECHO Maximum Iterations %max_feedback% Hit >> %SCENARIO_DIR%\converge.txt
@ECHO. >> %SCENARIO_DIR%\converge.txt
SET CONV=1
)
)
::endComment
IF %CONV% EQU 0 (SET FinalAssign=1)
IF %CONV% EQU 1 (SET FinalAssign=2)
::%beginComment%
:: If the model is converged, run assignment one last time
IF %FinalAssign% EQU 2 (
:: FINAL HIGHWAY
::Start Cube Cluster
runtpp %SCRIPT_PATH%\HTPIL00B.S
%check_cube_errors%
FOR /L %%I IN (1,1,11) DO (
IF %%I EQU 1 (
SET PER=AM1
SET ASSIGNNAME=AM1 Peak Period
SET HWY_NET=HWY_NET_3.net
SET NETNAME=AM Peak Period 6:00 AM to 7:00 AM
SET CAPFAC=1
)
IF %%I EQU 2 (
SET PER=AM2
SET ASSIGNNAME=AM2 Peak Period
SET HWY_NET=HWY_NET_3.net
SET NETNAME=AM Peak Period 7:00 AM to 8:00 AM
SET CAPFAC=1
)
IF %%I EQU 3 (
SET PER=AM3
SET ASSIGNNAME=AM3 Peak Period
SET HWY_NET=HWY_NET_3.net
SET NETNAME=AM Peak Period 8:00 AM to 9:00 AM
SET CAPFAC=1
)
IF %%I EQU 4 (
SET PER=AM4
SET ASSIGNNAME=AM4 Peak Period
SET HWY_NET = HWY_NET_3.net
SET NETNAME=AM Peak Period 9:00 AM to 10:00 AM
SET CAPFAC=1
)
IF %%I EQU 5 (
SET PER=MD
SET ASSIGNNAME=Mid Day Period
SET HWY_NET=HWY_NET_4.net
SET NETNAME=Mid Day Period 10:00 AM to 3:00 PM
SET CAPFAC=4.48
)
IF %%I EQU 6 (
SET PER=PM1
SET ASSIGNNAME=PM1 Peak Period
SET HWY_NET = HWY_NET_6.net
SET NETNAME=PM Peak Period 3:00 AM to 4:00 PM
SET CAPFAC=1
)
IF %%I EQU 7 (
SET PER=PM2
SET ASSIGNNAME=PM2 Peak Period
SET HWY_NET=HWY_NET_6.net
SET NETNAME=PM Peak Period 4:00 AM to 5:00 PM
SET CAPFAC=1
)
IF %%I EQU 8 (
SET PER=PM3
SET ASSIGNNAME=PM3 Peak Period
SET HWY_NET=HWY_NET_6.net
SET NETNAME=PM Peak Period 5:00 AM to 6:00 PM
SET CAPFAC=1
)
IF %%I EQU 9 (
SET PER=PM4
SET ASSIGNNAME=PM4 Peak Period
SET HWY_NET=HWY_NET_6.net
SET NETNAME=PM Peak Period 6:00 AM to 7:00 PM
SET CAPFAC=1
)
IF %%I EQU 10 (
SET PER=EV
SET ASSIGNNAME=Evening Period
SET HWY_NET=HWY_NET_1.net
SET NETNAME=Evening 7:00 PM to 12:00 AM
SET CAPFAC=3.32
)
IF %%I EQU 11 (
SET PER=ON
SET ASSIGNNAME=Overnight Period
SET HWY_NET=HWY_NET_1.net
SET NETNAME=Overnight 12:00 AM to 6:00 AM
SET CAPFAC=2.59
)
runtpp %SCRIPT_PATH%\HTMAT00B.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\HTHWY00B.s
%check_cube_errors%
)
:: End Cube Cluster
runtpp %SCRIPT_PATH%\HTPIL00E.S
:: FINAL TRANSIT
runtpp %SCRIPT_PATH%\PAMAT00C.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\PAMAT00A_loop.s
%check_cube_errors%
::now
runtpp %SCRIPT_PATH%\PAPTR00B_loop.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\PAPTR00D_loop.s
%check_cube_errors%
FOR /L %%K IN (1,1,2) DO (
IF %%K EQU 1 (SET ACC=WK)
IF %%K EQU 2 (SET ACC=DR)
runtpp %SCRIPT_PATH%\PAMAT00B_loop.s
%check_cube_errors%
)
:: FINAL POSTPROCESSING
FOR /L %%I IN (1,1,2) DO (
IF %%I EQU 1 (SET PER=AM)
IF %%I EQU 2 (SET PER=PM)
:: Combine time period networks
runtpp %SCRIPT_PATH%\PPNET00A.s
%check_cube_errors%
runtpp %SCRIPT_PATH%\PPNET00B.s
%check_cube_errors%
:: Export to csv
runtpp %SCRIPT_PATH%\PPMAT00A.s
%check_cube_errors%
)
)
SET /a ITER=ITER+1
SET /a PREV_ITER=PREV_ITER+1
:: Return to beginning of model loop if model is no converged
IF %ITER% LEQ %max_feedback% (IF %CONV% EQU 0 (%returnToHead%))
::endComment
COPY *.prn %SCENARIO_DIR%\abm_logs\*.prn
:: Delete all the temporary TP+ printouts and cluster files
DEL *.prn
:Visualizer
cd Visualizer
generateDashboard_metc_vs_asim.bat
:endOfFile
@ECHO OFF
IF ERRORLEVEL 0 (
ECHO RUN SUCCEEDED
)
IF ERRORLEVEL 1 (
ECHO RUN FAILED IN ActivitySim
)
IF ERRORLEVEL 2 (
ECHO RUN FAILED IN CUBE SCRIPTS
)
::cd ..\..\..