# Difference between revisions of "Discrete Filter"

(→Model) |
(→Model) |
||

Line 29: | Line 29: | ||

==Model== | ==Model== | ||

+ | |||

+ | The "firstOrderFilter" function is defined generically in terms of filter coefficients A, B, C, and D and values for the previous input and previous output, as shown in the image below. This Function can be referenced by the output table called Discrete_Filter. | ||

Use the approach as follows: | Use the approach as follows: | ||

[[Image:firstOrderFilter_ttm.jpg|center|TTM firstOrderFilter]] | [[Image:firstOrderFilter_ttm.jpg|center|TTM firstOrderFilter]] | ||

+ | |||

+ | <table> | ||

+ | <pre> | ||

+ | [[Image:Discrete_Filter_ttm.jpg|center|TTM Discrete_Filter]] | ||

+ | </pre> | ||

+ | </table> |

## Revision as of 14:10, 20 February 2007

TTM is a modeling tool that is very generic. It is not really meant for any specific application domain so there is no direct support for things like control/filter expressions that are more naturally specified in a tool such as Simulink. However, the concept of FUNCTIONS, now supported in TTM 3.x and higher, makes it possible to represent things like Discrete Filters. This should allow users to create libraries of TTM models (to be included via the model-includes mechanism).

## Function

For a general first order filter specified like this

Discrete filter: A.z + B ------- D.z + C where A, B, C, D are real numbers The output of the function is defined as Oz0 = A/D*In.z0 + B/D*In.z-1 - C/D*Out.z-1 Where In.z0 : current input In.z-1: previous input

To represent this in TTM it is necessary to state the semantics in terms of a function of current cycle input values and a previous cycle computed state variable (or multiple previous cycle state variables, in the case of z-equations of orders greater than 1). This requires the equation to be in a form similar to the expressions used to perform such a filter computation, computing the primary output and also computing a state variable output that you would also reference as an input (from the previous cycle's output computation).

## Model

The "firstOrderFilter" function is defined generically in terms of filter coefficients A, B, C, and D and values for the previous input and previous output, as shown in the image below. This Function can be referenced by the output table called Discrete_Filter.

Use the approach as follows:

[[Image:Discrete_Filter_ttm.jpg|center|TTM Discrete_Filter]]