- #1

- 36

- 0

I am not sure if this is the right forum to post this. I am working on a Kalman Filter for battery state of discharge estimation during discharging process. I am using a Linearized Discrete Time Kalman Filter to estimate the State of Discharge/SOD (how much % of charge has been taken away) of a battery. Below are some of the codes.

Coefficient which relates the measurement (on most books it is a matrix, but since I am only having 1 state variable, it is a coefficient)

**Hk=c1+2*c2*SOD+3*c3*pow(SOD,2)+4*c4*pow(SOD,3)+5*c5*pow(SOD,4)+6*c6*pow(SOD,5)+7*c7*pow(SOD,6)+8*c8*pow(SOD,7)+9*c9*pow(SOD,8)+10*c10*pow(SOD,9);**

c1-c10 are the battery model coefficients to fit the experimental data well.

Kalman gain computation

**Kk = (pkmin*Hk)/(Hk*pkmin*Hk+R);**

Correction Updates

**zk = uk - Hk*xkmin;**

xkplus = xkmin + Kk*zk;

xkplus = xkmin + Kk*zk;

**SOD = SOD + xkplus;**

pkplus=(1-Kk*Hk)*pkmin*(1-Kk*Hk)+Kk*R*Kk;

pkplus=(1-Kk*Hk)*pkmin*(1-Kk*Hk)+Kk*R*Kk;

Prediction Updates for the next iteration

**Ak = 1**; //it is the transition coefficient

**xkmin = Ak*xkplus;**

pkmin = Ak*pkplus*Ak + Q;

pkmin = Ak*pkplus*Ak + Q

The idea is to get measurement of the battery terminal voltage to estimates the state of discharge.

The state of the system xkmin is the change in SOD. uk is the change of battery terminal voltage from the actual measurement. R is measurement noise covariance (assumed to be 1). Q is process noise covariance (assumed to be 0.5).

My problem is in order to get the filter to work at its best, both Q and R must not be constant. This is due to the fact that the system is non-linear system which is linearized and both R and Q may be changing with each time step. I have read some research paper on how to do "tuning" of these two parameters, but always ended up with unsuitable approach. If anyone here have experience with Kalman Filter, your help and suggestions would be really appreciated. Thank you in advanced.