# Working with lookup tables in RSView32

A

#### Alok Khatlawala

How do I perform lookup based calculations in RSView32?

I have an application where I need to calculate mass flow using density @ specified temperature for PROPANE in liquid form.

The following tags are available as inputs from field:

Volumne Flow rate

Current temperature

I also have a table of density versus temperature which is obtained from laboratory using samples of the product. I have to look up the corresponding density based on the temperature read from the field and multiply the same with the volume flow rate to obtain mass flow rate
How do I implement the same. Is it possible to enter the lookup table in the ladder program or it is better to do it in RS View 32 works?

In either case, can someone please suggest how to do this.

Thanks

Alok Khatlawala
Dy. Manager (Automation Systems)
Daniel Measurement and Control (India) Pvt. Ltd.
Gujarat
India

M

#### Mike Copelin

My suggestion is to do a piece-wise linear approximation of the density curve. The curve can be broken into as many pieces as required for your mass flow accuracy. The PLC program could then determine which linear portion to use in the calculation dependent on the temperature. As a PLC programmer, I suggest doing this type of calculation in the PLC in order to have the result available to other control logic.

A

#### Allen Nelson

First off: Is the adjusted rate calculation needed for control, or just for visualization (operator information). If for CONTROL, then the CONTROLLER (PLC) should make the calculation. If it's just for visualization, then it doesn't make much difference - whichever is easier.

What's not easy is for a SCADA package to read a value from a PLC, do a calculation, and then send constantly-changing data back to the PLC. If the SCADA goes down, the PLC will make

On exactly how to do the calculation, you have several options

Option 1: Break up the curve into segments (for which you have data points), and assume that the curve is linear between each of the segements.

Option 2: Plug the density v. temperature values into a curve-fitting program (a Google search on "curve fitting" will turn up several), and use the formula rather than a table.

Option 3: Combine 1 & 2: determine a formula that is a close approximation, but is only valid between certain limits. At other limits, use different equations.

D

#### dooley

I would definitely use a curve fitting program. Excel will do multiple linear regression analysis. You may have to generate extra columns for the various possible functions of T.... for example 1/T, T^2 etc. Incidentally, liquid propane
density/temperature data is in the CRC handbook.

Vince Dooley