Tank presentation wonderware intouch

RobinH

Member
Join Date
Jun 2012
Location
Trondheim
Posts
54
Dear all,

I have a wonderware intouch application reading level and ullage from several tanks. I receive these values in millimeters (mm). I would also like to present the volume of the tanks. The volume of each tank is not linear in function of the level of the liquid contained so each tank has its own volume table. I need to base my calculations on this table. This means that if i read i certain level i need to lookup into this table and find out what the volume is. Also i need to interpolate between each value in this table.

How can this be done in Intouch scripting?

Best regards
 
Just about anything can be done with InTouch scripting (one of the only highlights of InTouch, yet the scrip editor is pure garbage....).

If it was only to convert the level information at the HMI level the it most-certainly can be done with relative ease via scripting. Especially if you have all the data for the look-up table already.

However, if you need any type of control based off the volume, then the logic and look up functions should be contained within the PLC, then you can use it within your PLC program. Then InTouch would just read the volume calculation from the PLC just like any other analog value.

I would place the code into the PLC regardless.
 
Dear Paully,

Thank you for your answer.

I agree that the best solution would be to put all the tables in the PLC but my concern is that I already have alot of code inside my PLC so im very low on resources. That is why im trying to figure out how I can solve this within wonderware intouch instead.

Do you have any idea how this could be done with scripting?

Best regards
 
Well if you insist on the scripting...

Create QuickFunctions that will process the code. I assume you are applying this to various vessel sizing, therefore you have different lookup table references (to keep things basic I am assuming you will hard-code lookup values in your script). Each lookup table dataset will require a unique QuickFunction.

Either in the application script, or the window where you will display this value, constantly call the defined QuickFunction. Probably every second. You could also do this based on a data change script too, so when the level changes then process the script. Depending on how much the level fluctuates this may or may not be appropriate.

When you call the QuickFunction you will need to pass the analog value to it, so it can be processed. The result value would be the corresponding lookup table value.

Call the quick fuction

"""""""
VesselVolume = CALL TankVolumeLookup(VesselLevel);

""""""""

""""""""""""""""""""""""""
Quick Function "TankVolumeLookup"

Define parameter to hold the passed level
Level (INTEGER)(or real, whatever)

DIM Volume as INTEGER; (or real, whatever suites your needs)

If Level > lookupValue1 AND Level <= LookupValue2 THEN
Volume = LookupValue1Result;
ENDIF;

If Level > lookupValue2 AND Level <= LookupValue3 THEN
Volume = LookupValue1Result;
ENDIF;

.
.
.
.
.
If Level > lookupValue(n) AND Level <= LookupValue(n+1) THEN
Volume = LookupValue(n)Result;
ENDIF;

Return Volume; (Pretty sure this is correct for returning a value, been awhile)
""""""""""""""""""""""""""""""""""""""

Change the lookupValue referenes to numeric values based on your lookup data. Build as many if/else statements as you need.
Pretty basic but should get you started at least.
 
Last edited:
Dear Paully,

Thank you for the script.
Exactly what i was looking for.
I will test it.
I have one more question.
Will this script interpolate between two lookup values? (lineary).

This because between some of the lookup values the range can be big.

Best regards
 
Yes you can expand on this quite easily.

You just need to apply a scaling algorithm that is specific to each range (in each if statement).

If it is acceptable to say the volume is linear within the range, then simply change the statement to calculate the value based on the current range and value. This is where y=mx+b is your friend, you should be able to sort it out. It's no different than PLC analog scaling.

However, lets say it is not linear within the range, then you would need to create an custom algorithm for each range based on the characteristics of the vessel. More difficult and usually overkill.
 
Are your lookup tables required because of irregular tank shapes, or are they simply a tool that the plant operators have used in the past to make estimates? With cylindrical or conical tank sections, it is easy enough to make a direct calculation of volume without relying upon a lookup table.
 
are your lookup tables required because of irregular tank shapes, or are they simply a tool that the plant operators have used in the past to make estimates? With cylindrical or conical tank sections, it is easy enough to make a direct calculation of volume without relying upon a lookup table.

+1
 
Are your lookup tables required because of irregular tank shapes, or are they simply a tool that the plant operators have used in the past to make estimates? With cylindrical or conical tank sections, it is easy enough to make a direct calculation of volume without relying upon a lookup table.

Lookup tables are required because of irregular tank shapes. The table is important for the bottom of the tank and at top of the tank.
Between bottom and top the tank is quite linear.

Best regards
 
Yes you can expand on this quite easily.

You just need to apply a scaling algorithm that is specific to each range (in each if statement).

If it is acceptable to say the volume is linear within the range, then simply change the statement to calculate the value based on the current range and value. This is where y=mx+b is your friend, you should be able to sort it out. It's no different than PLC analog scaling.

However, lets say it is not linear within the range, then you would need to create an custom algorithm for each range based on the characteristics of the vessel. More difficult and usually overkill.

Thank you, I will try to figure this out.
 

Similar Topics

I want to measure the tank level and get the sensor output to the PLC. Below are the details : Tank Height =0 - 3m, the sensor is stalled 0,2m...
Replies
15
Views
604
Does anyone have RSLogix 5000 ladder diagram program of tank leveling (factory IO). Fill valve, discharge valve, set point, level, etc? I looked...
Replies
2
Views
156
I seem to remember a number of posts regarding calculation the actual level or volume in a horizontal tank, here is the formula written in ST...
Replies
15
Views
1,541
I'm coming from a background of PLC ladderlogic/rockwell products. I am new to blocks. Can you point me in right right direction? What I would...
Replies
5
Views
1,558
Back
Top Bottom