Lemonergy · Studio block

Enumeration code

Explicitly converts a declared enumeration signal to its integer code.

Implementation ID
enum-cast
Reviewed
2026-10-27

Behavior

Explicitly removes enumeration identity and exposes the member’s signed32 integer code.

Interface

Enumeration code interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Enumeration codeStudio blockin0out0
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input1Input 1; i32 signal.
out0output1Output 1; i32 signal.

Parameters

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

Configuration fields
ParameterUnitDefaultMeaning and limits
signal quantity
signal.quantity
1dimensionlessExplicit signal quantity in the worked model.
signal shape
signal.shape
1[]Explicit signal shape in the worked model.
signal element Type
signal.elementType
1i32Explicit signal elementType in the worked model.
signal enumeration id
signal.enumeration.id
1ChargeModeExplicit signal enumeration id in the worked model.
signal enumeration members
signal.enumeration.members
1[{"name": "Idle", "value": 0}, {"name": "CC", "value": 1}, {"name": "CV", "value": 2}]Explicit signal enumeration members in the worked model.

Equations and rules

  • output = enumeration member code

Worked example

Enumeration code — executable model

Converting the declared ChargeMode.CC member yields integer1.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Result
Result
0.2111e-09

Use in a workflow

Enumeration code — executable model

Explicitly converts a declared enumeration signal to its integer code.

  1. Enumeration code: Explicitly removes enumeration identity and exposes the member’s signed32 integer code.
    • Use the block reference for settings and connections.
    • Implementation tested locally; public release pending.
Open Studio example after release

Connected concepts

Limits and interpretation

  • The input must carry a declared enumeration identity. This does not construct arbitrary enumeration members from unvalidated integers.

Reference basis

This compiler and software type contract is defined by the documented behavior and executable example; no external research result or full external API parity is claimed.

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)