The only state in the PID controller is the current value of the integral, and it can be useful to set this value to a nonzero value if you have additional information about a likely steady state error.
In practice, you can simply simply use the PID controller several times and see what value the integral usually takes, and use this as the initial value.
If you have additional information, for example, knowing that the correct output is y for input x, you can invert the formula to find the correct integral as follows:
output = input * Kp + Integral * Ki
=> y = x * Kp + Integral * Ki
=> Integral = ( y - x * Kp) / Ki
source
share