PID Question

Started by Conrad A***** March 8, 2007
I am in the mechanical field (I took a systems and controls class
about 4 years ago) however I do dabble in quite a bit of electronics
(BX24 related) on the side.

A project I am wanting to take on is for my race car that I will get
up and running in the next few weeks. What I plan on doing is
removing the mechanical water pump and thermostat from the coolant
system and plumb in an electric water pump to replace the mechanical
unit. The whole interior heater core system has been removed since
it's strictly a race car (also makes things easier in terms of
coolant temp control). I want to control the electric water pump via
PID control as well as the radiator fan...but I'll talk about the fan
later.

The water pump minimum speed I would want is 5%-10% max speed (to
keep coolant flowing past the coolant sensor) controled via PWM
control. The desired temperature of the engine will be 180 degF.
When the coolant is slowly rising in temperature this will cause the
pump to speed up and slow the rate of the temperature rise and
eventually find a "sweet spot" with the duty cycle to keep the engine
at a steady temperature. When the car is driven hard I expect the
PID to see the massive change in temperature and compensate for it by
increasing the pump speed to keep the temperature at 180 degF.

Now I would like to run a separate PID program for the fan as well,
so it will modulate the speed of the fan...however I know with the
fan running it will affect the coolant PID as well. Would it make
more sense to tie the two together? Instead of having the two
potentially 'fight' eachother? Or is there a way to set the gain for
each and have them work together?

Most cases I have seen of PID on the net have been:
1 - temperature sensor
1 - heater
The desire is to heat the room to xx degrees. So if the delta is
large (say the desired is 30 degrees and the actual is 10) then the
heater will be on 100% of the time...while in my case it's opposite.
So the larger delta below the operating temp would result in the pump
running slower, but when it's closer or god forbid above the desired
value then the pump PWM will increase or possibly max out. Is there
any good places or sample code that show something related to this
idea?

I appreciate any input any of you have to offer.

Conrad Andres
Even a bare bones PID program would work. Where ADC is used, then
the PID process is used and I can vary the gain for each. I am sure
I can figure out the rest. Anyone know of any good PID code for the
BasicX?

Conrad

--- In b..., "Conrad A*****" wrote:
>
> I am in the mechanical field (I took a systems and controls class
> about 4 years ago) however I do dabble in quite a bit of
electronics
> (BX24 related) on the side.
>
> A project I am wanting to take on is for my race car that I will
get
> up and running in the next few weeks. What I plan on doing is
> removing the mechanical water pump and thermostat from the coolant
> system and plumb in an electric water pump to replace the
mechanical
> unit. The whole interior heater core system has been removed since
> it's strictly a race car (also makes things easier in terms of
> coolant temp control). I want to control the electric water pump
via
> PID control as well as the radiator fan...but I'll talk about the
fan
> later.
>
> The water pump minimum speed I would want is 5%-10% max speed (to
> keep coolant flowing past the coolant sensor) controled via PWM
> control. The desired temperature of the engine will be 180 degF.
> When the coolant is slowly rising in temperature this will cause
the
> pump to speed up and slow the rate of the temperature rise and
> eventually find a "sweet spot" with the duty cycle to keep the
engine
> at a steady temperature. When the car is driven hard I expect the
> PID to see the massive change in temperature and compensate for it
by
> increasing the pump speed to keep the temperature at 180 degF.
>
> Now I would like to run a separate PID program for the fan as well,
> so it will modulate the speed of the fan...however I know with the
> fan running it will affect the coolant PID as well. Would it make
> more sense to tie the two together? Instead of having the two
> potentially 'fight' eachother? Or is there a way to set the gain
for
> each and have them work together?
>
> Most cases I have seen of PID on the net have been:
> 1 - temperature sensor
> 1 - heater
> The desire is to heat the room to xx degrees. So if the delta is
> large (say the desired is 30 degrees and the actual is 10) then the
> heater will be on 100% of the time...while in my case it's
opposite.
> So the larger delta below the operating temp would result in the
pump
> running slower, but when it's closer or god forbid above the
desired
> value then the pump PWM will increase or possibly max out. Is
there
> any good places or sample code that show something related to this
> idea?
>
> I appreciate any input any of you have to offer.
>
> Conrad Andres
>
> Even a bare bones PID program would work.

