Modelling Transport - Cube Guidebook

January 11, 2017 | Author: onyxgroup | Category: N/A
Share Embed Donate


Short Description

Download Modelling Transport - Cube Guidebook...

Description

Modelling Transport – CUBE Guide Examples based on the book ‘Modelling Transport’, 4th edition by Ortuzar/Willumsen (© 2011 John Wiley & Sons, Ltd) Citilabs © 2011

Main Menu About Cube : a brief intro to the modelling system and its modules §About the tutorial : The Guide and Book in tandem §Click on the app boxes below to get to the examples §

Chapter Chapter §Chapter §Chapter §Chapter §Chapter §Chapter §Chapter §Chapter § §

3: 4: 5: 6: 8: 10 11 12 14

Data and Storage Trip Generation Modelling Trip Distribution Modelling Modal Split and Direct Demand Models Specification and Estimation of Discrete Choice Models : Assignment : Equilibrium and Dynamic Assignment : Simplified Transport Demand Models : Activity Based Models

Citilabs – software products Desktop Professional Modeling a comprehensive suite for passenger, freight, land use, and traffic simulation Cube Cloud Services - Modeling on the Internet web-accessed, cloud computing framework for model application –

Modeling Extensions for ArcGIS modeling and analysis tools for non-modelers –

 

Our Products: Cube

Cube: Professional Desktop Modeling Suite System Interface § Cube Base – comprehensive interface for data editing, mapping, reporting, model development and scenario creation and management Demand Modeling § Cube Voyager: urban, regional and long distance demand forecasting and assignment § Cube Land : land use model for combined transport-land use modeling § Cube Cargo: commodity-based freight forecasting Simulation § Cube Avenue: meso-scopic traffic simulation (DTA) § Cube Dynasim: multimodal micro-simulation

Click to edit Master text s Second level ● Third level Specialized ● Fourth level Cube Cluster: reduces run-times by allocating calculations over multiple processors and machines ● Fifth level §

§

Cube Analyst: advanced matrix estimation for all modes

Overview

Cube Base – Built for Scenario Testing § § §

Easy to use environment to create, test, manage and analyze scenarios. Menus to prompt user for inputs and parameters of test Integrated report and charting generators to assist in the analysis

Overview

Cube Base – Flow-Chart: Easy Model Development §

§ § §

Famous for its flow-charting environment for designing and building transportation models Modules are accessed through pull-down menus Dropped into a flow chart Data inputs and outputs linked by drag-and-drop

Overview

Cube Base – A Transportation-GIS Built on ESRI §

§

§

§

Only modeling system that comes with a complete transportation GIS built on ESRI’s marketing leading GIS technology. Store all data directly in ESRI’s geodatabase format. No need to convert data back and forth between the GIS department and the modeling team ArcGIS Extension for network editing (Sugar)

Overview

Cube Base – the complete software interface Cube GIS

§

§Click-drag-drop

functionality for all typical modelling tasks §Cube integrates GIS powered by ESRI §Uses ESRI geodatabase technology §Supports other formats; Shape, CAD, Raster

Cube Model Builder (Application Manager)

§

Flow-chart system for model design, coding and documentation §Visual creation of the model ‘macro’ §Gives direct access to data and scripts §

Cube Scenario Manager

§

Highlights key model parameters and data for easy creation and testing of scenarios §Creates customised run menu for defining and running scenarios §Provides easy links to main output data for viewing and comparing §

Cube Reports

§

Charts and Tables integrated in model §View and compare scenario specific statistics §

Comprehensive and Integrated Covers all facets of transportation modeling § § § § §

people goods land use region-wide traffic simulation multi-modal microsimulation

Open system § § §

Seamless links to other software Microsoft Office (Access, Excel) User programs

BACK TO MAIN MENU

About the book : Modelling Transport 4th edition

This system of Cube modelling tutorials is based on Modelling Transport 4th Edition (the 'book') §The book has been used since its first edition in 1990 by transport modellers around the world to find and select appropriate methods to their modelling tasks and for understanding the theoretic base behind these methods §The book includes a wealth of examples of how to model, in terms of approach and mathematics, the various aspects of transport. §This guide provides a set of applications showing the examples of the book coded up in Cube scripts, grouped according to the book's chapters. Suggestions for the MODELLER :

§



• • •

§

find and study the appropriate method in the book study the relevant example in the book see how this example is coded in Cube use the script as a base for your model and its data

Suggestions for the STUDENT :

§



• •

read the relevant chapter/model type and its modelling methods in the book study the examples see how these example are coded in Cube

§ About the 'book' : About the MT Cube Guide : Modelling Transport 4th Edition, © 2011 John Wiley & Sons, Version 1.0 September 2011 Authors : Citilabs professionals Ltd Authors : Juan de Dios Ortuzar © Citilabs 2011 Luis G. Willumsen

About the book : Availability and authors Modelling Transport" 4th Edition, John Wiley & Sons § Available from http:// eu.wiley.com/WileyCDA/WileyTitle/productCd-0470760397.html § Also available from www.Amazon.com and www.Amazon.co.uk § Available as hard copy and electronic book for Kindle, iPad and other tablets

