LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set proper step size for control & simulation loop?

Hello,

I have adapted an example VI that implements a Kalman filter in a control & simulation loop. By default, the step size for the control & simulation loop is 0.02 seconds, but when I run the program with this setting, the

Kalman filter does not behave correctly (it does not converge to the value I expect it to converge to). I tried reducing the step size to 0.00005 seconds, and it appears that the Kalman filter works better, but is this an untypically small step size? How can I tell that I have selected an appropriate step size (esp. for a Kalman filter)? Is a rule of thumb to pick as large of a step size as possible without affecting the functionality of your program (such that the step size is not so small as to reduce performance)? Thank you.

0 Kudos
Message 1 of 3
(3,150 Views)

Hi,

A SubVI is missing, therefore it wasn't possible to reproduce your example correctly.

But I would recommend using a different program architecture here.

You might miss some Data if you use Local variables to communicate between loops that way.

It would be the best if you use a queue to transfer your random velocity values to the Control Simulation Loop, so you will not lose any data.

Queue explanation:

https://www.ni.com/en/support/documentation/supplemental/21/producer-consumer-architecture-in-labvie...

 

Or using another example of a Kalman Filter from a previous forum post would be a possibility too:

https://forums.ni.com/t5/Control-and-Simulation/Estimate-Simple-Kalman-vi/gpm-p/3526301

 

0 Kudos
Message 2 of 3
(3,071 Views)

You might find this document useful, it talks about the Continuous Kalman Filter function and mentions the sampling rate:

https://www.ni.com/docs/en-US/bundle/labview-control-design-and-simulation-module/page/lvsysidconcep...

Francine P.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 3
(3,058 Views)