Question
Is there an error in the ST middleware pid_regulator.c, specifically PI_Controller() ?
The function PI_Controller() implements PI control but there seems to be an error in the final output with the wDischarge term. This term is calculated at the very output as the anticipated amount the output exceeds the output limit's. The intent is to reduce the integrator by this amount but the code does not account for the Ki divisor, pHandle->hKiDivisorPOW2. Without this the value applied to the integrator is too small.