The Museum of HP Calculators

# Two-bus AC Power Transfer for the HP-33S

This program is by Karl Schneider and is used here by permission.

This program is supplied without representation or warranty of any kind. Karl Schneider and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

## Overview

PROGRAM FUNCTION: Calculates transfer of complex power between two AC buses

DESIGNED FOR: HP-33S (using ALG mode)

DIRECTLY PORTABLE TO: No other models

SIMILAR PROGRAMS TAILORED FOR: HP-32S, HP-32SII, and HP-33S (using RPN mode)

FUNCTIONAL DESCRIPTION:

This program calculates the total active (real) power "P" and reactive power "Q" injected into either end of an AC line or pair of paralleled AC lines joined by two buses. The AC line(s) may be three-phase or single-phase.

Each AC line is modeled with one set of "balanced-pi" parameters of series resistance, series reactance, and shunt susceptance. The AC bus voltages are defined in terms of rms magnitudes and a phase-angle difference.

The program includes a routine "Z" that will calculate the equivalent parameters of a parallel line-pair, if needed. The user may also run "Z" separately as a stand-alone program.

IMPORTANT: This program was originally written for RPN logic, and adapted so that users can input data in Algebraic (ALG) mode. The routines perform computations in RPN mode, but switch to ALG mode for INPUT and VIEW commands, and at completion. Users who normally operate the HP-33S in RPN mode should consider the RPN-mode version of this program.

RESOURCES:

```Total storage:   468 bytes

Program labels:    4

Stored variables: 10

Flags:             1 (flag 2)

```

PROGRAM CODE SUMMARY:

```Label  Bytes  Checksum  Description

S      42     93A7    Starts program; prompts for input variables

C     135     3B49    Drives calculation of the output variables

P     168     8A66    Calculates all injections of real and reactive power

Z     123     0FBE    Calculates equivalent parameters of line-pair

```

INPUT VARIABLES (in order of entry):

```Variable  Description                              Unit of measure    Notes

V      Voltage magnitude at first bus           [per unit]         (1)

W      Voltage magnitude at second bus          [per unit]         (1)

D      Voltage-angle difference between buses   [degrees]          (2)

R      Series resistance of line                [per unit]         (3)

X      Series reactance of line                 [per unit]         (3)

B      Total shunt susceptance of line          [per unit]         (4)

R      Series resistance of second line         [per unit]         (3,5)

X      Series reactance of second line          [per unit]         (3,5)

B      Total shunt susceptance of second line   [per unit]         (4,5)

(1)  1-phase lines: Base voltage is rms nominal line-ground (LG) voltage
3-phase lines: Base voltage is rms nominal line-line (LL) voltage = sqrt(3)*LG

(2)  Positive-valued angle difference is inputted for voltage at the first bus
leading that of the second bus; negative-valued angle difference is entered
for a lagging first-bus voltage.

(3)  Base impedance for R and X is the squared base voltage divided by power base
(100 MVA in line P0028).

(4)  Base admittance for B is the reciprocal of base impedance.

(5)  R, X, and B for the second line are to be input only if two lines are modeled.

```

OUTPUT VARIABLES (in order of display):

```Variable   Description                                    Unit of measure   Notes

P, S    Real power injected by first bus               [MW]              (6,7)

Q, T    Reactive power injected by first bus           [MVAr]            (6,8)

P       Real power injected by second bus              [MW]              (6)

Q       Reactive power injected by second bus          [MVAr]            (6)

P       Real-power consumption (losses) on the line    [MW]              (6,9)

Q       Reactive-power consumption on the line         [MVAr]            (6,9)

(6)  These units (MW or MVAr) assume a base voltage in kV and base power of 100 MVA.

(7)  P is re-stored to variable S when second-bus power is calculated.

(8)  Q is re-stored to variable T when second-bus power is calculated.

(9)  P and Q losses are also placed in the display as a complex-valued number.

```

PROCEDURE:

1. Set Flag 2 if two parallel transmission lines are to be entered

2. Start program using "XEQ S"

3. Enter input variables V, W, D, R, X, and B

4. Enter additional input variables R, X, and B for second line if necessary

5. Read total first-bus real power P; press "R/S"

6. Read total first-bus reactive power Q; press "R/S"

7. Read total second-bus real power P; press "R/S"

8. Read total second-bus reactive power Q; press "R/S"

9. Read total real-power line losses; scroll down to read total reactive-power line losses

TIPS:

• SHORTCUT: When the correct values of all other input variables are already entered, just modify individual variables using "STO" and calculate all results by entering "XEQ C", or calculate only first-bus injections by entering "XEQ P".

• Voltage magnitudes and line parameters may be inputted in physical units, rather than per-unit. To obtain correct results in the desired units, the power base (in line P0028) must be changed to the appropriate value.

