main content

estimate model parameters per experiment (gui) -凯发k8网页登录

this example shows how to use multiple experiments to estimate a mix of model parameter values; some that are estimated using all the experiments and others that are estimated using individual experiments. the example also shows how to configure estimation experiments with experiment dependent parameter values.

you estimate the parameters of a rechargeable battery based on data collected in experiments that discharge and charge the battery.

open the model and get experimental data

this example estimates parameters of a simple, rechargeable battery model, sdobattery. the model input is the battery current and the model output, the battery terminal voltage, is computed from the battery state-of-charge.

open_system('sdobattery')

sdobattery_uidemo_01.png

the model is based on the equation

e=(1-loss)v-kqmax1-ss

in the equation:

e is the battery terminal voltage in volts.

v is the battery constant voltage in volts.

k is the battery polarization resistance in ohms.

qmax is the maximum battery capacity in ampere-hours.

s is the battery charge state, with 1 being fully charged and 0 discharged. the battery state-of-charge is computed from the integral of the battery current with a positive current indicating discharge and a negative current indicating charging. the battery initial state-of-charge is specified by q0 in ampere-hours.

loss is the voltage drop when charging, expressed as a fraction of the battery constant voltage. when the battery is discharging this value is zero.

v, k, qmax, q0, and loss are variables defined in the model workspace.

estimation experiment data

a 1.2v (6500mah) battery was subjected to a discharge and a charging experiment. this experiment data has been loaded into a preconfigured estimation session.

use the following commands to load the pre-configured estimation session.

load sdobattery_spesession
spetool(sdosessiondata)

the measured charge and discharge experiment data are loaded and plotted. click the arrow to the right of the plot tab and select tile all > left/right to lay out the plots so that the experiment plot:charge_exp and experiment plot:dcharge_exp are both visible. click plot model response to see how well the model simulation matches the measured experiment data.

the plots show that the battery initial charge q0 is not set correctly for the charge_exp experiment and that the model v, k, and loss parameters need to be estimated.

setting experiment parameter values

the previous plot indicates that the charge_exp battery initial charge, q0, is not set correctly. add the initial charge to both experiments. right click charge_exp and select edit. a dialog to edit the experiment opens.

click select parameters to open a dialog to add model parameters to the experiment. select loss and q0 to add to the experiment. select loss as we need to estimate this parameter using only the charge_exp experiment. click ok to add the q0 and loss parameters to the experiment.

set the battery initial charge q0 in the charge_exp to 0, i.e. there is no initial charge.

similarly add the battery initial charge q0 to the dcharge_exp experiment and set the initial charge to 6.5., i.e. for this experiment there is an initial charge.

now that the experiments are updated with the correct initial battery charge click plot model response to simulate the model and compare measured and simulated data.

the experiment plots show that the experiment initial conditions match but the battery response does not. the next step is to estimate the k and v model parameters.

select estimation parameters

the previous plot showed that the model response does not match the measured data and we need to estimate the model v and k parameters.

click select parameters to open a dialog to select model parameters.

the upper portion of the select parameters dialog has a section for parameters that are tuned using all experiments. click select parameters and add the v and k model parameters to the estimated parameters. set the v minimum to 0 and the maximum to 2, similarly set the k minimum to 1e-6 and maximum to 0.1.

the lower section of the dialog has a section for initial states and parameters that are tuned using individual experiments.

for the charge_exp we tune the loss parameter and set its minimum to 0 maximum to 0.5. the battery initial charge q0 is fixed to 0 and should not be estimated; uncheck estimate.

select dcharge_exp from the experiment combobox to view the parameter settings for the dcharge_exp experiment. the battery initial charge q0 is fixed to 6.5 and should not be estimated; uncheck estimate.

estimate parameter values

the experiments and estimated parameters are configured and we a ready to run the estimation. first create a plot to monitor the estimation progress. click add plot and select parameter trajectory. this creates a plot that shows how the estimated parameter values change during estimation. click the view tab to layout the plots so that the experiment and parameter trajectory plots are all visible.

click the estimate button to start the estimation. you can modify estimation options by setting the cost function combobox and clicking more options.

while the estimation is running the plots update and a dialog showing estimation progress appears. the progress dialog shows the estimation iterations, the number of times the model has been evaluated (f-count), and the estimation cost at each iteration.

after a number of iterations the estimation converges and terminates. the experiment plots show the measured and simulation data matching well. the estimatedparams plot shows the v, k, and loss parameters changing during the estimation; the scale of v, k, and loss are different, right click on the plot and select show scaled values to see how all the parameters changed from their original values.

related examples

to learn how to estimate parameters per experiment using the sdo.optimize command, see .

close the model

bdclose('sdobattery')
网站地图