I apologize in advance for the large wall of text, but I feel like to properly ask this question, some background information is in order. I've been recently working on modelling the impedance of a circuit using the Mathworks SIMULINK/SIMSCAPE libraries - more specifically, I am interested in using the Impedance measurement block to perform an in silico impedance spectroscopy measurement (similarly to the Zfit function found in the Matlab File Exchange, https://ch.mathworks.com/matlabcentral/fileexchange/19460-zfit, though the latter neglects any phase terms which is why I also would like to build a model with Simulink).
However, one of the elements in my system is a generalized constant phase element (CPE), characterised by the following equation (in the Laplace domain, with \$ s=j\omega\$ - equivalent to a Fourier transform): \$ Z(j\omega) = 1/(j\omega C)^n \$, with C [F] being a capacitance value and 0≤n≤1. I thought of a few different ways to implement this, but each come with a few drawbacks:
Using the Zfit function: very easy to implement, but there is no phase information. Furthermore, when I will need to expand this model (to include the interaction of an additional body) by including an additional AC current source (which is itself made up of three independent current sources, with particular frequencies), I will need to rework the equivalent circuit with Norton/Thenevin in order to account for this current source. With Simscape, changing the circuit means simply connecting an additional block.
Using the built-in Impedance block in Simulink: Somewhat easy to implement, but will require additional blocks to provide \$n,C\$ as a parameters. Additionally, this block is simply a vector of impedance values which are linearly interpolated depending on the frequency (basically a fancy lookup table). Plus, I would need to use the fidgety Physical Signal/Simulink converter (or the reverse) to interface it with the Simscape blocks.
Modelling the impedance itself by a "super-block" which makes use of the Simulink transfer-function blocks and some other converters. This one is a likely candidate, but is a lot more work and it's a little harder to re-use in other models I may build.
For these reasons, I decided to look into building custom Simscape elements with the Simscape language (https://blogs.mathworks.com/simulink/2009/09/25/custom-components-in-physical-models/) in order to have something that is tunable and reusable across models. Briefly, you can define a file containing the nodes, branches, and parameters of your block, as well as the equations which define the through variables (basically "flow" variables, like current) and the across variables ("work/energy" variables, like electric potential).
For an ideal capacitor, this is easy enough since the relevant equations are well known:
- \$ V = V^+ - V^- \$ (the voltage across the two nodes is the difference between voltages in the input (+) and output (-) nodes)
- \$ i = C \frac{dV}{dt}\$ (or i = C*v.der in Simscape language)
However, for the case of the CPE this is a little more complicated. As a first idea, I figured that one could leverage the higher-order derivative properties in the Laplace domain (http://lpsa.swarthmore.edu/LaplaceZTable/LaplacePropTable.html) to handle the \$ (j\omega)^n\$ term but since n is a fractional number I believe this property cannot be used in this case.
My next attempt was to calculate the inverse Laplace transform of the transfer function from scratch. After many sheets and some help from WolframAlpha, I found something of the form:
$$ \frac{1}{C^n}\frac{t^{n-1}}{(n-1)!} $$
Finally, this leads me to a few questions:
Is this inverse transform approach really valid? Or am I missing something regarding the initial conditions of the circuit by starting directly from the transfer function of that element?
Is this formula really a correct inverse Laplace transform?
Am I correct in concluding that, after the time-domain response is found (the inverse Laplace transform of the TF),the overall equation then becomes: \$ Z(j\omega) = V(j\omega)/I(j\omega) \rightarrow V(t) = z(t) * i(t) \$? (with * denoting a convolution)
Bonus (for those with some Simscape experience): Are convolutions even implementable with the Simscape language? (I'm also asking this question in the MathWorks forums regarding the implementation of such a thing).
For those who got through this verbose question, I heartily thank you, and I appreciate any input you may have regarding these questions!
EDIT: If you're considering down-voting the question, I would appreciate if you could comment with a reason as to why (indaquate understanding, confusing question, not the appropriate forum, etc..) just to ensure that my question was indeed appropriate for this forum, and to help me better formulate them in the future. Seeing as this was the first question I've posted, I'm still relatively new to the SE system. Thanks!