There is this in the files, Conrad:
http://tech.groups.yahoo.com/group/basicx/files/Datasheets-Appnotes-Examples-Drawings/Code%20Techniques/
PID 1.1

I believe I spent a little time with it and found it incomplete, but it
might give you a place to start.
Tom
IMHO, I would leave the water system alone. You may find yourself
making steam really fast under WOT conditions. Get the best racing
water pump you can find for your engine, pull the mechanical thermostat
and monitor the coolant temperature coming out of the radiator. Use a
servo and sliding louver system to adjust the airflow through the
radiator to maintain coolant output temperature. Your electric fan/pump
modulation is going to do little to effect the airflow through the
radiator at 150 MPH. A spring-loaded louver system will provide a
fail-safe position parking open to protect your engine when the BX24
locks up. This assumes you're not just talking about a 10 year old Honda
with a four cylinder and spoiler package.

-----Original Message-----
From: b... [mailto:b...] On Behalf
Of Conrad A*****
Sent: Friday, March 09, 2007 4:17 PM
To: b...
Subject: [BasicX] Re: PID Question

Even a bare bones PID program would work. Where ADC is used, then
the PID process is used and I can vary the gain for each. I am sure
I can figure out the rest. Anyone know of any good PID code for the
BasicX?

Conrad

--- In b..., "Conrad A*****" wrote:
>
> I am in the mechanical field (I took a systems and controls class
> about 4 years ago) however I do dabble in quite a bit of
electronics
> (BX24 related) on the side.
>
> A project I am wanting to take on is for my race car that I will
get
> up and running in the next few weeks. What I plan on doing is
> removing the mechanical water pump and thermostat from the coolant
> system and plumb in an electric water pump to replace the
mechanical
> unit. The whole interior heater core system has been removed since
> it's strictly a race car (also makes things easier in terms of
> coolant temp control). I want to control the electric water pump
via
> PID control as well as the radiator fan...but I'll talk about the
fan
> later.
>
> The water pump minimum speed I would want is 5%-10% max speed (to
> keep coolant flowing past the coolant sensor) controled via PWM
> control. The desired temperature of the engine will be 180 degF.
> When the coolant is slowly rising in temperature this will cause
the
> pump to speed up and slow the rate of the temperature rise and
> eventually find a "sweet spot" with the duty cycle to keep the
engine
> at a steady temperature. When the car is driven hard I expect the
> PID to see the massive change in temperature and compensate for it
by
> increasing the pump speed to keep the temperature at 180 degF.
>
> Now I would like to run a separate PID program for the fan as well,
> so it will modulate the speed of the fan...however I know with the
> fan running it will affect the coolant PID as well. Would it make
> more sense to tie the two together? Instead of having the two
> potentially 'fight' eachother? Or is there a way to set the gain
for
> each and have them work together?
>
> Most cases I have seen of PID on the net have been:
> 1 - temperature sensor
> 1 - heater
> The desire is to heat the room to xx degrees. So if the delta is
> large (say the desired is 30 degrees and the actual is 10) then the
> heater will be on 100% of the time...while in my case it's
opposite.
> So the larger delta below the operating temp would result in the
pump
> running slower, but when it's closer or god forbid above the
desired
> value then the pump PWM will increase or possibly max out. Is
there
> any good places or sample code that show something related to this
> idea?
>
> I appreciate any input any of you have to offer.
>
> Conrad Andres
>

Yahoo! Groups Links
Something to consider regarding cooling systems.

Removing the thermostat in some cars sometimes causes overheating
problems. The reason is that the water jacket and radiator can only
move X amount of heat in a given time. The thermostat, even when in
the open position serves to restrict the flow. If the flow rate of
the coolant is too fast, there isn't enough time for the heat to move
into the coolant or (out of the radiator). I'm not exactly sure of
what engine/radiator/pump/power combination causes this issue, but I
have seen it happen a handful of time over the years.

That said, if you think you have the code working, and are seeing
undesireable results in the field, you may have to limit the maximum
speed of the pump to keep the flow rate below the 'too much isn't
always better' level.

