Generated reference › Discrete Varying Transfer Function — Control Systems/Linear Parameter Varying
kind: generated#block#control-systems-linear-parameter-varying

Discrete Varying Transfer Function — Control Systems/Linear Parameter Varying

b(k) a(k) varying

Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Transfer_Function · 4 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.

Discrete Varying Transfer Function

Control Systems / Linear Parameter Varying

A first-order discrete transfer function whose coefficients arrive as signals, so the filter may be re-scheduled on every sample. It is realized in transposed direct form II – a single state s, rather than separate input and output histories:

y[k] = b0[k]·u[k] + s[k−1]
s[k] = b1[k]·u[k] − a1[k]·y[k]

equivalently y/u = (b0 + b1z−1) / (1 + a1z−1). The denominator is monic by contract: a1 is the tail, the leading 1 is implied, and the a term is subtracted.

Ports

  • u – the signal to filter, of any size [p,q]. The filter is SISO and applied independently to every entry, each carrying its own state s, but all entries share the one coefficient triple.
  • b0 – the direct-feedthrough numerator coefficient for this sample.
  • a1 – the denominator tail for this sample. Note the port order is (u, b0, a1, b1), matching Simulink exactly: the coefficients interleave as a1, b1, a2, b2… after b0, which is not the grouping the names suggest.
  • b1 – the one-sample-delayed numerator coefficient.
  • Outputy, the same size as u.

Parameters

  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. Everything else about this block arrives on ports, so there is nothing else to tune.

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The coefficients are emitted as reads of the b0/a1/b1 signals rather than as constants, so a generated core re-schedules with them exactly as the simulation does. The three HDL targets carry the recursion in Q16.16 fixed point; coefficients arriving on a port are quantized to that grid.

Simulink bridge

Import and export, mapped to cstblocks/Linear Parameter Varying/Discrete Varying Transfer Function (the library is cstblocks, not the "Control System Toolbox" display name, which add_block does not accept). The coefficients need no parameter mapping at all – on both sides they are signals – and the port order is identical.

The order is fixed at one, and this is the block's real limitation. Simulink's N and Feedthrough move ports (2N+2 inputs with feedthrough, 2N+1 without), while an ICore block's port list is structural, so both are always written out fixed: N = 1 and Feedthrough = on. That keeps the bridge exact and lossless for the shape it does support instead of approximately right for all of them. Two of these in series realize a second-order section.

"Sampling Time (s)" DOES cross, but under Simulink's own name for it here: this block's rate parameter is Ts, not SampleTime. Emitting the standard name would be a hard set_param error that aborts the whole generated script.

Notes

  • Discrete only, and stateful: a single state s per entry of the signal, starting at zero.
  • The realization is part of the specification here, not an implementation detail. Direct form I, direct form II and this transposed form all realize the same transfer function and agree exactly while the coefficients hold still – they become three different systems the moment the coefficients move. This block matches Simulink's to 4·10−16 with all three coefficients varying, where direct form I would be out by ~0.8.
  • Stability is the user's responsibility, in a way it is not on a fixed-coefficient filter. |a1| ≥ 1 for even a few samples can start a divergence the block never recovers from, and nothing here can prevent it: the coefficients are signals, and their trajectory is not known until the run.
  • Use Discrete Transfer Function instead whenever the coefficients are constant – it bakes them into the generated code, which is both faster and exact.

Code facts#

FactValue
registered typeControl_Systems/Linear_Parameter_Varying/Discrete_Varying_Transfer_Function
familyControl_Systems/Linear_Parameter_Varying
solver environment classICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Transfer_Function
sourcesrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Transfer_Function/ICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Transfer_Function.cpp
headersrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Transfer_Function/ICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Transfer_Function.h
default size on canvas140 × 110 px
ports at insert4 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleu
2inICoreDoubleb0
3inICoreDoublea1
4inICoreDoubleb1
5outICoreDouble

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.

supportSupport::Both
Simulink pathcstblocks/Linear Parameter Varying/Discrete Varying Transfer Function
port-count rulePortsParam::None
SampleTime parameteryes
rate parameter nameTs
always setN = 1, Feedthrough = on

Caveat (shown to the user): the coefficients are signals on both sides, so nothing about them is a parameter to carry, and the port order (u, b0, a1, b1) is identical; the ORDER is fixed at 1 with feedthrough, because Simulink's N and Feedthrough move ports and an ICore port list is structural -- chain two blocks for a second-order section

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

Discrete Varying Transfer Function — a first-order IIR whose coefficients are SIGNALS, in TRANSPOSED DIRECT FORM II y[k] = b0[k]*u[k] + s[k-1] s[k] = b1[k]*u[k] - a1[k]*y[k]

Port order (u, b0, a1, b1), the sign convention AND THE REALIZATION were all measured against the R2026a block, not assumed -- see the header, and note that the realization is the one property a constant-coefficient check cannot see. Simulation and all ten exports carry the same single state s per entry of the signal.

Sample results#

Discrete Varying Transfer Function — Step: 0 -> 1 at t = 1 sDiscrete Varying Transfer Function — Step: 0 -> 1 at t = 1 s00.51012345t (s)in ICoreDouble-Out-0in 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 = 0-2.962e15 … 5.197e14
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias0 … 10.85
tableRepeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample-2.75 … 14.25

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