§

The authors have been involved with transport modelling research for over 40 years §Juan de Dios Ortuzar §Luis (Pilo) Willumsen

§



Present

Professor of Transport Engineering at Pontificia Universidad Católica de Chile Advisor to governments and international agencies



Present











Past •



Director of Luis Willumsen Consultancy Visiting Professor at University College London Researcher at Leeds University and University College London Board Director at Steer Davies Gleave

About the guide : Availability and purpose Part of the Cube’s Learning Center on http:// www.citilabs.com/support-services/learning-center §Comes with downloadable Cube catalog with examples scripted in Cube §Open to all users of Cube and to those who are evaluating the system §

This guide will make it easier for modellers to put the lessons learned in the book to practical use in models

§

The main purpose of this guide is to promote sound modeling practices based on established methods described and discussed in the book

§

This guide is also meant to encourage the modelling community to keep up to date on modeling methods and principles; the book is an ideal starting point

§

BACK TO MAIN MENU

About the guide : The tutorial system The main page with links to the apps with examples from each chapter of the book

§

BACK TO MAIN MENU

Chapter 4 : Trip Generation Modelling Click on the boxes below to select the various examples

§

BACK TO MAIN MENU

Ch4-TGM : Ex4.1 - Growth-factor Modelling Click on the script file boxes below to see the scripts

§

BACK …

Ch4-TGM: Ex4.1 - Growth - base year RUN PGM=MATRIX PRNFILE="C4MAT00A.PRN" MSG='Example 4.1 - Base Year' FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter4\Results_4_1_BaseYear.DBF", FIELDS=Z, GEN FILEI DBI[1] = "C:\Modelling Transport_CG\Input\Chapter4\SocioEconData_4_1_BY.dbf" PAR ZONES=1 C=DBIReadRecord(1,1) ; read input data ZONEN=DI.1.Z ; zone numbers (only 1 zone in the current example) X1=DI.1.NO_CAR ; number of households without a car X2=DI.1.WITH_CAR ; number of households with 1 or more cars ; calculation of total number of trips per day GEN=X1*{GenRateNCar}+X2*{GenRateCar} ; trips per day ; ti=250 x 2.5 + 250 x 6.0 = 2125 trips/day (See page 144) ; save results to output file RO.Z=ZONEN RO.GEN=GEN WRITE RECO=1 ENDRUN

BACK …

Ch4-TGM: Ex4.1 - Future year growthfactor

RUN PGM=MATRIX PRNFILE="C4MAT00B.PRN" MSG='Example 4.1 - Future Year - Growth-factor method' FILEI DBI[3] = "C:\Modelling Transport_CG\Output\Chapter4\Results_4_1_BaseYear.DBF", SORT=Z FILEI DBI[2] = "C:\Modelling Transport_CG\Input\Chapter4\SocioEconData_4_1_FY.dbf", SORT=Z FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter4\Results_4_1_FutureYear.DBF", FIELDS=Z GEN FILEI DBI[1] = "C:\Modelling Transport_CG\Input\Chapter4\SocioEconData_4_1_BY.dbf" PAR ZONES=1 C=DBIReadRecord(1,1) ; read input data Base Year ZONEN=DI.1.Z ; zone numbers (only 1 zone in the current example) X1_B=DI.1.NO_CAR ; number of households without a car X2_B=DI.1.WITH_CAR ; number of households with 1 or more cars D=DBISeek(2,1) ; read input data Future Year X1_F=DI.2.NO_CAR ; number of households without a car X2_F=DI.2.WITH_CAR ; number of households with 1 or more cars E=DBISeek(3,1) ; read ti GEN_B=DI.3.GEN ; calculation of total number of trips per day Factor2=(X2_F/(X1_F+X2_F))/(X2_B/(X1_B+X2_B)) ; Fi=C_di/C_ci (See page 144) GEN_F=Factor2*GEN_B ; Ti = 2 x 2125 = 4250 trips/day (See page 144) ; save results to output file RO.Z=ZONEN RO.GEN=GEN_F WRITE RECO=1 ENDRUN

BACK …

Ch4-TGM: Ex4.1 - Future year growth applying trip rates

RUN PGM=MATRIX PRNFILE="CHAPTER4\C4MAT00C.PRN" MSG='Example 4.1 - Future Year - Applying Trip Rates' FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter4\Results_4_1_FutureYear_TR.DBF", FIELDS=Z, GEN FILEI DBI[1] = "C:\Modelling Transport_CG\Input\Chapter4\SocioEconData_4_1_FY.dbf" PAR ZONES=1 C=DBIReadRecord(1,1) ; read input data ZONEN=DI.1.Z ; zone numbers (only 1 zone in the current example) X1=DI.1.NO_CAR ; number of households without a car X2=DI.1.WITH_CAR ; number of households with 1 or more cars ; calculation of total number of trips per day GEN=X1*{GenRateNCar}+X2*{GenRateCar} ; trips per day ; ti=250 x 2.5 + 250 x 6.0 = 2125 trips/day (See page 144) ; save results to output file RO.Z=ZONEN RO.GEN=GEN WRITE RECO=1 ENDRUN

