* Z:\home\khalils\Downloads\files\data\raw_asc\0291754737f1_USB_sense_old_WCA.asc
* Generated by LTspice 26.0.1 for Windows.
V1 Vin 0 5
V2 PSU_en 0 PULSE(0 5 1m 10u 10u 3m)
R3 PSU_en N002 {WC1(1k,0.05,0)}
R4 N002 0 {WC1(100k,0.05,1)}
D1 0 Vin_mon BZX84-C3V3
R2 Vin N001 {WC1(3k6,0.05,2)}
R6 Vin_mon 0 {WC1(6k8,0.01,3)}
V3 STEPPING 0 {STEPPING}
V4 THERSHOLD 0 2.475
M1 N001 N002 Vin_mon Vin_mon NMOS
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.model NMOS NMOS
.model PMOS PMOS
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.mos
* .dc V1 0 7 0.1
.tran 5m startup
***********************************************************
*
* BZX84-C3V3
*
* Nexperia
*
* Voltage regulator diodes
* VFmax = 0,9V @ IF = 10mA
* IRmax = 5A @ VR = 1V
* VZmax = 3,5V @ IZ = 5mA
* IZSM = 6A @ tp = 100s
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT23
*
* Package Pin 1: Anode
* Package Pin 2: Not Connected
* Package Pin 3: Cathode
*
*
* Extraction date (week/year): #
* Simulator: PSPICE
*
***********************************************************
*
.MODEL BZX84-C3V3 D
+ IS = 7.035E-16
+ N = 0.9809
+ BV = 3.3
+ IBV = 0.005
+ RS = 0.3487
+ CJO = 3.162E-10
+ VJ = 0.6687
+ M = 0.3164
+ FC = 0.5
.ENDS
*
.FUNC MOD(a,b) {a-FLOOR(a/b)*b}
.FUNC BIT(x) {if(MOD(STEPPING,2**(X+1))>=2**x,1,0)}
.FUNC EVA1 (nom, tol, param_num) {if(STEPPING == -1, nom, nom*(1-tol)+2*nom*tol*BIT(param_num))}
.FUNC EVA2 (nom, min, max, param_num) {if(STEPPING == -1, nom, IF(BIT(param_num),max,min))}
.FUNC WC1 (nom, tol, param_num) EVA1(nom, tol, param_num)
.FUNC WC2 (nom, min, max, param_num) EVA2(nom, min, max, param_num)
.step param STEPPING -1 15 1
**********
.SUBCKT BSS169_L1 drain gate source PARAMS: dVth=0 dRdson=0 dgfs=0 dC=0
.PARAM Rs=0.074 Rg=10 Ls=3n Ld=1n Lg=3n
.PARAM Inn=0.05 Unn=0 Rmax=12
.PARAM act=0.25
X1 d1 g s Tj K_100_d_var PARAMS: a={act} dVth={dVth} dR={dRdson} Inn={Inn} Unn={Unn}
+Rmax={Rmax} dgfs={dgfs} Rs={Rs} dC={dC} heat=0
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))}
Rsa s1 s 1Meg
Ls source s1 {Ls*if(dgfs==99,0,1)}
Ld drain d1 {Ld*if(dgfs==99,0,1)}
E1 Tj w VALUE={TEMP}
R1 w 0 1u
.ENDS
*$
**********
**************************************************************************************
.SUBCKT K_100_d_var dd g s Tj PARAMS: a=1 dVth=0 dR=0 dgfs=0 Inn=1 Unn=1 Rmax=1
+gmin=1 Rs=1 Rp=1 dC=0 heat=1
.PARAM Vth0=-1.8 beta4c=0.303 ph0=20 ph1=0.026 Ubr=150
.PARAM Rd=0.6 nmu=2.6 Rf=0.2 rpa=0.02925 lnIsj=-24.6
.PARAM Rdi=0.073
.PARAM Tref=298 T0=273 auth=3m c=0.82 mu_bet=0.4
.PARAM f_bet=-2 ndi=1.2 UTnbr=207m lnBr=-23 kbq=85.8u
.PARAM Wcml={beta4c*4*c}
.PARAM aubr={0.93m*UBr}
.PARAM dvgs={0.1-0.06*Vth0}
.PARAM f1=118p f2=118p f3=207p f4=330p f5=217p
.PARAM U0=0.5 nd=0.42 nc=0.5 g1=4 bb=-10.8
.PARAM sl=30p remp=0p ta=60n td=20n
.PARAM Vmin=-2.9 Vmax=-1.8 dCmax=0.35
.PARAM Vth={Vth0+(Vmax-Vth0)*limit(dVth,0,1)-(Vmin-Vth0)*limit(dVth,-1,0)}
.PARAM p0={Wcml*a*((1-f_bet)*(T0/Tref)**mu_bet+f_bet) }
.PARAM Rlim={(Rmax-Rs-(Unn-Vth0-Inn*Rs-SQRT((Unn-Vth0-Inn*Rs)**2-4*c*Inn/p0))/(2*c*Inn))/(1+rpa*(Inn/a)**2)}
.PARAM dRd={Rd/a+if(dVth==0,limit(dR,0,1)*max(Rlim-Rd/a,0),0)}
.PARAM bet={Wcml}
.PARAM dC1={1+dCmax*limit(dC,0,1)}
.PARAM Cox={f1*a*dC1}
.PARAM Cds0={f2*a*dC1}
.PARAM Cgs0={f3*a*dC1}
.PARAM Cox1={f5*a*dC1}
.PARAM Crand={remp*SQRT(a)}
.PARAM dRdi={Rdi/a}
.FUNC U1(Uds,T) {(SQRT(1+4*(0.4+(T-T0-25)*2m)*abs(Uds))-1)/2/(0.4+(T-T0-25)*2m)}
.FUNC I2(p,Uee,z1,pp) {if(Uee>pp,(Uee-c*z1)*z1,p*(pp-p)/c*exp((Uee-pp-(min(0,Uee))**2)/p))}
.FUNC Ig(Uds,T,p,Uee) {bet*((1-f_bet)*(T0/T)**mu_bet+f_bet)*I2(p,Uee,min(Uds,Uee/(2*c)),min(2*p,p+c*Uds))}
.FUNC Iges(Uds,Ugs,T)
+{a*(sgn(Uds)*Ig(U1(Uds,T),T,1/(ph0-ph1*T),Ugs-Vth+auth*(T-Tref))+exp(min(lnBr+(abs(Uds)-UBr-aubr*(T-Tref))/UTnbr,25)))}
.FUNC Isjt(Tj) {exp(min(lnIsj+(Tj/Tref-1)*1.12/(ndi*kbq*Tj),9))*(Tj/Tref)**1.5}
.FUNC Idiode(Usd,Tj,Iss) {exp(min(log(Iss)+Usd/(ndi*kbq*Tj),9))-Iss}
.FUNC Idiod(Usd,Tj) {a*Idiode(Usd,Tj,Isjt(Tj))}
.FUNC QCdg(x,z) {if(f4>f5,(f5**2-(f4-z*sl)**2)/(2*sl)+f5*min(x,(f4-f5)/sl),f4*z-sl*z**2/2-f5*max((f4-f5)/sl-x,0))}
E_Edg d ox VALUE {V(d,g)-(min(V(d,g),-bb)+1/(g1*(1-nc))*((1/(1+g1*max(V(d,g)+bb,0)))**(nc-1)-1))}
C_Cdg ox g {Cox}
E_Edg1 d ox1 VALUE {V(d,g)-QCdg(V(d,g),limit(V(d,g),(f4-f5)/sl,f4/sl))/f5}
C_Cdg1 ox1 g {Cox1}
C_Cdg2 d g {Crand}
E_Eds d edep VALUE {(V(d2,s)-I(V_sense3)/Cds0)}
C_Cds edep s {Cds0}
C_Cds2 d2 s {Cds0/500}
C_Cgs g s {Cgs0}
G_chan d s VALUE={Iges(V(d,s),V(g,s),T0+limit(V(Tj),-200,350))}
E_RMos d1 d VALUE={I(V_sense)*(Rf*dRd+(1-Rf)*dRd*((limit(V(Tj),-200,999)+T0)/Tref)**nmu)*(1+rpa*(I(V_sense)/a)**2)}
V_sense dd d1 0
G_diode s d2 VALUE={Idiod(V(s,d2),T0+limit(V(Tj),-200,499))}
R_Rdio d2 d3 {dRdi}
V_sense2 d1 d3 0
L_L001 a c {td/(ta+td)}
R_R001 a b {1/ta}
V_sense3 c f 0
R_sense3 f 0 1
E_E001 b 0 VALUE {I(V_sense2)}
E_E002 e 0 VALUE {1Meg*Cds0*(1/(1-nd)*U0**nd*(limit(U0+V(d2,s),U0/2,2*UBr))**(1-nd)+2**nd*min(V(d2,s)+U0/2,0))}
R_R002 e c 1Meg
R1 g s 1G
Rd01 d s 500Meg
Rd02 d2 s 500Meg
Rd03 d1 d 10k
G_TH 0 Tj VALUE = {heat*LIMIT(I(V_sense)*V(dd,s),0,100k)}
.ENDS
*$
*****************************************************************************************************
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 7904 1972
WIRE 624 -32 432 -32
WIRE 432 -16 432 -32
WIRE 624 0 624 -32
WIRE -672 48 -736 48
WIRE -416 48 -464 48
WIRE -736 80 -736 48
WIRE -464 80 -464 48
WIRE 432 80 432 64
WIRE 624 96 624 80
WIRE -736 176 -736 160
WIRE 96 176 -32 176
WIRE 288 176 176 176
WIRE 576 176 288 176
WIRE -464 192 -464 160
WIRE -32 208 -32 176
WIRE 288 208 288 176
WIRE -32 320 -32 288
WIRE 288 320 288 288
WIRE 624 320 624 192
WIRE 912 320 624 320
WIRE 1024 320 912 320
WIRE 624 352 624 320
WIRE 912 368 912 320
WIRE 624 464 624 432
WIRE 912 464 912 432
FLAG 288 320 0
FLAG -32 320 0
FLAG 432 80 0
FLAG 1024 320 Vin_mon
FLAG 912 464 0
FLAG 624 464 0
FLAG -32 176 PSU_en
FLAG 432 -32 Vin
FLAG -736 176 0
FLAG -672 48 STEPPING
IOPIN -672 48 Out
FLAG -416 48 THERSHOLD
IOPIN -416 48 Out
FLAG -464 192 0
SYMBOL voltage 432 -32 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage -32 192 R0
WINDOW 3 21 91 Left 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value PULSE(0 5 1m 10u 10u 3m)
SYMATTR InstName V2
SYMBOL res 80 192 R270
WINDOW 0 -36 58 VTop 2
WINDOW 3 65 77 VBottom 2
SYMATTR InstName R3
SYMATTR Value {WC1(1k,0.05,0)}
SYMBOL res 272 192 R0
WINDOW 3 34 74 Left 2
SYMATTR Value {WC1(100k,0.05,1)}
SYMATTR InstName R4
SYMBOL zener 928 432 R180
WINDOW 0 -37 48 Left 2
WINDOW 3 -147 16 Left 2
SYMATTR InstName D1
SYMATTR Value BZX84-C3V3
SYMBOL res 608 -16 R0
SYMATTR InstName R2
SYMATTR Value {WC1(3k6,0.05,2)}
SYMBOL res 608 336 R0
SYMATTR InstName R6
SYMATTR Value {WC1(6k8,0.01,3)}
SYMBOL voltage -736 64 R0
SYMATTR InstName V3
SYMATTR Value {STEPPING}
SYMBOL voltage -464 64 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value 2.475
SYMBOL nmos 576 96 R0
SYMATTR InstName M1
TEXT -192 416 Left 2 ;.dc V1 0 7 0.1
TEXT -192 456 Left 2 !.tran 5m startup
TEXT 2392 -352 Left 2 !***********************************************************\n*\n* BZX84-C3V3\n*\n* Nexperia\n*\n* Voltage regulator diodes\n* VFmax = 0,9V    @ IF = 10mA\n* IRmax = 5µA     @ VR = 1V\n* VZmax = 3,5V    @ IZ = 5mA\n* IZSM  = 6A      @ tp = 100µs\n*\n*\n*\n* Package pinning does not match Spice model pinning.\n* Package: SOT23\n*\n* Package Pin 1: Anode\n* Package Pin 2: Not Connected\n* Package Pin 3: Cathode\n*\n*\n* Extraction date (week/year): #\n* Simulator: PSPICE\n*\n***********************************************************\n*\n.MODEL BZX84-C3V3 D\n+ IS = 7.035E-16\n+ N = 0.9809\n+ BV = 3.3\n+ IBV = 0.005\n+ RS = 0.3487\n+ CJO = 3.162E-10\n+ VJ = 0.6687\n+ M = 0.3164\n+ FC = 0.5\n.ENDS\n*
TEXT -776 -280 Left 2 !.FUNC MOD(a,b) {a-FLOOR(a/b)*b}\n.FUNC BIT(x) {if(MOD(STEPPING,2**(X+1))>=2**x,1,0)}\n.FUNC EVA1 (nom, tol, param_num) {if(STEPPING == -1, nom, nom*(1-tol)+2*nom*tol*BIT(param_num))}\n.FUNC EVA2 (nom, min, max, param_num) {if(STEPPING == -1, nom, IF(BIT(param_num),max,min))}\n.FUNC WC1 (nom, tol, param_num) EVA1(nom, tol, param_num)\n.FUNC WC2 (nom, min, max, param_num) EVA2(nom, min, max, param_num)
TEXT -776 -112 Left 2 !.step param STEPPING -1 15 1
TEXT 1280 -360 Left 2 !**********\n \n.SUBCKT BSS169_L1 drain gate source PARAMS: dVth=0 dRdson=0 dgfs=0 dC=0\n \n.PARAM Rs=0.074     Rg=10        Ls=3n        Ld=1n        Lg=3n\n.PARAM Inn=0.05     Unn=0        Rmax=12\n.PARAM act=0.25\n \nX1  d1 g s Tj K_100_d_var PARAMS: a={act} dVth={dVth} dR={dRdson} Inn={Inn} Unn={Unn} \n                                        +Rmax={Rmax} dgfs={dgfs} Rs={Rs} dC={dC} heat=0\nRg    g1     g    {Rg}   \nLg    gate   g1   {Lg*if(dgfs==99,0,1)}\nGs    s1     s    VALUE={V(s1,s)/(Rs*(1+(limit(V(Tj),-200,999)-25)*4m))}\nRsa   s1     s    1Meg\nLs    source s1   {Ls*if(dgfs==99,0,1)}\nLd    drain  d1   {Ld*if(dgfs==99,0,1)}\n \nE1    Tj     w      VALUE={TEMP}\nR1    w      0      1u\n \n.ENDS\n*$\n \n**********
TEXT 3008 -368 Left 2 !**************************************************************************************\n \n\n.SUBCKT K_100_d_var dd g s Tj PARAMS: a=1 dVth=0 dR=0 dgfs=0 Inn=1 Unn=1 Rmax=1\n+gmin=1 Rs=1 Rp=1 dC=0 heat=1\n \n.PARAM  Vth0=-1.8      beta4c=0.303   ph0=20         ph1=0.026      Ubr=150\n.PARAM  Rd=0.6         nmu=2.6        Rf=0.2         rpa=0.02925    lnIsj=-24.6\n.PARAM  Rdi=0.073\n \n.PARAM  Tref=298     T0=273      auth=3m      c=0.82       mu_bet=0.4\n.PARAM  f_bet=-2     ndi=1.2     UTnbr=207m   lnBr=-23     kbq=85.8u\n.PARAM  Wcml={beta4c*4*c}        \n.PARAM  aubr={0.93m*UBr}\n.PARAM  dvgs={0.1-0.06*Vth0}\n \n.PARAM  f1=118p        f2=118p        f3=207p        f4=330p        f5=217p\n.PARAM  U0=0.5         nd=0.42        nc=0.5         g1=4           bb=-10.8\n.PARAM  sl=30p         remp=0p        ta=60n         td=20n\n \n.PARAM  Vmin=-2.9      Vmax=-1.8      dCmax=0.35\n.PARAM  Vth={Vth0+(Vmax-Vth0)*limit(dVth,0,1)-(Vmin-Vth0)*limit(dVth,-1,0)}\n.PARAM  p0={Wcml*a*((1-f_bet)*(T0/Tref)**mu_bet+f_bet)    }\n.PARAM  Rlim={(Rmax-Rs-(Unn-Vth0-Inn*Rs-SQRT((Unn-Vth0-Inn*Rs)**2-4*c*Inn/p0))/(2*c*Inn))/(1+rpa*(Inn/a)**2)} \n.PARAM  dRd={Rd/a+if(dVth==0,limit(dR,0,1)*max(Rlim-Rd/a,0),0)} \n.PARAM  bet={Wcml}\n \n.PARAM  dC1={1+dCmax*limit(dC,0,1)} \n.PARAM  Cox={f1*a*dC1}\n.PARAM  Cds0={f2*a*dC1}\n.PARAM  Cgs0={f3*a*dC1}\n.PARAM  Cox1={f5*a*dC1}\n.PARAM  Crand={remp*SQRT(a)}\n.PARAM  dRdi={Rdi/a}\n \n.FUNC U1(Uds,T)       {(SQRT(1+4*(0.4+(T-T0-25)*2m)*abs(Uds))-1)/2/(0.4+(T-T0-25)*2m)}\n.FUNC I2(p,Uee,z1,pp) {if(Uee>pp,(Uee-c*z1)*z1,p*(pp-p)/c*exp((Uee-pp-(min(0,Uee))**2)/p))}\n.FUNC Ig(Uds,T,p,Uee) {bet*((1-f_bet)*(T0/T)**mu_bet+f_bet)*I2(p,Uee,min(Uds,Uee/(2*c)),min(2*p,p+c*Uds))}\n.FUNC Iges(Uds,Ugs,T) \n +{a*(sgn(Uds)*Ig(U1(Uds,T),T,1/(ph0-ph1*T),Ugs-Vth+auth*(T-Tref))+exp(min(lnBr+(abs(Uds)-UBr-aubr*(T-Tref))/UTnbr,25)))}\n \n.FUNC Isjt(Tj)           {exp(min(lnIsj+(Tj/Tref-1)*1.12/(ndi*kbq*Tj),9))*(Tj/Tref)**1.5}\n.FUNC Idiode(Usd,Tj,Iss) {exp(min(log(Iss)+Usd/(ndi*kbq*Tj),9))-Iss}\n.FUNC Idiod(Usd,Tj)      {a*Idiode(Usd,Tj,Isjt(Tj))}\n \n.FUNC QCdg(x,z)  {if(f4>f5,(f5**2-(f4-z*sl)**2)/(2*sl)+f5*min(x,(f4-f5)/sl),f4*z-sl*z**2/2-f5*max((f4-f5)/sl-x,0))}\n \nE_Edg     d   ox  VALUE {V(d,g)-(min(V(d,g),-bb)+1/(g1*(1-nc))*((1/(1+g1*max(V(d,g)+bb,0)))**(nc-1)-1))}\nC_Cdg     ox  g   {Cox}\nE_Edg1    d   ox1 VALUE {V(d,g)-QCdg(V(d,g),limit(V(d,g),(f4-f5)/sl,f4/sl))/f5}\nC_Cdg1    ox1 g   {Cox1}\nC_Cdg2    d   g   {Crand}\n \nE_Eds     d edep  VALUE {(V(d2,s)-I(V_sense3)/Cds0)}\nC_Cds  edep    s  {Cds0}\nC_Cds2   d2    s  {Cds0/500}\n \nC_Cgs     g    s  {Cgs0}\n \nG_chan    d    s  VALUE={Iges(V(d,s),V(g,s),T0+limit(V(Tj),-200,350))}\nE_RMos   d1    d  VALUE={I(V_sense)*(Rf*dRd+(1-Rf)*dRd*((limit(V(Tj),-200,999)+T0)/Tref)**nmu)*(1+rpa*(I(V_sense)/a)**2)}\nV_sense  dd   d1  0\nG_diode   s   d2  VALUE={Idiod(V(s,d2),T0+limit(V(Tj),-200,499))}\nR_Rdio   d2   d3  {dRdi}\nV_sense2 d1   d3  0\n \nL_L001    a    c  {td/(ta+td)}\nR_R001    a    b  {1/ta}\nV_sense3  c    f  0\nR_sense3  f    0  1\nE_E001    b    0  VALUE {I(V_sense2)}\nE_E002    e    0  VALUE {1Meg*Cds0*(1/(1-nd)*U0**nd*(limit(U0+V(d2,s),U0/2,2*UBr))**(1-nd)+2**nd*min(V(d2,s)+U0/2,0))}\nR_R002    e    c  1Meg\n \nR1        g    s  1G\nRd01      d    s  500Meg\nRd02     d2    s  500Meg\nRd03     d1    d  10k\n \nG_TH      0    Tj  VALUE = {heat*LIMIT(I(V_sense)*V(dd,s),0,100k)}\n \n.ENDS\n*$\n \n*****************************************************************************************************