NetAna is a program developed to solve sets of linear equations using
matrix algebra to solve electrical network voltage and current values.
Python, and Python-Matplot were used to create the multi-platform
program. The GUI was handcrafted using Python's built in Tkinter.
NetAna is used to analyze DC and AC networks using either Node or
Mesh equations. NetAna uses a network specification (component values)
and driving voltages or currents and in the case of an AC network the
frequency range. Any text editor can be used to create, edit, and save
the network specification file. The "spec." file must be saved with an
".txt" extension. Once the specification filename is selected, the
network equations are entered into a matrix (grid table). This matrix
is “Submitted”, stored in a file. The network is then analyzed
producing an analysis report displayed in a pop up window. Next a plot
of the gain and phase angle can be produced. This plot can also be
saved to a file providing the user with a complete report and plot for
documenting the performance of the network.
The following words/symbols are used in defining the network/circuit
specification. The specification in typed into the program editor or
your favorite text edited and saved with the ".txt" extendsion.
The specificatioon may be typed in either lowercase or
uppercase. Python is case senesitve but, this program scans the
specification file and converts the text to uppercase before
evaluating the specification. The reserved words below are shown in
upper case even though they can be entered in lower case.
This word is required to be defined for
node analysis and specifes the number of nodes in the network. Example
"nodes = 5" to specify a five node network.
This word is required to be defined for
mash analysis and specifies the number of mashs in the network.
Example "mashs = 4" to specify a four mash network.
This word defines the voltage generator
value when doing mash analysis. When 'VG' is used. the program will do
mash analysis. Example "VG = 10.0' will specify a 10.0 volt
This word defines the current generator
value when doing node analysis. When 'IG' is used, the program will do
node analysis. Example: "Ig = 0.500' will specify a 500 millampere
L must be the first character of a word
to define an inductor value. Normally the usage would be ",L1, L2, L3,
L4 ......... " or "l1, l2, l3, l4 .... " but, the usage of the lower
case L may be confused for the number 1. Example: L23 = 25.0e-3
( 25.0 millihenry )
C is the first character of a value
definition for a capacitor - see above L* for usage. Example: c1 =
0.1e-6 ( 0.1 microfarad )
R must be the first character of the
word to define resistor values. Examples: r1 = 10e3 , R2 =
10,000.0, r4 = 1e6, R3=2*R2 where values are in ohms.
Used to define mulitple voltage sources
(mash analysis). Example: vglist = [e1, e2, 0, 0, e2]
This defines two voltage sources driving three mashs ( mashs 1, 2, and
5) where mashs are the current loops.
The first element of the list is the voltage source for meash 1. In
the above 'vglist' voltage 'e2' is driving mash 2 and 5.
Used to define multiple current sources
(node analysis). Example: iglist = [i1, i2, 0, 0, 0,
This defines three current sources in a six node network. Current
source at node six is the product of voltage e1 and admittance y3.
This keyword is used when doing AC
analysis only. It defines the 'start, stop, increment, label'
frequency range that will be used in the analysis.
Example: FREQ=(100,500,10, "Hz") defines a frequency range starting at
100 Hz to 500 Hz in steps of 10 Hz. And defines the frequency label
used the label the response plot.
The 'TF' (Transfer Function) keyword is
used the define the output of the analysis program. Example; TF =
("(i2-i3) * R3", "Volts") defines, for mash analysis, the voltage
across resistor R3. During analysis all mash currents are
solved and during node anlysis all node voltage are solved. The second
parameter passed to the TF is a label, used for DC analysis
only, used in writing the output report. If in the above example the
output to be in millivolts instead of volts, the TF is written as TF =
("(i2-i3)*R3*1e3"," mv") note that the first parameter must be scaled
by 1e3 (1000) to get millivolts.
The GOALS keyword is only used in DC
analysis. It defines the number of goals, similar to transfer
functions. Example: GOALS=3 specifies that there are three output
goals or expressions to be solved for using the network elements,
currents, or voltages. During Mash Analysis all loop currents are
solved and during Node Analysis all node voltages are solved.
GOAL? means Goal1......GoalN. where N is
defined by keywprd GOALS above.
Assuming Node Analysis:
Example: Goal1 = ("(e1-e2) / R2 *
1000", "ma.") # find current in R2
Goal2 = ("e1-e2", "volt") # find voltage across R2 assuming R2
connected between nodes 1 and 2.
Once the program is running, a frame with a top menu bar and four
buttons will be visible to the user. Depress the "Enter Sepc. File
Name" button and select the "Spec." file. The 'spec'
(specification) file is a plain text file with an extension '.txt' that
contains the program keywords. See the included Demo files in the
'Examples' folder included with this distribution.
Next depress the 'Enter Network Equations' button. A zero filled grid
(table) will appear if this is the first analysis run of this network.
Fill in the grid with the network equations. The equation cells in the
grid are unique in that no 's' or 'jw' symbols are entered in the cells,
only component symbols. The reactances are computed by the program.
Therefore, all the capacitor and inductance symbols must be entered with
their C's and L's. If this network has been analyzed before, the grid
will come up with the network equations already entered as used in the
last run. The equation can be edited any time this grid frame is open.
When all equations have been entered, depress the 'Submit' button on the
grid dialog frame. This will save the equations in a file with an '.equ'
Note: A feature has been added to version 1.0.0 allowing the user to
specify the network equations and connections in a xxxxx.net file
Once the equations have been saved as above, the 'Analyze Network'
should be pressed. If all goes well a new window will pop up displaying
the output report data. When doing DC analysis the report will show all
the loop current values for Mash analysis plus any GOAL values or all
the node voltage values plus GOAL values when doing Node Analysis.
When doing AC Analysis the report will show the transfer function (TF),
magnitude and phase values verses frequency as defined by the FREQ
Once a network/circuit has been analyzed three files will be
created and maybe an optional forth file may be created. These three
files should be kept together in order to re-run the analysis with the
same 'spec' and equations.
- mynetwok.txt -- user input 'spec' file
- mynetwork.report -- program generated output response file
- mynetwork.equ -- equation file
- mynetwork.net -- optional connection list file
- xxxxx.png -- plot image file, you apply name as you save it.
Plot Network Report
After viewing the output report, the output may be plotted by depressing
the 'Plot Network Report' button. You may save the plot by depressing
the lower right button on the plot frame. If you want to print either
the saved report or plot files, use one of the standard printing
methods, depending on the computer platform being used.
Net Connection List
Version 1.0.0 has added a feature that allows the user to
create a network connection text file that will be used to fill in
the grid when the "Enter Network Equations" button is depressed if
the ".equ" file does not exist.
When entering data in the first data column
be sure to include the symbols for the reactive components. The reactive
component must be
exposed (shown). Data may be entered in either upper or lower case.
Example: R1 is in series with C1; Y1
= 1.0/R1 + C1 and Y1 is connected between node 4 and
Y1+C1,4,5 as long as Y1 is defined in the spec. file. Such as
R1=10e3 and Y1=1/R1.
When creating this .net file you can create
a comment using the "#" symbol any place in the line and the rest of the
line will be treated as a comment. The xxxxxxx.net file will only be
used if an xxxxxx.equ file does not exist. If you depress the "Save"
button in the Equation Dialog grid display the equation
information will be saved in the xxxxxx.equ file. As long as the
xxxxxxx.equ file exists, the xxxxxxxx.net file will not be used. If you
edit the .net file, you must then delete the respective .equ file, then
the new net file will be used.