Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Twin Builder Modelica BatteryECMCell Library Page 1 of 13

Twin Builder Modelica BatteryECMCell

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 2 of 13

Twin Builder Modelica BatteryECMCell


Library
The BatteryECMCell library is available in the Twin Builder Modelica environment. It provides a set of
templates of equivalent circuit models (ECM) for battery cells. ECM is a battery modeling approach,
which represent the cell’s impedance response to its operating conditions.

Structure of the BatteryECMCell Library


The BatteryECMCell library is automatically loaded into the component manager in the Twin Builder
Modelica environment as shown below:

The library contains four common ECM circuits, for which the cell dependent parameters are editable
in model properties. The 4P models contain four key parameters for voltage-current characteristics.
Similarly, the 6P models contain six key parameters due to a higher order of transient response.
Model names ending with SOC indicate that they are state of charge (SOC) dependent models, for
which the parameters are functions of SOC. Model names ending with SOCTemp indicate the model
depends on both SOC and temperature, for which the parameters are 2D lookup tables.

Model Description
Internal diagrams of each of the models are shown below:

Cell4P_SOC

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 3 of 13

Cell4P_SOCTemp

Cell6P_SOC

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 4 of 13

Cell6P_SOCTemp

Model Pins:

Name Description Type


P Positive terminal of battery electrical
N Negative terminal of battery electrical
Power Power loss real output
Temp_In (for temperature

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 5 of 13

dependent model only) Temperature real input

List of parameters for 4P models

Name Description
Value of Ccapacitor, for modeling battery
Ccapacity
capacity
Initial voltage of Ccapacitor, which indicate initial
initialVoltage
SOC of the cell, range 0 to 1
voc or voc_table Open-circuit voltage
rseries or reseries_table Internal resistance
For modeling the transient of current pulse
rt or rt_table
response
For modeling the transient of current pulse
ct or ct_table
response

List of parameters for 6P models

Name Description
Value of Ccapacitor, for modeling battery
Ccapacity
capacity
Initial voltage of Ccapacitor, which
initialVoltage indicates initial SOC of the cell, range 0
to 1
voc or voc_table Open-circuit voltage
rseries or reseries_table Internal resistance
For modeling the transient of current
rt_s or rt_s_table
pulse response
For modeling the transient of current
ct_s or ct_s_table
pulse response
For modeling the transient of current
rt_l or rt_l_table
pulse response
For modeling the transient of current
ct_l or ct_l_table
pulse response

Each ECM model contains an SOC sub-circuit of a Ccapacitor and a current source: IBatt. Current
for IBatt is controlled by the cell’s output current. The voltage across this sub-circuit (IBatt.v) should
be within [0,1], which measures the SOC. Thus, the cell’s capacity when fully charged should be
Ccapacity*1 in coulombs, and the initial charge is Ccapacity*initialVoltage in coulombs.

The remaining parameters: voc, rseries and the transient related RC parameters, can be determined
through Hybrid Pulse Power Characterization(HPPC) data of a given battery cell. For models
Cell4P_SOC and Cell6P_SOC, these parameters should be a function of SOC=IBatt.v; For models
Cell4P_SOCTEMP and Cell6P_SOCTEMP, these parameters should be a 2D lookup table of SOC
(in rows) and temperature (in columns)

UI Operations to Set Parameters

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 6 of 13

In the Twin Builder Modelica environment, the various parameters of the ECM models can be edited
as follows:

1. After dragging and dropping an ECM model into the Modelica diagram editor, click on the model
to show its properties in the Properties Window. The parameters are grouped under multiple
tabs.
2. First, you should change the InstanceName listed in Properties Window>Properties tab as
needed, because this name may be used in SOC dependent parameter expressions.

3. Next, set the other parameters, which are listed in the General and Initialize tabs:

For model Cell4P_SOC and Cell6P_SOC:

initialVoltage can be set in General tab, in Value of initialVoltage; the other parameters need to
be set in Initialize tab, by clicking the button next to each parameter. The following figure
shows an example of setting parameter voc of a Cell6_SOC instance. By clicking the
button next to voc, the Edit voc window is opened, in which user can input the desired voc
value in Value or check Edit Text then input in format voc = VocValue.

In this case the parameter is in form of:

voc= a0+a1*SOC+a2*SOC2+…+a5*SOC5

in which variable SOC is the state of charge measured in this very cell.

In Modelica, the internal variable of an instance is referred to by syntax


InstanceName.VariableName. For this cell, InstanceName is Cell6P_SOC, so

SOC=Cell6P_SOC.IBatt.v

in which IBatt.v refers to voltage across IBatt, which measures the cell’s SOC. So the final input
value is in the form shown in the following figure.

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 7 of 13

For model Cell4P_SOCTemp and Cell6P_SOCTemp:

Ccapacity can be set on the Initialize tab by clicking the button next to the parameter. The
other parameters can be set on the General tab, either directly in Value, or by clicking the
button next to each parameter. By clicking the button next to voc, the Add Table window
opens. The following figure shows an example of setting parameter voc_table of a
Cell6_SOCTemp instance.

