{ "cells": [ { "cell_type": "markdown", "id": "51ea5530-ffc5-458d-b3dc-58f126597e76", "metadata": {}, "source": [ "Jochen Kieninger
\n", "**Electrochemical Methods for the Micro- and Nanoscale**
\n", "www.electrochemical-methods.org\n", "\n", "## Task 7.3 (Electrochemical impedance spectroscopy - simulation)\n", "\n", "Simulating different basic equivalent circuits and changing the parameter helps to get a sound understanding of EIS models. Here, we use the library impedance.py (https://doi.org/10.21105/joss.02349), primarily designed to analysis experimental data." ] }, { "cell_type": "code", "execution_count": 1, "id": "4b447e3f-71dd-4cf7-ae78-ef5ab6313e4e", "metadata": {}, "outputs": [], "source": [ "from impedance.models.circuits import CustomCircuit\n", "import numpy as np\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "markdown", "id": "fae68c91-72d9-42c7-9500-ce150f16f77e", "metadata": {}, "source": [ "- Frequency range: 10 mHz to 10 kHz" ] }, { "cell_type": "code", "execution_count": 2, "id": "21f96a85-ce37-414f-b129-3288b37f1f63", "metadata": {}, "outputs": [], "source": [ "frequencies = np.logspace(-2, 4, 100)" ] }, { "cell_type": "markdown", "id": "ec03f87b-e01a-4172-a0c4-9c9100d5cb02", "metadata": {}, "source": [ "- Simple RC parallel circuit representing the charge transfer resistance (100 Ω) and double layer capacity (100 µF)" ] }, { "cell_type": "code", "execution_count": 3, "id": "a90a3677-be10-4541-b5d5-40c61035351a", "metadata": {}, "outputs": [], "source": [ "circuit = CustomCircuit(initial_guess=[100, 100e-6], circuit='p(R1,C1)')\n", "Z_sim = circuit.predict(frequencies)" ] }, { "cell_type": "code", "execution_count": 4, "id": "18822ad2-8dae-4713-b5fa-0f5ad700cdc2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "" ], "text/plain": [ "alt.HConcatChart(...)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.plot(f_data=frequencies, Z_data=Z_sim)" ] }, { "cell_type": "markdown", "id": "71335422-e407-48dc-a4aa-1603833370a2", "metadata": {}, "source": [ "- Enhanced model with a CPE (exponent 0.8) instead of the capacitor and another element for the uncompensated resistance (10 Ω)" ] }, { "cell_type": "code", "execution_count": 5, "id": "dae5d390-de90-48e5-a67f-2023a6f0165e", "metadata": {}, "outputs": [], "source": [ "circuit = CustomCircuit(initial_guess=[10, 100, 100e-6, 0.8], circuit='R0-p(R1,CPE1)')\n", "Z_sim = circuit.predict(frequencies)" ] }, { "cell_type": "code", "execution_count": 6, "id": "89122474-bea7-440f-bf8d-d43e39dac32d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "" ], "text/plain": [ "alt.HConcatChart(...)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.plot(f_data=frequencies, Z_data=Z_sim)" ] }, { "cell_type": "markdown", "id": "1c40b48b-0ad6-4d56-af77-7fcc06b8361f", "metadata": {}, "source": [ "- Enhanced model with a Warburg element (20 Ω s0.5) to consider mass transport limitation (semiinfinite diffusion)" ] }, { "cell_type": "code", "execution_count": 7, "id": "f722f0fc-7b0b-47f1-a941-45b2a735d6f4", "metadata": {}, "outputs": [], "source": [ "circuit = CustomCircuit(initial_guess=[10, 100, 20, 100e-6, 0.9], circuit='R0-p(R1-W1,CPE1)')\n", "Z_sim = circuit.predict(frequencies)" ] }, { "cell_type": "code", "execution_count": 8, "id": "43179c37-3345-49a0-9cfd-51d61db5feb1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "" ], "text/plain": [ "alt.HConcatChart(...)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.plot(f_data=frequencies, Z_data=Z_sim)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.8" } }, "nbformat": 4, "nbformat_minor": 5 }