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

Self Conditioned 1D — Control Systems/Gain Scheduling

ABCD

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

1D Self-Conditioned

Control Systems / Gain Scheduling

The Aerospace Blockset's 1D Self-Conditioned [A(v),B(v),C(v),D(v)]: the Self-Conditioned Controller with its four matrices scheduled on one variable v. 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 – the eigenvalues of Ak − Hk·Ck are the poles you give – and then interpolated like the matrices: each of A, B, C, D and H is (1 − f)·Mk + f·Mk+1 on the breakpoint interval v falls in, exactly as in the 1D Controller, and clamps outside the breakpoints.

Ports

  • y – the controller input, an [m,1] column, m being the column count of the B and D matrices.
  • v – the scheduling variable, a scalar.
  • 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, stacked vertically in breakpoint order: a [P·n, n] matrix, with n from 1 to 8. From a MATLAB array A(:,:,k) the config is reshape(permute(A,[1 3 2]),[],size(A,2)).
  • B Matrices – the n×m B matrices, stacked the same way.
  • C Matrices – the 1×n C rows, stacked: [P, 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: [P, m].
  • Breakpoints – the P scheduling-variable values the matrices belong to, 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 (the Simulink parameter vec_w, default [-5 -2]). Repeated poles are refused, exactly as Simulink's place refuses 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; 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 on v assigns the interval and the fraction, a chain on the interval 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/1D 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 three-dimensional arrays, one slice per breakpoint, 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 between breakpoints (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.
  • The breakpoint search is inclusive at the bottom of each interval: v exactly on an interior breakpoint starts the next interval, with fraction 0.

Code facts#

FactValue
registered typeControl_Systems/Gain_Scheduling/Self_Conditioned_1D
familyControl_Systems/Gain_Scheduling
solver environment classICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_1D
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Self_Conditioned_1D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_1D.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Gain_Scheduling/Self_Conditioned_1D/ICoreBlock_0_Control_Systems_1_Gain_Scheduling_2_Self_Conditioned_1D.h
default size on canvas160 × 100 px
ports at insert3 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubley
2inICoreDoublev
3inICoreDoubleu_meas
4outICoreDoubleu_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 variableDefaultSimulink parameter
A Matrices[-1 0.5; 0 -2; -1.5 0.5; 0 -3]—
B Matrices[0; 1; 0; 1]—
C Matrices[1 0; 1 0]—
D Matrices[0; 0]—
Breakpoints[0 1]—
Initial State0—
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.

supportSupport::None
Simulink path—
port-count rulePortsParam::None
SampleTime parameteryes

Caveat (shown to the user): aerolibschedule/1D 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 THREE-DIMENSIONAL arrays, one slice per breakpoint, and neither MATLAB's matrix literal syntax nor an ICore matrix config has a three-dimensional 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).

1D Self-Conditioned [A(v),B(v),C(v),D(v)] -- a scheduled self-conditioned controller 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(v) = (1 - f)*M[k] + f*M[k+1] for A, B, C, D AND H H_k = place(A_k', C_k', poles)' at every breakpoint, once

The unscheduled Self-Conditioned Controller (../Self_Conditioned_Controller) with every matrix scheduled. 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 (its initialization loops place() over the third

dimension), and the running block then INTERPOLATES 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, three breakpoints, poles [-4.5 -1.7 -2.9] and v sweeping past both ends of the 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 700 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 three-dimensional arrays (M(:,:,k) per breakpoint). The configs stack the matrices vertically, and the description gives the MATLAB line that produces them.

Sample results#

Self Conditioned 1D — Step: 0 -> 1 at t = 1 sSelf Conditioned 1D — 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.003415 … 0.2006
rampRamp: slope 1 from t = 00 … 3.37
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias-0.7719 … 0.5537
tableRepeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample-0.7072 … 0.8902

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