Characterize Battery Block Parameters in CAGE
After preprocessing the data and initializing the battery parameters, use feature filling in the MBC Optimization app (CAGE) to characterize the battery parameters.
Note
This example shows how to use CAGE to characterize battery block parameters. A
script-based approach is also available using the characterizeBattery method. For more information, see Characterize Battery Equivalent Circuit Block (Code).
Import Model and Data Set
Load the model and data files:
Open the CAGE Browser. In MATLAB®, in the Apps tab, in the Automotive section, click MBC Optimization.

Click Feature Filling and select the appropriate model file. For this example, select the
Simscape_Battery.slxmodel file that contains the Battery Equivalent Circuit (Simscape Battery) block. Click Open.
In the Battery Data Folder window, select the folder
HPPC_Data/origPreprocessedDatathat contains the preprocessed data files. Click Select Folder.Note
Supported data file formats include:
Excel
CSV
MAT — containing a single table object
The required variables must be available in all the files within the folder. You will receive an error message if you select a folder with files that do not meet these requirements. You must start the process again from a new CAGE project or configure the fill process using the Feature Fill wizard.
Calibrate the Block
After selecting the model and data set, the Import Battery Block dialog box opens.
You can adjust the bounds and initial values for the resistances and time constants directly from the Import Battery Block dialog box. It is recommended to enable the Use measured SOC option if you have measured SOC data available. In this example, you do not need to modify the bounds or initial values. Enable the Use measured SOC option to utilize the SOC that was calculated in the preprocessing step, Modify Original Data Set.
For more information on specifying Import Battery Block dialog box options, see Calibrate the Block.
Click OK to start the feature fill.

The Fill Progress dialog box opens and starts parameter estimation.
To view a lookup table in the Lookup Table Preview tab on the CAGE browser while the model calibrates, select from the Lookup Table Display list in the Fill Progress dialog box.
For this example, click Accept after 45 iterations. After 45 iterations, the lookup table values stop changing.

Click Accept again. Lookup table values are automatically written back to the variables stored in the base workspace.
Validate Results
Validate the calibration using a similar but independent preprocessed battery data set. Inspect the fit of the parameters by viewing plots generated by CAGE to determine how well the model predicts. For more information, see Validate Feature Fill.
To import an independent data set, from the Common Tasks pane, click Validate.

Select File from the Import Data dialog box. Then, select a data set to validate your results. For this example, select the file
validation_data/validationData25degC.mat.
After you choose your data file, the Data Set Import Wizard dialog box opens. Click Next.

CAGE automatically matches items from the right data columns list to CAGE variables in the left list. Click Finish.
Note
If CAGE does not find matches automatically for the names used in the Data Columns, you can manually match data columns to CAGE variables using the arrow buttons. For more information using the Data Set Import Wizard, see Set Up Data Sets.

From the CAGE Browser, click the Validation tab and select the imported data set from the list on the right. View the results using one of these four plot types combined with the RMSE value to determine how well the model predicts:
Comparison plot
Scatter plot matrix
Timeseries plots
Histogram
The orange line in the graph is the measured data. The blue line is the predicted result.

See Also
Calibrate Powertrain Blockset and Simscape Battery Blocks