I'm having a hard time figuring out the Integral portion of the PID Controller.
The below pic is my simulation. The Setpoint is pTarget and the Input is CyclePM5s
The model starts out well, but the iTerm continues to increase (although v little), and as the Input increases to ~100, the error of course becomes larger and thus the iTerm also increases (Green highlight) and the New Target becomes lower to get the Input to reduce (which it seems to be doing successfully).
Now comes to the blue highlight, When the input is successfully brought back down such that the error becomes close to 0, the iTerm doesn't see the same reduction, but continues to increase. (Is this due to some over compensation somewhere?)

Suppose we have a linear coil spring, and we wish to control the position of the end using force on the endpoint as input. You can test this by hand by taking a coil spring from your pen or something similar.
Next we define that the desired setpoint is some distance away from the resting position. Now pull it such that you reach this distance. By pulling the endpoint, you exert force on the spring. Now to hold the spring in this position, I still need to exert force on the spring, otherwise it will bounce back to the resting position. In PID terms, if I have reached the setpoint (eg the error is zero), what values will the individual components have? $$k_p = 0, ~~~~ \text{error}=0$$ $$k_d = 0, ~~~~ \text{error is not changing}$$ $$k_I = ??$$ So we know the proportional and the derivative terms must be zero, but we also know that to assure we stay on the setpoint, a non-zero force is required. This non-zero force is the integral component.