Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Discrete Transfer Function (ztf)

Filters or controls a sampled signal with two coefficient lists.

ztf

Component reference · 繁體中文

Group: Control · Kind: {"block":"ztf","kind":"control"}

When to use it

Use it for a digital compensator or filter when you already have its difference equation. Use Transfer Function for a continuous design.

Pins

Pin Domain Meaning
in signal Signal input, sampled every ts
out signal Output, held between sample times

Common parameters

  • ts: Time between samples (Default: required)
  • num: Numerator coefficients, no delay first (Default: required)
  • den: Denominator coefficients, no delay first (Default: required)
  • offset: Time of the first sample (Default: 0)

Parameters

Key Unit Default Typical range Description
ts s required Time between samples
offset s 0 Time of the first sample
num — required Numerator coefficients, no delay first
den — required Denominator coefficients, no delay first
lo — -1e30 Lowest value the output can reach; the limited output is what the filter remembers
hi — 1e30 Highest value the output can reach; the limited output is what the filter remembers
y0 — 0 Output at the start while the input is zero (needs a pole at z = 1)

Parameter descriptions are in English in both languages.

Model

H(z) = (b0 + b1·z^-1 + ...) / (1 + a1·z^-1 + ...), so y[k] = b0·u[k] + b1·u[k-1] + ... - a1·y[k-1] - .... num is b0, b1, ... and den is 1, a1, ...; both lists are divided by the first den coefficient, which must not be 0. At most 64 coefficients are allowed. The block has direct feedthrough only when b0 is not 0, so 0, 0.1 is a delay of one sample and can close a loop.

Common mistakes

  • The order is the opposite of Transfer Function: start with the constant term and go up in powers of z^-1, not down in powers of s. A first-order lag with a = exp(-ts/tau) is num 0, 1-a and den 1, -a.
  • A pole outside the unit circle makes the output grow until the run stops. Design the coefficients for the same ts the block uses, or the response is wrong.

Problems rules: solver.control

Datasheet and sources

ts is the controller sample time, 1/fs. The coefficients come from converting your continuous design to that ts with a design tool or by hand, or straight from the difference equation in the firmware.

Example

Open the example with the command file.openExample and the name demo:ztf.


Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.