~?!i&32768 ~o=295 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1999. All rights reserved. ~/ ~/The right to use this macro is granted 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 ~/ without charge 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) The comments in this macros must not be removed and any additions or ~/ modification must be appropriately identified as such and give at least ~/ date, name and the reason of the modification. ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~:end_of_copyright ~/========================================================================= ~/ SELINES 1.3 - "Select Lines" transit assignment for arbitrary line set ~/ (Heinz Spiess, EMME/2 Support Center, CH-2558 Aegerten - 2003-02-04) ~/ ~/ This macro performs a two-step transit assignment to compute the ~/ volumes and demand matrix of the trips using at least one line in ~/ from the specified set of lines. ~/ ~/ Calling sequence: ~/ ~ [] ~/ where: Transit demand matrix ~/ Transit line selection clause for first set of lines ~/ Resulting active demand matrix containing the trips ~/ using at least one of the selected lines (optional); ~/ must be specified with matrix number, e.g. mf67. ~/ ~/ ~/ Notes: ~/ 1) The transit assignment parameters are contained in text register t1 in ~/ the form of a compound macro statement. They can be set to different ~/ values in the calling macro - otherwise the values coded in this ~/ macro are used. ~/ 2) The full matrix mf"tmp1" is used to store intermediate results. ~/ If it exists already, its old contents will be lost. ~/ 3) The transit line extra attribute @selxx is for temporary storage. ~/ If a extra attribute with the same name exists already, it will ~/ will be erased. ~/========================================================================== ~x=%0% ~?x<2 ~$>end_of_macro ~# if t1 is empty (i.e no calling macro provided any values), then set ~# t1 to the (Winnipeg) default values ~?t1= ~t1=~+|*|1|1|2.5|1|0.5|2|2|2 ~/ ~+|~/ Demand matrix: %1% %%%%1%.n%%% %%%%1%.d%%% ~/ Selected line subset: %2% ~t2=%3% ~?t2= ~/ Active demand matrix: not saved! ~?!t2= ~/ Active demand matrix: %3% ~/ Assignment parameters: %t1.-3% ~/ ~#-------------------------------------------------------------------------- ~/ Step 0: Checking if specified line set is valid 2.41 / Check if specified line set is valid ~+|1|n|0*hdw+put(get(1)+1)||%2%|~?e|~#|~?q=0||5 ~/ Set "%2%" contains %g1% transit lines. ~?g1=0 ~+|q|~/ Invalid line set specification!|~$end_of_macro q ~/ Create transit line attribute @selxx 2.42 / Extra attributes ~?e ~+|~/ Cannot enter module 2.42! (No extra attribute in this data bank?)|q|~$end_of_macro ~+|3|@selxx|~?e||~?q=1|y|2|3 ~?e ~+|~/ Cannot create extra attribute @selxx! (Extra attribute table full?)|q|~$end_of_macro ~+|@selxx|tr. line set (selines)||q 3.12 / matrix manipulations ~/ Delete temporary matrix mf"tmp1" - if any ~+|2|mf"tmp1"|~?e||~?q=1|y ~?t2= ~$>don't_save_demand ~/ Checking if result matrix %3% is valid ~+|3|%3% ~?e ~+|~/ Cannot access matrix %3%!||q|~$end_of_macro ~?q=1 ~+|y|actdem|still empty (selines)|0 ~+|3||still empty (selines) ~:don't_save_demand ~/ Create temporary matrix mf"tmp1" ~+|1|mf"tmp1" ~?e ~+|~/ Cannot create matrix mf"tmp1"!||q|~$end_of_macro ~+|y|temporary matrix (selines)|0|q ~#-------------------------------------------------------------------------- ~/ Step 1: Compute full transit assignment ~#specify special report file reports=selines.rep 5.11 / Perform basic transit assigment without additional options (ALL) ~+|2|~?q=2|2|%1%||||||| %t1% ~# compute all matrix of all assignable trips ~+|y|@selxx||||2|.max.|||mf"tmp1"|~?q=1|y||neg. demand -%1%|~?q=1|y| ~+|5.31|~?q=2|2 3.21 / Matrix computations to compute negative demand matrix ~+|1|y|mf"tmp1"|n ~+|put(0-mf"tmp1")+0*put(get(2)-get(1))+0*put(get(3)+%1%+get(1))|||n|~?q=2|2 ~r1=%g2% ~r5=%g3% ~r6=%r5% ~r6+%r1% q ~/ Total demand: %r6_10% trips ~/ Unassignable demand: %r5_10% trips ~/ Assignable demand: %r1_10% trips ~#-------------------------------------------------------------------------- ~/ Step 2: Subtract trips not using any line in "%2%" 2.41 / Network calculation for @selxx=1 for "%2%" ~+|1|y|@selxx|n|0||all|5|r ~+|1|y|@selxx|n|1||%2%||5|q 5.11 / Perform additional options assigment NOTUSE(%2%) ~+|2|~?q=2|1|mf"tmp1"||||||| %t1% ~+|y|@selxx||||2|.max.|0,0||%t2%|~?q=1|n ~+|5.31|~?q=2|2 ~+|2.41|1|n|put(get(1)+volax)||ci=1||5|~r2=%%%g1%%%|q ~/ Active demand: %r2_10% trips in outgoing connector links ~?!t2= ~+|3.21|1|y|%t2%|y||'selines: D1-D2'|n|put(%t2%-mf"tmp1")+0*put(get(1)+get(2))|||n|~?q=2|2|~r3=%%%g2%%%|q ~?!t2= ~/ %r3_10% trips in active demand matrix %t2% ~+|2.41|1|n|put(get(1)+board)||%2%||all|5|~r4=%%%g1%%%|q ~/ Boardings: %r4_10% boardings to lines "%2%" ~#-------------------------------------------------------------------------- reports=^ ~:done ~/========================================================================= ~/ ~/ Macro SELINES terminated normally. The scenario now contains transit ~/ volumes of those trips who use at least one of the lines "%2%". ~?!t2= ~/ The corresponding partial demand matrix is stored in %3%. ~/ ~/========================================================================= ~:end_of_macro ~o=6