Post Reply 
41 Cistern Program
08-11-2016, 12:46 PM
Post: #1
41 Cistern Program
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
Find all posts by this user
Quote this message in a reply
08-13-2016, 08:29 AM (This post was last modified: 08-13-2016 10:07 AM by wojtek.)
Post: #2
RE: 41 Cistern Program
(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


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
08-13-2016, 11:06 AM
Post: #3
RE: 41 Cistern Program
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

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
08-13-2016, 12:18 PM
Post: #4
RE: 41 Cistern Program
(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
Find all posts by this user
Quote this message in a reply
08-13-2016, 06:29 PM
Post: #5
RE: 41 Cistern Program
(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.
Find all posts by this user
Quote this message in a reply
08-13-2016, 06:44 PM (This post was last modified: 08-13-2016 06:51 PM by wojtek.)
Post: #6
RE: 41 Cistern Program
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.
Find all posts by this user
Quote this message in a reply
08-13-2016, 09:41 PM (This post was last modified: 08-13-2016 09:56 PM by Gerson W. Barbosa.)
Post: #7
RE: 41 Cistern Program
(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 ).
Find all posts by this user
Quote this message in a reply
08-13-2016, 09:57 PM
Post: #8
RE: 41 Cistern Program
My favorable is Werner's:
<<
OVER / 1 SWAP - ACOS DUP +
DUP SIN - SWAP SQ * * 2 /
>>
Find all posts by this user
Quote this message in a reply
08-14-2016, 04:34 AM
Post: #9
RE: 41 Cistern Program
(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.
Find all posts by this user
Quote this message in a reply
08-14-2016, 07:07 AM
Post: #10
RE: 41 Cistern Program
(08-13-2016 09:41 PM)Gerson W. Barbosa Wrote:  Or, without SIN:

[Image: 261cb2282f86f426c32a46b2a92fa6ef.jpg]

SCNR :D

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
08-14-2016, 02:26 PM
Post: #11
RE: 41 Cistern Program
(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]
Find all posts by this user
Quote this message in a reply
08-14-2016, 05:19 PM
Post: #12
RE: 41 Cistern Program
(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 * - * *
  »
Find all posts by this user
Quote this message in a reply
08-15-2016, 05:20 PM (This post was last modified: 08-15-2016 05:48 PM by aurelio.)
Post: #13
RE: 41 Cistern Program
(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....
Find all posts by this user
Quote this message in a reply
08-15-2016, 07:06 PM
Post: #14
RE: 41 Cistern Program
(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
Find all posts by this user
Quote this message in a reply
08-15-2016, 07:28 PM
Post: #15
RE: 41 Cistern Program
(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!
Find all posts by this user
Quote this message in a reply
08-15-2016, 08:25 PM (This post was last modified: 08-15-2016 08:25 PM by aurelio.)
Post: #16
RE: 41 Cistern Program
(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)
Find all posts by this user
Quote this message in a reply
08-15-2016, 09:08 PM (This post was last modified: 08-15-2016 09:11 PM by wojtek.)
Post: #17
RE: 41 Cistern Program
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.
Find all posts by this user
Quote this message in a reply
08-16-2016, 01:56 AM (This post was last modified: 08-16-2016 02:12 AM by Gerson W. Barbosa.)
Post: #18
RE: 41 Cistern Program
(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.


Attached File(s)
.pdf  Horizontal cylindrical tank - partial volume.pdf (Size: 50.06 KB / Downloads: 21)
Find all posts by this user
Quote this message in a reply
08-16-2016, 05:49 AM
Post: #19
RE: 41 Cistern Program
(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 /
  »
Find all posts by this user
Quote this message in a reply
08-16-2016, 07:08 PM
Post: #20
RE: 41 Cistern Program
(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.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 14 Guest(s)