-Don
--- In b..., "James R. Parish" wrote:
>
> IMHO, I would leave the water system alone. You may find yourself
> making steam really fast under WOT conditions. Get the best racing
> water pump you can find for your engine, pull the mechanical thermostat
> and monitor the coolant temperature coming out of the radiator. Use a
> servo and sliding louver system to adjust the airflow through the
> radiator to maintain coolant output temperature. Your electric fan/pump
> modulation is going to do little to effect the airflow through the
> radiator at 150 MPH. A spring-loaded louver system will provide a
> fail-safe position parking open to protect your engine when the BX24
> locks up. This assumes you're not just talking about a 10 year old Honda
> with a four cylinder and spoiler package.
>
> -----Original Message-----
> From: b... [mailto:b...] On Behalf
> Of Conrad A*****
> Sent: Friday, March 09, 2007 4:17 PM
> To: b...
> Subject: [BasicX] Re: PID Question
>
> Even a bare bones PID program would work. Where ADC is used, then
> the PID process is used and I can vary the gain for each. I am sure
> I can figure out the rest. Anyone know of any good PID code for the
> BasicX?
>
> Conrad
>
> --- In b..., "Conrad A*****" wrote:
> >
> > I am in the mechanical field (I took a systems and controls class
> > about 4 years ago) however I do dabble in quite a bit of
> electronics
> > (BX24 related) on the side.
> >
> > A project I am wanting to take on is for my race car that I will
> get
> > up and running in the next few weeks. What I plan on doing is
> > removing the mechanical water pump and thermostat from the coolant
> > system and plumb in an electric water pump to replace the
> mechanical
> > unit. The whole interior heater core system has been removed since
> > it's strictly a race car (also makes things easier in terms of
> > coolant temp control). I want to control the electric water pump
> via
> > PID control as well as the radiator fan...but I'll talk about the
> fan
> > later.
> >
> > The water pump minimum speed I would want is 5%-10% max speed (to
> > keep coolant flowing past the coolant sensor) controled via PWM
> > control. The desired temperature of the engine will be 180 degF.
> > When the coolant is slowly rising in temperature this will cause
> the
> > pump to speed up and slow the rate of the temperature rise and
> > eventually find a "sweet spot" with the duty cycle to keep the
> engine
> > at a steady temperature. When the car is driven hard I expect the
> > PID to see the massive change in temperature and compensate for it
> by
> > increasing the pump speed to keep the temperature at 180 degF.
> >
> > Now I would like to run a separate PID program for the fan as well,
> > so it will modulate the speed of the fan...however I know with the
> > fan running it will affect the coolant PID as well. Would it make
> > more sense to tie the two together? Instead of having the two
> > potentially 'fight' eachother? Or is there a way to set the gain
> for
> > each and have them work together?
> >
> > Most cases I have seen of PID on the net have been:
> > 1 - temperature sensor
> > 1 - heater
> > The desire is to heat the room to xx degrees. So if the delta is
> > large (say the desired is 30 degrees and the actual is 10) then the
> > heater will be on 100% of the time...while in my case it's
> opposite.
> > So the larger delta below the operating temp would result in the
> pump
> > running slower, but when it's closer or god forbid above the
> desired
> > value then the pump PWM will increase or possibly max out. Is
> there
> > any good places or sample code that show something related to this
> > idea?
> >
> > I appreciate any input any of you have to offer.
> >
> > Conrad Andres
> >
> Yahoo! Groups Links
>
I'm not sure that this is correct Don. The rate of heat transfer Q uA(Tw-Ta) where u is the heat transfer coef of the radiator, A is area
and Tw - Ta is deltaT. Intuitively, if the rate of water flow is higher,
deltaT will be greater, thereby increasing Q. I'm not sure if time
enters into it?
neil

Don Kirby wrote:
Removing the thermostat in some cars sometimes causes overheating
problems. The reason is that the water jacket and radiator can only
move X amount of heat in a given time. The thermostat, even when in
the open position serves to restrict the flow. If the flow rate of
the coolant is too fast, there isn't enough time for the heat to move
into the coolant or (out of the radiator). I'm not exactly sure of
what engine/radiator/
I have a offroad car. It has a chevy 350 and his is right. I have to
run a restrictor where the thermostat was. It only has a 3/4 hole.
That is the size that got the car running the coolest.

