Skip to main content
7-Bedrock
November 5, 2013
Solved

Some help needed for a program to divide tube length

  • November 5, 2013
  • 4 replies
  • 4096 views

I'd like my programming module to produce a vector with the pipe lengths belonging to various sectors of pipe.

Details, example and my attempt are given in the attached Mcd2001 file.

Obviously I am not too good in programming ...

Thank you very much for any help,

Liv.

Best answer by Werner_E

I, too, can't see the problem you have.

You demand a function which should calculate vector(s) of pieces of unittubes for varius pipe sections.

Lets clarify input and output of that function.

INPUT: We sure need a minimum of three input values

  • Length of the current (last) section; thinks thats z in your flowchart
  • Length of unit pipe (Lu)
  • Some information about what happened before. This could be
  1. the last value from the vector of the section before
  2. the total length of all sections before
  3. the section length of every section before (which is the most natural approach in my opinion and is what Alan and Fred had chosen)
  4. the whole vector of vectors of unitparts calculated so far (which looks like you try to do in your sheet)

OUTPUT: what should it be?

  • a vector of vectors showing the segmentation of all the sections so far (which your sheet seems to indicate and what Alan and Fred have shown you how to do)
  • just the vector of unit segments of the last section

Anyway I think you already got the solution for your problem from both Alan and Fred.

If you know just the length of LC1 and LC2 so just call their function with a vector as parameter consisting of LC1 and LC2 only. Then go ahead with your calculations and eventually you will arrive at LC3. Then call their function again with a vector (LC1,LC2,LC3) as parameter, etc.

4 replies

19-Tanzanite
November 5, 2013

How about the following:

proglen.PNG

I've just supplied this as an image as I can't save back to MC2001 format from MC15.

The last line of the for loop in sectionlengths should probably be 'vj = stack(vj,z) if z>0' to avoid an occasional unwanted zero length appearing.

Alan

23-Emerald I
November 5, 2013

Please see function Tubes

Liv7-BedrockAuthor
7-Bedrock
November 5, 2013

Thank you both a lot, Alan & Fred. It seems that's I was trying to do.

But I'am sorry now, I'll look closer to your programs later, because I have a train to catch ...

Liv

Liv7-BedrockAuthor
7-Bedrock
November 23, 2013

Sorry for my late reaction, but I was away several days and plenty of work meanwhile.

Though, part of my problem is still there.

Initially I know only the length LC1 of the first sector, but not the lengths of the subsequent sectors (LC2, LC3, ...). Length LC2 of the second sector is farther computed in my project, after some other calculations. Length LC2 (and indeed its distribution in unit tubes) depends thus on both LC1 and LC1 distribution into unitary Lu tubes or parts of unitary tubes.

Summing up, I was looking for a program able to carry out the division into unitary tubes (or fragments of) of the sector i ALONE, which would be (inherently) based on the distribution into tubes (or fragments) of the i-1 sector. Excepting obviously the first sector, since it starts from 0.

This was my main difficulty on programming in Mathcad, according the depicted algorithm posted initially.

My last true programs go back to many years ago and to Fortran where lines involved in loops have labels and can be adressed correspondingly. But there are not lines labels in Mathcad programming modules...

Many thanks for any help,

Liv .

1-Visitor
November 23, 2013

Perhaps, you could present a worked out, annotated, manual numerical example. I see the words, but I can't really relate them to a process.

TTFN

19-Tanzanite
November 23, 2013

Arbiter 007 wrote:

Perhaps, you could present a worked out, annotated, manual numerical example. I see the words, but I can't really relate them to a process.

TTFN

Likewise!

Alan