topic Re: Some help needed for a program to divide tube length in PTC Mathcad
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217732#M85262
<HTML><HEAD></HEAD><BODY><P>I, too, can't see the problem you have.</P><P>You demand a function which should calculate vector(s) of pieces of unittubes for varius pipe sections.</P><P></P><P>Lets clarify input and output of that function.</P><P>INPUT: We sure need a minimum of three input values</P><UL><LI>Length of the current (last) section; thinks thats z in your flowchart</LI><LI>Length of unit pipe (Lu)</LI><LI>Some information about what happened before. This could be</LI></UL><OL><LI>the last value from the vector of the section before</LI><LI>the total length of all sections before</LI><LI>the section length of every section before (which is the most natural approach in my opinion and is what Alan and Fred had chosen)</LI><LI>the whole vector of vectors of unitparts calculated so far (which looks like you try to do in your sheet)</LI></OL><P></P><P>OUTPUT: what should it be?</P><UL><LI>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)</LI><LI>just the vector of unit segments of the last section</LI></UL><P></P><P>Anyway I think you already got the solution for your problem from both Alan and Fred.</P><P>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.</P></BODY></HTML>Sat, 23 Nov 2013 14:55:12 GMTWerner_E2013-11-23T14:55:12ZSome help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217725#M85255
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.Thu, 03 May 2018 16:46:41 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217725#M85255Liv2018-05-03T16:46:41ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217726#M85256
<HTML><HEAD></HEAD><BODY><P>How about the following:</P><P></P><P><IMG __jive_id="60738" alt="proglen.PNG" class="jive-image-thumbnail jive-image" src="https://community.ptc.com/legacyfs/online/60738_proglen.PNG" width="450" /></P><P>I've just supplied this as an image as I can't save back to MC2001 format from MC15.</P><P>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. </P><P></P><P>Alan</P></BODY></HTML>Tue, 05 Nov 2013 14:56:51 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217726#M85256AlanStevens2013-11-05T14:56:51ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217727#M85257
<HTML><HEAD></HEAD><BODY><P><EM>Please see function Tubes</EM></P></BODY></HTML>Tue, 05 Nov 2013 15:03:36 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217727#M85257Fred_Kohlhepp2013-11-05T15:03:36ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217728#M85258
<HTML><HEAD></HEAD><BODY><P>Thank you both a lot, Alan & Fred. It seems that's I was trying to do.</P><P> But I'am sorry now, I'll look closer to your programs later, because I have a train to catch ... <IMG src="https://community.ptc.com/legacyfs/online/emoticons/confused.png" /></P><P></P><P>Liv</P></BODY></HTML>Tue, 05 Nov 2013 16:28:02 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217728#M85258Liv2013-11-05T16:28:02ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217729#M85259
<HTML><HEAD></HEAD><BODY><P>Sorry for my late reaction, but I was away several days and plenty of work meanwhile.</P><P>Though, part of my problem is still there. </P><P>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.</P><P>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. </P><P>This was my main difficulty on programming in Mathcad, according the depicted algorithm posted initially. </P><P>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... </P><P></P><P>Many thanks for any help,</P><P>Liv . </P></BODY></HTML>Sat, 23 Nov 2013 00:17:23 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217729#M85259Liv2013-11-23T00:17:23ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217730#M85260
<HTML><HEAD></HEAD><BODY><P>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.</P><P></P><P>TTFN</P></BODY></HTML>Sat, 23 Nov 2013 05:54:23 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217730#M85260IRstuff2013-11-23T05:54:23ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217731#M85261
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P>Arbiter 007 wrote:</P><P></P><P>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.</P><P></P><P>TTFN</P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Likewise!</P><P></P><P>Alan</P></BODY></HTML>Sat, 23 Nov 2013 09:07:53 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217731#M85261AlanStevens2013-11-23T09:07:53ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217732#M85262
<HTML><HEAD></HEAD><BODY><P>I, too, can't see the problem you have.</P><P>You demand a function which should calculate vector(s) of pieces of unittubes for varius pipe sections.</P><P></P><P>Lets clarify input and output of that function.</P><P>INPUT: We sure need a minimum of three input values</P><UL><LI>Length of the current (last) section; thinks thats z in your flowchart</LI><LI>Length of unit pipe (Lu)</LI><LI>Some information about what happened before. This could be</LI></UL><OL><LI>the last value from the vector of the section before</LI><LI>the total length of all sections before</LI><LI>the section length of every section before (which is the most natural approach in my opinion and is what Alan and Fred had chosen)</LI><LI>the whole vector of vectors of unitparts calculated so far (which looks like you try to do in your sheet)</LI></OL><P></P><P>OUTPUT: what should it be?</P><UL><LI>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)</LI><LI>just the vector of unit segments of the last section</LI></UL><P></P><P>Anyway I think you already got the solution for your problem from both Alan and Fred.</P><P>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.</P></BODY></HTML>Sat, 23 Nov 2013 14:55:12 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217732#M85262Werner_E2013-11-23T14:55:12ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217733#M85263
<HTML><HEAD></HEAD><BODY><P>Werner, you are right and you put my problem in plain English, thus better than I did.</P><P>INPUT & OUTPUT as you wrote, but excepting (as I was initially thinking that was easier to program) :</P><P>- as third input, item "1. the last value from the vector of the section before" alone. </P><P>- as output, "just the vector of unit segments of the last section".</P><P></P><P>Folks, you are right, I can get the solution I was looking for with both functions of Alan and Fred - see attached (Mcd2001). It was easier than I've imagined and I should have studied them better <IMG src="https://community.ptc.com/legacyfs/online/emoticons/confused.png" />... </P><P>I used 'submatrix' to get a one-number vector in the case of the first sector alone. </P><P>It was a little bit tricky to figure out how to write the needed "if" and "otherwise".</P><P></P><P>In the current stage, my project wants to estimate the needed length of the tube coil inside the convection zone of a fired heater in order to heat gasoline from around 100 C to about 600 C and to establish parameters pressure and temperature in some selected points along the coil. Calculation uses several simplifying assumptions and it's quite straightforward. I'll post it too, but first I need first to arrange it a little bit and translate the text inside into English.</P><P></P><P>Many thanks to all,</P><P>Liv. </P><P></P><P></P><P></P><P></P><P> </P></BODY></HTML>Mon, 25 Nov 2013 00:07:49 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217733#M85263Liv2013-11-25T00:07:49ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217734#M85264
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P>I used 'submatrix' to get a one-number vector in the case of the first sector alone. </P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Not necessary. You can put L.C[0 inside a 1x1 matrix.</P><P>You may add vectorindex 0 (as I did in the first expression) to get the vector alone and not nested, if thats needed.</P><P><IMG __jive_id="61810" alt="25.11.png" class="jive-image" src="https://community.ptc.com/legacyfs/online/61810_25.11.png" /></P><P></P><P>If you prefer to only get back the vector for the last segment you can change Alan's or Fred's routines in the very last line.</P><P>Replace "B" for "B[last(B)" (or the same with v in Alans routine). [ denotes the vector index.</P><P></P><P>Her is yet another routine which returns the vector for the last segment only.</P><P>As I cannot save in MC2001 format I attach a pdf.</P></BODY></HTML>Mon, 25 Nov 2013 00:33:00 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217734#M85264Werner_E2013-11-25T00:33:00ZRe: Some help needed for a program to divide tube length
https://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217735#M85265
<HTML><HEAD></HEAD><BODY><P>Werner, you are right. </P><P>It's not possible to directly insert a 1x1 matrix/vector in Mcd2001, but this allowed in Mcd15 (and probably in other more recent versions too), as I've noticed with the free trial version 15.</P><P></P><P>Thanks a lot again,</P><P>Liv. </P></BODY></HTML>Mon, 25 Nov 2013 12:16:07 GMThttps://community.ptc.com/t5/PTC-Mathcad/Some-help-needed-for-a-program-to-divide-tube-length/m-p/217735#M85265Liv2013-11-25T12:16:07Z