* SPICE netlist
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

* LTspice schematic (.asc)
Version 4
SHEET 1 1952 1040
WIRE 512 -520 464 -520
WIRE 624 -520 592 -520
WIRE 656 -520 624 -520
WIRE 800 -520 736 -520
WIRE 864 -520 800 -520
WIRE 800 -472 800 -520
WIRE 624 -456 624 -520
WIRE 624 -360 624 -376
WIRE 752 -360 752 -488
WIRE 752 -360 624 -360
WIRE 800 -360 800 -408
WIRE 800 -360 752 -360
WIRE 624 -344 624 -360
WIRE -928 -216 -976 -216
WIRE -752 -216 -800 -216
WIRE -704 -216 -752 -216
WIRE -928 -200 -928 -216
WIRE -800 -200 -800 -216
WIRE 368 -200 336 -200
WIRE 448 -200 368 -200
WIRE 592 -200 448 -200
WIRE 752 -200 720 -200
WIRE 832 -200 752 -200
WIRE 976 -200 832 -200
WIRE 336 -184 336 -200
WIRE 592 -184 592 -200
WIRE 720 -184 720 -200
WIRE 976 -184 976 -200
WIRE 448 -168 448 -200
WIRE 832 -168 832 -200
WIRE -928 -88 -928 -120
WIRE 336 -72 336 -104
WIRE 448 -72 448 -104
WIRE 592 -72 592 -104
WIRE 720 -72 720 -104
WIRE 832 -72 832 -104
WIRE 976 -72 976 -104
WIRE -752 -8 -800 -8
WIRE -704 -8 -752 -8
WIRE -800 8 -800 -8
WIRE 432 168 384 168
WIRE 480 168 432 168
WIRE -752 184 -800 184
WIRE -704 184 -752 184
WIRE 384 184 384 168
WIRE -800 200 -800 184
WIRE -752 424 -800 424
WIRE -704 424 -752 424
WIRE -800 440 -800 424
FLAG 464 -520 a
IOPIN 16 112 BiDir
FLAG 624 -344 p
IOPIN 176 288 BiDir
FLAG 864 -520 c
IOPIN 416 112 BiDir
FLAG 720 -72 0
FLAG 832 -72 0
FLAG 976 -72 0
FLAG 752 -200 d2
FLAG -976 -216 vc
IOPIN -1424 416 In
FLAG -928 -88 0
FLAG -800 -120 0
FLAG -752 -216 dccm
FLAG -800 88 0
FLAG -752 -8 ddcm
FLAG -800 280 0
FLAG -752 184 d
FLAG 336 -72 0
FLAG 448 -72 0
FLAG 592 -72 0
FLAG 368 -200 d1
FLAG 384 264 0
FLAG 432 168 cm_ccm_ac
FLAG -800 520 0
FLAG -752 424 mode
SYMBOL bi 512 -520 R270
SYMATTR InstName B1
SYMATTR Value I= V(d1) / ( V(d1) + V(d2) ) * I(Vsense)
SYMBOL voltage 640 -520 R270
SYMATTR InstName Vsense
SYMATTR Value 0
SYMBOL bv 624 -472 R0
SYMATTR Value V= V(d1) / ( V(d1) + V(d2) + 1u ) * V(a,p)
SYMATTR InstName B2
SYMBOL cap 784 -472 R0
SYMATTR InstName CR
SYMATTR Value Q = ( if( V(cm_ccm_ac) > 0.5, 4/ ( {L} * (2* pi *{f})**2 ), 0) ) * x
SYMBOL bi 720 -104 R180
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 816 -168 R0
SYMATTR InstName C1
SYMATTR Value 1p
SYMBOL res 960 -200 R0
SYMATTR InstName R1
SYMATTR Value 1
SYMBOL res -944 -216 R0
SYMATTR InstName R2
SYMATTR Value 1g
SYMBOL bv -800 -216 R0
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 -800 -8 R0
SYMATTR InstName B5
SYMATTR Value V= limit(  V(vc) * L * f / ( vr*f*L + ks * abs(V(a,c) )   ), 0, 1 )
SYMBOL bv -800 184 R0
SYMATTR InstName B6
SYMATTR Value V= min( V(ddcm), V(dccm) )
SYMBOL bi 336 -104 R180
SYMATTR InstName B7
SYMATTR Value I= limit( V(d), {D_min}, {D_max} )
SYMBOL cap 432 -168 R0
SYMATTR InstName C2
SYMATTR Value 1p
SYMBOL res 576 -200 R0
SYMATTR InstName R3
SYMATTR Value 1
SYMBOL bv 384 168 R0
SYMATTR InstName B8
SYMATTR Value V= smallsig() * if( ({ks}>10u) & ( V(dccm)<V(ddcm) ), 1, 0 )
SYMBOL bv -800 424 R0
SYMATTR InstName B9
SYMATTR Value V= if( V(dccm) < V(ddcm), 1, 0)