#Variable declaration
Q = 4.0 #Charge(C)
t = 0.54 #Time(sec)
#Calculation
I = Q/t #Current(A)
#Result
print('Value of Current is , I = %.2f A' %I)
#Variable declaration
V = -24.0 #Voltage(V)
I = 3.0 #Current(A)
#Calculation
P = V*I #Power supplied by the element A(W)
#Result
print('Power supplied by the element A is , P = %.1f W' %P)
#Variable declaration
R1 = 5.0 #Resistance(ohm)
R2 = 4.0 #Resistance(ohm)
R3 = 9.0 #Resistance(ohm)
R4 = 6.0 #Resistance(ohm)
V1 = 10.0 #Resistance(ohm)
V2 = 6.0 #Resistance(ohm)
#Calculation
R_th = (R1*R4/(R1+R4))+R2 #Thevenin resistance(ohm) by removing R3 & short-circuiting voltage sources
I = (V1-V2)/(R1+R4) #Current(A) by applying KVL
V_th = 6*I+V2 #Thevenin voltage(V) by applying KVL
I_9ohm = V_th/(R_th+R3) #Current through 9 ohm resistor(A)
#Result
print('Current through 9 ohm resistor , I_9Ω = %.2f A' %I_9ohm)
from scipy.integrate import quad
#Variable declaration
V_t1 = 30.0 #Magnitudes of voltages(V) 0 < t1 < 2
V_t2 = -10.0 #Magnitudes of voltages(V) 2 < t2 < 4
T = 4.0 #Time period(sec) from figure
#Calculation
def integrand(V):
return V**0
a, err = quad(integrand, 0, 2)
def integrand(V):
return V**0
b, err = quad(integrand, 2, 4)
V_rms = ((a*V_t1**2+b*V_t2**2)/4)**0.5 #RMS value of voltage waveform(V)
#Result
print('RMS value , V_rms = %.2f V' %V_rms)
import math
import cmath
#Variable declaration
V_P = 200.0 #Magnitude of each phase(V)
#Calculation
V_an = V_P*cmath.exp(1j*0*math.pi/180) #Magnitude of 3-phase voltage(V)
V_bn = V_P*cmath.exp(1j*-120*math.pi/180) #Magnitude of 3-phase voltage(V)
V_cn = V_P*cmath.exp(1j*120*math.pi/180) #Magnitude of 3-phase voltage(V)
V_L = 3**0.5*V_P #Magnitude of line voltage(V)
#Result
print('Expression of phase voltages are,')
print('\t\t\t V_an = %.f∠%.f° V' %(abs(V_an),cmath.phase(V_an)))
print('\t\t\t V_bn = %.f∠%.f° V' %(abs(V_bn),cmath.phase(V_bn)*180/math.pi))
print('\t\t\t V_cn = %.f∠%.f° V' %(abs(V_cn),cmath.phase(V_cn)*180/math.pi))
print('Magnitude of the line voltage , V_L = %.1f V' %V_L)
import math
import cmath
#Variable declaration
R = 10.0 #Resistance of each coil(ohm)
X = 15.0 #Inductive reactance of each coil(ohm)
V_L = 420.0 #Line voltage(V)
f = 50.0 #Frequency of supply(Hz)
#Calculation
V_an = (V_L/3**0.5)*cmath.exp(1j*(0-30)*math.pi/180) #Phase voltage(V)
V_bn = (V_L/3**0.5)*cmath.exp(1j*(-120-30)*math.pi/180) #Phase voltage(V)
V_cn = (V_L/3**0.5)*cmath.exp(1j*(120-30)*math.pi/180) #Phase voltage(V)
Z_P = complex(R,X) #Phase impedance(ohm)
#For case(i)
I_L1 = V_an/Z_P #Line current(A)
I_L2 = V_bn/Z_P #Line current(A)
I_L3 = V_cn/Z_P #Line current(A)
#For case(ii)
pf = R/abs(Z_P) #Power factor
#Result
print('(i) Values of line currents are,')
print('\t I_L1 = I_an = %.2f∠%.2f° A' %(abs(I_L1),cmath.phase(I_L1)*180/math.pi))
print('\t I_L2 = I_bn = %.2f∠%.2f° A' %(abs(I_L2),cmath.phase(I_L2)*180/math.pi))
print('\t I_L3 = I_cn = %.2f∠%.2f° A' %(abs(I_L3),cmath.phase(I_L3)*180/math.pi))
print('(ii) Power factor is , pf = %.1f lag' %pf)
print('\nNOTE : I_L2 has an angle -206.31° in textbook which is same as 153.69° i.e (360-206.31)° obtained here')
import math
import cmath
#Variable declaration
Z_P = complex(10,15) #Per phase impedance(ohm)
V_L = 420.0 #Voltage(V)
#Calculation
#For case(i)
V_ab = V_L*cmath.exp(1j*0*math.pi/180) #Phase voltage(V)
V_bc = V_L*cmath.exp(1j*-120*math.pi/180) #Phase voltage(V)
V_ca = V_L*cmath.exp(1j*120*math.pi/180) #Phase voltage(V)
I_ab = V_ab/Z_P #Phase current(A)
I_bc = V_bc/Z_P #Phase current(A)
I_ca = V_ca/Z_P #Phase current(A)
#For case(ii)
I_P = abs(I_ab) #Phase current magnitude(A)
I_L = 3**0.5*I_P #Line current magnitude(A)
#Result
print('(i) Phase currents are,')
print('\t\t I_ab = %.2f∠%.2f° A' %(abs(I_ab),cmath.phase(I_ab)*180/math.pi))
print('\t\t I_bc = %.2f∠%.2f° A' %(abs(I_bc),cmath.phase(I_bc)*180/math.pi))
print('\t\t I_ca = %.2f∠%.2f° A' %(abs(I_ca),cmath.phase(I_ca)*180/math.pi))
print('(ii) Magnitude of line current , I_L = %.2f A' %I_L)
import math
import cmath
#Variable declaration
V_P = 280.0 #Generator Phase voltage(V)
Z_P = complex(2,3) #Line impedance per phase(ohm)
Z_L = complex(4,5) #Load impedance per phase(ohm)
#Calculation
V_An = V_P*cmath.exp(1j*0*math.pi/180) #Phase voltage(V)
V_Bn = V_P*cmath.exp(1j*-120*math.pi/180) #Phase voltage(V)
V_Cn = V_P*cmath.exp(1j*120*math.pi/180) #Phase voltage(V)
Z_t = Z_P+Z_L #Total impedance(ohm)
I_Aa = V_An/Z_t #Magnitude of line current for phase A(A)
I_Bb = V_Bn/Z_t #Magnitude of line current for phase B(A)
I_Cc = V_Cn/Z_t #Magnitude of line current for phase C(A)
V_an = I_Aa*Z_L #Phase voltage of load(V)
V_bn = I_Bb*Z_L #Phase voltage of load(V)
V_cn = I_Cc*Z_L #Phase voltage of load(V)
#Result
print('Line currents are,')
print('\t\t I_Aa = %.f∠%.f° A' %(abs(I_Aa),cmath.phase(I_Aa)*180/math.pi))
print('\t\t I_Bb = %.f∠%.f° A' %(abs(I_Bb),cmath.phase(I_Bb)*180/math.pi))
print('\t\t I_Cc = %.f∠%.f° A' %(abs(I_Cc),cmath.phase(I_Cc)*180/math.pi))
print('\nLoad phase voltages are,')
print('\t\t V_an = %.1f∠%.1f° V' %(abs(V_an),cmath.phase(V_an)*180/math.pi))
print('\t\t V_bn = %.1f∠%.1f° V' %(abs(V_bn),cmath.phase(V_bn)*180/math.pi))
print('\t\t V_cn = %.1f∠%.1f° V' %(abs(V_cn),cmath.phase(V_cn)*180/math.pi))
print('\nNOTE : ERROR : Z_L = 6.4∠38.6°Ω is taken in textbook solution instead of 6.4∠51.34°Ω = (4+j5)Ω')
import math
import cmath
#Variable declaration
Z = complex(6,8) #Per phase impedance of load(ohm)
V_AN = 340.0*cmath.exp(1j*0*math.pi/180) #Phase voltage(V)
#Calculation
V_P = abs(V_AN) #Voltage(V)
V_BN = V_P*cmath.exp(1j*-120*math.pi/180) #Phase voltage(V)
V_CN = V_P*cmath.exp(1j*120*math.pi/180) #Phase voltage(V)
I_an = V_AN/Z #Load current(A)
I_bn = V_BN/Z #Load current(A)
I_cn = V_CN/Z #Load current(A)
I_n = I_an+I_bn+I_cn #Neutral current(A)
#Result
print('Phase current in each load = Line current in each load are,')
print('\t\t\t\t I_an = I_Aa = %.f∠%.f° A' %(abs(I_an),cmath.phase(I_an)*180/math.pi))
print('\t\t\t\t I_bn = I_Bb = %.f∠%.f° A' %(abs(I_bn),cmath.phase(I_bn)*180/math.pi))
print('\t\t\t\t I_cn = I_Cc = %.f∠%.f° A' %(abs(I_cn),cmath.phase(I_cn)*180/math.pi))
print('Neutral current is , I_n = %.f A' %abs(I_n))
import math
import cmath
#Variable declaration
Z = complex(3,4) #Per phase impedance of load(ohm)
V_AN = 200.0*cmath.exp(1j*0*math.pi/180) #Phase voltage(V)
#Calculation
V_P = abs(V_AN) #Voltage(V)
V_AB = 3**0.5*V_P*cmath.exp(1j*30*math.pi/180) #Line voltage(V)
V_BC = 3**0.5*V_P*cmath.exp(1j*-90*math.pi/180) #Line voltage(V)
V_CA = 3**0.5*V_P*cmath.exp(1j*150*math.pi/180) #Line voltage(V)
#For case(i)
I_ab = V_AB/Z #Load current(A)
I_bc = V_BC/Z #Load current(A)
I_ca = V_CA/Z #Load current(A)
#For case(ii)
I_Aa = I_ab-I_ca #Line current(A)
I_Bb = I_bc-I_ab #Line current(A)
I_Cc = I_ca-I_bc #Line current(A)
#Result
print('(i) Magnitude of load currents are,')
print('\t\t I_ab = %.1f∠%.2f° A' %(abs(I_ab),cmath.phase(I_ab)*180/math.pi))
print('\t\t I_bc = %.1f∠%.2f° A' %(abs(I_bc),cmath.phase(I_bc)*180/math.pi))
print('\t\t I_ca = %.1f∠%.2f° A' %(abs(I_ca),cmath.phase(I_ca)*180/math.pi))
print('\n(ii) Magnitude of line currents are,')
print('\t\t I_Aa = %.2f∠%.2f° A' %(abs(I_Aa),cmath.phase(I_Aa)*180/math.pi))
print('\t\t I_Bb = %.2f∠%.2f° A' %(abs(I_Bb),cmath.phase(I_Bb)*180/math.pi))
print('\t\t I_Cc = %.2f∠%.2f° A' %(abs(I_Cc),cmath.phase(I_Cc)*180/math.pi))
print('\nNOTE : ERROR : Calculation mistakes in textbook')
import math
import cmath
#Variable declaration
Z = complex(3,4) #Per phase impedance of load(ohm)
V_AN = 150.0*cmath.exp(1j*0*math.pi/180) #Phase voltage(V)
#Calculation
V_P = abs(V_AN) #Voltage(V)
V_BN = V_P*cmath.exp(1j*-120*math.pi/180) #Phase voltage(V)
V_CN = V_P*cmath.exp(1j*120*math.pi/180) #Phase voltage(V)
I_Aa = V_AN/Z #Line current(A)
I_Bb = V_BN/Z #Line current(A)
I_Cc = V_CN/Z #Line current(A)
pf = Z.real/abs(Z) #Power factor
I = abs(I_Aa) #Magnitude of line current(A)
P = V_P*I*pf*10**-3 #Power supplied to each phase(kW)
P_t = 3*P #Total power supplied(kW)
#Result
print('Line currents are,')
print(' I_Aa = %.f∠%.2f° A' %(abs(I_Aa),cmath.phase(I_Aa)*180/math.pi))
print(' I_Bb = %.f∠%.2f° A' %(abs(I_Bb),cmath.phase(I_Bb)*180/math.pi))
print(' I_Cc = %.f∠%.2f° A' %(abs(I_Cc),cmath.phase(I_Cc)*180/math.pi))
print('Power factor , pf = %.1f ' %pf)
print('Power supplied to each phase , P = %.1f kW' %P)
print('Total Power supplied to the load , P_t = %.1f kW' %P_t)
import math
#Variable declaration
P = 120.0 #Total power(kW)
pf = 0.6 #Power factor
#Calculation
teta = math.acos(pf) #Power factor angle(radians)
teta_deg = teta*180/math.pi #Power factor angle(degree)
P_2 = 1.0/2*((math.tan(teta)*P/3**0.5)+P) #Second wattmeter reading(kW)
#Result
print('Second wattmeter reading , P_2 = %.1f kW' %P_2)
import math
#Variable declaration
P = 5000.0 #Power(W)
pf_1 = 0.8 #Initial Power factor
V = 110.0 #rms Voltage(V)
f = 50.0 #Frequency(Hz)
pf_2 = 0.9 #Final Power factor
#Calculation
phi_1 = math.acos(pf_1) #Initial Power factor angle(radians)
phi_1_deg = phi_1*180/math.pi #Initial Power factor angle(degree)
phi_2 = math.acos(pf_2) #Final Power factor angle(radians)
phi_2_deg = phi_2*180/math.pi #Final Power factor angle(degree)
C = P*(math.tan(phi_1)-math.tan(phi_2))/(2*math.pi*f*V**2)*10**6 #Parallel capacitance(µF)
#Result
print('Capacitance , C = %.1f µF' %C)
import math
#Variable declaration
pf_1 = 0.85 #Initial Power factor
kVA = 20.0 #Load(kVA)
f = 50.0 #Frequency(Hz)
pf_2 = 0.95 #Final Power factor
V = 200.0 #Voltage(V)
R = 0.05 #Resistance(ohm)
X = 0.2 #Inductive reactance(ohm)
#Calculation
phi_1 = math.acos(pf_1) #Initial Power factor angle(radians)
phi_1_deg = phi_1*180/math.pi #Initial Power factor angle(degree)
phi_2 = math.acos(pf_2) #Final Power factor angle(radians)
phi_2_deg = phi_2*180/math.pi #Final Power factor angle(degree)
P = kVA*pf_1 #Load power(kW)
C = P*1000*(math.tan(phi_1)-math.tan(phi_2))/(2*math.pi*f*V**2)*10**6 #Parallel capacitance(µF)
#Before adding capacitor
I_1 = P*1000/(pf_1*V) #Line current(A)
P_1 = I_1**2*R #Power loss in line(W)
#After adding capacitor\n",
S = P*1000/pf_2 #Apparent power(VA)
I_2 = S/V #Line current(A)
P_2 = I_2**2*R #Power loss in line(W)
#Result
print('Capacitance , C = %.1f µF' %C)
print('Power loss in the line before adding capacitor , P_1 = %.1f W' %P_1)
print('Power loss in the line after adding capacitor , P_2 = %.1f W' %P_2)