Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing a Full State Feedback Estimator

Solved!
Go to solution

Hello everybody,

I'm just a beginner in programmming LABVIEW and therefor, I hope somebody can help me with my problem.

 

I want to designe a full state feedback controller and estimator for a ball on beam system with MyRio-1900. The system  consists out of a servo motor and a IR sensor. The input u(t) is the angle of the servo, the output y(t) is the ball position and the states are the ball position and the ball velocity. So, I get the state space model, which is

 

x_dot(t) = [0 1; 0 0] x(t) + [0; 5.866] u(t)

y(t) = [1 0] x(t)

 

Therefor, I modeled the system in MATLAB, did the poleplacement and implemented it in LABVIEW. I also designed the observer in MATLAB but I don't know how to implement my observer. I tried to implement it with the sub.vi Continous Observer. It can be found at Control & Simulations -> Simulation -> Estimation -> Continous Observer.

 

My Controller Matrix is K = [7.78 1.36], the Gain is G = 7.69 and my Observer Matrix is [80; 4578.4].

 

The problem I had with this sub.vi is that it allways delets my state space model, what I used in the block parameters and I get some errors after compiling.

 

The figure below depicts my LABVIE program without the oberver

FullStateController.JPG

I'm really looking forward to your suggestions and solutions.

 

Kind Regards 

Marmai94

 

 

0 Kudos
Message 1 of 8
(2,662 Views)

Are you wanting to simulate the system, or apply to a real system ?

If you want to simulate only then, just you'll need to construct your state feedback entirely within a simulation loop.

If you want to apply to real system, use the corresponding function for non-simulation functions in Control & Simulation | Control Design.| State Feedback | State Estimator, or build the observer from basic math functions (it is just matrix manipulations)

If applying to the real system I would make sure the estimator is working correctly first before connecting in the state feedbcak controller.

 

 

 

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 2 of 8
(2,597 Views)

Hello AndyClegg,

 

Thank you for the fast response!

 

I need it for a real system and I also realized it now with the "Discrete State Estimater" block. But now I have another problem, I get allways a "NaN" data from the observer.  

 

Below the new system is depicted

0 Kudos
Message 3 of 8
(2,531 Views)

Does you state-space model behave as you expect ?

It doesn't look like you have converted the continuous model into an equivalent discrete model.

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 4 of 8
(2,502 Views)

Not really i allways get as output a NaN signal.

 

I also tried to inser the block CD Convert Continious to Discrete.vi. Despite, I just get a NaN signal.

0 Kudos
Message 5 of 8
(2,466 Views)
Solution
Accepted by topic author marmai94

Your system is unstable - i.e will grow exponentially to Inf with time (but should not always give outpput NAN)

Is that what you expect?

Did you compare your discrete model response (time or frequency) to the continuous model to check that it behaved in the same way ?

Have you discretised at an appropriate sample time?

If you are you using a discrete state estimator you MUST use a discrete model with it - and obviously the sample time used for the discretisation and the sample time of the observer needs to be the same

Check your state estimator is working when not part of the feedback law ? This is more difficult with a real unstable system, so probably best to do that within a simulation.

Beyond that it should just be about getting the state feedack controller gains and control signal correct - making sure the controlled system seen by the state feedback is as represented by the model. It is very easy to miss out some additional scaling / offset terms. But none of those should really give NAN if arranged correctly.

 

 

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 6 of 8
(2,445 Views)

The system is unstable? So I'm curious about it, because the system without the observer is stable and works and I designed the observer with matlab and also simulated it and there it is stable.

 

Ok thank you I'll try to compare the continuous model with the discrete.

0 Kudos
Message 7 of 8
(2,420 Views)
Ok thank you i got. Now i transformed my system in the MATLAB model into the z-domain and also my K and L and now it is running. Thank you for your hints!
0 Kudos
Message 8 of 8
(2,413 Views)