Professional Documents
Culture Documents
User'S Manual, Pecan Power Electronic Circuit Analysis: O.W. Andersen
User'S Manual, Pecan Power Electronic Circuit Analysis: O.W. Andersen
Andersen
PROGRAM INSTALLATION
PECAN is transmitted as a zip-file. It is extracted and installed in any directory (folder). The program
can also be installed on a memory stick and run from there.
N5
C6 C7 C8
B6 B7
B8 B9 B10 B14
C3 C4 C5
N4
Nx=Node x Fig. 1
Bx=Branch x
Cx=Component x
An input file DEMO.INP is for a very simple three phase rectifier. To run the program with this input,
enter:
RUN DEMO.INP
After a few seconds, the voltages across components C1 and C6 and currents in branches B11 and B14
are displayed as curves on the screen, with minimum and maximum values.
-2-
The graph has been drawn on a Visual Basic Form. If the picture appears to be cropped, adjust the file
SIZESCR.FIL. At the same time a bitmap picture file PLOTFILE.BMP has been produced. Close the
form and enter command:
PLOT
The graph now reappears in a standard Windows program. Before printing, it is sometimes desired to
crop the picture file to remove empty space. Microsoft Office Picture Manager or Microsoft Paint can
be used for that. Rather than printing it directly, it is recommended to transfer the picture file to
Microsoft Word. Here it can easily be resized and comments added before printing.
Output from PECAN is stored in file OUTPUT. To display it on the screen, enter:
FILE OUTPUT
Batch command FILE starts the standard Windows program NOTEPAD. It will be used here for
viewing, editing and printing text files. The first time it is invoked, it should be set to Courier New size
8, word wrap, and to no top and bottom extra text when printing. The window should always be
maximized.
INPUT
FILE DEMO.INP
What the numbers mean can be found on the input sheets. For an explanation of what else can be done
with the input file, copy it first to a new file with the command:
HEADINGS NEW.INP
FILE NEW.INP
The abbreviated headings on the input file also explain the numbers. With a little experience, that
explanation suffices to enter new numbers and to make up new input files.
Old input as similar as possible is first copied to a new input file. Then headings are introduced and the
file changed. Numbers always start in columns 1, 11, 21 and so on. They can be entered with or without
decimal point.
-3-
Before the new file can be run, the headings must be removed. Do this first with:
CLEANUP NEW.INP
A file without headings can have headings introduced and be viewed at the same time with:
HEADFILE NEW.INP
Headings can also be removed and the file run at the same time with:
CLEANRUN NEW.INP
New input must be entered very carefully, following explanations on the input sheets and instructions
elsewhere in this manual. Small mistakes like a comma instead of a decimal point or a number starting
in the wrong column are not tolerated. Some mistakes are caught by the program and are explained on
the output.
FOURIER ANALYSIS
Fourier analysis of one of the curves at a time can be performed. For a demonstration of how this is
done for a symmetrical square wave, start with:
RUN SQUARE.INP
FOURIER
Follow the instructions that now appear on the screen. The questions are already answered for the
square wave case.
The harmonic spectrum will appear on the screen. It can be brought back and printed in the same way
as explained earlier.
The results of the Fourier analysis will replace the contents of file OUTPUT and can be examined with
command:
FILE OUTPUT
The analysis is performed up to the 50th harmonic, or as high as permitted by the maximum step size.
The crest factor, form factor and harmonic distortion are part of the output.
- 4-
PROGRAM DESCRIPTION
The program is primarily designed to solve problems in power electronic circuit analysis. All the
common switching elements can be handled, such as diodes, ordinary thyristors, triacs, transistors and
gate turnoff thyristors. Non zero values for conductive resistance, constant volts in conduction, recovery
time and minimum latching current can be entered. Pulses for the switching elements can be specified by
starting time and number per second, by starting angle referred to an ac voltage, or by starting time after
a voltage or current goes through zero.
The circuit can include saturable inductors and mutual couplings between linear inductors.
All the common waveforms for voltage and current sources are included, dc, sinusoidal, sawtooth,
sweep, pulsed, stepped and linear variation. The user can also specify his own functions. If they are
linear functions of other voltages and currents, they can be entered directly. If not, or if the functions are
to be used to generate additional output, they can be programmed by the user in a small subroutine.
However, source code and a suitable compiler must be available for that.
The use of function voltage and current sources makes it possible to solve problems with complicated
regulation loops, and also many problems which are not at all or only partly circuit problems, but
governed by similar equations. This is a very powerful feature of the program. User programmed
functions can be plotted and Fourier analyzed, with all the circuit data omitted or entered as zeros.
A broad class of problems which PECAN is eminently suited to solve without most of the usual
simplifying assumptions, is generalized rotating machinery problems.
The synchronization of synchronous motors has been analyzed successfully. Initial conditions close to
synchronous speed were calculated separately. Then the program was set up to remove the starting
resistor and apply the field voltage at a certain time in relation to the phase angle of the induced field
current. Currents, torque and slip were calculated as functions of time as the machine pulled into step.
A line to line short circuit of a synchronous machine has also been solved, without the usual
assumptions of zero time constants and other simplifications. Currents, torque and open circuit voltage
were calculated.
Other potential applications in connection with synchronous machines are other types of short circuit,
out of phase synchronization, oscillations of compressor motors and diesel driven generators, transient
stability and voltage regulation.
The PECAN output gives numerical values of up to four voltages, currents and other variables at each
step in the solution, graphically in color as curves on the screen and on a printer. The program also
picks out minimum and maximum values, maximum derivatives, and calculates average values, rms
values and losses.
Step sizes are adjusted automatically by the program within specified limits, based on certain criteria,
which will be explained later.
-5-
BRANCH EQUATIONS
us
u1 r L C u2
i
iM
Fig. 2
The solution is done step by step, and for the first two steps after the starting point and after a switching
operation and another sudden change, the equation is:
inew - iold iM,new - iM,old 1
u1,new - u2,new = r inew + L + M + uc,old + inew t - us,new (1)
t t C
Here index new refers to the current step, and old to the previous step. Later avg will refer to the point
half way inbetween. This is illustrated for the current in Fig.3.
i i new
i avg
i old
t
t
previous step current step
Fig. 3
Similar equations are used for the voltages u1, u2, uc and us.
There may be more than one mutual inductance. Therefore, a summation sign is used in this term.
Eq. 1 may be solved for the current inew, or for one of the voltages u1,new or u2,new.
When the voltages and currents change more gradually, better accuracy is achieved with the equation:
inew - iold iM,new - iM,old 1 t
u1,avg - u2,avg = r iavg + L + M + uc,old + iavg - us,avg (2)
t t C 2
Old and new values are substituted for all the average values from equations similar to the one for iavg,
and Eq.2 may also be solved for inew, u1,new or u2,new.
In this case, a new capacitance voltage is calculated before the next step as:
1
uc = uc,old + iavg t
C
It is not possible to use Eq.2 immediately after sudden changes in the circuit, because it may lead to
unstable solutions with pulsations which repeat every second step. This is perhaps best explained with
reference to a branch with only an inductance. Eq.2 then becomes:
u2
u
u1 1 2 3 4 5 6
Fig. 4
At points 1, 3 and 5:
u1,new - u2,new = u
At points 2, 4 and 6:
u1,old - u2,old = u
In all cases the left hand side of Eq.3 is zero, and a voltage pulsation like this may be sustained even
with a constant current. This problem does not arise with Eq.1.
-7-
It could be argued that the capacitance voltage change in Eq.1 would be more accurate as:
1
iavg t
C
But this may lead to current pulsations similar to the voltage pulsations in Fig.4. It can be seen easily
for a branch with only a capacitance that such a current pulsation may be sustained even with constant
voltages at the terminals.
Similar instability problems have been experienced with the capacitance voltage change in Eq.2
substituted by:
1 t
(3iold + inew)
C 8
The program detects pulsations such as the ones in Fig.4 both of voltages and currents, and if they
should occur in spite of the precautions, it immediately switches to Eq.1 and reduces the step size to its
minimum value in order to suppress them.
CIRCUIT SOLUTION
Node potentials and branch currents are all considered to be variables, and a linear matrix equation is
set up relating them to each other at each point in time in the stepwise solution. Gaussian elimination is
used to find their values. The solution must be repeated with time intervals which are small enough for
the required accuracy.
One reason for using this straightforward approach instead of more sophisticated circuit theory and step
by step integration methods, is the use of function voltage and current sources. When voltages and
currents are specified as linear functions of other variables in the circuit, the equations are simply added
to the linear node and branch equations, and the overall solution method is not affected. It is also
possible to enter non linear functions, but in this case the values of the variables must be taken by the
program from the preceding step directly, or by extrapolation from the preceding two steps.
The method does not require all branches to have inductances different from zero, which is often the
case in methods based on integration of current derivatives. The input requirements are limited to a
minimum.
A circuit consists of components, nodes and branches. A component can be passive, such as a resistor,
inductor or capacitor. It can also be a switching element, such as a diode, thyristor, triac or transistor.
Finally, it can be a voltage source or a current source. Components which are connected in series and all
carry the same current constitute a branch. Each branch terminates at two nodes.
Nodes and branches are numbered consecutively, and it is recommended to use the prefixes N and B.
Node N1 receives the reference potential U1 = 0. Each separate circuit (without electrical connection)
must have a node N1. This node must never be isolated by open switches. The first branch receives the
number of the last node plus one. The last branch number is normally equal to the number of variables
(node potentials and branch currents), but additional variables can also be defined.
Isolated nodes are given the potential zero, and isolated branches will of course get zero currents.
-8-
If the node and branch numbering is done too haphazardly, it can result in difficulties for the program in
setting up the equations. The numbering should therefore be done in an orderly fashion. Branches should
be numbered in a sequence which corresponds roughly to the sequence of the node numbers.
A node equation is derived from the sum of the currents into the node equal to zero. It is used to
determine the current in one of the branches connected to the node.
Initially up to three branches can be assigned tentatively in array ASSIG(500,3). For node I, the branch
which is finally chosen will eventually end up in ASSIG(I,1). If it can be determined already at the
outset which branch will be used, the branch is assigned in a singular assignment. In multiple
assignments, initial preference is given to branches with only voltage sources, otherwise to the branches
with the lowest branch numbers.
A branch equation can be used to determine the branch current, or the potential at one of its two nodes.
The branch number and the two node numbers are therefore often entered initially in array
ASSIG(500,3). For branch I, the variable which is finally chosen will eventually end up in ASSIG(I,1).
The potential at node 1 is the reference potential zero. Therefore, node 1 is never assigned. If it is
possible to determine at the outset that only one of the three variables can be used, it is assigned in a
singular assignment.
SINGULAR ASSIGNMENTS
If a branch B has a current source, an open switch or is short circuited, the branch equation for branch
B must be used to determine the current in branch B.
If a branch B with only a voltage source is connected to node Nx, and its other node is N1 with the
reference potential zero, then the node equation for node Nx must be used to determine the branch
current in branch B. The inverse singular assignment also applies, in that the branch equation for branch
B must be used to determine the node potential at node Nx.
If a node NxN1 has only one branch B connected to it without a current source, an open switch or a
short circuit, then the node equation for node Nx must be used to determine the branch current in branch
B. Also here the inverse singular assignment applies, in that the branch equation for branch B must be
used to determine the potential at node Nx.
-9-
FINAL ASSIGNMENTS
In the final assignments in ASSIG(I,1), all the variables should appear once, so that they can be
determined by an equal number of linear equations. The rearrangement of array ASSIG to accomplish
this from the initial tentative assignments where variables may be missing in ASSIG(I,1) and appear
more than once, is done with an algorithm which rotates variables between ASSIG(I,1), (I,2) and (I,3),
eliminates variables, and successively narrows down the choice. This algorithm has been refined to a
point where it is very reliable. Nevertheless, it is easy to conceive of haphazard node and branch
numbering for some circuits, which will make its task impossible. The numbering should be done in an
orderly fashion, with node and branch numbers progressing through the circuit in roughly the same way.
A minimum and a maximum step size are specified in the input, and also a reference voltage for
automatic step size selection by the program.
The program always uses the minimum step size in two steps at the start of the calculation, after a
change in conductive state of one of the switching elements, after a change between non saturated and
saturated inductance of a non linear inductor, and after detecting numerical problems such as described
in connection with Fig.4. When not determined by these conditions, the step size is increased by a factor
of three, but not beyond its upper limit, if the maximum change of node potential from the preceding
step is less than 5% of the reference voltage. If on the other hand the change is more than 15% and the
step size is greater than the lower limit, the program repeats the last step with a step size of one third of
the previous value or equal to the lower limit, whichever is greater. A repetition with reduction of the
step size back to the point where a change in conductive state or inductance takes place is also effected,
whenever such a change is recorded. However, also in this case the step size will not be reduced beyond
its lower limit.
Conductive states of switching elements are updated after the calculations at each point. If impossible
situations arise, such as diodes carrying negative current, the last step is repeated.
- 10 -
A minimum and a maximum step size are specified in the input, and also a reference voltage for
automatic step size selection by the program.
The program always uses the minimum step size in two steps at the start of the calculation, after a
change in conductive state of one of the switching elements, after a change between non saturated and
saturated inductance of a non linear inductor, and after detecting numerical problems such as described
in connection with Fig.4. When not determined by these conditions, the step size is increased by a factor
of three, but not beyond its upper limit, if the maximum change of node potential from the preceding
step is less than 5% of the reference voltage. If on the other hand the change is more than 15% and the
step size is greater than the lower limit, the program repeats the last step with a step size of one third of
the previous value or equal to the lower limit, whichever is greater. A repetition with reduction of the
step size back to the point where a change in conductive state or inductance takes place is also effected,
whenever such a change is recorded. However, also in this case the step size will not be reduced beyond
its lower limit.
Conductive states of switching elements are updated after the calculations at each point. If impossible
situations arise, such as diodes carrying negative current, the last step is repeated.
One way to model an ideal transformer is to use mutually coupled inductances, and is described on input
sheet 6. The coupling factor should be k=1, and the inductances should have high values and be
proportional to the square of the turns L1/L2 = (N1/N2)2.
Another way, which is just as simple and more accurate, is to use a function current source and a
function voltage source, as shown on Fig.5.
I U
Primary Secondary
N1 turns N2 turns
Fig. 5
The function current source represents the primary winding, and is set equal to the current in the
secondary winding times N2/N1. The function voltage source represents the secondary winding, and is
set equal to the voltage across the primary winding times N2/N1.
- 11 -
Y- CONNECTION
In Fig.6, the short circuit impedance Z = R + j L is phase to neutral, referred to the primary winding.
The function voltage and current sources are:
A current source I2A must be used in secondary phase A, because a voltage source would have given a
short circuited loop with zero total voltage and an indefinite current. A current source in primary phase
A would not have added any information, since i1A = - (I1B +I1C) anyway, because of the connection.
For -Y connection, similar rules apply. In both cases, the secondary must have a node N1, which never
becomes isolated from the remaining nodes in that part of the circuit, because of switching actions.
Other nodes may have to be artificially connected with high resistances, to avoid becoming isolated.
- 12 -
CIRCUIT MODIFICATION
large
capacitance
dc voltage
source
large
capacitance
Fig. 8 Fig. 9
In this case a numerical instability is likely to occur in the capacitor branches, with the current pulsating
as in Fig.4, and the step size will remain at or near its minimum value. The resistance branch is trivial,
and is not required in the analysis. With sufficiently large capacitors, it is much better to simplify the
circuit, and to make it as in Fig.9.
Fig. 10
The RC overvoltage protection in Fig.10 often has a very small time constant T=RC, and its inclusion
requires correspondingly small step sizes. If such branches are not essential in the analysis, they should
therefore be removed.
- 13 -
RUN CONTINUATION
A run can be continued, if a desired steady state condition has not been reached, or if it is desirable for
some other reason. As an example, a run has been made with the command:
RUN INPUT.FIL
CONTRUN INPUT.FIL
In the continuation run, a new input file INP2.FIL will be made up from the old input file INPUT.FIL.
Here, initial conductor currents, capacitor voltages and conducting states of switching elements will be
set to the end values from the previous run. Also, phase angles and times of change for control pulses
and voltage and current sources will be adjusted to the new starting time.
Continuation runs can be made several times in succession. For cyclic phenomena, it is recommended
that each run is made for an integral number of cycles, but it is not necessary. Initial runs can be made
with fairly coarse steps, and only the final one or two cycles with finer steps, in order to save calculation
time.
Continuation runs can also be made if a run has been interrupted inadvertently, because the limit 30000
steps was reached before the specified end time.
- 14 -
The Command Prompt window should be maximized and the size adjusted to fill the screen after right
clicking the top title bar. Cursor size small and letter size 12x16 pixels are recommended. If Command
Prompt goes into full screen mode by an application, it can be brought back with Alt-Enter.
Since many PC users are not familiar with Command Prompt, here are some hints and frequently used
commands. The commands are examples and may be modified in obvious manners. Large and small
letters are interchangeable.
Other commands:
C: Moves to unit C or another unit.
CD\ Changes to base directory.
MD GRAPHICS Makes directory GRAPHICS.
CD\GRAPHICS Changes directory to GRAPHICS, just below the base directory.
COPY OLD.INP NEW.INP Copies old file OLD.INP to a new file NEW.INP.
COPY /? Explains options available for command COPY.
REN OLD.INP NEW.INP Renames OLD.INP as NEW.INP.
DEL OLD.INP Deletes OLD.INP.
DIR *.INP Lists all files in the directory with extension INP.
DIR *.I?? Lists all files in the directory with three letter extension starting with I.
START NOTEPAD OUTPUT Invokes Windows program NOTEPAD with file OUTPUT.
START PLOTFILE.BMP Starts a standard Windows program to process the bitmap file.
POWER ELECTRONIC CIRCUIT ANALYSIS PROGRAM PECAN INPUT SHEET 1
Numerical data are entered with the first digit in columns 1,11,21 etc.,
as indicated. Decimal point is optional.
Nodes, branches and components are numbered. Start with the nodes. Node 1
receives the reference potential zero. Each separate circuit (without
electrical connection) must have a node with the number one. This node
must never be isolated by open switches. When all the nodes are numbered,
continue with the branches. The first branch receives the number of the
last node plus one. The last branch number is normally equal to the number
of variables, which are node potentials and branch currents. However,
additional variables can also be defined, and are numbered in sequence,
following the last branch number. Components are numbered separately,
starting with one. For a clear indication on the connection diagram of
whether a number refers to a node, branch or component, prefixes N, B
and C are recommended.
Output control:
NUMBER OF OUTPUT VOLTAGES BETWEEN NODES ) 1
NUMBER OF OUTPUT VOLTAGES ACROSS COMPONENTS ) total 11
NUMBER OF OUTPUT BRANCH CURRENTS ) 4 21 3
NUMBER OF OUTPUTS FROM ADDITIONAL VARIABLES ) 31
OUTPUT START TIME, ms 41
NUMERICAL PRINTOUT AT EACH POINT (0 or 1, usually 0) 51
*1: It is possible to run the program with only programmed variables, and
the number of components equal to zero. In that case, the program is
not used to solve a circuit problem at all.
*2: The total number of variables must be 500.
*3: With an ac applied voltage, the max. step size should give at least
40 steps per cycle.
*4: The reference voltage is normally equal to the maximum (peak) applied
voltage. A smaller value can also be specified. The average step size
is approximately proportional to the reference voltage.
POWER ELECTRONIC CIRCUIT ANALYSIS PROGRAM PECAN INPUT SHEET 4