Settling Time — Control Systems/Pulse Metrics
Control_Systems/Pulse_Metrics/Settling_Time · 1 input / 3 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.
Settling Time
Control Systems / Pulse Metrics
Reports how long after a transition the waveform last strayed outside a
tolerance band around the state level it was heading for – MATLAB's
settlingtime:
s = t(last sample with |u − landing level| > (high − low) · tol / 100) − t(mid crossing)
The search runs over a settling region that opens when the transition completes and closes Seek Duration seconds after the transition instant. The instant itself is interpolated between the last straying sample and the one after it, so the answer is not quantised to the sampling period.
Ports
- u – the bilevel waveform to measure. Scalar – see Notes.
- s – settling time of the most recent closed region, in seconds from the transition instant, held until the next region closes. Scalar.
- lev – the level the waveform was at when it settled, in the signal's own units. Scalar. It is one tolerance band away from the landing state level, on whichever side the waveform approached from.
- ok – 1 when the most recent closed region produced a
measurement and 0 where MATLAB reports
NaN. Scalar – see Notes for the three cases that produce a 0.
Parameters
- Low State Level – the value the waveform sits at in its low state. 0 by default.
- High State Level – the value it sits at in its high state. 1 by default. Every threshold below is a percentage of the distance between these two, so they must differ.
- State Level Tolerance (%) – how far into the amplitude a sample
must be before it counts as having settled into a state. 2 by
default, the value IEEE Std 181-2003 uses. ⚠ It is also the settling band:
settlingtimemeasures the stray against the same tolerance it uses for the state boundaries, so raising it loosens both at once. - Mid Percent Reference Level – the level whose crossing dates a transition, as a percentage of the amplitude. 50 by default. The settling time is measured from that instant, not from the sample the transition completed on.
- Seek Duration (s) – how long the settling region lasts, measured
in seconds from the transition instant. 0.1 by default. It is
MATLAB's
Dargument, which that function requires rather than defaults. A region that ends before the waveform stops straying reports no measurement rather than a short one. - 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.
Every threshold is structural and is inlined into the comparisons at export time rather than exposed as a tunable parameter. The Seek Duration is converted to a whole number of sample periods once, at export time, and the emitted core carries that count rather than the seconds – so re-export after changing the duration or the sampling period.
⚠ The three HDL targets are simulation-only. They carry this
block's arithmetic in real rather than Q16.16, quantising only at
the port boundary, for a reason specific to what it measures: an instant is a
sample index plus a fraction, and a 16-bit integer part runs out after 32767
samples – five and a half minutes at a 10 ms rate. The comparisons and the
interpolation are exact in real, which is what makes the exported
core agree with the simulation.
Simulink bridge
No equivalent (Support::None). Measured rather than
assumed: a find_system sweep over 22 DSP System Toolbox and
Simulink libraries on R2026a finds no block matching duty, pulse,
rise, fall, slew, overshoot, settling or
state level – the whole Pulse Metrics group is MATLAB functions with
no Simulink counterpart. The bridge reports this block rather than dropping it
silently, and it therefore has no parity testbench. Code export
verification still covers it across all ten languages.
Notes
- Stateful, and discrete by nature
(
setDiscreteOnlyBlock(true)): the tracker advances once per sample. - The last STRAY sample is what is searched for, not the first settled one. A ring that re-crosses the band has many samples inside it and only one last sample outside it, and IEEE Std 181-2003 Sec 5.3.7 names the latter. The two agree on an edge that approaches its level once and differ on every ring.
- Three cases report ok = 0, and they are MATLAB's three
NaNs. The waveform is still outside the band when the region expires; a later transition begins before it expires; or the region is shorter than the transition itself, so it expires before the transition even completed. - s and lev hold when ok is 0, keeping their last real measurement, and both start at 0 before the first one exists.
- A measurement appears one sample after the region that produced it closes, in the live run and in all ten exported languages alike. A hardware block cannot read back a value it computes in the same clocked interval, so publishing immediately would put the three HDL targets one sample behind the other seven; the delay is uniform instead, and deliberate.
- The state levels are PARAMETERS here, not estimated from the data.
MATLAB's pulse-metric functions call
statelevelsto guess the two levels from a histogram of the WHOLE signal when you do not supply them; that is a batch operation over samples a streaming block has not seen yet. This block takes the levels the way those same functions do when you pass'StateLevels'explicitly. - Scalar only. One waveform and its own tracker; wire one block per channel.
- No state space. The block is not linear in its input – it is a sequence of comparisons – so it carries none and model reduction correctly declines to merge it.
- Sibling readouts of the same tracker: Rise Time and Fall Time measure the transition itself, Overshoot and Undershoot measure how far past the level the waveform went, and this block measures when it stopped going past it.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Pulse_Metrics/Settling_Time |
| family | Control_Systems/Pulse_Metrics |
| solver environment class | ICoreBlock_0_Control_Systems_1_Pulse_Metrics_2_Settling_Time |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Pulse_Metrics/Settling_Time/ICoreBlock_0_Control_Systems_1_Pulse_Metrics_2_Settling_Time.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Pulse_Metrics/Settling_Time/ICoreBlock_0_Control_Systems_1_Pulse_Metrics_2_Settling_Time.h |
| default size on canvas | 140 × 96 px |
| ports at insert | 1 in, 3 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 | u |
| 2 | out | ICoreDouble | s |
| 3 | out | ICoreDouble | lev |
| 4 | out | ICoreDouble | ok |
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 |
|---|---|---|
Low State Level | 0 | — |
High State Level | 1 | — |
State Level Tolerance (%) | 2 | — |
Mid Percent Reference Level | 50 | — |
Seek Duration (s) | 0.1 | — |
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): no Simulink equivalent: the Signal Processing Toolbox's pulse metrics are MATLAB functions and that toolbox ships no Simulink library at all. Measured 2026-09-10 on R2026a -- a find_system sweep over 22 DSP System Toolbox and Simulink libraries, at depth 6 and under masks, finds nothing matching pulse, rise, fall, slew, duty, overshoot, settling or state level. Reported rather than dropped, and it carries no parity testbench
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).
Settling Time -- one readout of the shared Pulse Metrics tracker This block is one READOUT of the family's shared IEEE Std 181-2003 transition tracker. The tracker, the reference levels, the interpolation and all ten code emitters live in ../ICorePulseMetricsSupport.h, whose banner carries the algorithm and the five facts about MATLAB's own implementation that a paraphrase gets wrong. What is HERE is the block's ports, its parameters, and what it does with a transition once the tracker has dated one.
⚠ IT IS A SEARCH FOR THE LAST STRAY SAMPLE, NOT FOR THE FIRST SETTLED ONE. Sec 5.3.7 and MATLAB's settlingtime both take the LAST sample in the region whose distance from the landing level exceeds the tolerance, and interpolate between it and the sample after it. A block that stopped at the first sample inside the band would agree on a monotone edge and be wrong on every ring that leaves the band again -- which is the only shape where a settling time is worth measuring.
⚠ WHERE MATLAB REPORTS NaN, THIS BLOCK REPORTS ok = 0, and the two value outputs hold. A NaN would have to survive ten code generators, two of which abort a simulation rather than produce one, so the verdict travels as its own output instead.
The state levels are PARAMETERS rather than estimated from the data. MATLAB guesses them with a histogram of the whole signal when they are not supplied; that is a batch operation over samples a streaming block has not seen, so this family takes them the way those same functions do when a caller passes 'StateLevels' explicitly.
A measurement is published ONE SAMPLE after the region that produced it closes, in the live run and in all ten exported languages. A clocked hardware body cannot read back a value it writes in the same interval, so publishing immediately would put the three HDL targets one sample behind the other seven -- which code export verification scores as the full size of the step. The delay is uniform instead.
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 … 0.048 |
ramp | Ramp: slope 1 from t = 0 | 0 … 0 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | 0 … 0 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | 0 … 0 |
Plotted: step — Step: 0 -> 1 at t = 1 s
Category dynamic · sample time 0.1 · 60 steps · commit bc943ba32 · produced by docsSample --out <folder> --blocks Settling_Time --steps 60 · data docs/generated/samples/Control_Systems__Pulse_Metrics__Settling_Time.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).