Generated reference › Variable Transport Delay — Control Systems/Continues
kind: generated#block#control-systems-continues

Variable Transport Delay — Control Systems/Continues

1/d

Control_Systems/Continues/Variable_Transport_Delay · 2 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.

Variable Transport Delay

Control Systems / Continues

Carries the input along a path of fixed length whose contents move at a speed the delay port sets – a conveyor, a pipe, an extruder. The delay actually applied is the one that was in force while the material was travelling, not the one in force when it arrives:

∫ ds / d(s) = 1 over [t − τ(t), t], and y(t) = u(t − τ(t))

Read that as: material leaves once a full path length has been covered. The port value d is the transit time that would apply if the speed held steady, in seconds.

Its sibling, Variable Time Delay, reads the same port as "how stale the signal is right now" and reaches straight back by that much. Hold d constant and the two are identical; move it and they part company, because this block keeps faith with material already in flight and that one does not. Pick this one for anything physically transported, and that one when the delay is simply a staleness you are imposing.

Ports

  • u – the transported signal, of any size [m,n]. This is what comes out delayed.
  • d – the transit time in seconds, a scalar [1,1]. It applies to the whole signal, not per entry. It is clamped into [one sample, Maximum Delay (s)]: a conveyor cannot carry material at infinite speed, so a zero or negative transit time is raised to a single sample.
  • Output – the delayed signal, the SAME size [m,n] as u.

Parameters

  • Maximum Delay (s) – scalar, the longest transit the block can represent, in seconds. Defaults to 10, matching Simulink. It sets the depth of the transit line and bounds the search for the exit sample, so cost is proportional to it – at a 0.01 s rate the default is 1000 stored samples per signal entry. Set it to the longest transit you actually need rather than leaving headroom.
  • Initial Output – scalar, what the block emits while nothing has yet completed the journey. Defaults to 0. The whole line is pre-filled with it, so a run starts from a defined state rather than from samples that were never taken.
  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. It is the resolution the transit is resolved to, the floor the transit time is clamped to, and the unit the maximum delay is counted in, 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. Each carries the transit line and the per-step travel as its state and repeats the same backward search the simulation runs, so all ten agree with it and with each other. Only dt, the line depth and the transit clamp are baked in; the transit time is read from its port every tick.

The three HDL targets are simulation-only, in the same sense and for the same kind of reason as Recursive IIR. Two steps of this block do not belong in a fixed-point datapath: the per-step travel is dt / d, a division by a signal rather than a constant, and the exit sample is found by searching back along the line until a full path length has accumulated, so the work per tick grows with Maximum Delay (s) / dt. Both are ordinary in real arithmetic, so the generated cores carry the conveyor in real and quantize only at the port boundary. They simulate correctly and are deliberately not offered as synthesizable – keep the maximum delay tight regardless, since the search is unrolled to its depth. The sibling Variable Time Delay indexes the line directly instead of searching it, and exports a genuine fixed-point core.

Simulink bridge

Import and export, mapped to simulink/Continuous/Variable Transport Delay. "Maximum Delay (s)" to MaximumDelay, "Initial Output" to InitialOutput. The block always implies VariableDelayType = "Variable transport delay" – that parameter is the only thing distinguishing this Simulink block from Variable Time Delay, which shares its BlockType – and PadeOrder = 0, since the transit is realized as a true line and never as a Padé approximation. A Simulink block carrying either at a different value is reported on import rather than silently accepted.

This block has no SampleTime parameter in Simulink – it is a continuous block there – so "Sampling Time (s)" stays on the ICore side and does not cross.

Simulink's block is continuous: it interpolates both the stored signal and the crossing, and its solver may take steps this block does not. This one resolves the exit to the nearest stored sample. The two agree closely for a transit that is slow next to the sampling rate, and differ by up to half a sample where it is not.

Notes

  • Stateful: Maximum Delay / dt + 1 past values of the signal port, plus the travel each of those steps accrued.
  • Discrete by nature – the line advances one slot per sample, so the block always runs at its own rate rather than being pushed through a continuous solver's stages.
  • The exit is resolved to the nearest stored sample, so sub-sample transit is not interpolated. Shorten the sampling time for finer resolution.
  • The rounding is chosen so that a constant transit time gives exactly round(d / dt) samples – the same answer Variable Time Delay gives, so the two blocks agree wherever the mathematics says they must.
  • Not linear in the state-space sense, and so deliberately carries no state space: a pure delay is the transcendental factor e^(−sτ), which no finite A/B/C/D expresses, and a time-varying one is not even time-invariant.

