- 91 Views
- Uploaded on
- Presentation posted in: General

Subroutes. All U.S. and All U.S. CAN. Purpose of this worksheet.

Subroutes

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Subroutes

All U.S. and All U.S. CAN

- To support the calculation of trip category depth-cost tables for the SVM from final (November 2010) GLSAND outputs. There are two analogous worksheets, for US-US and US-CAN trips; they work exactly the same way. This slide show explains the US-US worksheet:
- Reads trip codes from the 24 monthly GLSAND output worksheets
- Makes a final list in the range A1:M300 based on several iterations of reading and analysis.
- The first value for January (cell B5) illustrates the process.

- The value of cell B5 is 422,288,312, a code for one trip category that decodes to the subroute (4), the eastern lake (2) and the western lake (also 2), eastern dock depth 288”, western dock depth 312”.
- This is a trip that takes place entirely on Lake Erie (lake 2) and that makes the sub-route Erie, code 4.
- In contrast, the value of cell B9 is 1023,288,252 and that illustrates a two lake trip, subroute 10 between eastern lake 2 (Erie) and western lake 3 (Lake St. Clair) with an Erie dock depth of 288” and a Lake St. Clair dock depth of 252”.

- The formula for cell B5 is IF(BC5="","",CONCATENATE(BC5,AP5,",",DG5))
- That formula is repeated throughout the entire B5:M300 range
- First, if the formulas leading to cell BC5 create a blank value for BC5, then B5 would also be blank, but that’s not true so
- B5 is a concatenation of BC5 (the subroute), AP5 (the east-west two lake code), a comma, and then DG5, which is the east and then west dock depths separated by a comma.
- Next, the definitions of BC5 and AP5. DG5 is defined later.

- BC5 is the subroute code, here “4”. The formula for cell BC5 is: IF(AP5="","",VLOOKUP(AP5,$BO$5:$BP$40,2))That formula is repeated throughout the entire BC5:BN300 range
- First, if the formulas leading to cell AP5 create a blank value for AP5, then BC5 would also be blank, but that’s not true so BC5 is defined by a vertical lookup:
- Find the value in AP5 in column BO and read the value in column BP next to that cell.

- AP5 is the two digit east-west lake code, 22
- Column BO is the list of sub-routes. Cell BO19 holds code 22 (Erie-Erie). Cell BP19 holds the sub-route number for that lake combination, 4.

- AP5 = 22. The formula for cell BC5 is IF(P5="","",IF(AC5,CONCATENATE(MID(P5,2,1),LEFT(P5,1)),LEFT(P5,2))). That formula is repeated throughout the entire AP5:BA300 range
- First, if the formulas leading to cell P5 create a blank value for P5, then AP5 would be blank, but that’s not true so AP5 is defined by a concatenation drawn from the values in cells AC5 (TRUE or FALSE) and P5, which is the trip code less the route number 22,288,312.
- AC5 is TRUE if the order of the lakes in P5 is West, East. IF AC5 is TRUE, concatenate:
- The number found within P5 by moving 2 from the far left and grabbing 1 digit (22,288,312)
- The number found within P5 by taking the leftmost digit (22,288,312)

- If AC5 is FALSE, the AP5is the leftmost 2 digits from P5 ((22,288,312)
- Note, when the east and west lakes are the same, it doesn’t make any difference, but AC5 is defined as FALSE (see next slide)

- AC5 = FALSE. The formula for cell BC5 is IF(P5="","",IF(LEFT(P5,1)>MID(P5,2,1),TRUE(),FALSE)). That formula is repeated throughout the entire AC5:AN300 range
- First, if the formulas leading to cell P5 create a blank value for P5, then AC5 would be blank, but that’s not true so AC5 is defined as TRUE if the first lake code in P5 is larger than the second lake code in P5. Because the numbers increase as you go west - St. Lawrence River (0), Lake Ontario (1), Erie (2), Lake St. Clair (3), Michigan-Huron (4), Superior (5) – TRUE means the lakes are arranged west-east.
- If the lakes are the same or arranged west-east, AC5 is FALSE, and that is used in cell AP5 to reverse them to create an east-west order. Where the first number is larger than the second (for example, 42 in cell P10) then the lakes are arranged east-west, AC10 is TRUE and AP5 reads the lake code order as it is.

- P5 = 22,288,312. The formula for cell P5 is CONCATENATE('CODcost1-US-US'!$B3,'CODcost1-US-US'!$D3,",",'CODcost1-US-US'!$C3,",",'CODcost1-US-US'!$E3). That formula is repeated throughout the entire P5:AA300 range
- This formula simply checks the GLSAND output and returns a trip category code for a trip or a blank if there is no trip
- The formulas in column P look up US-US trips made in January; column Q is February, and so on. The month is hard coded by CODcost1-US-US; the 1 signifies January, the US-US means both the origin and destination ports are in the United States.
- The row specified in the concatenation (here 3) changes with the row of the formula. It is 3 in cell P5, 4 in cell P6 and so on.
- The concatenation
- grabs the origin lake in cell 'CODcost1-US-US'!$B3
- the destination lake code in cell D3
- inserts a comma,
- then grabs the origin dock depth in cell C3,
- another comma
- and the destination dock depth in cell E3.

2

2

,

288

,

312

- The last few slides have documented the derivation of the first part of B5, the route code and east and west lake codes, drawn from cells BC5 and AP5, tracing AP5 from AC5 and AC5 from P5. The last part of B5 is the east and west dock depths, and those are pulled from cell DG5.
- DG5 = 288,312. The formula for cell DG5 is IF(P5="","",IF(AC5,CONCATENATE(CT5,",",CG5),CONCATENATE(CG5,",",CT5))). That formula is repeated throughout the entire DG5:DR300 range
- As with the other formulae, the first check is to see if P5 is blank; if so,DG5 will be made blank, too.
- But it’s not so DG5 defined as either as the concatenation of CT5 (destination lake), comma, CG5 (origin lake) if AC5 is true (meaning CT5 destination lake is west of CG5 origin lake) or the reverse, CG5,comma,CT5, if the origin lake is east of the destination lake.
- All that remains to explain are cells CG and CT5, the codes for the origin and destination lakes.

- Both are defined using the MID function to grab characters from the route information in cell P5
- CG5 is 288, defined as: IF(AP5="","",IF(LEFT(AP5,1)=1,888,IF(LEFT(AP5,1)=0,999,MID(P5,4,3)))).
- That means that
- If AP5,the east lake code-west lake code, is blank, then CG5 is blank
- If not, then if the farthest left character in the two lake code is 1 assign the value 888 to CG5; if it’s 0, assign 999, but otherwise takes the 4th, 5th and 6th characters from P5.

22,288,312

288

CT5 takes the last 3 (312)

Origin dock depth codes in CG5:CR300

Final subroute-lakes-dock depth codes in B5:M300

Origin lake-destination dock depthcodes in P5:AA300

Destination dock depth codes in CG5:CR300

East lake – West lake codes in AP5:BA300

Final subroutecodes in BC5:BN300

Origin lake-destination lake codes in P5:AA300 (TRUE if lakes are ordered west-east in P5

TRUE/FALSE codes in AC5:AN300 (TRUE if lakes are ordered west-east in P5

Trip information in US-US Cost 1 (January) through US-US Cost 12 (December)