Lemonergy · Studio block

Discrete state space

Advances a discrete linear state model and computes its output at each tick.

Implementation ID
native-discrete-state-space
Reviewed
2026-10-27

Behavior

y[k] = C x[k] + D u[k]. x[k+1] = A x[k] + B u[k]. The worked example connects this operation to signals in Lemonergy Studio.

Interface

Discrete state space interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Discrete state spaceStudio blockin0out0
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input1Input; real scalar.
out0output1Output; real scalar.

Parameters

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

Configuration fields
ParameterUnitDefaultMeaning and limits
Sample period
sampleTimeS
s0.1Exact sample grid period. Elapsed-time integration begins after initialization.
Minimum 1e-06
State count
params[0]
11Configured finite numerical parameter.
A matrix
tables[0]
1[0.5]Column-major state × state.
B matrix
tables[1]
1[1]Column-major state × input.
C matrix
tables[2]
1[1]Column-major output × state.
D matrix
tables[3]
1[0]Column-major output × input.
Initial state
tables[4]
1[0]Configured coefficients or initial values in column-major order.

Equations and rules

  • y[k] = C x[k] + D u[k]
  • x[k+1] = A x[k] + B u[k]

Worked example

Discrete state space — worked example

Input = 1. Output at 0 s = 0.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Output
out0
0011e-08

Explore the recorded outputs

Discrete state space recorded example

Discrete state space
Discrete state space against timeRecorded synthetic simulation values. Time in seconds; output in —.-0.159843800.41958980.250.99902340.51.5784570.752.1578911—Time (s)
Discrete state space: 0 — at 0 s

11 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

Discrete state space — worked example

Advances a discrete linear state model and computes its output at each tick.

  1. Discrete state space: y[k] = C x[k] + D u[k]. x[k+1] = A x[k] + B u[k]. The worked example connects this operation to signals in Lemonergy Studio.
    • Use the block reference for settings and connections.
    • Implementation tested locally; public release pending.
Open Studio example after release

Connected concepts

Limits and interpretation

  • Real, dense, constant A/B/C/D; up to128 discrete states; difference-equation updates occur once per tick.
  • Shapes and element types are explicit. Values must be finite; automatic reshaping and unit conversion are not performed.

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: An Introduction for Scientists and Engineers, second edition

    Karl J. Åström, Richard M. Murray · Princeton University Press; author-maintained FBSwiki · 2021

    Technical reference · State-space modeling, feedback and PID control. These mathematical foundations do not establish a particular software 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)