• The SOLVE root-finding function can be utilized to iteratively solve for one input variable based upon a single "target" output value, with minor modification to the routine labeled "P" or "C".

## Listing

```S0001  LBL S       Enter main program
S0002  ALG
S0003  DEG
S0004  INPUT V     First-bus voltage magnitude (V1)
S0005  INPUT W     Second-bus voltage magnitude (V2)
S0006  INPUT D     Voltage-angle difference (d)
S0007  FS? 2       2-line network?
S0008  XEQ Z       -- If yes, run parallel-line program
S0009  FS? 2
S0010  GTO C
S0011  INPUT R     -- Else, enter line parameters here
S0012  INPUT X
S0013  INPUT B
S0014  GTO C

C0001  LBL C
C0002  CF 2
C0003  XEQ P       Calculate power from first bus
C0004  RCL P
C0005  STO S       Copy P from first bus
C0006  RCL Q
C0007  STO T       Copy Q from first bus
C0008  RCL V       Set variables to calculate power from second bus:
C0009  x<> W       -- Swap V and W
C0010  STO V
C0011  RCL D       -- Change sign of D
C0012  +/-
C0013  STO D
C0014  XEQ P       Calculate power from second bus
C0015  RCL V       Restore original values of V, W, and D
C0016  x<> W
C0017  STO V
C0018  RCL D
C0019  +/-
C0020  STO D
C0021  RPN
C0022  RCL T       Add complex power at first bus and second bus
C0023  RCL S
C0024  RCL Q
C0025  RCL P
C0026  CMPLX+
C0027  STO P       Store P losses
C0028  x<>y
C0029  STO Q       Store Q losses
C0030  ALG
C0031  SF 10
C0032  "LOSSES: P+Qi"   [Unquoted text is entered in Equation mode]
C0033  PSE
C0034  CF 10
C0035  RCL P
C0036  +
C0037  RCL Q
C0038  CMPLX
C0039  ENTER       Display losses P (real part) and Q (imag part) as complex
C0040  RTN

P0001  LBL P       Begin calculation of power injections
P0002  RPN
P0003  RCL D       Voltage-angle difference (d)
P0004  RCL V       First-bus voltage magnitude (V1)
P0005  RCL W       Second-bus voltage magnitude (V2)
P0006  *
P0007  Th,r->y,x
P0008  0
P0009  RCL V
P0010  x2
P0011  Rdown
P0012  Rdown
P0013  CMPLX-      V_dif = V1^2 - V1*V2*(cos d + j*sin d)
P0014  RCL X
P0015  +/-
P0016  RCL R
P0017  CMPLX/      S through line [in pu] = V_dif / (R - j*X)
P0018  RCL B
P0019  2
P0020  /
P0021  RCL V
P0022  x2
P0023  *
P0024  0
P0025  CMPLX-     Subtract line-charging Q (= j*B/2 * V1^2)
P0026  0
P0027  ENTER
P0028  100        Power base = 100 MVA
P0029  CMPLX*     Multiply P and net Q by power base
P0030  STO P
P0031  x<>y
P0032  STO Q
P0033  ALG
P0034  VIEW P     Show P injected into line(s)
P0035  VIEW Q     Show Q injected into line(s)
P0036  RTN

Z0001  LBL Z
Z0002  ALG
Z0003  INPUT R    Enter resistance of first line (R1)
Z0004  INPUT X    Enter reactance of first line  (X1)
Z0005  INPUT B    Enter susceptance of first line (B1)
Z0006  RPN
Z0007  RCL X
Z0008  RCL R
Z0009  CMPLX1/x
Z0010  STO S      Real part in temporary storage
Z0011  x<>y
Z0012  STO T      Imaginary part in temporary storage
Z0013  ALG
Z0014  INPUT R    Enter resistance of second line (R2)
Z0015  INPUT X    Enter reactance of second line  (X2)
Z0016  RPN
Z0017  RCL X
Z0018  RCL R
Z0019  CMPLX1/x
Z0020  RCL T
Z0021  RCL S
Z0022  CMPLX+
Z0023  CMPLX1/x   (Req + j*Xeq) = (R1+ j*X1) || (R2 + j*X2)
Z0024  STO R
Z0025  x<>y
Z0026  STO X
Z0027  RCL B
Z0028  STO S
Z0029  ALG
Z0030  INPUT B    Enter susceptance of second line (B2)
Z0031  RCL+ S
Z0032  STO B      Beq = B1 + B2
Z0033  CLx
Z0034  STO S      Clear S and T temporary registers
Z0035  STO T
Z0036  FS? 2      Is "Z" being run from AC transfer program?
Z0037  RTN        -- If yes, return without displaying results
Z0038  VIEW R     -- Else, display Req, Xeq, Beq in sequence
Z0039  VIEW X
Z0040  VIEW B
Z0041  RTN

```