~?!i&32768 ~o|263 ~o|16 ~o|32 ~$>end_of_copyright ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~/Copyright (C) Isabelle Constantin, INRO Consultants Inc., 1999. ~/ ~/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 that there is no explicit or implied ~/ warranty or support provided with this macro. ~/ 3) The comments in this macro must not be removed. ~/ 4) Any addition or modification must be identified as such, and give ~/ at least the date, name and the reason for the modification. ~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~:end_of_copyright ~y=0 ~/********* ind2mat - 1.6 (I. Constantin, INRO Consultants Inc.) ********* ~/ ~x=%0% / test if enough parameters are provided ~?x<2 ~y=1 ~?!m=000 / test if started from main menu ~y=2 ~?y=0 ~$>START ~/ind2mat - a macro to obtain a station-to-station matrix from a ~/ boarding/alighting pair index matrix and a corresponding ~/ demand matrix. ~/ ~/This macro processes the boarding/alighting indices and the corresponding ~/demand, in order to obtain the station-to-station matrix. This matrix is ~/appended to a file named ind2mat.out. If desired, this matrix can then be ~/read into the data bank (using module 3.11), assuming there are existing ~/centroids with the station numbers used. ~/ ~/Usage: ~ [] ~/ ~/where: s2sind (mfN) matrix containing boarding/alighting stations index ~/ s2sdem (mfN) matrix containing corresponding demand ~/ s2smat matrix identifier (mfN) to write in output file (optional) ~/ ~/Notes: - This macro must be started at the main menu level ~/ - It needs Release 9.0 or later of the EMME/2 system ~/ - The macro uses the following scalars: ms98-ms99 ~/************************************************************************ ~$>error ~:START ~# Test that matrices exist ~+;~t1=%%1%.d%;~t1=%%%t1.1%%%;~?t1=% ~+;~y=3;~$>error ~+;~t1=%%2%.d%;~t1=%%%t1.1%%%;~?t1=% ~+;~y=4;~$>error c='start macro: ind2mat %1% %2% %3%' ~p=2005 ~t1=%p% ~/ ~/Macro ind2mat was called with the following parameters: ~+;~/- boarding/alighting indices %1% (%%1%.d%) ~+;~/- corresponding demand %2% (%%2%.d%) ~?!x<3 ~/- output matrix identifier %3% (station-to-station matrix for %1% and %2%) ~/ ~# ~# Write output file header ~# process boarding/alighting stations indices ~# 3.21 1 y ms98 y minind minimum station index ~?q=1 y 0 (int(%1%/100).min.(%1%.mod.100)).max.1 n .min. .min. 1 c 1 y ms99 y maxind maximum station index ~?q=1 y 0 int(%1%/100).max.(%1%.mod.100) n .max. .max. 1 c ~/Station indices range from %ms98% to %ms99% ~y=248 ~y/%ms99% ~r2=%ms99% ~r2*%y% ~r3=%ms99% ~r3/%y% ~y=%r2% ~y+2 ~>>ind2mat.out ~+;~"c Macro ind2mat(v1.6) Date: %d% User: %u% ~+;~"c - boarding/alighting indices %1% (%%1%.d%) ~+;~"c - corresponding demand %2% (%%2%.d%) ~"c ~> ~x=%0% ~?x<3 ~$>End_output_file_header ~>>ind2mat.out ~"t matrices ~"d matrix=%3% ~+;~"a matrix=%3% s2smat 0 ind2mat for %1% (%%1%.n%), %2% (%%2%.n%) ~> ~:End_output_file_header ~r8=%r3% ~r8+.5 ~/ ~/Processing boarding/alighting stations indices (%r8.0% steps required) ~r1=0 ~:Process_step ~z=%r1% ~z+1 ~/... step %z% ~z=248 ~z/%ms99% ~r4=%r1% ~r4*%z% 1 n put(get(puti(((int(%1%/100)-1)*%ms99%+%1%.mod.100+1-%r1%*%r2%) .max.1.min.(%r2%+2)))+%2%) n 1 c ~x=2 ~:Print_matrix ~?gx=0 ~$>Next_pair_index ~z=%x% ~z-2 ~z/%ms99% ~z+1 ~z+%r4% ~r6=%z% ~z=%x% ~z-2 ~z%%ms99% ~z+1 ~+;~>>ind2mat.out;~" %r6% %z% %gx_6.2%;~> ~:Next_pair_index ~x+1 ~?x<%y% ~$Print_matrix ~x=1 ~+;~gx=0;~x+1;~?!x>250;~$ ~r1+1 ~?r1<%r3% ~$Process_step q ~+;~>>ind2mat.out;~" ;~> ~/ ~~/Station-to-station matrix ~x=%0% ~?x=3 ~~/(%3%) ~/appended to file ind2mat.out s=%r7% ~+|~p=2005|~y=%%%p%%%|~y-%t1%|~y/10 ~/ ~/Macro ind2mat terminated normally, after %y% CPU seconds. ~/========================================================================== c='end macro: ind2mat %1% %2% %3%' ~y=0 ~:error ~?y=2 ~/Macro must be called from main menu! ~?y=3 ~/Matrix %1% does not exist! ~?y=4 ~/Matrix %2% does not exist! ~:end_of_macro ~/ ~o=6