
NFAP (c) 1990
All rights Reserved
Don C Robinson
3812 Booth
Kansas City, KS 66103
(913)362-3969 Home
(816)854-5434 Work

This program is provided free of charge and can be distributed under the follow:

1)  It is distributed unaltered, complete with document file included.
2)  Also it has to be given freely.  No charge or distribution fee, may be coll.

3)  If used for commercial use, the company should contact me directly for perm.

The reason for the above distribution rules is simple.  I provided the program .

NFAP - Nodal Format Analysis Program
for calculating the voltages of an AC Electronics Circuit using descrete compon.

Program overview:

Variables Used:

N= Number Nodes
F= Frequency

Three complex matrices are used:

A= N by N complex matrix, contains device loads
B= N by 1 complex matrix, contains current sources
C= N by 1 complex matrix, is the unknown voltages matrix

B=A*C

C=B/A   To find the solution

Devices are added into the matrices as using the following formulas:

Resistor:   R ohms

                  -> Ix
  O-------------\/\/\/\/\-------------O
Node From                          Node To

m=1/R+0j

Capacitor:   C farads

                  -> Ix
  O-----------------|(----------------O
Node From                          Node To

m=0+2(pi)C(freq)j


Inductor:  L Henry
                  -> Ix
  O-----------------[Z]---------------O
Node From                          Node To

m=0+-1/(2(pi)L(freq))j


R+xj:  R ohms + x=(L) Henry
                  -> Ix
  O-------\/\/\/\/\/\------[Z]--------O
Node From                          Node To

m=1/R+-1/(2(pi)L(freq))j



Complex Value (m) is added or subtracted into matrix A as follows:

------------------------------------------------------------
Matrix A Row/Column |----------------Column----------------|
--------Row---------|  Node Leaving     |    Node Entering |
--------------------|-------------------|------------------|
Node Leaving+ (From)|       +m          |        -m        |
Node Entering+ (To) |       -m          |        +m        |
------------------------------------------------------------


Current Source:  I Angle Theta

                  -> Ix
  O----------------(->)--------------O
Node From           I              Node To

------------------------------------------
Matrix B Row        |One dimension matrix|
--------Row---------|----Column one------|
--------------------|--------------------|
Node Leaving+ (From)|       -I           |
Node Entering+ (To) |       +I           |
------------------------------------------


Vs+R
Voltage Source with Resistor in series:  E Volts, R ohms

I=E/R

Add I the same as a current source and add R same as a resistor.

IcIs
Current Controlled Current Source: 

Node Leaving       Node Leaving
Control side       Source Side
_______            _______
   +  |            |   +
      \            |
      /            |   |
 R    \ Ib        (I)  V I=B*Ib        B=Beta=Control Value
      /            |                   Ib=Current through R
      \            |
   -  |            |   -
-------            -------
Node Entering      Node Entering
Control Side       Source Side

m=B/r        B=Control Value

Add m to Matrix A as follows and then add R to Matrix A same as a resistor.

------------------------------------------------------------
Matrix A Row/Column |----------------Column----------------|
--------Row---------|              Source Nodes            |
----Control Nodes---|  Node Leaving     |    Node Entering |
--------------------|-------------------|------------------|
Node Leaving+ (From)|       +m          |        -m        |
Node Entering+ (To) |       -m          |        +m        |
------------------------------------------------------------

VcIs
Voltage Controlled Current Source: 

Node Leaving       Node Leaving
Control side       Source Side
_______            _______
   +  |            |   +
      \            |
      /            |   
 R    \ Vx        (I)     I=gm(Vx)    gm=Control factor
      /            |                  Vx=Voltage across R
      \            |
   -  |            |   -
-------            -------
Node Entering      Node Entering
Control Side       Source Side

Add Control factor to matrix A as follows:

------------------------------------------------------------
Matrix A Row/Column |----------------Column----------------|
--------Row---------|              Source Nodes            |
----Control Nodes---|  Node Leaving     |    Node Entering |
--------------------|-------------------|------------------|
Node Leaving+ (From)|       +gm         |       -gm        |
Node Entering+ (To) |       -gm         |       +gm        |
------------------------------------------------------------



Routines to NFAP for HP-48SX


Name     Description
-------- ---------------------------------------------------
Begin    Starts/Restarts program for AC Circuit Analysis.
DELv     Purges all variables created by NFAP
Solv     Solves for Voltages unknown and displays them in stk
VcIs     Adds variables for Voltage Controlled I Source
R&Xj     Adds variables for R+Xj device
Branch   Subroutine that asks for Next Device
From     Subroutine that asks for From and To nodes.
Brn      Creates 'Dev' = Branch # + Device Type
Offm     Blanks Custom menus
Menu     Turns on Custom menus
Resis    Adds variables for Resistor Device
Cap      Adds variables for Capacitor Device
Inductor Adds variables for Inductor Device
Is       Adds variables for Current Source
Vs&R     Adds variables for Voltage Source + series Resistor
IcIs     Adds variables for Current Controlled Current Source
Add      Adds X to Matrix A using Fr and To for columns/Rows
Add2     Adds X to Matrix B using Fr and To for Rows
Add3     Adds X to Matrix A using Fr,Fr2,To,To2 for col/Rows
LblD     Adds Device value + label to 'Dev' variable
LblF     Adds Fr and To to 'Dev' variable
LblG     Adds Fr2 and To2 to 'Dev' variable
Copyright Copyright message for NFAP

Variables Used:

Name     Description
-------- ----------------------------------------------------
N        Number of Nodes in circuit
F        Frequency in Hz
A        Matrix A - N by N complex matrix
B        Matrix B - N by 1 complex matrix
C        Matrix C - N by 1 complex Matrix
Bn       Branch number (Number of Devices)
Dev      Last Device/Current Device specs, helps keep track
         of data entry.
CST      Custom Menu list
X        Complex variable used to add device to matrix
Fr       From Node
To       To Node
Fr2      From Node (control device)
To2      To Node (control device)
Y        Complex Variable - Used when two devices are added.
-------------------------------------------------------------

Custom menu

        [Resis]  [ Cap ]  [Induc]  [ Is  ]  [VS&R ]  [ICIS ]
NXT ->  [VCIS ]  [R&XJ ]  [SOLV ]  [BEGIN]  [DELV ]  [     ]

-------------------------------------------------------------

Running the program:

1) Go into NFAP Directory

