Cycling a battery 40 times with a constant current constant voltage (cccv) control
julia
using BattMo, GLMakieWe use the setup provided in the p2d_40.json file. In particular, see the data under the Control key.
julia
file_path_cell = parameter_file_path("cell_parameters", "chen_2020.json")
file_path_cycling = parameter_file_path("cycling_protocols", "cccv.json")
cell_parameters = load_cell_parameters(; from_file_path = file_path_cell)
cycling_protocol = load_cycling_protocol(; from_file_path = file_path_cycling)
model = LithiumIonBattery();
cycling_protocol["TotalNumberOfCycles"] = 10
sim = Simulation(model, cell_parameters, cycling_protocol);
output = solve(sim)✔️ Validation of ModelSettings passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of CellParameters passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of CyclingProtocol passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of SimulationSettings passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of SolverSettings passed: No issues found.
──────────────────────────────────────────────────
Jutul: Simulating 2 days, 2 hours as 3605 report steps
╭────────────────┬────────────┬────────────────┬──────────────╮
│ Iteration type │ Avg/step │ Avg/ministep │ Total │
│ │ 2622 steps │ 3148 ministeps │ (wasted) │
├────────────────┼────────────┼────────────────┼──────────────┤
│ Newton │ 4.08505 │ 3.40248 │ 10711 (4460) │
│ Linearization │ 5.28566 │ 4.40248 │ 13859 (4683) │
│ Linear solver │ 4.08505 │ 3.40248 │ 10711 (4460) │
│ Precond apply │ 0.0 │ 0.0 │ 0 (0) │
╰────────────────┴────────────┴────────────────┴──────────────╯
╭───────────────┬──────────┬────────────┬────────╮
│ Timing type │ Each │ Relative │ Total │
│ │ μs │ Percentage │ s │
├───────────────┼──────────┼────────────┼────────┤
│ Properties │ 28.1860 │ 8.53 % │ 0.3019 │
│ Equations │ 69.4727 │ 27.19 % │ 0.9628 │
│ Assembly │ 40.8371 │ 15.98 % │ 0.5660 │
│ Linear solve │ 29.8060 │ 9.02 % │ 0.3193 │
│ Linear setup │ 0.0000 │ 0.00 % │ 0.0000 │
│ Precond apply │ 0.0000 │ 0.00 % │ 0.0000 │
│ Update │ 18.4567 │ 5.58 % │ 0.1977 │
│ Convergence │ 23.1651 │ 9.07 % │ 0.3210 │
│ Input/Output │ 92.9450 │ 8.26 % │ 0.2926 │
│ Other │ 54.0883 │ 16.36 % │ 0.5793 │
├───────────────┼──────────┼────────────┼────────┤
│ Total │ 330.5576 │ 100.00 % │ 3.5406 │
╰───────────────┴──────────┴────────────┴────────╯Plot the results
We can plot a simple voltage current dashboard
julia
plot_dashboard(output, plot_type = "simple")
Or plot specific variables
julia
plot_output(output, ["DischargeCapacity vs CycleIndex"])
plot_output(output, ["CumulativeCapacity vs Time"])
We can check in the overview which variables are available and can be plotted against each other
julia
print_info(output)
OUTPUT OVERVIEW
===========================================================================================================================================================
Variable Unit Shape
-----------------------------------------------------------------------------------------------------------------------------------------------------------
TIME_SERIES
===========================================================================================================================================================
Variable Unit Shape
-----------------------------------------------------------------------------------------------------------------------------------------------------------
[ "CumulativeCapacity" ] Ah (nTime,)
[ "Current" ] A (nTime,)
[ "CycleNumber" ] 1 (nTime,)
[ "NetCapacity" ] Ah (nTime,)
[ "Time" ] s (nTime,)
[ "Voltage" ] V (nTime,)
===========================================================================================================================================================
STATES
===========================================================================================================================================================
Variable Unit Shape
-----------------------------------------------------------------------------------------------------------------------------------------------------------
[ "Cell" ][ "Position" ] m (nPosition,)
[ "Electrolyte" ][ "Charge" ] C (nTime, nPosition)
[ "Electrolyte" ][ "Concentration" ] mol·m⁻³ (nTime, nPosition)
[ "Electrolyte" ][ "Diffusivity" ] m²·s (nTime, nPosition)
[ "Electrolyte" ][ "Mass" ] g (nTime, nPosition)
[ "Electrolyte" ][ "Position" ] m (nElectrolytePosition,)
[ "Electrolyte" ][ "Potential" ] V (nTime, nPosition)
[ "Electrolyte" ][ "Temperature" ] T (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "Charge" ] C (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "DiffusionCoefficient" ] m²·s⁻¹ (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "OpenCircuitPotential" ] mol·m⁻²·s⁻¹ (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "ParticleConcentration" ] mol·L⁻¹ (nTime, nPosition, nRadius)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "Position" ] m (nNegativeElectrodeActiveMaterialPosition,)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "Potential" ] V (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "Radius" ] m (nNegativeElectrodeActiveMaterialRadius,)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "ReactionRateConstant" ] V (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "SurfaceConcentration" ] mol·L⁻¹ (nTime, nPosition)
[ "NegativeElectrode" ][ "ActiveMaterial" ][ "Temperature" ] T (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "Charge" ] C (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "DiffusionCoefficient" ] m²·s⁻¹ (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "OpenCircuitPotential" ] V (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "ParticleConcentration" ] mol·L⁻¹ (nTime, nPosition, nRadius)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "Position" ] m (nPositiveElectrodeActiveMaterialPosition,)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "Potential" ] V (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "Radius" ] m (nPositiveElectrodeActiveMaterialRadius,)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "ReactionRateConstant" ] mol·m⁻²·s⁻¹ (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "SurfaceConcentration" ] mol·L⁻¹ (nTime, nPosition)
[ "PositiveElectrode" ][ "ActiveMaterial" ][ "Temperature" ] T (nTime, nPosition)
[ "Separator" ][ "Position" ] m (nSeparatorPosition,)
[ "Time" ] s (nTime,)
===========================================================================================================================================================
METRICS
===========================================================================================================================================================
Variable Unit Shape
-----------------------------------------------------------------------------------------------------------------------------------------------------------
[ "ChargeCapacity" ] Ah (nCycleIndex,)
[ "ChargeEnergy" ] J (nCycleIndex,)
[ "CycleIndex" ] 1 (nCycleIndex,)
[ "DischargeCapacity" ] Ah (nCycleIndex,)
[ "DischargeEnergy" ] J (nCycleIndex,)
[ "RoundTripEfficiency" ] % (nCycleIndex,)
===========================================================================================================================================================
Total output variables: 42Example on GitHub
If you would like to run this example yourself, it can be downloaded from the BattMo.jl GitHub repository as a script.
This page was generated using Literate.jl.