Michael Walsh

Tank Level Program from PM

13 posts in this topic

From a PM from @Jason_G

I am newbie her  to omron and need some help. I am trying to program a tank level control using a CP1H. What I would like to do is to take a 4-20mA signal from a DP cell located on the bottom of the tank to measure the level (0 to 100%). I would want to take this level and send it to a PID which would then manipulate a VFD pump to control the level base on the set value in the PID as well as the PV from the transmitter. I need help in setting up the PID parameters and also how best to scale the analog input should I use SCL or APR? 

Specs:

DP Transmitter : 4-20mA on Tank O to 10 feet of water to be displayed in percentage of 0 to 100%

VFD pump taking in an analog of 4 to 20mA to drive a 0 to 2000 rpm VFD drive

 

Tank Level Program.cxp

Share this post


Link to post
Share on other sites

Hi everyone

I have seen and read many of the post here on PID. But I am still not understanding some of the parameters especially the ones for C+6 to C+9. Could someone stage an example and explain it in some details. For example if I convert and scale a PV value of 4-20mA to a  value of 0000 to 0100 in BCD to the PV of the PID and my.  VFD takes in a 4-20mA from the AO of my PLC and I know that in the VFD I can set it up to convert the mA signal to rpm within the VFD. I just need the know how to set the PID to take the PV compare it to a SV and output the appropriate value for me to use

Share this post


Link to post
Share on other sites

First of all, don't scale the feedback to BCD. Scale it to an unsigned integer. I assume 0-100 is a reference to percent.

With this setup, C+6 would be:

#0010

Bits 8-11 are the input range. Since 100 is in the 8 bit range, a value of 0 is what you use.

Bits 4-7 is for the integral and derivative unit.  I chose a multiple of the sampling period.  This determines the multiplier of C+2 and C+3. 

Bits 0-3 are the output range.  This has to be the same as bits 8-11.   So I set this to 0.

So, your input is a 0-100 % value as scaled from the analog input.  The output of the function will then be a 0-100% command to the analog output.

C+7 would then be 0 - the lower limit for the output.

C+8 would then be 100 - the upper limit for the output.

 

You would then take the output value and scale it to the analog output range using the function block that I referred to earlier.

If the range was 0-3999 for instance, you would use the FB to scale 0-100 to 0-3999.  

Hopefully this helps.

 

 

 

 

Share this post


Link to post
Share on other sites

Thanks @Michael Walsh, this seems pretty much clearer to me. I will try it and see what happens.

Share this post


Link to post
Share on other sites

Hi Guys,

After trying the above settings for the PID parameters I still cant get the PID to work as it should.  I have attached the program I written can someone take a look at it for me and help me identify where am going wrong?

Tank Level Program.cxp

Share this post


Link to post
Share on other sites

PID.jpg.62a2786b1be814f30a73c6b7c878b0a3

Both of the above issues are big issues.  By having the real number in the input field, the PID instruction was looking at nonsensical data as it was looking for an integer.  Also, by Having D350 rather than D200 as the second entry, the instruction was not even looking at any of the parameters that you had set up in the D200 range.  It was looking in the D350 - D388 range (which was likely all zeros, except for your setpoint).  

PID2.jpg.20a2775efe64a4ade1451ea30aa3be4

PID3.jpg.ccd0b663de591172e512adc37ae1f37

Lastly, it is recommended that you zero out the "scratch pad" area that the PID function uses for its calculation.  

PID4.jpg.44c69e6bfc729d0f0591da49ea2ba55

Share this post


Link to post
Share on other sites

@Michael Walsh,

I just still cant get it to work. I really don't know what I am doing wrong. Please can you run the program for me and highlight my exact errors. Its actually part of a school project and the due date is getting close

FINAL PROJECT - Single Loop Tank Level Control.bak

FINAL PROJECT - Single Loop Tank Level Control.cxp

FINAL PROJECT - Single Loop Tank Level Control.opt

PROJECT TWO - Single Loop Tank Level Control.cxp

PROJECT TWO - Single Loop Tank Level Control.opt

Edited by Jason_G

Share this post


Link to post
Share on other sites

PID instructions does not work in simulator.

Share this post


Link to post
Share on other sites

Yes, did you put this in a PLC?  I cannot open your attachments.  All that is needed is the file with the .cxp extension.

 

Share this post


Link to post
Share on other sites

Well,  first, change W10.04 to P_First_Cycle (A200.11).  That will make sure that your scratch area is zeroed out when you first power on the machine.

The instruction moving into D16 needs to move #1010 into D16.  This enables the output limiting so that the output value in D200 is from 0-100.

Delete this:

PID35.jpg.2807967f07bd26b93a90b5bf968e95

You have moved a decimal value of 2048 (hex 800) into the AT calculated gain.  Not sure what that would do , but you don't need it.

You likely have your direction backwards.  You moved a #3 into D15, which specifies the direction of the Proportional action to be forward.  For reference, if this were a temperature related application, Forward would be cooling and reverse would be heating:

pid7.jpg.4c469e66421da61c162a508317cfbd4

You likely need to move a #2 into D15.  This is likely what is causing it to not work as expected.  But, please do all recommendations.

 

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