---
title: "Synchronous machine lab: phasors, V-curves and power limits"
heading: Solving round-rotor and salient-pole phasor diagrams in code, tracing V-curves and their stability limit, finding a salient machine's maximum power, and modeling a generator on a power system
eyebrow: S12 · Lesson 19 · Synchronous machine lab
xp: 60
---

::: hook
Lessons 10 to 18 drew phasor diagrams by hand: excitation from terminal conditions, V-curves from the field, the salient machine's two reactances, the power-angle curve through a network. Each is a few lines of complex arithmetic, and once it's in code the questions a designer actually asks become easy: how the field must change across a load range, where the stability limit lies, how much saliency adds. In this lab you'll write those functions and check them against the lessons' worked examples.
:::

::: play
- The curves are V-curves: armature current against excitation for a machine with $X_s$ = 1 pu on a 1 pu bus, at the three real powers shown.
- Each has its minimum at unity power factor, where the current equals the real power, and ends on the left at the stability limit $E_f = PX_s$.
- Overexcited (right) the machine supplies reactive power; underexcited (left) it absorbs it.
:::

```sim plot
view: graph
x: E = 0.3..2.2
y: I = 0..1.5
plot: sqrt(E^2 - 2*E*cos(asin(0.2/E)) + 1) | label: P = 0.2 pu
plot: sqrt(E^2 - 2*E*cos(asin(0.5/E)) + 1) | label: P = 0.5 pu
plot: sqrt(E^2 - 2*E*cos(asin(0.8/E)) + 1) | label: P = 0.8 pu
```

::: predict
## On its 0.8 pu V-curve ($X_s$ = 1 pu), a machine's excitation is raised from 1.281 pu (unity power factor) to 2.0 pu. What happens to its armature current?

- [ ] It stays at 0.8 pu
- [x] It rises to about 1.15 pu, as the machine supplies reactive power
- [ ] It falls, because the load angle shrinks
- [ ] It rises to 2.0 pu

::: reveal
Real power is fixed by the shaft, so only the reactive part changes. At $E_f$ = 2.0, sin δ = 0.4 and the current is $|E_fe^{j\delta} - 1|/X_s = 1.155$ pu: 0.8 pu real and 0.83 pu reactive, supplied to the bus. Task 3 traces the whole curve.
:::
:::

::: nameit
## What the lab computes

- **Round rotor** (generator, $R_a$ neglected): $\hat E_f = \hat V + jX_s\hat I$, with $\hat I = I\angle{-\phi}$ for a lagging power factor.
- **Salient pole**: $\hat E' = \hat V + jX_q\hat I$ gives the direction of $E_f$ (the angle δ); then $I_d = I\sin(\delta + \phi)$ and $E_f = |E'| + (X_d - X_q)I_d$.
- **V-curves**: at real power P on a 1 pu bus, $\sin\delta = PX_s/E_f$ and the current is $|E_fe^{j\delta} - 1|/X_s$; the curve exists only for $E_f \ge PX_s$.
- **Salient maximum power**: $P(\delta) = \frac{E_f}{X_d}\sin\delta + \frac{X_d - X_q}{2X_dX_q}\sin 2\delta$ peaks below 90°.
:::

::: check
kind: python

## Write `round_rotor(V, I, pf, Xs, lagging=True)` returning $(E_f, \delta)$ in per unit and degrees for a generator.

```python starter
def round_rotor(V, I, pf, Xs, lagging=True):
    return V, 0.0
```

```python solution
import cmath, math

def round_rotor(V, I, pf, Xs, lagging=True):
    phi = math.acos(pf)
    Ic = cmath.rect(I, -phi if lagging else phi)
    E = V + 1j * Xs * Ic
    return abs(E), math.degrees(cmath.phase(E))
```

```python tests
E, d = round_rotor(1, 1, 0.9, 0.84016)
assert abs(E - 1.5615) < 1e-3 and abs(d - 28.96) < 0.02, "Lesson 10's generator: 1.56 pu at 29.0°."
E2, d2 = round_rotor(1, 1, 1.0, 0.84016)
assert abs(E2 - 1.3061) < 1e-3 and abs(d2 - 40.03) < 0.02, "At unity power factor: 1.31 pu at 40.0°."
E3, d3 = round_rotor(1, 1, 0.9, 0.84016, lagging=False)
assert E3 < E2 < E, "Leading power factor needs the least field."
```

::: right
Right. Supplying vars costs field current; absorbing them costs stability margin.
:::
:::

::: check
kind: python

## Write `salient(V, I, pf, Xd, Xq, lagging=True)` returning $(E_f, \delta)$ by the two-reaction method.

