07-31-2024 01:21 PM
I am working on a project that involves controlling the flow and temperature of a closed loop water system. I have created a PID and tuned it for the flow. It was, surprisingly, very easy to do and has been working great so far. The temperature system is killing me though. The temperature system consists of a heater and a cooler and I feel like I have the setup correct. Both the heater and the chiller are PWM controlled, I have my output range of the PID set -1, +1 and I have a VI that converts the output to a PWM. The PWM period I set to 5s arbitrarily, then I math out the +1, -1 PID MV output to a percent of the 5s. If the manipulated variable is > 0 the heater is fired, and < 0 the system routes the fluid through the chiller. This all seems to work great as far as heating and cooling in a sort of uncontrolled manner.
For the life of me I cant seem to get the PID tuned properly. I have already come to the conclusion that I should probably do some gain scheduling because I have setup some auto tuning functionality based on the "Autotuning PID Offline.vi" example (I have put similar setup into a DQMH module, I also tried using the PID Autotuning (Temperature).VI rather than the advanced PID Advanced.VI that i am using now, it also sucked). I did my flow PID the same way, and liked being able to try out the different methods of tuning. I found for the Flow system that the Chien-Hornes-Reswick method with 0% servo worked the best.
I was able to get decent results for the cooling portion of the tuning, albeit it was a bit slow to cool, but it held the temperature at the setpoint really well. The autotuning for the Higher temperature setpoints i will have to hit has not gone so well with any of the tuning methods.
So I have run these tunings several times at this point and just did the last one as Chien-Hornes-Reswick method with 0% servo hoping that I would have similar results as flow and the cooling process, but it doesn't seem like its going to ever hit the setpoints i need, its taking forever, hence the gain scheduling. (which will also help speed up the cooling) If it gets close maybe the values i found will work ok for maintaining the setpoint. So I found the formulas used here and since the tuning spits out "Identified Plant Parameters" I decided that maybe i would just use the parameters i got from the last tuning to calculate the 20% overshoot servo (or the regulator 0 and 20%). Before I mathed them out though i tried to apply the formulas for the 0% to make sure i would get matching gains as what the tuning had spit out, I plug the plant parameters i found into the NI provided formulas and the results i get are nowhere close to the gains that i got from the auto tuning.
The Identified plant parameters:
K = 185.54
T = 3247.88
L = 176.466
The Gains:
Kc = 0.059519
Ti = 54.131356
Td = 1.470547
and if i do the math with the formulas the gains that i get for CHR Servo 0%:
Kc = 0.6 * T / L = 11.04
Ti = L = 176.466
Td = 0.5 * L = 88.233
Am i misunderstanding how these formulas are applied? The formulas seem to match others that i have found online, so I don't think they are incorrect, what is going on here that the alleged formulas used are producing such different gains from what the math says i should be getting? Is this some sort of an error in the gains that are produced from the PID Autotuning Design.VI or an error in the Identified Plant Parameters?
For using gain scheduling, there are examples, so i should be all set with figuring that out, i can just use high "P" values to get close to the setpoints, but what would be the best method for determining what the gains should be to maintain the setpoint? I plan to try the ones i have, but at this point i expect them not to work for the High temp setpoints.
08-07-2024 08:59 AM
Hi Brother,
@TheWolfmansBrother wrote:
For using gain scheduling, there are examples, so i should be all set with figuring that out, i can just use high "P" values to get close to the setpoints, but what would be the best method for determining what the gains should be to maintain the setpoint? I plan to try the ones i have, but at this point i expect them not to work for the High temp setpoints.
I also worked with heaters and chillers, controlled by PWM.
My experiences/learnings: