Hello, Andrew! I think, I have similar problem simulating the following model in spectre:
.SUBCKT IPD100N06S4 drain gate source Tj Tcase PARAMS: dVth=0 dRdson=0 dgfs=0 dC=0 Zthtype=0 Ls=1.5n Ld=1n Lg=3n
.PARAM Rs=659u Rg=1.3 Rd=50u Rm=180u
.PARAM Inn=90 Unn=10 Rmax=3.5m gmin=60
.PARAM RRf=390m Rrbond=12m Rtb=5.5 g2=758m
.PARAM act=9.3
.FUNC Pb(I,dT,Rb) {Rb/(2*Rtb)*(I-limit(dT/(max(I,1n)*Rb)+RRf*I*g2,0,I))**2}
X1 d1 g s Tj S4_60_o_var PARAMS: a={act} dVth={dVth} dR={dRdson} dgfs={dgfs} Inn={Inn} Unn={Unn}
+Rmax={Rmax} gmin={gmin} Rs={Rs} Rp={Rd} dC={dC} Rm={Rm}
Rg g1 g {Rg}
Lg gate g1 {Lg*if(dgfs==99,0,1)}
Gs s1 s VALUE={V(s1,s)/(Rs*(1+(limit(V(Tj),-200,999)-25)*4m)-Rm)}
Rsa s1 s 1Meg
Ls source s1 {Ls*if(dgfs==99,0,1)}
Rda d1 d2 {Rd}
Ld drain d2 {Ld*if(dgfs==99,0,1)}
Rsb source s1 10
Rga gate g1 10
Rdb drain d2 10
G_TH 0 Tb VALUE = {Pb(abs(I(Ls)),V(Tj,Tcase),Rrbond*(1+(limit((V(Tb)+V(Tj))/2,-200,999)-25)*4m))}
Cthb Tb 0 3.71m
Rthb Tb Tj {Rtb}
Rth1 Tj t1 {3.18m+limit(Zthtype,0,1)*1.18m}
Rth2 t1 t2 {37.94m+limit(Zthtype,0,1)*14.04m}
Rth3 t2 t3 {152.2m+limit(Zthtype,0,1)*57.57m}
Rth4 t3 t4 {154.57m+limit(Zthtype,0,1)*115.94m}
Rth5 t4 Tcase {264.77m+limit(Zthtype,0,1)*198.61m}
Cth1 Tj 0 97.107u
Cth2 t1 0 334.606u
Cth3 t2 0 2.294m
Cth4 t3 0 1.639m
Cth5 t4 0 37.686m
Cth6 Tcase 0 70m
.ENDS
I receive messages:
WARNING (SFE-1805): "/OptiMOS-T2_60V.lib" 11: .FUNC is not recognised as a valid SPICE control card.
ERROR (SFE-1024): "/OptiMOS-T2_60V.lib" 16: Instance `Lg': Unexpected value `0' - positional parameters are not allowed after explicitly named parameters.
I have fixed problem with "if" by introducing ternary operator ( ? : ), but I do not know how to handle .FUNC and limit() constructions.
Could you help?