```python starter
def salient(V, I, pf, Xd, Xq, lagging=True):
    return V, 0.0
```

```python solution
import cmath, math

def salient(V, I, pf, Xd, Xq, lagging=True):
    phi = -math.acos(pf) if lagging else math.acos(pf)
    Ic = cmath.rect(I, phi)
    Ep = V + 1j * Xq * Ic
    d = cmath.phase(Ep)
    Id = I * math.sin(d - phi)
    return abs(Ep) + (Xd - Xq) * Id, math.degrees(d)
```

```python tests
E, d = salient(1, 1, 0.8, 1.0, 0.6)
assert abs(E - 1.7750) < 1e-3 and abs(d - 19.44) < 0.01, "Lesson 17's example: 1.775 pu at 19.44°."
Er, dr = salient(1, 1, 0.8, 1.0, 1.0)
import cmath
assert abs(Er - abs(1 + 1j * (0.8 - 0.6j))) < 1e-12, "With Xd = Xq it reduces to the round rotor."
```

::: right
Right. The q-axis reactance fixes the angle; the d-axis one adds the rest of the excitation.
:::
:::

::: check
kind: python

## Write `v_curve(P, Xs, E)`: the armature current for real power P and excitation E on a 1 pu bus, or None below the stability limit, and `stability_limit(P, Xs)`.

```python starter
def v_curve(P, Xs, E):
    return P

def stability_limit(P, Xs):
    return 0.0
```

```python solution
import cmath, math

def v_curve(P, Xs, E):
    if E < P * Xs:
        return None
    d = math.asin(P * Xs / E)
    return abs((cmath.rect(E, d) - 1) / (1j * Xs))

def stability_limit(P, Xs):
    return P * Xs
```

```python tests
import math
assert abs(v_curve(0.8, 1.0, math.sqrt(1.64)) - 0.8) < 1e-9, "Unity power factor: the minimum, I = P."
assert abs(v_curve(0.8, 1.0, 2.0) - 1.155) < 1e-3, "Overexcited: 1.155 pu."
assert abs(v_curve(0.8, 1.0, 1.0) - 0.8944) < 1e-4, "Lesson 16's example: 0.894 pu at Ef = 1."
assert v_curve(0.8, 1.0, 0.7) is None and stability_limit(0.8, 1.0) == 0.8, "Below 0.8 pu it can't hold the load."
```

::: right
Right. The V-curve's left end is the stability limit; its bottom is unity power factor.
:::
:::

::: check
kind: python

## Write `salient_pmax(E, Xd, Xq)`: the maximum of $P(\delta)$ on a 1 pu bus and its angle in degrees, by golden-section search between 0 and 90°.

```python starter
def salient_pmax(E, Xd, Xq):
    return E / Xd, 90.0
```

```python solution
import math

def salient_pmax(E, Xd, Xq):
    P = lambda d: E / Xd * math.sin(d) + (Xd - Xq) / (2 * Xd * Xq) * math.sin(2 * d)
    lo, hi = 0.0, math.pi / 2
    g = (math.sqrt(5) - 1) / 2
    for _ in range(200):
        a, b = hi - g * (hi - lo), lo + g * (hi - lo)
        if P(a) < P(b):
            lo = a
        else:
            hi = b
    d = (lo + hi) / 2
    return P(d), math.degrees(d)
```

```python tests
Pm, d = salient_pmax(1.775, 1.0, 0.6)
assert abs(Pm - 1.884) < 1e-3 and abs(d - 72.2) < 0.1, "Lesson 17's machine: 1.884 pu at 72.2°."
P0, d0 = salient_pmax(1.775, 1.0, 1.0)
assert abs(P0 - 1.775) < 1e-9 and abs(d0 - 90) < 1e-3, "Without saliency: 1.775 at 90°."
Pr, dr = salient_pmax(0.0, 0.651, 0.398)
assert abs(Pr - 0.488) < 1e-3 and abs(dr - 45) < 1e-3, "No field: reluctance power alone, 0.49 pu at 45°."
```

::: right
Right. Saliency raises the peak and pulls it below 90°, and leaves a machine some power even without its field.
:::
:::

::: explain
## Why does a synchronous machine's armature current have a minimum as its field current is varied at constant real power?

::: model
With the shaft power fixed, the real part of the armature current is fixed too, because the terminal voltage is set by the bus. The field current sets the excitation voltage, which decides how much reactive power the machine exchanges with the bus: overexcited it supplies reactive power, underexcited it absorbs it. The armature current is the vector sum of its fixed real part and this reactive part, so it is smallest when the reactive part is zero, at unity power factor, and grows on either side. Lowering the field further eventually reaches the point where the excitation can no longer hold the real power at any angle, which ends the curve.
:::
:::
