Electronic – How To Interpret PID Output in a Slow Response System

actuatorcontroldc motorpid controller

@Update:
A few days have passed since I asked this question and I've had a chance to do some research based on the answers I've received from @R Drast and @Spehro. I'm not sure this update is the correct thing to do, but my new questions are still related to the original topic and the title is still relevant.

I hadn't realized that "Position" and "Velocity" are two types of algorithm that determine how the PID output is treated (probably obvious from my original responses below). Oddly enough, I figured the incremental and relative (velocity) method was, intuitively, the most appropriate for my situation and yet it was roundly rejected in the previous answers. So, I have some questions about the position method relating to my specific setup (measuring temperature, large dead-time, etc).

Firstly, I want to make sure I have a correct understanding of how the position method actually works. I understand it to mean that you assign a PID output to each (valid) position on the actuator. For example, a PID output of -3V would be one extent of the actuator, say fully retracted (i.e., window closed/least ventilation) whilst 3V would be the other end (fully extended or maximum ventilation). This would put zero somewhere in between. Do I have this right?

If the above understanding is correct then that would mean you pre-determine the point on the actuator when the error is zero. Is that right?

So, how do you deal with the following scenario: it's mid-morning and 25 degrees in the gh. The SP is 25 degrees and the actuator is fully retracted, the error is 0 (so this puts the zero position as: actuator fully retracted – fair enough). As midday advances, the temperature goes up, the actuator pushes the window open and the temp in the gh falls again. Now we have a new 0 point actuator position. You can't ask the actuator to go back to the original zero position, that would close the window!

I obviously have gone wrong somewhere and I don't quite follow what @R Drast and @Spehro have said below. Can you guys (or anyone else) put me straight on this??

====================================================================
Original Question:

I'm relatively new to electronics and I've been working on a temperature controller for my greenhouse for some time now. The system comprises a PID controller and linear actuator all orchestrated by a microcontroller, ATTiny 2313 most likely (see images). The block diagram doesn't capture it, but the actuator is end stop controlled and the LDR is there to close everything up at night. My original intention was to do this without a microcontroller and so pieces like the DAC seem a little redundant now (although I expect I'll save some pins on my uC). That's the background, with most of the individual components built and tested at this stage.

enter image description here

enter image description here

enter image description here

My question is this, how should I interpret the PID output in a system whose feedback is slow? I understand the PID output to be a control "command", so when the PID output is +2V it's saying "adjust the system output by +2V to reach the set point target". I can understand this for say motor speed control where the feedback is rapid. There's little chance the system will be over-stretched owing to a slow system response since the motor will respond immediately to the PID command and in the next instant the command will have changed appropriately.

Just to be clear and in response to a comment by a responder, I understand that the command is "positional" which makes sense since a PID output of 0 means don't move from your present position, the setpoint has been obtained.

However, I can see (using my prototype setup, see image) that the command from the PID can be output for quite some time owing to the slow system response driving the actuator to the end stop. One idea I had was to slow down the command delivery by sampling the PID output (using the uC) every so often and then acting accordingly. This is an attempt to match the command to the system response but I'm not sure if this is the right thing to do. What's the best thing to do here? (Apologies for the quality of the PID Controller circuit diagram. It was difficult to fit it all on the one image).

Best Answer

You shouldn't be using the PID output as a velocity command in your system, as it will simply become unstable and eventually oscillate between one end limit and the other, or have no response.

Using a linear actuator as you are, you should use the output of the PID as a position command, and have the actuator follow the output that way. By setting the PID min and max limits, the end of travel switches are only safeties if something goes horribly wrong.

Also, if you detect that your PID is at either limit (which it might have to be if the response is very slow), you want to inhibit the integral term for as long as it is at a limit so that you don't suffer from integrator wind-up.

PID's work fine on motor controls, true, but I use them industrially to control temperatures easily on systems with several minutes of lag. Tuning is everything... Remember the basics, Proportional gain will only get you (approximately) half to three quarters way to the setpoint, Integral gain will take you the rest of the way. Derivative tempers the change.

For temperature control loops with a long lag, I find it much easier to ramp the setpoint up slowly to the final setpoint rather than jump it immediately, it allows a tighter tuning of the PID without having it go into oscillation.