In [1]:

```
#Variable declaration
R_sh = 120.0 #Shunt field resistance(ohm)
R_a = 0.1 #Armature resistance(ohm)
V_L = 120.0 #Line voltage(V)
E_g1 = 125.0 #Generated voltage by dynamo A(V)
E_g2 = 120.0 #Generated voltage by dynamo B(V)
E_g3 = 114.0 #Generated voltage by dynamo C(V)
#Calculation
#Case(a) #1
I_gA = (E_g1-V_L)/R_a #Current in the generating dynamo A(A)
I_f = V_L/R_sh #Shunt field current(A)
I_a1 = I_gA+I_f #Armature current for dynamo A(A)
I_L1 = I_gA #Current delivered by dynamo A to the bus(A)
#2
I_gB = (E_g2-V_L)/R_a #Current in the generating dynamo B(A)
I_a2 = I_gB+I_f #Armature current for dynamo B(A)
I_L2 = I_gB #Current delivered by dynamo B to the bus(A)
#3
I_gC = (V_L-E_g3)/R_a #Current in the generating dynamo C(A)
I_a3 = I_gC #Armature current for dynamo C(A)
I_L3 = I_gC+I_f #Current received by dynamo C from the bus(A)
#Case(b) #1
P_LA = V_L*I_L1 #Power delivered to the bus by dynamo A(W)
P_gA = E_g1*I_a1 #Power generated by dynamo A(W)
#2
P_LB = V_L*I_L2 #Power delivered to the bus by dynamo B(W)
P_gB = E_g2*I_a2 #Power generated by dynamo B(W)
#3
P_LC = V_L*I_L3 #Power delivered by the bus to dynamo C(W)
P_gC = E_g3*I_a3 #Power generated by dynamo C(W)
#Result
print('Case(a) 1: Line current delivered by dynamo A to the bus , I_LA = %.f A' %I_L1)
print(' Armature current , I_a = %.f A' %I_a1)
print(' 2: Line current delivered by dynamo B to the bus , I_LB = %.f A. Thus dynamo B is floating' %I_L2)
print(' Armature current , I_a = %.f A' %I_a2)
print(' 3: Line current received by dynamo C from the bus , I_LC = %.f A' %I_L3)
print(' Armature current , I_a = %.f A' %I_a3)
print('\nCase(b) 1: Power delivered to the bus by dynamo A , P_LA = %.f W' %P_LA)
print(' Power generated by dynamo A , P_gA = %.f W' %P_gA)
print(' 2: Dynamo B neither receives or delivers power , P_LB = %.f W' %P_LB)
print(' Power generated by dynamo B to excite its field , P_gB = %.f W' %P_gB)
print(' 3: Power delivered by the bus to dynamo C , P_LC = %.f W' %P_LC)
print(' Internal power delivered in the direction of rotation of its prime mover , P_gC = %.f W' %P_gC)
```

In [1]:

```
#Variable declaration
R_a = 0.1 #Armature resistance(ohm)
R_f = 100.0 #Field circuit resistance(ohm)
V_L_b = 120.0 #Bus voltage(V)
V_L_a = 140.0 #Generated voltage of the generator(V)
#Calculation
#Case(a)
V_f = V_L_a #Voltage across the field(V)
I_f_a = V_f/R_f #Field current(A)
I_a_a = I_f_a #Armature current(A)
E_g_a = V_L_a+I_a_a*R_a #Generated EMF(V)
P_g_a = E_g_a*I_a_a #Generated power(W)
#Case(b)
I_a_b = (E_g_a-V_L_b)/R_a #Armature current(A)
I_f_b = V_L_b/R_f #Field current(A)
I_Lg = I_a_b-I_f_b #Generated line current(A)
P_L = V_L_b*I_Lg #Power generated across the lines(W)
E_g_b = V_L_a
P_g_b = E_g_b*I_a_b #Generated power(W)
#Result
print('Case(a): Generated current before it is connected to the bus , I_a = %.1f A' %I_a_a)
print(' Generated power before it is connected to the bus , P_g = %.1f W' %P_g_a)
print('Case(b): Generated armature current after it is connected to the bus , I_a = %.1f A' %I_a_b)
print(' Generated line current after it is connected to the bus , I_Lg = %.1f A' %I_Lg)
print(' Generated power across the line after it is connected to the bus , P_g = %.f W' %P_L)
print(' Generated power after it is connected to the bus , P_g = %.f W' %P_g_b)
```

In [1]:

```
#Variable declaration
R_a1 = 0.1 #Armature resistance of shunt generator 1(ohm)
R_a2 = 0.1 #Armature resistance of shunt generator 2(ohm)
R_a3 = 0.1 #Armature resistance of shunt generator 3(ohm)
R_L = 2.0 #Load resistance(ohm)
E_g1 = 127.0 #Voltage generated by shunt generator 1(V)
E_g2 = 120.0 #Voltage generated by shunt generator 2(V)
E_g3 = 119.0 #Voltage generated by shunt generator 3(V)
#Calculation
#Case(a)
V_L = ((E_g1/R_a1)+(E_g2/R_a2)+(E_g3/R_a3))/((1/R_a1)+(1/R_a2)+(1/R_a3)+(1/R_L))
#Case(b)
I_L1 = (E_g1-V_L)/R_a1 #Current delivered/received by generator 1(A)
I_L2 = (E_g2-V_L)/R_a2 #Current delivered/received by generator 2(A)
I_L3 = (E_g3-V_L)/R_a3 #Current delivered/received by generator 3(A)
I_L = -V_L/R_L #Current received by 2 ohm load(A)
#Case(c)
I_a1 = I_L1 #Armature current for generator 1(A)
I_a2 = I_L2 #Armature current for generator 2(A)
I_a3 = I_L3 #Armature current for generator 3(A)
P_g1 = E_g1*I_a1 #Power generated by generator 1(W)
P_g2 = E_g2*I_a2 #Power generated by generator 2(W)
P_g3 = E_g3*I_a3 #Power generated by generator 3(W)
#Case(d)
P_L1 = V_L*I_L1 #Power delivered/received from generator 1(W)
P_L2 = V_L*I_L2 #Power delivered/received from generator 2(W)
P_L3 = V_L*I_L3 #Power delivered/received from generator 3(W)
P_L = V_L*I_L #Power delivered/received from 2 ohm load(W)
#Result
print('Case(a): Terminal bus voltage , V_L = %.f V' %V_L)
print('Case(b): Current delivered to the bus by generator 1 , I_L1 = %.f A (to bus)' %I_L1)
print(' Current delivered to the bus by generator 2 , I_L2 = %.f A' %I_L2)
print(' Current received by the generator 3 from the bus , I_L3 = %.f A (from bus)' %I_L3)
print(' Current received from the bus by load , I_L3 = %.f A (from bus)' %I_L)
print('Case(c): Power generated by generator 1 , P_g1 = %.f W' %P_g1)
print(' Power generated by generator 2 , P_g2 = %.f W (floating)' %P_g2)
print(' Power generated by generator 3 , P_g3 = %.f W' %P_g3)
print('Case(d): Power delivered to the bus from generator 1 , P_L1 = %.f W' %P_L1)
print(' Power delivered to the bus from generator 2 , P_L2 = %.f W' %P_L2)
print(' Power received from the bus by generator 3 , P_L2 = %.f W' %P_L3)
print(' Power received from the bus by load , P_L = %.f W' %P_L)
```

In [1]:

