transmission line model for MEISP

84 views
Skip to first unread message

Oliver Weber

unread,
Apr 22, 2013, 9:33:00 AM4/22/13
to impedance-s...@googlegroups.com
Dear Group,

I am trying to reproduce the transmission line model in a paper of Fabregat-Santiago (reference below) by writing a function for a user-defined distributed element for MEISP. When I tested the function I received an error of expected ')' or expected 'comma'. Does anyone have an opinion of the mistakes (probably many) that I am making?

function Bisquert(w,R1,R3,Q3)

                B = 0.98;

                L = 1/((R1*Q3)*pow(1/B));

                E = 1/((R3*Q3)*pow(1/B));

                z = sqrt((R1*R3)/(1+(1j*w/E)*pow(B)))*(cosh((E/L)*pow(B/2)*sqrt(1+(1j*w/E)*pow(B))))/(sinh((E/L)*pow(B/2)*sqrt(1+(1j*w/E)*pow(B))));

return 1/z;


B is supposed to be the exponent of a constant phase element  Z3 = Q3 ^(-1)  (iω)^(-B). I have just assigned it a numerical value for simplicity, it should presumably be a variable?


Thank you,

Oli Weber,
Undergraduate,
University of Bristol

Francisco Fabregat-Santiago, Germa Garcia-Belmonte, Juan Bisquert, Arie Zaban, and
P. Salvador, Decoupling of Transport, Charge Storage, and Interfacial Charge Transfer in the Nanocrystalline TiO2/Electrolyte System by Impedance Methods  J. Phys. Chem. B, 2002, 106 (2), pp 334–339


Yevgen Barsukov

unread,
Apr 22, 2013, 10:24:29 AM4/22/13
to impedance-s...@googlegroups.com

First of all pow(a,b) function needs two arguments like 2^5 is pow(2,5), but you are using it with one argument.
This is what likely causes the issue.

In the help file there is no examples that uses constants (see below), although I would be surprised if it would not be recognized. 

Anyway, to try it you could pass all numerical values through the 
variable list. If you want to keep it constant, you can do so by setting an initial value, and making it fixed in the fit.

Another possible issue is that the string 
sqrt((R1*R3)/(1+(1j*w/E)*pow(B)))*(cosh((E/L)*pow(B/2)*sqrt(1+(1j*w/E)*pow(B))))/(sinh((E/L)*pow(B/2)*sqrt(1+(1j*w/E)*pow(B))));
is too long for the parser. 
Try splitting it into many smaller sub-variables, this will also make it easier to keep track of the brackets...


Here is the help section on user-defined functions:

*****************
User-defined function format


It is possible to create new functions which can be used as a black-box element in all circuits by simply typing its defining equation in file with extension *.fun. This files should be stored in directory \userfun and included into your netlist file with #include name.fun statement. If arbitrary circuit is created with CEDIT, include statement will be added automatically. Format of the function definition file is simple:

function <name>(w, var1, var2, .... varN)
x=....;
y=....;
z=....;
return 1/z;

Example:
function sph_diff(w, Rd, Cd)
z=Rd/(1+sqrt(1j*w*3*Cd*Rd));
return 1/z;

· Function should always return admittance, 1/Z
· Function name can be any word, but it is recommended to use short words, otherwise they will not look nice in the graphical schematic. Also, some names are reserved by the program and should not be used. These are mathematical functions names listed below), and names of predefined distributed elements listed in "summary of distributed elements".
· w should always be the first argument of the function. It means angular frequency. 

· "1j" means imaginary multiplier i=sqrt(-1)
· function definition can has local variables with any names, which can be used for intermediate storage during calculations. All variables are considered as complex. Example

function fletcher1(w, Re,Ri, Cdl,Rp, Cp)

x = 1/(1j*w*Cdl+1/(Rp + (1/(1j*w*Cp))));
m=sqrt((Re+Ri)/(4*x));
z=(1+(tanh(m)/m))*Ri*Re/(Ri+Re)+sqrt((Ri+Re)*x)/tanh(2*m);
return 1/z;


· Each line should end with semicolon ";"
· You can use in your equations mathematical operators +,-,*,/ for both real or complex arguments. Additionally you can use large number of mathematical functions listed below. All of them accept complex arguments and give complex results when appropriate:

Function: 'abs'.

Function: 'arg'.

Function: 'real'.

Function: 'imag'.

Function: 'sqrt'.

Function: 'conj'.

Function: 'sin'.

Function: 'cos'.

Function: 'log'.

Function: 'exp'.

Function: 'sinh'.(hyperbolic sine)

Function: 'cosh'.(hyperbolic cosine)

Function: 'tanh' (hyperbolic tangent)

Function: 'pow' (pow(a,b) is equivalent to mathematical expression a^b)

Additionally, all distributed elements, can also be used as sub-functions in user-defined functions. If element's library name is given as <name> var1 var2 var3... varN it should be used as <name>(w, var1, war2, war3..varN).

 Note that all distributed elements functions return admittance (1/Z) and not impedance (Z). Here is an example using porous electrode impedance function, fletch

function fletch_ser(w, Rser, Rp, Cdl, Re,Ri, Cp)

z=Rser+1/fletch(w, Rp, Cdl, Re,Ri, Cp);
return 1/z;

MEISP : (C) 2000-2002, Korea Kumho Petrochemical Co., Ltd. (KUMHO)

*****************

Regards,
Yevgen



--
You received this message because you are subscribed to the Google Groups "Impedance Spectroscopy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to impedance-spectro...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Oliver Weber

unread,
Apr 23, 2013, 6:54:52 AM4/23/13
to impedance-s...@googlegroups.com
Dear Yevgen,

Thank you very much for taking the time to advise me, I have tried everything you suggested and my function is now working. :-)

Best Regards,

Oli
Reply all
Reply to author
Forward
0 new messages