Understanding how your system operates is the first key to getting PID to work.
So, we’re going to spend this entire video getting to know our system and finding out
what it is capable of.
This is the hardware we will be using in this series of videos.
It’s just a quick demo I threw together using parts I happened to have laying around
the office so don’t get hung up on the exact part numbers.
In a nutshell, this 500-Watt heater is trying to heat things up while this exhaust fan is
pulling room temperature air through the enclosure.
Our goal?
We want to accurately control the enclosure's internal temperature by controlling the heater's
average input power.
We’ll do that by configuring a BRX PLC output to be a Pulse Width Modulated – or PWM - signal.
That will control this solid-state relay, which will toggle the 120-Volt AC power into
the 500-Watt resistive fan heater.
If the PWM signal is on all the time, the heater is on all the time and we get all 500
watts.
If the PWM output is set to a 50% duty cycle, then the heater is only on half the time and
we get half the heat.
A 25% duty cycle gives us 25% of the heat,
etc.
We’ll see how easy that is to set up in a Do-more PLC in just a minute.
While the 12-Volt exhaust fan is on all the time for this demo, I did connect it to a
regular digital output just in case I wanted to control that too.
The BRX digital outputs can handle up to half an amp and the fan only needs 200 milliamps
so it is a direct connection.
This RTD sensor provides a 4-20 mA signal so we can run it directly into an analog input
on the BRX PLC.
I added a digital panel meter here so I can see at a glance the temperature inside the
enclosure.
It isn’t required, it’s just for my convenience.
I connected another digital panel meter to a room temperature RTD sensor and sent that
into another BRX analog input, so we could monitor the temperature of the room during
our testing.
This panel meter is both showing me the room temperature AND converting the RTD signal
to 4-20 milliamps which saves me from purchasing a BRX RTD input module.
In this configuration, the digital panel meter is also providing the loop power, so we don’t
need another power supply.
I have a beacon connected to a digital output to warn folks a test is in progress.
Again, this not required, it’s just for my convenience.
This schematic shows how all of that is wired.
You can pause the video to take a closer look and I’ll also include a link to the schematic
and parts list in the notes below the video.
The Do-more PLC setup is straight forward so I’ll also include a link to the project
file in the notes below the video if you want to take a look at it.
The only thing you may not be familiar with is how to setup and manipulate the PWM output
and how to choose the correct exhaust fan size, so let’s take a closer look at those
two since they are both keys to getting this to work.
We COULD set up a Do-more output as a PWM output. Just go to the dashboard, click on Outputs,
configure high-speed outputs, and select one of the PWM outputs.
Give it a name and assign one of the available outputs to it.
Easy!
But, that would be a waste of only three possible high-speed PWM outputs.
We’re not going to need high speed so instead all of the demos we do in this series will
use the TIMEPROP instruction to create the PWM output.
We’ll get the same end result, but we don’t waste a high-speed I/O to do it.
The cycle time just needs to be something faster than the response time of the heater,
which is several seconds, so I chose 1 second to keep things simple.
We’ll control the pulse width with R0 and it will go from 0 to 100%.
And we’ll use this to drive output Y0.
So, to change the heater power, we just change R0.
The TIMEPROP instruction will use that to automatically change the PWM output duty cycle
which will ultimately change the average output power of the heater.
The exhaust fan is critical to our success.
Without it, the 500-Watt heater would just keep re-heating the hot air in the box until
something melted or the heater’s built-in thermal fuse tripped.
The enclosure is only rated for 250 degrees so it’s really important we choose the right
exhaust fan size.
But how do we know what size fan to use to keep the enclosure at a reasonable temperature
but still give PID enough headroom to do its job?
Well, we want to maintain an accurate 110 degrees Fahrenheit inside the enclosure, right?
And we want to give PID as much head room as we can, so it can do its job.
That is, if you want to hold the temperature at 110 degrees, then it really helps PID to have the ability to go way past 110.
That way PID can go full throttle to ramp up to speed quickly, but then back off as
it approaches the 110 setpoint it needs to get to.
It’s kinda like when you drive a car. It sure helps to have a car that has the horsepower
to get you up to 120 miles per hour just so you can accelerate rapidly to 60 miles per
hour, right?
Same thing.
So we need an exhaust fan that keeps the enclosure cool enough to prevent cabinet meltdown,
but leaves enough heater power headroom so PID can get the enclosure up to 110 degrees
quickly.
We know the enclosure is rated for 250 degrees, and I also know this heater safety trips at
210 degrees, so we need to be below that.
So let’s find an exhaust fan that will keep the enclosure under 200 degrees, maybe in
the 180 to 190 degree ballpark.
That will give us a good amount of heater power headroom, so we can get to 110 degrees
quickly without melting the enclosure.
Again, the more headroom you can afford to give PID, the better it will work.
Given that, we just go to this awesome tool on the Stego enclosures website and select
Cooling.
My room temperature is going to average around 72 degrees.
I want the internal box temperature to be around 190 degrees max and I have a 500-Watt
heater in the box.
I’m in Atlanta Georgia, which is around 350 meters above sea level.
Altitude is important because thinner air has fewer hot molecules for the fan to move,
so a fan won’t be able to move as much heat per minute.
Hit Calculate and it tells me I need a fan with around 15 cubic feet per minute of airflow.
That was for an ideal system of course, and it depends heavily on things like how the air
flows through the box, enclosure materials, etc.
But it should get us in the ball park.
AutomationDirect has tons of replacement fans for variable frequency drives, soft starters,
etc., so I searched the specs of some of those data sheets to see if any of them would fit
our needs.
Looks like this replacement fan for a GS3 Drive is pretty close!
It will move a little more air than we need, which just means the max temperature will be below
190 degrees, but it should be good enough, so that’s the one I installed here to pull
air through the box.
I drilled some holes in the top of the box to allow airflow to happen.
To test all of this and see what we REALLY got, I programmed the BRX PLC to apply full
power to the heater and log the temperatures every 30 seconds.
The temperature rose like this and it looks like it leveled off to a steady state temperature
of around 160 degrees.
That’s about what we expected.
Cool.
Then I had it do the same thing at 80% average heater power, 60% power, 40% average
power and 20% power.
I also monitored the room temperature air and subtracted the temperature fluctuations
out to normalize everything to a constant room temperature.
That way, the room temperature fluctuations won’t bias the results.
You’ll find a link to that Do-more Designer project in the description below the video
so you can see how I used Do-more’s built-in data logging instructions to do that.
This tells us our system isn’t perfectly linear.
If it was linear, then these lines would all be equally spaced.
That is, each time we bumped the power 20%, we should see an equally proportional increase
in temperature.
But how bad is it?
If we plot the average steady state temperatures vs power, we can see how linear it is.
I’ll add a trendline to show what a perfectly linear system would look like.
OK, it’s not perfect, but it is reasonably linear with some minor variations so PID should
have no problem working with this.
In the next video we’ll use what we learned here about our hardware to implement PID in
our ladder code.
We’ll then run Auto-Tune to generate the PID coefficients we need to automatically
control the temperature inside the enclosure and then we’ll run a bunch of tests on the
real hardware to see how well it worked.
Click here to see all the videos in this Do-more PID series.
Click here to learn more about AutomationDirect’s Free technical support options and click here
to subscribe to our YouTube channel so you will be notified when we publish new videos.