Get state vectors of state space block during simulation

Hi,

how can I get all state vectors of state space block during simulation in Xcos?

Thank you.

Scilab 17-12-18, 12:58 p.m. alexandru

You can get all output states of state space block by using a vector multiplication. For example, if the states are [x1 x2], you can extract the x1 state by multiplying the output by the vector [1 0]. Similarly, you can extract the x2 state by multiplying the output by the vector [0 1]. This vector can be defined using the "GAINBLK_f". This block can be found inside the "Mathematical Operations" category on the "Palette Browser".

Rupak

If you take a look at the "Description" section in the block help (https://help.scilab.org/doc/5.3.3/en_US/CLSS.html), the states are the x vector.
I think you mean the output vector (y). That is not problem to get. I need the x vector.

17-12-18, 3:07 p.m. alexandru

Yes and the states (the x vector) are available on the output "y" because we define "y=C*X". So if you define C as an identity matrix of proper dimension, all your states are available on output "y".

Hm, intreresting approach... Actually C is not identity matrix in my model so I need to dupplicate the state space block and define C as a identity matrix for this new block. The new block must run in parallel with the original block. I guess that's doable... Thank you very much for the tip.

17-12-18, 3:17 p.m. alexandru

You are welcome. I think you can safely consider C to be identity with its "number of rows" matching the "number of rows" of B. I dont see any reason how C affects your system's model.

Rupak