Scilab Design Battery-Simulation
Scilab Design Battery-Simulation
org/ev-design-%E2%80%93-battery-simulation
--
There are several methods used for mathematical modeling. For a better
understanding of the methods, advantages and disadvantages, read the
article Methods of mathematical modeling. In our case, we are going to focus on
white-box modeling, using physical principles (equations).
If there is no load connected to the battery, the current through the battery will be
zero and the terminal voltage will be equal with the source voltage. This is
called open circuit voltage.
1 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
The higher the internal resistance of the battery, the higher the voltage drop on it,
the higher the power losses of the battery. For any applications, including battery
electric vehicles, the value of the internal resistance should be as small as possible.
The open circuit voltage of a battery depends on the depth of discharge and can be
approximate by empirical equations [1]. For lead-acid batteries, the open circuit
voltage is directly proportional with the state of charge of the battery and can be
calculated with the following equation:
where:
n [-] – number of battery cells
DOD [-] – depth of discharge
E [V] – open circuit voltage
For nickel-cadmium batteries, the open circuit voltage is non linear and needs
to be approximated by a polynomial. A good fit, produced from experimental result,
is the equation [1]:
We can use Scilab in order to plot the open circuit voltage for a lead-acid and a
nickel-cadmium battery. In this case we are going to create a Scilab function (*.sci)
which has as arguments (inputs): the number of cells, the depth of discharge and
the type of battery and outputs: the open circuit voltage.
// x-engineer.org
// Function for open circuit voltage calculation
// inputs: DoD [-] - depth of discharge
// Nc [-] - number of battery cells
// batt_type [string] - type of battery
// output: E [V] - battery open circuit voltage
function y = Ebatt(DoD,Nc,batt_type)
if batt_type=="lead-acid" then
y=(2.15-(2.15-2.00)*DoD)*Nc;
elseif batt_type=="nickel-cadmium" then
y=(-8.2816*DoD.^7+23.5749*DoD.^6-30*DoD.^5+23.7053*DoD.^4- ..
2 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
12.5877*DoD.^3+4.1315*DoD.^2-0.8658.*DoD+1.37)*Nc;
else
disp("Type of battery should be ""nickel-cadmium"" or ""lead-acid""");
end
endfunction
The open circuit voltage function is called in another Scilab script (*.sce) which
also generates the plot of the results.
// x-engineer.org
exec("Ebatt.sci") // load battery voltage function
DoD = [0:0.001:0.99]; // depth of discharge
Nc = 6; // number of cells
// Nickel-cadmium
figure(0)
plot(DoD*100,Ebatt(DoD,Nc,"nickel-cadmium"))
hf=gcf();
hf.background=8;
xgrid()
xlabel("Depth of discharge [%]")
ylabel("Nickel-cadmium battery (6 cells) voltage [V]")
title("x-engineer.org")
xs2png(hf, 'Nickel-cadmium battery (6 cells) voltage.png')
// Lead-acid
figure(1)
plot(DoD*100,Ebatt(DoD,Nc,"lead-acid"))
hf=gcf();
hf.background=8;
xgrid()
xlabel("Depth of discharge [%]")
ylabel("Lead-acid battery (6 cells) voltage [V]")
title("x-engineer.org")
xs2png(hf, 'Lead-acid battery (6 cells) voltage.png')
The depth of discharge is set between 0 (fully charged) and 0.99 (discharged, flat).
After running the script file, two images are going to be generated and also saved in
the Scilab working folder as *.png files. The script is run for two different cases:
first, only for 1 cell, second, for a battery containing 6 cells. The results can be seen
in the images below.
3 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
The voltage of the cell (battery) is not constant but depends on the depth of
discharge (state of charge) of the battery. The more discharged a battery is, the
lower the voltage at the terminals.
In reality, the capacity of the battery depends on the amount of current drawn from
the battery. If the current is drawn more quickly, the capacity of the battery is
reduced. For example, drawing 20 A for 1 h does not take the same electrical charge
as drawing 40 A for 0.5 h. The higher the current drawn from the battery, the lower
the capacity. This phenomenon occurs due to the internal resistance of the battery.
Ah higher currents, the internal resistance of the battery also increases (due to
higher temperatures) which makes less current to be available at the battery
terminals.
4 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
The battery voltage also depends on the amount of current drawn from the
battery. The higher the current, the lower the voltage. This phenomenon also occurs
due to the increase of the internal resistance of the battery. The higher the internal
resistance, the higher the voltage drop on it, the lower the voltage at the battery
terminals.
where:
SOC – state of charge [-]
SOC0 – initial state of charge [-]
i – electrical current [A]
Q – battery capacity [Ah]
Based on equation (5) and using input battery parameters, we can create an Xcos
block diagram model for the estimation of the battery state of charge.
5 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
The Integrator is initialised with the start value of the battery state of charge. The
input signal Ibatt [A] is the current drawn from the battery, which is divided by
the battery capacity. When the battery is discharged, the input Ibatt [A] is positive
but it’s converted to negative for the Integrator since it needs to remove charge.
When the battery is charged, the input Ibatt [A] is negative and it’s converted to
positive for the Integrator since it adds charge.
The outputs of the model will be the battery state of charge SOC [%] and the battery
voltage Ubatt [V]. Since the voltage depends on the battery state of charge, a liner
interpolation block Interp is used to compute the battery voltage.
6 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
tsim=2⋅πω(6)
The simulation parameters can also be included in the Scilab script (*.sce).
// Electrical current generator (sinus)
I0_A = 150; // current amplitude
omega_radps = 0.001; // current frequency
simTime_s = 2*%pi/omega_radps; // simulation time
The input current, battery state of charge and battery voltage are saved in a Scilab
parameter sOut which can be found in the workspace at the end of the simulation.
Running the simulation model and plotting the results, gives:
With the input current, the battery is discharge to 10 % state of charge in around
3000 s. Afterwards, it is increased back to 100 % SOC receiving a charging current.
The battery voltage drops also to 350 V when the state of charge is at its minimum.
This model is very simple but good enough to give an estimation of the state of
charge of the battery when the vehicle is driven on a standard cycle. With this
model, integrated into a vehicle model, the range can be estimated for several
7 of 8 23/11/2020 22:59
EV design – battery simulation | www.scilab.org https://www.scilab.org/ev-design-%E2%80%93-battery-simulation
References:
[1] James Larminie, John Lowry, Electric Vehicle Technology Explained. John
Wiley & Sons, 2003.
[2] M. Ehsani, Y. Gao, A. Emadi, Modern Electric, Hybrid Electric, and Fuel Cell
Vehicles – Fundamentals, Theory, and Design, 2nd edition, CRC Press, 2010.
8 of 8 23/11/2020 22:59