~o|16 ~?!i&32768 ~o=7 ~o|32 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1997. 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.2 - A macro to compare the networks of two EMME/2 scenarios ~/ (Heinz Spiess, Haldenstrasse 16, CH-2558 Aegerten, Switzerland 97-12-10) ~/ ~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 ~?z>0 ~$>start ~/ The macro NETDIFF compares the networks of the two scenarios given ~/ as arguments and reports nodes, links and/or lines 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 node, link or line attributes for ~/ which to perform value comparisons ~/ option flags: -nodes do not compare nodes ~/ -links do not compare links ~/ -lines do not compare transit lines ~/ (several flags can be given) ~/ 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] ~/ (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. ~/ - This macro assumes the existence of an external "echo" command, as ~/ the one that is available under DOS and UNIX. ~/ ~/*************************************************************************** ~$>end ~:start ~/*************************************************************************** ~x=7 ~t3=%s% / save current scenario ~:options ~t1=%1% ~?t1=-nodes ~+|~x&30|~%|~$options ~?t1=-links ~+|~x&29|~%|~$options ~?t1=-lines ~+|~x&27|~%|~$options ~?x=0 ~+|~/Nothing to compare!|~$end ~z=%0% ~?z<2 ~$end ~t2=%2% ~?t1=%t2% ~+|~/Two different scenarios must be specified!|~$end ~+|~t8=|~p=2004|~?p=1|~t8=' ~p=2010 ~t7=%p% ~p=2009 ~t7======== NETDIFF: Comparing scenario %t1% with %t2% (%d% %p%h%t7%) ===================== ~/ ~/Comparing networks of scenarios %1% and %2%: ~!echo %t8.1%==========================================================================%t8.1% >>netdiff.out ~!echo %t8.1%%t7_74%%t8.1% >>netdiff.out ~y=0 / counter for g-registers ~:compare batchout=netdiff.out s=%t1% / switch to scenario 1 ~?e ~+|~/Scenario %t1% does not exist!|~$done ~!echo %t8.1%Elements in scenario %t1% and not in %t2%:%t8.1% >>netdiff.out 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 q ~?t1=%2% ~$attributes ~t1=%2% ~t2=%1% ~$compare ~:attributes ~!echo %t8.1%Differing attribute values (scen %t1% values in tmpX1, diffs in tmpX3):%t8.1% >>netdiff.out ~z=%0% ~?z>2 ~/Differences in attribute values: s=%t2% 2.41 / now compare attribute given as arguments, if any ~?x&1 ~+|2|%t1%|i|tmpi2|all / copy node numbers from scenario %t1% ~?x&2 ~+|2|%t1%|typ|tmpl2|all / copy link types numbers from scenario %t1% ~?x&4 ~+|2|%t1%|hdw|tmpt2|all / copy line headways from scenario %t1% ~+|5|n|n|n|n|'r' / change module parameters ~:values ~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%!||~%|~$values ~?x&1 ~+|~t6=inodes|tmpi1|~?!e|~$>attok ~?x&2 ~+|~t6=llinks|tmpl1|~?!e|~$>attok ~?x&4 ~+|~t6=tlines|tmpt1|~?!e|~$>attok ~+|~/Invalid attribute %3%!||~%|~$values ~:attok all 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!=0))) +(tmp%t6.1%1-%3%)*(tmp%t6.1%2!=0) ~?e / attribute %3% not available in scenario %t2% ~+|~/Attribute %3% not available in scenario %t2%!|~?q=0||~%|~$values all 3 ~ry=%gy% ~/%ry_5% %t6.-1% with different values of attribute %3% ~+|1|y|tmp%t6.1%3|0||all|4 / reinitialize temporary attribute for differences ~% ~$values ~:quit q ~:summary ~!echo %t8.1%Summary:%t8.1% >>netdiff.out ~?x&1 ~!echo %t8.1%%r1_5% nodes in scenario %t2% but not in scenario %t1%%t8.1% >>netdiff.out ~?x&2 ~!echo %t8.1%%r2_5% links in scenario %t2% but not in scenario %t1%%t8.1% >>netdiff.out ~?x&4 ~!echo %t8.1%%r3_5% lines in scenario %t2% but not in scenario %t1%%t8.1% >>netdiff.out ~?x&1 ~!echo %t8.1%%r4_5% nodes in scenario %t1% but not in scenario %t2%%t8.1% >>netdiff.out ~?x&2 ~!echo %t8.1%%r5_5% links in scenario %t1% but not in scenario %t2%%t8.1% >>netdiff.out ~?x&4 ~!echo %t8.1%%r6_5% lines in scenario %t1% but not in scenario %t2%%t8.1% >>netdiff.out ~t0=%t4% ~y=6 ~:nextat ~?t0= ~$done ~y+1 ~!echo %t8.1%%ry_5% %1% with different values of attribute %2%%t8.1% >>netdiff.out ~% ~% ~$nextat ~:done ~!echo %t8.1%==========================================================================%t8.1% >>netdiff.out ~/ ~/*************************************************************************** s=%t3% batchout=^ ~:end ~o=6 ~:very_end