brewer

Compact Logix Ladder

4 posts in this topic

Is there a simple instruction where I can fill in a table and do a look-up based on a value.  I have a airflow meter that Pressure correlates to Airflow but it is non linear.  I have 11 pressures that equal 11 flows.

Using RSLogix 5000 V20.04 Ladder logic only, no language pack.

Thanks

 

Share this post


Link to post
Share on other sites

Yes there is. Well... kind of, you have to have Function Block licensing. There's a function block called FGEN (Function Generator) that is wonderful for doing what you want to do. I've used it for Air/Fuel Ratio control, valve characterization, etc. If I remember correctly (been over a year since I've used it), when you make the tag for X and Y you need to make it for number of characters +1 or it will fault. 

Or you can roll your own un Structured Text. Y = mX+b... slope of a line for each segment of the non-linear curve. I'd use FGEN :)

 

1 person likes this

Share this post


Link to post
Share on other sites

There isn't anything in LAD that will just drop-in and do what you want but it shouldn't be too hard to roll your own with an array and some LIM instructions. If they hadn't eliminated the SCP instruction in the 5000 world, it would be even easier...

Ok, so I couldn't resist trying this. Here's my made-up table of pressures and flows:

PressureFlow_Table.PNG.d68ebcdb0dd896d40

The first column is 11 pressure data points. Second column is the span between the points. Third and fourth columns are the same for flow. Here are the PLC tags:

PressureFlow_Tags.PNG.2efaeb9254386e3de4

The pressure and flow data points are variables so you can adjust your table as desired. Next, calculate the span tags:

PressureFlow_Ranges.PNG.52c5a448422f334a

The spans for the flow are calculated the same way. I built 2 branches of the scaling calculation here:

PressureFlow_Scaling.PNG.78a5f88dde17d90

 

This is just a simple linear interpolation calculation. Ironically, it would be far easier in the Logix 5 and Logix 500 worlds by using the SCP instruction. With that, we could eliminate the range calculations altogether and just have a "LIM SCP" branch for each step. But Rockwell decided we don't need SCP any more.... They do have the SCL instruction in structured text and FBD but that doesn't help us much in the LAD world. I've tinkered with making my own SCP instruction as an AOI but haven't had a lot of time to work on it.

I tested this with a variety of pressures from 0 up to 20 including the actual pressure points (10 and 20) and it returned the right answer (it agreed with Excel, anyway).

 

Share this post


Link to post
Share on other sites

Thanks  I ended up doing a similar network in Ladder to get what I needed.  I agree that they should have kept the SCP in ladder.

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