Useful Tools in BattMo β
Before we dive into how to set up and run simulations, it's helpful to get familiar with some of the built-in tools provided by BattMo. These utilities can save time and improve your workflow, and we'll be using most of them throughout the tutorials.
using BattMoSaving Default Parameter Sets Locally β
BattMo includes several default parameter sets that you can use as a starting point. If you want to explore or customize them, you can easily save them to your local disk using:
path = pwd()
folder_name = "default_parameter_sets"
generate_default_parameter_files(path, folder_name)π JSON files successfully written! Path:
/home/runner/work/BattMo.jl/BattMo.jl/docs/build/tutorials/default_parameter_setsThis will create a folder in your current working directory containing the default parameter files.
Viewing Parameter Set Information β
To quickly inspect which default parameter sets are included with BattMo and what each contains, you can use:
print_default_input_sets()
====================================================================================================
π Overview of Available Default Sets
====================================================================================================
π cell_parameters: chayambuka_2022, chen_2020, xu_2015
π cycling_protocols: cc_charge, cc_cycling, cc_discharge, cccv, user_defined_current_function
π full_simulation_input: chen_2020, chen_2020_p4d
π model_settings: p2d, p4d_cylindrical, p4d_pouch
π simulation_settings: p2d, p2d_fine_resolution, p4d_cylindrical, p4d_pouch
π solver_settings: default, direct, iterative
====================================================================================================
π Detailed Descriptions
====================================================================================================
π cell_parameters
----------------------------------------------------------------------------------------------------
chayambuka_2022
πΉ Cell name: -
πΉ Cell case: Pouch
πΉ Source: ]8;;(Invalid metadata format)\visit]8;;\
πΉ Suitable for:
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ ModelFramework: P2D
πΉ Description: Parameter set for a Sodium ion cell based on Chayambuka et al. The positive electrode open circuit potential has been retrieved from a [COMSOL example](https://www.comsol.com/model/1d-isothermal-sodium-ion-battery-117341).
chen_2020
πΉ Cell name: LG INR 21700 M50
πΉ Cell case: Cylindrical
πΉ Source: ]8;;https://doi.org/10.1149/1945-7111/ab9050\visit]8;;\
πΉ Suitable for:
β’ CurrentCollectors: Generic
β’ SEIModel: Bolay
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ ModelFramework: P2D
πΉ Description: Parameter set of a cylindrical 21700 commercial cell (LGM50), for an electrochemical pseudo-two-dimensional (P2D) model, after calibration. SEI parameters are from Bolay2022: https://doi.org/10.1016/j.powera.2022.100083 .
xu_2015
πΉ Cell name: LP2770120
πΉ Cell case: Pouch
πΉ Source: ]8;;https://doi.org/10.1016/j.energy.2014.11.073\visit]8;;\
πΉ Suitable for:
β’ CurrentCollectors: Generic
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ ModelFramework: P2D, P4D Pouch
πΉ Description: Parameter set of a commercial Type LP2770120 prismatic LiFePO4/graphite cell, for an electrochemical pseudo-two-dimensional (P2D) model.
π cycling_protocols
----------------------------------------------------------------------------------------------------
cc_charge
πΉ Description: Parameter set for a constant current charging protocol.
cc_cycling
πΉ Description: Parameter set for a constant current cycling protocol.
cc_discharge
πΉ Description: Parameter set for a constant current discharging protocol.
cccv
πΉ Description: Parameter set for a constant current constant voltage cyling protocol.
user_defined_current_function
πΉ Description: Parameter set that shows an example of how to include a user defined function in the cycling protocol parameters.
π full_simulation_input
----------------------------------------------------------------------------------------------------
chen_2020
πΉ Source: ]8;;https://doi.org/10.1149/1945-7111/ab9050\visit]8;;\
πΉ Description: Parameter set of a cylindrical 21700 commercial cell (LGM50), for an electrochemical pseudo-two-dimensional (P2D) model, after calibration. SEI parameters are from Bolay2022: https://doi.org/10.1016/j.powera.2022.100083 .
chen_2020_p4d
πΉ Source: ]8;;https://doi.org/10.1149/1945-7111/ab9050\visit]8;;\
πΉ Description: Parameter set of a cylindrical 21700 commercial cell (LGM50), for an electrochemical pseudo-two-dimensional (P2D) model, after calibration. SEI parameters are from Bolay2022: https://doi.org/10.1016/j.powera.2022.100083 .
π model_settings
----------------------------------------------------------------------------------------------------
p2d
πΉ Description: Default model settings for a P2D simulation including a current ramp up, excluding current collectors and SEI effects.
p4d_cylindrical
πΉ Description: Default model settings for a P4D cylindrical cell with a current ramp up.
p4d_pouch
πΉ Description: Default model settings for a P4D pouch simulation including a current ramp up, current collectors.
π simulation_settings
----------------------------------------------------------------------------------------------------
p2d
πΉ Suitable for:
β’ SEIModel: Bolay
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ ModelFramework: P2D
πΉ Description: Default simulation settings for a P2D simulation including a current ramp up, excluding current collectors and SEI effects.
p2d_fine_resolution
πΉ Suitable for:
β’ SEIModel: Bolay
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ ModelFramework: P2D
πΉ Description: Default simulation settings for a P2D simulation including a current ramp up, excluding current collectors and SEI effects for a finer resolution.
p4d_cylindrical
p4d_pouch
πΉ Suitable for:
β’ SEIModel: Bolay
β’ RampUp: Sinusoidal
β’ TransportInSolid: FullDiffusion
β’ CurrentCollector: Generic
β’ ModelFramework: P2D, P4D Pouch
πΉ Description: Default simulation settings for a P4D pouch simulation including a current ramp up, current collectors.
π solver_settings
----------------------------------------------------------------------------------------------------
default
direct
iterativeInspecting Individual Parameters β
If you're unsure how a specific parameter should be defined or what it represents, you can print detailed information about it. For example, for cell parameters and cycling protocol parameters:
parameter_name = "OpenCircuitPotential"
print_info(parameter_name; view = "CellParameters")
----------------------------------------------------------------------------------------------------
π Cell Parameter: OpenCircuitPotential
----------------------------------------------------------------------------------------------------
πΉ Name OpenCircuitPotential
πΉ Category CellParameters
πΉ Description The open-circuit potential of the active material under a given intercalant stoichimetry and temperature.
πΉ Type String, Dict{String, Vector}, Real
πΉ Unit V
πΉ Documentation ]8;;https://battmo.org/BattMo.jl/dev/manuals/user_guide/simulation_dependent_input\visit]8;;\
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/electrochemistry#electrochemistry_9c657fdc_b9d3_4964_907c_f9a6e8c5f52b\visit]8;;\
========================================================================================================================An example for model or simulation settings:
parameter_name = "ModelFramework"
print_info(parameter_name; view = "ModelSettings")
----------------------------------------------------------------------------------------------------
πΈοΈ Model Setting: ModelFramework
----------------------------------------------------------------------------------------------------
πΉ Name ModelFramework
πΉ Category ModelSettings
πΉ Description Framework defining the dimensionality of the electrochemical model. Examples: "P2D", "P4D Pouch".
πΉ Type String
πΉ Options P2D, P4D Pouch, P4D Cylindrical
πΉ Documentation ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/pxd_model\visit]8;;\
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/battery#battery_b1921f7b_afac_465a_a275_26f929f7f936\visit]8;;\
========================================================================================================================An example for output variables:
parameter_name = "Concentration"
print_info(parameter_name; view = "OutputVariable")
----------------------------------------------------------------------------------------------------
π Output Variable: NegativeElectrodeActiveMaterialSurfaceConcentration
----------------------------------------------------------------------------------------------------
πΉ Name NegativeElectrodeActiveMaterialSurfaceConcentration
πΉ Category OutputVariable
πΉ Description Concentration of lithium ions at the surface of negative electrode particles.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit molΒ·Lβ»ΒΉ
----------------------------------------------------------------------------------------------------
π Output Variable: PositiveElectrodeActiveMaterialParticleConcentration
----------------------------------------------------------------------------------------------------
πΉ Name PositiveElectrodeActiveMaterialParticleConcentration
πΉ Category OutputVariable
πΉ Description Radial distribution of lithium concentration in positive electrode particles.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition, nPositiveElectrodeActiveMaterialRadius)
πΉ Unit molΒ·Lβ»ΒΉ
----------------------------------------------------------------------------------------------------
π Output Variable: ElectrolyteConcentration
----------------------------------------------------------------------------------------------------
πΉ Name ElectrolyteConcentration
πΉ Category OutputVariable
πΉ Description Concentration of lithium ions in the electrolyte.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit molΒ·mβ»Β³
----------------------------------------------------------------------------------------------------
π Output Variable: PositiveElectrodeActiveMaterialSurfaceConcentration
----------------------------------------------------------------------------------------------------
πΉ Name PositiveElectrodeActiveMaterialSurfaceConcentration
πΉ Category OutputVariable
πΉ Description Concentration of lithium ions at the surface of positive electrode particles.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit molΒ·Lβ»ΒΉ
----------------------------------------------------------------------------------------------------
π Output Variable: NegativeElectrodeActiveMaterialParticleConcentration
----------------------------------------------------------------------------------------------------
πΉ Name NegativeElectrodeActiveMaterialParticleConcentration
πΉ Category OutputVariable
πΉ Description Radial distribution of lithium concentration in negative electrode particles.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition, nNegativeElectrodeActiveMaterialRadius)
πΉ Unit molΒ·Lβ»ΒΉ
========================================================================================================================And a general example, find variables with charge in the name.
print_info("charge")
----------------------------------------------------------------------------------------------------
π Cell Parameter: ChargeNumber
----------------------------------------------------------------------------------------------------
πΉ Name ChargeNumber
πΉ Category CellParameters
πΉ Description Electric charge of an ion divided by the elementary charge.
πΉ Type Int64
πΉ Unit 1
πΉ Minimum value 1
πΉ Maximum value 4
πΉ Ontology link ]8;;https://w3id.org/emmo#EMMO_dc467621_3b49_4f31_9b09_82290f29da52\visit]8;;\
----------------------------------------------------------------------------------------------------
π Cell Parameter: ChargeTransferCoefficient
----------------------------------------------------------------------------------------------------
πΉ Name ChargeTransferCoefficient
πΉ Category CellParameters
πΉ Description Constant alpha in the Butler-Volmer equation. It represents the fraction of the electrostatic potential energy affecting the reduction rate in an electrode reaction, with the remaining fraction affecting the corresponding oxidation rate.
πΉ Type Real
πΉ Unit -
πΉ Minimum value 0.1
πΉ Maximum value 0.9
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/electrochemistry#electrochemistry_a4dfa5c1_55a9_4285_b71d_90cf6613ca31\visit]8;;\
----------------------------------------------------------------------------------------------------
π΄ Cycling Protocol: RestingTimeAfterDischarge
----------------------------------------------------------------------------------------------------
πΉ Name RestingTimeAfterDischarge
πΉ Category CyclingProtocol
πΉ Description Time during which the cell is kept at open-circuit conditions after completing a discharging step.
πΉ Type Real
πΉ Unit s
πΉ Minimum value 0.0
πΉ Maximum value 1.0e6
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/electrochemistry#electrochemistry_2678a656_4a27_4706_8dde_b0a93e9b92fa\visit]8;;\
----------------------------------------------------------------------------------------------------
π΄ Cycling Protocol: InitialStateOfCharge
----------------------------------------------------------------------------------------------------
πΉ Name InitialStateOfCharge
πΉ Category CyclingProtocol
πΉ Description State of charge of the cell at the start of a simulation.
πΉ Type Real
πΉ Unit 1
πΉ Minimum value 0.0
πΉ Maximum value 1.0
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/electrochemistry#electrochemistry_8b2aaa50_bbe1_45da_8778_8898326246a2\visit]8;;\
----------------------------------------------------------------------------------------------------
π΄ Cycling Protocol: RestingTimeAfterCharge
----------------------------------------------------------------------------------------------------
πΉ Name RestingTimeAfterCharge
πΉ Category CyclingProtocol
πΉ Description Time during which the cell is kept at open-circuit conditions after completing a charging step.
πΉ Type Real
πΉ Unit s
πΉ Minimum value 0.0
πΉ Maximum value 1.0e6
πΉ Ontology link ]8;;https://w3id.org/emmo/domain/electrochemistry#electrochemistry_2678a656_4a27_4706_8dde_b0a93e9b92fa\visit]8;;\
----------------------------------------------------------------------------------------------------
π Output Variable: DischargeCapacity
----------------------------------------------------------------------------------------------------
πΉ Name DischargeCapacity
πΉ Category OutputVariable
πΉ Description Total amount of charge delivered during the discharge phase.
πΉ Type Vector{Real}
πΉ Shape (nCycleIndex,)
πΉ Unit Ah
----------------------------------------------------------------------------------------------------
π Output Variable: NegativeElectrodeActiveMaterialCharge
----------------------------------------------------------------------------------------------------
πΉ Name NegativeElectrodeActiveMaterialCharge
πΉ Category OutputVariable
πΉ Description Charge stored in the negative electrode.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit C
----------------------------------------------------------------------------------------------------
π Output Variable: ElectrolyteCharge
----------------------------------------------------------------------------------------------------
πΉ Name ElectrolyteCharge
πΉ Category OutputVariable
πΉ Description Charge carried by the ions in the electrolyte.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit C
----------------------------------------------------------------------------------------------------
π Output Variable: DischargeEnergy
----------------------------------------------------------------------------------------------------
πΉ Name DischargeEnergy
πΉ Category OutputVariable
πΉ Description Total energy output from the battery during discharge.
πΉ Type Vector{Real}
πΉ Shape (nCycleIndex,)
πΉ Unit J
----------------------------------------------------------------------------------------------------
π Output Variable: PositiveElectrodeActiveMaterialCharge
----------------------------------------------------------------------------------------------------
πΉ Name PositiveElectrodeActiveMaterialCharge
πΉ Category OutputVariable
πΉ Description Charge stored in the positive electrode.
πΉ Type Vector{Real}
πΉ Shape (nTime, nPosition)
πΉ Unit C
----------------------------------------------------------------------------------------------------
π Output Variable: ChargeEnergy
----------------------------------------------------------------------------------------------------
πΉ Name ChargeEnergy
πΉ Category OutputVariable
πΉ Description Total energy input to the battery during charging.
πΉ Type Vector{Real}
πΉ Shape (nCycleIndex,)
πΉ Unit J
----------------------------------------------------------------------------------------------------
π Output Variable: ChargeCapacity
----------------------------------------------------------------------------------------------------
πΉ Name ChargeCapacity
πΉ Category OutputVariable
πΉ Description Total amount of charge accepted during the charge phase.
πΉ Type Vector{Real}
πΉ Shape (nCycleIndex,)
πΉ Unit Ah
========================================================================================================================This is especially useful when building or editing custom parameter sets.
Listing Available Submodels β
BattMo supports a modular submodel architecture. To view all available submodels you can integrate into your simulation, run:
print_submodels()====================================================================================================
βΉοΈ Submodels Information
====================================================================================================
Parameter Options Documentation
----------------------------------------------------------------------------------------------------
ButlerVolmer Standard, Chayambuka ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/pxd_model\visit]8;;\
CurrentCollectors Standard -
SEIModel Bolay ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/sei_model\visit]8;;\
RampUp Sinusoidal ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/ramp_up\visit]8;;\
TemperatureDependence Arrhenius ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/arrhenius\visit]8;;\
PotentialFlowDiscretization GeneralAD, TwoPointDiscretization -
TransportInSolid FullDiffusion -
ModelFramework P2D, P4D Pouch, P4D Cylindrical ]8;;https://battmoteam.github.io/BattMo.jl/dev/manuals/user_guide/pxd_model\visit]8;;\Write a parameter set object to a JSON file β
You can use the following function to save your ParameterSet object to a JSON file:
file_path = "path_to_json_file/file.json"
parameter_set = CellParameters(Dict("NegativeElectrode" => Dict("Coating" => Dict("Thickness" => 100e-6))))
write_to_json_file(file_path, parameter_set)An error occurred while writing to the file: SystemError("opening file \"path_to_json_file/file.json\"", 2, nothing)Get quick information on a cell parameter set β
Let's load a default cell parameter set.
cell_parameters = load_cell_parameters(; from_default_set = "chen_2020")You can easily print some handy quantities and metrics for debugging:
quick_cell_check(cell_parameters)ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Quick Cell Check
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Cell 1: Chen2020
Quantity Cell 1 | Unit | Source
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Nominal Voltage 3.71 | V | [INPUT]
Nominal Capacity 4.8 | Ah | [INPUT]
Cell Theoretical Capacity 5.09 | Ah | [EQUILIBRIUM CALCULATION]
Cell N:P Ratio 0.9131 | - | [EQUILIBRIUM CALCULATION]
Cell Mass 0.04745 | kg | [EQUILIBRIUM CALCULATION]
Positive Electrode Mass Loading 24.89 | mg/cmΒ² | [EQUILIBRIUM CALCULATION]
Negative Electrode Mass Loading 14.44 | mg/cmΒ² | [EQUILIBRIUM CALCULATION]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββIf there are functional parameters present within the parameter set, like the OCP or electrolyte diffusion coefficient, you can easily plot those parameters against a realistic x-quantity range:
plot_cell_curves(cell_parameters)
Example 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.