# Kalman Filter- practical way to get the measurement error covariance R

hello all,
I just get into a project about BLDC motor state and parameter estimation using Kalman Filter. And I have already finished the
calculation of KF, now the problem is to estimate or tune the KF measurement error covariance R.
I read some materials and also my boss told me it is possible to estimation R in a practical way, and I assume, I should take some sample measurements and estimation of the motor states or parameters to determine the variace of the measurement noise, that is something like: varERROR=f(x-\hat x).
But I really dont know how to achieve this 'practical estimation of R' in PRACTIC.
Anyone knows how to deal with that??
I appreciate any help:-)
Emily
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
hello all again,
I post one message twenty minutes ago, but it didnt appear in the forum, really dont know what is the matter... anyway...
I just got into a project about state and parameter estimation for a BLDC motor using Kalman filter. I have already established the calculation of KF in Matlab/Simulink. The problem now is to choose the suitable measurement noise covariance R.
I read some materials and also my boss told me it is possible to measure R in a practical way, and I assume, maybe I should choose some motor state or paramter to get both the measurement and the estimation value, and try to get the measurement variance? that is something like, var = f(x-\hat x)??
But I really dont know how to apply this kind 'practical way' in PRACTIC. Anyone knows how to deal with that?? or is there some materials related in this part.
I appreciate for any help:-)
Emily
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Well, I'm not completely sure but:
R=[Sxx Sxy; Syx Syy]     (in Matlab notation ; means next row)
where Sxy is covariance and is equal 0 as far as we consider only one sensor noise (R is measurement covariance by definition) and Sxx is a variance of this noise?
Just set it (on R diagonal) constant and equal to measurement error variance sigma^2. This is in practice your sensor accuracy (or power 2).
If you generate a sensor noise in your simulation then a and b are that generated signal variance.
--

Mikolaj

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>

You need to set up an experiment that lets you have a well-controlled independent parameter, or that lets you measure the independent parameter significantly more accurately than you expect in practice. Then measure the same parameter by the method that you're going to use in practice. Use your 'good' value of the parameter vs. your 'practical measurement' to determine the variance.
Exactly how you set up your experiment depends on what parameters you're trying to measure, of course.
--

Tim Wescott
Wescott Design Services
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
thanks up there,
and Tim, I am quite new in the field of stochastic estimation and control, actually I only had some lectures.
I think I did the experiments you mentioned, the parameters needed to be estimated is the stator resistance of the BLDC motor, I actually know the value of it and I measured the value in a Simulink model, which is without any noises. the value is equal to the real one.
I estimated the resistance with KF as a observer and I added some Gausian noise simulated the measurement noise. I got the variance of the estimated resistance vs. the real resistance.
The problem is, as I used the current and rotor speed as for the measured value, the structure of R is like R=[a,0;0;b], how to choose a, and b using the variance I got from experiments?
And like Matt said, how to choose the initial a and b?
thanks again.
Emily
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
(...)

(...)
If you know it (or you really trust to your measurements) then R doesn't exist.
--
Mikolaj

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Hi. You might also try starting with the product specifications to get the general structure of the R matrix. Then you can evaluate its performance on the motor hardware while varying R by multiplying it by a coefficient until you are satisfied that you've achieved the fastest estimation response you can get for your system.
As a simple example, say you had R=[a 0;0 b], with a and b being the corresponding measurement error variances from your sensor specifications. Then, set R_test = k*R and turn the crank on your Kalman Filter gain computations. Test that out in your hardware setup. Try several conservative values of k until you are satisfied with the estimation output. The more you decrease k, the faster your filter will respond -- but it will also be much noisier.
Matt

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
: hello all, : : I just get into a project about BLDC motor state and parameter : estimation using Kalman Filter. And I have already finished the : calculation of KF, now the problem is to estimate or tune the KF : measurement error covariance R. : : I read some materials and also my boss told me it is possible to : estimation R in a practical way, and I assume, I should take some : sample measurements and estimation of the motor states or parameters : to determine the variace of the measurement noise, that is something : like: varERROR=f(x-\hat x). : : But I really dont know how to achieve this 'practical estimation of R' : in PRACTIC. : : Anyone knows how to deal with that??
We have calculated the measurement error for an encoder by simulating motion at various speeds, sample rates and resolutions. As it turns out quantizing is the biggest source of error. We sampled data the sample times plus or minus a little jitter. The sampled data was then quantized to the resolution of the encoder. The errors are then calculated between the simulated sampled and quantized data and the true data. The variance was computed from that.
Peter Nachtwey
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>

## Site Timeline

• ### Does Siemens s7-3xx have a timing diagram like AB's Contact Histogram or Trend

• - next thread in ⧑ Industrial Control Group