```
#Variable declaration
P1 = 300.0 #Power rating of generator 1(kW)
P2 = 600.0 #Power rating of generator 2(kW)
V = 220.0 #Voltage rating of generator 1 and 2(V)
V_o = 250.0 #No-load voltage applied to both the generators(V)
V_1 = 230.0 #Terminal voltage(V)
V_2 = 240.0 #Terminal voltage(V)
#Calculation
#Case(a)
kW1_a = (V_o-V_1)/(V_o-V)*P1 #Load carried by generator 1(kW)
kW2_a = (V_o-V_1)/(V_o-V)*P2 #Load carried by generator 2(kW)
#Case(b)
kW1_b = (V_o-V_2)/(V_o-V)*P1 #Load carried by generator 1(kW)
kW2_b = (V_o-V_2)/(V_o-V)*P2 #Load carried by generator 2(kW)
#Case(c)
frac_a = (V_o-V_1)/(V_o-V) #Fraction of rated kW carried by each generator
frac_b = (V_o-V_2)/(V_o-V) #Fraction of rated kW carried by each generator
#Result
print('Case(a): When the terminal voltage is 230 V Generator 1 carries = %.f kW' %kW1_a)
print(' When the terminal voltage is 230 V Generator 2 carries = %.f kW' %kW2_a)
print('Case(b): When the terminal voltage is 240 V Generator 1 carries = %.f kW' %kW1_b)
print(' When the terminal voltage is 240 V Generator 2 carries = %.f kW' %kW2_b)
print('Case(c): Both generators carry no-load at 250 V ; %.3f rated load at %d V ; %.3f rated load at %d V ; and rated load at %d V ;' %(frac_b,V_2,frac_a,V_1,V))
```

In [1]:

```
#Variable declaration
E_1 = 220.0 #Terminal voltage of alternator 1(V)
E_2 = 222.0 #Terminal voltage of alternator 2(V)
f_1 = 60.0 #Frequency of alternator 1(Hz)
f_2 = 59.5 #Frequency of alternator 2(Hz)
#Calculation
E_max = (E_1+E_2)/2 #Maximum effective voltage across each lamp(V)
E_min = (E_2-E_1)/2 #Minimum effective voltage across each lamp(V)
f = f_1-f_2 #Frequency of the voltage across the lamps(Hz)
E_peak = E_max/0.7071 #Peak value of the voltage across each lamp(V)
n = (1.0/2)*f_1 #Number of maximum light pulsations per minute
#Result
print('Case(a): Maximum effective voltage across each lamp , E_max/lamp = %.f V (rms)' %E_max)
print(' Minimum effective voltage across each lamp , E_min/lamp = %.f V' %E_min)
print('Case(b): Frequency of the voltage across the lamps , f = %.1f Hz' %f)
print('Case(c): Peak value of the voltage across each lamp , E_peak = %.f V' %E_peak)
print('Case(d): Number of maximum light pulsations per minute , n = %.f pulsations/min' %n)
```

In [1]:

```
#Variable declaration
E_1 = 220.0 #Voltage generated by alternator 1(V)
E_2 = 220.0 #Voltage generated by alternator 2(V)
f_1 = 60.0 #Frequency of alternator 1(Hz)
f_2 = 58.0 #Frequency of alternator 2(Hz)
#Calculation
E_max = (E_1+E_2)/2 #Maximum effective voltage across each lamp(V)
f = f_1-f_2 #Frequency of the voltage across the lamp(Hz)
E_min = (E_2-E_1)/2 #Minimum effective voltage across each lamp(V)
#Result
print('Case(a): Maximum effective voltage across each lamp , E_max/lamp = %.f V' %E_max)
print(' Frequency of the voltage across each lamp , f = %.f Hz' %f)
print('Case(b): The voltages are equal and opposite in the local circuit')
print('Case(c): Minimum effective voltage across each lamp , E_min/lamp = %.f V' %E_min)
print(' Frequency of the voltage across each lamp , f = 0 Hz')
print('Case(d): The voltages are in phase in the local circuit')
```

In [1]:

```
import math
import cmath
#Variable declaration
E_1 = 220.0 #Terminal voltage of alternator 1(V) From Ex. 7-5
E_2 = 222.0 #Terminal voltage of alternator 2(V)
f_1 = 60.0 #Frequency of alternator 1(Hz)
f_2 = 59.5 #Frequency of alternator 2(Hz)
E1 = 220.0 #Voltage generated by alternator 1(V) From Ex. 7-6
E2 = 220.0 #Voltage generated by alternator 2(V)
f1 = 60.0 #Frequency of alternator 1(Hz)
f2 = 58.0 #Frequency of alternator 2(Hz)
R_a1 = 0.1 #Armature resistance of alternator 1(ohm)
R_a2 = 0.1 #Armature resistance of alternator 2(ohm)
X_a1 = 0.9 #Armature reactance of alternator 1(ohm)
X_a2 = 0.9 #Armature reactance of alternator 2(ohm)
#Calculation
Z_1 = complex(R_a1,X_a1) #Effective impedance of alternator 1(ohm)
Z_2 = complex(R_a2,X_a2) #Effective impedance of alternator 2(ohm)
#In Ex.7-5
E_r = E_2-E_1 #Effective voltage generated(V)
I_s = E_r/(Z_1+Z_2) #Synchronizing current in the armature(A)
#In Ex.7-6
Er = E2 -E1 #Effective voltage generated(V)
Is = Er/(Z_1+Z_2) #Synchronizing current in the armature(A)
#Result
print('In Ex.7-5 the synchronizing current in the armatures of both alternators , I_s = %.3f∠%.2f° A' %(abs(I_s),cmath.phase(I_s)*180/math.pi))
print('In Ex.7-6 the synchronizing current in the armatures of both alternators , I_s = %.f∠%.f° A' %(abs(Is),cmath.phase(Is)*180/math.pi))
```

In [1]:

```
import math
import cmath
#Variable declaration
E_gp1 = 200.0 #Terminal voltage of alternator 1(V)
E_gp2 = 220.0 #Terminal voltage of alternator 2(V)
R_a1 = 0.2 #Armature resistance of alternator 1(ohm)
R_a2 = 0.2 #Armature resistance of alternator 2(ohm)
X_a1 = 2.0 #Armature reactance of alternator 1(ohm)
X_a2 = 2.0 #Armature reactance of alternator 1(ohm)
#Calculation
#Case(a)
Z_p1 = complex(R_a1,X_a1) #Effective impedance of alternator 1(ohm)
Z_p2 = complex(R_a2,X_a2) #Effective impedance of alternator 2(ohm)
E_r = (E_gp2-E_gp1) #Effective voltage generated(V)
I_s = E_r/(Z_p1+Z_p2) #Synchronizing current in the armature(A)
Is = abs(I_s) #Magnitude of Synchronizing current(A)
theta = cmath.phase(I_s)*180/math.pi #Angle of Synchronizing current(degree)
P_2 = E_gp2*Is*math.cos(theta*math.pi/180) #Generator action developed by alternator 2(W)
#Case(b)
P_1 = -E_gp1*Is*math.cos(theta*math.pi/180) #Synchronizing power received by alternator 1(W)
#Case(c)
P1 = abs(P_1) #Magnitude of P1(W)
losses = P_2-P1 #Power loss in both armatures(W)
check = E_r*Is*math.cos(theta*math.pi/180) #Verifying losses(W) by Eq.7-7
double_check = Is**2*(R_a1+R_a2) #Verifying losses(W) by Eq.7-7
#Case(d)
V_p2 = E_gp2-Is*abs(Z_p2) #Generator action(V)
V_p1 = E_gp1+Is*abs(Z_p1) #Motor action(V)
#Result
print('Case(a): Generator action developed by alternator 2 , P_2 = %.1f W' %P_2)
print('Case(b): Synchronizing power received by alternator 1 , P_1 = %.1f W' %P_1)
print('Case(c): Power loss in both armature , Losses = %.f W' %losses)
print('Case(d): Terminal voltage of alternator 2 , V_p2 = %.f V (generator action)' %V_p2)
print(' Terminal voltage of alternator 1 , V_p2 = %.f V (motor action)' %V_p1)
print('Case(e): Phasor diagram is shown in Fig 7-14 in textbook page no 195')
```

In [1]:

