# Perform Grouped Estimation of Model Parameters for Single-Particle Battery Model

This example shows how to estimate the parameters of a single-particle model with electrolyte dynamics (SPMe) of a Li-ion battery. You estimate the model parameters to match the voltage output of the battery model to a measured voltage response.

You first use the Sensitivity Analyzer app to evaluate the influence of the model parameters on the match between the model output and the measured data and then group the model parameters based on the strength of their influence. Finally, you use the Parameter Estimator app to estimate the parameters in groups, in a sequence of decreasing influence.

### Single-Particle Battery Model

Open the Simulink® model.

`open_system('sdoSPMBattery');`

The `sdoSPMBattery`

model simulates the battery terminal voltage in response to a hypothetical dynamic pulsed current profile. You use the Battery Single Particle block from Simscape™ Battery™ to model the battery behavior in the simulation.

The` `

Battery Single Particle block implements an electrochemical model for Li-ion batteries. It is a simplified electrochemical model that follows a typical single-particle model with electrolyte dynamics (SPMe) framework. For more information on the single-particle approach to model a battery, see the documentation for the Battery Single Particle block from Simscape™ Battery™.

There are lots of parameters associated with an electrochemical model for Li-ion batteries. These parameters can be related to the cell design, the cell equilibrium (or static) behavior, and the cell dynamic behavior. In this example, you estimate the following battery design parameters for the model:

The Cathode Particle Radius (

`CPR`

), with a baseline value of $$5.5\times 1{0}^{-8}$$, ranging from a minimum of $$4\times 1{0}^{-8}$$ (`CPR_min`

) to a maximum of $$6\times 1{0}^{-8}$$ (`CPR_max`

).The Anode Particle Radius (

`APR`

), with a baseline value of $$5\times 1{0}^{-6}$$, ranging from a minimum of $$4\times 1{0}^{-6}$$ (`APR_min`

) to a maximum of $$6\times 1{0}^{-6}$$ (`APR_max`

).The Cathode Diffusion Coefficient (

`CDC`

), with a baseline value of $$3\times 1{0}^{-20}$$, ranging from a minimum of $$1{0}^{1.02\times lo{g}_{10}(5.9\times 1{0}^{-20})}$$ (`CDC_min`

) to a maximum of $$1{0}^{0.98\times lo{g}_{10}(5.9\times 1{0}^{-20})}$$ (`CDC_max`

).The Anode Diffusion Coefficient (

`ADC`

), with a baseline value of $$3\times 1{0}^{-15}$$, ranging from a minimum of $$1{0}^{1.02\times lo{g}_{10}(3\times 1{0}^{-15})}$$ (`ADC_min`

) to a maximum of $$1{0}^{0.98\times lo{g}_{10}(3\times 1{0}^{-15})}$$ (`ADC_max`

).

To avoid a degenerate solution to the parameter estimation, you create the input current profile by superimposing two pulsed current profiles of different amplitudes. However, you can use a different current profile based on the nature of the estimation problem. It is generally important and necessary to carefully design a current profile such that the measured voltage encodes enough information for estimating battery model parameters. Although there may be scope for current profile optimization in this kind of model parameter estimation project, this example assumes that the superimposed pulsed current profile is the one selected and focuses on demonstrating the workflow of sensitivity analysis and parameter estimation.

### Group** **Model** **Parameters** **Using** **Sensitivity** **Analysis

Perform sensitivity analysis to group the model parameters according to the influence of the model parameters on the fit of model response to experimental data. You use such grouping to perform group-wise parameter estimation where the model parameters with higher sensitivities are estimated before those with lower sensitivities.

#### Specify Design Variables and Generate Analysis Values

To open the Sensitivity Analyzer app, in the Simulink model window, in the **Apps** gallery, click **Sensitivity Analyzer**.

In the **Sensitivity Analysis** tab, in the **Select Parameters** drop-down list, select **New**. To create a parameter set that includes the model design parameters, in the Select Parameters dialog box, select `CPR`

, `APR`

, `CDC`

, and `ADC`

, and click **OK**. The parameter set appears as `ParamSet`

under the **Parameter Sets** section of the app.

Create a gridded space of parameter values. Select `ParamSet`

and in the **Sensitivity Analysis** tab, in the **Generate Values **drop-down list, select **Generate Gridded Values**. In the Generate Gridded Parameter Values dialog box, in the **Starting Values** section, set up each parameter to take its minimum and maximum values.

To create combinations of parameter values, in the **Gridding Method** section, select `Min-Max Combinations`

and click **OK**.

Doing so populates the parameter set `paramSet`

with the parameter combinations.

#### Add Signal Matching Requirement

Create a requirement to match the model response to the experimental data. In the **Sensitivity Analysis** tab, in the **New Requirement** drop-down list, select **Signal Matching**. To associate the measured voltage data with the voltage output of the model, in the Edit Signal Matching: SignalMatching dialog box, under the **Outputs** section, click **Select Signals** and in the Select Outputs dialog box, select the t`erminal voltage (V)`

** **output of the** **Probe** **block and click **OK**.** **Configure the measured data by populating the **Time** field as `VoltageMeasTime`

** **and** **the **Data** field as `VoltageMeasData`

. Note that the measured data used in this example is hypothetical and only for demonstrative purposes. Click **Close**.

A new requirement `SignalMatching`

appears in the **Requirements** section of the app. Rename the requirement as `VoltageMatching`

