- Identify the Charging and Discharging Periods: You can identify these periods based on the ‘step[SA1] _type’ column, or by observing the sign of the current column. Usually, a positive current indicates charging and a negative current indicates discharging.
- Calculate the Charge/Discharge for Each Time Step: The amount of charge transferred in each time step can be calculated by multiplying the current (in Amperes) by the time step (in hours). If your ‘total_[SA2] time_s’ column is cumulative time in seconds, you'll need to calculate the difference between each consecutive row to get the time step.
How to perform Coulomb Counting to predict SoC
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I am trying to calculate the charge and discharge values (Ah) using the attached Excel dataset. The sheet represents the test data for a cell which has started its test from a discharge of 3.0V (representing 0% SoC) and charges to 4.25V (representing 100% SoC). This has been done a few times as represented in the plot below (voltage plot). The charge/discharge values are already present in the last row of the sheet (step_amp_hours) at each instance of charge and discharge but I need to use Colomb Couting to prove if the required final results of Qcharge and discharge are correct. I believe I need to include a set of arrays from where each discharge cycle starts/ends and need to input it into the equation but Im not sure how to progress with this. (Columns C and H can be ignored in the Excel sheet)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502809/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502814/image.png)
Really appreciate any help with this.
Thankyou.
0 comentarios
Respuestas (1)
arushi
el 6 de Ag. de 2024 a las 8:38
Hi Mahnoor,
I understand that you want to calculate the charge and discharge values in Ampere-hours (Ah) using the Coulomb Counting method from your dataset. You want to verify the charge/discharge values already present in the 'step_amp_hours' column. Here's how you can approach this:
Please refer to the following code to get the desired results:
% Load your data
data = readtable('Dataset.xlsx');
% Calculate time step in hours
data.delta_t = [0; diff(data.total_time_s)] / 3600;
% Initialize charge/discharge arrays
data.charge = zeros(height(data), 1);
data.discharge = zeros(height(data), 1);
% Calculate charge/discharge for each time step
for i = 2:height(data)
if data.current(i) > 0
data.charge(i) = data.current(i) * data.delta_t(i);
elseif data.current(i) < 0
data.discharge(i) = data.current(i) * data.delta_t(i);
end
end
% Calculate cumulative charge/discharge for each cycle
data.cumulative_charge = cumsum(data.charge);
data.cumulative_discharge = cumsum(data.discharge);
% Reset cumulative charge/discharge at the start of each new cycle
for i = 2:height(data)
if data.total_cycle(i) > data.total_cycle(i-1)
data.cumulative_charge(i:end) = data.cumulative_charge(i:end) - data.cumulative_charge(i);
data.cumulative_discharge(i:end) = data.cumulative_discharge(i:end) - data.cumulative_discharge(i);
end
end
% Create a cycle index that goes from 1 to the number of unique cycles
[~, ~, cycle_idx] = unique(data.total_cycle);
% Calculate total charge/discharge for each cycle
TotalCharge = accumarray(cycle_idx, data.charge);
TotalDischarge = -accumarray(cycle_idx, data.discharge); % Negate to get positive discharge values
% Define total battery capacity
total_capacity_Ah = 4.25; % Replace with your battery capacity in Ah
% Calculate SoC at the end of each cycle
summary.SoC = zeros(height(summary), 1);
summary.SoC(mod(summary.Cycle, 2) == 1) = summary.TotalCharge(mod(summary.Cycle, 2) == 1) / total_capacity_Ah * 100; % At the end of charge cycles
summary.SoC(mod(summary.Cycle, 2) == 0) = summary.TotalDischarge(mod(summary.Cycle, 2) == 0) / total_capacity_Ah * 100; % At the end of discharge cycles
% Display the summary table with SoC
disp(summary)
Here are all the functions used in the MATLAB code snippets provided:
1. ‘readtable’: This function reads data from a file into a table.
2. ‘diff’: This function calculates the difference between consecutive elements of a vector.
3. ‘height’: This function returns the number of rows in a table or array.
4. ‘zeros’: This function creates an array of all zeros, with the size specified.
5. ‘cumsum’: This function calculates the cumulative sum of the elements of a vector.
6. ‘unique’: This function finds the unique elements in an array.
7. ‘accumarray’: This function accumulates values from an array based on their subscripts.
8. ‘table’: This function creates a table from input data.
9. ‘disp’: This function displays the value of a variable or expression.
10. ‘mod’: This function calculates the modulus after division.
Please refer to the following MATLAB documentation link to know more about the above functions:
I hope the above solution works.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!