Zero Order Hold — Control Systems/Discrete
Control_Systems/Discrete/Zero_Order_Hold · 1 input / 1 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Zero-Order Hold
Control Systems / Discrete
Samples its input at the block's own rate and holds that value until the next sample:
y(t) = u[k] for k·Ts ≤ t < (k+1)·Ts
As a transfer function it is simply H(z) = 1. The whole block is its sampling time: it has no coefficient to configure and keeps no memory of past samples, so what it contributes is a rate, not arithmetic. Put one in front of a subsystem that must run slower than the model around it, or use it to model the sampler a digital controller sees the continuous world through.
Ports
- Input – the signal u to sample, of any size [p,m].
- Output – the held signal y, the SAME size [p,m] as the input. Every entry is sampled on the same tick; the block does not stagger them.
Parameters
- Sampling Time (s) – the only parameter, and the block's entire behaviour. A positive value is the period the input is sampled at, and the output holds between those instants. Zero or less inherits the solver's rate, at which point the block samples every step and is a straight wire – a zero-order hold only does something when it is slower than what surrounds it, so leaving this at the default makes the block a no-op rather than a bug.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text, all from the shared realization every linear Control Systems / Discrete block uses. There is nothing to tune and nothing to bake in: the emitted body is a copy of the input to the output, and the holding is carried by the rate the generated core schedules the block at, exactly as it is in the in-app run.
Simulink bridge
Import and export, mapped to simulink/Discrete/Zero-Order Hold. There is
one parameter on each side and they are the same one: "Sampling Time (s)" to
SampleTime, through the global mapping every block uses. Nothing is
left behind in either direction, which makes this the most complete crossing in
the library – there is simply nothing else to carry.
Notes
- Discrete only, and stateless: the output is this sample's input, with no past value remembered. That is what separates it from Unit Delay, which holds the PREVIOUS sample and therefore adds a delay; a zero-order hold adds none.
- Being linear (indeed a pure feed-through), the block is directly usable by the model reduction and linear-analysis commands, which will absorb it into a neighbour rather than being blocked by it.
- It does nothing at the surrounding rate. Worth repeating, because a diagram that samples everything at one period gets an exact wire here and that is the correct result. Give the block a slower "Sampling Time (s)" than the model's for it to have any effect at all.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Discrete/Zero_Order_Hold |
| family | Control_Systems/Discrete |
| solver environment class | ICoreBlock_0_Control_Systems_1_Discrete_2_Zero_Order_Hold |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Zero_Order_Hold/ICoreBlock_0_Control_Systems_1_Discrete_2_Zero_Order_Hold.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Zero_Order_Hold/ICoreBlock_0_Control_Systems_1_Discrete_2_Zero_Order_Hold.h |
| default size on canvas | 90 × 70 px |
| ports at insert | 1 in, 1 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | — |
| 2 | out | ICoreDouble | — |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
No config variable beyond the Sampling Time (s) every block carries.
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::Both |
| Simulink path | simulink/Discrete/Zero-Order Hold |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Catalog contract: src/ICoreSDK/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Zero-Order Hold block — y[k] = u[k], sampled and held at the block's own rate The one block in this family whose behaviour is NOT in its matrices. A/B/C/D are a pure feed-through; the hold comes from setDiscreteOnlyBlock (in the base) plus the block's own "Sampling Time (s)", which is scheduling rather than arithmetic. See the header. Everything below the matrices comes from ICoreDiscreteLinearBlockBase.
Sample results#
| t | in ICoreDouble-Out-0 | out ICoreDouble-Out-0 |
|---|---|---|
| 0 | -2 | -2 |
| 0.4 | 0.5 | 0.5 |
| 0.8 | -2 | -2 |
| 1.2 | 0.5 | 0.5 |
| 1.6 | -2 | -2 |
| 2 | 0.5 | 0.5 |
| 2.4 | -2 | -2 |
| 2.8 | 0.5 | 0.5 |
| 3.2 | -2 | -2 |
| 3.6 | 0.5 | 0.5 |
| 4 | -2 | -2 |
| 4.4 | 0.5 | 0.5 |
| 4.8 | -2 | -2 |
| 5.2 | 0.5 | 0.5 |
Every 4th of 60 samples, from the table stimulus.
The same rig also ran:
| Stimulus | What it is | Output range |
|---|---|---|
impulse | Impulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair) | 0 … 1 |
ramp | Ramp: slope 1 from t = 0 | 0 … 5.8 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -1 … 0.9996 |
step | Step: 0 -> 1 at t = 1 s | 0 … 1 |
Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample
Category static · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/Control_Systems__Discrete__Zero_Order_Hold.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).