{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Tutorial 3 \\- Modify Structural Parameters\n", "\n", "## Introduction\n", "\n", "In this tutorial, we will use a P2D model to simulate the effects of changing structural parameters (like electrode thickness or porosity) on cell discharge. After completing this tutorial, you should have a working knowledge of:\n", "\n", "- Basics of how structural properties are defined in BattMo\n", "- How changing the thickness of one electrode can affect the overall capacity of the cell\n", "- How to setup and execute a parameter sweep\n", "\n", "We'll use the same model from Tutorial 1.\n", "" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "source": [ "jsonstruct = parseBattmoJson('Examples/jsondatafiles/sample_input.json');" ], "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Explore the Structural Parameters\n", "\n", "Structural parameters are defined in the JSON parameter file and parsed into the MATLAB structure. Once the JSON parameter file has been read into MATLAB as a jsonstruct, its properties can be modified programmatically.\n", "\n", "\n", "Let's begin by exploring the parameters of the negative electrode coating with the following command:\n", "" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "source": [ "disp(jsonstruct.NegativeElectrode.Coating)" ], "outputs": [ { "data": { "text/plain": [ " thickness: 6.4000e-05\n", " N: 10\n", " effectiveDensity: 1900\n", " bruggemanCoefficient: 1.5000\n", " ActiveMaterial: [1x1 struct]\n", " Binder: [1x1 struct]\n", " ConductingAdditive: [1x1 struct]" ] }, "metadata": {}, "execution_count": 2, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Here, we can see that the structural and material properties of the coating are defined. Let's try increasing the thickness of the negative electrode from 64 µm to 72 µm.\n", "" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "source": [ "jsonstruct.NegativeElectrode.Coating.thickness = 72*micro;" ], "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Now we can run the simulation and plot the discharge curve against the discharged capacity of the cell.\n", "" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "source": [ "% instantiate an empty figure\n", "figure()\n", "output = runBatteryJson(jsonstruct);" ], "outputs": [ ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "retrieve the states from the simulation result\n", "" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "source": [ "states = output.states;\n", "\n", "% extract the time, voltage, and current quantities\n", "time = cellfun(@(state) state.time, states);\n", "voltage = cellfun(@(state) state.('Control').E, states);\n", "current = cellfun(@(state) state.('Control').I, states);\n", "\n", "% calculate the capacity\n", "capacity = time .* current;\n", "\n", "% plot the discharge curve in the figure\n", "plot((capacity/(hour*milli)), voltage, '-', 'linewidth', 3)\n", "xlabel('Capacity / mA \\cdot h')\n", "ylabel('Voltage / V')\n", "legend('t_{NE} = 72 µm')" ], "outputs": [ { "data": { "text/html": [ "