from __future__ import division
import math
import cmath
#initializing the variables:
RL = 12j;# in ohm
R = 5;# in ohm
rv = 52;# in volts
thetav = 30;# in degree
#calculation:
#voltage
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#impedance, Z
Z = R + RL
#current
I = V/Z
#Active power, P
Pa = V.real*I.real + V.imag*I.imag
#Results
print "\n\n Result \n\n"
print "\nthe active power in the circuit ",Pa," W\n"
from __future__ import division
import math
import cmath
#initializing the variables:
V = 120 + 200j;# in volts
I = 15 + 8j;# in amperes
#calculation:
#Active power, P
Pa = V.real*I.real + V.imag*I.imag
#Reactive power, Q
Q = V.imag*I.real - V.real*I.imag
#Results
print "\n\n Result \n\n"
print "\n (a) the active power in the circuit ",Pa," W\n"
print "\n (b) the reactive power in the circuit ",Q," var\n"
from __future__ import division
import math
import cmath
#initializing the variables:
Vm = 141.4;# in volts
w = 10000;# in rad/sec
phiv = math.pi/9;# in radian
Pd = 1732;# in Watts
pf = 0.866;# power fctr
#calculation:
#the rms voltage,
Vrms = 0.707*Vm
#Power P = V*I*cos(phi)
#current magnitude, Irms
Irms = Pd/(Vrms*pf)
phid = math.acos(pf)
#current phase angle
phii = phiv + phid
phiid = phii*180/math.pi# in degrees
#Voltage, V
V = Vrms*math.cos(phiv) + 1j*Vrms*math.sin(phiv)
#current, I
I = Irms*math.cos(phii) + 1j*Irms*math.sin(phii)
#Impedance, Z
Z = V/I
#resistance, R
R = Z.real
#capacitive reactance, Xc
Xc = abs(Z.imag)
#capacitance, C
C = 1/ (w*Xc)
#Results
print "\n\n Result \n\n"
print "\n (a)the current flowing and Circuit phase angle is ",round(Irms,2),"/_",round(phiid,2),"deg A\n"
print "\n (b) the resistance is ",round(R,2)," ohm\n"
print "\n (c) the capacitance is ",round(C*1E6,2),"uF\n"
from __future__ import division
import math
#initializing the variables:
rv = 100;# in volts
thetav = 0;# in degrees
R = 5;# in ohm
R1 = 3;# in ohms
RL = 4j;# in ohm
Rc = -10j;# in ohms
#calculation:
#impedance, Z1
Z1 = R1 + RL
#impedance, Zc
Zc = Rc
#Circuit impedance, Z
Z = R + (Z1*Zc/(Z1 + Zc))
#voltage
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
I = V/Z
Imag = ((I.real)**2 + (I.imag)**2)**0.5
#Active power developed between points A and B
Pab = (Imag**2)*R
#Active power developed between points C and D
Pcd = (Imag**2)*Zc.real
#Current, I1
I1 = I*Zc/(Zc + Z1)
I1mag = ((I1.real)**2 + (I1.imag)**2)**0.5
#active power developed between points E and F
Pef = (I1mag**2)*Z1.real
#Results
print "\n\n Result \n\n"
print "\n (a)Active power developed between points A and B is ",round(Pab,2)," W\n"
print "\n (b)Active power developed between points C and D is ",round(Pcd,2)," W\n"
print "\n (c)Active power developed between points E and F is ",round(Pef,2)," W\n"
from __future__ import division
import math
import cmath
#initializing the variables:
Pa = 400;# in Watts
rv = 100;# in volts
thetav = 30;# in degrees
R = 4;# in ohm
pf = 0.766;# power factor
#calculation:
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#magnitude of apparent power,S = V*I
S = Pa/pf
phi = math.acos(pf)
theta = phi*180/math.pi# in degrees
#Reactive power Q
Q = S*math.sin(phi)
#magnitude of current
Imag = S/rv
thetai = thetav - theta
I = Imag*math.cos(thetai*math.pi/180) + 1j*Imag*math.sin(thetai*math.pi/180)
#Total circuit impedance ZT
ZT = V/I
#impedance Z
Z = ZT - R
#Results
print "\n\n Result \n\n"
print "\n (a)apparent power is ",round(S,2)," VA\n"
print "\n (b)reactive power is ",round(Q,1)," var lagging\n"
print "\n (c)the current flowing and Circuit phase angle is ",round(Imag,2),"/_",round(thetai,2),"deg A\n"
print "\n (d)impedance, Z is ",round(Z.real,2)," + (",round( Z.imag,2),")i ohm\n"
from __future__ import division
import math
import cmath
#initializing the variables:
S = 300000;# in VA
pf1 = 0.70;# in power factor
pf2 = 0.90;# in power factor
#calculation:
#active power, P
Pa = S*pf1
phi1 = math.acos(pf1)
phi1d = phi1*180/math.pi
#Reactive power, Q
Q = S*math.sin(phi1)
phi2 = math.acos(pf2)
phi2d = phi2*180/math.pi
#The capacitor rating needed to improve the power factor to 0.90
#the capacitor rating,
Pr = Q - (Pa*math.tan(phi2))
#Results
print "\n\n Result \n\n"
print "\n the rating (in kilovars) of the capacitors is ",round((Pr/1E3),2)," kvar leading\n"
from __future__ import division
import math
import cmath
#initializing the variables:
Z = 3 + 4j;# in ohms
rv = 50;# in volts
thetav = 30;# in Degrees
f = 1500;# in Hz
pf1 = 0.966;# in power factor
#calculation:
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#Supply current, I
I = V/Z
Istr = I.real - 1j*I.imag
#Apparent power, S
S = V*Istr
#active power, Pa
Pa = S.real
#reactive power, Q
Q = abs(S.imag)
#apparent power, S
S = (S.real**2 + S.imag**2)**0.5
phi1 = math.acos(pf1)
phi1d = phi1*180/math.pi
#rating of the capacitor
Pr = Q - Pa*math.tan(phi1)
#Current in capacitor, Ic
Ic = Pr/rv
#Capacitive reactance, Xc
Xc = rv/Ic
C = 1/(2*math.pi*f*Xc)
#Results
print "\n\n Result \n\n"
print "\n (a)supply current, I is ",round(I.real,2)," + (",round( I.imag,2),")i A\n"
print "\n (b)active power is ",round(Pa,2)," W, apparent power is ",round( S,2)," W "
print "and reactive power is ",round( Q,2)," W lagging\n"
print "\n (c)the rating of the capacitors is ",round(Pr,2)," var leading\n"
print "\n (d)value of capacitance needed to improve the power factor to 0.966 lagging is ",round( C*1E6,2),"uF\n"