Generated reference › Variant Start — Control Systems/Signal Routing
kind: generated#block#control-systems-signal-routing

Variant Start — Control Systems/Signal Routing

Control_Systems/Signal_Routing/Variant_Start · 1 input / 2 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.

Variant Start

Control Systems / Signal Routing

Opens a variant region: it sends its input down one of its branches, the one whose variant control is true, and a Variant End with the same Variant Start End Tag closes the region by passing on that same branch. The branches between them are ordinary blocks. Every block on a branch not chosen leaves the run – a block tapped off that branch included – as Simulink removes it. The choice is made before the run from the project's variables.

Ports

  • Input – u, any size [m,n].
  • y1 … yN – one branch per variant control, each of the input's size. Add or remove outputs from the block's port settings, keep one control per output, and give the paired Variant End as many inputs. The chosen branch carries u.

Parameters

  • Variant Controls – one control per branch, in port order, written as Simulink writes them, {'V==1';'V==2'}, or as a plain list, V==1; V==2. A control is a condition that is true or false: V==1, V~=1, V>=1 && V<=2, V==1 || W==2, mod(V,2)==1, or true and false. (default) marks the branch taken when no other control is true. A bare name such as V is not a condition and is refused, as Simulink refuses it. The default is {'true';'false'}: the first branch.
  • Variant Control Mode – expression evaluates the controls as conditions; label treats each control as a name and takes the branch whose name is Label Mode Active Choice; sim codegen switching takes the branch whose control is (sim), and each control must be (sim) or (codegen).
  • Label Mode Active Choice – in label mode, the name of the chosen branch. Unused in the other modes.
  • Variant Start End Tag – the name that pairs this block with its Variant End, which must be at the same level. Default A, as in Simulink.
  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. It does not cross to Simulink, whose block has no rate parameter.

When a run is refused

In Simulink's words: no Variant End of the same tag at this level (has no paired Variant End block present in the current hierarchy), no control true (must have at least one active port), more than one true, two (default) controls, a bare name, a variable the project does not define, a value that is not true or false, and a number of controls that is not the number of outputs. ICore also refuses two Variant Ends of the same tag at one level.

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The choice is made before the export, so the generated body copies the input to the chosen branch and holds no condition; the branches not chosen are not exported. Re-export after changing a variable a control reads. The HDL targets are fully synthesizable.

Simulink bridge

Import and export, mapped to simulink/Signal Routing/Variant Start. Variant Controls crosses as the cell VariantControls, which is what sets Simulink's output count and its paired End's input count; Variant Control Mode, Label Mode Active Choice and Variant Start End Tag as VariantControlMode, LabelModeActiveChoice and VariantStartEndTag. The activation time is written as update diagram, the only one ICore makes; a model with another is reported on import. The rate does not cross.

Notes

  • Algebraic, with no state.
  • Simulink also refuses a branch that has no direct path from the Start to the End; ICore does not check that, and runs whatever the branches hold.
  • Controls name variables of the project's variables space; Simulink's Simulink.Variant objects and model workspace are not carried.

Code facts#

FactValue
registered typeControl_Systems/Signal_Routing/Variant_Start
familyControl_Systems/Signal_Routing
solver environment classICoreBlock_0_Control_Systems_1_Signal_Routing_2_Variant_Start
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Routing/Variant_Start/ICoreBlock_0_Control_Systems_1_Signal_Routing_2_Variant_Start.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Routing/Variant_Start/ICoreBlock_0_Control_Systems_1_Signal_Routing_2_Variant_Start.h
default size on canvas80 × 90 px
ports at insert1 in, 2 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDouble—
2outICoreDoubley1
3outICoreDoubley2

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
Variant Controls{'true';'false'}VariantControls
Variant Control Modeexpression%~%label%~%sim codegen switching~~expressionVariantControlMode
Label Mode Active Choice—LabelModeActiveChoice
Variant Start End TagAVariantStartEndTag

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::Both
Simulink pathsimulink/Signal Routing/Variant Start
port-count rulePortsParam::VariantControlsOut
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
deliberately not crossedVariantPairedBlock
always setVariantActivationTime = update diagram
ICore configSimulink parameterValue translation
Variant ControlsVariantControlspasses through
Variant Control ModeVariantControlModeexpression → expression, label → label, sim codegen switching → sim codegen switching
Label Mode Active ChoiceLabelModeActiveChoicepasses through
Variant Start End TagVariantStartEndTagpasses through

Caveat (shown to the user): the controls cross as the cell VariantControls, which sets Simulink's output count and its paired End's input count; the pair crosses as VariantStartEndTag; the activation time is update diagram, the only one ICore makes; the block has NO SampleTime parameter, so a rate set here does not cross

Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h

Description vs code#

The checker has a blind spot here — it could not resolve something (a grouped port bullet, a computed config name), which is reported and never counted as a pass. A reader has to settle it:

  • B0 Ports lists 2 entries for 3 ports (1 in, 2 out), and the 2 they cover does not reconcile — grouped, or one undocumented? a reader must say
  • B0 no sample under docs/generated/samples/ — nothing to cross-check (P8.1)

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

Variant Start -- opens a variant region: one input down one of N branches The Variant Sink's shape, paired with a Variant End. Measured on R2026a (FEATURES_TO_ADD.md §F.BF3 (e)): 1 in, N out, the output count following the VariantControls cell; the dialog is the Sink's without AllowZeroVariantControls, plus VariantStartEndTag (default 'A') and the read-only VariantPairedBlock; no SampleTime. Paired by tag: V=1 gives y = 2 (the x2 branch) and V=2 gives y = 3; a To Workspace tapped off a branch inside the region is removed with it; no control true is Simulink:VariantCompile:VariantStartZeroVariantsNotAllowed, and a tag nothing matches is Simulink:VariantLangBlocks:VariantEndBlockMissing. The choice, the pairing, the pruning and the ten generators are ICoreVariantBlockBase's.

Sample results#

No sample run is committed for this block. Samples come from the headless harness (DOCS_PLAN.md P8.1) into docs/generated/samples/; until one exists this block's behaviour is witnessed by the parity and export-verification suites, not by a plot here.