I have a general question about the integral term that is used in PID control algorithms. The integral term is just the integral of the error of the system over all time, correct? And then this value is multiplied by some gain factor to form the integral term of the input that is sent back to control the system. I have 2 questions: first of all, does the integral term treat all error as a positive value, or does it give error in one direction from the setpoint a positive value, and error in the other direction a negative value? And then my second question is, suppose you have a system whose state is "higher" than whatever the desired setpoint is. Then say that the system is controlled and gradually settles in on the setpoint, without any oscillations. The system will be at the desired point, but the integral of the error will still be a positive value, and will therefore contribute a corrective value to the system's input to drive it below the setpoint to produce "negative error" in order to cancel out the positive integral error that had been accumulated. Is that how the integral term really works, or am I missing something here? I haven't had a complete class on control (yet), but I've read a little about it and just didn't quite understand that part of it.
