Tapped Delay — Control Systems/Discrete
Control_Systems/Discrete/Tapped_Delay · 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.
Tapped Delay
Control Systems / Discrete
Remembers the last N samples of its input and emits all of them at once as a single column signal – a delay line with every tap brought out:
y[k] = [ u[k−N] … u[k−1] ]
That column is the regressor an FIR filter, a correlator or a least-squares identification scheme wants, so one block replaces a ladder of Unit Delays and a Mux. Samples from before the run starts read the configured Initial Condition.
Ports
- Input – the signal u to tap. It must be a scalar [1,1]: the taps are stacked into the output column, so a non-scalar input would need a second dimension the signal type has no room for.
- Output – the tap column, [T,1], where T is Number of Delays, plus one when Include Current Input is on. The size therefore follows the parameters rather than the input.
Parameters
- Number of Delays – N, how many past samples are kept, at least 1. Defaults to 4. It sets the output height.
- Initial Condition – a scalar, the value every tap reads before that sample has been taken. Defaults to 0, and seeds the whole line.
- Delay Order – which end of the line comes first:
- Oldest (default) – row 1 is the OLDEST sample u[k−N] and the last row is u[k−1].
- Newest – row 1 is the most recent sample u[k−1] and the last row is u[k−N].
- Include Current Input – whether the undelayed sample u[k] joins
the column, which makes the output one row taller:
- off (default) – only delayed samples; the block has no direct feedthrough.
- on – u[k] is appended at the END under Oldest and prepended at the FRONT under Newest, so it always sits at the "newest" end of whichever order is in force. The block then has direct feedthrough.
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. It is the spacing between taps, so it is part of the arithmetic and not merely a schedule.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The tap ORDER is resolved at export time into a straight-line assignment per output row – there is no ordering branch left in the generated core – and the line itself is a shift register of N elements seeded with the initial condition. On the three HDL targets the shift is a register-to-register move, which is what a tapped delay is in hardware anyway.
Simulink bridge
Import and export, mapped to simulink/Discrete/Tapped Delay. "Number of
Delays" to NumDelays, "Initial Condition" to vinit,
"Delay Order" to DelayOrder and "Include Current Input" to
includeCurrent; all four values are 1:1, so the mapping is lossless
in both directions.
The rate crosses as samptime, not SampleTime.
Simulink's Tapped Delay is a masked S-Function and names its rate parameter
differently from the rest of the library; emitting the usual name would be a hard
set_param error that aborts the whole generated script, so the entry
names the parameter it actually has.
Notes
- Stateful: a shift register of N past samples.
- Discrete by nature – the line advances one slot per sample.
- Direct feedthrough only with the current input included. With it off, every output row is a past sample, so the block breaks an algebraic loop exactly as Unit Delay does; with it on, row 1 (or the last row) is the live input and it does not.
- Deliberately carries no state space. A pure delay is the transcendental factor e^(−sTs), which no finite continuous A/B/C/D expresses; the block runs its discrete shift directly instead.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Discrete/Tapped_Delay |
| family | Control_Systems/Discrete |
| solver environment class | ICoreBlock_0_Control_Systems_1_Discrete_2_Tapped_Delay |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Tapped_Delay/ICoreBlock_0_Control_Systems_1_Discrete_2_Tapped_Delay.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Tapped_Delay/ICoreBlock_0_Control_Systems_1_Discrete_2_Tapped_Delay.h |
| default size on canvas | 110 × 80 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#
| Config variable | Default | Simulink parameter |
|---|---|---|
Number of Delays | 4 | NumDelays |
Initial Condition | 0 | vinit |
Delay Order | Oldest%~%Newest~~Oldest | DelayOrder |
Include Current Input | off%~%on~~off | includeCurrent |
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/Tapped Delay |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
| rate parameter name | samptime |
| ICore config | Simulink parameter | Value translation |
|---|---|---|
Number of Delays | NumDelays | passes through |
Initial Condition | vinit | passes through |
Delay Order | DelayOrder | Oldest → Oldest, Newest → Newest |
Include Current Input | includeCurrent | off → off, on → on |
Caveat (shown to the user): the rate crosses as 'samptime' - Simulink's Tapped Delay is a masked S-Function and does not use the standard 'SampleTime' parameter name
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).
Tapped Delay block — a delay LINE, with every tap brought out at once Holds the last N samples of a scalar input and emits all of them as one [T,1] column, so a single block supplies the whole regressor an FIR filter, a correlator or an identification scheme needs. Two configs decide the ORDER and whether the current sample joins them, and between them they set the output size:
hist[j] = u[k-1-j] (j = 0 .. N-1, seeded with the initial condition) Oldest : y = [u[k-N] ... u[k-1]] (+ u[k] appended LAST when the current input is included) Newest : y = [u[k-1] ... u[k-N]] (+ u[k] prepended FIRST, likewise) T = N (+1 when the current input is included)
Every ordering above was verified numerically against Simulink R2026a rather than assumed -- "Oldest" puts the OLDEST sample in row 1 and appends the current input at the END, which is the opposite of what the name suggests to most readers on first meeting.
The mapping is computed once by tapPlan() and shared by the simulation and all ten generators, so an ordering fix can never land in one and not the others.
Discrete by nature: the line advances one slot per SAMPLE.
Sample results#
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.4 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -0.9962 … 0.9996 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | -2 … 3 |
Plotted: step — Step: 0 -> 1 at t = 1 s
Category dynamic · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/Control_Systems__Discrete__Tapped_Delay.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).