~o=40 ~?!i&32768 ~o=263 ~/*********************************************************************** ~/*** TCHAIN3: ACTIVITY CHAINING DEMAND MODEL FOR 3 LEG TRIPS (1.3) *** ~/*** (Copyright (C) 1993 - Heinz Spiess, Aegerten, Switzerland) *** ~/*********************************************************************** ~$>skipnotice !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I herewith grant the right to use this macro to all EMME/2 users, provided the following conditions are met: 1) The macro cannot be sold for a fee (but it can be used and distributed within consulting projects). 2) The user is aware that this macro is not a part of the EMME/2 software licence and there is no explicit or implied warranty or support provided with this macro. 3) This notice and the comments in this macro must not be removed. 4) Any additions or modification made by anyone else but me must be clearly identified as such, including date, name and the reason of the modification. Aegerten, February 26, 1993 Heinz Spiess !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~:skipnotice ~t3=ul3 ~/*** ~/*** This EMME/2 macro implements logit demand model for activity ~/*** chains of cardinality 3 (such as HOME-WORK-SHOPPING-HOME). The ~/*** demand on a particular chain pqrp is given by the formula: ~/*** ~/*** C * A * C * B * C ~/*** pq q qr r rp ~/*** G = T ------------------------------------------- ~/*** pqrp p ---- ~/*** \ C * A * C * B * C ~/*** / pq' q' q'r' r' r'p ~/*** ---- ~/*** q'r' ~/*** (The mathematical details are described in the note "Computing Activity ~/*** Chain Based Trip Distribution Models", available from the author.) ~/*** ~/*** Requirements: ~/*** - Macro is started from main menu and needs EMME/2 Release 7.0. ~/*** - Assignment reports are appended to the file tchain3.rep ~/*** ~/*** Calling sequence: ~/*** ~
~/*** where the first 4 parameters specify the input matrices: ~/*** Tp trip chain production at origin p (moXX) ~/*** Aq Attractivity of first intermediate zone q (mdXX) ~/*** Br Attractivity of second intermediate zone r (mdXX) ~/*** Cpq conductivity matrix for travel between p and q (mfXX) ~/*** (for logit models usually exp(-const*Upq)) ~/*** and the last 4 parameters specify the result matrices: ~/*** Gq first destination attractions (moXX) ~/*** Gr second destination attractions (moXX) ~/*** Gpq first leg demand matrix (mfXX) ~/*** Gqr second leg demand matrix (mfXX) ~/*** Grp third leg demand matrix (mfXX) ~/*********************************************************************** ~x=%m% /test if started from main menu ~x+%q% ~?x>0 ~$stop ~x=%0% ~?x=0 ~$stop ~y=3 /test if enough parameters are provided ~?x<9 ~$error c='START tchain3 %1% %2% %3% %4% %5% %6% %7% %8% %9%' ~p=2005 ~t1=%p% ~/================ TCHAIN3: 3 LEG ACTIVITY CHAIN DEMAND MODEL =========== ~/Input vectors: Tp Trip chain production: %1% ~/ Aq Attractivity of first intermediate zone: %2% ~/ Br Attractivity of second intermediate zone: %3% ~/ Cpq Conductivity matrix: %4% ~/Result vectors: Gq First intermediate zone totals: %5% ~/ Gr Second intermediate zone totals: %6% ~/Result matrices: Gpq First leg demand matrix: %7% ~/ Gqr Second leg demand matrix: %8% ~/ Grp Third leg demand matrix: %9% ~/ ~/Computations: reports=tchain3.rep ~+|~x=1|~/%%%x%%%) Transpose of conductivity matrix into %9% 3.12 4 3 %4% %9% y Cqp transposed conductivity matrix ~?q=1 y 0 q ~+|~x+1|~/%%%x%%%) Second destination convolution into %7% 3.23 1 %9% * %9% n * n %3% + %7% y CBC sumq Crq Bq Cqp ~?q=1 y 0 n y 2 q 3.21 1 y %7% y Wpq first leg weights n %4%*%2%*%7% n ~?q=2 2 1 y %5% y Sp sumrq Cpq Aq Cqr Br Crp ~?q=1 y 0 %7% n + ~?q=2 2 1 y %5% y Sp (sumrq Cpq Aq Cqr Br Crp)/Gp n %1%/(%5%+.0001*(%5%==0)) n ~?q=2 2 ~+|~x+1|~/%%%x%%%) First leg demand matrix into %7% 1 y %7% y Gpq First leg demand matrix n %7%*%5% n ~?q=2 2 q ~+|~x+1|~/%%%x%%%) Origin convolution into %8% 3.23 1 %9% * %9% n * n %5% + %8% y CSC sumq Cqp 1/Sq Crq ~?q=1 y 0 n y 2 q ~+|~x+1|~/%%%x%%%) Second leg demand matrix into %8% 3.21 1 y %8% y Gqr Second leg demand matrix n %2%'*%3%*%4%*%8% n ~?q=2 2 q ~+|~x+1|~/%%%x%%%) First destination convolution into %9% 3.23 1 %4% * %4% n * n %2% + %9% y CAC sumq Cqr Aq Cpq ~?q=1 y 0 n y 2 q ~+|~x+1|~/%%%x%%%) Transpose of third leg convolution matrix %9% 3.12 4 3 %9% %9% y C'AC' sumq Crq Aq Cqp n q ~+|~x+1|~/%%%x%%%) Third leg demand matrix into %9% 3.21 1 y %9% y Grp Third leg demand matrix n %4%*%3%'*%5%'*%9% n ~?q=2 2 ~+|~x+1|~/%%%x%%%) First intermediate zone totals into %5% 1 y %5% y Gq First intermediate zone totals ~?q=1 y 0 %8% n + ~?q=2 2 ~+|~x+1|~/%%%x%%%) Second intermediate zone totals into %6% 1 y %6% y Gr Second intermediate zone attractions ~?q=1 y 0 %9% n + ~?q=2 2 q reports=^ c='END tchain3 %1% %2% %3% %4% %5% %6% %7% %8% %9%' ~+|~p=2005|~y=%%%p%%%|~y-%t1%|~y/10 ~/ ~/Macro TCHAIN3 terminated normally using %y% CPU seconds ~/======================================================================= ~$stop ~:error ~/ ~?y=3 ~/Invalid number of macro parameters! ~:stop ~o=6