Unit Delay (z^-n) (zDelay)
Delays its input by a whole number of samples.
Group: Control · Kind: {"block":"zDelay","kind":"control"}
When to use it
Use it for the computation delay of a digital controller, or to break a loop between sampled blocks.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Signal to delay |
out |
signal | Input from n samples ago |
Common parameters
ts: Time between samples (Default: required)n: Delay, counted in whole samples (Default: 1)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 | |
n |
— | 1 | Delay, counted in whole samples |
Parameter descriptions are in English in both languages.
Model
At each instant offset + k·ts the block pushes the present input into a first-in first-out queue of length n and outputs the value that falls out, so y[k] = u[k-n]. The queue starts at zero, so the first n outputs are 0. The block has no direct feedthrough, which is why it can close a loop. The delay in seconds is n·ts.
Common mistakes
- n counts samples, not seconds, and must be a whole number from 1 to 4096. For a delay of part of a sample, use the delay setting of MCU Output Stage.
- The first n outputs are 0 whatever the input is. Give this block the same ts and offset as the controller blocks around it, or the delay is not a whole number of controller samples.
Datasheet and sources
ts is the controller sample time, 1/fs. n is the delay of your firmware in samples: the measured interrupt run time divided by ts, rounded up. Use 1 when the code computes in one sample and applies the result in the next.
Example
Open the example with the command file.openExample and the name demo:zDelay.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.