├── BatteryModel_Sim.slx ├── Battery_Parameters.xlsx └── BatteryModel_Run.m /BatteryModel_Sim.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mo-Abouelea/Battery-Model-Simulation/HEAD/BatteryModel_Sim.slx -------------------------------------------------------------------------------- /Battery_Parameters.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mo-Abouelea/Battery-Model-Simulation/HEAD/Battery_Parameters.xlsx -------------------------------------------------------------------------------- /BatteryModel_Run.m: -------------------------------------------------------------------------------- 1 | %% Define the Battery Capacity 2 | Q = 2.3 * 3600; 3 | 4 | 5 | %% Read Excel Dataset 6 | Battery_Data = xlsread('Battery_Parameters.xlsx',1); 7 | SOC = Battery_Data(:,1); 8 | OCV = Battery_Data(:,2); 9 | R_Charging = Battery_Data(:,3); 10 | R_Discharging = Battery_Data(:,4); 11 | 12 | 13 | %% Plot SOC Vs. OCV, R+, and R- 14 | figure; 15 | plot(SOC, OCV); xlabel('SOC'); ylabel('OCV [V]'); title('SOC Vs. OCV') 16 | 17 | 18 | %% Plot SOC Vs. Internal Resistance 19 | figure 20 | subplot(2,1,1) 21 | plot(SOC, R_Charging); grid; xlabel('SOC'); ylabel('Charging Resistance [Ohms]'); 22 | title('SOC Vs. Charging and Discharging Resistances') 23 | legend('Charging Resistance') 24 | 25 | subplot(2,1,2) 26 | plot(SOC, R_Discharging ) 27 | grid; xlabel('SOC'); ylabel('Discharging Resistance [Ohms]'); 28 | legend('Discharging Resistance') 29 | 30 | %% Model Simulation with 2.3 A starting with a Fully Discharged Cell 31 | % Define the Input Current 32 | i = 2.3; 33 | sim('BatteryModel_Sim'); 34 | --------------------------------------------------------------------------------