2) Press [BEGIN] to Start or Restart the program.

3)Enter number of Nodes in Circuit, exclude reference node.

4)  Enter Frequency

5) When prompted for Next Branch, select device from softkeys.  For example if .

6)  Repeat step 5 for each device in the circuit.

7)  Select [SOLV] from the second level of softkeys to solve the matrix for the.

8)  If your ready to begin another circuit go to step 2, If your ready to exit .

The end.

Now for an example:


Circuit:

   [ Node 1            ]     R2    [Node 2]    R3    [Node 3]
   [-------------------]--\/\/\/\/-[------]-\/\/\/\/-[------]
    |       |       |      4 ohms    |       3 ohms        |
    I    R1 \       )                |                     )
Is (^)   1  /       ) Inductor       | Capacitor           )
1<60|   Meg \       ) .3 h           = 1 uf           .2 h )
    |   ohm /       )                |            Inductor )
    |       |       |                |                     |
   [--------------------------------------------------------]
   [                   Reference Node                       ]


Start Program

[Begin]
|----------------------|
|     NFAP (c) 1990    |
|                      |
|     Nodal Format     |
|   Analysis Program   |
|                      |
|   By Don Robinson    |
|                      |
|[ ] [ ] [ ] [ ] [ ][ ]|
|----------------------|

|----------------------|
|                      |
| Number Nodes?        |
|                      |
|                      |
| <                    |
|[ ] [ ] [ ] [ ] [ ][ ]|
|----------------------|

Circuit has three nodes and a reference node.

Type
          3 [ENTER]

