#finding peak,load,ripple voltages
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
V=28.0;#V
C=4700.0;#microF
R=16.0;#load
f=120.0;#hertz
#calculation
Vp=V*2**.5-2;
Vd=0.95*Vp;
Id=Vd/R;
v=Id/f/C;
#approximation
Vd1=Vp-v*1e6/2;
#result
print "peak voltage is",round(Vp,2), "V"
print "load voltage is",round(Vd,1), "V"
print "ripple voltage is",round(v*1e6,2), "V"
print "approx. load voltage is",round(Vd1,2), "V"
#finding inductor,Zth
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
V1=120.0;#pri voltage
V2=28.0;#sec voltage
I=2.0;#pri current
f=60.0;#Hz
Vth=28.8;#open voltage
V3=12.1;#pri-short voltage
Is=2.0;#short current at 45 degree
#calculation
Zi=(V2*V3)/V1/Is*cos(45*pi/180);
Zj=(V2*V3)/V1/Is*sin(45*pi/180);
L=Zi/(2*pi*f);
#result
print'Zth is',round(Zi),'+',round(Zj),'in ohm'
print "inductor is",round(L*1000,2), "mH"
#finding power factor
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
I1=1.8;#current
R=16.0;#resistance
I2=5.7;#A
V=28.8;#Voltage
#calculation
P=I1**2*R;
S=I2*V;
Pf=P/S;
#result
print "power factor is",round(Pf,2)
#finding power factor
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
I=22.6;#current
I2=28.00;
V=120.0;#Voltage
V2=280.0;
#calculation
Pt=3*I*V;
Pl=I2*V2;
Pf=Pl/Pt;
#result
print "aparrent power is",round(Pt/1000,2),"kVA"
print "dissipated power is",round(Pl/1000,2),"kW"
print "power factor is",round(Pl/Pt,2)
#finding firing angle, time delay,Vd
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
V=208.0;#voltage
R=100.0;#load
Vd=150.0;#V
#calculation
r=Vd/V;
a=58;#degree
Vd=3*2**.5*208*(cos(pi/3+a*pi/180)-cos(2*pi/3+a*pi/180))/pi;
t=a*16.7/360;
#result
print "ratio is",round(r,2)
print('firing angle is 58 degrees');
print "dc voltage is",round(Vd,2), "V"
print "time delay is",round(t,2), "ms"
#finding maximum current and power dissipated
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
P=150.0;#power
V=8.0;#voltage
R=.01;#resistance
D=.5;#duty cycle
#calculation
I=P/.9/D/V;
Ir=I*D**.5;
Pq=Ir**2*R;
#result
print "max. current is",round(I,2), "A"
print "dissipated power is",round(Pq,2),"W"
#finding fundamental frequency and output voltage
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
f1=60.0;#frequency
V=150.0;#voltage
f2=31.0;#kHz
#calculation
f3=f1*4;
Vo=V*10**(-4.2);
#result
print "pwm fundamental frequency is",round(f3*2**7/1000,2), "kHz"
print "output voltage is",round(Vo*1000,2), "V"
#finding resistances,capacitor,average voltage
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
V=120.0;#load voltage
f=60.0;#Hz
Vp=200.0;#V
Vd=5.0;#V
#calculation
Vdc=2*Vp/pi;
Va=4.2;
R1=47.0;
I=(Vdc-Va)/R1;
R2=Va/I;
K=1.0/(1/R1+1/R2)# R1 \\ R2
C=1.0/2/pi/3.8/K;
#result
print "average voltage is",round(Vdc,2), "V"
print('\nVa-d @ 200Vin=4.2V')
print('\n\npick R1=47kohm')
print "current through dividers is",round(I,2), "mA"
print "R2 is",round(R2,2), "kohm"
print "capacitor is",round(C*1000,2), "microF"