Hi I am trying to simulate a model of a paper in LTSpice but I get an if function error which says "Syntax error: function if(): requires exactly three segments" These are the code of the model:
.subckt SEM + - R
.params
+ H0=0 rs=215 CH0=1e-4 del=0.01 vp=0.1
+ i01=6E-9 a1=2.3 rs1=20K
+ i02=1E-12 a2=15.9 rs2=350
+ i03=9e-4 a3=3
+ nset=7 vset=2 nres=6 vres=0
BH 0 H I=if(ddt(V(A,-))>=0,((D(V(H))-1)*S(V(A,-))
+ +S(D(V(A,-)))-D(V(H)))/S(D(V(A,-)))-1),
+ D(V(H))/R(D(V(A,-)))*R(V(A,-))) Rpar=1
CH H 0 {CH0} ic = {H0}
RS + A {rs}
RS1 A B {rs1}
BD1 B - I = i01*sinh(a1*V(B,-))
RS2 A C {rs2}
BD2 C - I = i02*(exp(a2*V(C,-))-1)
BPL A - I = V(H)*i03*V(A,-)**a3
BI 0 R I = i01*sinh(a1*vp)+i02*(exp(a2*vp)-1)
+ +V(H)*i03*vp**a3
.func D(x){delay(x,del)}
.func S(x){1/(1+exp(-nset*(x-vset)))}
.func R(x){1/(1+exp(-nres*(x-vres)))}
.ends
Is there something wrong?