Lucho
New Member
Offline
Posts: 5
Bucaramanga - Colombia
|
Hi all,
I'm working with a simple behavioral model of a boost converter. I'm trying to model the ripple based on the equations given by the theory. I use the idtmod function to create a sort of ripple on the waveform, defined by the frequency of operation and the ripple current. However, whenever I try to pass the modulus of idtmod as a parameter obtained in the initial_step the simulation never ends :-/. It's weird 'cause the operand works properly with the same parameters. What can I do to properly pass modulus of the idtmod calculated in the initial_step ?
Here is the code :)
//
`include "discipline.h" `include "constants.h"
module stepup (out, in, gnd);
electrical out, in, gnd;
parameter real D=0.14 from (0:1); parameter real L=100e-6; // Converter inductance parameter real f=100e3; // Converter frequency (if fixed) parameter real Rw=0.1;
real Rload, Irppl, Iripple, Vripple, WLss, WLosses, T, Vrppl;
analog begin
//CALCULATING REAL PARAMETERS
@(initial_step) begin Irppl = abs((V(in,gnd)*(1-(V(out,gnd)/V(in,gnd)))/(f*L))); Iripple = 1000*Irppl; Rload = abs(V(out,gnd)/I(out)); Vrppl = Irppl*Rload; Vripple = Iripple*Rload; WLss = abs(Rw*pow(I(out),2)); WLosses = 1000*WLss; end
// INPUT-OUTPUT VOLTAGE RELATION // IDEAL CONVERTER * WINDING LOSSES FACTOR + RIPPLE V(out,gnd) <+ V(in,gnd)*(1/(1-D))*(1+((Rw*I(out)/(pow(1-D,2)*V(out,gnd))))); V(out,gnd) <+ idtmod(f*Irppl,0,Vrppl,-20e-3)*Rload; // <<< THE PROBLEM IS Vrppl <<<
// INPUT-OUTPUT CURRENT RELATION I(in) <+ I(out)/(1-D); //DISPLAY MEASUREMENT RESULTS ON OUTPUT LOG @(final_step) begin $strobe("The total winding losses are %g [mW]", WLosses); $strobe("The ripple current is %g [mA]", Iripple); $strobe("The ripple voltage is %g [mV]", Vripple); end end
endmodule
|