BACK …

Ch4-TGM : Ex4.3 - Linear regression Click on the script file boxes below to see the scripts

§

BACK …

Ch4-TGM: Ex4.3 – Linear regression RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER4\E4MAT01A.PRN“, MSG='Exmple 4.3 - Linear regression with intercept=0' FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter4\RegrCoeffAndStats_4_3.DBF", FIELDS=B(10.8) R2(10.8) SERR(10.8) T_VALUE(10.8) FILEI DBI[1] = "C:\Modelling Transport_CG\Input\Chapter4\SocioEconData_4_3.dbf" PAR ZONES=1 ; Linear regression with intercept=0 ; Y = a + bX ; a=0 LOOP K=1,DBI.1.NUMRECORDS C=DBIReadRecord(1,K) ; read input data X1=DI.1.X1 ; number of workers in household Y=DI.1.Y ; observed trips per household ; b= sum(xy)/sum(x^2) _XY=X1*Y+_XY _X=X1^2+_X ENDLOOP ; script continues on next page

NEXT …

Ch4-TGM: Ex4.3 – Linear regression ; script continued from previous page B=_XY/_X LOOP K=1,DBI.1.NUMRECORDS C=DBIReadRecord(1,K) ; read input data X1=DI.1.X1 ; number of workers in household Y=DI.1.Y ; observed trips per household Y_MOD=B*X1 _SSRESID=(Y-Y_MOD)^2+_SSRESID _SSTOTAL=(Y^2)+_SSTOTAL _SSX=(X1^2)+_SSX ENDLOOP N=DBI.1.NUMRECORDS-1 ; sample size minus number of regressors (1 in this case) R2=1-(_SSRESID/_SSTOTAL) ; R squared SERR=SQRT(_SSRESID/N)/SQRT(_SSX) ; Standard error for coefficient B T_VALUE=B/SERR ; t-value for coefficient B ; save results to output file RO.B=B RO.R2=R2 RO.SERR=SERR RO.T_VALUE=T_VALUE WRITE RECO=1 ENDRUN

BACK …

Ch4-TGM : Additional examples Click on the script file boxes below to see the scripts

§

BACK …

Ch4-TGM: A – Processing tabular data in MATRIX RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER4\E4MAT01D.PRN" FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter4\CrossTabulation.dbf", FIELDS=INC_CLASS(50) ZERO_CARS ONE_CAR TWOPL_CARS TOTAL FILEI RECI = "C:\Modelling Transport_CG\Input\Chapter4\ExampleTable.DBF", SORT=INCOME ARRAY CARS=4 ARRAY CLASS=5 CLASS[1]=125 CLASS[2]=250 CLASS[3]=500 CLASS[4]=750 CLASS[5]=2000 IF (_ID=0) _PCLASS=0 _CLASS=1 ENDIF IF(_INCOME>=CLASS[_CLASS] & _ID>0) RO.INC_CLASS='Between'+Str(CLASS[_PCLASS],4,0)+' and '+Str(CLASS[_CLASS],4,0)+' (US$/month)' RO.ZERO_CARS=CARS[1] RO.ONE_CAR=CARS[2] RO.TWOPL_CARS=CARS[3]+CARS[4] RO.TOTAL =CARS[1]+CARS[2]+CARS[3]+CARS[4] ; script continues on next page

NEXT …

Ch4-TGM: A – Processing tabular data in MATRIX ; script continued from previous page WRITE RECO=1 CARS[1]=0 CARS[2]=0 CARS[3]=0 CARS[4]=0 _CARS=0 _PCLASS=_PCLASS+1 _CLASS=_CLASS+1 ENDIF _ID=RI.ID _CARS=RI.CARS+1 _INCOME=RI.INCOME CARS[_CARS]=1+CARS[_CARS] ; script continues on next page

NEXT …

Ch4-TGM: A – Processing tabular data in MATRIX ; script continued from previous page IF(I=0) RO.INC_CLASS='Between'+Str(CLASS[_PCLASS],4,0)+' and '+Str(CLASS[_CLASS],4,0)+' (US$/month)' RO.ZERO_CARS=CARS[1] RO.ONE_CAR=CARS[2] RO.TWOPL_CARS=CARS[3]+CARS[4] RO.TOTAL =CARS[1]+CARS[2]+CARS[3]+CARS[4] WRITE RECO=1 CARS[1]=0 CARS[2]=0 CARS[3]=0 CARS[4]=0 _CARS=0 _CLASS=_CLASS+1 ENDIF ENDRUN

BACK …

