# Creating SPICE netlist from EIS equivalnet circuits

In electrochemical impedance spectroscopy, "equivalent circuits" are often used to model the response of an electrochemical system to an AC potential input in the frequency domain. I'd like to try and simulate the time-domain response for an arbitrary circuit, and it seems like the SPICE transient analysis tool will provide me with the necessary equations (although I can't use the simulator itself because of impedance components like the constant phase element)

My question is therefore how to create a SPICE netlist based on an equivalent circuit. The equivalent circuits look something like this

The problem is converting this into a netlist that can be parsed by SPICE. In particular, how do you decide where the current nodes are defined? This provides some examples but it's unclear what the node placement rules are, where the 0th node is meant to go

• Voltage at nodes , Current in components or jumpers. Node current is always 0. Feb 28 at 20:27
• You'll have to be more precise than that: what does the circuit represent? How is it driven? By what? What is that CPE -- it looks like a sort of a capacitive reactance, but $\omega$ has a power ($\alpha$)? That W looks like an impedance made of a series R+C: Z=R-j/(wC), but the real part is also frequency dependent (inversely proportional, too)? In general, having complex values will not work in any SPICE except in .AC, but you can replace those with their impedance/reactance equivalents. But you have to specify that. Feb 28 at 22:02
• @aconcernedcitizen This was a good primer for me, but it's still a bit over my head: lacey.se/science/eis/constant-phase-element Mar 1 at 9:30
• @FTACV This paper seems to give an example of a CPE model being simulated in MicroCap, which is a free SPICE-based simulator: ncbi.nlm.nih.gov/pmc/articles/PMC7997031 Mar 1 at 9:31
• @SteKulov Those were good links, thank you. FTACV, what you need is an element that can provide a constant phase shift that is not an integer multiple of 90 deg. In .AC this is simply modelled with Laplace transfer functions, but these tend to behave very strange in .TRAN, even with special considerations. So, your options are to either try the Laplace and hope to get good results, or you will need to approximate the responses with lumped elements (e.g. in the same way a -3 dB/oct filters are in practice). I'll try to give some resemblance of an answer later, as a guide. Mar 1 at 11:11

Since you have not provided any other clues, I'll try to answer with a methodology of implementation, rather than a precise answer.

I have a feeling that the numerical inverse laplace transform will fail with a CPE, (I think because it is a fractional operator in the laplace domain)

No, LTspice will handle sqrt(s), or exp(s), no problems. But, as I said, .AC will give precise results, while .TRAN has problems. That's because all SPICE engines perform something similar: they take the expression in s, perform an IFFT by guessing an appropriate frequency range and resolution. LTspice has some helper parameters for that: window, nfft, mtol, which are guessed by the engine if not specifically set. One thing that will help in .TRAN, sometimes drastically, is stated in the help (LTspice > Circuit Elements > E. ...):

The response must drop at high frequencies or an error is reported.

If the frequency of interest is (say) $$\\omega_p=1\;\text{Hz}\$$ then adding an s/1k+1 in the denominator will attenuate at high frequencies, while keeping $$\\omega_p\$$ relatively clean. With these, the first step is to try to deduce the appropriate responses that the elements will have.

First, the CPE. In your picture it has the expression: $$\1/(Q1j\omega^{\alpha 1})\$$, which is not very clear. Is it $$\Q\cdot 1\$$ or $$\Q_1\$$? I'm guessing it's an indice, but the writing... Is it $$\j\omega\$$, or only $$\\omega\$$, or the whole denominator raised to power? Is the power $$\\alpha_1\$$ or $$\\alpha\cdot 1\$$? Or is it l (small L), not 1? Fortunately, Ste Kulov posted some very nice links, in which it's stated (pg 2, bottom):

$$Z=\dfrac{U}{I}=\dfrac{1}{C(j\omega)^{\alpha}},\qquad 0\lt\alpha\le 1 \tag{1}$$

Where their $$\C_{\alpha}\$$ signifies the capacitance value for the particular $$\\alpha\$$. Given the similarity between this notation and your picture, I'll conclude that $$\C1\$$ means $$\C_1\$$. This means that it will behave as a fractional capacitance, which will have a slope and a constant phase dictated by $$\\alpha\$$.

Then, the W element, whose expression seems more clearly given as:

$$W=\dfrac{W}{\sqrt{\omega}}-j\dfrac{W}{\sqrt{\omega}}=\dfrac{W}{\sqrt{\omega}}(1-j) \tag{2}$$

I used the same notation for $$\W1\rightarrow W_1=W\$$ as for $$\C1\rightarrow C_1=C\$$ above.

With these, LTspice can be used to see their frequency responses:

For CPE, as a is .STEPped, the slope and the phase vary from that of a resistor (a=0) to that of a capacitor (a=1). I have normalized the frequency to 1 Hz (wp=2*pi). For W, there is no variable parameter, instead, its magnitude is 2 (3 dB) due to the (1-j) term. In order to have $$\\omega\$$, not $$\j\omega\$$, I used s/sqrt(-1), since $$\s=j2\pi f\$$. Both of them have an additional (s/1meg+1) in the denominator to act as the high frequency pole.

For .TRAN, LTspice tries to guess some appropriate values but, in this case, manual intervention is needed, so I chose a simulation time of 0.5 sec and window=4 nfft=2048, for a step response (pwl 0 0 1u 1):

I have no idea whether these will fit your requirements but, if you want to use these in .TRAN, then you'll have to settle with either these Laplace equations, or try to create some lumped, passive or active filter that tries to mimic the responses. They will look something like this (example):

and the values will be such that the poles/zeroes will be an octave, or half an octave, or a third, etc, apart, so that the combined effect will give the required attenuation slope and the phase, over a finite bandwidth. It's not that bad, it can be done, it has been done and, to try to lessen the impact, here's how a rather dense 3 dB/oct filter made in the exact same way as above responds to the same step input, versus CPE and W:

The RC response is similar to a lowpass: it has a pole which has been set to 0.1 Hz, and its slope is -3 dB/oct, or -10 dB/dec. That corresponds to W, out of the box, and to CPE with a=0.5. Amplifications differ, though, so that's why you see *3.5 or *5 in the plot window. Otherwise, the transiet response comes quite close. Due to everything that's been said about the behaviour of Laplace expressions in .TRAN, I'm more inclined to believe that the RC approximation comes closer to the real response. In fact, because I know how dense the cells are and that the phase has a ripple of 0.115o, I'd say the response of the RC filter is very, very close. The downside is that, to build the CPE, the whole chain of RC elements needs to have parameterized values in order to make for easier changes in the response as a function of a, and these values need to be carefully crafted.

• Wow! This is a very comprehensive answer. I'm afraid it's going to take me a few days to understand and digest this (as you can probably tell, I'm a chemist, not an electrical engineer), but thank you for taking so much time to reply in detail Mar 2 at 18:10