Help - Search - Members - Calendar
Full Version: Tempture controller
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
andrea
Hi Guys


I am setting up a water boiler with a analog sensor input. I am wondreing if there is a better way of controling the offset and timedelay than what I have in the program I have posted.

I have added the time delay so the output will not cycle to fast.

Are there any better ideas?


Andrea
robh
Assuming you are talking about controlling the boilers temperature,

Here is what I used for heating up some aluminum platens. I could not allow the heaters to be on 100% all the time while trying to reach set point to prevent burning up, and to keep it from overriding set point. So I had a span of temperature from room temp to 75 % of set point, where the heaters cycle was 30 seconds on and 5 seconds off. Once the temp got above the 75% of set point the heaters cycle went to 10 on and 5 off. I was also using a thermocouple for temp input. Not sure if this helps, but I thought I would throw it out there.
Rob
finfin
Here are some thoughts:

The timer set at 10 seconds doesn't seem like it would do anything except allow the temperature to drop a bit, which could be accomplished by a lower set point. One thing it does do however is help isolate the system from temperature sensor noise. That is a downward spike in temperature (not real temperature... just noise), would not turn on the output. I would guess that .5 to 1 second would be plenty for this.

You seem not to be set up to catch the same for turning the output off. This would take another timer.

Obviously I don't know the application environment. These are just thoughts.
andrea
I am controlling a hotwater boiler . all I want to do is have a high set point and a 5 c offset the timer is to prevent it from cycling to fast.
finfin
What is "to fast"? Could it really change 5 degrees C in less than 10 seconds? Right now the timer seems to limit the "off" time to not less than 10 seconds, and doesn't limit the "on" time at all.
andrea
Right now when the temperature will reach high or low, for a second or 2 it will go on and off because of the way the analog sensor sense the temperature since I have added the timer it has to time out before it can come back on.
finfin
so it's not really cycling through the temperature thresholds... it's just noise from the sensor input. I understand now. Seems like latching it on and not unlatching until it goes below the low threshold would have fixed that. Reported temperature uncertainty of a few hundredths of a degree I can understand, but 5 degrees of noise is wild. Did you add the latch/unlatch at the same time as the timer?
andrea
yes it is .5deg noise that will turn it on and off so the timer prevents that.

I had to change the rungs . The program is edited now.

the program works ,but was wondering if this is the right way of doing it or is there a better way?
MIKE31
HI
Is it possible to convert your code to PDF format, not everybody got the current revision . Thanks
Mickey
QUOTE(MIKE31 @ Mar 8 2008, 06:31 PM) [snapback]66160[/snapback]
HI
Is it possible to convert your code to PDF format, not everybody got the current revision . Thanks


Here you go.

Peter Nachtwey
QUOTE(andrea @ Mar 6 2008, 03:28 PM) [snapback]66068[/snapback]

Are there any better ideas?

Now I can see what you are doing. How do you know that 10 seconds is the right amount of time to be on or off. That can be too long depending on the time constant of your system. Do you know the time constant of your system? Does your system have a dead time?

What you are doing is somewhat of a kludge. There is an alternative approach to PID control that works well when the output is on or off. It is called Sliding Mode Control or SMC. The basic idea is similar to what you already have. If the Error= SP-PV > 0 then the heater is on otherwise it is off. You already know the problem with this technique is that the temperature WILL over shoot the SP because the heater is on until the PV > SP. This is not good so we need a way of turning off the heater even though the PV is below the SP. This is done by taking the error rate into account. It should be obvious that the faster the PV is approaching the SP the sooner you want to turn off the heater to keep from over shooting the SP. Now the condition for turning on the heater changes to:


Error(n)=SP(n)-PV(n)
ErrorRate(n)=(Error(n)-Error(n-1))/TimePeriod

Now if

tau*ErrorRate(n)+Error(n) > 0 then turn on the heater.

Tau is a time constant. If must be equal to or longer than the time constant of the system. I like to keep the TimePeriod short relative to tau ( time constant ) or the plant time constant. I would do these calculations every second in a interrupt.

Here is an example
ftp://ftp.deltacompsys.com/public/SMC/smc%20rs500.zip

Don't be intimidated. Most of the code is for the simulator. Yes there is a simulator and trends!!!! Talk about a gift.

The advantage of SMC is that it is very robust and easy to setup. Load changes do not affect SMC control as much as load changes affect PID control. SMC will tend to turn on and off the heater more often than in your example because it is doing its check every second instead of every 10 but this isn't a problem if you are using solid state relays. The ML1500 LRP must have mechanical relays because I could here it click on and off as the simulation progressed.

If the control overshoots then just make tau ( the time constant ) longer.

SleepyWombat made a SMC simulator in Excel so you can see what it does and how it does it.
http://www.plcs.net/downloads/index.php?PH...3ad43284fd22a74

See the Sliding Mode Control.xls








This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.