~o|16 ~?!i&32768 ~o=295 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1997. All rights reserved. ~/ mailto:heinz@spiess.ch http://www.spiess.ch/emme2/ ~/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 ~/========================================================================= ~/NETHIST 1.1 - Heinz Spiess, EMME/2 Support Center, CH-2558 Aegerten ~/ ~/NETHIST calculates a arbitrary network histogram of up to 248 classes, ~/i.e. it accumulates for each class of the specified classification ~/the values of a given expression. ~/ ~/Usage: nethist [] [] ~/ ~/where: : expression for the values to be accumulated ~/ : expression for the classification to be used ~/ : optional interval value if is not a class index ~/ but a continuous variable which is to by discretized ~/ by an interval (value must be > 0) ~/ : type of output to be generated: ~/ "list": list values on screen (default) ~/ "file ": write values on file ~/ "plot": generate a "histogram" plot using ~/ module 4.13 ~/ "plot [a-z]": same as above, but an annotation ~/ is automatically generated and ~/ displayed with the given letter ~/ which contains the plot legends ~y=%0% ~?y>1 / check if enough parameters are provided ~$>start_macro ~t9=~*Do you want to see more detailed instructions? ~t9=%t9.1% ~?!t9=y ~$>end_of_macro ~/Notes: ~/ - The expressions and must not contain any blanks. ~/ - If no interval is specified, the class expression must yield ~/ class index values between 1 and 248. ~/ - If an interval value is specified, the lowest interval start with ~/ value 0 and the interval should be chosen not to exceed 248 classes. ~/ - Intervals include the lower limit and exclude the upper limit. ~/ - When generating a plot, a temporary user function is created using ~/ the maximum function index (overwritten if it already exists). ~/ - The option for writing the results into a file assume the existence ~/ of an "echo" command, as those available under DOS and UNIX. ~/Examples: ~/a) List the auto vehicle hours by volume-delay function type: ~/ ~end_of_macro ~:start_macro ~/========================================================================= ~/Accumulated values: %1% ~/Classification: %2% ~t3= ~r1=0%3% ~?r1>0 ~t3=%r1% ~?!t3= ~+;~t4=%4%;~t5=%5%;~/Interval: %t3% ~?t3= ~+;~t4=%3%;~t5=%4% ~/========================================================================= 2.41 /network calculations to accumulate class values 1 n /don't save results put(get(puti( ~?t3= int(%2%)+1 ~?!t3= (%2%)/%t3%+2.00001 ))+( %1% )) ~?e ~+;~/Error in value or class expression!;;q;~$>end_of_macro ~+;*;~?q=0;~$ 5 r ~x=0 /copy the (volatile) g-registers into the corresponding r-registers ~+;~x+1;~rx=%%%gx%%%;~?x<250;~$ q ~x=1 ~g3=0 /compute total of all classes ~+;~x+1;~g3+%%%rx%%%;~?x<249;~$ ~g3*.01 ~:::::::::::: list histogram values numerically on the screen ::::::::::::: ~t6=%%%t3%%% ~?t4= ~t4=list ~?!t4=list ~$>generate_file ~x=0 ~z=1 ~?t3= ~/Class: Value: ~?t3= ~+;~x+1;~z+1;~g4=%%%rz%%%;~g4/%%%g3%%%;~?!rz=0;~/%%%x_4%%% %%%rz_10%%% %%%g4.2_8%%%%;~?z<249;~$ ~?t3= ~+;~g3*100;~/Total: %%%g3_10%%% ~?!t3= ~+;~g1=0;~g2=%t3%;~/ Interval: Value: ~?!t3= ~+;~x+1;~z+1;~g4=%%%rz%%%;~g4/%%%g3%%%;~?!rz=0;~/%%%g1_6%%% -%%%g2_6%%% %%%rz_10%%% %%%g4.2_8%%%%;~g1+%t6%;~g2+%t6%;~?z<249;~$ ~?!t3= ~+;~g3*100;~/ Total: %%%g3_10%%% ~$>end_of_macro ~:::::::::::: write histogram values into the specified file ::::::::::::: ~:generate_file ~?!t4=file ~$>generate_plot ~x=0 ~z=1 ~y=1 ~?t5= ~t5=nethist.out ~+;~t7=~!echo ;~t8=>>%t5% ~p=2004 ~?p=1 ~+;~t7=~!echo ';~t8='>>%t5% %t7%File %t5%: generated %d% by macro "~end_of_macro ~:::::::::::: generate histogram plot using module 4.13 ::::::::::::::::::: ~:generate_plot ~?!t4=plot ~$>invalid_output_type 4.12 / create a temporary user function ~p=59 / using largest function index available ~?t3= ~+;4;fu%p%;;~?e;r;~?q=1;y;2;fu%p%;get(nint(x0)+1);;;q ~?!t3= ~+;4;fu%p%;;~?e;r;~?q=1;y;2;fu%p%;get(x0/%t3%+2);;;q ~t5=%t5.1% ~?t5z ~t5= ~?t5= ~$>no_legend ~+;~t7=~!echo ;~t8= ~p=2004 ~?p=1 ~+;~t7=~!echo ';~t8=' %t7%c 2 %t8%>annot%t5% %t7%s -12 %t8%>>annot%t5% %t7%t 450 63 %2% %t8%>>annot%t5% %t7%s 12 %t8%>>annot%t5% %t7%t 65 707 %1% %t8%>>annot%t5% %t7%c 1 %t8%>>annot%t5% %t7%s 6 %t8%>>annot%t5% %t7%t 720 53 Plot generated by macro NETHIST%t8%>>annot%t5% ~:no_legend 4.13 / now display the histogram with module 4.13 ~+;2;2000;;;;n / increase no. of points in module parameters ~x=0 / copy r-registers into g-registers ~+;~x+1;~?!rx=0;~y=%%%x%%%;~gx=%%%rx%%%;~?x<250;~$ ~r1=%y% ~?!t3= ~+;~r1-.9;~r1*%t3% ~p=59 / using largest function index available ~+;1;~o=0;fu%p%;x0;0 %%%r1%%%;n;y;~?!t5=;a%t5% ~$done ~:invalid_output_type ~/Invalid output specifier "%t4%"! ~:end_of_macro ~/========================================================================= ~o=6 ~:done