How to calculate SOC

My aim is to calculate SOC how to do that ?
load('B0056.mat');
for i=1:252
Type=B0056.cycle(i).type;
if strcmp(Type,'discharge')==1
Voltage_measured=B0056.cycle(i).data.Voltage_measured;
Current_measured=B0056.cycle(i).data.Current_measured;
Temperature_measured=B0056.cycle(i).data.Temperature_measured;
Current_charge=B0056.cycle(i).data.Current_charge;
Voltage_charge=B0056.cycle(i).data.Voltage_charge;
Time=B0056.cycle(i).data.Time/3600;
Capacity=B0056.cycle(i).data.Capacity;
for j=1:length(Current_measured)
if (j == 1)
SOC0 = 0;
else
State =(SOC0 + ((Current_measured(j)*(Time(j)-Time(j-1)))/Capacity))*100;
end
end
SOC=State;
A=[ Voltage_measured', Current_measured',Temperature_measured',Current_charge',Voltage_charge',Time',SOC'];
a=strcat('B0056.cycle(', num2str(i),').charge.xlsx');
xlswrite(a,A);
Shows error
Error using horzcat
Dimensions of matrices being concatenated are not consistent.

3 Comments

load('B0006.mat');
for i=1:252
Type=B0006.cycle(i).type;
if strcmp(Type,'discharge')==1
Voltage_measured=B0006.cycle(i).data.Voltage_measured;
Current_measured=B0006.cycle(i).data.Current_measured;
Temperature_measured=B0006.cycle(i).data.Temperature_measured;
Current_charge=B0006.cycle(i).data.Current_charge;
Voltage_charge=B0006.cycle(i).data.Voltage_charge;
Time=B0006.cycle(i).data.Time/3600;
Capacity=B0006.cycle(i).data.Capacity;
for j=1:length(Current_measured)
if (j == 1)
SOC0 = 0;
else
State =(SOC0 + ((Current_measured(j)*(Time(j)-Time(j-1)))/Capacity))*100;
end
end
end
end
SOC=State;
A=[ Voltage_measured', Current_measured',Temperature_measured',Current_charge',Voltage_charge',Time',SOC'];
a=strcat('B0006.cycle(', num2str(i),').charge.xlsx');
xlswrite(a,A);
You keep forgetting to attach 'B0056.mat' so no one is answering.
we can not upload it here because it exceeded 5 MB
if you would like to help please send your email

Sign in to comment.

Answers (0)

Categories

Asked:

on 14 Feb 2019

Commented:

on 26 Apr 2021

Community Treasure Hunt

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

Start Hunting!