pySimBlocks.blocks.systems.polytopic_state_space¶
- class pySimBlocks.blocks.systems.polytopic_state_space.PolytopicStateSpace(name: str, A: ArrayLike, B: ArrayLike, C: ArrayLike, x0: TypeAliasForwardRef('ArrayLike') | None = None, sample_time: float | None = None)[source]¶
Bases:
BlockDiscrete-time polytopic state-space block.
Implements a convex combination of linear state-space models:
x[k+1] = sum_{i=1}^r w_i[k] (A_i x[k] + B_i u[k])
y[k] = C x[k]
The weight vector
wmust be non-negative and sum to 1 at each step. Matrices A and B are provided as horizontal concatenations of the per-vertex matrices: A = [A_1, …, A_r] of shape (nx, r*nx) and B = [B_1, …, B_r] of shape (nx, r*nu).- A¶
Concatenated vertex state matrices of shape (nx, r*nx).
- B¶
Concatenated vertex input matrices of shape (nx, r*nu).
- C¶
Output matrix of shape (ny, nx).
- direct_feedthrough = False¶
True if outputs depend directly on inputs.
- initialize(t0: float) None[source]¶
Compute initial outputs from the initial state.
- Parameters:
t0 – Initial simulation time in seconds.
- output_update(t: float, dt: float) None[source]¶
Compute y and x outputs from the committed state.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- state_update(t: float, dt: float) None[source]¶
Compute the next state as a weighted sum of vertex dynamics.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- Raises:
RuntimeError – If inputs
woruare not connected.ValueError – If
wdoes not sum to 1, has negative entries, or if input shapes are wrong.