Self Conditioned 3D — Control Systems/Gain Scheduling
Control_Systems/Gain_Scheduling/Self_Conditioned_3D · 5 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.
3D Self-Conditioned
Control Systems / Gain Scheduling
The Aerospace Blockset's 3D Self-Conditioned [A(v),B(v),C(v),D(v)]: the Self-Conditioned Controller with its four matrices scheduled on three variables, v1, v2 and v3. Its states stay consistent with what the actuator is really doing:
dx/dt = H(v)·umeas + (B(v) − H(v)·D(v))·y +
(A(v) − H(v)·C(v))·x
udem = C(v)·x + D(v)·y
While the actuator delivers what was demanded, umeas = udem, the H terms cancel and the block is the scheduled controller [A, B, C, D]; when it saturates or is switched out, H pulls the states toward values consistent with the real input. H is placed at every breakpoint triple – the eigenvalues of Aijl − Hijl·Cijl are the poles you give – and then interpolated like the matrices: each of A, B, C, D and H is the trilinear blend of the eight stored around (v1, v2, v3), exactly as in the 3D Controller, and each variable clamps outside its breakpoints.
Ports
- y – the controller input, an [m,1] column, m being the column count of the B and D matrices.
- v1 – the first scheduling variable, a scalar (the Simulink block labels it AoA).
- v2 – the second scheduling variable, a scalar (labelled AoS there).
- v3 – the third scheduling variable, a scalar (labelled Mach there).
- u_meas – the actuator's measured output, [1,1]: the value the plant actually received.
- u_dem – the demanded actuator command, [1,1].
Parameters
- A Matrices – the n×n A matrix for every breakpoint triple, stacked
vertically with the first variable varying fastest and the third slowest: a
[P1·P2·P3·n, n] matrix, with n from 1 to
8. From a MATLAB array
A(:,:,i,j,l)the config isreshape(permute(A,[1 3 4 5 2]),[],size(A,2)). - B Matrices – the n×m B matrices, stacked the same way.
- C Matrices – the 1×n C rows, stacked: [P1·P2·P3, n]. ⚠ One row each: with a single controller output the gain H that places n poles is unique, so this block and Simulink compute the same H. With several outputs there are infinitely many, and Simulink picks one by a robustness criterion this block does not reproduce.
- D Matrices – the 1×m D rows, stacked: [P1·P2·P3, m].
- Breakpoints v1 – the P1 values of v1, strictly increasing, at least two.
- Breakpoints v2 – the P2 values of v2, strictly increasing, at least two.
- Breakpoints v3 – the P3 values of v3, strictly increasing, at least two.
- Initial State – x at the start of the run: a scalar for every state, or an [n,1] column. Default 0.
- Poles of A-H*C – n real, distinct values, the eigenvalues H
places at every breakpoint triple (the Simulink parameter
vec_w, default [-5 -2]). Repeated poles are refused, exactly as Simulink'splacerefuses them, and so is a breakpoint whose (A, C) pair is not observable. Complex poles cannot be written in a real matrix and are not offered. - Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
The defaults are a second-order example with two breakpoints and Simulink's own default poles on a 2×2×2 grid; the Simulink block has no literal matrix defaults (its dialog names workspace variables).
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The gains H are placed at export time and baked in with the matrices; a chain of comparisons per variable assigns its interval and fraction, a nested chain on the three intervals assigns the blended A, B, C, D and H, and the core forms A − H·C and B − H·D from them each sample, as the Simulink block does – so no generated core places a pole. The state integrates with forward Euler at the block's period. All ten are rendered from the one description of the arithmetic the block's own simulation runs.
The three HDL targets are simulation-only: the fraction divides by a signal
difference, so they compute in real arithmetic and quantize only at the ports.
VHDL keeps the arithmetic in a function of its own.
Simulink bridge
None (Support::None). The counterpart is aerolibschedule/3D
Self-Conditioned [A(v),B(v),C(v),D(v)] in the Aerospace Blockset, and this block
reproduces it exactly – but its four matrix parameters are five-dimensional
arrays, one slice per breakpoint triple, and neither MATLAB's matrix literal syntax nor an ICore
matrix config has that form. So the schedule cannot cross in either direction; the block is
reported rather than exported without its matrices. It therefore has no parity testbench;
code export verification covers it.
Notes
- Stateful: n states. Direct feedthrough when some D row is nonzero, and also when the C rows differ across the grid (udem = C(v)·x then moves with v at the same instant). umeas reaches only the state, but this block declares feedthrough for the whole block, so a loop from udem back to umeas through a static actuator model (a Saturation alone) is reported as an algebraic loop when either holds; an actuator with dynamics, or a Memory in that path, opens it.
- Between breakpoints the eigenvalues of A(v) − H(v)·C(v) are near the given poles, not on them: H is interpolated, not re-placed, exactly as the Simulink block does.
- Each breakpoint search is inclusive at the bottom of each interval: a variable exactly on an interior breakpoint starts the next interval, with fraction 0.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Gain_Scheduling/Self_Conditioned_3D |
| family | Control_Systems/Gain_Scheduling |
| solver environment class | ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_3D |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Self_Conditioned_3D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_3D.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Self_Conditioned_3D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_3D.h |
| default size on canvas | 160 × 120 px |
| ports at insert | 5 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 | y |
| 2 | in | ICoreDouble | v1 |
| 3 | in | ICoreDouble | v2 |
| 4 | in | ICoreDouble | v3 |
| 5 | in | ICoreDouble | u_meas |
| 6 | out | ICoreDouble | u_dem |
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 |
|---|---|---|
A Matrices | [-1 0.5; 0 -2; -1.5 0.5; 0 -3; -1.2 0.5; 0 -2.4; -1.8 0.5… | — |
B Matrices | [0; 1; 0; 1; 0; 1; 0; 1; 0; 1; 0; 1; 0; 1; 0; 1] | — |
C Matrices | [1 0; 1 0; 1 0; 1 0; 1 0; 1 0; 1 0; 1 0] | — |
D Matrices | [0; 0; 0; 0; 0; 0; 0; 0] | — |
Breakpoints v1 | [0 1] | — |
Breakpoints v2 | [0 1] | — |
Breakpoints v3 | [0 1] | — |
Initial State | 0 | — |
Poles of A-H*C | [-5 -2] | — |
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::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): aerolibschedule/3D Self-Conditioned [A(v),B(v),C(v),D(v)] computes exactly what this block does -- measured to 0 under ode1 -- but its four matrix parameters are FIVE-DIMENSIONAL arrays, one slice per breakpoint triple, and neither MATLAB's matrix literal syntax nor an ICore matrix config has that form. So the schedule cannot cross in either direction, and an exported model would carry the ports and no controller. Reported rather than exported to a counterpart that would be missing its matrices
Catalog contract: src/ICoreBlocks/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).
3D Self-Conditioned [A(v),B(v),C(v),D(v)] -- self-conditioned on THREE variables dx/dt = (H(v)*u_meas + (B(v) - H(v)*D(v))*y) + (A(v) - H(v)*C(v))*x u_dem = C(v)*x + D(v)*y M(v1,v2,v3) = the trilinear blend of the eight around it, for A, B, C, D AND H H_ijl = place(A_ijl', C_ijl', poles)' at every breakpoint TRIPLE, once
The 1D Self-Conditioned with three scheduling variables: the same arithmetic, the same H and the same refusals, the trilinear blend of the 3D Controller. The same reading of the self-conditioning and the same H: Ackermann's formula on the observer dual, the unique gain for a single-row C and so the gain place() returns, and the same refusals -- repeated poles, an unobservable (A, C) pair, more than one output row, more than eight states. What scheduling adds, read off the R2026a mask:
- The mask places H ONCE PER BREAKPOINT TRIPLE (its initialization loops place() over the
third, fourth and fifth dimensions), and the running block then BLENDS H like the four matrices. So between breakpoints A - H*C is formed from the interpolated A, H and C -- H*C and H*D are Product blocks at run time -- and its eigenvalues are NOT the given poles there, only near them.
- The state sum is H*u_meas + (B - H*D)*y + (A - H*C)*x, added in that order (one Sum with
three "+" inputs), and the output C*x + D*y.
MEASURED: with n = 3 states, y of width 2, a 2 x 3 x 2 grid, poles [-4.5 -1.7 -2.9] and all three variables sweeping past both ends of their breakpoints, the real block under ode1 and a forward-Euler reference of exactly the program the base runs -- with H from place() -- agree to EXACTLY 0 over 800 samples. This block's H comes from Ackermann instead, which agrees with place() to rounding (1.6e-15 on the unscheduled block's own measured case).
NO SIMULINK BRIDGE, for the 1D Controller's reason: the four matrix parameters are FIVE-dimensional arrays (M(:,:,i,j,l) per breakpoint triple). The configs stack the matrices vertically, the first variable fastest, and the description gives the MATLAB line.
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.005949 … 0.1206 |
ramp | Ramp: slope 1 from t = 0 | 0 … 2.053 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -0.7751 … 0.3751 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | -0.7072 … 0.4954 |
Plotted: step — Step: 0 -> 1 at t = 1 s
Category dynamic · sample time 0.1 · 60 steps · commit 4287636be · produced by docsSample --out <folder> --blocks Controller_Blend_2D Observer_Form_2D Observer_Form_3D Self_Conditioned_2D Self_Conditioned_3D --steps 60 · data docs/generated/samples/Control_Systems__Gain_Scheduling__Self_Conditioned_3D.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).