06-06-2015 03:13 AM
I´ll use your suggestions!! Thanks!
I have been thinking on the NAN problem , and I guess the problem is on the cluster i am using to recirculating the State Space model around the state machine.
Altough the discrete model has enough numerical significant digits when defined, (as I recall, they are matrices of DBL with 6 digits of precision), when passing through the cluster they round to 2 digits of precision, and that probably causing the observer went unstable, and driving it towards infinity.
I´ll check it on Monday!!
Thanks a lot for the comments.
06-06-2015 03:16 AM
Clusters have nothing to do with rounding. The number of visible decimal digits is just a cosmetic property and does not change the underlying data.
06-06-2015 07:48 AM
altenbach escribió:
Clusters have nothing to do with rounding. The number of visible decimal digits is just a cosmetic property and does not change the underlying data.
Ok, good to know that. I was trying first some simulations and saw that if I reduced the numerical precision of the elements of the discretized state space matrices, then the simulations went to inf, so at least I needed 6 digits in order to perform well. Maybe I should implement the continuous model and let the RT code do the discretization math for me. (That way worked in simulation). Or try EXT datatype. I am not confident on what is really happening.
From this link: Labview Wiki: NAN I think that the only case that could possibly happen, would be the last: any calculation which includes NaN as one of its operands
But if you look at the discrete observer implementation:
At each time step k, this function calculates the Predicted State Estimate xhat(k+1|k) using the Estimated Output yhat(k) and the Predicted State Estimate xhat(k|k–1).
The following equations define the outputs of this function:
yhat(k) = C(k) · xhat(k|k–1) + D(k) · u(k)
xhat(k+1|k) = A(k) · xhat(k|k–1) + B(k) · u(k) + Lp[y(k) – yhat(k)]
where Lp is the Observer Gain.
take into consideration that D=0, and some elements of Lp are large (with another design I could get smaller terms), but I do not get why It works on simulation and not in real time.
Thanks a lot for the insight!
06-09-2015 02:37 AM
Anyone may help?