Lowpass FilterSnapshot of the front panel of the simulator:
AimsThe aims of this simulator are:
MotivationLowpass filters are frequently needed in practical application based in some processing of measurements. This is because all practical measurements are noisy. Typically the noise is approximately a random signal. The filter is used to attenuate the noise. One very important application is in a control system. The process measurement (temperature, level, pressure, speed etc.) always contains some noise. If the noise is not attenuated it will propagate through the controller and cause abrupt (noisy) variations in the control signal, causing excessive wear of the actuator (pump, valve, motor). The filter algorithm given above is relatively simple, but still it is probably the most commonly used filter algorithm in practical application. Description of the system that is simulatedInput signals to the filterA discrete-time first order filter is simulated. The input signal to the filter consists of three additive terms:
Each of these signals can be deactivated (removed). The (total) input and the output signals are plotted in real time in a chart. Also, the amplitude gain plot (Bode plot) of the filter is plotted. The filter functionThe filter is a discretized version of a continuous-time time-constant filter given by the following s-transfer function: H(s) = Y(s)/U(s) = 1/(T_{f}s+1) The user can select the following filter parameters:
The filter algorithm that is implemented in the simulator is given by the following difference equation: y(t_{k}) = (1-a)*y(t_{k-1}) + a*u(t_{k}) (Eq. 1) where t_{k} is the discrete point of time at time index k. Hence, t_{k-1} means the previous discrete point of time. y is the filter output, and u is the filter input. In general the filter parameter a can be set directly. In this simulator Eq. 1 is developed by discretizing a continuous-time filter. The derivation is shown in detail in filter_algorithm.pdf. There it is shown that a = h/(T_{f} + h) (Eq. 2) For the filter given by Eq. 1 to be stable, a must be between 0 and 1. Frequency responseThe amplitude gain of the frequency response of a filter expresses how a sinusoid is attenuated through the filter. In the simulator the amplitude gain of the filter is plotted. The amplitude gain is calculated from the z-transfer function of Eq. 1. This transfer function found by taking the z-transform of Eq. 1, and it is H_{f}(z) = Y(z)/U(z) = az/[z-(1-a)] (Eq. 3) The amplitude gain is calculated as the absolute value of H_{f}(z) when z = e^{jwh} where w is the frequency [rad/s] and h [s] is the sampling interval. j is the imaginary unit. In the simulator the Bode.vi function in LabVIEW is used to calculate and plot the amplitude gain in a Bode diagram. The relation beween the time-constant T_{f} and the filter bandwidth f_{b} [Hz] for H_{f}(z) is rather complicated. However, if the sampling time h is relatively small (less than 1/5 of T_{f}) the following relation holds (approximately): f_{b} [Hz] ~ 1/(2*pi*T_{f}) (Eq. 4) How random noise is propagated through the filterIt is useful to know how the filter attenuates random noise. The attenuation can be expressed as the ratio between the standard deviation of the filter output and the standard deviation of the filter input, hence "standard deviation gain", K_{sigma} (sigma is the greek character symbol for standard deviation). In random_noise_attenuation.pdf it is shown that K_{sigma} = sqrt(a/(2-a)) (Eq. 5) where a is given by Eq. 2. Tasks
Updated 21. March 2008. Developed by Finn Haugen. E-mail: finn@techteach.no. |