Sample Delay (delay)
Delays its input by one sample period.
Group: Control · Kind: {"block":"delay","kind":"control"}
When to use it
Use it for the computation delay of a digital controller or to break a loop. Use Sample and Hold for no extra delay.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Signal to delay |
out |
signal | Input from one period earlier |
Common parameters
period: Sample period (Default: required)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
period |
s | required | Sample period |
Parameter descriptions are in English in both languages.
Model
At every multiple of period the block outputs the value it stored at the previous instant and stores its present input: out(k) = in(k-1). The output is 0 during the first period. The solver lands a step on each sample instant. The block has no direct feedthrough, so it breaks loops with no delay.
Common mistakes
- The delay is a whole period, not any time you like. The period is in seconds, so write 100u for 10 kHz.
- The output is 0 for the first period, which can start a loop with a wrong command. Allow for it at start-up, and keep the maximum step well below the period.
Problems rules: param.out_of_range
Datasheet and sources
No datasheet applies. The value of period is the controller sample period (the inverse of the interrupt rate), and one delay of that length models the usual one-sample computation delay.
Example
Open the example with the command file.openExample and the name demo:delay.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.