Hi Masurov,
I am using the Current Mode PWM to simulate the flyback that is shown in Video 1.
Here is the Netlist of Basso's Current Mode switching PWM.
Robert
*Library: Models\BASSO_SWITCHED
*
.SUBCKT PWMCM2 3 4 6 2 5 1
*$PINNAMES: COMP FB VOSC GND SENSE OUT
+ PARAMS:
+ REF=2.5, PERIOD=10U, DUTYMAX=0.8, RAMP=5V, VOUTHI=12V,
+ ROUT=10, VHIGH=3, ISINK=15M, ISOURCE=500U,
+ VLOW=100M, POLE=30, GAIN=31622, VOUTLO=100M, RATIO=0.333
*
* Generic Model for Current Mode PWM controller
* Developed by Christophe BASSO, France
* PSpice compatible format
* Last modified: October 25th 1996
*
***** Generic PWM controller parameters *******
* REF ; internal reference voltage
* PERIOD ; switching period
* DUTYMAX ; maximum duty cycle
* RAMP ; ramp amplitude for compensation
* VOUTHI ; driver output voltage high
* VOUTLO ; driver output voltage low
* ROUT ; driver output resistor
***** Internal error amplifier parameters *****
* VHIGH ; maximum output voltage
* VLOW ; minimum output voltage
* ISINK ; sink capability
* ISOURCE ; source capability
* POLE ; first pole in Hertz
* GAIN ; DC open-loop gain (default=90dB)
* RATIO ; maximum peak current at max output error level
; (CM only)
***********************************************
XERR 10 4 3 2 ERRAMP PARAMS: VHIGH={VHIGH} ISINK={ISINK} ISOURCE={ISOURCE} ; error amplifier
+ VLOW={VLOW} POLE={POLE} GAIN={GAIN}
VREF 10 2 {REF} ; reference voltage
ELIM 500 2 VALUE = { V(3)*RATIO } ; max peak current = VOH*RATIO / Rsense
XCOM 5 500 12 COMP ; limit comparator
XFFL 11 82 14 13 FFLOP ; flip-flop
RDUM 13 2 1MEG
VCLK 11 2 PULSE 0 5 0 1N 1N 10N {PERIOD} ; Clock set pulses
VRAMP 6 2 PULSE 0 {RAMP} 0 {PERIOD-2N} 1N 1N {PERIOD}
VDUT 80 2 PULSE 0 5 {PERIOD*DUTYMAX} 1N 1N {(PERIOD-PERIOD*DUTYMAX)-2N} {PERIOD} ; max. duty cycle (=delay/period) delay=period-(tr+tf+tpuls)
XOR1 11 14 81 OR2 ; Clock OR FFlopD
XOR2 80 12 82 OR2 ; IMAX OR MAXduty Reset
E_BOUT 15 2 VALUE = { IF ( V(81) > 3.5, {VOUTHI}, {VOUTLO} ) }
ROUT 15 1 {ROUT} ; output resistor
**** ERROR AMPLIFIER MODEL ****
.SUBCKT ERRAMP 20 8 3 21 PARAMS: ISINK= 15M, ISOURCE=500U, VHIGH=2.8, VLOW=100M, POLE=30, GAIN=31622
* + - OUT GND
RIN 20 8 8MEG
CP1 11 21 {1/(6.28*(GAIN/100U)*POLE)}
E1 5 21 11 21 1
R9 5 2 5
D14 2 13 DMOD
IS 13 21 {ISINK/100} ; mA
Q1 21 13 16 QPMOD
ISRC 7 3 {ISOURCE} ; uA
D12 3 7 DMOD
D15 21 11 DCLAMP
G1 21 11 20 8 100U
V1 7 21 {VHIGH-0.6V}
V4 3 16 {VLOW-38MV}
RP1 11 21 {GAIN/100U}
.MODEL QPMOD PNP
.MODEL DCLAMP D (RS=10 BV=10 IBV=0.01)
.MODEL DMOD D (TT=1N CJO=10P)
.ENDS ERRAMP
*$
**** 2 INPUT COMPARATOR ****
.SUBCKT COMP 1 2 3
* + - S
E_B1 4 0 VALUE = { IF ( V(1) > V(2), 5V, 0 ) }
RD 4 3 100
CD 3 0 10P
.ENDS COMP
*$
**** 2 INPUT OR CIRCUIT ****
.SUBCKT OR2 1 2 3
E_B1 4 0 VALUE = { IF ( (V(1)>800M) | (V(2)>800M), 5V, 0 ) }
RD 4 3 100
CD 3 0 10P
.ENDS OR2
*$
.SUBCKT FFLOP 6 8 2 1
* S R Q Q\
E_BQB 10 0 VALUE = { IF ( (V(
![Cool 8)](https://www.eevblog.com/forum/Smileys/default/cool.gif)
<800M) & (V(2)>800M), 0, 5V ) }
E_BQ 20 0 VALUE = { IF ( (V(6)<800M) & (V(1)>800M), 0, 5V ) }
RD1 10 1 100
CD1 1 0 10P IC=5
RD2 20 2 100
CD2 2 0 10P IC=0
.ENDS FFLOP
*$
.ENDS PWMCM2