From ed457ff169de38ecd0ef51c54bafc8efcdf67d2d Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 17 Sep 2024 13:40:45 +0100 Subject: [PATCH] examples: update state of thevenin fitting notebooks --- ...uivalent_circuit_identification_hppc.ipynb | 194 ++++++++++++++---- ...nt_circuit_identification_multipulse.ipynb | 128 ++++++++++-- 2 files changed, 265 insertions(+), 57 deletions(-) diff --git a/examples/notebooks/equivalent_circuit_identification_hppc.ipynb b/examples/notebooks/equivalent_circuit_identification_hppc.ipynb index 018fd3a8..4e6b7634 100644 --- a/examples/notebooks/equivalent_circuit_identification_hppc.ipynb +++ b/examples/notebooks/equivalent_circuit_identification_hppc.ipynb @@ -20,11 +20,25 @@ "id": "1", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/engs2510/Documents/Git/PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip\r\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ "Note: you may need to restart the kernel to use updated packages.\n", + "/home/engs2510/Documents/Git/PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "Note: you may need to restart the kernel to use updated packages.\n" ] } @@ -224,10 +238,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "Initial parameters: [5.23889280e-03 5.86558394e-03 5.08906401e-03 5.21844050e+02\n", - " 2.64240978e+03]\n", - "Estimated parameters: [1.05127792e-02 4.34063511e-03 3.57417951e-02 5.96113674e+02\n", - " 2.14915067e+03]\n" + "Initial parameters: [4.81653818e-03 4.49143448e-03 6.17816943e-03 6.71210862e+02\n", + " 1.30328804e+03]\n", + "Estimated parameters: [9.63365968e-03 3.70346684e-03 2.03665595e-02 2.79021132e+02\n", + " 1.49068535e+03]\n" ] } ], @@ -261,8 +275,56 @@ "outputs": [ { "data": { - "image/svg+xml": [ - "0102030404.124.134.144.154.164.174.184.19ReferenceModelOptimised ComparisonTime / sVoltage / V" + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" ] }, "metadata": {}, @@ -291,8 +353,32 @@ "outputs": [ { "data": { - "image/svg+xml": [ - "2040608010000.0050.010.0150.02ConvergenceIterationCost" + "text/html": [ + "
" ] }, "metadata": {}, @@ -300,8 +386,32 @@ }, { "data": { - "image/svg+xml": [ - "2004006008000.0040.0060.0080.012004006008000.0040.0060.0082004006008000.010.020.030.04200400600800500600700800200400600800220024002600R0 [Ohm]R1 [Ohm]R2 [Ohm]C1 [F]C2 [F]Parameter ConvergenceFunction CallFunction CallFunction CallFunction CallFunction CallR0 [Ohm]R1 [Ohm]R2 [Ohm]C1 [F]C2 [F]" + "text/html": [ + "
" ] }, "metadata": {}, @@ -340,9 +450,36 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "id": "20", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Step([[ 0 3]\n", + " [ 1 3]\n", + " [ 2 3]\n", + " ...\n", + " [3598 3]\n", + " [3599 3]\n", + " [3600 3]], duration=3600, period=1, direction=Discharge)]" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "experiment.steps" + ] + }, + { + "cell_type": "markdown", + "id": "21", + "metadata": {}, "source": [ "Update the estimated RC values. These values will be used to calculate heat generation and corresponding temperature distribution in the thermal submodel. Given `model.predict` is a light wrapper on the `PyBaMM.Simulation` class, we interact with it the same way. Visualisation of voltage response and cell temperature is plotted below using the PyBaMM solution." ] @@ -350,14 +487,14 @@ { "cell_type": "code", "execution_count": null, - "id": "21", + "id": "22", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "2024-09-17 11:50:30.764 - [WARNING] callbacks.on_experiment_infeasible_time(240): \n", + "2024-09-17 13:35:23.641 - [WARNING] callbacks.on_experiment_infeasible_time(240): \n", "\n", "\tExperiment is infeasible: default duration (3600 seconds) was reached during 'Step([[ 0 3]\n", " [ 1 3]\n", @@ -367,30 +504,6 @@ " [3599 3]\n", " [3600 3]], duration=3600, period=1, direction=Discharge)'. The returned solution only contains up to step 1 of cycle 1. Please specify a duration in the step instructions.\n" ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "cad29f36e7ba41df86f323455ae5c8fb", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(FloatSlider(value=0.0, description='t', max=1.0, step=0.01), Output()), _dom_classes=('w…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" } ], "source": [ @@ -399,13 +512,12 @@ " experiment=experiment,\n", " parameter_set=parameter_set,\n", " initial_state={\"Initial SoC\": 0.95},\n", - ")\n", - "sol.plot([\"Battery voltage [V]\", \"Cell temperature [K]\"])" + ")" ] }, { "cell_type": "markdown", - "id": "22", + "id": "23", "metadata": {}, "source": [ "## Conclusion\n", @@ -430,7 +542,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/examples/notebooks/equivalent_circuit_identification_multipulse.ipynb b/examples/notebooks/equivalent_circuit_identification_multipulse.ipynb index 3d91b762..1cd5413e 100644 --- a/examples/notebooks/equivalent_circuit_identification_multipulse.ipynb +++ b/examples/notebooks/equivalent_circuit_identification_multipulse.ipynb @@ -20,11 +20,25 @@ "id": "1", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/engs2510/Documents/Git/PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip\r\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ "Note: you may need to restart the kernel to use updated packages.\n", + "/home/engs2510/Documents/Git/PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "Note: you may need to restart the kernel to use updated packages.\n" ] } @@ -190,7 +204,7 @@ " require.undef(\"plotly\");\n", " requirejs.config({\n", " paths: {\n", - " 'plotly': ['https://cdn.plot.ly/plotly-2.32.0.min']\n", + " 'plotly': ['https://cdn.plot.ly/plotly-2.35.2.min']\n", " }\n", " });\n", " require(['plotly'], function(Plotly) {\n", @@ -207,9 +221,9 @@ { "data": { "text/html": [ - "
" ] }, "metadata": {}, @@ -442,8 +490,32 @@ "outputs": [ { "data": { - "image/svg+xml": [ - "2040608010000.020.040.060.080.10.12ConvergenceIterationCost" + "text/html": [ + "
" ] }, "metadata": {}, @@ -451,8 +523,32 @@ }, { "data": { - "image/svg+xml": [ - "2004006008000.0040.0060.0080.010.0122004006008000.0020.0040.0060.0082004006008000.0050.010.0150.02200400600800400500600700200400600800155016001650R0 [Ohm]R1 [Ohm]R2 [Ohm]C1 [F]C2 [F]Parameter ConvergenceFunction CallFunction CallFunction CallFunction CallFunction CallR0 [Ohm]R1 [Ohm]R2 [Ohm]C1 [F]C2 [F]" + "text/html": [ + "
" ] }, "metadata": {}, @@ -491,7 +587,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.2" } }, "nbformat": 4,