In [1]:

```
from sympy import *
#Variable declaration
N = 100.0 #Number of turns
#Calculation
t = Symbol('t')
e = N*diff(0.05*sin(314*t), t, 1)
#Result
print('Induced voltage at the coil terminals , e = ' + repr(e) + ' V')
```

In [1]:

```
#Variable declaration
l = 0.65 #Length of conductor(m)
v = 35.0 #Speed of conductor(m/s)
B = 0.8 #Magnetic flux density(Tesla)
#Calculation
e = B*l*v #Induced voltage at the conductor(V)
#Result
print('Induced voltage at the conductor , e = %.1f V' %e)
```

In [1]:

```
import math
#Variable declaration
l = 1.5 #Length of conductor(m)
v = 20.0 #Velocity of conductor(m/s)
theta = 35.0*math.pi/180 #Angle(radians)
B = 0.9 #Magnetic flux density(Wb/m^2)
#Calculation
e = B*l*v*math.sin(theta) #Induced voltage at the conductor(V)
#Result
print('Induced voltage at the conductor , e = %.1f V' %e)
```

In [1]:

```
#Variable declaration
P = 4.0 #Number of poles
S = 40.0 #Number of slots
C = 10.0 #Number of conductors per slot
phi = 0.02 #Flux per pole(Wb)
N = 1200.0 #Speed(rpm)
#Calculation
Z = S*C #Total number of conductors
A = 2.0 #Number of parallel paths for Wave winding
E_g = P*phi*Z*N/(60*A) #Generated emf(V)
#Result
print('Generated emf , E_g = %.f V' %E_g)
```

In [1]:

```
import math
#Variable declaration
P = 6.0 #Number of poles
Z = 600.0 #Number of conductors
phi = 0.05 #Flux per pole(Wb)
N = 1000.0 #Speed of generator(rpm)
I_a = 120.0 #Current supplied by generator(A)
#Calculation
A = P #Number of parallel paths for lap winding
E_g = P*phi*Z*N/(60*A) #Generated voltage(V)
T_em = (P*Z*phi)/(2*math.pi*A)*I_a #Electromagnetic torque(N-m)
#Result
print('Generated voltage , E_g = %.f V' %E_g)
print('Electromagnetic torque , T_em = %.2f N-m' %T_em)
```

In [1]:

```
#Variable declaration
V_t = 220.0 #Shunt generator voltage(V)
I_L = 250.0 #Load current(A)
R_sh = 50.0 #Shunt field resistance(ohm)
R_a = 0.02 #Armature resistance(ohm)
#Calculation
I_sh = V_t/R_sh #Shunt field current(A)
I_a = I_L+I_sh #Armature current(A)
E_g = V_t+I_a*R_a #Generated voltage(V)
#Result
print('Generated voltage , E_g = %.2f V' %E_g)
```

In [1]:

```
#Variable declaration
E = 25.0 #Power of compound generator(kW)
V_t = 220.0 #Terminal voltage(V)
R_a = 0.07 #Armature resistance(ohm)
R_se = 0.05 #Series resistance(ohm)
R_sh = 55.0 #Shunt field resistance(ohm)
V_brush = 1.0 #Voltage drop per brush(V)
#Calculation
I_L = E*10**3/V_t #Load current in A
I_sh = V_t/R_sh #Shunt field current(A)
I_a = I_sh+I_L #Armature current(A)
#For case(i)
E_g1 = V_t+I_a*(R_a+R_se)+2*V_brush #Generated emf(V)
#For case(ii)
V_ab = V_t+I_L*R_se #Voltage across the shunt field(V)
I_sh2 = V_ab/R_sh #Current in the shunt field(A)
I_a2 = I_sh2+I_L #Armature current(A)
E_g2 = V_ab+I_a2*R_a+2*V_brush #Generated emf(V)
#Result
print('(i) Generated emf when generator is connected in long shunt , E_g = %.f V' %E_g1)
print('(ii) Generated emf when generator is connected in short shunt , E_g = %.1f V' %E_g2)
```

In [1]:

