* Z:\home\khalils\Downloads\files\data\raw_asc\1165e8d164ff_PWM_BU.asc
* Generated by LTspice 26.0.1 for Windows.
B1 a N001 I= V(d1) / ( V(d1) + V(d2) ) * I(Vsense)
Vsense N001 c 0
B2 N001 p V= V(d1) / ( V(d1) + V(d2) + 1u ) * V(a,p)
CR c p Q = ( if( V(cm_ccm_ac) > 0.5, 4/ ( {L} * (2* pi *{f})**2 ), 0) ) * x
B3 0 d2 I= limit( abs( 2*L*f*(I(Vsense) ) / (V(d1)*V(a,c) + 10u ) - V(d1) ), 1-V(d1), 0 )
C1 d2 0 1p
R1 d2 0 1
R2 vc 0 1g
B4 dccm 0 V= limit( 2*f*L* ( V(vc) - ks*abs( I(Vsense) ) ) / ( 2*vr*f*L + ks * abs(V(a,c) ) ), 0, 1 )
B5 ddcm 0 V= limit( V(vc) * L * f / ( vr*f*L + ks * abs(V(a,c) ) ), 0, 1 )
B6 d 0 V= min( V(ddcm), V(dccm) )
B7 0 d1 I= limit( V(d), {D_min}, {D_max} )
C2 d1 0 1p
R3 d1 0 1
B8 cm_ccm_ac 0 V= smallsig() * if( ({ks}>10u) & ( V(dccm)<V(ddcm) ), 1, 0 )
B9 mode 0 V= if( V(dccm) < V(ddcm), 1, 0)
.param f 100k
.param L 50u
.param ks 0
.param vr 1
.param D_min 0.01
.param D_max 0.99
* V= smallsig() * if( ({ks}>10u) & ( V(dccm)<V(ddcm) ), 1, 0 )
* Q = ( if( V(cm_ccm_ac) > 0.5, 4/ ( {L} * (2* pi *{f})**2 ), 0) ) * x
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2780 1204
WIRE 64 112 16 112
WIRE 176 112 144 112
WIRE 208 112 176 112
WIRE 352 112 288 112
WIRE 416 112 352 112
WIRE 352 160 352 112
WIRE 176 176 176 112
WIRE 176 272 176 256
WIRE 304 272 304 144
WIRE 304 272 176 272
WIRE 352 272 352 224
WIRE 352 272 304 272
WIRE 176 288 176 272
WIRE -1376 416 -1424 416
WIRE -1200 416 -1248 416
WIRE -1152 416 -1200 416
WIRE -1376 432 -1376 416
WIRE -1248 432 -1248 416
WIRE -80 432 -112 432
WIRE 0 432 -80 432
WIRE 144 432 0 432
WIRE 304 432 272 432
WIRE 384 432 304 432
WIRE 528 432 384 432
WIRE -112 448 -112 432
WIRE 144 448 144 432
WIRE 272 448 272 432
WIRE 528 448 528 432
WIRE 0 464 0 432
WIRE 384 464 384 432
WIRE -1376 544 -1376 512
WIRE -112 560 -112 528
WIRE 0 560 0 528
WIRE 144 560 144 528
WIRE 272 560 272 528
WIRE 384 560 384 528
WIRE 528 560 528 528
WIRE -1200 624 -1248 624
WIRE -1152 624 -1200 624
WIRE -1248 640 -1248 624
WIRE -16 800 -64 800
WIRE 32 800 -16 800
WIRE -1200 816 -1248 816
WIRE -1152 816 -1200 816
WIRE -64 816 -64 800
WIRE -1248 832 -1248 816
WIRE -1200 1056 -1248 1056
WIRE -1152 1056 -1200 1056
WIRE -1248 1072 -1248 1056
FLAG 16 112 a
IOPIN 16 112 BiDir
FLAG 176 288 p
IOPIN 176 288 BiDir
FLAG 416 112 c
IOPIN 416 112 BiDir
FLAG 272 560 0
FLAG 384 560 0
FLAG 528 560 0
FLAG 304 432 d2
FLAG -1424 416 vc
IOPIN -1424 416 In
FLAG -1376 544 0
FLAG -1248 512 0
FLAG -1200 416 dccm
FLAG -1248 720 0
FLAG -1200 624 ddcm
FLAG -1248 912 0
FLAG -1200 816 d
FLAG -112 560 0
FLAG 0 560 0
FLAG 144 560 0
FLAG -80 432 d1
FLAG -64 896 0
FLAG -16 800 cm_ccm_ac
FLAG -1248 1152 0
FLAG -1200 1056 mode
SYMBOL bi 64 112 R270
WINDOW 0 60 -19 VTop 2
WINDOW 3 115 188 VBottom 2
SYMATTR InstName B1
SYMATTR Value I= V(d1) / ( V(d1) + V(d2) ) * I(Vsense)
SYMBOL voltage 192 112 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName Vsense
SYMATTR Value 0
SYMBOL bv 176 160 R0
WINDOW 3 -651 47 Left 2
SYMATTR Value V= V(d1) / ( V(d1) + V(d2) + 1u ) * V(a,p)
SYMATTR InstName B2
SYMBOL cap 336 160 R0
SYMATTR InstName CR
SYMATTR Value Q = ( if( V(cm_ccm_ac) > 0.5, 4/ ( {L} * (2* pi *{f})**2 ), 0) ) * x
SYMBOL bi 272 528 R180
WINDOW 0 6 176 Left 2
WINDOW 3 -882 154 Left 2
SYMATTR InstName B3
SYMATTR Value I= limit( abs( 2*L*f*(I(Vsense) ) / (V(d1)*V(a,c) + 10u ) - V(d1) ), 1-V(d1), 0 )
SYMBOL cap 368 464 R0
SYMATTR InstName C1
SYMATTR Value 1p
SYMBOL res 512 432 R0
SYMATTR InstName R1
SYMATTR Value 1
SYMBOL res -1392 416 R0
SYMATTR InstName R2
SYMATTR Value 1g
SYMBOL bv -1248 416 R0
WINDOW 0 49 45 Left 2
WINDOW 3 -25 131 Left 2
SYMATTR InstName B4
SYMATTR Value V= limit(   2*f*L* ( V(vc) - ks*abs( I(Vsense) ) ) / ( 2*vr*f*L + ks * abs(V(a,c) )   ), 0, 1 )
SYMBOL bv -1248 624 R0
WINDOW 0 49 45 Left 2
WINDOW 3 -27 135 Left 2
SYMATTR InstName B5
SYMATTR Value V= limit(  V(vc) * L * f / ( vr*f*L + ks * abs(V(a,c) )   ), 0, 1 )
SYMBOL bv -1248 816 R0
WINDOW 0 49 45 Left 2
WINDOW 3 -28 130 Left 2
SYMATTR InstName B6
SYMATTR Value V= min( V(ddcm), V(dccm) )
SYMBOL bi -112 528 R180
WINDOW 0 -33 172 Left 2
WINDOW 3 -304 138 Left 2
SYMATTR InstName B7
SYMATTR Value I= limit( V(d), {D_min}, {D_max} )
SYMBOL cap -16 464 R0
SYMATTR InstName C2
SYMATTR Value 1p
SYMBOL res 128 432 R0
SYMATTR InstName R3
SYMATTR Value 1
SYMBOL bv -64 800 R0
WINDOW 0 49 45 Left 2
WINDOW 3 -28 130 Left 2
SYMATTR InstName B8
SYMATTR Value V= smallsig() * if( ({ks}>10u) & ( V(dccm)<V(ddcm) ), 1, 0 )
SYMBOL bv -1248 1056 R0
WINDOW 0 49 45 Left 2
WINDOW 3 -25 131 Left 2
SYMATTR InstName B9
SYMATTR Value V= if( V(dccm) < V(ddcm), 1, 0)
TEXT 296 -328 Left 2 !.param f 100k
TEXT 296 -296 Left 2 !.param L 50u
TEXT 296 -256 Left 2 !.param ks 0
TEXT 296 -224 Left 2 !.param vr 1
TEXT 304 -168 Left 2 !.param D_min 0.01
TEXT 312 -128 Left 2 !.param D_max 0.99
TEXT -96 1000 Left 2 ;V= smallsig() * if( ({ks}>10u) & ( V(dccm)<V(ddcm) ), 1, 0 )
TEXT 384 272 Left 2 ;Q = ( if( V(cm_ccm_ac) > 0.5, 4/ ( {L} * (2* pi *{f})**2 ), 0) ) * x