Sie sind auf Seite 1von 3

//

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

*****************************************************************
PWMswVM.va - voltage mode PWM switch CCM-DCM auto-togggling
***************************************
Owner
: Nicolas Cyr
E-mail
: nicolas.cyr@onsemi.com
***************************************
Using Christophe Basso's model from his book "Switch-Mode Power
Supplies" (McGraw-Hill, 2008); based on Dr. Vatch Vorprian
initial concept developped in 1986 at Virginia Polytech Institute
(in "Simplified Analysis of PWM Converters Using the Model of the
PWM Switch", Transactions on Aerospace and Electronics Systems,
vol. 26, no. 3, May 1990).
***************************************
Revision history
2008 Jan 23 - Nico Cyr - creation
*****************************************************************

`include "constants.vams"
`include "disciplines.vams"

module PWMswVM(a, c, p, DC);


inout a;
inout c;
inout p;

electrical a;
electrical c;
electrical p;

// "active" terminal
// "common" terminal
// "passive" terminal

input DC;

electrical DC;

// "duty cycle" input

parameter
parameter
parameter
parameter

real
real
real
real

L=100u from (0:inf);


Fsw=100k from (0:inf);
DCmax=0.99 from (0:1);
DCmin=0.016 from (0:DCmax);

//
//
//
//

inductance value
switching frequency
duty cycle max clamp
duty cycle min clamp

real d1clh, d1cl, d_2, d2clh, d2cl;


analog begin
// calculate and clamp ON time duty cycle d1
d1clh = (V(DC) >= DCmax) ? DCmax : V(DC);
d1cl = (d1clh <= DCmin) ? DCmin : d1clh;
// calculate and clamp duty cycle d2 (which corresponds
// to OFF time in CCM, and to demagnetization time in DCM)
d_2 = (2*L*Fsw*I(p,c) / ((d1cl*V(a,c))+1u)) - d1cl;
d2clh = (d_2 >= (1-d1cl)) ? (1-d1cl) : d_2;
d2cl = (d2clh <= DCmin) ? DCmin : d2clh;

// assign values to currents and voltages


I(a,p) <+ I(p,c)*d1cl / (d1cl+d2cl);
V(c,p) <+ V(a,p)*d1cl / (d1cl+d2cl);
end
endmodule

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

*****************************************************************
PWMswCM.va - current mode PWM switch CCM-DCM auto-togggling
***************************************
Owner
: Nicolas Cyr
E-mail
: nicolas.cyr@onsemi.com
***************************************
Using Christophe Basso's model from his book "Switch-Mode Power
Supplies" (McGraw-Hill, 2008); based on Dr. Vatch Vorprian
initial concept developped in 1986 at Virginia Polytech Institute
(in "Simplified Analysis of PWM Converters Using the Model of the
PWM Switch", Transactions on Aerospace and Electronics Systems,
vol. 26, no. 3, May 1990).
***************************************
Revision history
2008 Jan 23 - Nico Cyr - creation
2009 August 25th - correction on the CS line reported by James Kohout
*****************************************************************

`include "constants.vams"
`include "disciplines.vams"

module PWMswCM(a, c, p, Verr, DC, Vmode);


inout a;
inout c;
inout p;

electrical a;
electrical c;
electrical p;

// "active" terminal
// "common" terminal
// "passive" terminal

input Verr;

electrical Verr;

// "error voltage" input

output DC;
output Vmode;

electrical DC;
electrical Vmode;

// "duty cycle" input


// "mode of operation" output
// (1 for DCM, 0 for CCM)

parameter
parameter
parameter
parameter
parameter
parameter

real
real
real
real
real
real

L=75u from (0:inf);


Fsw=100k from (0:inf);
Ri=1 from (0:inf);
Sa=0 from [0:inf);
DCmax=0.99 from (0:1);
DCmin=0.016 from (0:DCmax);

//
//
//
//
//
//

inductance value
switching frequency
sense resistor
slope of compensation ramp
duty cycle max clamp
duty cycle min clamp

real d_1, d1cl, d1clh, d_2, d2cl, d2clh, Cs, mode, Iverr, Imju, Ics;
analog begin
// calculate and clamp duty cycle d2 (which corresponds
// to OFF time in CCM, and to demagnetization time in DCM)
d_2 = (2*L*Fsw*I(p,c) / ((V(DC)*V(a,c))+1u)) - V(DC);
d2clh = (d_2 >= (1-V(DC))) ? (1-V(DC)) : d_2;
d2cl = (d2clh <= DCmin) ? DCmin : d2clh;
// calculate and clamp on time duty cycle d1
d_1 = d2cl*V(c,p) / (V(a,p)-V(c,p)+1u);
d1clh = (d_1 >= DCmax) ? DCmax : d_1;
d1cl = (d1clh <= DCmin) ? DCmin : d1clh;
// evaluate mode of operation (1=DCM, 0=CCM)
mode = (d2cl<(1-d1cl)) ? 1 : 0;
// calculate capacitor for subharmonic oscilllations (0 if DCM)
Cs = (mode==1) ? 0 : 4 / (L*4*pow(`M_PI,2)*pow(Fsw,2));
// calculate contributors to Ic current
Iverr = V(Verr) / Ri;
Imju = Sa*d1cl/(Ri*Fsw) + V(c,p)*d2cl*(1-((d1cl+d2cl)/2))/(L*Fsw);
Ics = Cs*ddt(V(c,p));
// assign values to currents and voltages
I(a,p) <+ I(p,c)*d1cl / (d1cl+d2cl);
I(p,c) <+ Iverr - Imju - Ics;
// Assign values to outputs
V(DC) <+ d1cl;
V(Vmode) <+ mode;
end
endmodule

Das könnte Ihnen auch gefallen