```
#Variable declaration
V_t = 220.0 #Shunt generator voltage(V)
I_L = 146.0 #Current delivered by generator(A)
R_sh = 55.0 #Shunt field resistance(ohm)
R_a = 0.012 #Armature resistance(ohm)
R_se = 0.02 #Series field resistance(ohm)
R_di = 0.03 #Diverter field resistance(ohm)
#Calculation
I_sh = V_t/R_sh #Shunt field current(A)
I_a = I_L+I_sh #Armature current(A)
R_com = R_se*R_di/(R_se+R_di) #Combined resistance(ohm)
E_g = V_t+I_a*(R_a+R_com) #Generated voltage(V)
P_lsd = I_a**2*R_com #Power loss in series field and diverter(W)
P_la = I_a**2*R_a #Power loss in the armature circuit resistance(W)
P_lsh = V_t*I_sh #Power loss in shunt field resistance(W)
P_dl = I_L*V_t #Power delivered(W)
#Result
print('Generated voltage , E_g = %.1f V' %E_g)
print('Power loss in the series field and diverter , P_lsd = %.1f W' %P_lsd)
print('Power loss in the armature circuit resistance , P_la = %.1f W' %P_la)
print('Power loss in the shunt field resistance , P_lsh = %.f W' %P_lsh)
print('Power delivered to the load , P_dl = %.f W' %P_dl)
print('\nNOTE : ERROR : Shunt field resistance is taken as 50 ohm while solving I_sh in textbook but it is 55 ohm as per textbook question')
```

In [1]:

```
#Variable declaration
P = 4.0 #Number of poles
Z = 500.0 #Number of conductors
I_a = 30.0 #Current delivered by generator(A)
alpha = 6.0 #Angle at which brushes are displaced angle(degree)
#Calculation
A = 2.0 #Number of parallel paths for Wave winding
I_c = I_a/A #Current per conductor(A)
#For case(i)
AT_d = Z*I_c*alpha/360 #Demagnetizing ampere-turns per pole(At)
#For case(ii)
AT_c = Z*I_c*((1/(2*P))-(alpha/360)) #Cross magnetizing ampere-turns per pole(At)
#Result
print('(i) Demagnetizing ampere-turns , AT_d = %.f At' %AT_d)
print('(ii) Cross-magnetizing ampere-turns , AT_c = %.1f At' %AT_c)
```

In [1]:

```
#Variable declaration
Power = 12.0 #Power(kW)
P = 4.0 #Number of poles
Z = 500.0 #Number of conductors
V_t = 250.0 #Generator voltage(V)
N = 1000.0 #Speed(rpm)
P_cu = 600 #Full load copper loss(W)
brush_drop = 2.0 #Total brush drop(V)
#Calculation
A = P #Number of parallel paths for lap winding
I_a = Power*10**3/V_t #Armature current(A)
R_a = P_cu/I_a**2 #Armature resistance(ohm)
E_g = V_t+I_a*R_a+brush_drop #Generated voltage(V)
phi = E_g*60*A/(P*Z*N) #Flux per pole(Wb)
#Result
print('Flux per pole , Φ = %.3f Wb' %phi)
```

In [1]:

```
#Variable declaration
P = 4.0 #Number of poles
I_L = 25.0 #Current delivered by generator(A)
V_t = 230.0 #Generator terminal voltage(V)
R_a = 0.2 #Armature resistance(ohm)
R_sh = 55.0 #Shunt field resistance(ohm)
V_brush = 1.0 #Voltage drop per brush(V)
#Calculation
I_sh = V_t/R_sh #Shunt field current(A)
I_a = I_L+I_sh #Armature current(A)
E_g = V_t+I_a*R_a+2*V_brush #Induced voltage(V)
P_arm = E_g*I_a #Power generated in armature(W)
P_L = V_t*I_L #Power absorbed by load(W)
n = (P_L/P_arm)*100 #Efficiency(percent)
#Result
print('Induced voltage , E_g = %.1f V' %E_g)
print('Efficiency of generator , η = %.1f percent' %n)
```