Tank Volume in PLC and HMI

Bullzi

Lifetime Supporting Member
Join Date
Jun 2012
Location
Colorado
Posts
1,530
Hi Everyone,
I have 2 applications where I am reading tank levels into my PLC via 4-20ma Transmitter. One application uses a CompactLogix L33 and the other uses a Micrologix 1100. Both use Red Lion G09 HMI's

I have been asked to use the tanks strapping charts to get the HMI to read out the tank volume. At first it sounds like a pretty simple thing to do. I just need to create a database in the PLC that has the level and corresponding volume. Now that I am really thinking about it, there is more to this than meets the eye.

Here are some questions for anyone that has done this before:
1. Would you create the database for the level vs. volume in the PLC or in the HMI?
2. Creating a 2D Array in the L33 is easy but how do you do this in the ML1100?
3. Ideas on the code for searching the Chart DB for the volume based on the level? I haven't written DB search code since Collage. That was quite awhile ago!!
4. How do you handle the times when the current level is between 2 DB points? Example: Current level = 10.15' and I have 10.1 and 10.2 in the DB.

Thanks for any help anyone can provide.
 
You have the "strapping charts" (here in the UK we often call them "dip tables") which is a lookup of dip level or weight to actual volume.

I would most certainly do this in the PLCs, not the HMIs.

As you say, a 2D array is easy in the CompactLogix, but in the MicroLogix you would have to use the position in one data-table to address the same position in another, relatively straightforward.

Most often a simple linear interpolation between the point above and below is sufficient for most people, it depends on how coarse the strapping chart is. Most dip-tables I have worked with have more data points clustered in the areas of most non-linearity, and for the bulk of the vessel which may be cylindrical, very few data points.
 
The Tank Manufacture has provided the customer with strapping charts and they want to use those.

So I have started to work on this. I am starting small and created 2D Array (2,60) and entered the first 60 levels and volumes. I am now trying to use the FSC instruction to search the array. I am getting the following error "Error: Rung 0, FSC, Operand 4: Invalid array subscript specifier" so the expression I have entered is obviously wrong. How do I search a 2D array when I am only interested in the first dim of the array?
 
Thanks cwal61 for that. It did give me a light bulb moment. I solved how to use FSC function to search the first position.

The FGEN function block looks interesting. I might play around with that and see if that works better than my idea of using the FSC.

Any other ideas please let me know. Thanks for all the help so far!!
 
Since Crimson is so powerful and flexible, you might be better off doing this in the Red Lion. Normally I would not try something like this in an HMI, but Red Lion HMIs are the exception. It depends partly on how comfortable you are with scripting in Crimson 3.0, and possibly how fast you need the PLC to acquire the result. If your application can tolerate a second or two delay, then the "structured text" programming in Crimson may be easier to deal with, and you'd only have to do it once for both types of PLCs.

In Crimson, your array tags can only have one dimension, so it would be similar to what you'd do in the Micrologix. the Crimson Tag would likely be a floating point tag with the Extent value set to the number of points in your table, and the retentive value set to true. Then you would use the rounded off level as a lookup value, and the fractional portion to determine if you need to extrapolate between two points in the chart. You would write a program to set all the values to match your chart and run it on startup, or you could make a Page to enter them if you wished. You would only need to set those values once as long as the HMI was not replaced if you use retentive tags and made them editable, or never again if you hard coded them with a program.

How many points are in your strapping chart? Can you share that chart with us?
 
Last edited:
Paul,
I have some experience with the scripting in Crimson but by no means an expert. So I am not afraid to try.

The result is not time dependent. It is just to show on the HMI so the operators know how much fuel is in the tank.

One of the tanks I am working with has about 262 points in the chart. It is a 11' x 36' horizontal tank. This is the one I am using the ML1100. The other tank is much larger 134'x40' (100,000 BBLS) that one has the L33.

Attached is the strapping chart for the smaller tank. Thanks for the help!!
 
Have you got a pdf with text that can be selected (copy n paste)? If you scan it with OCR enabled on the scanner (most scanners offer this semi-reliable feature) it *might* work pretty well. That would save time and help avoid errors no matter how you go about getting all those figures into a controller.

Matter of fact, I might just make up some code for you which you could drag and drop into your existing cd3 file just to brush up on Crimson since I have not used it in over a year.

You have 262 points (131" in 0.5" increments) so that pushes just past the file size limit of 256 in a Micrologix, but is not a problem for Crimson. It should be easy to take the raw level and double it, then round down and up to find the two enclosing points in the look-up table, scale between the points and get pretty darn close to exact.

What version of Crimson are you running? I have just downloaded the latest and installed it on this machine. For what I am planning, compatibility should not be affected as long as the file I (might ;) ) create can be opened.
 
Last edited:
I have the most recent version of Crimson. I just updated it now.

I am still working on getting some OCR Software set up on my computer.
 
Also, you might try cometdocs web app. I am not sure if it will covert to a spreadsheet well enough to work with but it is free. They email you the completed file, so you give them an email address, but I never noticed any spam or ads from them so I felt comfortable doing that. I will try to straighten the pages (rotation) in paint.net and use cometdocs right quick to see what happens.

EDIT: no dice on cometdocs. the better conversions now require a paid membership. I can make the jpg or bmp or png into a pdf, with no OCR lol...
 
Last edited:
In this kind of situation I usually use Excel to create a polynomial or linear function that calculates the output from the input, and then program that equation into the PLC. You can usually get accuracy within a fraction of a percent if you use enough decimal places and a high enough order polynomial.
 
Tom,
Would you be able to send me that spreadsheet? That sounds like something that I would like to look into.
 
The spreadsheet for a horizontal tank is attached. Here is a description of my method, which uses standard Excel functions:

I had a set of tabulated values from an old reference book You could generate your own table from the formulas given by others.

I then entered the formulas into an Excel spreadsheet. I created a chart. Then I created a trend on the chart by right clicking the line and selecting create trend. I checked the boxes for polynomial, display equation on chart, and display R squared (1.00 is a perfect fit), and selecting order (I used 3). You can get the equation to display more digits by clicking on it, hitting Control 1, and playing with the number of decimal places.

I use this all the time to crate functions from data. It is one of the best feature of Excel. You can even use it for things like square root relationships for flow meters.
 

Similar Topics

Hello, all. I’ve worked with totalizers based on a flow meter. However, I am trying to use ladder logic on totalizing a tank based on volume. I...
Replies
1
Views
1,137
Hi Everyone, Got a new project where I am going to read the level of a tank via Modbus and I need to use the tank strapping chart to convert it to...
Replies
8
Views
2,531
Hello PLCS.net! I wanted to ask someone who has experience in this. How does one do fluid level measurements if it's a safety/environmentally...
Replies
7
Views
2,175
Hi experts I got a last minute surprise when the customer told me that the tank is not uniform I already have program which show this on scale...
Replies
19
Views
9,288
Hi Everyone, I am trying to compute the tank volume vs level on a horizontal LP tank (capsule tank). I searched the forum and found a nice post...
Replies
4
Views
2,554
Back
Top Bottom