I need to simulate a component (constant phase element) with an impedance Z
= function of frequency. Specifically, Z ~ e^(-pi * n * i / 2) / omega^n .
It was simple enough to create a codemodel for AC analysis, since the input
is a voltage sine, I can easily give output current using the Z equation.
Things are more complicated for transient analysis, because I get a
time-varying voltage. I have approached this problem as specifying a
digital filter -- I am designing a FIR with scipy, then I'll create a
codemodel to apply any given FIR. However, this approach strikes me as
error-prone given that I am not an expert in DSP by any means, and that
there are a large number of issues that I have to be aware of as I design
my filter: how many taps do I need to get reasonable fidelity? How much
delay does the FIR introduce? Am I using the same sampling rate between
scipy and ngspice? Etc I feel like I could go on all day.
My question is: has anyone been in this boat already? Where you need to
create an arbitrary magnitude/phase response element. What has worked for
Incidentally, I know that one other common approach is to create an
equivalent circuit. Is this a better way to go about this problem? I had
not looked deeply into it given that I am unsure that there are any
algorithms to generate a circuit for any given response.
Thank you in advance,