Observer Form 2D — Control Systems/Gain Scheduling
Control_Systems/Gain_Scheduling/Observer_Form_2D · 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.
2D Observer Form
Control Systems / Gain Scheduling
The Aerospace Blockset's 2D Observer Form [A(v),B(v),C(v),F(v),H(v)]: a controller built as an observer of the plant with state feedback on the estimate, all five matrices scheduled on two variables, v1 and v2.
dx/dt = A(v)·x + (H(v)·(e + C(v)·x) + B(v)·umeas), udem = F(v)·x
The observer is driven by the actuator command that was really applied, umeas, so when the actuator saturates, or the controller is switched out of the loop, the estimate keeps tracking the plant instead of winding up. Each matrix is the bilinear blend of the four stored around (v1, v2), exactly as in the 2D Controller, and each variable clamps outside its breakpoints.
Ports
- e – the output error y − ydem (the Simulink block's
y-y_dem), a [q,1] column, q being the row count of one C matrix. - v1 – the first scheduling variable, a scalar (the Simulink block labels it AoA).
- v2 – the second scheduling variable, a scalar (labelled Mach there).
- u_meas – the measured actuator command, an [r,1] column, r being the column count of one B matrix.
- u_dem – the demanded actuator command, a [p,1] column, p being the row count of one F matrix.
Parameters
- A Matrices – the n×n A matrix for every breakpoint pair, stacked
vertically with the first variable varying fastest: a
[P1·P2·n, n] matrix. From a MATLAB array
A(:,:,i,j)the config isreshape(permute(A,[1 3 4 2]),[],size(A,2)). - B Matrices – the n×r B matrices (umeas to the state), stacked the same way.
- C Matrices – the q×n C matrices (the state to the predicted output), stacked the same way.
- F Matrices – the p×n state-feedback gains, stacked the same way.
- H Matrices – the n×q observer gains, stacked the same way. They are used as given: nothing is placed.
- Breakpoints v1 – the P1 values of v1, strictly increasing, at least two.
- Breakpoints v2 – the P2 values of v2, 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 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 two intervals assigns the five blended matrices; 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 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/2D
Observer Form [A(v),B(v),C(v),F(v),H(v)] in the Aerospace Blockset, and this block
reproduces it exactly – but its five matrix parameters are four-dimensional
arrays, one slice per breakpoint pair, 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 only when the F matrices differ across the grid (udem = F(v)·x then moves with v at the same instant); e and umeas reach only the state, never the output.
- 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#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Gain_Scheduling/Observer_Form_2D |
| family | Control_Systems/Gain_Scheduling |
| solver environment class | ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Observer_Form_2D |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Observer_Form_2D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Observer_Form_2D.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Observer_Form_2D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Observer_Form_2D.h |
| default size on canvas | 160 × 110 px |
| ports at insert | 4 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 | e |
| 2 | in | ICoreDouble | v1 |
| 3 | in | ICoreDouble | v2 |
| 4 | in | ICoreDouble | u_meas |
| 5 | 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; -2; -1.5; -2.5] | — |
B Matrices | [1; 1; 1; 1] | — |
C Matrices | [1; 1; 1; 1] | — |
F Matrices | [1; 0.5; 0.8; 0.4] | — |
H Matrices | [-2; -3; -2.5; -3.5] | — |
Breakpoints v1 | [0 1] | — |
Breakpoints v2 | [0 1] | — |
Initial State | 0 | — |
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/2D Observer Form [A(v),B(v),C(v),F(v),H(v)] computes exactly what this block does -- measured to 0 under ode1 -- but its five matrix parameters are FOUR-DIMENSIONAL arrays, one slice per breakpoint pair, 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).
2D Observer Form [A(v),B(v),C(v),F(v),H(v)] -- an observer-based controller on TWO variables z = e + C(v)*x (e = y - y_dem, the tracking error) dx/dt = A(v)*x + (H(v)*z + B(v)*u_meas) u_dem = F(v)*x M(v1,v2) = the bilinear blend of the four matrices around (v1, v2), v1 innermost
An observer of the plant (A, B, C) driven by the measured actuator command u_meas and the output error through the gain H, with state feedback F on the estimate. Because the observer is fed what the actuator REALLY did, a saturated or switched-out actuator never winds the estimate up -- the property the Aerospace Blockset names this form for.
MEASURED AGAINST R2026a. The masked subsystem is one Prelookup per variable (both "Index and fraction", extrapolation CLIP, "use last breakpoint" off) feeding five copies of the Interpolate Matrix(x,y) arithmetic, a Sum e + C*x, a Sum B*u_meas + H*z, a Sum of that with A*x into one Integrator, and F*x out through a Cast.
⚠ THE MIDDLE SUM IS WRITTEN THE OTHER WAY ROUND HERE than in the 1D Observer Form (which adds H*z + B*u_meas). It is a TWO-term sum, so the two orders are bit-identical and the shared program's grouping -- A*x + (H*z + B*u_meas) -- is the block's arithmetic exactly. With n = 3 states, e of width 2, a 3 x 2 grid and both 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 800 samples.
H IS A PARAMETER here, not placed: unlike the Self-Conditioned forms, the mask computes nothing, so any H the user gives is used as given and no toolbox is involved.
NO SIMULINK BRIDGE, for the 1D Controller's reason: the five matrix parameters are FOUR-dimensional arrays (M(:,:,i,j) per breakpoint pair). The configs stack the matrices vertically, the first variable fastest, and the description gives the MATLAB line that produces them.
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.1878 … 0 |
ramp | Ramp: slope 1 from t = 0 | -0.9556 … 0 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -0.2009 … 0.2769 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | -0.8491 … 0.2144 |
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__Observer_Form_2D.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).