Unit delay
Delays any signal by one sample period: the output is the input as it was one sample ago. Every state updates at the sample instant, so exported C reproduces it exactly.
- signal
- Gradara equations
- 2 ports
- 1 parameter
unitDelayLibraryDiscreteDescription
Delays any signal by one sample: at each sample instant the output takes the value the input had at the previous instant. Every state updates at the sample instant, so exported C reproduces it exactly.
Example
Sampling A sine held, delayed by one sample, and a step summed at a fixed sample rate.
Sine 1 HzHold 0.1 sUnit delay 0.1 sStepDiscrete integrator
Also in this example:Discrete integratorStepSine waveZero-order hold
Ports
Inputs 1
-
u
Input signal, read at each sample instant.
Outputs 1
-
y
Output signal, held between samples.
Parameters
-
Sample period
Ts0.001 s≥ 0.0001
Sample period, in seconds. At least 0.0001 s (default 1 ms).
Equations
Modelica
At t = k · Ts, k = 0, 1, 2, …: y[k] = u[k − 1], with u[−1] = 0
Implementation
The block’s Modelica model
discrete Real stored(start=0, fixed=true); when sample(0, Ts) then y = pre(stored); stored = u; end when;
Assumptions and limitations
- Samples are taken at fixed multiples of Ts from time 0; there is no offset or external trigger.
- The initial output is always 0.
Tips
- Unlike the Modelica library unit delay, which only delays signals that are already sampled, this block delays a continuous input too.
See also
Select a block in Gradara and press F1 to open its page offline.