필터 지우기
필터 지우기

What are the crucial parameters that are to considered in the state space model while estimating the state of charge of batteries ?

조회 수: 2 (최근 30일)
Here estimation of charge is carried out using extended Kalman filtering, I am unclear how do we model the uncertainties involving the battery , howto incorporate them in our state space ekf model for estimation.
I am unable to get a correct estimation. I am using Matlab scripting to realize the EKF. I am not sure why the script fails to estimate accurately
How do we choose noise parameter Q and R here.
Kindly someone explain to me what exactly is to be considered in these places.
%For this filter I use: %x: state vector, containing the state of charge (%) and a voltage (V) %I_meas: current measures %U_meas: voltage measures %h_est: voltage prediction %f: state function, giving its values to x %Loading of the measures data = SimData;%csvread('Measurements.csv'); % Opens of the measures file %len=size(data,1); % Number of data samples len=size(SimData)-5000; time=data(:,1)-5000; % 2nd column of the file: time U_meas=data(:,4); % 5th column: voltage I_meas=data(:,3); % 6th column: current
% Circuit and measure variables of electric battery model eta=1; % Coulombic efficiency: 1 for discharge, <1 for charge tau_Diff=L_Rdiff*L_Cd; % [s] Time constant of the RC ladder Cnom=18; % [Ah] Battery capacity dt=time(2)-time(1); %dt=1;
% Uncertainties initialization n=2; % Number of states: x(1):SoC, x(2):V_Diff q=0.2979; % Stdiv of process (voltage) % is it standard deviation or variance of the or the whole terminal voltage itself r=4.0028; % Stdiv of measurement (current)% is it the current as a whole to be considered or error current Q=q^2*eye(n); % Covariance of process R=r^2; % Covariance of measurement
% Initial states x_k_1 = [100;3.4910]; % Initial state: Soc=100%, U=0 P_k_1 = eye(n); % Initial state covariance
% OCV(SoC) model %how do we choose the right model i used poly fit\poly % trend OCV=@(socm)((3.82 * 10^-10) * socm^5 - (1.21 * 10^-7) * socm^4 + (1.51 * 10^-5) * socm^3 - (9.3 * 10^-4) * socm^2 + (0.0295* socm) + 2.85); %L_VOC = a8 * M_SOC.^8 + a7 * M_SOC.^7 +a6 * M_SOC.^6 + a5 * M_SOC.^5 + a4 * M_SOC.^4 + a3 * M_SOC.^3 + a2 * M_SOC.^2 + a1 * M_SOC.^1 + a0 % Function definition matrices Ak=[1 0;0 exp(-dt*eta/(L_Rdiff*L_Cd))]; Bk=[-dt*eta/L_Cd;L_Rdiff(1-exp(-dt/L_Rdiff*L_Cd))];
% Main loop
for k=1:len
% Observation function
h_est=@(x)(OCV(x(1))-((I_meas(k)*Ini_Ri)-x(2)));
% State prediction function
f=@(x)(Ak*x+Bk*I_meas(k));
% *** START OF EKF ***
% Calculation of the Jacobians
[x1,A]=jaccsd(f,x_k_1); % Constant value
[z1,H]=jaccsd(h_est,x1); % Varies with OCV(SoC)
% *** PREDICTION ***
x_k_ = Ak*x_k_1+Bk*I_meas(k);
% Prediction of the plant covariance
P_k_ = Ak*P_k_1*(Ak)' + Q;
% *** UPDATE ***
% Kalman gain
K = P_k_*H'*inv(H*P_k_*H'+R);
% Update estimate with measurement U_meas
x_k = x_k_ + K*(U_meas(k)-h_est(x_k_));
% Update the error covariance
P_k = (eye(n)-K*H)*P_k_;
% *** END OF EKF ***
% STORING OF VALUES
x_store(k,:)=x_k;
x_store_(k,:)=x_k_;
h_store(k)=h_est(x_k_);
% PREPARATION OF THE VARIABLES FOR THE NEXT K
x_k_1=x_k;
P_k_1=P_k;
if(k<(len-1)) dt=time(k+1)-time(k); end if (dt==0) if (k>1) dt=(time(k-1)+time(k+1))/2; else dt=1; jk = jk+1; end end
end
% Results plot
% State of charge figure(1) subplot(3,1,1) plot(time,data(:,2),time,x_store(:,1)) title('State of Charge') h_legend = legend('Actual value','Update',2); set(h_legend,'Interpreter','none')
% I current subplot(3,1,2) plot(time,I_meas,'-') title('I: battery current')
% U voltage subplot(3,1,3) plot(time,U_meas,'-',time,h_store,'--') title('U: battery voltage')
Error = x_store(:,1) - data(:,2); variance = var(Error)
% figure(2) % subplot(3,1,1) % plot(time,data(:,2),time,x_store(:,1)) % title('State of Charge') % h_legend = legend('Actual value','Update',2); % set(h_legend,'Interpreter','none') % % % error % subplot(2,1,2) % plot(time,Error,'-',variance,'***'); % title('Error and Variance')

답변 (1개)

Sabin
Sabin 2023년 9월 30일
A good place to start is Simscape Battery. Check out the SOC Estimator (Kalman Filter) doc page for more insights into how the estimator is designed.

카테고리

Help CenterFile Exchange에서 Estimators​에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by