```
import math
import cmath
#Variable declaration
E_2 = 230.0*cmath.exp(1j*180.0*math.pi/180) #Voltage generated by alternator 2(V)
E_1 = 230.0*cmath.exp(1j*20.0*math.pi/180) #Voltage generated by alternator 1(V)
Z = 2.01*cmath.exp(1j*84.3*math.pi/180) #Impedance(ohm)
#Calculation
E_r = E_2+E_1 #Total voltage generated by Alternator 1 and 2(V)
Z_1 = Z
Z_2 = Z
#Case(a)
I_s = E_r/(Z_1+Z_2) #Synchronizing current(A)
Is = abs(I_s) #Magnitude of Synchronizing current(A)
I_s_a = cmath.phase(I_s)*180/math.pi #Phase angle of Synchronizing current(degrees)
#Case(b)
E_gp1 = abs(E_1)
E_gp1_Is = (cmath.phase(E_1)*180/math.pi)-I_s_a #Angle(degree)
P_1 = E_gp1*Is*math.cos(E_gp1_Is*math.pi/180) #Synchronizing power developed by alternator 1(W)
#Case(c)
E_gp2 = abs(E_2)
E_gp2_Is = (cmath.phase(E_2)*180/math.pi)-I_s_a #Angle(degree)
P_2 = E_gp2*Is*math.cos(E_gp2_Is*math.pi/180) #Synchronizing power developed by alternator 2(W)
#Case(d)
P2 = abs(P_2);
losses = P_1-P2 #Losses in the armature(W)
theta = cmath.phase(Z)*180/math.pi #Angle(degree)
check = abs(E_r)*Is*math.cos(theta*math.pi/180) #Verifying losses(W) by Eq.7-7
R_aT = 2*Z.real #Total armature resistance of alternator 1 and 2(ohm)
double_check = Is**2*R_aT #Verifying losses(W) by Eq.7-7
#Result
print('Case(a): Synchronizing current , I_s = %.2f∠%.1f° A' %(Is,I_s_a))
print('Case(b): Synchronizing power developed by alternator 1 , P_1 = %.f W (power delivered to bus)' %P_1)
print('Case(c): Synchronizing power developed by alternator 2 , P_2 = %.f W (power received from bus)' %P_2)
print('Case(d): Losses in the armature , Losses = %.f W' %losses)
print('\nNOTE: Changes in obtained answer from that of textbook is due to more precision i.e more number of decimal places')
```

In [1]:

```
import math
import cmath
#Variable declaration
E_2 = 230.0*cmath.exp(1j*180.0*math.pi/180) #Voltage generated by alternator 2(V)
E_1 = 230.0*cmath.exp(1j*20.0*math.pi/180) #Voltage generated by alternator 1(V)
Z = 6.0*cmath.exp(1j*50.0*math.pi/180) #Impedance(ohm)
#Calculation
E_r = E_2+E_1 #Total voltage generated by Alternator 1 and 2(V)
Z_1 = Z
Z_2 = Z
#Case(a)
I_s = E_r/(Z_1+Z_2) #Synchronizing current(A)
Is = abs(I_s) #Magnitude of Synchronizing current(A)
I_s_a = cmath.phase(I_s)*180/math.pi #Phase angle of Synchronizing current(degrees)
#Case(b)
E_gp1 = abs(E_1)
E_gp1_Is = (cmath.phase(E_1)*180/math.pi)-I_s_a #Angle(degree)
P_1 = E_gp1*Is*math.cos(E_gp1_Is*math.pi/180) #Synchronizing power developed by alternator 1(W)
#Case(c)
E_gp2 = abs(E_2)
E_gp2_Is = (cmath.phase(E_2)*180/math.pi)-I_s_a #Angle(degree)
P_2 = E_gp2*Is*math.cos(E_gp2_Is*math.pi/180) #Synchronizing power developed by alternator 2(W)
#Case(d)
P2 = abs(P_2);
losses = P_1-P2 #Losses in the armature(W)
theta = cmath.phase(Z)*180/math.pi #Angle(degree)
check = abs(E_r)*Is*math.cos(theta*math.pi/180) #Verifying losses(W) by Eq.7-7
R_aT = 2*Z.real #Total armature resistance of alternator 1 and 2(ohm)
double_check = Is**2*R_aT #Verifying losses(W) by Eq.7-7
#Result
print('Case(a): Synchronizing current , I_s = %.2f∠%.1f° A' %(Is,I_s_a))
print('Case(b): Synchronizing power developed by alternator 1 , P_1 = %.f W (power delivered to bus)' %P_1)
print('Case(c): Synchronizing power developed by alternator 2 , P_2 = %.f W (power received from bus)' %P_2)
print('Case(d): Losses in the armature , Losses = %.f W' %losses)
print('\nNOTE: Changes in obtained answer from that of textbook is due to more precision i.e more number of decimal places')
```

