Hello,

I ran into an issue trying to use my Stabilizer with dual-iir application in PID mode to do side of fringe locking of a cavity. I would like to lock such that my photodiode output voltage is 1.5 V when cavity piezos have 5 V DC at the input. So this seems to require me to have an input offset of -1.5 V and output offset of 5 V. The issue is I do not seem to understand how the offsets work in Stabilizer, specifically when Ki is nonzero.

I connect a DC voltage generator to the input of channel 0 of my stabilizer via a BNC T, the other end of the T going to my oscilloscope (Picoscope 5444). I first use the following command to see that the stabilizer is alive and responsive to changes in the error signal:

python -m stabilizer.iir_coefficients --verbose --broker 10.34.16.99 --prefix dt/sinara/dual-iir/04-91-62-d2-84-57 --channel 0 --sample-period 1e-05 --x-offset 0.0 --y-min -10 --y-max 10 --y-offset 0.0 pid --Kp 1.0 --Ki 0.0

In this case, the output (blue) follows the input (red) exactly, which is expected. Then I check that the input offset works as expected by setting it to 2 V. Now what I expect to see is 0 output when I set the input to 2 V. This is true with Kp = 1 and Ki = 0, suggesting that the error signal fed to the PID is indeed 0. However, when I now set Ki = 0.01, the output increases linearly in time (screen below).

The code I use to obtain the screenshot above:

python -m stabilizer.iir_coefficients --verbose --broker 10.34.16.99 --prefix dt/sinara/dual-iir/04-91-62-d2-84-57 --channel 0 --sample-period 1e-05 --x-offset -2.0 --y-min -10 --y-max 10 --y-offset 0.000 pid --Kp 1.0 --Ki 0.1

My question here is what exactly is fed into the integrator, if the error signal is supposed to be 0?

Now I want to check what the y-offset does:

python -m stabilizer.iir_coefficients --verbose --broker 10.34.16.99 --prefix dt/sinara/dual-iir/04-91-62-d2-84-57 --channel 0 --sample-period 1e-05 --x-offset -2.0 --y-min -10 --y-max 10 --y-offset 1.000 pid --Kp 1.0 --Ki 0.0

In this case, Stabilizer outputs 1 V, which is expected. However, when I now set Ki=0.001, the output rails to +10 V.

I use the following code here:

python -m stabilizer.iir_coefficients --verbose --broker 10.34.16.99 --prefix dt/sinara/dual-iir/04-91-62-d2-84-57 --channel 0 --sample-period 1e-05 --x-offset -2.0 --y-min -10 --y-max 10 --y-offset 1.000 pid --Kp 1.0 --Ki 0.001

With smaller values of Ki-s railing still occurs equally fast.

I guess what I do not ultimately understand is the internal diagram of the PID, i.e. at which points the offsets are added, and I completely do not understand why the output rails like this with a nonzero y-offset and Ki. Any help would be appreciated, thanks.

rjo Thank you for the link, informative indeed, but it does not seem to explain my questions, or maybe I am just not looking where I should be. Specifically, I do not see why introducing an offset at the output and having nonzero integral gain would rail my output immediately.

Same for the first question - I suppose what we set with the x-offset parameter is u, then if my (x-u)=0, like in the case I described, then there should be nothing to integrate, but the output still changes. It stops integrating only when my input is x=0, and not when (x-u)=0.

4 months later

Did you ever figure out this issue? I am having a similar problem.

    sp_du Hi, unfortunately no, I just ended up not using stabiliser for now. I showed this issue to a control engineer, and he was equally confused.

    Please just refer to the white paper linked above. There is exactly one meaningful offset in an iir filter: The one after the feedforward and before the feedback terms.
    An "input offset" is implemented by propagating it through the feedforward terms. An "output offset" before feedback is congruent to that summing junction offset. An "output offset" after integral feedback is congruent to an offset of the output state, i.e. perform the technique described in the white paper of setting the state with one set of coefficients and then changing coefficients to the final settings.

    And feel free to send the white paper to anyone still confused.