toddp65

RsLogix Lookup Table programming Help

10 posts in this topic

So I'm somewhat at a loss here during my task to create a MLX 1400 project for an Ignition/SCADA wastewater pH leveling system.

Our chemical dosing pumps are solenoid controlled air diaphragm pumps and the specify two different modes of operation--Dosing and  reaction.

In the Dosing mode they specify " The valve closed time shall be based on a Lookup table such that when the difference between the measure pH and the pH set point is large the Valve Closed time shall be shorter and when the difference between the measured pH and pH set point is small, the Valve Closed time shall be longer."

I'm not sure how to create said lookup table.  I've seen references online to writing one in excel and uploading it to using indirect addressing and status instructions.

 

Thoughts anyone?

Share this post


Link to post
Share on other sites

Here's a quick-and-dirty example of a simple lookup in an ML1400 (I happen to be online with one making a change so I used some free registers). The thresholds in the GEQ/LES instructions can be hard-coded with literals and the sources of the MOV instructions can be variables if you want. The sources of the GEQ/LES can also be floating point registers. The numbers in the MOV source fields will need to be scaled based on the time base setting of the timer register you're using.

 

Lookup_ML1400.PNG.a325789b953d60993b821a

 

 

 

Edited by Joe E.

Share this post


Link to post
Share on other sites

Joe--thanks!

 

Could you give some background on this project?  ex, what are you integers representing?  When i hear the term lookup table I'm thinking of a graphed table converted to a data table. 

Share this post


Link to post
Share on other sites

lookup table just translates one value (input) to another value (output).

if relationship is simple, one can use scale or similar transform. 

 

If input is one of following cases 1,2,3,4 and output is 10,20,30,40

one can write Y=X*10 so only one operation is needed.

 

If input is one of following cases 5,6,7,8 and output is 10,20,30,40

one can write Y=(X-4)*10 so only two operations are needed.

 

If relationship is more complicated, math gets more complicated. In some cases it may be simpler to just create a list of all cases (table) and for each case assign specific value.

If input is one of following cases 5,6,7,8 and output is 10,29,32,40

one can write

EQU N7:0 5    MOV 10 N7:1

EQU N7:0 6    MOV 29 N7:1

EQU N7:0 7    MOV 32 N7:1

EQU N7:0 8    MOV 40 N7:1

 

That would be example of hardcoded lookup table. For each point there are two operations. if table is long, many operations would be needed.

Once can also use more elegant way where data is stored in the data table and retrieved by index... if needed index can be calculated.

SUB N7:0 5 N7:2  // N7:2 is recalculated index so input 5,6,7,8 is translated to 0,1,2,3

MOV N17[N7:2] N7:1  // then we can use N7:2 as an index to read values from table N17 that contains list of output values

1 person likes this

Share this post


Link to post
Share on other sites

Thanks, panic Mode

What if the variable is pH.

7.1 to 14.

Since the first number is a decimal I'm assuming all of the variables need to continue (7.2, 7 .3, .7.4, etc. ) and time being the unknown (range 0-300--so 7.1=0 and 14=300).

I can run a SCP with those as min and max but I'm not sure if that's what they want.

 

Share this post


Link to post
Share on other sites

Seems to me you almost want to use a PID algorithm to determine the error signal or the delta between the actual pH and the setpoint.  Use the error signal as the input to "lookup table" to determine the valve closed time that needs to be updated with the result of the "lookup table".  At some point you need data or an equation of the line or curve to best determine the format and structure of the program to do the lookup.

Also, not knowing the size of the application, just remember that pH is a fast moving variable.

Edited by pcmccartney1
1 person likes this

Share this post


Link to post
Share on other sites

why are you so secretive? post the link to datasheet or at least post table. SCP is not a good idea since it is linear and pH is logarithmic. this is why lookup table is used.

Share this post


Link to post
Share on other sites

Panic...are you referring to me?  what do you mean secretive?  I don't have a data sheet or a table.  The narrative provided by the engineering firm  is all I have to work with.  This is all they provided me :   In the Dosing mode they specify " The valve closed time shall be based on a Lookup table such that when the difference between the measure pH and the pH set point is large the Valve Closed time shall be shorter and when the difference between the measured pH and pH set point is small, the Valve Closed time shall be longer.

 

When I just did a quick SCP in the code and changed the float input, the time base changed proportionately...that said,  it functionally linearly but as you mentioned pH scale isn't linear.

 

PcmMacartney--I'll look into that option 

 

 

Share this post


Link to post
Share on other sites

what is the brand and model of this device and why don't you have datasheet? how else can you use the product? bottom line is - if vendor does not share such critical document,  look for alternative product and don't waste time with this brand. 

Share this post


Link to post
Share on other sites

I'm not sure what you're getting at...

However:

Micrologix 1400 using RSLogix 500 software

The engineering firm who wrote this narrative/Description is the lead of the project.  I have to program the PLC and we have a contractor doing the Ignition programming off  my code for the SCADA program (pH equalization/Leveling project for wastewater in a brewery.  Would it be their responsibility to create the Lookup table?  I've never done one such as this when your comparing pH levels and you're supposed to create a proportion time based upon different between set point and current variable.

This time base (0-300) is the time a solenoid valve is closed that operates a chemical dosing pump (Acid or Base).  

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