Hi to all,
I've a question about the PI regulators. I'm wondering how to implement the 'I' part of the following controller. I'm working on a position controller equipment. So there are a motor and a position sensor which provides feedback. I need to rotate the motor until it reaches the desired position.
If I integrate the error signal I get a constant output also when the system reaches the setpoint. This is because the integrator remembers the past errors. However, I need the integral part of the controller because if the system isn't getting close to the setpoint it must increase the drive signal.
Please, may you provide me a simple C code to understand how to implement such a controller?
For example, a raw PI (with no bells and whistles such as anti wind up, output saturation, ecc...) looks like this:
error = setPoint - actualValue; p = error * kp; i = intState * ki; intState += error; output = p + i;
How to change it?
Thanks Marco / iw2nzm