Frank
--- In b..., "njepsen@..." wrote:
>
> I'm not sure that this is correct Don. The rate of heat transfer Q > uA(Tw-Ta) where u is the heat transfer coef of the radiator, A is area
> and Tw - Ta is deltaT. Intuitively, if the rate of water flow is
higher,
> deltaT will be greater, thereby increasing Q. I'm not sure if time
> enters into it?
> neil
> Don Kirby wrote:
> Removing the thermostat in some cars sometimes causes overheating
> problems. The reason is that the water jacket and radiator can only
> move X amount of heat in a given time. The thermostat, even when in
> the open position serves to restrict the flow. If the flow rate of
> the coolant is too fast, there isn't enough time for the heat to move
> into the coolant or (out of the radiator). I'm not exactly sure of
> what engine/radiator/
>
I'm with Neil - it's simple thermodynamics. Another thing the thermostat
restriction provides is higher coolant pressure in all areas between the
pump outlet and the tstat , including the block/head cooling passages,
thus raising the boiling point even more and delaying the onset of
nucleate and film boiling on the critical and expensive parts. Sorry for
the OT stuff mods! On topic stuff: I use a BX24 to interrogate the
realtime variables of a MegaSquirt EFI/ignition controller via a serial
port and display this info on a VFD. I'm working on squeezing in enough
code to be able to modify the Megasquirt parms in real time as well.
Nice robust product!

-Mike

n...@ihug.co.nz wrote:
>
> I'm not sure that this is correct Don. The rate of heat transfer Q > uA(Tw-Ta) where u is the heat transfer coef of the radiator, A is area
> and Tw - Ta is deltaT. Intuitively, if the rate of water flow is higher,
> deltaT will be greater, thereby increasing Q. I'm not sure if time
> enters into it?
> neil
>
> Don Kirby wrote:
> Removing the thermostat in some cars sometimes causes overheating
> problems. The reason is that the water jacket and radiator can only
> move X amount of heat in a given time. The thermostat, even when in
> the open position serves to restrict the flow. If the flow rate of
> the coolant is too fast, there isn't enough time for the heat to move
> into the coolant or (out of the radiator). I'm not exactly sure of
> what engine/radiator/
>
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.11/722 - Release Date: 3/14/2007 3:38 PM
>
Good discussion, I agree with you Neil, however Mike you are right
the restrictor instead of a thermostat creates backpressure which
ultimately creates a higher pressure inside the block/head which
reduces the chance of boiling. So I will be running a restrictor, no
biggy.

I could create a very basic code that says run pump at 10% until 150
degrees, 50% at 170 degrees, 100% at anything higher than 190 and
turn the fan on 100%. However I could add more to control it even
more...but in essence that's very crude PID code.

Which is the reason I want to use PID code so I can set my desired
temperature, then set the variables (I've done PID tuning back in my
Systems and Controls class) and tweak them until I get a steady
coolant temperature.

Mike, my car has a MS1 and has been setup with the MSNS code with
antilag and flatshifting. I have mutliple spare turbos so no worry
with the antilag, but hopefully the car will be up and running this
year. Due to size constraints I have no choice but to go with an
electric pump. I don't want to have a pump running 100% all the time
with a thermostat in place, I'd like to have some more control over
the cooling system since the car is meant for racing and I'd like to
maximize power but also ensure there is no chance of overheating
(since the BX24 will constantly be monitoring the temperature). Also
having lines of code for cooldown procedures under various cases and
start up procedures would be nice too!

I did take a look at PID1.1...I did begin stripping through the lines
and lines of code. I am just looking for a basic bare bones PID code
though and then I can add from that. I find that easier than
subtracting code from what is already presented.

Anyone have any barebones PID code? What about self-learning PID
code?

Conrad

--- In b..., Mike Robert wrote:
>
> I'm with Neil - it's simple thermodynamics. Another thing the
thermostat
> restriction provides is higher coolant pressure in all areas
between the
> pump outlet and the tstat , including the block/head cooling
passages,
> thus raising the boiling point even more and delaying the onset of
> nucleate and film boiling on the critical and expensive parts.
Sorry for
> the OT stuff mods! On topic stuff: I use a BX24 to interrogate the
> realtime variables of a MegaSquirt EFI/ignition controller via a
serial
> port and display this info on a VFD. I'm working on squeezing in
enough
> code to be able to modify the Megasquirt parms in real time as
well.
> Nice robust product!
>
> -Mike
>
> njepsen@... wrote:
> >
> > I'm not sure that this is correct Don. The rate of heat transfer
Q > > uA(Tw-Ta) where u is the heat transfer coef of the radiator, A is
area
> > and Tw - Ta is deltaT. Intuitively, if the rate of water flow is
higher,
> > deltaT will be greater, thereby increasing Q. I'm not sure if time
> > enters into it?
> > neil
> >
> > Don Kirby wrote:
> > Removing the thermostat in some cars sometimes causes overheating
> > problems. The reason is that the water jacket and radiator can
only
> > move X amount of heat in a given time. The thermostat, even when
in
> > the open position serves to restrict the flow. If the flow rate of
> > the coolant is too fast, there isn't enough time for the heat to
move
> > into the coolant or (out of the radiator). I'm not exactly sure of
> > what engine/radiator/
> >
> >
> > ------------------------------
------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.446 / Virus Database: 268.18.11/722 - Release Date:
3/14/2007 3:38 PM
>
Nobody knows? I'd really like to know if anyone has had any
experience with this or any tips for me.

