{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aged parameter set example\n", "\n", "For scenario modelling it can be useful to take a parameter set for a fresh cell and apply a degradation state to it. In this example we will use the `apply_degradation_state` method to do this." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ionworkspipeline as iwp\n", "import pybamm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We begin by loading in a fresh parameter set. For this example we will use the `Chen2020` parameter set." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fresh_parameter_values = iwp.ParameterValues(\"Chen2020\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next we define a degradation state. The degradation state to apply to the parameter values is a dictionary with the following keys:\n", "\n", "* \"LAM_ne [%]\": Loss of active material in negative electrode (%)\n", "* \"LAM_pe [%]\": Loss of active material in positive electrode (%)\n", "* \"LLI [%]\": Loss of lithium inventory (%)\n", "* \"R0_addn [Ohm]\": Additional ohmic resistance (Ohm). This is achieved by adding to the contact resistance.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "degradation_state = {\n", " \"LLI [%]\": 8,\n", " \"LAM_ne [%]\": 3,\n", " \"LAM_pe [%]\": 5,\n", " \"R0_addn [Ohm]\": 0.03,\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We then apply the degradation state to the parameter values, passing `inplace=False` so that the original parameter values are not modified" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aged_parameter_values = fresh_parameter_values.apply_degradation_state(\n", " degradation_state, inplace=False\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can create a model and solve it for both the fresh and aged parameter values, " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model = pybamm.lithium_ion.SPMe(options={\"contact resistance\": \"true\"})\n", "experiment = pybamm.Experiment(\n", " [\n", " \"Discharge at 1C until 2.8V\",\n", " \"Rest for 1 hour\",\n", " \"Charge at 1C until 4.2V\",\n", " \"Hold at 4.2V until C/20\",\n", " \"Rest for 1 hour\",\n", " ]\n", ")\n", "sols = []\n", "for parameter_values in [fresh_parameter_values, aged_parameter_values]:\n", " sim = pybamm.Simulation(\n", " model,\n", " parameter_values=parameter_values,\n", " experiment=experiment,\n", " )\n", " sol = sim.solve()\n", " sols.append(sol)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and compare the results" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pybamm.dynamic_plot(\n", " sols,\n", " [\n", " \"Current [A]\",\n", " \"Voltage [V]\",\n", " \"X-averaged negative electrode reaction overpotential [V]\",\n", " \"X-averaged positive electrode reaction overpotential [V]\",\n", " \"X-averaged electrolyte overpotential [V]\",\n", " \"Electrolyte concentration [mol.m-3]\",\n", " ],\n", " labels=[\"Fresh\", \"Aged\"],\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "env", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 2 }