Lemonergy · Studio block

Exclusive action merge

Accepts one explicitly active branch at a sample, holds its prior value when none is active, and rejects competing writers.

Implementation ID
native-exclusive-merge
Reviewed
2026-10-27

Behavior

Accepts one explicitly active branch at a sample, holds its prior value when none is active, and rejects competing writers. Trial evaluations read the held output without mutating state.

Interface

Exclusive action merge interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Exclusive action mergeStudio blockin0in1in2in3out0out1
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input—Branch 1 value; real scalar.
in1input—Branch 2 value; real scalar.
in2input—Branch 1 active; bool scalar.
in3input—Branch 2 active; bool scalar.
out0output—Merged value; real scalar.
out1output—Accepted branch (0 means held); u32 scalar.

Parameters

Defaults are initial model values. Select values for your own model and operating conditions.

Configuration fields
ParameterUnitDefaultMeaning and limits
Sample period
sampleTimeS
s1Positive period between accepted updates; outputs hold between updates.
Initial held output
tables[0]
—[0]Output held before the first accepted update, with one value per output lane.
Branch count
params[0]
—2Number of data branches and matching Boolean ownership flags.
Minimum 2; Maximum 16

Equations and rules

  • Exactly one active branch i: held value ← branch[i]; accepted branch ← i + 1
  • No active branch: retain held value; accepted branch ← 0
  • More than one active branch: reject the sample without committing state

Worked example

Exclusive action merge worked example

Branch values are 2 and 5. Only branch 2 is active, so the accepted value is 5 and its owner index is 2.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Merged value
out0
05—1e-08
Accepted branch (0 means held)
out1
02—1e-08

Explore the recorded outputs

Exclusive action merge recorded example

Exclusive action merge / Merged value
Exclusive action merge / Merged value against timeRecorded synthetic simulation values. Time in seconds; output in —.4.504.750.5515.251.55.52—Time (s)
Exclusive action merge / Merged value: 5 — at 0 s

3 actual recorded samples. Lines are visual guides between samples. Synthetic example, not measured cell data.

Download the recorded samples (JSON) · Open this Studio example after release

Use in a workflow

Exclusive action merge worked example

Accepts one explicitly active branch at a sample, holds its prior value when none is active, and rejects competing writers.

  1. Exclusive action merge: Accepts one explicitly active branch at a sample, holds its prior value when none is active, and rejects competing writers. Trial evaluations read the held output without mutating state.
    • Use the block reference for settings and connections.
    • Implementation tested locally; public release pending.
Open Studio example after release

Connected concepts

Limits and interpretation

  • 2–16 explicitly declared, identically typed branches. Boolean action flags supply ownership; ownership is not inferred from an arbitrary source subsystem.
  • All inputs are validated even when inactive. Branches should share the declared sample clock. A conflict stops the run instead of choosing a writer by connection order.

Scientific and mathematical references

These sources explain the scientific and mathematical background. The behavior, interface and limits above define the Lemonergy implementation; a citation does not imply every model option in the source is implemented.

  1. Statecharts: A visual formalism for complex systems

    David Harel · Science of Computer Programming, 8(3), 231–274 · 1987

    Technical reference · Background on explicit states and events. Lemonergy bounded control blocks are not a complete Statecharts implementation.

Implementation sources

This reference follows the public interface and locally verified numerical checks for an upcoming release.

Contract: Lemonergy Studio public contract · Verification record: verification-2026-10-27

  • docs/glossary/native-block-verification.json

This implementation and its workflow uses (JSON) · Knowledge graph (JSON-LD)