#Variable Declaration
Vf =20; #Peak Input Voltage in V
rf=10; #Forward Resistance in ohms
RL=500.0; #Load Resistance in ohms
V0=0.7; #Potential Barrier Voltage of the diodes in V
#Calculation
#(1)
If_peak=(Vf-V0)/(rf+RL); #Peak current through the diode in A
If_peak=If_peak*1000; #Peak current through the diode in mA
#(2)
V_out_peak =If_peak * RL/1000 ; #Peak output voltage in V
#For an Ideal diode
If_peak_ideal=Vf/RL; #Peak current through the ideal diode in A
If_peak_ideal=If_peak_ideal*1000; #Peak current through the ideal diode in mA
V_out_peak_ideal=If_peak_ideal * RL/1000; # Peak output voltage in case of the ideal diode in V
#Result
print '(i) Peak current through the diode = %.1f mA '%If_peak;
print '(ii) Peak output voltage = %.1f V'%V_out_peak;
print '(iii) Peak current through the ideal diode = %d mA '%If_peak_ideal;
print '(iv) Peak output voltage in case of the ideal diode = %d V'%V_out_peak_ideal;
#Variable Declaration
V =10.0; #Battery voltage in V
R1=50.0; #Resistor 1's resistance in ohms
R2=5.0; #Resistor 2's resistance in ohms
#Calculation
#Using Thevenin's Theorem to find current in the diode
E0=(R2/(R1+R2))*V; #Thevenin's Voltage in V
R0=(R1*R2)/(R1+R2); #Thevenin's Resistance in ohms
I0=E0/R0; #Current through the diode in A
I0=I0*1000; #Current through the diode in mA
#Result
print 'Current through the diode = %d mA '%Io;
#Variable Declaration
V =10.0; #Battery voltage in V
R0=48.0; #Resistance of the resistor in ohms
Rd=1.0; #Forward resistance of the diodes in ohms
Vd=0.7; #Potential barrier of the diodes in V
#Calculation
V_net=V-Vd-Vd; #Net voltage in the circuit in V
R_net=R0+Rd+Rd #Net resistance of the circuit in ohms
I_net=V_net/R_net; #Net current in the circuit in A
I_net=I_net*1000; #Net current in mA
#Result
print 'Net current in the circuit = %d mA '%I_net;
#Variable Declaration
E1=24; #Voltage of first source in V
E2=4; #Voltage of second source in V
V0=0.7; #Potential barrier of diodes in V
R=2000; #Resistance of the given resistor in ohms
Rd=0; #Forward resistance of the diodes in ohms
#Calculation
I=(E1-E2-V0)/(R+Rd); #Current in the circuit in A
I=I*1000; #Current in the circuit in mA
#Result
print 'Current in the circuit = %.2f mA '%I;
#Variable Declaration
V=20; #Voltage of source in V
V0=0.3; #Potential barrier of Germanium diode in V
V0_Si=0.7; #Potetial barrier of Silicon diode in V
#Calculation
#As only Ge diode is turned on due to less potential barrier,
VA=V-V0; #Voltage VA acroos resistor of 3k ohms
#Result
print 'Voltage VA = %.1f mA '%VA;
#Variable Declaration
V=10; #Voltage of source in V
V0=0.7; #Potetial barrier of Silicon diode in V
# Resistance of all resistors in ohms
R1=2000;
R2=2000;
R3=2000;
#Calculation
Id=(V-V0)/(R2+2*R3); #Current through the diodes in A
VQ=2*Id*R3; #Voltage VQ across the grounded 2k ohm resistor in V
Id=Id*1000; #Current through the diodes in mA
#Result
print 'Voltage VQ = %.1f V '%VQ;
print 'Current through the diodes, Id = %.2f mA '%Id;
#Variable Declaration
V=15; #Voltage of source in V
V0=0.7; #Potetial barrier of Silicon diode in V
R=500 # Resistance of all resistors in ohms
#Calculation
I1=(V-V0)/R; #total current in the circuit in A
Id1=I1/2; #current in first diode in A
Id1=Id1*1000; #current in first diode in mA
Id2=Id1 #current in second diode in mA
#Result
print ('Current in first diode = %.1f mA'%Id1);
print ('Current in second diode = %.1f mA'%Id2);
#Variable Declaration
E=20; #Voltage of source in V
V0_d1=0.7; #Potetial barrier of first Silicon diode in V
V0_d2=0.7; #Potetial barrier of second Silicon diode in V
R1=5600; # Resistance of first resistor in ohms
R2=3300; # Resistance of second resistor in ohms
#Calculation
I2=V0_d2/R2; #Current I2 through resistor R2 in A
I2=round((I2*1000),3); #Current I2 through resistor R2 in mA
I1=(E-V0_d1-V0_d2)/R1; #Current I1 through resistor R1 in A
I1=round((I1*1000),2); #Current I1 through resistor R1 in mA
I3=I1-I2; #Current I3 through diode D2 in mA
#Result
print 'Current I1= %.2f mA'%I1;
print 'Current I1= %.3f mA'%I2;
print 'Current I1= %.3f mA'%I3;
#Variable Declaration
E=10.0; #Voltage of source in V
V0=0.7; #Potetial barrier of Silicon diode in V
R1=2000; # Resistance of first resistor in ohms
R2=8000; # Resistance of second resistor in ohms
R3=4000; #Resistance of third resistor in ohms
R4=6000; #Resistance of fourth resistor in ohms
#Calculation
#Assuming the given diode to be reverse bised and calculating voltage across it's terminals
V1=(E/(R1+R2))*R2; #voltage at the P side of the diode, i.e, voltage across R2 resistor,according to voltage divider rule, in V
V2=(E/(R3+R4))*R4; #voltage at the N side of the diode, i.e, voltage across R4 resistor,according to voltage divider rule, in V
#Result
if((V1-V2)>=V0):
print 'Our assumption was wrong and, the diode is forward biased';
else:
print 'The diode is reverse biased';
#Variable declaration
V=2; #Supply voltage in V
V0=0.7; #Potential barrier voltage of the diode in V
R1=4000.0; #Resistance of first resistor in Ω
R2=1000.0; ##Resistance of second resistor in Ω
#Calculation
#Assuming the diode to be in ON state
I1=((V-V0)/R1)*1000; #Current through resistor R1, in mA
I2=(V0/R2)*1000; #Current through resistor R2, in mA
ID=I1-I2; #Diode current, in mA
if(ID<0):
#Since the diode current is negative, the diode must be OFF
ID=0; #True value of diode current, mA
#As the diode is in OFF state it can be replaced by an open ciruit equivalent
VD=V*R2/(R1 +R2); #Voltage across the diode, in V
#Result
print 'ID =%d mA'%ID;
print 'VD =%.1f V'%VD;
#Variable declaration
AC_Input_Power=100.0; #Input AC Power in watts
AC_Output_Power=40.0; #Output AC Power in watts
Accepted_Power=50.0; #Power accepted by the half-wave rectifier in watt
#Calculation
R_eff=(AC_Output_Power/AC_Input_Power)*100; #Rectification efficiency of the half-wave rectifier
Unused_power=AC_Input_Power-Accepted_Power; #Power not used by the half_wave rectifier due to open circuited condition of the diode in watt
Power_dissipated=Accepted_Power-AC_Output_Power; #Power dissipated by the diode watt
#Result
print 'The rectification efficiency of the half-wave rectifier= %d%% '%R_eff;
print 'Rest 60%% of the power is the unused power and power dissipated by the diode = %d watts and %d watts' %(Unused_power ,Power_dissipated);
from math import pi
from math import sqrt
#Variable declaration
Vrms=230.0; #AC supply RMS voltage in V
Turns_Ratio=10/1; #turn ratio of the transformer
#Calculation
Vpm=sqrt(2)*Vrms; #Maximum primary voltage in V
Vsm=Vpm/Turns_Ratio; #Maximum secondary voltage in V
#Case 1
Vdc=Vsm/(round(pi,2)); #Output D.C voltage, which is the average voltage in V
Vdc=round(Vdc,2);
#Case 2
PIV=Vsm; #Peak Inverse Voltage in V
#Result
print 'The output d.c voltage= %.2f V'%Vdc;
print 'The peak inverse voltage= %.2f V'%PIV;
from math import pi
#Variable declaration
rf=20.0; #Internal resistance of the crystal diode in ohms
Vm=50.0; #Maximum applied voltage in V
RL=800.0; #Load Resistance in ohms
#Calculation
# 1
Im=Vm/(rf+RL); #Maximum current in A
Im=Im*1000; #Maximum current in
Im=round(Im,0);
Idc=Im/pi; #Average voltage in mA
Idc=round(Idc,1);
Irms=Im/2; #RMS value of the current in mA
Irms=round(Irms,1)
# 2
AC_Input_Power=pow(Irms/1000,2)*(rf+RL); #Input a.c power in watt
DC_Output_Power=pow(Idc/1000,2)*RL; #Output d.c power in watt
# 3
DC_Output_Voltage=(Idc/1000)*RL; #Output d.c voltage in V
# 4
Rectifier_efficiency=(DC_Output_Power/AC_Input_Power)*100; # Efficiency of rectification of the half-wave rectifier
#Result
print ' i:';
print ' Im = %d mA'%Im;
print ' Idc = %.1f mA'%Idc;
print ' Irms = %.1f mA'%Irms;
print ' ii: ';
print ' a.c input power= %.3f watt'%AC_Input_Power;
print ' d.c output power= %.3f watt'%DC_Output_Power;
print ' iii: ';
print ' d.c output voltage = %.2f volts'%DC_Output_Voltage;
print ' iv: '
print ' Efficiency of rectification = %.1f%%'%Rectifier_efficiency;
from math import pi
#Variable declaration
Vdc=50.0; #Output d.c voltage in V
rf=25; #Diode resistance in ohm
RL=800; #Load resistance in ohm
#Calculation
Vm=(pi*(rf+RL)*Vdc)/RL; #[ Vdc=Vm*RL/(pi*(rf+RL)) ]Maximum value of a.c voltage required to get a volatge of Vdc from the half-wave rectifier, in V
Vm=round(Vm,0);
#Result
print 'The a.c voltage required should have maximum value of = %d V' %Vm;
from math import sqrt
from math import pi
#Variable declaration
rf=20; #Internal resistance of the diodes in ohm
Vrms=50; #RMS value of transformer's secondary voltage from centre tap to each end of secondary
RL=980; #Load resistance in ohm
#Calculation
Vm=Vrms*sqrt(2); #Maximum a.c voltage in V
Im=Vm/(rf+RL); #Maximum load current in A
Im=Im*1000; #Maximum load current in mA
# 1:
Idc=2*Im/pi; #Mean load current
# 2:
Irms=Im/sqrt(2); #RMS value of load current in A
#Result
print 'i:';
print' The mean load current= %d mA'%Idc;
print 'ii:';
print ' The r.m.s value of the load current = %d mA'%Irms;
from math import sqrt
#Variable declaration
RL=100; #Load resistance in ohm
rf=0; #Internal resistance of the diodes in ohm
Turns_ratio=5/1; #Primary to secondary turns ratio of transformer
P_Vrms=230; #R.M.S value of voltage in primary winding in V
S_Vrms=P_Vrms/Turns_ratio; #R.M.S value of voltage in secondary winding in V
S_Vm=S_Vrms*sqrt(2); #Maximum voltage across secondary winding in V
Vm=S_Vm/2; #Maximum voltage across half seconfdary winding in V
#Calculation
# 1:
Idc=2*Vm/(pi*RL); #Average current in A
Vdc=Idc*RL; #d.c output voltage in V
# 2:
PIV=S_Vm; #Peak Invers Voltage(= Maximum secondary voltage) in V
# 3:
Pac=pow(Vm/(RL*sqrt(2)),2)*(rf+RL); #a.c input power in watt
Pdc=(pow(Idc,2)*RL); #d.c output power in watt
R_eff=(Pdc/Pac)*100; #Rectification efficiency
R_eff=round(R_eff,1);
#Result
print 'i:';
print ' The d.c output voltage= %.1f V'%Vdc;
print 'ii:';
print ' The peak inverse voltage= %d V'%PIV;
print 'iii:';
print ' Rectification efficiency= %.1f%%'%R_eff;
NOTE: The value of rectification efficiency is calculated as 81.2% in the textbook using the formula 0.812/(1 + (rf/RL)), but by calculating using the correct values in the formula we get 81.1%.
from math import sqrt
#Variable declaration
fin=50; #frequency of input ac source in Hz
RL=200; #Load resistance in ohm
Turns_ratio=4/1; #Transformers turns ratio, primary to secondary.
P_Vrms=230.0; #R.M.S value of voltage in primary winding in V
S_Vrms=P_Vrms/Turns_ratio #R.M.S value of voltage in secondary winding in V
Vm=S_Vrms*sqrt(2); #Maximum voltage across secondary winding in V
#Calculation
# 1:
Idc=2*Vm/(pi*RL); # Average current in A
Vdc=Idc*RL; #Output d.c voltage in V
Vdc=round(Vdc,0);
# 2:
PIV= Vm; #Peak Inverse Voltage(= Maximum volutage across secondary winding) in V
# 3:
fout=2*fin; #Output frequency in Hz
#Result
print 'i:';
print ' The d.c output voltage = %d V' %Vdc;
print 'ii:';
print ' The peak inverse voltage = %.1f V'%PIV;
print 'iii:';
print ' The output frequency = %d Hz'%fout;
from math import pi
from math import sqrt
#Variable declaration
RL=100.0; #Load Resistance in ohm
Turns_ratio=5/1; #Primary to secondary turns ratio of the transformer
Vin=230.0; #R.M.S value of input voltage in V
fin=50; #Input frequency in Hz
#Calculation
Vs_rms=Vin/Turns_ratio; #R.M.S value of the voltage in secondary winding, in v
Vs_max=Vs_rms*sqrt(2); #Maximum voltage across secondary, in V
# (i)
#Case i: Centre-tap circuit
Vm=Vs_max/2; #Maximum voltage across half secondary winding, in V
Vdc=2*Vm*RL/(pi*RL); #DC output voltage, in V
print 'The d.c output voltage for the centre-tap circuit = %.1f V'%Vdc;
#Case ii:
Vm=Vs_max; #Maximum voltage across secondary, in V
Vdc=2*Vm*RL/(pi*RL); #DC output voltage, in V
print 'The d.c output voltage for the bridge circuit = %.1f V'%Vdc;
# ii:
#Case i: Centre-tap circuit
Turns_ratio=5/1; #Turns ratio of the transformer
Vs_rms=Vin/Turns_ratio; #R.M.S value of the secondary voltage in V
Vs_max=Vs_rms*sqrt(2); #Maximum voltage across the secondary in V
Vm=Vs_max/2; #Maximum voltage across half of the secondary in V
PIV=2*Vm; #Peak Inverse Voltage in V
print 'PIV in case of centre-tap circuit = %d V'%PIV;
#Case ii: Bridge circuit
Turns_ratio=10/1; #Turns ratio of the transformer
Vs_rms=Vin/Turns_ratio; #R.M.S value of the secondary voltage in V
Vs_max=Vs_rms*sqrt(2); #Maximum voltage across the secondary in V
PIV=Vm; #Peak Inverse Voltage in V
print 'PIV in case of bridge circuit = %.1f V'%PIV;
from math import pi
from math import sqrt
#Variable declaration
rf=1; #forward resistance of diodes of the rectifier in ohm
RL=480; #Load resistance in ohm
Vrms=240.0; #a.c supply voltage in V
Vm=Vrms*sqrt(2); #Maximum a.c voltage in V
#Calculation
# 1:
Rt=2*rf+RL; #Total circuit resistance at any instance in ohm
Im=Vm/Rt; #Maximum load current in A
Idc=2*Im/pi; #Mean load current in A
# 2:
Irms=Im/2; #R.M.S value of current in A
P=pow(Irms,2)*rf; #Power dissipated in each diode in watt
#Result
print 'i:';
print ' Mean load current = %.2f A'%Idc;
print 'ii:';
print ' Power dissipated in each diode= %.3f W'%P;
NOTE: The value of power dissipated is approximately 0.124 W , but in the textbook it is approximated as 0.123W.
from math import sqrt,pi
#Variable declaration
RL=12000; #Load resistance in ohm
V0=0.7; #Potential barrier voltage of diodes in V
Vrms=12; #R.M.S value of input a.c voltage in V
Vs_pk=Vrms*sqrt(2); #Peak secondary voltage in V
#Calculation
# 1:
Vout_pk=Vs_pk-(2*V0); #Peak output voltage in V
Vav=2*Vout_pk/pi; #Average output voltage in V
Vav=round(Vav,2);
# 2:
Iav=Vav/RL; #Average output current in A
Iav=Iav*pow(10,6); #Average output current in μA
#Result
print 'i:';
print ' Average output voltage=%.2f V'%Vav;
print 'ii:';
print ' Average output current=%.1f μA'%Iav;
#Variable declaration
Vdc_A=10; #Supply voltage of A in V
Vdc_B=25; #Supply voltage of B in V
Vac_rms_a=0.5; #Ripples in power supply A in V
Vac_rms_b=0.001; #Ripples in power supply B in V
#Calculation
#For power supply A
ripple_factor_A=Vac_rms_a/Vdc_A; #Ripple factor of power supply A
#For power supply B
ripple_factor_B=Vac_rms_b/Vdc_B; #Ripple factor of power supply B
#Result
if(ripple_factor_A<ripple_factor_B):
print 'Power supply A is better';
else :
print 'Power supply B is better';
from math import sqrt
#Variable declaration
RL=2200; #Load resistance in ohm
C=50*pow(10,-6); #Capacitance of the capacitor used in filter circuit in F
V0=0.7; #Potential barrier voltage of the diodes of the rectifier in V
Vrms=115.0; #R.M.S value of input a.c voltage in V
fin=60; #Frequency of input a.c voltage in Hz
Turns_ratio=10/1; #Primary to secondary, turns ratio of the transformer
#Calculation
Vp_prim=Vrms*sqrt(2); #Peak primary voltage in V
Vp_sec=Vp_prim/Turns_ratio; #Peak secondary voltage in V
Vp_in= Vp_sec - 2*V0; #Peak full wave rectified voltage at the filter input in V
f=2*fin; #Output frequency in Hz
Vdc=Vp_in*(1-(1/(2*f*RL*C))); #Output d.c voltage in V
#Result
print 'The output d.c voltage is = %.1f V'%Vdc;
from math import pi
#Variable declaration
R=25; #d.c resistance of the choke in ohm
RL=750; #Load resistance in ohm
Vm=25.7; #Maximum value of the pulsating output from the rectifier in V
#Calculation
V_dc=2*Vm/pi; #d.c component of the pulsating output in V
V_dc=round(V_dc,1);
V_dc_out=(V_dc*RL)/(R+RL); #Output d.c voltage in V
V_dc_out=round(V_dc_out,1);
#Result
print ' The output d.c voltage accross the load resistance is = %.1f V'%V_dc_out;
#Variable declaration
Ei=120.0; #Input Voltage in V
Vz=50.0; #Zener Voltage in V
R=5000.0; #Resistance of the series resistor in ohm
RL=10000.0; #Load resistance in ohm
#Calculation
V=Ei*RL/(R+RL); #Voltage across the open circuit if the zener diode is removed
if(V>Vz):
#Zener diode is in ON state
# i:
Output_voltage=Vz; #Voltage across load resistance, in V
#ii:
Voltage_R=Ei-Vz; #Voltage across the series resistance R, in V
#iii:
IL=Vz/RL; #Load current through RL in A
IL=IL*1000; #Load current through RL in mA
I=Voltage_R/R; #Current through the series resistance in A
I=I*1000; #Current through the series resistance in mA
Iz=I-IL; #Applying Kirchhoff's first law, Zener current in mA
#Result
print 'i) The output voltage across the load resistance RL = %d V'%Output_voltage;
print 'ii) The voltage drop across the series resistance R = %d V'%Voltage_R;
print 'iii) The current through the zener diode = %d mA'%Iz;
#Variable declaration
Max_V=120.0; #Maximum input voltage in V
Min_V=80.0; #Minimum input voltage in V
R=5000.0; #Series resistance in ohm
RL=10000.0; #Load resistance in ohm
Vz=50.0; #Zener voltage in V
#Calculation
#Case i: Maximum zener current
#Zener current will be maximum when the input voltage is maximum
V_R_max=Max_V-Vz; #Voltage across series resistance R, in V
I_max=V_R_max/R; #Current through series resistance R, in A
I_max=I_max*1000; #Current through series resistance R, in mA
IL_max=Vz/RL; #Load current in A
IL_max=IL_max*1000; #Load current in mA
Iz_max=I_max-IL_max; #Applying Kirchhoff's first law, Zener current in mA;
#Case ii: Minimum zener current
#The zener will conduct minimum current when the input voltage is minimum
V_R_min=Min_V-Vz; #Voltage across series resistance R, in V
I_min=V_R_min/R; #Current through series resistance R, in A
I_min=I_min*1000; #Current through series resistance R, in mA
IL_min=Vz/RL; #Load current in A
IL_min=IL_min*1000; #Load current in mA
Iz_min=I_min-IL_min; #Applying Kirchhoff's first law, Zener current in mA
#Result
print 'Case i: ';
print 'Maximum zener current = %d mA'%Iz_max;
print 'Case ii: ';
print 'Minimum zener current = %d mA'%Iz_min;
#Variable declaration
Ei=12; #Input voltage in V
Vz=7.2; #Zener voltage in V
E0=Vz; #Voltage to be maintained across the load in V
IL_max=0.1; #Maximum load current in A
IL_min=0.012; #Minimum load current in A
Iz_min=0.01; #Minimum zener current in A
#Calculation
#When the load current is maximum at minimum value of RL, the zener current is minimum and, as the load current decreases due to increase in value of RL
R=(Ei-E0)/(Iz_min+IL_max); #The value of series resistance R to maintain a voltage=E0 across load, in ohm
#Result
print 'The minimum value of series resistance R to maintain a constant value of 7.2 V is = %.1f Ω'%R;
NOTE: The actual value of R is 43.636363 (recurring) but, in the textbook the value of R is wrongly approximated 43.5 Ω
#Variable declaration
Ei_min=22; #Minimum input voltage in V
Ei_max=28; #Maximum input voltage in V
Vz=18; #Zener voltage in V
E0=Vz; #Constant voltage maintained across the load resistance in V
Iz_min=0.2; #Minimum zener current in A
Iz_max=2; #Maximum zener current in A
RL=18; #Load resistance in Ω
#Calculation
IL=Vz/RL; #Constant value of load current in A
#When the input voltage is minimum, the zener current will be minimum
R=(Ei_min-E0)/(Iz_min+IL) #The value of series resistance so that the voltage E0 across RL remains constant
print 'The value of series resistance R, to maintain constant voltage E0 across RL = %.2f Ω.'%R;
#Variable declaration
Vz=10 #Zener voltage in V
Ei_min=13; #Minimum input voltage in V
Ei_max=16; #Maximum input voltage in V
Iz_min=0.015; #Minimum zener current in A
IL_min=0.01; #Minimum load current in A
IL_max=0.085; #Maximum load curremt in A
E0=Vz; #Constant voltage to be maintained in V
#Calculation
#The zener current will be minimum when the input voltage will be minimum and at that time the load current will be maximum
R=(Ei_min-E0)/(Iz_min+IL_max); #The value of series resistance R to maintain a constant voltage across load
#Result
print 'The value of series resistance to maintain a constant voltage across the load resistance is = %d Ω'%R;
#Variable declaration
Iz=0.2; #Current rating of each zener in A
Vz=15; #Voltage rating of each zener in V
Ei=45; #Input voltage in V
#Calculation
# i: Regulated output voltage across the two zener diodes
E0=2*Vz; # V
# ii: Value of series resistance
R=(Ei-E0)/Iz; # Ω
#Result
print 'i) The regulated output voltage = %d V'%E0;
print 'ii) The value of the series resistance = %d Ω'%R;
#Variable declaration
Vz=10; #Voltage rating of each zener in V
Iz=1; #Current rating of each zener in A
Ei=45; #Input unregulated voltage in V
#Calculation
#Regulated output voltage across the three zener diodes
E0=3*Vz; # V
#Value of series resistance to obtain a 30V regulated output voltage
R=(Ei-E0)/Iz; # Ω
#Result
print 'Value of series resistance to obtain a 30V regulated output voltage = %d Ω'%R;
#variable declaration
RL=2000.0; #Load resistance in Ω
R=200.0; #Series resistance in Ω
Iz=0.025; #Zener current rating in A
E0=30.0; #Output regulated voltage in V
#Calculation
#Minimum input voltage will be required when Iz=0 A, and at this condition
IL=E0/RL; #Load current during Iz=0, in A
I=IL; #According to Kirchhoff's law, total current, in A
Ei_min=E0+(I*R); #Minimum input voltage in V
#The maximum input voltage required will be when Iz=0.025 A, and at that condition
I=IL+Iz; #According to Kirchhoff's law, total current, in A
Ei_max=E0+(I*R); #maximum input voltage in V
#Result
print 'The required range of input voltage is from %d V to %d V'%(Ei_min,Ei_max);
#Variable declaration
Ei=16; #Unregulated input voltage in V
E0=12; #Output regulated voltage in V
IL_min=0; #Minimum load current in A
IL_max=0.2; #Maximum load current in A
Iz_min=0; #Minimum zener current in A
Iz_max=0.2; #Maximum zener current in A
#Calculation
#As the regulated voltage required across the load is 12V
Vz=E0; #Voltage rating of zener diode in V
V_R=Ei-E0; #Constant Voltage that should remain across series resistance
#The minimum zener current will occur when the curent in the load in maximum
R=V_R/(Iz_min+IL_max); #Series resistance in Ω
Max_power_rating=Vz*Iz_max; #Maximum power rating of zener diode in W
#Result
print 'The regulator is designed using a Seris resistance of %d Ω and a zener diode of zener voltage %d V'%(R,Vz);
print 'The maximum power rating of the zener diode is = %.1f W '%Max_power_rating;
#Variable declaration
V=12; #Source voltage in V
R=1000; #Series resistance in Ω
RL=5000; #Load resistance in Ω
Vz=6; #Voltage rating of zener in V
#Calculation
#Case i: zener is working properly
#The output voltage across the load will be equal to the zener voltage.
V0=Vz; # V
#Result
print 'Case i: Output voltage when zener is working properly is %d V'%V0;
#Case ii: zener is shorted
#As the zener is shorted, the potential difference across the load will be zero
V0=0; #V
#Result
print 'Case ii: Output voltage when zener is short circuited is %d V'%V0;
#Case iii: zener is open circuited
#If the zener is open circuited, the total voltage will drop across R and RL according to the voltage divider rule
V0=V*RL/(R+RL); #V
#Result
print 'Case iii: Output voltage when zener is open circuited is %d V'%V0;