Conrad

--- In b..., "Conrad A*****" wrote:
>
> Good discussion, I agree with you Neil, however Mike you are right
> the restrictor instead of a thermostat creates backpressure which
> ultimately creates a higher pressure inside the block/head which
> reduces the chance of boiling. So I will be running a restrictor,
no
> biggy.
>
> I could create a very basic code that says run pump at 10% until
150
> degrees, 50% at 170 degrees, 100% at anything higher than 190 and
> turn the fan on 100%. However I could add more to control it even
> more...but in essence that's very crude PID code.
>
> Which is the reason I want to use PID code so I can set my desired
> temperature, then set the variables (I've done PID tuning back in
my
> Systems and Controls class) and tweak them until I get a steady
> coolant temperature.
>
> Mike, my car has a MS1 and has been setup with the MSNS code with
> antilag and flatshifting. I have mutliple spare turbos so no worry
> with the antilag, but hopefully the car will be up and running this
> year. Due to size constraints I have no choice but to go with an
> electric pump. I don't want to have a pump running 100% all the
time
> with a thermostat in place, I'd like to have some more control over
> the cooling system since the car is meant for racing and I'd like
to
> maximize power but also ensure there is no chance of overheating
> (since the BX24 will constantly be monitoring the temperature).
Also
> having lines of code for cooldown procedures under various cases
and
> start up procedures would be nice too!
>
> I did take a look at PID1.1...I did begin stripping through the
lines
> and lines of code. I am just looking for a basic bare bones PID
code
> though and then I can add from that. I find that easier than
> subtracting code from what is already presented.
>
> Anyone have any barebones PID code? What about self-learning PID
> code?
>
> Conrad
>
> --- In b..., Mike Robert wrote:
> >
> > I'm with Neil - it's simple thermodynamics. Another thing the
> thermostat
> > restriction provides is higher coolant pressure in all areas
> between the
> > pump outlet and the tstat , including the block/head cooling
> passages,
> > thus raising the boiling point even more and delaying the onset
of
> > nucleate and film boiling on the critical and expensive parts.
> Sorry for
> > the OT stuff mods! On topic stuff: I use a BX24 to interrogate
the
> > realtime variables of a MegaSquirt EFI/ignition controller via a
> serial
> > port and display this info on a VFD. I'm working on squeezing in
> enough
> > code to be able to modify the Megasquirt parms in real time as
> well.
> > Nice robust product!
> >
> > -Mike
> >
> > njepsen@ wrote:
> > >
> > > I'm not sure that this is correct Don. The rate of heat
transfer
> Q > > > uA(Tw-Ta) where u is the heat transfer coef of the radiator, A
is
> area
> > > and Tw - Ta is deltaT. Intuitively, if the rate of water flow
is
> higher,
> > > deltaT will be greater, thereby increasing Q. I'm not sure if
time
> > > enters into it?
> > > neil
> > >
> > > Don Kirby wrote:
> > > Removing the thermostat in some cars sometimes causes
overheating
> > > problems. The reason is that the water jacket and radiator can
> only
> > > move X amount of heat in a given time. The thermostat, even
when
> in
> > > the open position serves to restrict the flow. If the flow rate
of
> > > the coolant is too fast, there isn't enough time for the heat
to
> move
> > > into the coolant or (out of the radiator). I'm not exactly sure
of
> > > what engine/radiator/
> > >
> > >
> > > ----------------------------
--
> ------
> > >
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.5.446 / Virus Database: 268.18.11/722 - Release
Date:
> 3/14/2007 3:38 PM
> > >
>