In [1]:

```
import math
import cmath
import numpy
#Variable declaration
V_AB = 100.0*cmath.exp(1j*0.0*math.pi/180) #Voltage supplied across A & B(V)
V_BC = 100.0*cmath.exp(1j*-120.0*math.pi/180) #Voltage supplied across B & C(V)
V_CA = 100.0*cmath.exp(1j*120.0*math.pi/180) #Voltage supplied across C & A(V)
I1_1 = complex(6,0)
I1_2 = complex(-3,0)
I2_1 = complex(-3,0)
I2_2 = complex(3,-4)
V_1 = complex(100,0)
V_2 = complex(-50,-86.6)
#Calculation
A = [[I1_1,I2_1],[I1_2,I2_2]] #Matrix containing mesh equations array
delta = numpy.linalg.det(A) #Determinant of A
#Case(a)
I_1 = numpy.linalg.det([[V_1,I2_1],[V_2,I2_2]])/delta #Mesh current I_1(A)
I_2 = numpy.linalg.det([[I1_1,V_1],[I1_2,V_2]])/delta #Mesh current I_2(A)
#Case(b)
I_A = I_1 #Line current(A)
I_B = I_2-I_1 #Line current(A)
I_C = -I_2 #Line current(A)
#Case(c)
Z_A = complex(3,0) #Impedance(ohm)
Z_B = complex(3,0) #Impedance(ohm)
Z_C = complex(0,-4) #Impedance(ohm)
V_AO = I_A*Z_A #Phase voltage(V)
V_BO = I_B*Z_B #Phase voltage(V)
V_CO = I_C*Z_C #Phase voltage(V)
#Result
print('Case(a): Mesh current , I_1 = (%.3f%.4fj) A = %.1f∠%.2f° A' %(I_1.real,I_1.imag,abs(I_1),cmath.phase(I_1)*180/math.pi))
print(' Mesh current , I_2 = (%.2f%.3fj) A = %.2f∠%.2f° A' %(I_2.real,I_2.imag,abs(I_2),cmath.phase(I_2)*180/math.pi))
print('Case(a): Line current , I_A = (%.2f%.3fj) A = %.1f∠%.2f° A' %(I_A.real,I_A.imag,abs(I_A),cmath.phase(I_A)*180/math.pi))
print(' Line current , I_B = (%.3f%.3fj) A = %.3f∠%.2f° A' %(I_B.real,I_B.imag,abs(I_B),cmath.phase(I_B)*180/math.pi))
print(' Line current , I_C = (%.2f+%.3fj) A = %.2f∠%.2f° A' %(I_C.real,I_C.imag,abs(I_C),cmath.phase(I_C)*180/math.pi))
print('Case(c): Phase voltage , V_AO = %.1f∠%.2f° V' %(abs(V_AO),cmath.phase(V_AO)*180/math.pi))
print(' Phase voltage , V_BO = %.2f∠%.1f° V' %(abs(V_BO),cmath.phase(V_BO)*180/math.pi))
print(' Phase voltage , V_CO = %.2f∠%.2f° V' %(abs(V_CO),cmath.phase(V_CO)*180/math.pi))
print('Case(d): The phasor diagram is shown in fig 7-23b in textbook page no.208')
```