|----------------------|
|                      |
| Frequency Hz?        |
|                      |
|                      |
| <                    |
|[ ] [ ] [ ] [ ] [ ][ ]|
|----------------------|


Analysis the Circuit at 10,000 Hz

Type
          10000 [ENTER]

|----------------------|
|     NFAP (c) 1990    |
|Last: NONE            |
|                      |
|                      |
|  Branch Number 1 ?   |
|                      |
|   (Select Device)    |
|[B] [C] [L] [I][V][IC]|
|----------------------|

Enter the current source.

Press Softkey 
          [ IS ]

|----------------------|
|Br=1 I<O              |        I<O=I Angle Theta
|                      |
|Current Source I<O?   |        I<O=I Angle Theta
|                      |
| <                    |
|[ ] [ ] [ ] [ ] [ ][ ]|
|----------------------|

Since the current source is a complex number 1 amp at phase 60 degrees.  Enter r

Press
          [Shift Left] ()
Next enter complex number
          1 [Shift Right] [Angle Symbol] 60

So it looks something like
(1<60)                         < = Angle Symbol

Then type
          [ENTER]

|----------------------|
|Br=1 I<O              |      I<O=I Angle Theta
|(1<60) :              |      Depends on Display Mode XYZ,R<Z
|Node L+.E-?           |
|                      |
| <                    |
|[ ] [ ] [ ] [ ] [ ][ ]|
|----------------------|


Nodes L+.E-?
L=Leaving or From or +, and E=Entering or To or -.

The current source is Leaving node 0 and Entering Node 1.

Type in
          0.1 [ENTER]
or type in
          .1 [ENTER]

The program will flash that it is adding the current source into the matrix and.

|----------------------|
|     NFAP (c) 1990    |
|Last: Br=1 I<O        |  Last device entered Branch 1, IS
|(I<60) :0:1           |  1 amp 60 deg  from node 0 to 1
|                      |
|  Branch Number 2 ?   |
|                      |
|   (Select Device)    |
|[B] [C] [L] [I][V][IC]|
|----------------------|


Select
          [Resis]

Resistance Value ohms?
Type
          1 [EEX] 6 [ENTER]
Nodes L+.E-?
Type
          1 [ENTER]

Doesn't matter on Resistor, Capacitor, Inductor or R=Xj what node goes in firstS
In the above case, any of the following inputs can be used:
          1 [ENTER]
          1.0 [ENTER]
          .1 [ENTER]
          0.1 [ENTER]

Next
Branch Number 3 ?

Press
          [Induc]

Inductor Value?
Type
          .3 [ENTER]
Nodes L+.E-?
Type
          1 [ENTER]

Next
Branch Number 4 ?

Press
          [Resis]

Resistance Value ohms ?

Type
          4 [ENTER]
Nodes L+.E-?
Type
          1.2 [ENTER]            Node 2.1 would also work.

Next
Branch Number 5 ?

Press
          [Cap]

Capacitor value?
Type
          1 [EEX] 6 [+/-] [ENTER]
Nodes L+.E-?
Type
          2 [ENTER]

Next
Branch Number 6 ?

Press
          [Resis]

Resistance Value ohms ?

Type
          3 [ENTER]
Nodes L+.E-?
Type
          2.3 [ENTER]            Node 3.2 would also work.

Branch Number 7 ?

Press
          [Induc]

Inductor Value?
Type
          .2 [ENTER]
Nodes L+.E-?
Type
          3 [ENTER]

Branch Number 8 ?

At This point choose [SOLV] to calculate voltages for each node.

Type
          [NXT] [SOLV]
[NXT] - Gets the second set of softkeys
[SOLV] - Softkey in custom menu.  Solves for voltages

Solution for F=10000 Hz
V1: (16.443864352  <-15.8963542449)
V2: (15.9490964551 <-29.9869000426)
V3: (15.9490960007 <-29.973221683 )

Solution for F=60 Hz
V1: (46.18620388  <146.868)
V2: (46.02842193 <149.8078)
V3: (45.99203034 <152.0863 )


Bug reports and suggestions are welcome.  This program is also available for th.

