Is initializing a digital filter's output with no “momentum” a non-trivial task?

I'm working on implementing a filter with a very slow step response. This filter is implemented as a cascaded second-order-section filter (transposed direct form 2). I'm using the output of this filter as the input to a controller. Thus I'm trying to slow down how quickly the controller set point is able to change.

I'm running into an issue where I would like to initialize the set point of this controller. In order to do this, I need to provide initial conditions to the filter.

Let's assume I have a 7th order filter implemented in SOS stages as described above. Is it is a trivial task to find initial conditions such that I can specify the output but also have it such that the there is no "momentum" in the filter for it to drive from its initial output?

If this were an analog filter, I am essentially trying to specify that y(0) = constant, while y'(0), y"(0), ... etc. all equal zero.

I've never attempted to do something similar with a digital filter. Is this trivial? Is this non-trivial? Are there any references on the subject?

Thanks for the help!

Edit: So I've changed up my system design such my filter output isn't the setpoint, but rather a deviation from a setpoint. This allows me to simply zero the filter to achieve what I was originally trying to do. However, my question still stands for a matter of interest.

• Based on your description, it sounds like you would like the system, in the absence of a nonzero input signal, the system's state would stay at its initial condition $y[0]$? Or are you just saying that at $n=0$, you would like as many derivatives as possible of the filter's impulse response to be zero? – Jason R Oct 12 '17 at 20:42
• So let's just assume our input is a non-zero constant: x[t] = C for all of t > 0. I would like to initialize my filter's output y[t], such that y[0] = C and the remainder y[t] = C where t > 0. I assume if I were to choose random initial conditions to n = -2, -3, -4, these would propagate through the system even though I was able to achieve Y[0] = C. – Izzo Oct 12 '17 at 20:53
• Then it sounds like you want your system to have unity gain at DC, that is, for a constant input, you want constant output of the same level. In that case, I think you would set all of your initial conditions equal to C. That says that the last few input samples and output samples were exactly equal to C, which sounds like what you want to simulate. – Jason R Oct 12 '17 at 21:13
• @JasonR Ha, turns out it was trivial. You are correct, that would do exactly what I wanted. I just for some reason couldn't picture that unless everything was zeros. – Izzo Oct 12 '17 at 21:37
• i can't really decode exactly what the system is. do you have a difference signal (the difference between the feedback value and a "set point") going into a second-order IIR and then that going into another controller (what is it?) and then that going into the "plant"? – robert bristow-johnson Oct 13 '17 at 5:24

If you want a stable linear time-invariant system to output constant $y$, it must have received input $x$ that is the ratio of the constant output and the zero frequency response of the system $H(1):$

$$y = H(1)x\quad \Leftrightarrow \quad x = \frac{y}{H(1)}$$

Or, you'd want to change the state of the system so that it reflects that situation. The system must satisfy the condition $H(1) \ne 0.$

For a composite filter that consists of a serially connected cascade of second-order sections, you can start with the first section with input $x$ and calculate sequentially using $y = H(1)x$ (recycling the variable names to mean the inputs and outputs of a single section) the constant intermediate output of each section. Or you could start from the other end and use $x = y/H(1).$ Knowing both the input $x$ and output $y$, use the signal flow diagram of each section to calculate its state variables, starting with the summation point with dependency only to known constants. Because all oscillation has settled due to constant input and stability of the filter, all signals are constants rather than functions of time, and the delays in the flow diagram have become identities.

Figure 1. Transposed direct form II biquad signal flow diagram. (CC BY-SA 3.0 by Fcorthay)

Given constant input $x$, the constant output $y$ of a biquad section decipted in Fig. 1 is:

$$y = H(1)x = \frac{b_0+b_11^{-1}+b_21^{-2}}{1+a_11^{-1}+a_21^{-2}}x = \frac{b_0 + b_1 + b_2}{1 + a_1 + a_2}x$$

As for the state variables, the top sum $m_0,$ the middle sum $m_1,$ and the bottom sum $m_2$ are calculated as (start calculation from the bottom):

\begin{align} m_0 &= b_0x + m_1\\ m_1 &= b_1x - a_1y + m_2\\ m_2 &= b_2x - a_2y\\ \end{align}

The top sum $m_0$ should equal $y$, which we can verify:

\begin{align}m_0 &= b_0x + b_1x - a_1y + m_2\\ &= b_0x + b_1x - a_1y + b_2x - a_2y\\ &= b_0x + b_1x - a_1\frac{b_0 + b_1 + b_2}{1 + a_1 + a_2}x + b_2x - a_2\frac{b_0 + b_1 + b_2}{1 + a_1 + a_2}x\\ &= \frac{b_0 + b_1 + b_2}{1 + a_1 + a_2}x\\ &= y \end{align}