Lemonergy · Studio block

Scoped state reader

Executes one declared discrete state-space child and records its actual internal state before and after each update.

Implementation ID
native-state-reader
Reviewed
2026-10-27

Behavior

Executes one declared discrete state-space child and records its actual internal state before and after each update. Trial evaluations read the held output without mutating state.

Interface

Scoped state reader interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Scoped state readerStudio blockin0out0out1out2
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input—Input; real scalar.
out0output—Output; real scalar.
out1output—State before update; real vector [1].
out2output—State after update; real vector [1].

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.
Declared child operation
nested
—Discrete state spaceThe locally owned target operation. Its parameters, initial state, and typed ports are configured explicitly.
State transition matrix
nested.parameters.config.tables[0]
—[0.5]Matrix A in x_next = A x + B u.
Input matrix
nested.parameters.config.tables[1]
—[1]Matrix B in x_next = A x + B u.
Output matrix
nested.parameters.config.tables[2]
—[2]Matrix C in y = C x + D u.
Direct input matrix
nested.parameters.config.tables[3]
—[3]Matrix D in y = C x + D u.
Initial state
nested.parameters.config.tables[4]
—[4]Initial internal coordinates before an optional enabled replacement.

Equations and rules

  • Observe x_before = internal child state
  • y = C x_before + D u
  • x_after = A x_before + B u

Worked example

Scoped state reader worked example

For A=0.5, B=1, C=2, D=3, initial state 4 and input 1, the model output is 11 and the internal state advances from 4 to 3.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Output
out0
011—1e-08
State before update
out1
0[4]—1e-08
State after update
out2
0[3]—1e-08

Explore the recorded outputs

Scoped state reader recorded example

Scoped state reader / Output
Scoped state reader / Output against timeRecorded synthetic simulation values. Time in seconds; output in —.7.7608.630.59.5110.371.511.242—Time (s)
Scoped state reader / Output: 11 — 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

Scoped state reader worked example

Executes one declared discrete state-space child and records its actual internal state before and after each update.

  1. Scoped state reader: Executes one declared discrete state-space child and records its actual internal state before and after each update. 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

  • One declared discrete linear state-space child, with 1–128 real state coordinates. The reader owns and executes that child; it cannot inspect arbitrary foreign blocks.
  • State outputs are explicit numeric coordinates, distinct from the model output. Continuous states, opaque kernel memory, and history buffers are not exposed.

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. Feedback Systems: System Modeling, Section 2.1, discrete-time systems

    Karl Johan Åström, Richard M. Murray · Princeton University Press; author-hosted chapter, California Institute of Technology

    Technical reference · Discrete state-space equations and the distinction between internal state and output. Scoped write ordering is a separate Lemonergy contract.

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)