en:software:qview:qview_6:qcl_library:vc21lpfilter

This translation is older than the original page and might be outdated. See what has changed.

VC21LPFilter

V = Variables

C = Claculation functions

The VC21LPFilter function implements a low-pass digital filter of the first order for values in the range from -999999 to +999999. It ' also provided the pre-charge filter option.

VC20LPFilter (Mode, Tsample, Tau, FilterIn, FilterOut)

Parameters:

IN/OUTVARIABLE TYPEEXAMPLE NAMEDIM
INCONST / GLOBALModeFMode of operation (0=pre-charge, 1=filter execution).
INCONST / SYSTEMTsampleWSample time filter (msec) [0÷32767].
INCONST / SYSTEMTauWThe filter time constant (ms)
[0÷32767]
INGLOBALFilterInLValue of the variable that you want to filter
[-999999÷999999]
OUTGLOBALFilterOutLValue of the filtered variable
[-999999÷999999]

The VC21LPFilter function implements a digital low-pass filter of the first order whose time constant (Tau) is defined in the parameters passed to the function. Assuming you start from a zero input variable value, the output of the filter takes a value equal to 63% of the input after the long Tau. Similarly the cutoff frequency of the filter is . If the Mode topic is zero allows you to preload the filter to a value that can be set with the topic FilterIn.

Example

;---------------------------------------------
; Project           : REG_012
; Module Name       : ReadTemp
; Author            : 
; Description       : Read temperature & filter
;---------------------------------------------
MAIN:
	CALL ReadTemp
	swTsample = 100		;100 ms time sampling filter
        swTau = 5000		;5 sec filter time constant
        gfMode = 1		;normal execution
	VC21LPFilter (gfMode,swTsample, swTau, gwFilterIn, gwFilterOut)
 
        WAIT 1
    	JUMP MAIN

Note

  • The function contains an internal timer to actually execute the filter each sample time(Tsample). The function should be executed at a frequency higher than the sample time (Tsample). Typically each cycle task.
  • Last modified: 2019/08/29 17:01