0
|
7808 Views
|
15 Replies
|
5 Total Likes
View groups...
Share
GROUPS:

# Amount of liquid in a tank that isn't level

Posted 10 years ago
 Hello,This is my the first time here.How can I calulate the amount of liquid in a fuel oil tank if the tank is not level?Looking down from the top of the tank there is an x and y axis. The x axis is running the length of the tank and the y is front to back. At one end I have a sensor measuring  the height of the liquid. If the tank is off on the y axis I wiil get a false reading. The same holds true for the x axis.If both are off the same, a false reading. I was never good at math. So if someone has a formula I would very much appreciate it. Or point me in the right direction.Thank you for any and all help,Ken
15 Replies
Sort By:
Posted 10 years ago
 Hello again, Ken.One of the fun things in this group is that people post entertaining problems. I found yours so interesting that I couldn't help thinking about it. I have a nice approach to this that is too long to post in the snippets we use here, but if you contact me I will email you a notebook.I think they don't like posting personal email addresses here, but you can contact me through my web site which is listed on my profile. (You will see there that I am a consultant, but this is not an offer to work -- I did this for the fun of it and will send you the notebook.)Best regards,David  Posted 10 years ago
 I'll make a rough approximation here and you can try to decide whether it is good enough or not.You said you were measuring from one end and trying to estimate how much was in the (slightly) tilted tank. Since the angle is "small", only a few degrees, and the tank isn't completely full or completely empty, so that tilting wouldn't change the amount, then I would multiply the amount calculated from the depth up or down by the sine of the angle of the tilt.If the far end is tilted down 4 degrees then I would estimate there is more in the tank that the measurement says. Since sin(4 degrees) is 0.0697 I would add 0.0697*measured amount to give adjusted amount.If the far end is tilted up 2 degrees then I would estimate there is less in the tank than the measurement says. Since sin(2 degrees) is 0.0349 I would subtract 0.0349*measured amount to give the adjusted amount.WolframAlpha.com can calculate sine for youhttp://www.wolframalpha.com/input/?i=sin+4+degreesMathematica can do the same, but it is finicky about capitalization and () and [] and decimal pointsIn:= Sin[4. Degree]Out= 0.0697565See if you can do anything to determine whether this approximation will be good enough for you or not.And this approximation is far far simpler than what the math folks would usually do to get an answer for this.
Posted 10 years ago
 It is difficult enough to make certain mathematics is right. Trying to understand a verbal description is even more likely to result in errors. I realize how close to impossible it is to get a diagram done well and perhaps even more difficult to post it here, but a really good clear diagram, something that someone who hasn't been looking over your shoulder and watching what you have been doing for the last couple of days would be certain to understand would be really helpful.I just can't trust that I really understand exactly how the tank is oriented and which way it is tilting, etc, etc, etc.Imagine for a moment you are trying to figure out what I'm describing when you haven't been here and can't see all the work I've done.Second, not an extra .0697 gallons but an extra 500*.0697 gallons which is a total of 534.85 gallons.AND, think if there is any way you might be able to actually measure the total amount for some small known angle so you can try to verify this estimate process.
