This example shows how to identify the parameters of a supercapacitor. Instead of collecting voltage and current waveforms from a real supercapacitor, the example generates voltage and current waveforms by running a simulation of a supercapacitor using parameter values that are already known. Then the example applies a parameter identification methodology [1] to the waveforms.
To assess the accuracy of the methodology, the example compares the identified parameters to the known parameter values. The example also shows how to further refine the parameter values using the Parameter Estimation tool provided by Simulink® Design Optimization™.
To identify the parameters of an actual supercapacitor empirically, you can:
Collect voltage and current waveforms from the supercapacitor.
Identify parameter values using the waveform data and the methodology described in [1].
To identify the parameters of a modeled supercapacitor, this example:
Generates voltage and current waveforms by simulating a model that it configures using known values for supercapacitor parameters.
Identifies supercapacitor parameter values using the generated waveform data and the methodology described in [1].
Configures and simulates the supercapacitor using the identified supercapacitor parameter values.
To see how the approach works for a real supercapacitor, evaluate the accuracy of the identification methodology by comparing:
the data generated using known parameter values and the data generated using identified parameter values.
the known parameter values and identified parameter values.
If the accuracy is not sufficient, you can use the Parameter Estimation tool from Simulink Design Optimization to improve it. Use the identified parameter values as the starting values for the optimization.
Generate voltage and current waveforms by configuring and simulating a model using known values for the fixed resistances, fixed capacitances, and voltage-dependent capacitor gain parameters of the supercapacitor. Model the input current, configure the physical characteristics and self-discharge resistance of the supercapacitor using realistic values.
Observe the supercapacitor behavior during three distinct phases:
Charge with constant current
Charge redistribution from immediate to delayed branch
Charge redistribution from immediate and delayed branches to long-term branch
% Open model modelName = 'ee_supercapacitor_identification'; open_system(modelName); set_param(find_system('ee_supercapacitor_identification','FindAll', 'on','type','annotation','Tag','ModelFeatures'),'Interpreter','off') % Configure the supercapacitor using known parameter values. % % Supercapacitor block Cell Characteristics parameters Kv = 190; % Voltage-dependent capacitor gain R = [2.5e-3 0.9 5.2]; % Fixed resistances, [R1 R2 R3] C = [270 100 220]; % Fixed capacitances, [C1 C2 C3] % Store a copy of the known parameter values for an eventual comparison to % parameter values identified using the methodology described in [1]. Kv_known = Kv; R_known = R; C_known = C; % Specify input current by configuring the Step block. % % Step block parameters stepTime = [40 1900 1917]; % Step time initialValue = [28 0 0]; % Initial value finalValue = [0 -25 25]; % Final value % Specify the physical characteristics of the supercapacitor. % % Supercapacitor block Cell Characteristics and Configuration parameters R_discharge = 9e3; % Self-discharge resistance N_series = 1; % Number of series cells N_parallel = 1; % Number of parallel cells % Specify the simulation duration stopTime = 2100; % Simulate and store voltage and current waveform data sim(modelName); t = simlog_ee_supercapacitor_identification.Sensing_current.It.i.series.time; i = simlog_ee_supercapacitor_identification.Sensing_current.It.i.series.values; v = simlog_ee_supercapacitor_identification.Sensing_voltage.V.V.series.values;
Warning: The file containing block diagram 'ee_supercapacitor_identification' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behavior. For more information see <a href="matlab:helpview([docroot '/toolbox/simulink/helptargets.map'], 'shadowing')">"Avoiding Problems with Shadowed Files"</a> in the Simulink documentation. The file containing the block diagram is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/ee_supercapacitor_identification.slx. The file higher on the MATLAB path is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/html/ee_supercapacitor_identification.m Warning: The file containing block diagram 'ee_supercapacitor_identification' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behavior. For more information see <a href="matlab:helpview([docroot '/toolbox/simulink/helptargets.map'], 'shadowing')">"Avoiding Problems with Shadowed Files"</a> in the Simulink documentation. The file containing the block diagram is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/ee_supercapacitor_identification.slx. The file higher on the MATLAB path is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/html/ee_supercapacitor_identification.m Warning: The file containing block diagram 'ee_supercapacitor_identification' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behavior. For more information see <a href="matlab:helpview([docroot '/toolbox/simulink/helptargets.map'], 'shadowing')">"Avoiding Problems with Shadowed Files"</a> in the Simulink documentation. The file containing the block diagram is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/ee_supercapacitor_identification.slx. The file higher on the MATLAB path is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/html/ee_supercapacitor_identification.m
Using the waveform data from the simulation, apply the methodology described in [1].
During the first stage of the identification, a fully discharged supercapacitor is charged with constant current. The method assumes that the immediate branch stores all the initial charge because the time constant for the branch is relatively small.
Immediate branch parameters are calculated by taking measurements of the charge characteristic. Once charging current has reached steady-state at , measure
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is charging current at
,
is fixed resistance of immediate branch,
Once voltage has increased from by approximately
, measure
and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is fixed capacitance of immediate branch,
Once voltage has reached rated voltage, measure and
, and turn off charging current. After
, once charging current has reached steady-state value of
measure
and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is time at parameter identification event
,
is terminal voltage at
,
is voltage-dependent capacitance coefficient,
% Event n=1 t1 = 20e-3; i1 = interp1(t,i,t1); v1 = interp1(t,v,t1); Ri = v1/i1; % Extract charging data that interp1 can use to find time values rather % than voltage values [v3, v_max_idx] = max(v); [v_charge, v_charge_idx] = unique(v(1:v_max_idx)); t_charge = t(v_charge_idx); % Event n=2 delta_v = 50e-3; v2 = v1+delta_v; t2 = interp1(v_charge,t_charge,v2); i2 = interp1(t,i,t2); Ci0 = i2*(t2-t1)/delta_v; % Event n=3 t3 = t(v_max_idx); % Event n=4 delta_t = 20e-3; t4 = t3+delta_t; v4 = interp1(t,v,t4); Qtotal = i1*(t4-t1); Cq = Qtotal/v4; Ci1 = (2/v4)*(Cq-Ci0);
During the second stage of the identification, charge redistributes from the immediate branch to the delayed branch.
Delayed branch parameters are calculated by taking measurements of the hold charge characteristic.
Once voltage has decreased from by approximately
, measure
and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is voltage at which the total immediate capacitance is to be calculated,
is total immediate capacitance at
,
is delayed branch resistance,
Wait for 300 seconds, measure and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is total charge supplied to the supercapacitor,
is delayed branch capacitance,
% Event n=5 v5 = v4-delta_v; discharge_idx = find(i<-20,1,'first'); t_discharge = t(v_max_idx:discharge_idx); v_discharge = v(v_max_idx:discharge_idx); t5 = interp1(v_discharge,t_discharge,v5); delta_t = t5-t4; Vci = v4-(delta_v/2); Cdiff = Ci0+Ci1*Vci; Rd = (v4-(delta_v/2))*delta_t/(Cdiff*delta_v); % Event n=6 TypicallyRdTimesCd = 100; t6 = t5 + 3*TypicallyRdTimesCd; v6 = interp1(t,v,t6); Cd = (Qtotal/v6)-(Ci0+((Ci1/2)*v6));
During the third, and final, stage of the identification, charge redistributes from the immediate and delayed branches to the long-term branch.
Long-term branch parameters are calculated by taking measurements of the hold charge characteristic.
Once voltage has decreased from by approximately
, measure
and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is long-term branch resistance,
After 30 minutes from the start of the charging/discharging process, measure and
and use
where:
is time at parameter identification event
,
is terminal voltage at
,
is long-term branch capacitance,
% Event n=7 v7 = v6-delta_v; t7 = interp1(v_discharge,t_discharge,v7); delta_t = t7-t6; Vci = v6-(delta_v/2); Cdiff = Ci0+Ci1*Vci; Rl = (v6-(delta_v/2))*delta_t/(Cdiff*delta_v); % Rl value large % Event n=8 t8 = 30*60; v8 = interp1(t,v,t8); Cl = (Qtotal/v8)-(Ci0+(v8*Ci1/2))-Cd; % Cl value too large
Collate the time and voltage data for each parameter identification event in a MATLAB® table:
DataTable = table((1:8)',... [t1 t2 t3 t4 t5 t6 t7 t8]',... [v1 v2 v3 v4 v5 v6 v7 v8]',... 'VariableNames',{'Event','Time','Voltage'}) %#ok<NOPTS>
DataTable = 8x3 table Event Time Voltage _____ _______ ________ 1 0.02 0.071799 2 0.51803 0.1218 3 40 2.2717 4 40.02 2.2019 5 56.675 2.1519 6 356.67 1.8473 7 499.28 1.7973 8 1800 1.5865
Configure and simulate the model using the identified supercapacitor parameters. Then, to evaluate the accuracy of the identified parameter values, compare the waveform output to the data generated by a simulation that uses known parameters.
% Create parameters for supercapacitor block using identified values and % create copies for easy reference. Kv = Ci1; R = [Ri Rd Rl]; C = [Ci0 Cd Cl]; Kv_identified = Kv; R_identified = R; C_identified = C; % Simulate the model and store voltage and current waveforms. sim(modelName); t_ = simlog_ee_supercapacitor_identification.Sensing_current.It.i.series.time; v_ = simlog_ee_supercapacitor_identification.Sensing_voltage.V.V.series.values; % Plot the data generated from simulating with known parameters on the % same axis as the data generated from simulating with identified % parameters. figure; plot(t,v,DataTable.Time,DataTable.Voltage,'o',t_,v_); grid('on'); legend('Known parameters simulation',... 'Measurements for parameter identification',... 'Identified parameters simulation');
Warning: The file containing block diagram 'ee_supercapacitor_identification' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behavior. For more information see <a href="matlab:helpview([docroot '/toolbox/simulink/helptargets.map'], 'shadowing')">"Avoiding Problems with Shadowed Files"</a> in the Simulink documentation. The file containing the block diagram is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/ee_supercapacitor_identification.slx. The file higher on the MATLAB path is: /mathworks/devel/bat/BR2020ad/build/matlab/toolbox/physmod/elec/eedemos/html/ee_supercapacitor_identification.m
Prerequisites:
Simulink Design Optimization license
If the traces are not similar enough to meet requirements, then the identified parameter values can serve as initial parameter values for the Parameter Estimation tool from Simulink Design Optimization.
spetool('ee_supercapacitor_spesession');
Display the parameter trajectory created using the Sum Squared Error cost function and Nonlinear least squares optimization method.
openfig('ee_supercapacitor_speresults');
[1] Zubieta, L. and R. Bonert. "Characterization of Double-Layer Capacitors for Power Electronics Applications." IEEE Transactions on Industry Applications, Vol. 36, No. 1, 2000, pp. 199-205.