from __future__ import division
import math
#initializing the variables:
f1 = 50;# in Hz
f2 = 20000;# in Hz
#calculation:
T1 = 1/f1
T2 = 1/f2
#Results
print "\n\n Result \n\n"
print "\n (a) Periodic time T = ",T1," secs\n"
print "\n (b) Periodic time T = ",(T2/1E-6)," usecs\n"
from __future__ import division
import math
#initializing the variables:
T1 = 0.004;# in secs
T2 = 4E-6;# in secs
#calculation:
f1 = 1/T1
f2 = 1/T2
#Results
print "\n\n Result \n\n"
print "\n (a) Frequency f = ",f1," Hz\n"
print "\n (b) Frequency f = ",(f2/1E6)," MHz\n"
from __future__ import division
import math
#initializing the variables:
T = (8E-3)/5;# in secs
#calculation:
f = 1/T
#Results
print "\n\n Result \n\n"
print "\n Frequency f = ",f," Hz\n"
from __future__ import division
import math
#initializing the variables:
Ta = 0.02;# Time for 1 complete cycle in secs
Vamax = 200;# in volts
Va1 = 25;# in volts
Va2 = 75;# in volts
Va3 = 125;# in volts
Va4 = 175;# in volts
Tb = 0.016;# Time for 1 complete cycle in secs
Ibmax = 10;# in Amperes
#calculation:
#for Triangular waveform (Figure 14.5(a))
fa = 1/Ta
Aaw = Ta*Vamax/4
Vaavg = Aaw*2/Ta
Varms = (((Va1**2) + (Va2**2) + (Va3**2) + (Va4**2))/4)**0.5
#Note that the greater the number of intervals chosen, the greater the accuracy of the result
Ffa = Varms/Vaavg
Pfa = Vamax/Varms
#for Rectangular waveform (Figure 14.5(b))
fb = 1/Tb
Abw = Tb*Ibmax/2
Ibavg = Abw*2/Tb
Ibrms = 10
Ffb = Ibrms/Ibavg
Pfb = Ibmax/Ibrms
#Results
print "\n\n Result \n\n"
print "\n (a1)Frequency f = ",fa," Hz\n"
print "\n (a2)average value over half a cycle = ",Vaavg," V\n"
print "\n (a3)rms value = ",round(Varms,2)," V\n"
print "\n (a4)Form factor = ",round(Ffa,2),"\n"
print "\n (a5)Peak factor = ",round(Pfa,2),"\n"
print "\n (b1)Frequency f = ",fb," Hz\n"
print "\n (b2)average value over half a cycle = ",Ibavg," A\n"
print "\n (b3)rms value = ",Ibrms," A\n"
print "\n (b4)Form factor = ",Ffb,"\n"
print "\n (b5)Peak factor = ",Pfb,"\n"
from __future__ import division
import math
import numpy
from numpy import mean, sqrt, arange
#initializing the variables:
Thalf = 5; #in ms
Ta = 0.02;# Time for 1 complete cycle in secs
#calculation:
Tfull = 2*Thalf/1000 # in sec
f = 1/Tfull
A=[3, 10, 19, 30, 49, 63, 73, 72, 30, 2]
Iinst125 = 19
Iinst38 = 70
sq = 0
Ipeak = 76
#B=arange(A)
Imean = (0.5*1E-3)*numpy.mean(A)*10/(5*1E-3)
for h in range(10):
sq = sq + A[h]**2
Irms = sqrt(sq/10)
#Results
print "\n\n Result \n\n"
print "\n (a)Frequency f = ",f," Hz\n"
print "\n (b)Instantaneous value of current after 1.25 ms =",Iinst125,"A "
print "and Instantaneous value of current after 3.8 ms", Iinst38,"A\n"
print "\n (c)Peak or maximum value = ",Ipeak," A\n"
print "\n (d)Mean or average value = ",round(Imean,2),"A\n"
print "\n (e)rms value = ",round(Irms,1),"A\n"
from __future__ import division
import math
#initializing the variables:
Imax = 20;# in Amperes
#calculation:
#for a sine wave
Irms = Imax/(2**0.5)
#Results
print "\n\n Result \n\n"
print "\n Rms value = ",round(Irms,2)," A\n"
from __future__ import division
import math
#initializing the variables:
Vrms = 240;# in Volts
#calculation:
#for a sine wave
Vmax = Vrms*(2**0.5)
Vmean = 0.637*Vmax
#Results
print "\n\n Result \n\n"
print "\n peak value = ",round(Vmax,2)," V\n"
print "\n mean value = ",round(Vmean,2)," V\n"
from __future__ import division
import math
#initializing the variables:
Vmean = 150;# in Volts
#calculation:
#for a sine wave
Vmax = Vmean/0.637
Vrms = 0.707*Vmax
#Results
print "\n\n Result \n\n"
print "\n peak value = ",round(Vmax,2)," V\n"
print "\n rms value = ",round(Vrms,2)," V\n"
from __future__ import division
import math
#initializing the variables:
Vmax = 282.8;# in Volts
w = 314;# in rad/sec
t = 0.004;# in sec
#calculation:
#for a sine wave
Vrms = 0.707*Vmax
f = w/(2*math.pi)
v = Vmax*math.sin(w*t)
#Results
print "\n\n Result \n\n"
print "\n (a)rms value = ",round(Vrms,2)," V\n"
print "\n (b)frequency f = ",round(f,2)," Hz\n"
print "\n (c)instantaneous value of voltage at 4 ms = ",round(v,2)," V\n"
from __future__ import division
import math
#initializing the variables:
Vmax = 75;# in Volts
w = 200*math.pi;# in rad/sec
t = 0.004;# in sec
phi = 0.25;# in radians
#calculation:
#for a sine wave
Vptp = 2*Vmax
Vrms = 0.707*Vmax
f = w/(2*math.pi)
T = 1/f
v = Vmax*math.sin(w*t)
phid = phi*180/math.pi
#Results
print "\n\n Result \n\n"
print "\n (a) Amplitude, or peak value = ",Vmax," V\n"
print "\n (b) Peak-to-peak value = ",Vptp," V\n"
print "\n (c)rms value = ",Vrms," V\n"
print "\n (d)periodic time, T = ",T," sec\n"
print "\n (e)frequency f = ",f," Hz\n"
print "\n (f)phase angle = ",round(phid,2),"deg lagging\n"
from __future__ import division
import math
#initializing the variables:
Vmax = 40;# in Volts
T = 0.01;# in sec
v = -20;# when t = 0sec, in volts
t = 0;# in secs
#calculation:
#for a sine wave
w = 2*math.pi/T
phir = math.asin(v/Vmax)
#Results
print "\n\n Result \n\n"
print "\n instantaneous voltage v = ", Vmax," sin(",round(w,2),"t",round(phir,2),") V\n"
from __future__ import division
import math
#initializing the variables:
Imax = 120;# in Amperes
w = 100*math.pi;# in rad/sec
phi = 0.36;# in rad
t1 = 0;# in secs
t2 = 0.008;# in secs
i = 60;# in amperes
#calculation:
#for a sine wave
f = w/(2*math.pi)
T = 1/f
phid = phi*180/math.pi
i0 = Imax*math.sin((w*t1)+phi)
i8 = Imax*math.sin((w*t2)+phi)
ti = (math.asin(i/Imax) - phi)/w
tm1 = (math.asin(Imax/Imax) - phi)/w
#Results
print "\n\n Result \n\n"
print "\n (a)Peak value = ", Imax," A, Periodic time T = ", T," sec, "
print " Frequency, f = ", f," Hz Phase angle = ",round(phid,2),"deg leading\n"
print "\n (b) When t = 0, i = ",round(i0,2)," A\n"
print "\n (c)When t = 8 ms = ", round(i8,2)," A\n"
print "\n (d)When i is 60 A, then time t = ",round((ti/1E-3),2)," ms\n"
print "\n (e)When the current is a maximum, time, t = ", round((tm1/1E-3),2)," ms\n"
from __future__ import division
import math
#initializing the variables:
i1max = 20;# in Amperes
i2max = 10;# in Amperes
phi1 = 0;# in rad
phi2 = math.pi/3;# in rad
#calculation:
#Ig = i1 + i2
Igmax = 26.5
phiIg = 19*math.pi/180
#Results
print "\n\n Result \n\n"
print "\n Current Ig = i1 + i2 =", Igmax,"sin(wt + ",round(phiIg,3),") Amps\n"
from __future__ import division
import math
#initializing the variables:
V1max = 50;# in volts
V2max = 100;# in volts
phi2 = -1*math.pi/6;# in rad
#calculation:
#vR2 = v1**2 + v2**2 - 2*v1*v2 cos 150
phidiff = math.pi + phi2
Vrmax = (V1max**2 + V2max**2 - 2*V1max*V2max*math.cos(phidiff))**0.5
#Using the sine rule
phi = math.asin(V2max*math.sin(phidiff)/Vrmax)
#Results
print "\n\n Result \n\n"
print "\n VR = ",round(Vrmax,2),"sin(wt - ",round(phi,2),") V\n"
from __future__ import division
import math
#initializing the variables:
I1max = 20;# in volts
I2max = 10;# in volts
phi2 = 1*math.pi/3;# in rad
#calculation:
#iR2 = i1**2 + i2**2 - 2*i1*i2cos150
phidiff = math.pi - phi2
Irmax = (I1max**2 + I2max**2 - 2*I1max*I2max*math.cos(phidiff))**0.5
#Using the sine rule
phi = math.asin(I2max*math.sin(phidiff)/Irmax)
#Results
print "\n\n Result \n\n"
print "\n IR = ", round(Irmax,2),"sin(wt + ",round(phi,2),") V\n"