Posted 10 years ago
 Hi Ken,This is a very typical volume integration problem. The math issue is not the problem of finding the integral -- the integrand is 1. The problems arise because the boundary conditions force you to break the problem up into numerous subintegrals, generaly where the upper integration limits are functions of the lower integration variables. With this tank problem, the number and nature of the subintegrals depends on how full the tank is and how it's tilted. Very clumsy.One alternative numerical strategy is overfilling the volume with random points and testing them to determine how many are in the tank, and of those how many are under the top of the liquid level. An example might be a 2D integration of a complex shape. It may be diffcult to segment a symbolic integral, but if you can define a simpler test to see if a point is inside the boundary, and you overfill the region with a known number of random points in a known area, then you know the area per point. You can just count the random points inside the region to estimate its area. The more points the better.In the code below, I assume a recatangular tank. To make matters simple, I leave the tank level and tilt and displace the liquid level. The liquid level is defined by having a fixed height above a measurement point on the tank base, with a level plane defined by its normal vector. (The usual point-vector definition for a plane.) It's the same problem. Then I fill the entire tank with random points. (If the tank was more complex, it would be easier to fill a larger region and select out the points in the tank.) Then the points are tested to select only those which are under the plane defining the liquid level. Counting the points gives the fill of the tank.The code below can be executed if loaded into Mathematica and separated into individual cells.Best,David (* Define tank volume lxwxh and determine if {x,y,z} is in the tank *)   inTank[{x_, y_, z_}, {l_, w_, h_}] := -l/2 < x < l/2 && -w/2 < y <     w/2 && 0 < z < h  (* define z[{x_,y_},{xm_,ym_,zm_},{xt_,yt_,zt_}] for {x,y} on the \ tank floor and liquid measured to have depth zm above the point \ {xm_,ym} on the tank floor, and with the liquid surface a plane \passing through measurement point {xm,ym,zm} and normal to vector \{xt_,yt_,zt} which defines the tilt of the liquid surface *)z[{x_, y_}, {xm_, ym_, zm_}, {xt_, yt_, zt_}] := Module[  {nx, ny, nz, zz},  {nx, ny, nz} = Normalize[{xt, yt, zt}];  zz /. Solve[{nx, ny, nz}.({x, y, zz} - {xm, ym, zm}) == 0, zz][]  ](* Fill the tank with random points *)points[{l_, w_, h_}, n_] := Table[  {RandomReal[{-l/2, l/2}], RandomReal[{-w/2, w/2}],    RandomReal[{0, h}]}, {n}](* make a set of sampling points that fills the tank. For a moe \complex tank shape it make be more convenient to fill a space that \enclosed the tank, and then select points within the tank. *)samplingPoints = points[{2, 3, 4}, 10000];(* This just plots them. *)ListPointPlot3D[samplingPoints, BoxRatios -> Automatic](* This selects only those points beneath the plane defining the \liquid level *)filledPoints = Select[samplingPoints, #[] <     z[#[[{1, 2}]], {0.5, 1, 3}, {.1, .2, 1}] &](* Plot those *)filledPlot = ListPointPlot3D[filledPoints, BoxRatios -> Automatic](* This is the fraction of sample points in the tank which are under \the liquid level *)filledFraction = Length[filledPoints]/Length[samplingPoints] // NExport["filled.png", filledPlot]Here is a plot of the points representing the partially filled tilted tank: Posted 10 years ago
 Thank you
Posted 10 years ago
 Is the tank a cylinder? A cube? Does it have "flat" ends? Or hemispherical ends? Are the dimensions of the tank known? Exactly where the measurement is being made? The angle the tank is off level? I'll warn you, the answer is probably going to be more complicated than you expect or are hoping for.
Posted 10 years ago
 The tank can be any one of the above. I've worked out the tank with the  hemispherical ends as far as volume goes.The angle  could be 2-4 degrees.
Posted 10 years ago
 How precisely do you need to know the answer? Is the measurement distance also at an angle of 2-4 degrees or is it exactly vertical?If you need a lot of accuracy, and perhaps even if you don't we perhaps need a good diagram showing exactly what the situation is.
Posted 10 years ago
 The measurement distance will be at the sane angle.
Posted 10 years ago
 Sorry I didn't get back to you sooner. I had to step out for a while. I will check out the above but, what if it's  tilted in both dierections. For example 4 degrees on the x and 2.5 on the y ?I think I am reading the result incorrectly. So in a 500 gallon tank it would only be a difference of 0.0697 gallons?
Posted 10 years ago
 Bill,I would like to thank for your help and understanding.I'll work on a drawing. This may take some time.Ken
Posted 10 years ago
Posted 10 years ago
 I noted that we can attach files, so I've attached the notebook.Best regards,David Attachments: