Sign in to follow this  
Followers 0
mhowasso

Horizontal Cylinder Tank Volume

35 posts in this topic

Hi All, I am using a MicroLogix 1500 with RSLogix 500. I have an underground fuel tank that I need to monitor the level of fuel in Gallons. It is a horizontal round cylinder tank that is flat on both ends. I am measuring the height of fuel in the tank using a 5 psi pressure transducer. I have done square tanks and vertical round cylinders with no issues, but this horizontal tank is just not working out. Looking for some help/advice or formulas that will work with a ML1500 or sample code that will work. Thanks,

Share this post


Link to post
Share on other sites
The formula for at horizontal flat ended tank is V = l * (pi*r^2/2 - r^2*arcsin(1-h/r) - (r-h)*sqrt(h(2r-h))) where V is volume, l is the interior horizontal length of the tank cylinder r is the interior tank radius, h is the height of fluid in the tank as measured from the bottom of the horizontal cylindrical tank interior and must be less than 2*r. Precalculate pi*r^2/2 and r^2 and and 2r and supply them to the equation as constants, especially since the ML1500 has limited math abilities. If this is a situation involving commerce then the simple tank volume equation may not be adequate because no tank is perfect. In this case you'll need a dip table calibrated specifically to the tank to satisfy metering regulations.

Share this post


Link to post
Share on other sites
Hi TConnolly, Thank you so much for the reply... A few questions if you dont mind. :) What does the ^ symbol represent..??? Also my tank is the following size (inches): Length = 720 Diameter = 144 Knowing these values and that I am using a ML1500 how do I do this..??? Thank you ALso, I have used submersible pressure transducers in tanks with water/chemicals and they work very well, but in this fuel tank (Jet A) it just seems to be a little inconsistant. Now maybe its just a bad sensor, but my gut tells me otherwise. Any suggestions..??? Again...Thanks so much for any advice..!!! Edited by mhowasso

Share this post


Link to post
Share on other sites
Hello, >What does the ^ symbol represent..??? Exponentiation a ^ b means a raised to the power of b (a ^ b is more commonly written ab. The symbol ^ is generally used in programming languages where ease of typing and use of plain ASCII text is preferred.)

Share this post


Link to post
Share on other sites
Hello, The math on this one makes me crosseyed, once you get into a totally non linier vessel it seems to get very complicated. Here are a couple of links I found, hope they will help you out. Calculate WC from psi: http://www.gp50.com/pdf/Application,%20Tech.%20Notes%20&%20Manuals/A5SL-TN1.00.pdf Formula for Calculating Volume: http://www.london-electronics.com/formula.htm Then you will still need to convert cubic inches into gallons. Hopefully others will be able to help you with specific questions, as I am still trying to wrap my head around this, its interesting though. From the reading I have done you will still have many factors that come in to play and can add variables to your calculation if your measurements have to be exacty precise. Is the tank vented to atmospheric pressure or is it a sealed tank under pressure? What temperature fluctuations will the liquid in the tank be subject too? Is the tank perfectly level or slightly tilted toward the suction line of a pump? And as TConnolly pointed out the tank is probably not a perfect cylinder. Also just a thought, is the pressure transducer you are using classified for hazardous locations / rated to be submerged in Jet Fuel? Onboard the ship I work on we are subject to a very strict criteria as to what we can and cannot use to measure level in our fuel tanks. We have a system that shoots a burst of air into the tank and a measurement is calculated from that. Anyway keep up the good fight, and please let us know how it turns out. BCS Edited by Bering C Sparky

Share this post


Link to post
Share on other sites
Hi BSC... Hope you are sound and safe...and thank you for doing what you do for us..!!!! 1st. The tank is level. 2nd. The tank is vented to outside atmosphere (0 psi pressure). 3rd. The sensor and cable is rated for Jet A. 4th. The Temperature is fairly stable but will fluctuate between 65-85 I have also found out that I can not use the pressure transducer for height. It works great in water and chemicals but not in Jet Fuel. The readings are inconsistent and unreliable even figuring in the difference in specific gravity. Why..?? I don't know..!! Im going to try an ultrasonic sensor tomorrow and see if that will be more stable. But Im still confused on the logic in my PLC for this. Well, stay safe and dry BSC..!! Mark

Share this post


Link to post
Share on other sites
The tank is open to atmosphere with jet fuel in it!! That does not sound safe to me. Ultrasonics don't do well in a hazardous atmosphere(vapors). Radar would be a better choice. Edited by Mickey

Share this post


Link to post
Share on other sites
Hi Mark, Thanks for your kind comment's, although I am not really doing anything for you out here unless you eat a lot of fish. Not on a military vessel, just a large At Sea Fishing Trawler / Processor. So we are just killing fish not terrorist. lol I would agree that this is pretty confusing and higher math is not a strong point of mine either. But basically your tank size is a constant, so the main variable that will change in the equation is: What level is the liquid in the tank. If pressure transducer would work then it would give you PSI. (PSI of a liquid can be calculated in a linier manner so you could use an SCP instruction to scale the raw input value of the pressure transducer and scale it to PSI. Lets say this SCP will output to N7:0 So now N7:0 = PSI Inches of water column can be calculated with a known PSI and specific gravity of the liquid. So you would then need to use a Divide instruction (DIV) to calculate Height of liquid in tank. Pressure/Specific Gravity = Height (I believe the SG of Jet Fuel is 0.82 you will need to check but lets use this # for now) DIV Source A = N7:0 Source B = 0.82 Dest = N7:1 So now N7:1 = Height in tank (in inches) Now that you have the Height of the tank known you can use a MOV instruction to place this variable into the larger equation. See volume equation link below. http://www.london-electronics.com/formula.htm df = depth of fluid (or Height) in the above linked formula so N7:1 would get moved into place anywhere the formula calls for df. From here you will need to get help from others with a much better grasp of math and the capabilties of the ML1500 you are using to compute this math calculation. I am not familliar with the 1500 but TConnolly pointed out earlier that it does have limited math abilitys. Once you get to this final number after this equation you will have cubic inches of fuel in the tank so lets say the destination for this will be N7:2 Now you will need to convert the value of N7:2 (cubic inches of fuel) to Gallons. So use a MUL instruction MUL Source A = N7:2 Source B= 0.004329 Dest = N7:3 (Total Gallons of Jet Fuel in Tank) Please take all that I have said with a grain of salt, as I am in no way a PLC or a Math expert, in fact I am pretty mediocre at both. The instuctions I used here were for example only, I just spit this out and did not put alot of thought into it. Others on the forum with more experience will be able to guide you as to the correct PLC instructions and math formulas to use. EXAMPLE INT or DINT or LONG MUL, DIV or use CPT Thanks for bring this problem to the forum, I never though of trying to figure out this scenario before so you have got my brain working and I will brush up on my math skills now so I too will be able to solve this if need be in the future. Micky, it is more common than not for fuel tanks to be vented to atmosphere, all of ours on the ship are vented and if you go to your local gas station look on the side of the building and you will see many pipes running up the side of it. These are the vents from the under gound tanks. Best of luck Mark and please keep us informed of your progress. BCS Edited by Bering C Sparky

Share this post


Link to post
Share on other sites
Hi BCS... Well, it was the thought that counts I guess..!!! :) (You still need to stay safe tho) 1st. For some of you...The jet fuel tanks MUST be vented to atmosphere or you would be creating a pressurized vessel that would be full of jet fuel vapors and that would not be safe. 2nd. I understand how to use the SCP and to use PSI for my height just fine (I have about a 100 tanks of different sizes, shapes, and depth that are used for everything from water to acids) (I use 0-5 psi/0-138 inches transducers or Ultrasonic) and every one I have done is working great when I calculate the depth/gallons to display on my HMI. 3rd. I understand that what is changing on my tank is the fill diameter. The length is fixed at 720 inches. The diameter of the cylinder is 144 inches. Radius is 72 inches. So the variable that is changing is the "fill diameter". This formula for gallons kind of makes sense but trying to replicate it in a ML1500 is my problem Maybe someone out there can help with plc coding in a ML1500. Or maybe not. Or maybe I can do it in my HMI. Either way I got yo figure this out soon. Take care. Later, Mark Edited by mhowasso

Share this post


Link to post
Share on other sites
the ARCSIN is a trigonometric function – and as near as I can tell (so far), the MicroLogix 1500 does not support that type of math ... on the other hand, according to the (limited) information that I have at hand, the MicroLogix 1400 does support the ARCSIN function ... am I correct in understanding that you have other similar tanks – and that you are able to calculate the volume in those? ... if so, are you using MicroLogix 1500 for those? ... two more questions for you ... (A) how accurate do you need to be with this particular volume reading? ... (be realistic now) ... and (B) how accurate is your depth reading likely to be? ... (I'm using the term "accurate" for this discussion – but we're actually interested in "resolution" here) ... in other words, how "fine" do you have to slice the number of gallons in the tank? ... more specifically, how close is "close enough" to get the job done? ... if the resolution that you require isn't too "fine" – then you might be able to get by with using a "lookup" table arrangement instead of the volume calculations ... basic idea: the more you tell us about your system, the better we'll be able to help you ... I'm going out on a limb here, but I'd bet (more than pocket change) that you're not going to be able to calculate the previously given "volume" equation with the MicroLogix 1500 ... so ... I'd say that you're going to need either a different approach to the problem – or you're going to need more processing power ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
Hi Ron, Very good questions... This is the only ML1500 that I have on a tank system. All the others I use ML1400's. Thats why I was nominated to do this project...(he has done all the others..he can do this). But all the others are either square, rectangular or vertical cylinders. Was a piece of cake to do..!! I used the ML1400 because mainly of the on-line editing and a few instructions for the others. I was also going to use the ML1400 on this project until I ran out of IO that forced me use a ML1500 since everyone here will only work with RSLogix 500. So thats how I got to here. This horizontal cylinder is my problem. I never imagined it would be this difficult because I was thinking volume. Volume has to be the same standing up or laying down, right..?? Well back up the truck...it aint that easy as I have found out..!! :) I just bought a radar sensor for my depth that I hope will be pretty accurate. I want my depth reading to be as accurate and stabil as possible. The Gallons value does not have to be so accurate (only looked at by fuelers as a reference). Anything would make me happy..!!! I always respected your advice, so tell me what you would do.. If all else fails I was considering letting the ML1500 do the depth, and doing the gallon conversion in my HMI. But if there is a way to get the gallons in the PLC even accurate within a quarter of an inch I would be happy. Thanks for your help Ron and looking forward to your reply. Mark Edited by mhowasso

Share this post


Link to post
Share on other sites
I'm from the natural gas business ( underground storage) venting hazardous vapors is a no-no under normal operations. Edited by Mickey

Share this post


Link to post
Share on other sites
I'm from the natural gas business ( underground storage) venting hazardous vapors is a no-no under normal operations. Edited by Bering C Sparky

Share this post


Link to post
Share on other sites
Ron, TConnelly.. Knowing the dimensions of the tank: 720 inches long, 144 inches in diameter. Please explain to a math novice what/how to use the formula mentioned above. What can I pre figure so I can substitute my height variable (F8:8 = fill inches) into this formula (H) to calculate the gallons..??? Thanks, Edited by mhowasso

Share this post


Link to post
Share on other sites
I don't have any experience with the ML1500, but I do have a lot of experience with level. My advice would be to use the radar detector to do the dirty work. I've used radar detectors for displaying the levels on various configurations of chemical tanks and the probe had the onboard software to figure distance or volume in the different tank orientations and was able to be set up on a non-ideal tank shape. The radar detector that I used would also temperature correct the reading if I set it up that way. The basic Siemens Probe LR will do all of these things but I'm sure that the basic radar detectors by other manufacturers will do the same.

Share this post


Link to post
Share on other sites
Well... I have decided to use a resistive tape sensor (JOWA-USA) PetroTape for the level to my ML1500 and do the gallon calculations in my HMI. This will give me the level AND temperature in one device. I don't know IF the ML1500 can do it or how to do it in the ML1500.

Share this post


Link to post
Share on other sites
Hello Again Mark, It is the ARCSIN variable in the equation that keeps you from being able to use the 1500 to calculate this problem, as this will always be a variable and never a constant. ( arcsin(1-h/r) will be a different value at every level of the tank so no preconfigured constant can be implemented for this part of the equation, you must have trig function capability in your plc) As Ron pointed out the 1500 does not provide you the ability to process trig functions. (take a look in your RSLogix 500 program for your 1500 under trig functions and you will see the ASN instruction is not selectable. You MUST have this function in order to procces the equation for this type of tank. The 1400 does let you use the trig function for Inverse Sin. Would it be possible for you to use a 1400 to perform this task and send this information from the 1400 either directly to your HMI or to your 1500. You said before you needed the 1500 because of the amout of I/O needed for the project, I know it seems like overkill adding the second PLC but adding the 1400 for just this part of what you doing will get the job done. Only other ways I see you could do this with 1500 would be to compare between levels say each 1/4 inch (as you stated earlier) and use compare instructions from your raw level value to MOV predetermined gallon values to your HMI when they are between each compared value. This will not be very accurate though, will be off by hundreds of gallons at times, and will require LOTS of Ladders, and your display on the HMI will look very course jumping in value at such a large rate. You could tune this in even closer but the finer you get with this method the number of Ladders needed increase greatly. If this is just something for referance on an HMI, can you display the tank level in fractions of inches (or whatever) on the HMI and then just have a premade table for the operator to look up gallons on. (not perfect but maybe a solution to your problem) If you get the 1400 and still have problems with the math you will be able to find help here, I have been playing with it and it works on the 1400. Unfortunatly there is no way to do it on 1500 (with no trig) without having to write LOTS of ladders and just move predetermend gallon values. (and this method will have very little accuracy unless you want to write it down to 64th or 128ths of an inch) If you do go this way there are lots of tank calculators on the web you could get your gallon values from. Best of luck. BCS Edited by Bering C Sparky

Share this post


Link to post
Share on other sites
Just to clarify (I may have a similar application shortly), what are the units above? I'm guessing if you give L, R and H in inches, you'll get volume in cubic inches, and so on?

Share this post


Link to post
Share on other sites
Hi All... I feel the best (only) way now for me to get the gallons value is to do the formula calculations in my HMI (it can process this formula and I already have it) and let my 1500 send it the height information. The amount of digital and analog IO prevented me from using the 1400 and I dont want to add a second PLC. Im using the HMI anyway so one more task wont be a big deal. Hey..sometimes you just have to punt..!!! :) Thanks for all your help. Mark

Share this post


Link to post
Share on other sites
Here's a pretty good approximation Volume = -0.0187*h3 + 4.0443*h2 + 163.51*h - 368.98 Volume is in gallons, height is in inches. It is not so good at the very bottom but at 14" liquid height it is only 5% off Starting at 25" liquid height, it is only 1% off and remains under 1% from here until the tank is full. I got this by putting your numbers into an online calculator that gave me the volume for every inch of height. Then I put these values into Excel and made a chart. Then I right clicked on the chart and asked for a trendline. I selected a polynomial order 3. You can probably increase the accuracy going to a higher order polynomial. If you just need a pretty good idea of volume for trending then this should be easy to program in the MLX1500. If you need commercial accuracy then this is not the way.

Share this post


Link to post
Share on other sites
If your controller has an X-Y look-up table function (called by different names like characterization, look-up, or linearization), then a relatively small number of points can provide surprisingly close calculated volume values, 0.5% or 0.3% as the tables show. These numbers came from Precision Digital, many of whose process indicating meters have a look-up table. More than once, people have used the converted-to-volume data retransmitted as a 4-20mA output from one of these indicators as a volume input to the PLC because the PLC lacked the math. Dan Edited by DanW

Share this post


Link to post
Share on other sites
mhowasso, for all the good advice, and magnificent formulae you have been given, you will ultimately have no confidence in the closeness of the calculated volume to the actual volume. Tanks are rarely "cylindrical", rarely "horizontal", rarely "uniform", and rarely even close to design dimensions. My background is in the brewing industry, which until recently, suffered duty charges on volumes brewed. It was in everyone's interests to have tanks "dipped", to achieve maximum accuracy in volume measurement. "Dipped" meant that the tank was calibrated by filling through a certified flowmeter, and the "dip heights" were recorded as the tanks were filled. The resultant "Dip Tables" (for each vessel, not one for each type), were accepted by Customs and Excise as a true measure of the tank's contents. So, it's up to you - how accurate do you need the volume measurement to be ? Do you need most accuracy when the tank is near empty, half full, or near full ? Or equal at any level ? Each and every method of volume measurement has it's benefits and downfalls, and whilst the "dip" method (you measure the height of the liquid, for which there are several methods) gives you the best results, only you can decide if calculating (based on empirical tank dimensions), or interpolating (based on a "dip-table") is the right way to go.

Share this post


Link to post
Share on other sites
Hi, Thanks for the info but how exactly would I put this in code in the ML1500..?? How would you write the ladder logic to achieve this..??? Any help would be appreciated and I will try what you say. Thanks, Mark

Share this post


Link to post
Share on other sites
If the ML1500 supports the CPT instruction, it'll be one rung: CPT N7:1 (-0.0187*N7:0^3)+(4.0443*N7:0^2)+(163.51*N7:0)-368.98 (assumes your height is in N7:0 and your volume is put into N7:1) If the ML1500 doesn't support CPT, you'd essentially have to put each step of the calculation on a different rung, remembering to be careful of your order of operation: exponentials, multiplication, then addition/subtraction.

Share this post


Link to post
Share on other sites
Hi ASForrest.. No the 1500 does not use the CPT (thats another reason I always try and use the 1400 if possible). Thanks for the info and I will try this and let you know how it works out. IF this works out OK then I owe you lunch..!!! :) Thanks, Mark Edited by mhowasso

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0