Generated reference › Controller 3D — Control Systems/Gain Scheduling
kind: generated#block#control-systems-gain-scheduling

Controller 3D — Control Systems/Gain Scheduling

ABCD

Control_Systems/Gain_Scheduling/Controller_3D · 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.

3D Controller

Control Systems / Gain Scheduling

The Aerospace Blockset's 3D Controller [A(v),B(v),C(v),D(v)]: a state-space controller whose four matrices are scheduled on three variables, v1, v2 and v3. A matrix is stored for every triple of breakpoints, and between them the block blends the eight around (v1, v2, v3) trilinearly.

dx/dt = A(v)·x + B(v)·y,   u = D(v)·y + C(v)·x

M(v) = (1 − f3)·M12(k3) + f3·M12(k3+1), where M12(k) is the bilinear blend in (v1, v2) on slice k of v3 – the 2D Controller's – and each variable's interval k and fraction f come from its own breakpoints exactly as in the 1D Controller. Outside its breakpoints each variable clamps: below the first it uses the first, at or above the last it uses the last.

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 – the controller output, a [p,1] column, p being the row count of one C matrix.

Parameters

  • A Matrices – the n×n A matrix for every breakpoint triple, stacked vertically with the first variable varying fastest and the third slowest: (1,1,1), (2,1,1), …, (1,2,1), …, (1,1,2), … – a [P1·P2·P3·n, n] matrix. From a MATLAB array A(:,:,i,j,l) the config is reshape(permute(A,[1 3 4 5 2]),[],size(A,2)).
  • B Matrices – the n×m B matrices, stacked the same way.
  • C Matrices – the p×n C matrices, stacked the same way.
  • D Matrices – the p×m D matrices, stacked the same way. All zero makes the controller strictly proper.
  • 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.
  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.

The defaults are a first-order example on a 2×2×2 grid; the Simulink block has no literal defaults (its dialog names workspace variables).

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. Each variable's interval and fraction come from a chain of comparisons on it, and a nested chain on the three intervals assigns the blended matrices, so the core grows with (P1−1)·(P2−1)·(P3−1) times the matrix entries. The state integrates with forward Euler at the block's period, because the matrices move with v and there is no fixed system to discretize exactly. 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 fractions divide 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 Controller [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 matrix is nonzero, and also when the C matrices differ across the grid: u = C(v)·x then moves with v at the same instant.
  • 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.
  • Linear at any instant but scheduled, so it carries no state space and model reduction reports it as unmergeable.

Code facts#

FactValue
registered typeControl_Systems/Gain_Scheduling/Controller_3D
familyControl_Systems/Gain_Scheduling
solver environment classICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Controller_3D
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Controller_3D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Controller_3D.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Controller_3D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Controller_3D.h
default size on canvas150 × 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
1inICoreDoubley
2inICoreDoublev1
3inICoreDoublev2
4inICoreDoublev3
5outICoreDoubleu

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
A Matrices[-1; -2; -3; -4; -5; -6; -7; -8]—
B Matrices[1; 1; 1; 1; 1; 1; 1; 1]—
C Matrices[1; 1; 1; 1; 1; 1; 1; 1]—
D Matrices[0; 0; 0; 0; 0; 0; 0; 0]—
Breakpoints v1[0 1]—
Breakpoints v2[0 1]—
Breakpoints v3[0 1]—
Initial State0—

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::None
Simulink path—
port-count rulePortsParam::None
SampleTime parameteryes

Caveat (shown to the user): aerolibschedule/3D Controller [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 Controller [A(v),B(v),C(v),D(v)] -- a state-space controller scheduled on three variables dx/dt = A(v1,v2,v3)*x + B(v1,v2,v3)*y u = D(v1,v2,v3)*y + C(v1,v2,v3)*x M(v1,v2,v3) = (1 - f3)*M2(k3) + f3*M2(k3+1), M2 the two-variable bilinear blend

MEASURED AGAINST R2026a. The masked subsystem is one Prelookup per variable (all "Index and fraction", extrapolation CLIP, "use last breakpoint" off) feeding four copies of the Interpolate Matrix(x,y,z) arithmetic -- two bilinear blends, one per bracketing slice of the third variable, blended along it; the first variable (the AoA port) is the array's third dimension and the innermost level, AoS the fourth, Mach the fifth and the outermost -- an Integrator on B*y + A*x, a Cast on the state, and an output Sum D*y + C*x. With n = 3 states, a 2 x 3 x 3 grid 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 agree to EXACTLY 0 over 700 samples.

The whole program is ICoreScheduledControllerBlockBase's (../ICoreScheduledControllerSupport.h), shared with the one- and two-variable Controllers: the number of scheduling variables is a loop bound there, not a copy. This file is the ports, the configs, the description and the catalog.

NO SIMULINK BRIDGE, for the 1D Controller's reason, two dimensions worse: 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 that produces them.

Sample results#

Controller 3D — Step: 0 -> 1 at t = 1 sController 3D — 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 … 0.06853
rampRamp: slope 1 from t = 00 … 0.7219
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias-0.5259 … 0.1238
tableRepeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample-0.2895 … 0.2809

Plotted: step — Step: 0 -> 1 at t = 1 s

Category dynamic · sample time 0.1 · 60 steps · commit 93133d604 · produced by docsSample --out <folder> --blocks Gain_Scheduled_Lead_Lag Controller_1D Controller_Blend_1D Controller_2D Controller_3D Observer_Form_1D Self_Conditioned_1D Line_Of_Sight_Access Orbit_Propagator_Kepler Attitude_Dynamics Attitude_Profile_Nadir_Pointing Attitude_Profile_Geographic_Pointing Multitaper_PSD Cross_Power_Spectral_Density Transfer_Function_Estimate Envelope_Spectrum Compose_String Scan_String --steps 60 · data docs/generated/samples/Control_Systems__Gain_Scheduling__Controller_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).