## Example2_3_pg69.sce
## To find primary voltage and current supplied
## Theory of Alternating Current Machinery by Alexander Langsdorf
## First Edition 1999, Thirty Second reprint
## Tata McGraw Hill Publishing Company
## Example in Page 69
import math
## Given data
## Transformer A data
va_A = 100e+3; ## VA rating of Transformer
v1_A = 4600.; ## Voltage in volts
v2_A = 230.; ## Voltage in volts
x_A = 0.027; ## Reactance in Ohms
r_A = 0.008; ## Resistance in Ohms
## Transformer B data
va_B = 200e+3; ## VA rating of Transformer
v1_B = 4610.; ## Voltage in volts
v2_B = 225.; ## Voltage in volts
x_B = 0.013; ## Reactance in ohms
r_B = 0.003; ## Resistance in ohms
## Common Data
P_load = 150e+3; ## Power in Watts
pf = +0.85; ## + denotes lagging power factor
vg = 225.; ## Voltage in volts
## Calculations
## Transformer A
a_1 = v1_A / v2_A;
z_1 = complex(0.008 , 0.027 );
y_1 = 1. / z_1;
y_1_HVside = y_1 / a_1;
## Transformer B
a_2 = v1_B / v2_B;
z_2 = complex(r_B , x_B);
y_2 = 1. / z_2;
y_2_HVside = y_2 / a_2;
y_K = y_1 + y_2;
y_K_HVside = y_1_HVside + y_2_HVside;
## To find the current
I = P_load / (vg * pf) ;
V2_vec = vg;
theta = math.acos(0.85);
I_vec = I*complex(math.cos(theta) , -math.sin(theta)); ## - sign indicates I lags V
V1_vec = ((V2_vec * y_K) + I_vec) / (y_K_HVside) ;
I1_vec = (I_vec + V1_vec*((y_K / a_1) - y_K_HVside)) / (z_1 * y_K );
I2_vec = I_vec - I1_vec;
print'%s %.2f %s %.2f %s '%(' Primary Voltage of transformer = ', abs(V1_vec),'volts' and '',(math.atan(V1_vec.imag/V1_vec.real))*180./math.pi,'volts');
print'%s %.2f %s %.2f %s '%(' Current Supplied by transformer A =',abs(I1_vec),'' and '',(math.atan(I1_vec.imag/I1_vec.real))*180./math.pi,'');
print'%s %.2f %s %.2f %s'%(' Current Supplied by transformer B = ',abs(I2_vec),'' and '' ,(math.atan(I2_vec.imag/I2_vec.real))*180./math.pi,'');
## Result
## Primary Voltage of transformer = 4678.867698 /_ 1.211839 Volts
## Current Supplied by transformer A = 361.324403 /_ -44.400715 Volts
## Current Supplied by transformer B = 438.858386 /_ -21.431553 Volts
## Example2_6_pg76.sce
## To find branch currents and voltages
## Theory of Alternating Current Machinery by Alexander Langsdorf
## First Edition 1999, Thirty Second reprint
## Tata McGraw Hill Publishing Company
## Example in Page 76
import math
## Given data
## Transformer data
va = 100e+3; ## VA rating of Transformer
v1 = 11500.; ## Voltage in volts
v2 = 230.; ## Voltage in volts
f = 60.; ## Frequency in Hz
OC_pow = 560.; ## Power in watts
pf = +0.155;
sc_volt = 217.5; ## Volts
sc_curr = 8.7; ## Amperes
sc_pow = 1135.; ## Power in watts
ll_volt = 15000.; ## Line to line voltage
z_1 = 0.6; ## Impedance
pf2 = +0.866;
pf3 = -0.5;
## Calculations
power_factor = sc_pow / (sc_volt * sc_curr) ;
theta_e = math.acos(power_factor);
transformation_ratio = v1 / v2 ;
## HT values
z = sc_volt / sc_curr;
r = z*math.cos(theta_e);
x = z*math.sin(theta_e);
## LT values
z_lt = z/(transformation_ratio**2) ;
r_lt = r/(transformation_ratio**2) ;
x_lt = x/(transformation_ratio**2) ;
zz = complex(r_lt , x_lt) ;
## Referring to figure 2.16(b) in page 77
z1 = z_1 + zz ;
z_2 = z_1*complex(pf2 , abs(pf3));
z2 = z_2 + zz;
z_3 = z_1*complex(abs(pf3) , -pf2);
z3 = z_3 + zz;
print('z1 = ')
print(z1);
print('z2 = ')
print(z2);
print('z3 = ')
print(z3);
print('By referring to Figure 2.16(b) in page 77, E_A, E_B, E_C can be written in terms of the unknowns x and y.');
print("\nE_A = -(x - 150) + j(259.8 - y) \nE_B = -x - jy \nE_C = (300 - x) - jy");
print("\n\nI_A = E_A / z1 \nI_B = E_B / z2 \nI_C = E_C / z3 \n");
print("\nI_A = -1.649x -0.0218y +253.01 + j(425.14 -1.649y +0.0218x) \nI_B = -1.415x -0.829y + j(0.829x - 1.415y) \nI_C = -0.860x +1.439y +258 + j(-1.439x -0.860y +431.7)\n");
## I_A + I_B + I_C = 0;
print('On simplification and by separating the real and imaginary parts, we get two equations consisting of x and y as variables as shown');
print("\n -3.924x +0.588y +511.01 = 0\n -0.588x -3.924y +856.84 = 0\n");
x=-0.45
y=-0.40
E_A = complex(-(x - 150) , (259.8 - y)) ;
E_B = complex(-x , -y) ;
E_C = complex((300 - x), - y);
I_A = E_A / z1 ;
I_B = E_B / z2 ;
I_C = E_C / z3 ;
print'%s %.2f %s '%("\n\nI_A =",abs(I_A) /math.atan((I_A.imag)/(I_A.real))*180/math.pi," Amps")
print'%s %.2f %s '%("\n\nI_B = ",abs(I_B) /math.atan((I_B.imag)/(I_B.real))*180/math.pi," Amps")
print'%s %.2f %s '%("\n\nI_C = ",abs(I_C) /math.atan((I_C.imag)/(I_C.real))*180/math.pi," Amps")
print'%s %.2f %s '%("\n\nE_A = ",abs(E_A) /math.atan((E_A.imag)/(E_A.real))*180/math.pi," volts")
print'%s %.2f %s '%("\n\nE_B = ",abs(E_B) /math.atan((E_B.imag)/(E_B.real))*180/math.pi," volts")
print'%s %.2f %s '%("\n\nE_C = ",abs(E_C) / math.atan((E_C.imag)/(E_C.real))*180/math.pi," volts")
# results are different due to round off error and becasue of those equations
## Result
## z1 =
##
## 0.6059982 + 0.0080014i
##
## z2 =
##
## 0.5255982 + 0.3080014i
##
## z3 =
##
## 0.3059982 - 0.5115986i
##
## By referring to Figure 2.16(b) in page 77, E_A, E_B, E_C can be written in terms of the unknowns x and y.
## E_A = -(x - 150) + j(259.8 - y)
## E_B = -x - jy
## E_C = (300 - x) - jy
##
## I_A = E_A / z1
## I_B = E_B / z2
## I_C = E_C / z3
##
## I_A = -1.649x -0.0218y +253.01 + j(425.14 -1.649y +0.0218x)
## I_B = -1.415x -0.829y + j(0.829x - 1.415y)
## I_C = -0.860x +1.439y +258 + j(-1.439x -0.860y +431.7)
##
## On simplification and by separating the real and imaginary parts, we get two equations consisting of x and y as variables as shown
##
## -3.924x +0.588y +511.01 = 0
## -0.588x -3.924y +856.84 = 0
##
##
## I_A = 108.89 /_ -82.59 Amps
##
## I_B = 412.73 /_ 20.30 Amps
##
## I_C = 402.59 /_ 4.99 Amps
##
## E_A = 65.99 /_ -81.84 Volts
##
## E_B = 251.44 /_ 50.67 Volts
##
## E_C = 240.00 /_ -54.13 Volts
## Example2_22_pg111.sce
## Conductively and Inductively transferred power
## Theory of Alternating Current Machinery by Alexander Langsdorf
## First Edition 1999, Thirty Second reprint
## Tata McGraw Hill Publishing Company
## Example in Page 111
import math
## Given data
## Transformer data
va = 10e+3; ## VA rating of Transformer, VA
v1 = 2300.; ## Voltage in volts
v2 = 230.; ## Voltage in volts
print('Referring to Fig 2.57, we have');
## Calculations
V_1 = v1 + v2; ## Voltage in volts
I_1 = va/v2; ## Voltage in volts
I_3 = va/v1; ## Voltage in volts
I_2 = I_1 + I_3; ## Current in Amperes
a = V_1 / v1;
P = V_1 * I_1; ## Power in watts
P_i = P * (a - 1)/a; ## Power in watts
P_c = round(P/a); ## Power in watts
print"%s %.2f %s %.2f %s %.2f %s "%("\n\nTotal volt-amperes supplied from the source is =",P," VA" and " Volt-Amperes supplied inductively is = ",P_i," VA" and "Power supplied conductively is ",P_c," VA" )
## Result
## Referring to Fig 2.57, we have
##
##
## Total volt-amperes supplied from the source is = 110000 VA
## Volt-Amperes supplied inductively is = 10000 VA
## Power supplied conductively is 100000 VA
## Example2_29_pg130.sce
## Positive and negative sequence voltages
## Theory of Alternating Current Machinery by Alexander Langsdorf
## First Edition 1999, Thirty Second reprint
## Tata McGraw Hill Publishing Company
## Example in Page 130
import math
## Given data
V_1 = complex(1000 ,50);
V_2 = complex(-800 ,100);
V_3 = complex(-200 ,-150);
a = complex(math.cos(2*math.pi/3) , math.sin(2.*math.pi/3));
## Calculations
print('According to Equations 2-88 and 2-89 in page 130');
V_1p = (V_1 + V_2*a + V_3*a**2)/3;
V_1n = (V_1 + V_2*a**(-1) + V_3*a**(-2))/3;
print"%s %.2f %s %.2f %s "%("\n\nPositive sequence voltage is = ",abs(V_1p)/math.atan((V_1p.imag)/(V_1p.real))*180/math.pi , " Volts" and "Negative sequence voltage is =",abs(V_1n)/math.atan((V_1n.imag)/(V_1n.real))*180/math.pi, "Volts")
## Result
## According to Equations 2-88 and 2-89 in page 130
##
##
## Positive sequence voltage is = 452.7740 /_ -19.11 Volts
## Negative sequence voltage is = 605.5265 /_ 19.11 Volts
## Example2_29_pg131.sce
## Positive Negative and Zero sequence voltages
## Theory of Alternating Current Machinery by Alexander Langsdorf
## First Edition 1999, Thirty Second reprint
## Tata McGraw Hill Publishing Company
## Example in Page 131
import math
## Given data
V_1 = complex(1000. ,50.);
V_2 = complex(-800. ,100.);
V_3 = complex(-1100. ,-270.);
a = complex(math.cos(2.*math.pi/3.) , math.sin(2.*math.pi/3.));
## Calculations
print('According to Equations 2-88 and 2-89 in page 130');
V_1p = (V_1 + V_2*a + V_3*a**2)/3.;
V_1n = (V_1 + V_2*a**(-1) + V_3*a**(-2))/3;
V_0 = (V_1 + V_2 + V_3)/3.;
print"%s %.2f %s %.2f %s "%("\n\nPositive sequence voltage is = ",(abs(V_1p)/math.atan(V_1p.imag/V_1p.real)*180/math.pi) , " Volts" and "Negative sequence voltage is =",abs(V_1n)/math.atan((V_1n.imag)/(V_1n.real))*180/math.pi, "Volts")
print"%s %.2f %s"%("\n\nZero sequence voltage is =",abs(V_0)/math.atan((V_0.imag)/(V_1p.real))*180/math.pi , " Volts")
##
##
## Zero sequence voltage is = 302.6549 /_ 7.59 Volts
## Positive sequence voltage is = 558.9050 /_ 13.62 Volts
## Negative sequence voltage is = 757.9524 /_ -3.15 Volts
#Calculations are done directly