Ch4-TGM: B – Use of GENERATION Program RUN PGM=GENERATION PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER4\E4GEN01A.PRN" FILEO PAO[1] = "C:\Modelling Transport_CG\Output\Chapter4\TripEnd.dbf", FORM=8.0, LIST=Z(2), P[1] P[2] P[3] P[4] A[1] A[2] A[3] A[4],DBF=T, NAMES = TAZ WORKP SCHOOLP SHOPP TOTP,WORKA SCHOOLA SHOPA TOTA FILEI ZDATI[1] = "C:\Modelling Transport_CG\Input\Chapter4\cubetown.mdb\Demographics" ; set number of zones PARAMETERS ZONES = 4 PROCESS PHASE=ILOOP ; ----- calculate generations by purpose P[1] = (0.960 * zi.1.HH1 + 1.370 * zi.1.HH2 + 1.995 * P[2] = (0.900 * zi.1.HH1 + 0.382 * zi.1.HH2 + 0.325 * P[3] = (0.480 * zi.1.HH1 + 1.370 * zi.1.HH2 + 1.465 * ; ----- calculate attractions by purpose A[1] = 1.450 * zi.1.TOTAL_EMP A[2] = 0.144 * 9.0 * zi.1.RETAIL + 1.8 * zi.1.SERVICE A[3] = 0.220 * 9.0 * zi.1.RETAIL + 1.8 * zi.1.SERVICE

zi.1.HH3 + 1.778 * zi.1.HH4) zi.1.HH3 + 0.500 * zi.1.HH4) zi.1.HH3 + 1.524 * zi.1.HH4) + 0.5 * zi.1.OTHER + 0.9 * zi.1.HOUSEHOLDS + 0.5 * zi.1.OTHER + 0.9 * zi.1.HOUSEHOLDS

ENDPROCESS PROCESS PHASE=ADJUST ; ----- adjust zonal attractions so total attractions match total productions BALANCE A2P=1,2,3; balance attrs to prods for purposes 1, 2, 3 ;for details on the method see pag.156 4.2.6 Matching Generations and Attraction totals P[4] = P[1] + P[2] + P[3] A[4] = A[1] + A[2] + A[3] ENDPROCESS ENDRUN

BACK …

Chapter 5: Trip Distribution Modelling Click on the boxes below to select the various examples

§

BACK TO MAIN MENU

Ch5-TDM: Ex5.1 - Uniform Growth-factor Click on the script file boxes below to see the scripts

§

BACK …

Ch5-TDM: Ex5.1 - Uniform Growth-factor RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT00A.PRN“, MSG='Example 5.1 - Uniform Growth Factor (tau)=1.2' FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_1.MAT", MO=1 NAME="Future matrix" FILEI MATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Base_year_trip_matrix_5_1.dbf", PATTERN=IJ:V FIELDS=O D TRIPS PAR ZONES=4 ; ; ; ; ; ;

multiply matrix per Tau (ratio of expanded over previous total number of trips) Tij = (tau)*tij (5.3) where: MW[1]=Tij MI.1.1=tij (tau)={tau}

MW[1]=MI.1.1*{tau} ENDRUN

BACK …

Ch5-TDM: Ex5.2 - Singly Constrained Click on the script file boxes below to see the scripts

§

BACK …

Ch5-TDM: Ex5.2 – Preparing trip end data RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT02A.PRN“, MSG='Example 5.2 - total number of trips generated per zone' FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_2_A.MAT", MO=1 FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Total_number_of_trips_generated_Base_year_5_2.DBF", FIELDS=ZONE SUM_J FILEI MATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Base_year_trip_matrix_5_1.dbf", PATTERN=IJ:V FIELDS=O D TRIPS PAR ZONES=4 ;initialize work variables _Generated=0 ;read tij MW[1]=MI.1.1 ;sum tij over destinations _Generated= ROWSUM(1) ;sum over cell by row ;write totals per origins RO.ZONE=I RO.SUM_J=_Generated WRITE RECO=1 ENDRUN

BACK …

Ch5-TDM: Ex5.2 – Singly constrained growth

RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT02B.PRN“, MSG='Example 5.2 - Expanded origin-constrained growth trip table' FILEI MATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Base_year_trip_matrix_5_1.dbf", PATTERN=IJ:V FIELDS=O D TRIPS FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_2.MAT", MO=1 DEC=1*5 NAME="Future matrix" FILEI LOOKUPI[2] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_future_year_5_2.dbf" FILEI LOOKUPI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Total_number_of_trips_generated_Base_year_5_2.DBF" LOOKUP LOOKUPI=1, NAME=Base, LOOKUP[1]=ZONE, RESULT=SUM_J, FAIL[3]=0 LOOKUP LOOKUPI=2, NAME=Future, LOOKUP[1]=ZONE, RESULT=OI, FAIL[3]=0 ;Set parameters and array PAR ZONES=4 ARRAY TAU=4 ;read tij MW[1]=MI.1.1 ; calculate (tau)I : (tau)i=Ti/ti ; Future(1,I)=Ti totals generated per zone in future matrix; Base(1,I)=Ti totals generated per zone in base year TAU[I]=Future(1,I)/Base(1,I) ;multiply each origin-destination value per origin values (same value per each row in the matrix) MW[1]=MW[1]*TAU[I] ENDRUN

