HP Forums

Full Version: 41 Cistern Program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Members

Does anyone have the program listing (key-codes etc.) for the CISTERN program described in the 13 April 1992 edition of Oil & Gas Journal article Simple Program Calculates Partial Liquid Volumes in Vessels? The program listing was available by request to anyone asking with a no-later-than date of 30 July 1992.

BEST!
SlideRule
(08-11-2016 12:46 PM)SlideRule Wrote: [ -> ]Does anyone have the program listing (key-codes etc.) for the CISTERN program described in the 13 April 1992 edition of Oil & Gas Journal article Simple Program Calculates Partial Liquid Volumes in Vessels? The program listing was available by request to anyone asking with a no-later-than date of 30 July 1992.
Firstly sorry for typos, I am lying on a hospital bed and use my smartphone.
I don't have this journal, but perhaps this can be of help to you. If I understood your problem cerrectly you would like to know a partial volume of liquid in a cy
lindrical vessel set horizontally on the ground, given the depth of liquid in the vessel. I am rather weak at math but after a short search of the internet I found a formula for this problem. Details are on the picture attached. So, given the R and L (radius and lenght of the cistern respectively) and H (measured depth of liquid) the program for 50g could be something like:

<< -> H << Pi R 2 ^ * 1 H R / - acos * 180 / R H - H R 2 * * H 2 ^ - sqrt * - L * 2 / ->num >> >>
Original formula had no division by 2 at the end and gave wrong results for the full and half full vessel. Addind this division by 2 gives correct results for H=0, R and 2R.
Hope to help a little
PS. 50g should be in degree mode, H is on the stack, R and L in global variables.
PS2. The formula is for circular cross-section, for other shapes, eliptical for example would be more complicated
Or (in radians, L, R, H on stack):

Code:
\<<
  \-> L R H
  \<<
    1 H R / - ACOS DUP +
    DUP SIN - L * R SQ * 2 /
  \>>
\>>

stack only:

Code:
\<<
  OVER / 1 SWAP - ACOS DUP +
  DUP SIN - SWAP SQ * * 2 /
\>>

Cheers, Werner
(08-13-2016 08:29 AM)wojtek Wrote: [ -> ]... I don't have this journal, but perhaps this can be of help to you. If I understood your problem cerrectly ...

Thank you for the reply. I hope the health improves & you soon see the backside of hospital. Get well!

I have the journal article (see attachment) and it is inclusive with illustrations and formula: great layout. A program for the 41 calculator is described but the listing is by request: not included with the article.
[attachment=3825]

Thanks again & hope for a speedy recovery!

BEST!
SlideRule
(08-13-2016 12:18 PM)SlideRule Wrote: [ -> ]Thank you for the reply. I hope the health improves & you soon see the backside of hospital. Get well!
.....
Thanks again & hope for a speedy recovery!

BEST!
SlideRule

Thank you very much.
Check this link
xls :
http://Partial Liquid Volumes in Horizontal Vessels - Engineering.com
There is some code in VB to calculate the partial volume. If it is not protected you could see it and adapt to your needs, maybe. I cannot check it now as I have no access to a computer.
Or better check this link:
http://www.ogj.com/articles/print/volume...ssels.html
There are examples to Pierre Koch's original article there, the one you have, but somewhere in the middle there is Editor's note that it is possible to get printed copy of the full program code. Maybe it is still possible.
(08-13-2016 11:06 AM)Werner Wrote: [ -> ]Or (in radians, L, R, H on stack):

Code:
\<<
  \-> L R H
  \<<
    1 H R / - ACOS DUP +
    DUP SIN - L * R SQ * 2 /
  \>>
\>>

stack only:

Code:
\<<
  OVER / 1 SWAP - ACOS DUP +
  DUP SIN - SWAP SQ * * 2 /
\>>

Or, without SIN:

Code:

«  L R H
  « 'L*(SQ(R)*ACOS(1-H/R)+(H-R)*√(H*(2*R-H)))' EVAL
  »
»

Regards,

Gerson.

P.S.: That's essentially the same formula provided by Wojtek. I hadn't seen the attachment, instead I used one I had derived years ago when solving a perhaps more interesing problem ( Time to drain a horizontal cylindrical tank ).
My favorable is Werner's:
<<
OVER / 1 SWAP - ACOS DUP +
DUP SIN - SWAP SQ * * 2 /
>>
(08-13-2016 09:57 PM)wojtek Wrote: [ -> ]My favorable is Werner's:
<<
OVER / 1 SWAP - ACOS DUP +
DUP SIN - SWAP SQ * * 2 /
>>

Trade-offs, one cannot have it all. 33.3% larger, but 22,4% faster (on my HP 50g), radians mode:

Code:

  « DUP2 OVER / 1 SWAP 
     - DUP ACOS ROT * ROT
     4 PICK DUP + OVER - *
     √ ROT * - * *
  »

Regards,

Gerson.
(08-13-2016 09:41 PM)Gerson W. Barbosa Wrote: [ -> ]Or, without SIN:

[Image: 261cb2282f86f426c32a46b2a92fa6ef.jpg]

SCNR :D
(08-14-2016 07:07 AM)Massimo Gnerucci Wrote: [ -> ]
(08-13-2016 09:41 PM)Gerson W. Barbosa Wrote: [ -> ]Or, without SIN:

[Image: 261cb2282f86f426c32a46b2a92fa6ef.jpg]

SCNR Big Grin

[Image: OwAnBPwrq]
(08-14-2016 04:34 AM)Gerson W. Barbosa Wrote: [ -> ]radians mode:

Code:

  « DUP2 OVER / 1 SWAP 
     - DUP ACOS ROT * ROT
     4 PICK DUP + OVER - *
     √ ROT * - * *
  »

Regardless the angle mode:

Code:

  « DUP2 OVER / 1 SWAP 
    - DUP ACOSH IM ROT *
    ROT 4 PICK DUP + OVER
    - *  √ ROT * - * *
  »
(08-13-2016 08:29 AM)wojtek Wrote: [ -> ]Original formula had no division by 2 at the end and gave wrong results for the full and half full vessel. Addind this division by 2 gives correct results for H=0, R and 2R.
Hi wojtek, hope you feel now better and you are already at home (or enjoying holidays).
thank-you very much for the help
I've tried applying also other programs kindly supplied here and in other places to solve the problem.
We calculate the area of the circular segment, reported for the lenght of the vessel, but I don't understand the need in dividing by 2....
(08-15-2016 05:20 PM)aurelio Wrote: [ -> ]Hi wojtek, hope you feel now better and you are already at home (or enjoying holidays).
.......
We calculate the area of the circular segment, reported for the lenght of the vessel, but I don't understand the need in dividing by 2....

Not yet, they'll keep me till the end of this week probably. On the positive - they are serving good eating here! And I'm glad that I took 50g with me. Thank you.

As for the 2/, I have not analyzed the problem too much, just did a few tests.
So, for the half full vessel you have H=R.Assuming R=1, L=10 the partial volume is 7.85 with 2/ and 15.71 without 2/. The 7.85 is correct as 15.71 is the total volume the vessel. But double check this reasoning as I can be not at my full mental abilities
(08-15-2016 05:20 PM)aurelio Wrote: [ -> ].... I don't understand the need in dividing by 2....
Oh no, you're right! Adding 2/ at the end was a mistake as volume of full vessel from example above is 31.42, not 15.70 !
Sorry for the mistake, I must be really ill.
Thank you aurelio!
(08-15-2016 07:06 PM)wojtek Wrote: [ -> ]On the positive - they are serving good eating here! And I'm glad that I took 50g with me.

I was lying on a hospital bed recently, but not so lucky with meals....glad me too to have brought with me a PC and a calculator Smile

All the best

I'm curious, I confess, regard this matter 'cause I was never involved before, in processing and storage of vessels;
very interesting so reading and understanding solutions for other cases (different shape, inclined position)
I am complete beginner in this field as well. I just found the problem interesting, besides in a hospital one has to do something to not go nuts.
As for inclined position I do not know how they measure the H - depth of the liquid in a vessel.
(08-15-2016 09:08 PM)wojtek Wrote: [ -> ]I am complete beginner in this field as well. I just found the problem interesting, besides in a hospital one has to do something to not go nuts.

Last time I laid in a hospital bed, twelve years ago, I was so ill I wouldn't read, watch TV, much less use a calculator or a notebook. I was meant to stay there only for a day or two after the appendicetomy but something went south and I had to undergo a second surgery four days later. As a result I spent three days in the ICU and three more weeks at the hospital before recovering and finally going home. Glad to know you are fine and even solving interesting problems during your stay :-)

Not a specialist here either. Anyway, FWIW, the attached PDF shows a step-by-step solution to this problem. It's in Portuguese, but the formulas looks exactly the same, except that sin(x) is written sen(x). So, no SIN at all this time.

Best regards,

Gerson.
(08-14-2016 05:19 PM)Gerson W. Barbosa Wrote: [ -> ]Regardless the angle mode:

Code:

  « DUP2 OVER / 1 SWAP 
    - DUP ACOSH IM ROT *
    ROT 4 PICK DUP + OVER
    - *  √ ROT * - * *
  »

Or, using the optimal formula rearrangement in SlideRule's attachment:

Code:

  « OVER / 1 SWAP - DUP 
    ACOSH IM SWAP 1 OVER 
    SQ - √ * - SWAP SQ * *
  »

Or, if the stack contains the more usual L D H instead of L R H:

Code:

  « DUP + OVER / 1 NEG 1
     + DUP ACOSH IM SWAP 1
     OVER SQ - √ * - SWAP
     SQ * * 4 /
  »
(08-13-2016 11:06 AM)Werner Wrote: [ -> ]Or (in radians, L, R, H on stack):

. . .

stack only:

Code:
\<<
  OVER / 1 SWAP - ACOS DUP +
  DUP SIN - SWAP SQ * * 2 /
\>>

Or, regardless the angle mode, but at the cost of 2.5 bytes and a few milliseconds more:

« OVER / 1 SWAP - DUP
ACOSH IM SWAP DUP
ACOS SIN * - SWAP SQ * *
»

Best regards,

Gerson.
Pages: 1 2 3
Reference URL's