lchamarthi

Sample Pid Program

7 posts in this topic

Hi All, Could anybody send some sample PID ladder to control temperature/any process value? Regards L Edited by lchamarthi

Share this post


Link to post
Share on other sites
Hi Sorin, Thank you for sending sample PID code & i implemented as attached for controlling 0--250 degree centigrade temperature sensing through Analog Input 2002 & controlled range 0---250 degree . But in the result word i always see & 4095 (FFF) value Constatly regardless change of Set value. More over DA041 Analog Output module (In my application Valve controlling through Analog output) which supports only upto 4000 counts. I didn't understand why it is giving 4095 counts instead of Max 4000 counts (which DA041 module support) ? Could you please check my code & kindly let me know comments for controlling only 0----250 degree centigrade. Thanks in advance. L PID.cxp Edited by lchamarthi
1 person likes this

Share this post


Link to post
Share on other sites

Hi! I looked over your program and I've made some modifications. First of all, all the PV, SV, MV of the PID controller are binary values (ie. UINT). You have selected 12 bit PID range for input and output, so the values are from &0 to &4096. The analog I/O of CJ1/CS1 are also 12 bit, but the actually range is smaller (ie &0..&4000), allowing you to override the 4..20mA input span. So each analog I/O have to be scaled to the new range. Other mistake that you did, was the use of BCD data instead of binary (for ex. you used BCD data for PV and SV values). The PID output is at maximum value because the loop is not tuned. You can start by setting P=10, I=9999 and D=0. In this way you can see some changes in output without autotunning, just modifying the SV. I am sorry, but I have no time for the instance to modify the code I sent to you to suit your application. Kind regards, Sorin. PID.cxp

1 person likes this

Share this post


Link to post
Share on other sites
Hello Sorin! Really thanks a lot for taking your valuable time-off to check the code & valuable comments given. I didn't used APR instruction & binary calucation for conversion. Instead of that i used SCL instruction defining directly Maximum & minimum limits of the two data (i.e. 0---250 Degree C, 0----0FA0) for conversion from one to one. Also as you advised I put #449 instead of #494 in C+6 word for PID. Now I turned on the PIDAT instruction with Always on BIT & C+9 with #8000 (15 bit-On) always. Then output is giving &4095 as long as the SV Higher than PV and &0 if PV is higher than SV or equal. Is it okay to implement (I always see &4095 for any error but some times &3071..for any error----I thought PID always open maximum to reach SV quickly regardless of change in error provided SV is higher than PV). Also I kept P=10, I=9999 & D=0 constantly Now I am similating on board, May be if we go to the field then we will come to know the actual response i think. Thank you for the help L Edited by lchamarthi
1 person likes this

Share this post


Link to post
Share on other sites
On 3/21/2006 at 5:29 AM, sorin.dumitriu@rdslink.ro said:

Hi! here is a sample of a heating PID loop with autotunng of CJ1M-CPU11. Enjoy! Regards, Sorin. Exemplu_PID_Eng..cxp

hi there..

how do i get the sample program that u attach with..?

regards

1 person likes this

Share this post


Link to post
Share on other sites

There was an issue with the website a while back where the attachments were no longer available.  Unfortunately, we have to fix the issue with each post as we find them.  I have fixed the file link above.  You should be able to download it now.

1 person likes this

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