BACK …

Ch5-TDM: Ex5.2 – Alternative way with FRATAR This example uses Cube’s template system §Click on ‘Go To Editor’ in the menu below to see the script §

BACK …

Ch5-TDM: Ex5.2 – Alternative way with FRATAR

RUN PGM=FRATAR PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5FRA02A.PRN“, MSG='Example 5.2 - alternative way using FRATAR' FILEI LOOKUPI[2] = "C:\Modelling Transport_CG\Output\Chapter5\Total_number_of_trips_generated_Base_year_5_2.DBF" FILEI MATI[1] = {MATI.Q}, PATTERN=IJ:V FIELDS=O D TRIPS FILEI LOOKUPI[1] = {LOOKUPI.Q} FILEO MATO[1] = {MATO.Q}, MO=1,NAME=FACTOREDMAT, DEC=1*D PARAMETERS ZONES=4, MAXITERS=1 ; USE A LOOKUP FILE TO find appropriate factors (1.0 is assumed unless expressly provided) LOOKUP LOOKUPI=1, LIST=Y, NAME=GROWTHF, LOOKUP[1]=ZONE,RESULT=OI, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 LOOKUP LOOKUPI=2, LIST=Y, NAME=GROWTHB, LOOKUP[1]=ZONE,RESULT=SUM_J, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 ;using fratar syntax we have: ; P[1]= generation values for purpose [1] ; A[1]=0 not used to constrain the final matrix; ; MW[1]=tij ; CONTROL[1]: define how update the original matrix ; CONTROL[1]=P set the matrix matching the generation values SETPA P[1]=GROWTHF(1,I) A[1]=0 MW[1]=MI.1.1 CONTROL[1]=P ;alternative control values are: ; CONSTROL[1]=A for a destination-specific factors ; CONTROL[1]=PA the average value between generation and attraction values ENDRUN

BACK …

Ch5-TDM: Ex5.2 – Alternative way with DISTRIBUTION RUN PGM=DISTRIBUTION PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5DST02A.PRN“, MSG='Example 5.2 - alternative way using DISTRIBUTION' FILEI ZDATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_future_year_5_2.dbf", Z=ZONE FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\FUTURE_ESTIMATED_TRIP_MATRIX_5_2_B.MAT", MO=1 DEC=5 NAME="Future Matrix" FILEI MATI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_2_A.MAT" PARAMETERS MAXITERS=1 ;using DISTRIBUTION syntax we have: ; P[1]= generation values for purpose [1] ; A[1]=1 not used to constrain the final matrix; ; MW[21]=tij ; ATTSUM: total of generated ; PAF= (tau)i MW[21]=MI.1.1 SETPA P[1]=ZI.1.OI A[1]=1 MW[1]=A[1]*MW[21] ATTSUM=ROWSUM(1) IF(ATTSUM>0) PAF=P[1]/ATTSUM MW[1]=PAF*MW[1] ENDRUN

BACK …

Ch5-TDM: Ex5.3 - Doubly Constrained Click on the script file boxes below to see the scripts

§

BACK …

Ch5-TDM: Ex5.3 – Doubly constrained distribution This example uses Cube’s template system §

Click on ‘Go To Editor’ in the menu below to see the script

§

BACK …

Ch5-TDM: Ex5.3 – Doubly constrained distribution RUN PGM=FRATAR PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5FRA03A.PRN“, MSG='Example 5.3 - using FRATAR "as steps from 2 to 9"' FILEI MATI[1] = {MATI.Q} FILEI LOOKUPI[1] = {LOOKUPI.Q} FILEO MATO[1] = {MATO.Q}, MO=1,NAME=FACTOREDMAT, DEC=1*5

PARAMETERS MAXRMSE=0 MAXITERS=25 ; USE A LOOKUP FILE TO find appropriate factors (1.0 is assumed unless expressly provided) LOOKUP LOOKUPI=1, LIST=Y, NAME=GROWTHF, LOOKUP[1]=ZONE,RESULT=OI, LOOKUP[2]=ZONE,RESULT=DJ, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 SETPA P[1]=GROWTHF(1,I)*100 A[1]=GROWTHF(2,I)*100 MW[1]=MI.1.1*100 CONTROL[1]=AP MW[1]=MW[1]/100 ENDRUN

This is a script generated by a template §The FILEI, FILEO and parameter settings come from the dialog on the previous slide §

BACK …

Ch5-TDM: Ex5.3 – Step 1 - Preparing trip end data RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03A.PRN“, MSG='Example 5.3 - total number of trips generated and attracted per zone' FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_3_A.MAT", MO=1 FILEO RECO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Total_#trips_gen_and_attr_Base_year_5_3.DBF", FIELDS=ZONE SUM_J SUM_I FILEI MATI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_2_A.MAT", PATTERN=IJ:V FIELDS=O D TRIPS ;read the base matrix MW[1]=MI.1.1 MW[2]=MI.1.1.T ;calculate the generated and attracted values _Generated= ROWSUM(1) ;sum over cell by row _Attracted= ROWSUM(2) RO.ZONE=I RO.SUM_J=_Generated RO.SUM_I=_Attracted ;save into table WRITE RECO=1 ENDRUN

