# State-Space Model (`stateSpace`)

> A linear plant or filter given by its A, B, C and D matrices, one input and one output.

![stateSpace](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/stateSpace.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/stateSpace/)

**Group:** Control · **Kind:** `{"block":"stateSpace","kind":"control"}`

## When to use it

Use it when your model of a plant is already in state-space form, such as an averaged converter model written as derivatives of inductor currents and capacitor voltages. Use Transfer Function or Zero-Pole-Gain when you have B(s)/A(s) or its roots.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Input u |
| `out` | signal | Output y |

## Common parameters

- `a`: State matrix A, rows separated by semicolons (Default: required)
- `b`: Input column B, one value per state (Default: required)
- `c`: Output row C, one value per state (Default: required)
- `d`: Feedthrough D from the input to the output (Default: 0)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `a` | — | required |  | State matrix A, rows separated by semicolons |
| `b` | — | required |  | Input column B, one value per state |
| `c` | — | required |  | Output row C, one value per state |
| `d` | — | 0 |  | Feedthrough D from the input to the output |

_Parameter descriptions are in English in both languages._

## Model

ẋ = A·x + B·u and y = C·x + D·u. a is the n × n matrix with rows separated by semicolons (-1, 2; 0, -3), b the column of n input gains, c the row of n output gains, and d a number. The block computes the transfer function C·(sI − A)⁻¹·B + D once when the circuit is built (the Faddeev–LeVerrier recursion) and runs it like Transfer Function: controllable canonical form, trapezoidal rule over every accepted step, initial state zero. With d not zero the output follows the present input (direct feedthrough). With a, b and c left empty the block is the gain d.

## Common mistakes

- Only the input-to-output behaviour from a zero state is kept: an initial state, and states the input cannot reach or the output cannot see, are dropped. Start the model at its operating point by adding the steady-state output outside the block.
- a must be square, b and c must have one value per row of a, and the order is at most 16, or the build stops. One input and one output only; use one block per output for a model with several.

Problems rules: `compile.error`, `solver.control`

## Datasheet and sources

There is no datasheet. The matrices come from your model. Code generation treats the block like Transfer Function: written as its discrete equivalent when it feeds a PWM, otherwise left out as an s-domain block.

## Example

Open the example with the command `file.openExample` and the name `demo:stateSpace`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
