Source code for psc_sim.eis_lumped

"""Lumped-element EIS: canonical series blocks (HTML computeEIS)."""

from __future__ import annotations

import numpy as np

from psc_sim.parameters import CellParameters
from psc_sim.simulation.eis_grid import default_eis_freqs


[docs] def eis_impedance(p: CellParameters, freqs: np.ndarray) -> tuple[np.ndarray, np.ndarray]: """ Return Zre, Zim (mathematical Im) for the canonical series model: Z = Rs + Z_parallel(Rsh, Cj) + (Rion + 1/(jω Cion)) Same algebra as solar_cell_sim_app.html ``computeEIS``. """ Rs, Rsh, Cj, Rion, Cion = p.Rs, p.Rsh, p.Cj, p.Rion, p.Cion f = np.asarray(freqs, dtype=float) w = 2.0 * np.pi * f zsh_den = 1.0 + (Rsh * w * Cj) ** 2 zsh_re = Rsh / zsh_den zsh_im = -Rsh * Rsh * w * Cj / zsh_den zion_re = np.full_like(f, Rion, dtype=float) zion_im = -1.0 / (w * Cion) zre = Rs + zsh_re + zion_re zim = zsh_im + zion_im return zre, zim
def eis_default_sweep(p: CellParameters) -> tuple[np.ndarray, np.ndarray, np.ndarray]: freqs = default_eis_freqs() zre, zim = eis_impedance(p, freqs) return freqs, zre, zim