BACK …

Ch5-TDM: Ex5.3 – Step 2 - Doubly constrained

RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03B.PRN“, MSG='Example 5.3 - step (2)' FILEO PRINTO[1] = "C:\Modelling Transport_CG\Output\Chapter5\ai_and_bj_values_5_3.txt", APPEND=T FILEI LOOKUPI[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5LOO03A.DBF" FILEI MATI[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5LOO03A.MAT", PATTERN=IJ:V FIELDS=O D TRIPS FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_3_1.MAT", MO=1 DEC=1*6 NAME="Step 2" FILEI LOOKUPI[2] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_Dj_future_year_5_3.dbf" LOOKUP LOOKUPI=1, NAME=Base, LOOKUP[1]=ZONE, RESULT=SUM_J, FAIL[3]=0 LOOKUP LOOKUPI=2, NAME=Future, LOOKUP[1]=ZONE, RESULT=OI, FAIL[3]=0 ;calculate (tau)i (as example 5.2) ;set parameters and array PAR ZONES=4 ARRAY TAU=4 ;base matrix MW[1]=MI.1.1 ;(tau)i=Ti/ti TAU[I]=Future(1,I)/Base(1,I) ;multiply base matrix per (tau)i MW[1]=MW[1]*TAU[I] PRINT PRINTO=1 LIST='Iteration: ', @IDLOOP@(L) ' Zone ', I(L), ' ai= ' ENDRUN

BACK …

TAU[I](10.5)

Ch5-TDM: Ex5.3 – Step 2 – prepare trip ends RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03D.PRN“, MSG='Example 5.3 - total number of trips after (1)' FILEO RECO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03B.DBF", FIELDS=ZONE SUM_J(10.6) SUM_I(10.6) FILEI MATI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_3_1.MAT" ;read the base matrix MW[1]=MI.1.1 MW[2]=MI.1.1.T ;calculate the generated and attracted values _Generated= ROWSUM(1) ;sum over cell by row _Attracted= ROWSUM(2) RO.ZONE=I RO.SUM_J=_Generated RO.SUM_I=_Attracted ;save into table WRITE RECO=1 ENDRUN

BACK …

Ch5-TDM: Ex5.3 – Step 3 - Doubly constrained

RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03C.PRN" MSG='Example 5.3 - step(3)' FILEO PRINTO[1] = "C:\Modelling Transport_CG\Output\Chapter5\ai_and_bj_values_5_3.txt", APPEND=T FILEI LOOKUPI[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03B.DBF" FILEI MATI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_3_1.MAT" FILEO MATO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03C.MAT", MO=1 DEC=1*6 NAME="Step 2" FILEI LOOKUPI[2] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_Dj_future_year_5_3.dbf" LOOKUP LOOKUPI=1, NAME=Base, LOOKUP[1]=ZONE, RESULT=SUM_I, FAIL[3]=0 LOOKUP LOOKUPI=2, NAME=Future, LOOKUP[1]=ZONE, RESULT=DJ, FAIL[3]=0 ;calculate (tau)j (as example 5.2 but with a transposed matrix, since we have to work on destinations) ;set parameters and array PAR ZONES=4 ARRAY TAU=4 ;base matrix MW[1]=MI.1.1.T ;this is the transposed matrix ;(tau)j=Tj/tj TAU[I]=Future(1,I)/Base(1,I) ;multiply base matrix per (tau)j MW[1]=MW[1]*TAU[I] PRINT PRINTO=1 LIST='Iteration: ', @IDLOOP@(L) ' Zone ', I(L), ' bj= ' ENDRUN

BACK …

TAU[I](10.5)

Ch5-TDM: Ex5.3 – Transpose matrix RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03E.PRN“, MSG='Example 5.3 - traspose matrix' FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_3_2.MAT", MO=1 DEC=1*6 NAME="Step 2" FILEO RECO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03C.DBF", FIELDS=ZONE SUM_J(10.6) SUM_I(10.6) FILEI MATI[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT03C.MAT" ;read the base matrix (note that next step will work on i values, the input matrix must be transposed) MW[1]=MI.1.1.T MW[2]=MI.1.1 ;calculate the generated and attracted values _Generated= ROWSUM(1) ;sum over cell by row _Attracted= ROWSUM(2) RO.ZONE=I RO.SUM_J=_Generated RO.SUM_I=_Attracted ;save into table WRITE RECO=1 ENDRUN

BACK …

Ch5-TDM: Ex5.4 - Properties of the Gravity Model Click on the script file boxes below to see the scripts §

Only first two program boxes and their scripts are shown

§

BACK …

Ch5-TDM: Ex5.4 – Create base matrix RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT14I.PRN“, MSG='Example 5.4 - matrix exp(-beta*cij)' FILEI ZDATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_Dj_future_year_5_3.dbf", Z=ZONE FILEO MATO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT14F.MAT", MO=1-2 DEC=2*5 NAME="Cost Matrix" "Exp Term" FILEO RECO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT14D.DBF", FIELDS=TOTAL_E(10.5) TOTAL_F(10.5) TAU(10.5) FILEI MATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Cost_matrix_base_year_5_4.dbf", PATTERN=IJ:V FIELDS=O D TIME ;set parameters PAR ZONES=4 ;read the base matrix MW[1]=MI.1.1 ;calculate exp(-(beta)*cij) MW[2]=exp(-{beta}*MW[1]) ;calculate the base matrix total _TOTAL=ROWSUM(2)+_TOTAL ;calculate the future matrix total _TOTAL_F=ZI.1.OI+_TOTAL_F IF(I=ZONES) ;calculate the expansion factor tau=T/t RO.TOTAL_E=_TOTAL RO.TOTAL_F=_TOTAL_F RO.TAU =_TOTAL_F/_TOTAL WRITE RECO=1 ENDIF ENDRUN

BACK …

Ch5-TDM: Ex5.4 – Gravity distribution with FRATAR This example uses Cube’s template system §Click on ‘Go To Editor’ in the menu below to see the script §

BACK …

Ch5-TDM: Ex5.4 – Gravity distribution with FRATAR RUN PGM=FRATAR PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5FRA14A.PRN“, MSG='Example 5.4 - Gravity model using "FRATAR" as steps from 3 to 9' FILEI MATI[1] = {MATI.Q} FILEI LOOKUPI[1] = {LOOKUPI.Q} FILEO MATO[1] = {MATO.Q}, MO=1,NAME=FACTOREDMAT, DEC=1*5 PARAMETERS MAXRMSE=0 MAXITERS=50 ; USE A LOOKUP FILE TO find appropriate factors (1.0 is assumed unless expressly provided) LOOKUP LOOKUPI=1, LIST=Y, NAME=GROWTHF, LOOKUP[1]=ZONE,RESULT=OI, LOOKUP[2]=ZONE,RESULT=DJ, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 MW[3]=MI.1.1 SETPA P[1]=GROWTHF(1,I)*100 A[1]=GROWTHF(2,I)*100 MW[1]=MI.1.2*100 CONTROL[1]=P MW[1]=MW[1]/100 FREQUENCY BASEMW=3,VALUEMW=1,RANGE=1-24,4,REPORT=99, TITLE='Ranges(min)' ENDRUN

This is a script generated by a template §The FILEI, FILEO and parameter settings come from the dialog on the previous slide §

BACK …

Ch5-TDM: Ex5.5 - Bi-proportional Fitting Click on the script file boxes below to see the scripts

§

BACK …

Ch5-TDM: Ex5.5 – Bi-proportional Fitting, step 1 RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5MAT05A.PRN“, MSG='Example 5.5 - create tables 5.11 and 5.13' FILEO MATO[2] = "C:\Modelling Transport_CG\Output\Chapter5\Future_estimated_trip_matrix_5_5_B.MAT", MO=2 NAME="Base Marix B" FILEO MATO[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_5.MAT", MO=1 NAME="Base Marix A" FILEI MATI[1] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_2_A.MAT" ;read the original data MW[1]=MI.1.1 MW[2]=MI.1.1 ;modify original data to perform exercises ;set to zero cells (2,1) (2,3) (2,4) and (2,2)=50 Table 5.11 JLOOP IF(I=2&&J=1,3-4) MW[1]=0 IF(I=2&&J=2) MW[1]=50 ENDJLOOP ;set to zero cells (2,1) (2,3) and (2,2)=50 (2,4)= 1 Table 5.13 JLOOP IF(I=2&&J=1,3) MW[2]=0 IF(I=2&&J=2) MW[2]=50 IF(I=2&&J=4) MW[2]=1 ENDJLOOP ENDRUN

BACK …

Ch5-TDM: Ex5.5 – Bi-proportional Fitting, step 2 This example uses Cube’s template system §

Click on ‘Go To Editor’ in the menu below to see the script

§

BACK …

Ch5-TDM: Ex5.5 – Bi-proportional Fitting, step 2 RUN PGM=FRATAR PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5FRA05A.PRN“, MSG='Example 5.5 - 100 iterations Table 5.12' FILEI MATI[1] = {MATI.Q} FILEI LOOKUPI[1] = {LOOKUPI.Q} FILEO MATO[1] = {MATO.Q}, MO=1,NAME=FACTOREDMAT, DEC=1*5

PARAMETERS MAXRMSE=0 MAXITERS=100 ; USE A LOOKUP FILE TO find appropriate factors (1.0 is assumed unless expressly provided) LOOKUP LOOKUPI=1, LIST=Y, NAME=GROWTHF, LOOKUP[1]=ZONE,RESULT=OI, LOOKUP[2]=ZONE,RESULT=DJ, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 SETPA P[1]=GROWTHF(1,I)*100 A[1]=GROWTHF(2,I)*100 MW[1]=MI.1.1*100 CONTROL[1]=AP MW[1]=MW[1]/100 ENDRUN

This is a script generated by a template §The FILEI, FILEO and parameter settings come from the dialog on the previous slide §

BACK …

Ch5-TDM: Ex5.5 – Bi-proportional Fitting, step 3 This example uses Cube’s template system §

Click on ‘Go To Editor’ in the menu below to see the script

§

BACK …

Ch5-TDM: Ex5.5 – Bi-proportional Fitting, step 3 RUN PGM=FRATAR PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E5FRA05B.PRN“, MSG='Example 5.5 - 100 iterations Table 5.13' FILEI MATI[1] = {MATI.Q} FILEI LOOKUPI[1] = {LOOKUPI.Q} FILEO MATO[1] = {MATO.Q}, MO=1,NAME=FACTOREDMAT, DEC=1*5

PARAMETERS MAXRMSE=0 MAXITERS=100 ; USE A LOOKUP FILE TO find appropriate factors (1.0 is assumed unless expressly provided) LOOKUP LOOKUPI=1, LIST=Y, NAME=GROWTHF, LOOKUP[1]=ZONE,RESULT=OI, LOOKUP[2]=ZONE,RESULT=DJ, FAIL[1]=1,FAIL[2]=1,FAIL[3]=1 SETPA P[1]=GROWTHF(1,I)*100 A[1]=GROWTHF(2,I)*100 MW[1]=MI.1.1*100 CONTROL[1]=AP MW[1]=MW[1]/100 ENDRUN

This is a script generated by a template §The FILEI, FILEO and parameter settings come from the dialog on the previous slide §

BACK …

Ch5-TDM: Ex5.6 – A Tri-proportional Click on the script file boxes below to see the scripts Problem §

BACK …

Ch5-TDM: Ex5.6 – Tri-proportional problem, step 0

RUN PGM=MATRIX PRNFILE="C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E6MAT06A.PRN“, MSG='Example 5.6 - costs and delta_ijm' FILEO MATO[2] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E6MAT06H.MAT", MO=2 NAME='Delta mij' FILEI MATI[2] = "C:\Modelling Transport_CG\Output\Chapter5\Base_year_trip_matrix_5_3_A.MAT" FILEO RECO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E6MAT06A.DBF", FIELDS=TOTAL_E(18.10) TOTAL_F(18.10) TAU(18.10) FILEI DBI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Target_TLD_future_year_5_6.dbf",SORT=RANGE_MIN RANGE_MAX FILEO RECO[2] = "C:\Modelling Transport_CG\Output\Chapter5\Delta_ijm.DBF", FIELDS=M I J DELTA FILEI ZDATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Target_Oi_Dj_future_year_5_3.dbf", Z=ZONE FILEO MATO[1] = "C:\Modelling Transport_CG\APPLICATIONS\CHAPTER5\E6MAT06A.MAT", MO=3 DEC=1*5 NAME="Base Matrix" FILEI MATI[1] = "C:\Modelling Transport_CG\Input\Chapter5\Cost_matrix_base_year_5_4.dbf", PATTERN=IJ:V FIELDS=O D TIME ;set parameters and array PAR ZONES=4 ARRAY CLASS_MIN =6 ;minimum in the n class ARRAY CLASS_MAX =6 ;maximum in the n class ;read ranges per each class IF(I=1) LOOP K=1,DBI.1.NUMRECORDS C=DBIReadRecord(1,K) MCLASS=DI.1.M RMIN =DI.1.RANGE_MIN RMAX =DI.1.RANGE_MAX CLASS_MIN[MCLASS]=RMIN CLASS_MAX[MCLASS]=RMAX ENDLOOP ENDIF

NEXT …

; script continues on NEXT page

Ch5-TDM: Ex5.6 – Tri-proportional problem, step 0 ; SCRIPT CONTINUED FROM PREVIOUS PAGE ;read base cost matrix MW[1]=MI.1.1 ;costs in minutes MW[3]=1 ;create the 3-dimension matrix for i, j and m with: ; 1 - if cost for the cell is in class m ; 0 - if cost for the cell is not in class m ;note: ; the same information can be represented by an i-j matrix where the od value is the class ; to make more efficient the application has been applied this representation. ; loop over classes LOOP T=1,6 JLOOP IF(I=1&&J=2) MW[2]=3 RO.M=T RO.I=I RO.J=J RO.DELTA=1 WRITE RECO=2 ELSEIF(I=2&&J=3) MW[2]=4 RO.M=T RO.I=I RO.J=J RO.DELTA=1 WRITE RECO=2 ; script continues on NEXT page

NEXT …

Ch5-TDM: Ex5.6 – Tri-proportional problem, step 0 ; SCRIPT CONTINUED FROM PREVIOUS PAGE ELSEIF(I=3&&J=1) MW[2]=5 RO.M=T RO.I=I RO.J=J RO.DELTA=1 WRITE RECO=2 ELSEIF(CLASS_MIN[T]
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF