Laboratory work signal filtering algorithms in the process control system - paper. Algorithms for digital filtering of signals by the averaging method and the study of the effectiveness of their work Algorithms for filtering signals

Physically feasible digital filters that operate in real time can use the following data to form an output signal at a discrete time point: a) the value of the input signal at the moment of sampling, as well as a certain number of “past” input samples, a certain number of previous samples of the output signal Integer numbers type determine the order of the digital filter. The classification of the digital filter is carried out in different ways depending on how information about the past states of the system is used.

Transversal CFs.

So it is customary to call filters that work in accordance with the algorithm

where is a sequence of coefficients.

The number is the order of the transversal digital filter. As can be seen from formula (15.58), the transversal filter performs a weighted summation of previous samples of the input signal and does not use past samples of the output signal. Applying the z-transform to both parts of the expression (15.58), we see that

Hence it follows that system function

is a fractional-rational function of z that has an -fold pole at and zeros whose coordinates are determined by the filter coefficients.

The operation algorithm of the transversal digital filter is illustrated by a block diagram shown in fig. 15.7.

Rice. 15.7. Scheme for constructing a transversal digital filter

The main elements of the filter are blocks for delaying the reference values ​​by one sampling interval (rectangles with symbols ), as well as scale blocks that perform digital multiplication operations by the corresponding coefficients. From the outputs of the scale blocks, the signals enter the adder, where, when added together, they form the output signal count.

The type of scheme presented here explains the meaning of the term "transverse filter" (from the English transverse - transverse).

Software implementation of transversal digital filter.

It should be borne in mind that the block diagram shown in Fig. 15.7 is not circuit diagram electrical circuit, but only serves graphic image signal processing algorithm. Using the FORTRAN language tools, let's consider a fragment of a program that implements transversal digital filtering.

Let in random access memory The computer formed two one-dimensional arrays of length M cells each: an array named X, which stores the values ​​of the input signal, and an array named A, containing the values ​​of the filter coefficients.

The content of the cells of the X array changes every time a new sample of the input signal is received.

Let us assume that this array is filled with previous samples of the input sequence, and consider the situation that occurs at the moment of arrival of the next sample, which is given the name S in the program. This sample should be placed in cell number 1, but only after the previous record is shifted by one position to the right, i.e. in the direction of delay.

The elements of array X thus formed are multiplied term by term by the elements of array A, and the result is entered into a cell named Y, where the reference value of the output signal is accumulated. Below is the text of the transversal digital filtering program:

impulse response. Let's return to formula (15.59) and calculate the impulse response of the transversal digital filter by performing the inverse z-transform. It is easy to see that each term of the function gives a contribution equal to the corresponding coefficient shifted by positions towards the delay. So here

This conclusion can also be reached directly by considering the block diagram of the filter (see Fig. 15.7) and assuming that a "single pulse" is applied to its input.

It is important to note that impulse response transversal filter contains a finite number of terms.

frequency response.

If in formula (15.59) we change the variable, then we get the frequency transfer coefficient

With a given sampling step A, it is possible to implement a wide variety of frequency response forms by properly selecting the weighting coefficients of the filter.

Example 15.4. Investigate the frequency characteristics of a transversal digital filter of the 2nd order, which averages the current value of the input signal and two previous samples according to the formula

The system function of this filter

Rice. 15.8. Frequency characteristics of the transversal digital filter from example 15.4: a - frequency response; b - PFC

where we find the frequency transfer coefficient

Elementary transformations lead to the following expressions for the frequency response in the phase response of this system:

The corresponding graphs are shown in fig. 15.8, a, b, where the value is plotted along the horizontal axes - the phase angle of the sampling interval at the current frequency value.

Suppose, for example, that , i.e., there are six samples per period of the harmonic input oscillation. In this case, the input sequence will look like

(the absolute values ​​of the samples do not matter, since the filter is linear). Using algorithm (15.62), we find the output sequence:

It can be seen that it corresponds to a harmonic output signal of the same frequency as at the input, with an amplitude equal to the amplitude of the input oscillation and with the initial phase shifted by 60° towards the delay.

Recursive CFs.

This kind digital filters is characterized by the fact that the previous values ​​of not only the input but also the output signal are used to form the output reading:

(15.63)

moreover, the coefficients defining the recursive part of the filtering algorithm are not equal to zero at the same time. To emphasize the difference between the structures of the two types of digital filters, transversal filters are also called non-recursive filters.

System function of recursive digital filter.

Having performed the z-transform of both parts of the recurrence relation (15.63), we find that the system function

describing the frequency properties of the recursive digital filter, has poles on the z-plane. If the coefficients of the recursive part of the algorithm are real, then these poles either lie on the real axis or form complex conjugate pairs.

Block diagram of a recursive digital filter.

On fig. 15.9 shows a diagram of the algorithm for calculations carried out in accordance with formula (15.63). Top part block diagram corresponds to the transversal (non-recursive) part of the filtering algorithm. Its implementation requires general case scale blocks (multiplication operations) and memory cells that store input samples.

The recursive part of the algorithm corresponds to the lower part of the block diagram. It uses successive values ​​of the output signal, which, during the operation of the filter, move from cell to cell by shifting.

Rice. 15.9. Block diagram of a recursive digital filter

Rice. 15.10. Structural scheme of the canonical recursive digital filter of the 2nd order

The disadvantage of this implementation principle is the need for a large number of memory cells, separately for the recursive and non-recursive parts. The canonical schemes of recursive digital filters are more perfect, in which the minimum possible number of memory cells is used, equal to the largest of the numbers . As an example, in fig. 15.10 shows the block diagram of the 2nd order canonical recursive filter, which corresponds to the system function

In order to make sure that this system implements the given function, consider an auxiliary discrete signal at the output of adder 1 and write down two obvious equations:

(15.67)

After performing the -transformation of equation (15.66), we find that

On the other hand, according to expression (15.67)

Combining relations (15.68) and (15.69), we arrive at the given system function (15.65).

Stability of recursive digital filters.

A recursive digital filter is a discrete analog of a dynamic feedback system, since the values ​​of its previous states are stored in the memory cells. If some initial conditions are given, i.e., a set of values, then in the absence of an input signal, the filter will form elements of an infinite sequence playing the role of free oscillations.

A digital filter is called stable if the free process that occurs in it is a non-increasing sequence, i.e., the values ​​for do not exceed some positive number M, regardless of the choice of initial conditions.

Free oscillations in the recursive digital filter based on the algorithm (15.63) are the solution of the linear difference equation

By analogy with the principle of solving linear differential equations we will look for a solution (15.70) in the form of an exponential function

with an unknown value. Substituting (15.71) into (15.70) and reducing by a common factor, we make sure that a is the root of the characteristic equation

Based on (15.64), this equation exactly coincides with the equation that is satisfied by the poles of the system function of the recursive digital filter.

Let the system of roots of equation (15.72) be found. Then the general solution of the difference equation (15.70) will have the form

The coefficients must be chosen so that the initial conditions are satisfied.

If all the poles of the system function, i.e., the modulo numbers do not exceed one, are located inside the unit circle with the center at the point, then, based on (15.73), any free process in the digital filter will be described by terms of decreasing geometric progressions and the filter will be stable. It is clear that only robust digital filters can be applied in practice.

Example 15.5. Investigate the stability of a 2nd order recursive digital filter with a system function

Characteristic equation

has roots

The curve described by the equation on the coefficient plane is the boundary, above which the poles of the system function are real, and below which they are complex conjugate.

For the case of complex conjugate poles, therefore, one of the boundaries of the stability region is line 1.

Rice. 15.11. The region of stability of the recursive filter of the 2nd order (the poles of the filter are complex conjugate in the region marked in color)

Considering the real poles at , we have the stability condition in the form

This type of digital filters is characterized by the fact that for the formation i th output count the previous values ​​of not only the input, but also the output signals are used (filtering algorithm):

where the coefficients (b ( ,b 2 ,...,b n _ The ts that define the recursive part of the filtering algorithm are not equal to zero at the same time.

Let's write down system function recursive CF. After completing z- transformation of both parts of the recursive relation (7.28), we find that the system function describing the frequency properties of the recursive digital filter has the form

It follows from this expression that the system function of the recursive digital filter has on the z-plane (m-1) zeros and (P- 1) poles. If the coefficients of the recursive part of the algorithm are real, then the poles either lie on the real axis or form complex conjugate pairs.

Calculate impulse response recursive CF. A characteristic feature that distinguishes a recursive digital filter from a non-recursive one is that, due to the presence feedback its impulse response has the form of an infinitely extended sequence. Therefore, often recursive filters are called IIR filters (filters with infinite impulse response). Let's show this on the example of the simplest filter of the 1st order, described by the system function

As is known, the impulse response can be found using the inverse ^-transform of the system function. Using the formula for the inverse ^-transform, we find the m-th term in the sequence ... according to laboratory analyses; 5) ... requirements for APCS. Technological processes ... processing and analysis of information ( signals, messages, documents, etc. ... algorithms filtration and algorithms eliminating noise from purpose ...

  • Intelligent Automation in Course and Diploma Projects

    abstract

    The wire. target. product... signal HART, which allows it to be integrated into systems APCS ... filtration There are different types of dust sensors. DT400G works ... algorithm... of the chemical industry. Technical means and laboratory work/ G.I. Lapshenkov, L.M. ...

  • The work program of the discipline "automation of technological processes"

    Working programm

    ... GOALS AND TASKS OF MASTERING THE DISCIPLINE aim... main components APCS- controllers...views signals in... bug fixes, filtration messages, ... algorithms and programs, discussions, performance of control works. Laboratory lessons. Laboratory ...

  • A computer