burnerman said:
I can't believe that this problem has never been cracked - has anyone got any experience of a system that works?
Yes, for instance a hydraulic motion controller MUST take into account the fact that the gains need to be different when extending and retracting. Our hydraulic system extends at about 4.5 inches per second per volt and retracts at 3 inches per second per volt. This is a big difference in gains between extending and retracting. Having different gain scaling based on the polarity of the output is a standard feature. We use ONLY ONE PID.
What I would do is set up the PID to have bi-polar outputs. I would compare the output with 0 to see if heating or cooling is required. One must also allow for the temperature to seek ambient by just keeping the cooling or heating off. This keeps the system more efficient.
If the system requires heating, the output is copied to the analog output for the heater and a 0 is copied to the analog output to the cooling valve.
If the system requires cooling, the output is negated so it is a positive value and mulitiplied by a cooling/heating gain factor. This value is then sent to the cooling valve. A 0 is copied to the heater analog outout.
What we DON'T want to have happen is for the heater and cooler to go on and off while holding temperature at 400 degrees. This would be wasteful. Hopefully, the temperature will be maintained by just varying the analog value to the heater and the cooling ONLY comes on when the PID output goes negative.
The can be done with some simple ladder at the output of the PID. Now pater01's application is a little trickier because the outputs 0-100% must be scaled to 4-20 ma. The SCP block makes that part easy infact the SCP block can probably change eliminate the need to negate the output when it is negative. Let the SCP block take care of it.