import math
#INPUT DATA
Vm = 325.; #voltage in volts
Rl = 1000.; #resistive load in ohms
rf = 100.; #forward resistance in ohms
#CALCULATIONS
#for subdivision (a)
Im = Vm/(rf+Rl); #peak value of current in A
Idc = Im/(math.pi); #average current in A
Irms = Im/2; #rms value of current in A
print "Thus peak value of current, average current and rms value of current are %g A , %g A and %g A\
respectively"%(Im,Idc,Irms);
#for subdivision (b)
Pdc = (Idc)**2*(Rl); #DC power output
print "Thus DC power is %1.3f W"%(Pdc);
#for subdivision (c)
Pac = (Irms)**2*(rf+Rl); #AC input power
print "Thus AC power is %d W"%(Pac);
#for subdivision (d)
n = (Pdc/Pac); #efficiency of rectification
n = n*100; #efficiency in percentage
print "Thus efficiency in percentage is %2.2f percentage"%(n);
import math
#INPUT DATA
Vdc = 24.; #supply voltage in volts
Rl = 500.; #resistance in ohms
rf = 50.; #forward resistance in ohms
#CALCULATIONS
Idc = (Vdc)/(Rl); #average value of load current in A
Im = (math.pi)*(Idc); #maximum value of load current in A
Vm = (Im)*(rf+Rl); #Maximum voltage required at input in volts
print "Thus average current, maximum current and maximum voltage required are %g A, %g A and %2.2f V respectively"%(Idc,Im,Vm);
import math
#INPUT DATA
Vac = 230.; #AC supply voltage
turnsratio = 5.; #turns ratio
Rl = 300.; #resistance in ohms
#CALCULATIONS
Vs = (Vac)/(turnsratio); #transformer sceondary voltage in V
Vm = math.sqrt(2)*(Vs); #maximum value of secondary voltage in V
Vdc = Vm/(math.pi); #DC output voltage in V
PIV = Vm; #PIV of a diode in V
Im = (Vm/Rl); #maximum value of load current in A
Pm = (Im)**2*(Rl); #Maximum value of power delivered
Idc = Vdc/(Rl); #average value of load current in A
Pdc = (Idc)**2*(Rl); #average value of power delivered to load
print "Thus DC output voltage, PIV, Maximum value of power delivered, average value of power delivered\
to load are %2.1f V, %d V, %2.1f W, %1.2f W respectively"%(Vdc,PIV,Pm,Pdc);
import math
#Chapter-12, Example 12.4, Page 344
#INPUT DATA
Vac = 230.; #AC supply voltage
f = 60.; #frequency in Hz
Rl = 900.; #load resistance in ohms
noofturns = 5.; #no of turns
Rl = 900.; #resistance of load in ohms
rs = 100.; #secondary coil resistance in ohms
#CALCULATIONS
Vs = (Vac)/(noofturns); #voltage across two ends of secondary in V
Vrms = (Vs)/2; #voltage from center tapping to one end
Vm = Vrms*math.sqrt(2); #mean voltage in V
Vdc = (2*Vm)/(math.pi); #voltage across load in V
Idc = (Vdc)/(rs+Rl); #DC current flowing through to load in A
Pdc = (Idc)**2*(Rl); #DC power delivered to the load in W
PIV = 2*Vm; #PIV across each diode in V
Vr = math.sqrt((Vrms)**2-(Vdc)**2); #Ripple voltage in V
fr = 2*f; #frequency of ripple voltage in Hz
print "Thus voltage across load, DC current flowing through to load ,DC power delivered to the load, \
\nPIV across each diode, Ripple voltage are %2.1f V, %g A, %1.3f W, %d V, %2.2f V and %d Hz respectively"%(Vdc,Idc,Pdc,PIV,Vr,fr);
import math
#Chapter-12, Example 12.5, Page 344
#INPUT DATA
Imax = 400*10**-3; #maximum value of current in mA
Iav = 150*10**-3; #average value of current in mA
Vs = 100; #maximum value of secondary voltage in V
#CALCULATIONS
#we know that maximum value of current does not exceed 80 percentage
Imax1 = 0.8*Imax; #maximum value of current in mA
Vm = math.sqrt(2)*(Vs); #maximum value of secondary voltage in V
Rl = (Vm)/(Imax1); #value of load resistor in ohms
Vdc = (2*Vm)/(math.pi); #DC(load) voltage
Idc = Vdc/(Rl); #DC load current in A
PIV = 2*Vm; #PIV of each diode
print "Thus value of load resistor,voltage,current and PIV of each \
\ndiode are %1.0f ohms,%d V,%1.3f A and %3.1f V respectively"%(Rl,Vdc,Idc,PIV);
import math
#INPUT DATA
Pdc = 50; #power in W
Rl = 200; #resistance in ohms
ripplefactor = 0.01
#CALCULATIONS
Vdc = math.sqrt(Pdc*Rl); #DC voltage
Vac = ripplefactor*Vdc; #AC voltage
print "Thus AC ripple voltage across the load is %d V"%(Vac);
import math
#INPUT DATA
V = 230.; #AC supply voltage
f = 50.; #frequency in Hz
noofturns = 4.; #noofturns ratio
Rl = 600.; #load resistance in ohms
#CALCULATIONS
Vrms = (V/4); #rms value of secondary voltage in V
Vm = math.sqrt(2)*(Vrms); #max value of secondary voltage
Vdc = (2*Vm)/(math.pi); #DC output voltage
Pdc = (Vdc)**2/(Rl); #DC power in W
PIV = Vm; #PIV across each diode in V
f0 = 2*f; #output frequency in Hz
print "Thus DC output voltage,DC power,PIV and output frequency are %1.0f V,%1.3f W,%2.1f V and %d hz respectively"%(Vdc,Pdc,PIV,f0);
#note:in given problem,Rl is 600 ohms,but in textbook calculations Rl taken is 1000 ohms,I took Rl as 600 ohms
import math
#INPUT DATA
Rl = 100.; #resistance of load in ohms
f = 60; #frequency in hz
ripplefactor = 0.04;
#CALCULATIONS
L = Rl/(3*math.sqrt(2)*(2*math.pi*f*ripplefactor)); #inductance
print "inductance is %1.4f H"%(L);
import math
from numpy.linalg import inv
#INPUT DATA
Rl = 500; #resistance of load in ohms
f = 400; #frequency in hz
ripplefactor = 0.1;
#CALCULATIONS
C = inv([[4*math.sqrt(3)*f*Rl*ripplefactor]]); #capacitance in uF
print "thus capacitance is %g F"%(C);
#note:ripple factor is 0.1 not 0.01 as mentioned by problem in text book
#INPUT DATA
V = 10; #output voltage in V
Il = 200*10**-3; #load current in A
#CALCULATIONS
Rl = V/(Il); #effective load resistance in ohms
ripplefactor = 0.02;
#critical value occurs at f = 50 hz
f = 50; #freq in hz
L = Rl/(3*2*math.pi*f); #inductance in H
#but taking L = 60mh(about 20 percentage higher)we have
L1 = 60*10**-3; #inductance in henry
C = 1.194/(ripplefactor*L1);
print "the values of L and C for LC filter are %g H and %g F respectively"%(L1,C)
#note:C value calculated is wrong in textbook
import math
#INPUT DATA
V = 10; #output voltage in V
Il = 200*10**-3; #load current in A
ripplefactor = 0.02;
#CALCULATIONS
Rl = V/(Il); #resistance in ohms
#if we assume L = 10H and C1 = C2 = C
L = 10; #indcumath.tance in henry
C = math.sqrt(5700/(L*50*ripplefactor));
print "the values of L and C for CLC section are %d H and %1.0f uF respectively"%(L,C)
#The frequency of given input signal is 2000 hz.Hence,the period of the signal is 0.5ms.During the negative half of the signal,the diode is forward biased and it acts like a short circuit and the capacitor charges to 20 V.THis can be found out by applying Kirchoff's law in the input side.
#15+Vc-5 = 0;
#and
#Vc = 20 V
#The voltage across the resistor will be equal to Dc voltage 5V
#During the positive half of input signal,the diode is reverse biased and it acts like an open circuit.Hence,the 5V battery has no effect on V0.Applying Kirchhoff's voltage law around the outside loop,we get
#15+20-Vo = 0
#Vo = 35V
print "Vc = 20V"
print "the voltage across resistor will be equal to 5V"
#During the negative half of the input signal,the diode conducts,and acts like a short circuit.Now,the output voltage,V0 = 0V.The capacitor is charged to 10V with polarities and it behaves like a battery.
#During the positive half of the input signal,the diode does not conduct,and acts like an open circuit.Hence,the output voltage,V0 = 20V.This gives positively clamped voltage.
print "V0 = 10+10 = 20 V"
#During the positive half of the input signal,the diode conducts and acts like a short circuit.Now,the output voltage,V0 = 0V.The capacitor is charged to 12V with polarities and it behaves like a battery.
#during the negative half of the input signal,the diode does not conduct and acts like an open circuit.Hence the output voltage ,V0 = -24V.This gives negatively clamped voltage.
print "V0 = 0V"
print "output voltage V0 = -24V"
#INPUT DATA
Rh = 200; #Hall-coefficient in cubiccentimeter/C
a = 10; #conductivity in s/m
#CALCULATIONS
un = a*Rh; #electron mobility in cm**2/V-s
print "electron mobility is %d cm**2/V-s"%(un)
#note:answer given is wrong in textbook
#INPUT DATA
a = 10; #conductivity in s/m
un = 50*10**-4; #electron mobility in m**2/V-s
q = 1.6*10**-19; #charge in coulombs
#CALCULATIONS
n = (a/(un*q)); #electron concentration in m**-3
print "electron concentration is %g m**-3 "%(n)
#INPUT DATA
I = 20; #current in A
B = 1.2 #magnetic flux density in Wb/m**2
Vh = 60; #hall voltage in V
w = 0.5; #thickness of strip in mm
q = 1.6*10**-19; #charge in coulombs
#CALCULATIONS
n = (B*I)/(Vh*q*w*10**-3); #electron concentration in m**-3
print "electron density is %g m**3 "%(n)