Thursday, November 2, 2017

infinite impulse response - 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.



Answer



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.


Transposed direct form 2 flow diagram
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}$$



No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...