Discrete Varying Notch — Control Systems/Linear Parameter Varying
Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Notch · 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.
Discrete Varying Notch
Control Systems / Linear Parameter Varying
A second-order notch filter whose centre frequency, depth and damping all arrive on ports, so it may be re-tuned on every sample:
N(s) = (s² + 2·gmin·ζ·w0·s + w0²) / (s² + 2·ζ·w0·s + w0²)
discretized by the bilinear (Tustin) rule and realized as a biquad in transposed direct form II (two states).
Ports
- u – the signal to filter, of any size [p,q]. The filter is SISO and applied independently to every entry, each carrying its own pair of states, but all entries share the one parameter triple.
- frequency – the notch centre w0 in radians per second, scalar.
- gmin – the notch depth: the gain at the centre frequency. 0 is an infinitely deep notch, 1 removes the notch entirely (numerator and denominator become equal), and values between set the attenuation.
- damping – the damping ratio ζ, which sets how WIDE the notch is: larger is wider.
- Output – y, the same size as u.
Parameters
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. It is also the Ts the Tustin coefficients are formed from, so it changes the filter and not merely how often it runs.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. All three parameters are read from their ports each step and the biquad is formed there, so a generated core re-tunes exactly as the simulation does; only Ts is baked in.
The three HDL targets are SIMULATION-ONLY. Forming the coefficients
divides by A0 on every sample, which does not belong in a Q16.16
datapath, so those cores carry the filter in real arithmetic and
quantize only at the port boundary – the same choice the sibling
Discrete Varying Lowpass, Recursive IIR and Variable Transport
Delay make.
Simulink bridge
Import and export, mapped to cstblocks/Linear Parameter Varying/Discrete
Varying Notch (the library is cstblocks, not the "Control System
Toolbox" display name, which add_block does not accept). The three
parameters need no mapping – on both sides they are signals – and the
port order (u, frequency, gmin, damping) is identical.
Simulink's w0 parameter is always written out as 0: on the
varying block the centre frequency comes from the port, so leaving it free would
let an imported block carry a second, silently unused frequency.
"Sampling Time (s)" DOES cross, under Simulink's own name for it here:
this block's rate parameter is Ts, not SampleTime.
Notes
- Discrete only, and stateful: two states per entry, both starting at zero.
- The discretization and the realization are both part of the specification. Tustin as a transposed direct form II biquad matches Simulink to 6·10−15 with all three parameters moving; the identical Tustin biquad written as a direct y-recursion is out by ~0.33. The two agree exactly whenever the parameters hold still, so a fixed-parameter check cannot tell them apart.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Notch |
| family | Control_Systems/Linear_Parameter_Varying |
| solver environment class | ICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Notch |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Notch/ICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Notch.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Linear_Parameter_Varying/Discrete_Varying_Notch/ICoreBlock_0_Control_Systems_1_Linear_Parameter_Varying_2_Discrete_Varying_Notch.h |
| default size on canvas | 140 × 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 | u |
| 2 | in | ICoreDouble | frequency |
| 3 | in | ICoreDouble | gmin |
| 4 | in | ICoreDouble | damping |
| 5 | 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#
No config variable beyond the Sampling Time (s) every block carries.
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 | cstblocks/Linear Parameter Varying/Discrete Varying Notch |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
| rate parameter name | Ts |
| always set | w0 = 0 |
Caveat (shown to the user): the centre frequency, depth and damping are signals on both sides, so none of them is a parameter to carry, and the port order (u, frequency, gmin, damping) is identical
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).
Discrete Varying Notch — centre frequency, depth and damping all on ports Tustin biquad, transposed direct form II. The full coefficient formation and the measured evidence for the realization are in the header.
The three HDL targets run this in
realand are SIMULATION-ONLY: forming the coefficients divides by A0 on every sample, which does not belong in a Q16.16 datapath. Same call the sibling Lowpass, Recursive IIR and Variable Transport Delay make.
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 … 1 |
ramp | Ramp: slope 1 from t = 0 | 0 … 20.93 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -1.194 … 1.271 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | -2.106 … 7.063 |
Plotted: step — Step: 0 -> 1 at t = 1 s
Category dynamic · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/Control_Systems__Linear_Parameter_Varying__Discrete_Varying_Notch.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).