Sign in to follow this  
Followers 0
Bibby

Basic PID

12 posts in this topic

Hi, I am using a Fx2n-4ad-TC with aFx1N. I need to control butter temp between 30c & 40c + - 1c via a HMI set point. Thermocouple reads fine. I will be using a solid state relay to turn a water heater on & off. Does anyone have code that i could just cut & past in. The book as usual is little help! Thanks in advance.

Share this post


Link to post
Share on other sites
The FX Programming Manual (JY992D88101) has a programming example in the back of the book for basic PID control.

Share this post


Link to post
Share on other sites
Bibby, It is impossible to copy and paste code from another, and hope that it works! What about the parameters: kp, ti, td, sample time, etc...... I have found this post. http://forums.mrplc.com/index.php?showtopic=9188&hl= The search facility does work really nice. Regards, WayneS

Share this post


Link to post
Share on other sites
Hi, thanks for your replies, but being very new to this kind of stuff, half a partial program does not help me at all.How in the example is an output controlled? Bibby.

Share this post


Link to post
Share on other sites
Typically what's happening is the PID loop is creating a numeric output value which would be transferred to an analog output. That analog signal would for example control a pump or heater to modify the input signal to the PID (current temp, pump flow, whatever.)

Share this post


Link to post
Share on other sites
Do you have to do it with a PID controller. I've used the PID function in the FX2N many times, but always with an analogue control valve to precisely adjust the amount of steam or the amount of flow. I've never used a PID block with a digital output, and I'm not sure how you would do it. How you would convert an analogue MV value into digital switching would require some thought, or maybe some more hardware. Could you not just programme it as a simple thermostat. ..... when temp less than low setpoint, turn on heater, when greater than high setpoint, turn off heater?

Share this post


Link to post
Share on other sites
Converting the PID output for a digital output you adjust the mark space ratio of a square wave PID output 0 to 100% one timer simply output on when timer "current value" <= PID output /100 * Timer Preset Timer Preset value is chosen to suit the control loop ( I use a value equal to the execution time of the PID) enhancements to basic control IF PID < 3% ( or PID output/100 * Timer Preset < minimum usefull on time) Don't bother turning ON output IF PID > 97% ( or (100 - PID output)/100 * Timer Preset < minimum usefull on time) Don't bother turning OFF output Reasoning for enhancements are 1) minimum switching times of the Digital device 2) minimum usefull time for process eg Turning on heater for 100 ms when the preset time is 10 seconds and the item being heated has a large thermal mass has no real effect on heating.

Share this post


Link to post
Share on other sites
Maybe Peter Nachtwey has some valuable input? He knows this stuff very well.

Share this post


Link to post
Share on other sites
Hi, I only went down the PID route after the rep from mitsubushi recomended it. I would be more than happy with any help in controlling water within 1deg c. If any one has a working example I would welcome it. Thanks, Bibby.

Share this post


Link to post
Share on other sites
Whats wrong with michael G example... it explains quite well how to turn the out put on/off through the use of a timer... this is baciscally what a temperature controller is doing with a relay out put... He was also nice enough to point out that you will need a contol output timer limitation (espsecially helpful for relay outputs). I would also suggest that you do some reading of PID... learn... cut and paste just aint gonna cut it...

Share this post


Link to post
Share on other sites
Thanks for all your helpful replies. I managed to obtain an example that I could just "cut and paste" in to my code & it works just fine! Cut and past.. It is the future. BIBBY. Edited by Bibby

Share this post


Link to post
Share on other sites
If you don't mind Bibby, post it here? I would be interested to see how this was done in the example you got. Edited by waynes

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
Sign in to follow this  
Followers 0