~o|16 ~?!i&32768 ~o=295 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1998. 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 ~/========================================================================= ~/ANG2TPF 1.1 - Heinz Spiess, EMME/2 Support Center, CH-2558 Aegerten ~/ ~/ANG2TPF sets the turn penalty function index (tpf) of all turns within ~/the specified range of turning angles to the specified tpf value. ~/If required, a subset of turns (or intersections) can be selected by the ~/optional specification of a link selection clause for the incoming and the ~/outgoing links. All tpf values of turns outside the specified angle range ~/(as well all those not selected, if applicable) remain unchanged. ~/ ~/Usage: ang2tpf [ []] ~/ ~/where: : turn penalty function index (can also be an arbitrary ~/ network calculator expression) ~/ : lower threshold for turn angle in degrees (exclusive) ~/ : upper threshold for turn angle in degrees (inclusive) ~/ : selection of incoming links (default="all") ~/ : selection of outgoing links (default="all") ~/ ~y=%0% ~?y>2 / 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 ~/ ~/Turning angles are specified in degrees and use values in the range ~/between -180 and +180. Positive values always imply right turns, whereas ~/negative values imply left turns. ~/ ~/U-turns always have a turning angle of -180 degrees. U-turns can be ~/selected by the turning angle interval "-181 -180". ~/ ~/For a tpf value to be modified, the turning angle Aijk of the turn ~/must satisfy (Aijk > angle1) and (Aijk <= angle2). ~/ ~/Examples: ~/a) Set tpf=7 for all left turns with a turning angle between -135 and ~/ -45 degrees: ~end_of_macro ~:start_macro ~/========================================================================= ~/Turn penalty function index: %1% ~r1=%2% ~r2=%3% ~/Range of turning angles: (%r1%,%r2%] ~t1=%4% ~?!t1= ~/Selected incoming links: %4% ~t1=%5% ~?!t1= ~/Selected outgoing links: %5% ~+|~?r1>180|~$>invalid_angle ~+|~?r1<-181|~$>invalid_angle ~+|~?r2>180|~$>invalid_angle ~+|~?r2<-181|~$>invalid_angle ~/========================================================================= 2.41 /network calculations to change tpf values 1 y /don't save results tpf put((put(180.*atan(put((xk-xj)*(yj-yi)-(yk-yj)*(xj-xi))/ put((xk-xj)*(xj-xi)+(yk-yj)*(yj-yi)))/3.1415926 +360*((get(1)>0)-.5)*(get(2)<0))>(%r1%))&&(get(3)<=(%r2%))) *(%1%)+((get(4)==0)*tpf) + 0*put(get(puti(5))+1) + 0*put(get(puti(6))+get(4)) + 0*put(get(puti(7))+get(4)*(tpf!=(%1%))) ~?e ~+|~/Error in turn penalty index expression!||q|~$end_of_macro ~t1=%4% ~+|~?t1=all|~t1=typ=1,9999 ~+|~?t1=*|~t1=typ=1,9999 ~+|~?t1=|~t1=typ=1,9999 %t1% ~?e ~+|~/Error in incoming link selection!||q|~$end_of_macro ~t2=%5% ~+|~?t2=all|~t2=typ=1,9999 ~+|~?t2=*|~t2=typ=1,9999 ~+|~?t2=|~t2=typ=1,9999 %t2% ~?e ~+|~/Error in outgoing link selection!||q|~$end_of_macro 4 ~/No. of turning angles calculated: %g5.0_7% ~/No. of turning angles in specified range: %g6.0_7% ~/No. of tpf values actually modified: %g7.0_7% q ~$>end_of_macro ~:invalid_angle ~/ ~/Invalid turning angle specified! ~:end_of_macro ~/========================================================================= ~o=6 ~:done