Lemonergy · Studio block

Comparison action router

Produces exactly one below/equal/above action flag for a configured threshold at each sample.

Implementation ID
native-if-actions
Reviewed
2026-10-27

Behavior

Produces exactly one below/equal/above action flag for a configured threshold at each sample. Outputs are held between accepted samples; numerical evaluation does not commit hidden state.

Interface

Comparison action router interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Comparison action routerStudio blockin0out0out1out2
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input—Value; real scalar.
out0output—Below; bool scalar.
out1output—Equal; bool scalar.
out2output—Above; bool 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 interval between accepted control samples. Outputs hold between these instants.
Minimum 0
Comparison threshold
params[0]
—0Configured comparison or case value.

Equations and rules

  • below = input < threshold; equal = input = threshold; above = input > threshold

Worked example

Comparison action router worked example

Default editable example at the first accepted sample (t = 0 s). The output checks below are execution oracles for this example.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Below
out0
01—1e-08
Equal
out1
00—1e-08
Above
out2
00—1e-08

Explore the recorded outputs

Comparison action router recorded example

Comparison action router / Below
Comparison action router / Below against timeRecorded synthetic simulation values. Time in seconds; output in —.0.500.750.5111.251.51.52—Time (s)
Comparison action router / Below: 1 — 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

Comparison action router worked example

Produces exactly one below/equal/above action flag for a configured threshold at each sample.

  1. Comparison action router: Produces exactly one below/equal/above action flag for a configured threshold at each sample. Outputs are held between accepted samples; numerical evaluation does not commit hidden 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

  • Control executes on an explicit sampled clock. Continuous states, history/delay kernels, residual equations, and event-source children are not supported.
  • One real threshold with below/equal/above branches; arbitrary logical expression parsing is not supplied.

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. Synchronous Data Flow

    Edward A. Lee, David G. Messerschmitt · Proceedings of the IEEE, 75(9), 1235–1245 · 1987

    Technical reference · Background on actor firing and explicit dataflow. The sampled conditional semantics documented here are Lemonergy design choices, not a claim of a complete SDF 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)