How to Model an LPV System in Xcos and Extract Individual States

Hello everyone,

I’m currently working on modeling a Linear Parameter-Varying (LPV) system in Xcos and have run into a few questions.

Current Challenges

  1. Modeling LPV System in Xcos:

    • How to model an LPV system in Xcos where the state-space matrices are dynamically updated based on the scheduling signals.
  2. Continuous State-Space System Block:

    • Is it possible to extract individual states from the “Continuous State-Space System Block” in Xcos?
    • If not, do I need to model the state-space equations manually using separate integrator blocks and mathematical operations?

Any help or guidance would be greatly appreciated!

Thank you!

Hello,

For the first point, I am affraid that for a general state-space system with state x, input u and output y

\begin{align} x'&=f(t,x,u),\\ y&=g(t,x), \end{align}

you will have to use the Scilab function block (scifunc_block_m - Scilab function block) and as many integration blocks (INTEGRAL_f - Integration) as the dimension of x.

For the second point, you can easily extract the state components by adding extra lines to the matrices C and D. For example if you have the following system with a state x of dimension n and an input u of dimension m

\begin{align} x'&=Ax+Bu,\\ y&=Cx+Du, \end{align}

you can define \tilde C=[C;\mathbf{I}] and \tilde D=[D;\mathbf{0}] where \mathbf{I} is the n\times n identity matrix and \mathbf{0} the n\times m zero matrix. Then the LTI system (A,B,\tilde C,\tilde D) will have an output \tilde y whose last n components are those of x.

S.

Thank you, so these to examples attached are not the right solution?


StateSpace_Total.zcos (5.6 KB)

Probably this is a good example:

Source:

What do yo mean ? It depends what you want to do with x afterwards. It is better to use a LTI system block and output the whole state x (taking C=\mathbf{I} and D=\mathbf{0}), then you can do what you want. But rebuilding the LTI block with elementary block is overkill, unless you need to add perturbations (like in your diagram above).

S.

So using the state space Block and the example of ninja is not the smart way?

https://help.scilab.org/CLSS

Sorry @mottelet, please help me again. I should use the scifunc_block_m - Scilab function block for the matrices, right?
And in this case I could model a LPV system, too?

There is no smart or not smart way, this is just a matter of taste.

If you have a few number of states, e.g. two, I would not use the scifunc block and directly compose the diagram for individual states. However, if you want to take advantage of the matrix algebra, then use this block. Here is an example for the system (a spring with damping increasing with time):

\begin{align} x'&=f(t,x,u)=A(t)x+Bu,\\ y&=Cx, \end{align}

with A(t)=\left(\begin{array}{cc}0 &1\\-1 & -\frac{t}{10}\end{array}\right):

Here is the code of the function in the block:


nonstat.zcos (4.0 KB)

1 Like