![]() Theta1+theta2 form a decent estimate of theta over fills from 0 to Vmax/2. By least square fitting over theta from 0 to pi Then if theta2 is defined as theta-theta1, it is a reasonable polynomial fit to V/Vmax. For very low fills, the first and second derivative are zero and an approximate solution This is still a transcendental equation, but easier to work with. Theta is the central angle subtended by the level, and ranges from 0 to 2*pi. Where theta = 4*arcsin(sqrt(h/D)) or h/D = sin²(theta/4) The Nakatsuka equation is very hard to differentiate, expand in Taylor series, etc, to find better methodsĪn alternative formulation is (angle MUST be in radians) Can the starter values be improved to where they often suffice for practical accuracy, and iterate faster when high accuracy is required. It is uncertain how many iterations of Newton's method will be required, but better starter values reduce the number of iterations. Based on his solution, I gave a Newton's method solution in post #43 for the reverse problem, find the depth at which a given volume occurs. Nakatsuka gave a solution to the forward problem, find volume given tank dimensions and depth in post #2. Recent posts 54-58 caused me to review this thread. Re: Volume of horizontal cylindrical tank The reverse, finding the depth that corresponds to a specified volume, is difficult and computationally intensive. Yes, the forward problem, measuring a depth and calculating the volume is MUCH easier. It may be helpful to set up Excel spreadsheet and watch it work before coding in a computer language It may farble for a few passes before it really begins to converge (and it can diverge with a bad guess). How well it starts depends on the initial guess. With doubles (15+ digits of precision) I would stop when the relative change is around 10^-12 or 10^-13. You can add a test to stop when you get close to the numerical precision of your computer. Once Newton's method gets close it converges "violently," typically doubling the number of correct significant figures each pass. The reverse, finding the depth that corresponds to a specified volume, is difficult and computationally intensive.ĭo you need a stick direct reading in gallons with fine graduations, or just a few key levels on the side of a tank? You may want to just prepare the chart of volume vs depth (forward calculation) and interpolate between closest entries. Let me see if I'm understanding things so far before getting to where I'm stuck.ġ) Calculate the ratio of liquid to max fill (V=gallons*231, Vmax=length*pi*((diameter/2)^2))Ģ) Pick a starting value of "s" based on near full, near empty, or in between.ģ) Make a few passes adjusting "s" until the adjustment is minimal (maybe 2-3 loops)ĭo I have that right so far? If so, I'm now stuck with my rusty memory of algebra trying to convert "s=1-(2*d/D)" to solve for "d".Yes, the forward problem, measuring a depth and calculating the volume is MUCH easier. I need to implement this into PHP (assuming code is not already available somewhere). I'm having a little trouble getting there. Wow, this is really taxing my vague memory of math class. Two or three iterations will generally suffice. Then proceed with Newton's method as in the third paragraph. Proceed as above but with (1 - V/Vmax) in place of V/Vmax and reverse the sign of s. As an alternative to the table in the 2nd paragraph, the following starting values for s work well, based on the value of V/Vmax ![]() The key to Newton's method is a reasonably good starting value. I strongly recommend a computer program or Excel spreadsheet as this is very tiresome to do on a calculator. ![]() You could probably use 0.1 increments from 0.1-0.9 Your initial table should at least use 0.01 increments of d/D in the range 0-0.1 and 0.9-1. Generally this converges well, but near empty and full, your initial guess needs to be pretty good. Iteratively evaluate f, f', s until the change in s is negligible vs your accuracy need. This drives to the value of s for which f(s) = 0Įquivalently new s = s + /(2*sqrt(1-s²)) Now use Newton's method to find the root f(s) =0, whereį(s) = arccos(s) - s*sqrt(1-s²) -pi*V/Vmaxįorm a new estimate of s = s - f(s)/f'(s). The table is normalized to fractional fill and fractional diameter so it can be used for any tank. For your fill V, calculate V/Vmax, enter the table backwards for the closest value of s. ![]() V/Vmax = (1/pi)*(arccos(s) - s*sqrt(1-s²)), with s defined as he did. Since the maximum volume of a cylinder is (Pi/4)*D²*L, his equation can be written as Please refer to the solution by Nakatsuka in post #2. You need to start with a plausible guess and then improve that guess. It can only be solved by iterative methods which are organized trial and error.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |