LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Discrete state-space representation in FPGA

Solved!
Go to solution

Hello all,

 

My aim is to simulate a discrete state-space model is the cRIO FPGA (in order to use an observer).

I am currently trying to simulate it on my computer without using the discrete state-space VI from the Control Design and Simulation toolbox (because there is not state-space model VI for the FPGA). However my discrete state-space model representation does not work.

There is below the continuous state-space model:

 forum1.jpg

 

Then I obtained the discretized model (using the zero-order-hold and t=0.01s):

 

forum2.jpg

 

Below is the discretized state-space model I designed (in order to design a similar model in the FPGA):

 forum3.jpg

Here is the discrete state-space VI I'm using to compare the results:

forum3.5.jpg

The graph plots the state X1, which is infinitely increasing. However it should look like a first order, as you can see:

forum4.jpg

 

I understand why the state X1 is increasing like this, I know I'm missing something (integration saturation ?).

 

Thanks in advance

Regards!

 

PS: Does somebody know if implenting other controller than the PID is doable in the cRIO FPGA? I also asking myself about matrix inversion if I want to use the Kalman gain in my observer.

PS2: I apologize for my disorganized/unclear Labview files, I'm beginning with it.

 

 

 

Download All
0 Kudos
Message 1 of 5
(3,929 Views)
Solution
Accepted by topic author Lyrae

Hi,

 

I think the problem might be caused by rounding errors in your A and B matrices.  Have you tried getting it to display the values with greater precision?

 

Matlab calculates those values as:  A = [0.995, 0.009925; 0 0.99],  B = [2.488e-5; 0.004975]

 

Regards,

Ian

0 Kudos
Message 2 of 5
(3,914 Views)

Hi,

 

thanks a lot, it's working very well.

Could you tell me what function did you use with Matlab ?

 

Regards

0 Kudos
Message 3 of 5
(3,911 Views)

Hi,

 

I'm glad that helped.  I used:

 

G = ss([-0.5, 1; 0 -1], [0;0.5], [0 0], 0);

c2d(G, 0.01)

 

(from the Control System Toolbox)

 

Regards,

Ian

0 Kudos
Message 4 of 5
(3,906 Views)

In fact I was reading A and B matrixes through the front panel of the 'CD Convert Continuous to Discret' VI and the display format had just 2 digit of precision... (Shame on me!)

 

Thanks for your help

 

Regards

0 Kudos
Message 5 of 5
(3,903 Views)