~o|16 ~?!i&32768 ~o=7 ~o|32 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1997-99. 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 ~z=%0% ~/*************************************************************************** ~/ NETDIFF 1.3 - A macro to compare the networks of two EMME/2 scenarios ~/ (Heinz Spiess, Haldenstrasse 16, CH-2558 Aegerten, Switzerland 99-10-18) ~/ ~p=2001 ~?!p=1 ~+|~/This macro can only be used with EMME/2!|~$>very_end ~?!m=000 ~+|~/This macro must be started at the EMME/2 main menu!|~$>very_end ~?!q=0 ~+|~/This macro must be started at the EMME/2 main menu!|~$>very_end ~p=50 ~x=%p% ~?x<9 ~+|~/This macro requires EMME/2 version 9 or higher!|~$very_end ~?z>0 ~$>start ~/ The macro NETDIFF compares the networks of the two scenarios given ~/ as arguments and reports nodes, links, lines, segments and/or turns ~/ which exist only in one or the other scenario. A summary is displayed ~/ on the screen and a list of all such elements is written to the output ~/ file netdiff.out. Optionally, the macro will also compare the values ~/ of given network attributes for those elements which are contained in ~/ both scenarios. ~/ ~/ Calling sequence: ~ [ ...] ~/ where: , scenarios to compare ~/ , , ... optional network attributes for which to ~/ perform value comparisons ~/ option flags: -nodes -links -lines -segments -turns ~/ if one or several of these option are specifies, ~/ the correponding elements are *not* compared ~/ The output file netdiff.out contains the following sections ~/ - elements in scenario which are not contained in ~/ - elements in scenario which are not contained in ~/ - for each attribute specified the elements with differing values ~/ Notes: ~/ - Temporary data used by NETDIFF: tmpi[123], tmpl[123], tmpt[123], ~/ tmps[123], tmpp[123] (there must be enough temporary spece in ~/ file 95 to create these). ~/ - If the output file netdiff.out already exists the new results are ~/ simply appended to it. ~/ - Due to the limited size of text registers, the maximum number of ~/ attributes is somewhere around 10. For more attributes, the task ~/ has to be split into several runs. ~/*************************************************************************** ~$>end ~:start ~/*************************************************************************** ~x=31 ~t3=%s% / save current scenario ~:options ~t1=%1% ~?t1=-nodes ~+|~x&30|~%|~$options ~?t1=-links ~+|~x&29|~%|~$options ~?t1=-lines ~+|~x&27|~%|~$options ~?t1=-segments ~+|~x&23|~%|~$options ~?t1=-turns ~+|~x&15|~%|~$options ~?x=0 ~+|~/Nothing to compare!|~$end ~z=%0% ~?z<2 ~$end ~t2=%2% ~?t1=%t2% ~+|~/Two different scenarios must be specified!|~$end ~p=2010 ~t7=%p% ~p=2009 ~t7======== NETDIFF: Comparing scenario %t1% with %t2% (%d% %p%h%t7%) ===================== ~/ ~/Comparing networks of scenarios %1% and %2%: ~>>netdiff.out ~+|~>>netdiff.out|~"==========================================================================|~> ~+|~>>netdiff.out|~"%t7_74%|~> ~y=0 / counter for g-registers ~:compare batchout=netdiff.out s=%t1% / switch to scenario 1 ~?e ~+|~/Scenario %t1% does not exist!|~$done ~+|~>>netdiff.out|~"Elements in scenario %t1% and not in %t2%:|~> 2.41 / network calculator ~+|5|n|n|n|n|'r' / change module parameters ~y+1 / compare nodes (only if requested) ~?!x&1 ~$nodes_done 2 / compare nodes %t2% ~?e ~+|~/Scenario %t2% does not exist!||q|~$done i / copy node numbers of scen %t2% to tmpi1 of scen %t1% tmpi1 all 1 / now list all nodes in scen %t1% that are not in scen %t2% y tmpi1 0*(xi+yi+ui1+ui2+ui3) +0*put(get(puti(%y%))+(tmpi1==0)) +(tmpi1==0)*i+tmpi1 all 3 ~ry=%gy% ~/%ry_5% nodes in scenario %t1% but not in scenario %t2% ~:nodes_done ~y+1 / compare links (only if requested) ~?!x&2 ~$links_done 2 / compare links %t2% type / copy link types of scen %t2% to tmpl1 of scen %t1% tmpl1 all 1 / now list all links in scen %t1% that are not in scen %t2% y tmpl1 0*(len+type+lan+vdf+ul1) +0*put(get(puti(%y%))+(tmpl1==0)) +(tmpl1==0)*type+tmpl1 all 3 ~ry=%gy% ~/%ry_5% links in scenario %t1% but not in scenario %t2% ~:links_done ~y+1 / compare transit lines (only if requested and there are any) ~?!x&4 ~$lines_done ~p=1005 ~?p=0 ~x&27 ~?p=0 ~$lines_done 2 / compare transit lines %t2% hdw / copy line headways of scen %t2% to tmpt1 of scen %t1% tmpt1 all 1 / now list all lines in scen %t1% that are not in scen %t2% y tmpt1 0*(hdwy+speed+ut1+ut2+ut3) +0*put(get(puti(%y%))+(tmpt1==0)) +(tmpt1==0)*hdwy+tmpt1 all 3 ~ry=%gy% ~/%ry_5% lines in scenario %t1% but not in scenario %t2% ~:lines_done ~y+1 / compare transit segments (only if requested and there are any) ~?!x&8 ~$segments_done ~p=1006 ~?p=0 ~x&23 ~?p=0 ~$segments_done ~+|1|y|tmps1|-999||all|all|4 / initialize tmps1 to -999 2 / compare transit line segments %t2% ttf / copy TTFs of scen %t2% to tmps1 of scen %t1% tmps1 all all 1 / now list all segments in scen %t1% that are not in scen %t2% y tmps1 0*(ttf+dwt+dwfac+noboa+noali+us1+us2+us3) +0*put(get(puti(%y%))+(tmps1==-999)) +(tmps1==-999)*ttf+(tmps1!=-999)*tmps1 all all 3 ~ry=%gy% ~/%ry_5% segments in scenario %t1% but not in scenario %t2% ~:segments_done ~y+1 / compare turns (only if requested and there are any) ~?!x&16 ~$turns_done ~p=1004 ~?p=0 ~x&15 ~?p=0 ~$turns_done ~+|1|y|tmpp1|-999||all|all|4 / initialize tmpp1 to -1 2 / compare turns %t2% tpf / copy turn penalty functions of scen %t2% to tmpp1 of scen %t1% tmpp1 all all 1 / now list all turns in scen %t1% that are not in scen %t2% y tmpp1 0*(tpf+up1+up2+up3) +0*put(get(puti(%y%))+(tmpp1==-999)) +(tmpp1==-999)*tpf+(tmpp1!=-999)*tmpp1 all all 3 ~ry=%gy% ~/%ry_5% turns in scenario %t1% but not in scenario %t2% ~:turns_done q ~?t1=%2% ~$attributes ~t1=%2% ~t2=%1% ~$compare ~:attributes ~+|~>>netdiff.out|~"Differing attribute values (scen %t1% values in tmpX1, diffs in tmpX3):|~> ~z=%0% ~?z<3 ~$summary ~?z>2 ~/Differences in attribute values: s=%t2% ~:values 2.41 / now compare attribute given as arguments, if any ~z=%0% ~?z<3 ~$quit 2 / compare values of attribute %3% %t1% %3% / copy attribute %3% of scen %t1% to tmpl1 of scen %t2% ~?e ~+|~/Attribute %3% not available in scenario %t1%!||~%|q|~$values ~?x&1 ~+|~t5=0|~t6=inodes|tmpi1|~?!e|~$>attok ~?x&2 ~+|~t5=0|~t6=llinks|tmpl1|~?!e|~$>attok ~?x&4 ~+|~t5=0|~t6=tlines|tmpt1|~?!e|~$>attok ~?x&8 ~+|~t5=-999|~t6=ssegments|tmps1|~?!e|~$>attok ~?x&16 ~+|~t5=-999|~t6=pturns|tmpp1|~?!e|~$>attok ~+|~/Invalid attribute %3%!||~%|q|~$values ~:attok all ~?q=0 all ~?t6=inodes ~+|2|%t1%|i|tmpi2|all / copy node numbers from scenario %t1% ~?t6=llinks ~+|2|%t1%|typ|tmpl2|all / copy link types numbers from scenario %t1% ~?t6=tlines ~+|2|%t1%|hdw|tmpt2|all / copy line headways from scenario %t1% ~?t6=ssegments ~+|1|y|tmps2|-999||all|all|4|2|%t1%|ttf|tmps2|all|all / copy transit time functions from scenario %t1% ~?t6=pturns ~+|1|y|tmpp2|-999||all|all|4|2|%t1%|tpf|tmpp2|all|all / copy turn penalty functions from scenario %t1% ~+|5|n|n|n|n|'r' / change module parameters 1 / now list all elements with different values y tmp%t6.1%3 ~t4=%t4% %t6.-1% %3% ~y+1 0*put(get(puti(%y%))+((%3%!=tmp%t6.1%1)&&(tmp%t6.1%2!=%t5%))) +(tmp%t6.1%1-%3%)*(tmp%t6.1%2!=%t5%) ~?e / attribute %3% not available in scenario %t2% ~+|~/Attribute %3% not available in scenario %t2%!|~?q=0||~%|q|~$values all ~?q=0 all 3 ~ry=%gy% ~/%ry_5% %t6.-1% with different values of attribute %3% ~% q ~$values ~:quit q ~:summary ~+|~>>netdiff.out|~"Summary:|~> ~?x&1 ~+|~>>netdiff.out|~"%r1_5% nodes in scenario %t2% but not in scenario %t1%|~> ~?x&2 ~+|~>>netdiff.out|~"%r2_5% links in scenario %t2% but not in scenario %t1%|~> ~?x&4 ~+|~>>netdiff.out|~"%r3_5% lines in scenario %t2% but not in scenario %t1%|~> ~?x&8 ~+|~>>netdiff.out|~"%r4_5% segments in scenario %t2% but not in scenario %t1%|~> ~?x&16 ~+|~>>netdiff.out|~"%r5_5% turns in scenario %t2% but not in scenario %t1%|~> ~?x&1 ~+|~>>netdiff.out|~"%r6_5% nodes in scenario %t1% but not in scenario %t2%|~> ~?x&2 ~+|~>>netdiff.out|~"%r7_5% links in scenario %t1% but not in scenario %t2%|~> ~?x&4 ~+|~>>netdiff.out|~"%r8_5% lines in scenario %t1% but not in scenario %t2%|~> ~?x&8 ~+|~>>netdiff.out|~"%r9_5% segments in scenario %t1% but not in scenario %t2%|~> ~?x&16 ~+|~>>netdiff.out|~"%r10_5% turns in scenario %t1% but not in scenario %t2%|~> ~t0=%t4% ~y=10 ~:nextat ~?t0= ~$done ~y+1 ~+|~>>netdiff.out|~"%ry_5% %1% with different values of attribute %2%|~> ~% ~% ~$nextat ~:done ~+|~>>netdiff.out|~"==========================================================================|~> ~/ ~/*************************************************************************** s=%t3% batchout=^ ~:end ~o=6 ~:very_end