by slowly double-clicking on it.

#### Perform Sensitivity Analysis and Group the Model Parameters

To evaluate the requirement values at the different parameter values in `ParamSet`

, in the **Sensitivity Analysis** tab, click **Evaluate Model**. The results appear as a new evaluation result `EvalResult`

in the **Results** section of the app.

Compute the sensitivity of the `SignalMatching`

requirement to model parameters. In the **Statistics** tab:

In the

**Evaluation Result to Analyze**drop-down list,**EvalResult**.For the

**Method**, select**Correlation**.For the

**Type**, select**Linear**.

Click **Compute Statistics**. A new statistics result `StatsResult`

appears in the **Results** section of the app. Also, a tornado plot appears in the app that quantifies the influence of the model parameters on the `VoltageMatching`

requirement. You can also create the tornado plot by selecting `StatsResult`

and clicking **Tornado Plot** in the **Plots** tab.

Now, divide the model parameters into groups based on the relative magnitude of their influence on the `VoltageMatching`

requirement. For this example, divide the model parameters into two groups:

The "High-Sensitivity" group consisting of the parameters

`CDC`

and`CPR`

.The "Low-Sensitivity" group consisting of the parameters

`ADC`

and`APR`

.

Note that you can use a different grouping criteria based on the number of parameters, the influence of parameters on the design requirements, and the nature of the estimation problem.

To directly view the sensitivity analysis results obtained in this example, open the session `sdoSPMBattery_sasession.mat`

.

### Estimate Model Parameters

Perform group-wise estimation of model parameters.

#### Create Parameter Estimation Session

In the **Sensitivity Analysis** tab, in the **Optimize** drop-down list, click **Create Parameter Estimation Session**. A new Parameter Estimation dialog box opens up. To import the `VoltageMatching`

requirement into the parameter estimation session, select the `VoltageMatching`

experiment and click **OK**. A new experiment, `VoltageMatching`

, appears in the **Experiment** section of the Parameter Estimator app. Also, an experiment plot appears in the app.

In the **Parameter Estimation** tab, click **Select Parameters**. In the Edit: Estimated Parameters dialog box, click **Select Parameters** and in the Select model variables dialog box, select the four continuous model parameters (`CDC`

, `CPR`

, `ADC`

, and `APR`

) for tuning. The four parameters appear in the Edit: Estimated Parameters dialog box.

By default, the minimum bound and the maximum bound on each parameter is set to `-Inf`

and `Inf`

respectively. Change the bounds on each parameter to their respective minimum and maximum bounds. Click **Close**.

Right-click on the `VoltageMatching`

requirement and click `Plot measured and simulated data`

. Observe the initial mismatch between the model response and the measured data.

Configure the optimization options. In the **Parameter Estimation** tab, in the **More Options** drop-down list, select **Optimization**. For this example, in the Estimation Options dialog box, under the **Optimization** tab, set the **Method** to **Gradient descent** and the **Algorithm** to **Interior-Point**. Click **OK**.

#### Estimate High-Sensitivity Parameters

Estimate the high-sensitivity parameters to get a better initial guess for them. These are the parameters that most influence the matching of model output to measured data.

To open the Edit: Estimated Parameters dialog box, double-click on a parameter in the **Parameters** section. To estimate the high-sensitivity parameters, unselect the **Estimate** check box for the parameters `ADC`

and `APR`

. Keep the **Estimate** check box selected for the `CDC`

and `CPR`

parameters. Click **Close**.

In the **Parameter Estimation** tab, click **Estimate**.

The estimation converges with the high-sensitivity parameters (`CDC`

and `CPR)`

tuned to best fit the simulation data to the measured data while keeping the low-sensitivity parameters (`ADC`

and `APR)`

unchanged. After the estimation, a new evaluation result `EstimatedParams`

appears in the **Results** section of the app.

#### Estimate High-Sensitivity and Low-Sensitivity Parameters

With the initial value of the high-sensitivity parameters estimated, now estimate high-sensitivity and low-sensitivity parameters together.

To open the Edit: Estimated Parameters dialog box, double-click on a parameter in the **Parameters** section. To estimate the low-sensitivity parameters, select the **Estimate** check box for the parameters `ADC`

and `APR`

. Keep the **Estimate** check box selected for the `CDC`

and `CPR`

parameters. Click **Close**.

In the **Parameter Estimation** tab, click **Estimate**.

The estimation converges with both the high-sensitivity parameters (`CDC`

and `CPR`

) re-tuned and the low-sensitivity parameters (`ADC`

and `APR`

) tuned to best fit the simulation data to the measured data. Note that the improvement in the fit is small, indicating that the initial values of the high-sensitivity parameters are well tuned.

The software updates the evaluation result `EstimatedParams`

with the newly estimated parameter values.

To directly view the parameter estimation results obtained in this example, open the session `sdoSPMBattery_spsession.mat`

.

Close the model.

`close_system('sdoSPMBattery');`

### Summary

This example presents the workflow to perform sensitivity-based group-wise parameter estimation of model parameters. In this approach, you perform a preliminary tuning of high-sensitivity parameters before performing a final parameter estimation of all model parameters. The preliminary tuning results in a better initial guess for the high-sensitivity parameters, which can help the final estimation session converge faster.

You can apply the approach demonstrated in this example to a variety of other parameter estimation scenarios with a larger number of parameters and complex models.