Lookup Table 1D — Control Systems/Lookup Tables
Control_Systems/Lookup_Tables/Lookup_Table_1D · 1 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.
1-D Lookup Table
Control Systems / Lookup Tables
Maps the input through a table of (breakpoint, value) pairs: y = table(u). Between two breakpoints the value comes from the chosen interpolation rule; outside the axis it comes from the chosen extrapolation rule. Applied entry by entry, so a matrix signal is looked up element for element.
This is Prelookup and Interpolation Using Prelookup done in one block, which is the right shape whenever one table owns its axis – and the wrong one when several tables share it, where doing the search once is the point.
Ports
- Input – the value u to look up, of any size [m,n].
- Output – the table's value y, of the SAME size [m,n]. The block never reshapes a signal.
Parameters
- Breakpoints – the axis, as a row or column vector; both spell the same list. At least two strictly increasing values: a repeated breakpoint is a zero-width interval whose slope is a division by zero, and a decreasing one describes no axis at all.
- Table Data – what the table is at each breakpoint, as a vector of the same length.
- Interpolation Method – what the table says between two breakpoints.
- Linear point-slope – a straight line between the two neighbours.
- Flat – the value at the breakpoint at or below the input, making the output a staircase that steps at each breakpoint.
- Nearest – the value at the nearer breakpoint. An input exactly halfway between two takes the higher one.
- Extrapolation Method – what the table says outside its own range.
- Linear – continue along the slope of the end interval.
- Clip – hold the end value.
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The table and the two rules are baked into the arithmetic at export time rather than exposed as tunable parameters, and they have to be: the number of breakpoints decides how many branches the generated code has, so the table and the structure of the code cannot be separated. Each branch is emitted as its own comparison, which is the one shape all ten targets agree on.
The three HDL targets are not simulation-only. No divider is emitted: each interval's slope is folded into one constant at export time, so a branch is one multiply and one add. The HDL caveat is range rather than accuracy – a signal is carried in Q16.16 there, so a breakpoint or table value outside ±32767 cannot be represented.
Simulink bridge
Import and export, mapped to simulink/Lookup Tables/1-D Lookup Table.
"Breakpoints" to BreakpointsForDimension1, "Table Data" to
Table, "Interpolation Method" to InterpMethod and
"Extrapolation Method" to ExtrapMethod – all four values are
Simulink's own strings, so those mappings are 1:1 and lossless both ways. The block
always writes NumberOfTableDimensions = 1, which is what having
one input port means. "Sampling Time (s)" goes to SampleTime, as on
every block.
Simulink offers three further interpolation methods on this block – Linear Lagrange, Cubic spline and Akima spline – which have no counterpart here. A model importing one of those is reported rather than silently mapped onto a straight line.
Notes
- Algebraic, with no state.
- Elementwise: the output carries the input's size, and each entry is looked up on its own.
- Not linear, and so deliberately carries no state space – model reduction reports it as unmergeable rather than absorbing the table. That holds even for a table whose points happen to lie on a line, because what the block does outside its range is still not that line unless the extrapolation says so.
- See 2-D Lookup Table and n-D Lookup Table for more axes, and Lookup Table Dynamic for a table that arrives on ports instead of from config.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Lookup_Tables/Lookup_Table_1D |
| family | Control_Systems/Lookup_Tables |
| solver environment class | ICoreBlock_0_Control_Systems_1_Lookup_Tables_2_Lookup_Table_1D |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Lookup_Tables/Lookup_Table_1D/ICoreBlock_0_Control_Systems_1_Lookup_Tables_2_Lookup_Table_1D.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Lookup_Tables/Lookup_Table_1D/ICoreBlock_0_Control_Systems_1_Lookup_Tables_2_Lookup_Table_1D.h |
| default size on canvas | 80 × 70 px |
| ports at insert | 1 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 | — |
| 2 | out | ICoreDouble | — |
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 |
|---|---|---|
Breakpoints | [-5 -4 -3 -2 -1 0 1 2 3 4 5] | BreakpointsForDimension1 |
Table Data | -0.99990920426259511 -0.99932929973906703 -0.99505475368… | Table |
Interpolation Method | LUT::interpComboSpec() | InterpMethod |
Extrapolation Method | LUT::extrapComboSpec() | ExtrapMethod |
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::Both |
| Simulink path | simulink/Lookup Tables/1-D Lookup Table |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
| always set | NumberOfTableDimensions = 1 |
| ICore config | Simulink parameter | Value translation |
|---|---|---|
Breakpoints | BreakpointsForDimension1 | passes through |
Table Data | Table | passes through |
Interpolation Method | InterpMethod | Flat → Flat, Nearest → Nearest, Linear point-slope → Linear point-slope |
Extrapolation Method | ExtrapMethod | Clip → Clip, Linear → Linear |
Caveat (shown to the user): Simulink's three further interpolation methods on this block - Linear Lagrange, Cubic spline and Akima spline - have no counterpart here, so a model importing one of them is reported rather than silently mapped onto a straight line. Note also that Flat and Nearest ignore the extrapolation method on BOTH sides: neither ever forms a slope to continue along
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).
1-D Lookup Table block — y = table(u) A (breakpoint, value) table with a choice of three rules for what happens BETWEEN the points and two for what happens OUTSIDE them. Algebraic and stateless, elementwise over the input's size. No state space (see header).
THE TABLE IS EMITTED AS A CHAIN OF COMPARISONS, one per breakpoint, which is the one shape all ten targets spell the same way. So the breakpoint COUNT decides how many branches the generated code has, and the table cannot be a tunable parameter: it is part of the code's structure, not a value the code reads.
NO DIVIDER IS EMITTED. Each interval's slope is (v[i+1]-v[i])/(bp[i+1]-bp[i]) with both ends known at export time, so the slope is folded into a single constant and every branch is one multiply and one add. That is what keeps the three HDL targets synthesizable rather than simulation-only.
Sample results#
| t | in ICoreDouble-Out-0 | out ICoreDouble-Out-0 |
|---|---|---|
| 0 | -2 | -0.964 |
| 0.4 | 0.5 | 0.3808 |
| 0.8 | -2 | -0.964 |
| 1.2 | 0.5 | 0.3808 |
| 1.6 | -2 | -0.964 |
| 2 | 0.5 | 0.3808 |
| 2.4 | -2 | -0.964 |
| 2.8 | 0.5 | 0.3808 |
| 3.2 | -2 | -0.964 |
| 3.6 | 0.5 | 0.3808 |
| 4 | -2 | -0.964 |
| 4.4 | 0.5 | 0.3808 |
| 4.8 | -2 | -0.964 |
| 5.2 | 0.5 | 0.3808 |
Every 4th of 60 samples, from the table stimulus.
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 … 0.7616 |
ramp | Ramp: slope 1 from t = 0 | 0 … 1 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -0.7616 … 0.7613 |
step | Step: 0 -> 1 at t = 1 s | 0 … 0.7616 |
Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample
Category static · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/Control_Systems__Lookup_Tables__Lookup_Table_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).