Code facts#

FactValue
registered typeControl_Systems/Continues/Variable_Transport_Delay
familyControl_Systems/Continues
solver environment classICoreBlock_0_Control_Systems_1_Continues_2_Variable_Transport_Delay
sourcesrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Continues/Variable_Transport_Delay/ICoreBlock_0_Control_Systems_1_Continues_2_Variable_Transport_Delay.cpp
headersrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Continues/Variable_Transport_Delay/ICoreBlock_0_Control_Systems_1_Continues_2_Variable_Transport_Delay.h
default size on canvas120 × 80 px
ports at insert2 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleu
2inICoreDoubled
3outICoreDouble

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 variableDefaultSimulink parameter
Maximum Delay (s)10MaximumDelay
Initial Output0InitialOutput

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.

supportSupport::Both
Simulink pathsimulink/Continuous/Variable Transport Delay
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setVariableDelayType = Variable transport delay, PadeOrder = 0
ICore configSimulink parameterValue translation
Maximum Delay (s)MaximumDelaypasses through
Initial OutputInitialOutputpasses through

Caveat (shown to the user): Simulink's Variable Transport Delay is continuous: it interpolates both the stored signal and the crossing, while this block resolves the exit to the nearest stored sample. The two agree closely for a transit that is slow next to the sampling rate. It shares its BlockType with Variable Time Delay, so VariableDelayType is pinned here to keep the two apart in both directions

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).

Variable Transport Delay block — the CONVEYOR reading of a moving delay The signal-domain counterpart of simulink/Continuous/Variable Transport Delay, which is the VariableTransportDelay block with VariableDelayType = "Variable transport delay".

WHAT MAKES THIS DIFFERENT FROM Variable Time Delay. That block reads its delay port as "how stale the signal is RIGHT NOW" and reaches straight back by that much. This one reads the same port as a TRANSIT TIME along a fixed path -- a pipe of unit length whose contents move at speed 1/d -- so the delay actually applied is the one that was in force WHILE the material was travelling, not the one in force when it arrives. Formally the exit time t and the entry time t - tau are tied by

integral over [t - tau(t), t] of ds / d(s) = 1

i.e. material leaves once a full path length has been travelled. Feed it a constant d and the integral collapses to tau = d and the two blocks agree exactly; move d and they part company, because this one keeps faith with material already in flight and that one does not. That is why they are two blocks rather than one block with a mode.

Implementation — a ring buffer of samples PLUS the travel each step accrued Storing the running integral itself would drift: it grows without bound over a run, and the quantity actually wanted is a DIFFERENCE between two distant points of it. So each slot stores only its own step's contribution,

travel[n] = dt / clamp(d_n, dt, maxDelay) in (0, 1]

and the integral over the last k steps is recovered by summing backwards:

g(k) = travel[n] + travel[n-1] + ... + travel[n-k+1]

g is nondecreasing in k, so the exit sample is found by walking back until g reaches 1:

k1 = the smallest k with g(k) >= 1 (searched, at most capacity steps) frac = (1 - g(k1 - 1)) / travel[n - k1 + 1] the crossing, linearly interpolated k = round(k1 - 1 + frac) nearest STORED sample

ROUNDING, and why it is round-to-nearest rather than the ceiling the raw search gives. Taking k1 straight off the search would mean a constant d of exactly one and a half samples came out as two, while the sibling Variable Time Delay rounds it to one -- the two blocks would then disagree on a CONSTANT delay, which is precisely the case where the mathematics says they must not. Interpolating the crossing and rounding to nearest makes k = round(d/dt)

Sample results#

Variable Transport Delay — Step: 0 -> 1 at t = 1 sVariable Transport Delay — Step: 0 -> 1 at t = 1 s00.51012345t (s)in ICoreDouble-Out-0in ICoreDouble-Out-0out ICoreDouble-Out-0

The same rig also ran:

StimulusWhat it isOutput range
impulseImpulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair)0 … 1
rampRamp: slope 1 from t = 00 … 2.1
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias-1 … 0.9996
tableRepeating 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__Continues__Variable_Transport_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).