Showing results for 
Search instead for 
Did you mean: 

Solving Riccati equation


Solving Riccati equation

I have experience with Systembuild only.


I saw that Xmath has a module with a function to solve the Riccati equation. How can I use this function in Systembuild?

0 Kudos
Message 1 of 2

Re: Solving Riccati equation

The Riccati equation can be solved in SystemBuild using a UserCodeBlock where internally the function XmathExecute is called to solve the Riccatti equation using Xmath.

This Riccati equation solver could be placed in a slower periodic SuperBlock so that it is not recalculated every time step.

Another UserCodeBlock (file scoped with the Ricatti solver UserCodeBlock) could return the new A and B matricies.


But, the real problem is how to inject the new A and B matrix into your model.

The SystemBuild StateSpace block A,B,C and D matricies can be only changed during simulation initialization.

You would have to create your own StateSpace SuperBlock using the matrix multiple blocks, UserCodeBlock(returns new A,B), intergator block and summer blocks to calculate.


Xdot = Ax + Bu;

Y      = Cx + Du;


It would be much easier if there were a StateSpace block that had the A and B matricies as inputs.


Note: using SystemBuild the UserCodeBlocks and StateSpace SuperBlock dimensions are fixed and would have to be determined before hand.


0 Kudos
Message 2 of 2