~o=295 ~?!m=000 ~+;~/ERROR: Macro must be started from the main menu!;~$>SYNTAX ~# ~x=%0% ~?x=0 ~+;~t1=NoExpansion;~r90=0;~$>Network-Update-Done ~y=%1% ~?y=0 ~+;~t1=NoExpansion;~r90=%2%;~?e;~r90=0;~?r90=1;~$>SYNTAX;~$>Network-Update-Done ~?!x>2 ~+;~/ERROR: Arguments are not correct!;~$>SYNTAX ~+;~t1=%10%;~r90=0 ~?!t1= ~+;~r90=%10%;~?e;~r90=0 ~$>continue ~:SYNTAX ~/*** M2MTRAS: TRANSIT ASSIGNMENT WITH MODE TO MODE TRANSFERS (1.1) *** ~/** ** ~/** The macro m2mtrans is used to modify the network to create ** ~/** special dummy nodes, links, segments at transfer nodes in ** ~/** order to modeling the mode to mode transfers with penalties. ** ~/** ** ~/** USAGE 1: ~ [node gap] ** ~/** [btim] [ww] [aw] [bw] [flag] ** ~/** where original network scenario ** ~/** new scenario with mode transfer penalties ** ~/** transit trip demand for the assignment ** ~/** current node list for expansion, ** ~/** eg. 11 for node 11 only, or ** ~/** 11,14 for nodes from 11 to 14, or ** ~/** 11;13;15 for node 11, 13 and 15 ** ~/** a node attribute (>0), eg. @m2m. t1 ** ~/** [node gap] default= 0, the node number gap between ** ~/** the max. node and the possible min. dummy node. ** ~/** [btim] boarding time, r3, optional (default=2.5) ** ~/** [ww] waiting time weight, r4, optional (default=2.0) ** ~/** [aw] auxiliary time weight, r5, optional (default=2.0) ** ~/** [bw] boarding time weight, r6, optional (default=2.0) ** ~/** [flag] 0 or empty, full operation r90 ** ~/** 1, expanding nodes only (no assignments, results) ** ~/** 2, expanding nodes, assignment and summary results** ~/** ** ~/** USAGE 2: ~ ** ~/** a penalty penalty ... ** ~/** eg. ** ~/** t mode-to-mode cw be ** ~/** c c w b e ** ~/** a c 0 - 1.5 2.0 ** ~/** a w - 0 1.3 2.2 ** ~/** a b 0 0 0 1.0 ** ~/** a e 0 0 0.5 0 ** ~/** where cw is the walk mode string, be is the transit ** ~/** -, or any number > 999 means no-transfers ** ~/** ** ~/** - summary report for mode-to-mode transfers: m2mtras.rpt ** ~/** ** ~/** - expanded nodes number convention for node i: ** ~/** starting dummy node number for node = (i*r2+r1) ** ~/** where r1, node base (node shift) ** ~/** r2, number factor = 2 * number of modes ** ~/** - dummy aux. transit mode for transfer penalty: ** ~/** z, (Penalty is saved in ul1) ** ~/** - dummy transit function: ft9=0 ** ~/** ** ~/** - ms99, reserved (overwritten) ** ~/** - ms101 and up are reserved for m2m transfer penalties ** ~/** - text registers: ** ~/** + t1: transfer node(s) (from argument 3) ** ~/** + t2: dummy transfer mode (defined in the macro) ** ~/** + t3: walk mode(s) (read from m2mtras.in) ** ~/** + t4: transit mode(s) (read from m2mtras.in) ** ~/** + t9: link attribute string, eg. ul1+ul2 ** ~/** - all nodes being expanded: @m2mnd (computed by the macro)** ~/** - dummy nodes after expansion: @m2mdm (results) ** ~/** Tips: ** ~/** - To change spaces between the dummy nodes, change r10 ** ~/** to set the min. coordinate difference, change r100 ** ~/** - To copy link attributes to the new links, set t9 ** ~/** ** ~/** RESULTS: ** ~/** - network with node expandsion ** ~/** - transit assignment with mode-to-mode transfer penalty ** ~/** - mode-to-mode transfer on the given nodes and summary ** ~/** ** ~/** Condition: If the transfer happens at the node, there is ** ~/** no alterative path going out of the node and ** ~/** coming back to the node, ** ~/** which has less costs than the transfer penalties! ** ~/** ** ~/** Shuguang He, INRO Solutions Inc., Montreal, Canada 2004 ** ~/** ** ~/********************************************************************* ~$>END ~:continue c='Start m2mtras %t0%' ~# ~#check the operation system ~+;~p=2004;~t8=%%%p%%% ~+;~?t8=1;~!rm m2mtras.jnk;~?t8=2;~!if exist m2mtras.jnk del m2mtras.jnk ~+;~?t8=1;~!rm m2mtras.rpt;~?t8=2;~!if exist m2mtras.rpt del m2mtras.rpt ~# ~+;~?t8=1;~!rm m2mnd.tmp;~?t8=2;~!if exist m2mnd.tmp del m2mnd.tmp ~# reports=m2mtras.jnk ~#define dummy mode for mode-to-mode transfer ~t2=z ~# ~#append the demand matrix string to t2 ~t2=%t2% %3% ~# ~/======== TRANSIT ASSIGNMENT WITH MODE-TO-MODE TRANSFER PENALTIES ========= ~/Date: %d% ~/Original Scenario: %1% ~/Working Scenario: %2% ~/Transit Demand: %3% ~/Node(s) for M2M Transfers: %4% ~/Dummy Mode for Transfers: %t2.1% ~/Dummy Transit Function: ft9=0 ~# ~#Report ~>>m2mtras.rpt ~"======== TRANSIT ASSIGNMENT WITH MODE-TO-MODE TRANSFER PENALTIES ========= ~"Macro arguments: %t0% ~"Date: %d% ~"Original Scenario: %1% ~"Working Scenario: %2% ~"Transit Demand: %3% ~"Node(s) for M2M Transfers: %4% ~"Dummy Mode for Transfers: %t2.1% ~"Dummy Transit Function: ft9=0 ~>> ~#copy scenario from %1% to %2% s=%1% ~t1=%ts% - M2M Transfers ~+;1.22;2;%2%;~?e;;~?q=1;y;3;%1%;%2%;%t1.60%;y;q ~# ~#add aux. transit mode %t2.1% for transfer penalties ~#1/aux. weight: for aux. transit time on mode %t2.1% ~t8=%7% ~+;~?!t8=;~r4=%t8%;~?t8=;~r4=2.0 ~##Wating Time Weight Transifers: %r4% <------ ~+;~r1=1;~r1/%r4% ~+;2.01;4;%t2.1% ~?q>1 ~+;2;3;%t2.1% ~+;m2mtras;1;;;;;ul1*%r1%;q ~# ~#create a ttf function for dummy transt segment: ft9=0 ~+;4.12;4;ft9;;~?!e;y;2;ft9;0;;;q ~# ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#if user wants to change the distances between the dummy node, decrease r10 ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#dummy node coordinate factor: r10 ~#note#dx (r8) = min. link distance/r10; dy (r9) = min. link distance/r10 ~r10=100 ~#min. r8 and r9 ~r100=0.00001 ~# ~t9= ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#if user wants to copy link attributes to the expanded network, set t9 ~#e.g. ~t9=ul1+ul2+@timau, which must be exist in the data bank. ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~t9= ~# ~### ~#keep the arguments ~t1=%t0% ~# ~######################################## ~#read from mode-to-mode file: m2mtras.in ~######################################## ~<Read-M2MTras-Done;~t8=%%%0%%%;~?t8<1;~$>Read-M2MTras-Done ~#if comment ~+;~t8=%1%;~t8=%%%t8.1%%%;~?t8=c;~$M2MTras ~t8=%1% ~#if title, save the walk mode and transit mode strings ~?!t8=t ~$>M2M-Data ~+;~t3=%3%;~t4=%4%;~r21=1;~r22=1;~r23=2 ~#find number of walk modes ~+;~t3=%%%t3.-1%%%;~?t3=;~$>No-Of-Walk-Modes-Done;~r21+1;~r23+1;~$ ~:No-Of-Walk-Modes-Done ~# ~+;~t4=%%%t4.-1%%%;~?t4=;~$>No-Of-Transit-Modes-Done;~r22+1;~r23+1;~$ ~:No-Of-Transit-Modes-Done ~+;~t3=%3%;~t4=%4% ~#note#walk mode t3=%t3%, number of walk mode r21=%r21% ~#note#transit mode t4=%t4%, number of transit mode r22=%r22% ~#note#total number of modes r23=%r23% ~#dummy node factor: twice of number of modes ~+;~r2=%r23%;~r2*2 ~# ~:M2M-Data ~+;~?!t8=a;~$M2MTras ~#from mode t5, to mode t6 ~+;~t5=%2%;~t8=%t3%%t4%;~x=1 ~#find the position of t5 in the mode string ~+;~t6=%%%t8.1%%%;~?t6=%t5%;~$>Found-1;~t8=%%%t8.-1%%%;~?t8=;~$>nFound-1;~x+1;~$ ~:nFound-1 ~+;~/Mode %t5% is not defined in mode string: %t3% %t4%. Check m2mtras.in!;~$>END ~:Found-1 ~#from mode t5 position x, to mode t6 position y ~y=1 ~:To-Mode-Loop ~#find t6 in the position y ~+;~z=%y%;~z-1;~t8=%t3%%t4% ~+;~t8=%%%t8.-%z%%%%;~t6=%%%t8.1%%% ~#D#~/t5=%t5%,x=%x%,t6=%t6%,y=%y% ~#save the penalty to ms ~+;~z=%y%;~z+2 ~+;~t7=%%z%% ~?t7= ~+;~/No. penalties does not matched with the no. of modes. Check m2mtras.in!;~$>END ~+;~?!t7=-;~r11=%t7%;~?t7=-;~r11=9999;~?r11>998;~r11=9999 ~#find scale no. for the m2m (start from ms101) ~+;~z=%x%;~z-1;~z*%r23%;~z+%y%;~z+100 ~+;3.12;2;ms%z%;~?e;;~?q=1;y;1;ms%z%;m2m-%t5%%t6%;transfer penalty from mode %t5% to %t6%;%r11%;q ~#to next mode ~y+1 ~?!y>%r23% ~$To-Mode-Loop ~# ~$M2MTras ~:Read-M2MTras-Done ~<< ~/Walk (aux. transit) Modes: %t3% ~/Transit Modes: %t4% ~/Mode-to-Mode Penalties in: ms101 - ms%z% ~#Report ~>>m2mtras.rpt ~"Walk (aux. transit) Modes: %t3% ~"Transit Modes: %t4% ~"Mode-to-Mode Penalties in: ms101 - ms%z% ~>> ~#mode string t3, set t4 free <---------- ~+;~t3=%t3%%t4%;~t4= ~######################################## ~#read from mode-to-mode file done ~######################################## ~# ~#restore the macro arguments ~t0=%t1% ~#nodes for considering mode-to-mode transfers ~t1=%4% ~#dummy node number ~#finding the existing dummy nodes ~+;2.42;2;1;@m2mdm;~?!e;nodes for m2m (connected with mode %t2.1%);;q ~+;2.41;1;y;@m2mdm;n;0;' ';*;4;q ~+;2.41;1;y;@m2mdm;n;i*(type.gt.-999);' ';5;mode=%t2.1%;;4;q ~+;2.41;1;y;@m2mdmj;n;j*(type.gt.-999);' ';5;mode=%t2.1%;;4;q ~# ~#find min. node (non-zone) number ~+;2.41;1;n;i;;@m2mdm=0;and ci=0;;5;2;ms99;minN;min. node number (excluding zones);;q ~r11=%ms99% ~#find max. node number ~+;2.41;1;n;i;;@m2mdm=0;;5;3;ms99;maxN;max. node number (excluding dummy nodes);;q ~r12=%ms99% ~#min. node number base: r1=maxN-minN*r2+1 ~+;~r1=-%r11%;~r1*%r2%;~r1+%ms99%;~r1+1 ~#node number between max. node and min. dummy node: %5% ~r1+%5% ~~/Node Number Base: %r1% ~+;~r24=%r11%;~r24*%r2%;~r24+%r1%;~r25=%r12%;~r25*%r2%;~r25+%r1%;~r25+%r2% ~/ (dummy node range: %r24%, %r25%) ~#node number factor ~/Node Number Factor: %r2% ~#boarding time ~t8=%6% ~+;~?!t8=;~r3=%t8%;~?t8=;~r3=2.5 ~/Boarding Time: %r3% ~#watiing time weight ~t8=%7% ~+;~?!t8=;~r4=%t8%;~?t8=;~r4=2.0 ~/Wating Time Weight: %r4% ~#aux. transit time weight ~t8=%8% ~+;~?!t8=;~r5=%t8%;~?t8=;~r5=2.0 ~/Aux. Transit Time Weight: %r5% ~#boarding time weight ~t8=%9% ~+;~?!t8=;~r6=%t8%;~?t8=;~r6=2.0 ~/Boarding Time Weight: %r6% ~# ~#Report ~>>m2mtras.rpt ~"Node Number Base: %r1% ~" dummy node range: %r24% %r25% ~"Node Number Factor: %r2% ~"Boarding Time: %r3% ~"Wating Time Weight: %r4% ~"Aux. Transit Time Weight: %r5% ~"Boarding Time Weight: %r6% ~>> ~# ~###shift the coordinates (prepare for better coordination precision in the batchout) ~#find min. xi ~+;2.41;1;n;xi;;@m2mdm=0;;5;2;ms99;minXi;min. x coordinates;;q ~r98=%ms99% ~#find min. yi ~+;2.41;1;n;yi;;@m2mdm=0;;5;2;ms99;minYi;min. y coordinates;;q ~r99=%ms99% ~#shift ~+;2.41;1;y;xi;xi-(%r98%);;*;4;q ~+;2.41;1;y;yi;yi-(%r99%);;*;4;q ~# ~### finding delta xi and yi ### ~+;2.41;1;n;sqrt((xi-xj)^2+(yi-yj)^2);;@m2mdm=0;;5;2;ms99;minD;shortest link distances;;;q ~#delta xi,yi ~+;~r8=%ms99%;~r9=%ms99% ~+;~r8/%r10%;~r9/%r10% ~+;~?r8<%r100%;~r8+%r100%;~?r9<%r100%;~r9+%r100% ~#D#~/Delta Xi, Yi %r8% %r9% ~### batchout nodes considering ### ~#x=0, if node attribute; otherwise, node numbers ~x=%t1.1% batchout=m2mnd.tmp ~+;2.41;1;n;xi+yi; ~?!x=0 ~+;%t1% ~?x=0 not %t1%=0 ~+;and @m2mdm=0;and ci=0;;3;q batchout=^ ~#add the current node list to the old one if it exists. ~+;2.42;2;1;@m2mnd;~?!e;all nodes being expanded;;q ~+;2.41;1;y;@m2mnd;n;i; ~?!x=0 ~+;%t1% ~?x=0 not %t1%=0 ~+;and @m2mdm=0;and ci=0;;4;q ~# ~#=============== NETWORK UPDATE ================ ~# processing node by node by reading m2mnd.tmp = ~#=============================================== ~#number of lines to be read: r11, number of lines read: r12 ~r11=1 ~:M2M-Nodes ~r12=0 ~<Expanding-Done;~t8=%%%0%%%;~?t8<4;~$>Expanding-Done ~#################### ~/Expanding node: %1% ~#################### ~# w w ~# w w ~# * => * ~# t t ~# t t ~#node number, xi, yi ~+;~t1=%1%;~r31=%2%;~r32=%3% ~#new node, xi left: r33=r31-r8, xi right: r34=r31+r8 ~+;~r33=%r31%;~r33-%r8%;~r34=%r31%;~r34+%r8% ~# ~#batchout links connected with the expanding node %t1% ~+;~p=2004;~t8=%%%p%%% ~+;~?t8=1;~!rm m2mlk.tmp;~?t8=2;~!if exist m2mlk.tmp del m2mlk.tmp batchout=m2mlk.tmp ~+;2.14;5;n;;n;i=%t1%;j=%t1%;;q batchout=^ ~# ~#batchout transit lines ~+;~?t8=1;~!rm m2mln.tmp;~?t8=2;~!if exist m2mln.tmp del m2mln.tmp batchout=m2mln.tmp ~#change module parameters, punch only one segment on each route record ~+;2.24;5;n;y;y;n;n ~#punch out all lines ~+;4;nod=%t1%;;q batchout=^ ~# ~### find out the modes used by the node ### ~#set r2??=0 ~x=200 ~+;~x+1;~r%%%x%%%=0;~?x>229;~$>Set-R201-Done;~$ ~:Set-R201-Done ~# ~<Read-M2mlk-1-Done ~#if a (a link, only links are punched in this file) ~+;~t8=%t0.1%;~?!t8=a;~$Read-M2mlk-1 ~#modes of current link ~t7=%5% ~#start from r201, if r2??>1, mode used for the node ~:Link-Mode-Loop-1 ~+;~t5=%t7.1%;~t7=%t7.-1%;~t8=%t3%;~x=1 ~#find the position of mode t5 in the mode strings. If not found, it could be an auto mode. ~+;~t6=%%%t8.1%%%;~?t6=%t5%;~$>Found-2;~t8=%%%t8.-1%%%;~?t8=;~$>nFound-2;~x+1;~$ ~:Found-2 ~+;~y=200;~y+%x%;~r%%%y%%%+1 ~:nFound-2 ~?!t7= ~$Link-Mode-Loop-1 ~# ~$Read-M2mlk-1 ~:Read-M2mlk-1-Done ~<< ~### ~#note: Modes used by the node are in the flag r2?? > 0 ~# ~#network file for updating ~+;~p=2004;~t8=%%%p%%% ~+;~?t8=1;~!rm m2mnd-u.tmp;~?t8=2;~!if exist m2mnd-u.tmp del m2mnd-u.tmp ~+;~?t8=1;~!rm m2mlk-u.tmp;~?t8=2;~!if exist m2mlk-u.tmp del m2mlk-u.tmp ~+;~?t8=1;~!rm m2mln-d.tmp;~?t8=2;~!if exist m2mln-d.tmp del m2mln-d.tmp ~+;~?t8=1;~!rm m2mln-u.tmp;~?t8=2;~!if exist m2mln-u.tmp del m2mln-u.tmp ~#link attributes ~?t9= ~$>Link-Attribute-Header-Done ~+;~?t8=1;~!rm m2mla.tmp;~?t8=2;~!if exist m2mla.tmp del m2mla.tmp ~+;~?t8=1;~!rm m2mla-u.tmp;~?t8=2;~!if exist m2mla-u.tmp del m2mla-u.tmp ~>>m2mla-u.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for node %t1% ~"t link attributes ~>> ~:Link-Attribute-Header-Done ~#note#number of walk mode r21=%r21%, number of transit mode r22=%r22% ~#note#total number of modes r23=%r23%, node factor r2=%r2%, modes t3 ~#note#Dxi: r8=%r8%, Dyi: r9=%r9% ~### add dummy nodes ### ~>m2mnd-u.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for node %t1% ~"t nodes ~> ~>m2mlk-u.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for node %t1% ~"t links ~> ~#add nodes for walk modes ~#note:r13: count with inc. 2, r14: reverse count, r15: 2*walk modes, r16: count for all modes ~+;~r13=1;~r14=%r21%;~r15=%r21%;~r15*2;~r16=1 ~:Walk-Mode-Loop-1 ~### check if this mode r16 is used by the node ### ~+;~z=200;~z+%r16%;~?!r%%%z%%%>0;~$Next-Walk-Mode-1 ~### ~#new node right x: i*r2+r1 +2*r16 -2, xi: r33, yi: r35=r32+r9*r14 ~+;~x=%t1%;~x*%r2%;~x+%r1%;~x+%r16%;~x+%r16%;~x-2 ~+;~r35=%r9%;~r35*%r14%;~r35+%r32% ~#new node left: y=x+1, xi: r34, yi: r35 ~+;~y=%x%;~y+1 ~# ~>>m2mnd-u.tmp ~"a %x_6% %r33.6_16% %r35.6_16% ~"a %y_6% %r34.6_16% %r35.6_16% ~>> ~:Next-Walk-Mode-1 ~+;~r13+2;~r14-1;~r16+1 ~?r13<%r15% ~$Walk-Mode-Loop-1 ~# ~#add nodes for transit modes ~#note:r13: count, r14: count 2, r15: 2*transit modes, r16: count for all modes ~+;~r13=0;~r14=1;~r15=%r22%;~r15*2 ~:Transit-Mode-Loop-1 ~### check if this mode r16 is used by the node ### ~+;~z=200;~z+%r16%;~?!r%%%z%%%>0;~$Next-Transit-Mode-1 ~### ~#new node right x:i*r2+r1 +2*r16 -2, xi: r33, yi: r35=r32-r9*r14 ~+;~x=%t1%;~x*%r2%;~x+%r1%;~x+%r16%;~x+%r16%;~x-2 ~+;~r35=-%r9%;~r35*%r14%;~r35+%r32% ~#new node left: y=x+1, xi: r34, yi: r35 ~+;~y=%x%;~y+1 ~# ~>>m2mnd-u.tmp ~"a %x_6% %r33.6_16% %r35.6_16% ~"a %y_6% %r34.6_16% %r35.6_16% ~>> ~:Next-Transit-Mode-1 ~+;~r13+2;~r14+1;~r16+1 ~?r13<%r15% ~$Transit-Mode-Loop-1 ~### ~### add dummy links ### ~<Read-M2mlk-2-Done ~#if a (a link, only links are punched in this file) ~+;~t8=%t0.1%;~?!t8=a;~$Read-M2mlk-2 ~#current link data ~#i node: r41, j node: r42; length: r43, modes: t7 ~#type: r44, lanes: r45, function: r46, ul1,ul3: r47,r49 ~+;~r41=%2%;~r42=%3%;~r43=%4%;~t7=%5% ~+;~r44=%6%;~r45=%7%;~r46=%8%;~r47=%9%;~r48=%10%;~r49=%11% ~###copy any link extra attribute of the link (r41,r42) here batchout=m2mla.tmp ~?!t9= ~+;2.41;1;n;%t9%;;i=%r41%;and j=%r42%;;3;q batchout=^ ~# ~#go through the mode strings. auto modes: t4 ~t4= ~:Link-Mode-Loop-2 ~+;~t5=%t7.1%;~t7=%t7.-1%;~t8=%t3%;~x=1 ~#find the position of mode t5 in the mode strings. If not found, it could be an auto mode. ~+;~t6=%%%t8.1%%%;~?t6=%t5%;~$>Found-3;~t8=%%%t8.-1%%%;~?t8=;~$>nFound-3;~x+1;~$ ~:nFound-3 ~+;~t4=%t4%%t5%;~$>Next-Link-Mode-2 ~:Found-3 ~#new node number: y=i*r2+r1 + 2*x -2 ~+;~y=%t1%;~y*%r2%;~y+%r1%;~y+%x%;~y+%x%;~y-2 ~?t1=%r41% ~$>Outgoing-Link ~#if incoming link, from node y ~>>m2mlk-u.tmp ~"a %r41_6% %y_6% %r43.3_8% %t5% %r44_3% %r45.1_5% %r46_3% %r47% %r48% %r49% ~>> ~#save link (r41,y) to the attribute table ~?!t9= ~+;~>>m2mla.tmp;~"%r41% %y%;~>> ~# ~$>Next-Link-Mode-2 ~# ~#if out going link ~:Outgoing-Link ~y+1 ~>>m2mlk-u.tmp ~"a %y_6% %r42_6% %r43.3_8% %t5% %r44_3% %r45.1_5% %r46_3% %r47% %r48% %r49% ~>> ~#save link (y r41) to the attribute table ~?!t9= ~+;~>>m2mla.tmp;~"%y% %r42%;~>> ~:Next-Link-Mode-2 ~?!t7= ~$Link-Mode-Loop-2 ~# ~#delete the link and keep the link with auto modes ~>>m2mlk-u.tmp ~"d %r41_6% %r42_6% ~?!t4= ~"a %r41_6% %r42_6% %r43.3_8% %t4% %r44_3% %r45.1_5% %r46_3% %r47% %r48% %r49% ~>> ~#NOTE: This does not consider transit time depending on auto time! ~# Auto time must be copied to an attribute, which defines the ttf. ~#ul1, ul2, ul3 are copied to the corresponding links. :) ~# ~#next link ~$Read-M2mlk-2 ~:Read-M2mlk-2-Done ~<< ~### ~# ~### add dummy links: x start mode count, y end mode count ~#-------------------------------------------------------- ~x=1 ~:I-Mode-Loop ~### check if this mode x is used by the node ### ~+;~z=200;~z+%x%;~?!r%%%z%%%>0;~$>Next-I-Mode ~y=1 ~:J-Mode-Loop ~### check if this mode y is used by the node ### ~+;~z=200;~z+%y%;~?!r%%%z%%%>0;~$>Next-J-Mode ~#i node: r41, j node: r42 ~#i node number: r41=i*r2+r1 + 2*x -2 ~+;~r41=%t1%;~r41*%r2%;~r41+%r1%;~r41+%x%;~r41+%x%;~r41-2 ~#j node number: r42=i*r2+r1-1 + 2*y ~+;~r42=%t1%;~r42*%r2%;~r42+%r1%;~r42-1;~r42+%y%;~r42+%y% ~# ~#mode x to mode y penalty: ms1?? ~+;~z=%x%;~z-1;~z*%r23%;~z+%y%;~z+100 ~+;~r47=%%%ms%z%%%%;~t5=%t2.1% ~#if between the same transit mode ~+;~?!x=%y%;~$>Check-No-Transfer-Link ~+;~?!x>%r21%;~$>Check-No-Transfer-Link ~#find the (transit) mode character ~+;~z=%x%;~z-1;~t8=%t3% ~+;~t8=%%%t8.-%z%%%%;~t5=%%%t8.1%%%%t2.1% ~?r47>998 ~+;~r47=0;~t5=%t8.1% ~$>Out-Dummy-Link ~# ~:Check-No-Transfer-Link ~+;~?r47>998;~$>Next-J-Mode ~:Out-Dummy-Link ~>>m2mlk-u.tmp ~"a %r41_6% %r42_6% 0 %t5% 99 0 0 %r47% 0 0 ~>> ~:Next-J-Mode ~y+1 ~?!y>%r23% ~$J-Mode-Loop ~:Next-I-Mode ~x+1 ~?!x>%r23% ~$I-Mode-Loop ~#--------------------------------------------------- ~# ~### update transit lines ### ~#--------------------------- ~>m2mln-d.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for node %t1% (delete lines) ~"t lines ~> ~>m2mln-u.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for node %t1% (update lines) ~"t lines ~> ~# ~/update transit lines for node %t1% ~<Read-M2mln-1-Done ~+;~t7=%1%;~t8=%%%t7.1%%% ~#if c, t put into the output file ~+;~?t8=c;~$Read-M2mln-1;~?t8=t;~$Read-M2mln-1 ~#find the mode of the line ~?!t8=a ~$>Not-Header-t ~#D# ~/update line: %t0% ~#transit's mode: t5 ~#find second ' ~x=0 ~t6=%t0% ~+;~t5=%%%t6.1%%%;~?t5=';~x+1;~t6=%%%t6.-1%%%;~?x=2;~$>Found-N1;~$ ~:Found-N1 ~t7=%t0% ~t0=%t6% ~t5=%1% ~t0=%t7% ~#old#~+;~t5=%3%;~/mode t5=%t5% ~#find the mode position x ~+;~t8=%t3%;~x=1 ~#find the position of t5 in the mode string ~+;~t6=%%%t8.1%%%;~?t6=%t5%;~$>Found-4;~t8=%%%t8.-1%%%;~?t8=;~$>nFound-4;~x+1;~$ ~:nFound-4 ~+;~/(Line) Mode %t5% is not defined in modes: %t3%. Check m2mtras.in!;~$>END ~:Found-4 ~#i node number: r41=i*r2+r1 + 2*x -2 ~+;~r41=%t1%;~r41*%r2%;~r41+%r1%;~r41+%x%;~r41+%x%;~r41-2 ~#j node number: r42=r41+1 ~+;~r42=%r41%;~r42+1 ~>>m2mln-d.tmp ~"d %t0.-1% ~>> ~>>m2mln-u.tmp ~"%t0% ~>> ~$Read-M2mln-1 ~# ~:Not-Header-t ~#note: z=1, if first node of the line ~?t8=p ~+;~z=1;~>>m2mln-u.tmp;~"%t0%;~>>;~$Read-M2mln-1 ~#if not a node ~y=%t8% ~?y=0 ~+;~z=0;~>>m2mln-u.tmp;~"%t0%;~>>;~$Read-M2mln-1 ~###check nodes now ~#if not the node expanding, save the dwt=. of the "to node" in t6 ~t8=%1% ~?!t8=%t1% ~+;~>>m2mln-u.tmp;~"%t0%;~>>;~z=0;~t6=%2%;~$Read-M2mln-1 ~###replace the expanding node ~#shift out the node number ~% ~#dwt: t8 ~+;~t7=%1%;~t8=%%%t7.3%%% ~#if line ends, end at %r41% (i node) ~?t8=lay ~+;~>>m2mln-u.tmp;~" %r41% %t0%;~>>;~z=0;~$Read-M2mln-1 ~?t8=dwt ~$>DWT ~#It could be the last node of the line. ~x=%0% ~+;~t8=%%%%x%%%% ~+;~t8=%t8.3% ~?!t8=lay ~+;~/Transit line batchout format was changed, check the macro (A).;~$>END ~+;~>>m2mln-u.tmp;~" %r41% %t0%;~>>;~z=0;~$Read-M2mln-1 ~# ~:DWT ~#if line starts, start at r42 ~?z=1 ~+;~>>m2mln-u.tmp;~" %r42% %t0%;~>>;~z=0;~t6=%1%;~$Read-M2mln-1 ~# ~#find the dwt for the dummy node: dwt specification: t7, value: t8 ~t8=%t6.-4% ~t7=%t8.1% ~#if t7 is number or ., which is equilvent to + (eg. dwt=.01) ~y=%t7% ~?t7=. ~+;~t7=+;~y=9 ~?!y=0 ~t7=+ ~?y=0 ~t8=%t8.-1% ~# ~:Boarding-Only ~?!t7=< ~$>Aligting-Only ~>>m2mln-u.tmp ~" %r41% tdwt=#.00 ttf=9 us1=0 us2=0 us3=0 ~" %r42% tdwt=<%t8% %t0% ~>> ~$Read-M2mln-1 ~# ~:Aligting-Only ~?!t7=> ~$>Non-Stop ~>>m2mln-u.tmp ~" %r41% tdwt=>.00 ttf=9 us1=0 us2=0 us3=0 ~" %r42% tdwt=#%t8% %t0% ~>> ~### ~$Read-M2mln-1 ~# ~:Non-Stop ~?!t7=# ~$>Dwell-Factor ~>>m2mln-u.tmp ~" %r41% tdwt=#.00 ttf=9 us1=0 us2=0 us3=0 ~" %r42% tdwt=#%t8% %t0% ~>> ~$Read-M2mln-1 ~# ~:Dwell-Factor ~?!t7=* ~$>Boarding-Alighting-Allowed ~/Note: --------------------------------------------------------------------------------------- ~/The dwt with factor, (*, minutes per unit length) will not be correct on the split node %t1%. ~/This dwt is set on alighting node (%r41%), not on boarding node (%r42%). Then dwt on the ~/boarding node (%r42%) will be zero because the length on %r41%-%r42% is set to zero. ~/But the total transit times (with dwt) is correct. ~/If user does not like to see this message, please don't use dwell time factor on this node. ~/--------------------------------------------------------------------------------------------- ~>>m2mln-u.tmp ~" %r41% tdwt=>*%t8% ttf=9 us1=0 us2=0 us3=0 ~" %r42% tdwt=<*.00 %t0% ~>> ~$Read-M2mln-1 ~# ~:Boarding-Alighting-Allowed ~?!t7=+ ~+;~/Transit line batchout format was changed, check the macro (B).;~$>END ~>>m2mln-u.tmp ~" %r41% tdwt=>.00 ttf=9 us1=0 us2=0 us3=0 ~" %r42% tdwt=<%t8% %t0% ~>> ~$Read-M2mln-1 ~:Read-M2mln-1-Done ~#--------------------------- ~# ~#batchin the new nodes batchin=m2mnd-u.tmp ~+;2.11;2 batchin=^ ~#batchin the delete lines batchin=m2mln-d.tmp ~+;2.21;2 batchin=^ ~#batchin the updated links batchin=m2mlk-u.tmp ~+;2.11;2 batchin=^ ~#batchin the updated lines batchin=m2mln-u.tmp ~+;2.21;2 batchin=^ ~# ~?t9= ~$>Update-Link-Att-Done ~###update link attribute### ~/copy link attributes: %t9% ~<END ~>>m2mla-u.tmp ~"%t0% ~>> ~x=1 ~:Read-Link-Att-Loop ~+;~t0=~@;~?e;~$>Read-Link-Att-Done;~t8=%%%0%%%;~?t8=0;~$>Read-Link-Att-Done ~t8=%1% ~?t8=inode ~+;~t0=~@;~x=1 ~?x=1 ~+;~%;~%;~t7=%%%t0%%%;~x=2;~$Read-Link-Att-Loop ~#output attribute to the new link ~>>m2mla-u.tmp ~" %1% %2% %t7% ~>> ~$Read-Link-Att-Loop ~:Read-Link-Att-Done ~# ~#batchin and update the link attributes ~<END ~t8=%1% ~+;~?!t8=inode;~$Read-Link-Att-Header-Loop ~#number of attributes+3 ~+;~y=%0%;~x=3 ~:Attribute-Loop ~#attribute name, and if extra attribute t8 (=@) ~+;~t5=%%%%x%%%%;~t8=%%%t5.1%%% ~#batchin the attribute, must have already existed. batchin=m2mla-u.tmp ~+;2.41;3;%t5%;~?t8=@;n;*;1,2,%x%;n;y;q batchin=^ ~x+1 ~?x<%y% ~$Attribute-Loop ~<< ~# ~:Update-Link-Att-Done ~###update link attribute### ~# ~######################### ~#Expanding node %t1% done ~######################### ~# ~##No-Rule-Check <-!!!!!!! ~$>Rule-Check-Done ~####check transfer penalties ~#----------start------------ ~#**for transfers to a transit mode** ~###Condition 1 (sufficient condition): ~#Transfer penalties from transit modes to a transit mode must less than those from walk modes. ~# => If there is no transfers from a transit mode, there is no boarding from walk modes. ~# ~#first transit mode: r17 ~+;~r17=%r21%;~r17+1 ~:Transit-Mode-Loop-10 ~#check if this transit mode r17 is used by the node ~+;~z=200;~z+%r17%;~?!r%%%z%%%>0;~$>Next-Transit-Mode-10 ~#go through the walk modes, and find the min. penalty to the mode r17: r51 ~r51=9999 ~#first walk mode: r16 ~r16=1 ~:Walk-Mode-Loop-11 ~#check if this walk mode r16 is used by the node ~+;~z=200;~z+%r16%;~?!r%%%z%%%>0;~$>Next-Walk-Mode-11 ~#penalty from r16 to r17 is ms1?? ~+;~z=%r16%;~z-1;~z*%r23%;~z+%r17%;~z+100 ~+;~?r51>%%%ms%z%%%%;~r51=%%%ms%z%%%% ~:Next-Walk-Mode-11 ~r16+1 ~?!r16>%r21% ~$Walk-Mode-Loop-11 ~##/the min. penalty from walk to transit mode %r17% is %r51% ~# ~#go through the transit modes, and find the max. penalty to the mode r17: r52 ~r52=0 ~#first transit mode: r16 ~:Transit-Mode-Loop-11 ~#check if this transit mode r16 is used by the node ~+;~z=200;~z+%r16%;~?!r%%%z%%%>0;~$>Next-Transit-Mode-11 ~#penalty from r16 to r17 is ms1?? ~+;~z=%r16%;~z-1;~z*%r23%;~z+%r17%;~z+100 ~+;~?r52<%%%ms%z%%%%;~r52=%%%ms%z%%%% ~:Next-Transit-Mode-11 ~r16+1 ~?!r16>%r23% ~$Transit-Mode-Loop-11 ~##/the max. penalty from transit to transit mode %r17% is %r52% ~# ~#check if the condition is hold. ~?!r51<%r52% ~$>Next-Transit-Mode-10 ~#if not OK, ~+;~z=%r17%;~z-1;~t8=%t3% ~+;~t8=%%%t8.-%z%%%%;~t5=%%%t8.1%%% ~/WARNING: ~/The min. penalty (%r51%) from walk to mode %t5% is less than the max. of those (%r52%) from transit modes! ~?r52>998 ~/No transfer is allowed from any walk mode if transfer to mode %t5% from a transit mode is not allowed! ~:Next-Transit-Mode-10 ~r17+1 ~?!r17>%r23% ~$Transit-Mode-Loop-10 ~# ~#**for transfers to a walk mode** ~###Condition 2 (sufficient condition): ~#Transfer penalties are always less than the cost of going out of the node expanded and coming back. ~# ~# ~:Rule-Check-Done ~#----------done------------- ~####check transfer penalties ~# ~$M2M-Nodes ~:Expanding-Done ~# ~###shift coordinates back ~+;2.41;1;y;xi;xi+(%r98%);;*;4;q ~+;2.41;1;y;yi;yi+(%r99%);;*;4;q ~# ~t9= ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#if user wants to copy node attributes to the expanded network, set t9 ~#e.g. ~t9=ui1+@tn, which must be exist in the data bank. ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~t9= ~# ~?t9= ~$>Update-Node-Att-Done ~+;~p=2004;~t8=%%%p%%% ~+;~?t8=1;~!rm m2mna.tmp;~?t8=2;~!if exist m2mna.tmp del m2mna.tmp ~+;~?t8=1;~!rm m2mna-u.tmp;~?t8=2;~!if exist m2mna-u.tmp del m2mna-u.tmp ~>>m2mna-u.tmp ~"c %tp% ~"c %ts% ~"c Expanded network for nodes @m2mnd ~"t node attributes ~>> batchout=m2mna.tmp ~?!t9= ~+;2.41;1;n;%t9%;;not @m2mnd=0;;3;q batchout=^ ~/copy node attributes for all expanded nodes: %t9% ~<END ~>>m2mna-u.tmp ~"%t0% ~>> ~:Read-Node-Att-Loop ~+;~t0=~@;~?e;~$>Read-Node-Att-Done;~t8=%%%0%%%;~?t8=0;~$>Read-Node-Att-Done ~+;~t1=%1%;~%;~t7=%%%t0%%% ~#output attribute to the new node ~+;~y=%t1%;~y*%r2%;~y+%r1% ~+;~z=%y%;~z+%r2% ~:New-Node-Loop ~>>m2mna-u.tmp ~" %y% %t7% ~>> ~y+1 ~?!y>%z% ~$New-Node-Loop ~$Read-Node-Att-Loop ~:Read-Node-Att-Done ~# ~#batchin and update the node attributes ~<END ~t8=%1% ~+;~?!t8=inode;~$Read-Node-Att-Header-Loop ~<< ~#number of attributes+2 ~+;~y=%0%;~x=2 ~:Node-Attribute-Loop ~#attribute name, and if extra attribute t8 (=@) ~+;~t5=%%%%x%%%%;~t8=%%%t5.1%%% ~#batchin the attribute, must have already existed. batchin=m2mna-u.tmp ~+;2.41;3;%t5%;~?t8=@;n;*;1,%x%;n;y;q batchin=^ ~x+1 ~?x<%y% ~$Node-Attribute-Loop ~# ~:Update-Node-Att-Done ~###update node attribute### ~# ~:Network-Update-Done ~#expansion noly ~?r90=1 ~$>END ~# ~?!t1=NoExpansion ~$>Assignment ~########################################################################### ~#macro lines for assignment and results without expandsion of the network # ~########################################################################### ~##Following data is needed for the output, which is read from the m2mtras.rpt. ~## - dummy mode %t2.1% ~## - transit demand: %t2.-1% ~## - walk mode string: t3 ~## - transit mode string t4 ~## - node base: r1 ~## - node factor: r2 ~## - dummy node range: r24 r25 ~## - factors for the assignment ~#read the former report file: m2mtras.rpt ~x=0 ~<END ~##~?t0= ~##~+;~/Not a correct report, please check m2mtras.rpt;~$>END ~t8=%t0.5% ~?t8====== ~+;~x=1;~/;~/%t0% ~?t8====== ~+;~>>m2mtras.rpt;;;~"%t0%;~>>;~$>Next-Report-Line ~?x=2 ~+;~>>m2mtras.rpt;~"Macro arguments: %t1%;~>>;~$>Next-Report-Line ~?x=3; ~+;~>>m2mtras.rpt;~"Date: %d%;~>>;~$>Next-Report-Line ~?x=4; ~+;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=5; ~+;~>>m2mtras.rpt;~"Working Scenario: %s%;~>>;~$>Next-Report-Line ~?x=6; ~+;~t2=%3%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=7; ~+;~>>m2mtras.rpt;~"Node(s) for M2M Transfers: @m2mnd;~>>;~$>Next-Report-Line ~?x=8; ~+;~t2=%5% %t2%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=9; ~+;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=10; ~+;~t3=%5%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=11; ~+;~t4=%3%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=12; ~+;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=13; ~+;~r1=%4%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=14; ~+;~r24=%4%;~r25=%5%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=15; ~+;~r2=%4%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=16; ~+;~r3=%3%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=17; ~+;~r4=%4%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=18; ~+;~r5=%5%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~?x=19; ~+;~r6=%4%;~>>m2mtras.rpt;~"%t0%;~>>;~$>Next-Report-Line ~:Next-Report-Line ~x+1 ~?x<20 ~$Read-Former-Report-Loop ~# ~+;~t5=%t3%;~t6=%t4%;~r21=1;~r22=1;~r23=2 ~#find number of walk modes: r21 ~+;~t3=%%%t3.-1%%%;~?t3=;~$>No-Of-Walk-Modes-Done-R;~r21+1;~r23+1;~$ ~:No-Of-Walk-Modes-Done-R ~# ~#find number of transit modes: r22 ~+;~t4=%%%t4.-1%%%;~?t4=;~$>No-Of-Transit-Modes-Done-R;~r22+1;~r23+1;~$ ~:No-Of-Transit-Modes-Done-R ~+;~t3=%t5%%t6% ~# ~?r90=3 ~$>Output-Results ~?r90=4 ~$>Output-Results ~# ~############################## DONE ##################################### ~#macro lines for assignment and results without expandsion of the network # ~########################################################################### ~# ~#============== NETWORK UPDATE DONE ============ ~#=============================================== ~:Assignment ~/Start Transit Assignment ~# ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#please modify the following parts of the macro for your transit assignment ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~+;~t8=%t2.-1% ~#Preparing transit assignment 5.11 2 / transit assignment ~?q=2 2 %t8% / demand matrix / transit impedances / no in-vehicle time matrix / no auxiliary time matrix / waiting time matrix / no first waiting time matrix / no boarding time matrix / no number of boardings matrix ~# active modes * 1 / actual headways 1 / same boarding times %r3% / minutes boarding time 1 / same wait time factor 0.5 / wait time factor %r4% / wait time weight %r5% / aux time weight, IMPORTANT: this factor is used for creating mode z! %r6% / boarding time weight ~?q=1 n / no additional options ~#Performing transit assignment .................... 5.31 2 / report to printer ~# ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~# ~:Output-Results ~t9= ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~#t9=y, if show mode-to-mode transfer costs in the result table ~t9=y ~### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ~# ~#if summary only ~?r90=2 ~$>Summary-Results ~?r90=4 ~$>Summary-Results ~# ~/Start Ouptut Results ~###output the all nodes expanded ~+;~p=2004;~t8=%%%p%%% ~+;~?t8=1;~!rm m2mnd.tmp;~?t8=2;~!if exist m2mnd.tmp del m2mnd.tmp batchout=m2mnd.tmp ~+;2.41;1;n;xi+yi;;not @m2mnd=0;;3;q batchout=^ ~#finding the existing dummy nodes ~#ok#~+;2.42;2;1;@m2mdm;~?!e;nodes for m2m (connected with mode %t2.1%);;q ~+;2.41;1;y;@m2mdm;n;0;' ';*;4;q ~+;2.41;1;y;@m2mdm;n;i*(type.gt.-999);' ';5;mode=%t2.1%;;4;q ~+;2.41;1;y;@m2mdmj;n;j*(type.gt.-999);' ';5;mode=%t2.1%;;4;q ~# ~###output mode-to-mode transfer volume ~#========= Mode to Mode Volume Output ========== ~# processing node by node by reading m2mnd.tmp = ~#=============================================== ~#number of lines to be read: r11, number of lines read: r12 ~r11=1 ~:M2M-Nodes-10 ~r12=0 ~<Output-Done;~t8=%%%0%%%;~?t8<4;~$>Output-Done ~t1=%1% ~################################################## ~+;~/;~/Transfer volume on node: %t1% ~################################################## ~#Report ~>>m2mtras.rpt ~+;~";~"Transfers (ex. volumes on the same line) on node: %t1% ~>> ~+;~x=1;~t5=M2M;~t8=%t3%;~t6=_______ ~#output mode header: t5 ~:Output-Mode-Header-Loop ~+;~t7=%t8.1%;~t8=%t8.-1% ~t5=%t5%%t6%%t7%%t6% ~:Next-Output-Mode-Header ~x+1 ~?!t8= ~$Output-Mode-Header-Loop ~>>m2mtras.rpt ~"%t5% ~>> ~/%t5% ~# ~### check dummy links: x start mode count, y end mode count ~#-------------------------------------------------------- ~x=1 ~:I-Mode-Loop-10 ~#mode character of x: t7 ~+;~z=%x%;~z-1;~t8=%t3% ~+;~t8=%%%t8.-%z%%%%;~t7=%%%t8.1%%% ~+;~t5=%t7%-- ~# ~y=1 ~:J-Mode-Loop-10 ~#mode character of y: t6 ~##~+;~z=%y%;~z-1;~t8=%t3% ~##~+;~t8=%%%t8.-%z%%%%;~t6=%%%t8.1%%% ~# ~#i node: r41, j node: r42 ~#i node number: r41=i*r2+r1 + 2*x -2 ~+;~r41=%t1%;~r41*%r2%;~r41+%r1%;~r41+%x%;~r41+%x%;~r41-2 ~#j node number: r42=i*r2+r1-1 + 2*y ~+;~r42=%t1%;~r42*%r2%;~r42+%r1%;~r42-1;~r42+%y%;~r42+%y% ~# ~#mode x to mode y penalty: ms1?? ~+;~z=%x%;~z-1;~z*%r23%;~z+%y%;~z+100 ~+;~r47=%%%ms%z%%%% ~t7=(%r47.2_5%) ~# ~?r47>998 ~t7=( - ) ~# ~+;2.41;1;n;volax;;i=%r41%;and j=%r42%;;5;6;ms99;;;~z=%%%ms99%%% ~?z=0 ~+;~t4=---;q;~$>Output-Volume-10 ~+;4;ms99;volax;transfer volume on %r41%-%r42%;q ~r43=%ms99% ~t4=%r43.2% ~# ~:Output-Volume-10 ~##show transfer costs ~?t9=y ~+;~t5=%t5%%t4_>8%%t7_7% ~##not show transfer costs ~?!t9=y ~+;~t5=%t5%%t4_>15% ~# ~:Next-J-Mode-10 ~y+1 ~?!y>%r23% ~$J-Mode-Loop-10 ~#Report ~>>m2mtras.rpt ~"%t5% ~>> ~/%t5% ~# ~:Next-I-Mode-10 ~x+1 ~?!x>%r23% ~$I-Mode-Loop-10 ~#--------------------------------------------------- ~# ~$M2M-Nodes-10 ~:Output-Done ~# ~:Summary-Results ~#################################### ~+;~/;~/Transfer summary on all nodes;~/============================== ~#################################### ~#Report ~>>m2mtras.rpt ~+;~";~"Transfer summary on all nodes:;~"============================== ~>> ~+;~x=1;~t5=M2M;~t8=%t3%;~t6=_______ ~#output mode header: t5 ~:Output-Mode-Header-Loop-20 ~+;~t7=%t8.1%;~t8=%t8.-1% ~t5=%t5%%t6%%t7%%t6% ~:Next-Output-Mode-Header-20 ~x+1 ~?!t8= ~$Output-Mode-Header-Loop-20 ~>>m2mtras.rpt ~"%t5% ~>> ~/%t5% ~# ~### check dummy links: x start mode count, y end mode count ~#-------------------------------------------------------- ~x=1 ~:I-Mode-Loop-20 ~#min. start nodes: r13=%r24%+2*%x%-2 ~+;~r13=%r24%;~r13+%x%;~r13+%x%;~r13-2 ~#mode character of x: t7 ~+;~z=%x%;~z-1;~t8=%t3% ~+;~t8=%%%t8.-%z%%%%;~t7=%%%t8.1%%% ~+;~t5=%t7%-- ~# ~y=1 ~:J-Mode-Loop-20 ~#min. end nodes: r14=%r24%+2*%y%-1 ~+;~r14=%r24%;~r14+%y%;~r14+%y%;~r14-1 ~#mode character of y: t6 ~##~+;~z=%y%;~z-1;~t8=%t3% ~##~+;~t8=%%%t8.-%z%%%%;~t6=%%%t8.1%%% ~# ~#mode x to mode y penalty: ms1?? ~+;~z=%x%;~z-1;~z*%r23%;~z+%y%;~z+100 ~+;~r47=%%%ms%z%%%% ~t7=(%r47.2_5%) ~# ~?r47>998 ~t7=( - ) ~# ~+;2.41;1;n;volax;;i=%r13%,%r25%,%r2%;and j=%r14%,%r25%,%r2%;;5 ~+;6;ms99;;;~z=%%%ms99%%% ~?z=0 ~+;~t4=---;q;~$>Output-Volume-20 ~+;4;ms99;volax;transfer volume;q ~r43=%ms99% ~t4=%r43.0% ~# ~:Output-Volume-20 ~##show transfer costs ~?t9=y ~+;~t5=%t5%%t4_>8%%t7_7% ~##not show transfer costs ~?!t9=y ~+;~t5=%t5%%t4_>15% ~# ~:Next-J-Mode-20 ~y+1 ~?!y>%r23% ~$J-Mode-Loop-20 ~#Report ~>>m2mtras.rpt ~"%t5% ~>> ~/%t5% ~# ~:Next-I-Mode-20 ~x+1 ~?!x>%r23% ~$I-Mode-Loop-20 ~# ~# ~:END c='End m2mtras' ~# reports=^ ~/END