All the 2D lookup tables in ECM models are arranged in the following format: SOC is the first
dimension that begins each row; and temperature is the second dimension that begins each
column. The top left element in a table is always 0. This is shown below, using the voc_table as
an example:

0 T1 T2
SOC1 VOC11 VOC12

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 8 of 13

SOC2 VOC21 VOC22


SOC3 VOC31 VOC32

For this table, the syntax of Modelica text would be:

voc_table=[0,T1,T2; SOC1,VOC11,VOC12; SOC2, VOC21, VOC22; SOC3,VOC31,VOC32]

In the Add Table window, you can either specify table size then input table element one by one,
or organize the table according to the syntax, then input the whole table in the Edit Text field
starting start with ‘[‘ and end with’]’. You also have the option to store the table in an Excel
or .csv file, then Import in the Add Table window.

Examples
Demo examples are included with the installation for the two 6P models. Both examples include a
battery module built in the Twin Builder Modelica environment. It is compiled to be a component in the
Twin Builder design, in which the battery is discharged by a current pulse source, to show the voltage-
current characteristics. The examples show:

How to use the ECM models in the Modelica environment.


How to connect a compiled Modelica component with other Twin Builder components in a Twin
Builder schematic.

When using a Modelica component in a Twin Builder Schematic, note that only non-conservative
input/output pins are supported (in Modelica terminology, these are referred to as causal pins).
Consequently, you cannot make direct electrical connections with a Modelica battery model. To solve
this problem, an additional interface circuit, shown in figure below, is needed to transfer the different
connection types. Half of the interface is in Modelica diagram, which transfers electrical pins to
input/output pins, while the other half of the interface is built into the Twin Builder schematics to
transfer the input/output pins back to electrical nodes. In both examples, the use of such interface
circuits are demonstrated.

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 9 of 13

In addition to the approach introduced above, Twin Builder also provides the option of using the
Modelica Connector Library to create Modelica subsystems with conservative connections. For details
on this option, refer to Twin Builder Modelica Connector Library.

BatteryECM_Cell6P_SOC Example
The Twin Builder design can be found in this location:

<ANSYS EM Installation> Win64\Examples\Twin Builder\Modelica\Twin Builder


BatteryECMCell\BatteryECM_Cell6P_SOC.aedt

In this example, a simple 2-cell battery module is built in Modelica diagram using the Cell6P_SOC
model, as shown in the following figure. Electrical nodes are transferred to input/output pins, and the
power output of the two cell is summed and output to TotalPower.

In the Twin Builder schematic of the design, shown below, a test circuit is added to discharge the
battery (Modelica component) with a current pulse. Initial SOC of both internal cells are set to 1. The
two inputs of initialVoltage are made available in the top-level battery component by selecting them
as interfaces when compiling the Modelica model.

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 10 of 13

Output voltage response to the current pulse trigger, and the power loss of the battery are shown in
figures below.

SOC of the cells decreases during the discharge, and all the six cell parameters that are SOC
dependent also change accordingly. Simulation results of instance Cell6P_1 are shown below, in
which Cell6P_1_IBatt_v is the SOC value. These are made available as simulation outputs by
selecting them as interfaces when compiling the Modelica model.

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 11 of 13

BatteryECM_Cell6P_SOCTEMP Example
The Twin Builder design can be found in this location:

<ANSYS EM Installation> Win64\Examples\Twin Builder\Modelica\Twin Builder


BatteryECMCell\BatteryECM_Cell6P_SOCTEMP.aedt

In this example, a simple 1-Tcell battery module is built in Modelica diagram using the
Cell6P_SOCTemp model, as shownbelow. Electrical nodes are transferred to input/output pins, and
temperature input pin and power output pin are added.

In the Twin Builder schematic of the design, shown below, a test circuit is built to discharge the battery
(Modelica component) with a current pulse. Initial SOC of the internal cell is set to 1. The input of
initialVoltage is made available in the top-level battery component by selecting it as interface when
compiling the Modelica model. In addition, a temperature input is added since the model is both SOC
and temperature dependent. As a simple test case, a constant temperature input is used. For the
purpose of smooth initialization, in the battery component’s properties, set

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 12 of 13

UseStartValueInitialization to “true” and set T_input_start according to input temperature.

Simulation results shown here are obtained when temperature is 300 Kelvins. User can change to
other temperature values and observe behavior change. In real applications, the input temperature
can be a variable (typically the temperature output of a thermal model). Output voltage response to
the current pulse trigger, and the power loss of the battery are shown in figures below.

SOC of the cell decreases during the discharge, and all the six cell parameters that are SOC
dependent also change accordingly. Simulation results are shown below. These are made available
as simulation outputs, by selecting them as interfaces when compiling the Modelica model.

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19
Twin Builder Modelica BatteryECMCell Library Page 13 of 13

mk:@MSITStore:C:\Program%20Files\AnsysEM\AnsysEM19.3\Win64\Help\Twin%20B... 07-Oct-19

You might also like