~?!o&8 ~o=295 / set bits 0, 1, 2, 5 and 8 ON ~$>SKIP_COMMENT_SECTION ~/***************************************************************************** ~/******* CNTPOST 2.4 - FIND SET OF COUNT POST (LOCATION) LINKS ******* ~/******* Copyright (C) Diane Larin, INRO Consultants Inc., 1996 ******* ~/ ~/ 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 ~/ 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 addition or ~/ modification must be appropriately identified as such and give at least ~/ date, name and the reason of the modification. ~/ ~/ This macro implements an heuristic to find the optimal location of ~/ count post (or count location) links. ~/ The additional options of the auto assignment (5.11/5.21) are used ~/ to find the trips which are not counted at all. ~/ Note that the default values used in the preparation of the assignment ~/ may be changed manually, if needed. ~/ Then, the network calculator (2.41) is used to identify the link with ~/ the maximum additional volume (not counted demand). ~/ A user data of this link is set to "volad" in order to be able to ~/ trace back the sequence according to which links were chosen. ~/ Optionally, the macro computes the percentage of the not counted demand ~/ and performs comparison of histograms for a matrix weighted by the total ~/ demand versus the same matrix weighted by the still not counted demand. ~/ ~/ Data requirements: ~/ ul2: Contains: ~/ 1] positive value if there is already a count post on that link ~/ 2] 0 if link may be considered as a count post ~/ 3] negative value if the link can not be considered as a candidate ~/ to receive a count post (e.g. connectors) ~/ Note: cntpost automatically sets connectors with a zero value ~/ to -1. ~/ The default link user data UL2 may be modified to UL1, UL3 or any ~/ link extra attribute by changing the value assigned to register t1. ~/ ms91: Scalar to hold maximum volume on links with not counted demand. ~/ ms92: Scalar to hold the I-node of that link. ~/ ms93: Scalar to hold the J-node of that link. ~/ ms94: Scalar to hold total demand. ~/ ms95: Scalar to hold the current total of the not counted demand. ~/ ms96: Scalar to hold the percentage of the total uncounted trips. ~/ ~/ Other requirements: ~/ 1) This macro must be started at the main menu level. ~/ 2) This macro needs a release 6.0 or later of the EMME/2 system. ~/ ~/ Usage: ~ [] [ [] []] ~/ ~/ Macro Parameters: ~/ Mandatory arguments ~/ ------------------- ~/ : Number of count post to locate. ~/ : Demand matrix. ~/ ~/ Optional arguments ~/ ------------------ ~/ : Additional OD attributes matrix. ~/ If this argument is not present, the assignment is faster. ~/ However, this argument is mandatory if one wants to compute the ~/ percentage of the not counted trips. ~/ : Data matrix to use when plotting histograms ~/ (e.g. auto times matrix, distance matrix, ...) ~/ This matrix must exist and not be write protected. ~/ : Upper limit for value range when plotting histograms. ~/ Default is 60. ~/ : Interval value when plotting histograms. Default is 5. ~/ ~/***************************************************************************** ~t1=~*Type "q" to quit or any other key to continue < ~?t1=q ~$>QUIT ~:SKIP_COMMENT_SECTION ~t1=ul2 comment='cntpost %1% %2% %3% %4% %5% %6%' off=1 / do not ask for graphic device off=2 / switch off printing of main menu ~/Checking for presence of all requested arguments ~y=%0% / set register y to number of arguments ~z=1 / initialization of numerical register z ~?y<2 ~$>USAGE ~+#3.14#1#1#%2%#~?e#~t3=Demand matrix %2% does not exist# #q ~?t3> ~+#~/%t3%#~$>QUIT ~/Making sure connectors will not be used as candidate ~+#2.41#1#y#%t1%#~?q=1#n#-1##ci=1#cj=1#&%t1%=0##4#q ~?y=2 ~$LOOP ~?y>3 / check if data matrix exists ~+#3.14#1#1#%4%#~?e#~t3=Data matrix %4% does not exist# #q ~?t3> ~+#~/%t3%#~$>QUIT ~/Computing total demand and saving result in ms94 3.21 ~+#1#y#ms94#y#totdem#total demand#~?q=1#y#0#%2%###n#+#+#~?b=1#2#q ~:LOOP ~/ ~/Preparing additional options auto assignment to get paths with no count post ~+;~p=32;~x=%%%p%%% / set register x to NLERR 5.11 1 / fixed demand auto assignment ~?q=2 / is scenario already assigned? 2 / new assignment ~?v>600 1 / single class assignment on auto mode 5 / assign additional demand %2% / auto demand in persons / no auto occupancy matrix / no additional demand / no auto times saved ~?q=1 / Initialize auto volumes? y 6 %t1% / source for additional link attribute; default is ul2 .max. / operator to compute additional path attribute -999,0 / threshold - path with no count post %3% / matrix to hold additional OD attributes ~?q=1 / initialize data if matrix already exists ~+#y#noncnt#non counted demand#~?q=1#y#0#4 /active additional demand 15 / max. number of iterations 0.5 / stopping criterion for gap 0.5 / mean time difference stopping criterion ~+;~x-%p%;~?!x=0;~/ WARNING while preparing auto assignment 5.21 / auto assignment ~+;~p=32;~x=%%%p%%% / set register x to NLERR ~/Iter %z%: i=%ms92% j=%ms93% volad=%ms91% ~?o&1 ~o-1 / allow display of standard dialog ~+;~o|64;~?b=1;2 ~o-64 / bit 6 OFF ~o|1 / bit 0 ON ~+;~x-%p%;~?!x=0;~/ WARNING while performing auto assignment ~/Identifying the link with the maximum additional volume (not counted demand) 2.41 / network calculation 1 / network calculations and mode changes n / do not save result volad %t1%=0 5 / save summary in scalars 3 / maximum result value and element ~+#ms91#maxvol#maximum volume ~+#ms92#i-node#I-node with maximum volume ~+#ms93#j-node#J-node with maximum volume 1 / back to primary select 1 / network calculations and mode changes y %t1% / attribute to save result in ~?q=1 n volad l=%ms92%,%ms93% 5 / save summary in scalars 1 / back to primary select q ~?y=2 ~$SKIP MATRIX CALCULATION AND PLOTTING OF HISTOGRAM 3.21 / matrix calculations ~/ ~/Saving non counted demand in ms95 ~+#1#y#ms95#y#noncnt#non counted demand#~?q=1#y#0#%3%###n#+#+#~?b=1#2 ~/*** Not counted demand: %ms95% ~/ ~/Saving percentage of non counted trips in ms96 ~+#1#y#ms96#y#percen#percentage of the non counted trips#~?q=1#y#0 ms95/ms94*100 ~+###~?b=1#2 ~/*** Percentage of the non counted trips: %ms96.2% % q on=1 / ask graphic device plots=cntpost%z%.plt 3.16 / plot histogram of matrices 2 / compare histogram of two matrices %4% / data matrix 1 y / weight matrix 1 %2% n / no submatrix %4% / data matrix 2 y / weight matrix 2 %3% n / no submatrix / no constraint matrix 1 / density 2 / actual values 0 %5% 60 / value range %6% 5.00 / interval y / automatic range on vertical axis ~?q=2 2 / send to plot file ~?q=0 / if non graphic terminal, enter annotations q off=1 ~/*** Plot sent to file cntpost%z%.plt plots=^ ~:SKIP MATRIX CALCULATION AND PLOTTING OF HISTOGRAM ~z+1 / count number of iteration ~?!z>%1% / branch if still count post to locate ~$LOOP on=2 / reset switch to print main menu comment='end of cntpost %1% %2% %3% %4% %5% %6%' ~/ ~/***************************************************************************** ~/ cntpost %1% %2% %3% %4% %5% %6% ~/ MACRO COMPLETED NORMALLY ~/***************************************************************************** ~$>QUIT ~:USAGE ~/ ~/***************************************************************************** ~/ Usage: ~ [] [ [] []] ~/ : Number of count post to locate. ~/ : Demand matrix. ~/ Optional arguments ~/ ------------------ ~/ : Additional OD attributes matrix. ~/ If this argument is not present, the assignment is faster. ~/ However, this argument is mandatory if one wants to compute the ~/ percentage of the not counted trips. ~/ : Data matrix to use when plotting histograms ~/ (e.g. auto times matrix, distance matrix, ...) ~/ This matrix must exist and not be write protected. ~/ : Upper limit for value range when plotting histograms. Default=60 ~/ : Interval value when plotting histograms. Default=5. ~/ ~/***************************************************************************** ~/ ~:QUIT on=2 / reset switch to print main menu ~?b=2 / quit if in batch mode 9 ~o=6