SUB HDDWRB(field$(), err.msg$) ! ! write back flow and pipe diameter information following a Hardy Cross run ! {BL:[101,5]FCSERRCOM.B4S} {BL:[101,5]TRUTH.B4S} ! {HDDDEF.B4S} ! {HDDMAP.B4S} ! ! we have a line with loop ! pipe ! diam ! flow ! ! take each line in turn (don't worry if we over-write a record due to the pipe occurring twice) ! the FLOW will be in the direction of the LOOP. We thus have to see which sense the loop is ! in relation to the original pipe as defined by NODE1% and NODE2%, and apply it to the flow ! before writing the flow back to the pipe record. ! pi.pe% = val(field$(2%)) lo.op% = val(field$(1%)) ! ! print "WRB: pi.pe%, lo.op%"; pi.pe%; lo.op% ! CALL GET.(.pipe.chan%, pipe$, pi.pe%) ! get the pipe record into the buffer ! diam = val(field$(4%)) ! over-write the diameter from the LINES record ! CALL GET.(.loop.chan%, loop$, lo.op%) ! get the loop record into the loop buffer ! nod% = 0% ! WHILE l.node%(nod%) n1.index% = nod% IF (l.node%(nod%) = node1%) n2.index% = nod% IF (l.node%(nod%) = node2%) nod% = nod% + 1% NEXT ! IF (((n2.index% - n1.index%) = 1%) OR ((n2.index% = 0%) AND (n1.index% > n2.index%))) & THEN sense% = 1% & ELSE sense% = -1% ! pipeflow = sense% * val(field$(5%)) ! print "loop, pipe, sense, q: "; lo.op%, pi.pe%, sense%, pipeflow ! CALL PUT.(.pipe.chan%, pipe$, pi.pe%) ! write out the pipe record ! SUBEND