|
|
MATLAB Simulation
A matlab program for simulating the half-wave rectifier with a free-wheeling
diode is presented below.
% Program to simulate the half-wave rectifier circuit
% The circuit has a free-wheeling diode
% Enter the peak voltage, frequency, inductance L in mH and resistor R
disp('Typical value for peak voltage is 340 V')
peakV=input('Enter Peak voltage in Volts>');
disp('Typical value for line frequency is 50 Hz')
freq=input('Enter line frequency in Hz>');
disp('Typical value for Load inductance is 31.8 mH')
L=input('Enter Load inductance in mH>');
disp('Typical value for Load Resistance is 10.0 Ohms')
R=input('Enter Load Resistance in Ohms>');
w=2.0*pi*freq;
X=w*L/1000.0;
if (X<0.001) X=0.001; end;
Z=sqrt(R*R+X*X);
tauInv=R/X;
loadAng=atan(X/R);
A1=peakV/Z*sin(loadAng);
A2=peakV/Z*sin(pi-loadAng)*exp(-pi*tauInv);
A3=(A1+A2)/(1-exp(-2.0*pi*tauInv));
Ampavg=0;
AmpRMS=0;
for n=1:360;
theta=n/180.0*pi;
X(n)=n;
if (n<180)
cur=peakV/Z*sin(theta-loadAng)+A3*exp(-tauInv*theta);
Ampavg=Ampavg+cur*1/360;
AmpRMS=AmpRMS+cur*cur*1/360;
else
A4=peakV/Z*sin(pi-loadAng)*exp(-(theta-pi)*tauInv);
cur=A4+A3*exp(-tauInv*theta);
Ampavg=Ampavg+cur*1/360;
AmpRMS=AmpRMS+cur*cur*1/360;
end;
if (n<180)
Vind(n)=peakV*sin(theta)-R*cur;
Vout(n)=peakV*sin(theta);
diode2cur(n)=0;
diode1cur(n)=cur;
else
Vind(n)=-R*cur;
Vout(n)=0;
diode2cur(n)=cur;
diode1cur(n)=0;
end
iLoad(n)=cur;
end;
plot(X,iLoad)
title('The Load current')
xlabel('degrees')
ylabel('Amps')
grid
pause
plot(X,Vout)
title('Voltage at cathode')
xlabel('degrees')
ylabel('Volts')
grid
pause
plot(X,Vind)
title('Inductor Voltage')
xlabel('degrees')
ylabel('Volts')
grid
pause
plot(X,diode1cur)
title('Diode 1 current')
xlabel('degrees')
ylabel('Amps')
grid
pause
plot(X,diode2cur)
title('Diode 2 current')
xlabel('degrees')
ylabel('Amps')
grid
AmpRMS=sqrt(AmpRMS);
[A,message]=fopen('outhfr2.dat','w');
fprintf(A,'Avg Load Cur=\t%d\tRMS Load Cur=\t%f\n',Ampavg,AmpRMS);
fclose(A)The responses obtained for the typical specified values are shown
below.




The average and rms values of load current are presented below.
Avg Load Cur= 1.082254e+001 RMS Load Cur= 13.954542
TO THE TOP |
|