the ieee five bus power system analysis

Upload: jmercie1

Post on 03-Jun-2018

260 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    1/51

    Lakehead University

    Engineering 0438 WA Power Systems

    The IEEE Five Bus Power System Analysis

    Simulations and Results for Normal Operation, Symmetrical Bus Faults,and Line Removals

    Prese ntation Date

    April 8, 2013

    Report Submission Date

    April 3,2013

    Instructor/Supervisor

    Dr. K. Natarajan

    Group Members

    Jonathan Evangelista (# 0497627)

    Joey Mercier (# 0502424)

    Maxime Veillette (# 0455142)

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    2/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - i -

    Statement of Work and Responsibil ities

    By: Jonathan Evangelista, Joey Mercier, Maxime Veillette

    This statement is to declare that the work and responsibilities of the report for the

    IEEE 5-bus power system analysis and corresponding coding was divided equitably

    among the three aforementioned individuals.

    Jonathan Evangelista Joey Mercier Maxime V eillette

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    3/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - ii -

    Abstract

    The IEEE Five Bus Power System Analysis

    Power systems analysis is a critical part of any transmission or distribution system.

    Using physical properties of a system to perform calculations on how the entire

    system behaves is paramount to not only the design, but the maintenance and care of

    such a system. This report does such calculations from provided data on a 5-bus

    system. Additionally, fault analysis are performed for two types of faults: having a

    three-phase symmetrical bus fault to ground, and having a symmetrical fault on a line

    between two buses that results in the line being taken out of service. The latter fault

    is very important and is used to determine what would happen to not only the

    stability of the system, but also the overall effect on loadflow to each remaining line

    in service.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    4/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - iii -

    Contents

    !"#"$%$&" () *(+, #&- +$!.(&!/0/1/"/$! 22222222222222222222222222222222222222222222222222222222222222222 /

    #0!"+#3" 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 //

    "#01$ () )/45+$! 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 6

    1/!" () $75#"/(&! 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222226/

    82 /&"+(-53"/(& 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 8

    92 -$!/4& () ":$ )/6$;05! !

    !"#"6 ,78-. 9&0& """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" !

    "#" +',-)./%.(0 (1 /)(2)34,5362().%&4, 7,'+ ######################################################################### 8

    !"!"# :;*+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" ?

    !"!"! @%A-/ B&34*3&07%.+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" ?

    !"!"1 C-A0%.DE&FG+%.

    8#9 ,*44'%).-36

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    5/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - iv -

    ?2 3(&315!/(& #&- )5"5+$ *(+,222222222222222222222222222222222222222222222222222222222222222222222222222222222 8@

    >#$ 17%7)' :()@ 30+ 6.4.%3%.(0, ################################################################################################# $A

    >#" -(0-67,.(0 ####################################################################################################################################### $B

    A2 +$)$+$&3$! 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 9B

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    6/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - v -

    Table o f Figures

    1.27)' $C6.0' +.32)34 (1 %&' >

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    7/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    - vi -

    List o f Equations

    D"#$E3+4.%%30-' 43%).H ############################################################################################################################### >

    D"#"E-36-763%.02 0(+' 3+4.%%30-', ####################################################################################################### >

    D"#9E3//3)'0% /(:') 'I73%.(0 ################################################################################################################# >

    D"#8E/(:') %(%36, ########################################################################################################################################## >D"#>E%&' J3-(

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    8/51

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    9/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Introduction !1

    1. Introduction

    The objective of this project is to create a 5 bus electrical network from the provided information

    and complete a load flow analysis. The analysis must solve for the voltages, voltage angles and

    the amount of apparent power at each bus during various scenarios by using a system of

    equations. For this project the Newton-Raphson iteration method is used, due to its accuracy and

    speed in calculating load flow.

    The Newton-Raphson iterations require a great deal of matrix calculations; hence MATLAB and

    OCTAVE were used, since they are themselves designed for matrix manipulation. Furthermore,

    a GUI can be executed in MATLAB, and one was designed for this report. This GUI allows the

    selection of a fault type and section affected in the network. The information is then displayed in

    a table in the same display, allowing for the user to see all the values obtained from the load flow

    analysis. GNU Octave (which is initially UNIX based) was used because of its cross-platform

    portability; since it is an open-source software package, individuals may port it to different

    operating systems (it is native to Linux, but is already been ported to Windows, Mac OS,

    Android for mobile devices, etc).

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    10/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !2

    2. Design of the Five-Bus System

    2.1 Theory

    The material covered in this section describes the different bus types used in the project, which

    have different applications and different known values. These values are the voltage magnitude

    (|V|), the voltage angle (!), the real power (P) and the Reactive power (Q).

    2.1 .1 Load Bus

    A Load bus (P.Q. Bus) does not generate power, but has active and reactive loads connected to it.

    A load bus has information on the real and reactive power, but no information about the voltage

    magnitude or its angle.

    2.1.2 Generator Bus

    A generator bus (Voltage Controlled Bus) has a generator connected to it, which can be used to

    control the output voltage by adjusting the generator excitation. This output voltage remains

    constant during the normal operations of the system. The known values of a generator bus are the

    voltage magnitude and the real power. The unknown values are the voltage angle and the

    reactive power.

    2.1.3 Slack Bus

    A slack bus (Swing Bus) can generate extra power, if the generating bus cannot handle the load

    demanded by the system. The extra power is generated at a constant voltage magnitude and angle,

    however, the active and reactive power at the bus are unknown. A slack bus is also considered to

    be a reference bus since it will maintain a constant voltage magnitude and angle under different

    system conditions.

    2.1 .4 Given Data

    The following figures contain all pertinent information on the 5-bus system:

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    11/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !3

    Figure 1: Line Diagram of the 5 Bus System

    Figure 2 : Given Operating Conditions of 5 Bus

    Figure 3: Voltage Regulated Bus (Bus 4) Operating Conditions

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    12/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !4

    Figure 4: Line Data for 5 Bus System

    2.2 Description of Programs/Al gorithms Used

    In order to solve the 5 bus power system, various algorithms were used, all of which are based on

    numerical methods that stem from actual equations/functions. This section will provide insight

    into the inner workings of the code by explaining where their functions originate. The entire

    code was written for MATLAB/Octave. A Graphical User Interface, or GUI, was created to

    simplify and accelerate fault simulations.

    Even if the GUI was used to obtain the results, Octave can also be used to obtain the same results,

    and an example on how to do this is provided below (additionally, Octave has been ported to the

    Android OS, which makes it usable on mobile devices, and for a display of this, please refer to

    Appendix B):

    Using the [report, Lineflow] = report_5bus(ybus,busj,busk) (located in the report_5bus.m

    script file) function in octave will produce results similar to the GUI, but in a much less user

    friendly way. A snippet of the code used to generate the solution of the 5 bus system under

    normal operation in octave is shown below:

    octave:1> [results,loadflow] = report_5bus(Y5bus(),1,1);

    The actual results generated from using this code are included in section 3.2.

    All the code can be found in Appendix A of the report, and since it is well commented, only

    descriptions of the algorithms used will be explained, and not a line by line description. The

    following subsections will describe the algorithms used.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    13/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !5

    2.2 .1 Ybus Asse mbly

    The Ybus (or admittance matrix) for the power system was assembled using nodal equations and

    king of the hill principle, and can be shown in the equations:

    !"#$ ! !!! !

    !!" !

    !!" !

    !!" !

    !!"

    !!!" !!! !!!" !!!" !!!"

    !!!" !!!" !!! !!!" !!!"

    !!!" !!!" !!!" !!! !!!"

    !!!" !!!" !!!" !!!" !!!

    (2.1)

    !!" ! !!!"

    ! !!! ! !!!!"##$!%$&!"!"#$!!! !"#$!!!"#$%#!!!!

    (2.2)

    The line charging is given as an admittance in the data provided, and its positive values implies

    that they are a capacitive load (which is where line charging comes from). Having the Ybus for

    the system is very important, as the Zbus (or impedance matrix) can be obtained by inverting the

    Ybus.

    2.2 .2 Power Calculations

    The most straightforward calculations done are achieved with the following simple power

    equation:

    ! ! !! !!

    (2.3)By manipulating Equation 3, any of the three variables can be found given the two other ones are

    known. Another important calculation used was power loss, and this can be calculated using the

    formulas provided below:

    !!"!!!"# ! !!!!"#

    !

    !!!! !!"!!!"# !!!!"!!!"#

    !!"!

    !

    !"#$ ! !

    !!

    !"#$

    !

    !!!! !

    !"!!

    !"#$!

    !!!"!!

    !"!"

    !!"!!!"##$# ! !!"!!!"# ! !!"!!!"#$ !! !!"!!!"# ! !!"!!!"#$

    (2.4)

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    14/51

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    15/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !7

    !"!!!!!

    !" ! ! ! ! !!! !!!!!!!

    ! (2.6)

    The voltage correction value is calculated by inverting the Jacobian matrix and multiplying it to

    the difference of the perturbed and original power matrix, as can be seen in the equation below

    (the new voltage is calculated by adding the correction value to the current voltage value):

    !!"#

    ! !!"!# ! !! (2.7)

    2.2.4 Loadflow Analysis

    Loadflow (or lineflow) analysis consists of calculating the power transferred from one bus to

    another through a tie line. In order to compute the apparent power (and corresponding active [P]

    and reactive [Q] powers), the tie line and shunt currents must be known. The figure below

    shows the different impedances and corresponding currents between two buses (assuming Bus 1

    has a higher potential than Bus 2):

    Figure 5: Loadflow Currents

    In order to obtain the loadflow from a given bus to another, the conjugate of the line current (I12

    in the figure) is added to the conjugate of the line charging current (IiC in the figure, where i is 1

    or 2) and multiplied to the bus voltage (much like equation 3) and can be summarized by the

    equation below (which would calculate sending end loadflow from bus 1 to bus 2):

    !!" ! !!" !!!!" ! !! ! !!!" ! !!!!! (2.8)A negative active power implies that there is consumption while a positive power indicates

    power transferred.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    16/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !8

    2.2.5 Kron Reduction

    The Kron reduction is a very powerful matrix operation. It can be used for wye-delta

    transformations, amongst other things. In essence, Kron reduction reduces a matrix that has zero

    elements in a vector. Explaining this process is quite complex and trivial, and is much better

    expressed through matrix algebra, and is shown in the equation below:

    !! ! !!!! ! ! ! ! !!!

    ! ! !

    !!! ! !!"

    !!!! !! ! ! !!! !!

    ! ! !

    !!! ! ! ! ! !!!

    !!

    !

    !!

    !!!!

    !

    !!

    !

    !!

    !

    !!

    !

    !

    !

    !!!!

    !!!!!!!!

    ! !!! !!

    ! !!! !!!!!!

    !!

    !

    !!

    !!!!

    !

    !!

    !

    !!

    !

    !!

    !

    !

    !

    !!!!

    ! !!!!!!!!! ! !!! !!!!!!

    !!! !

    !!! !!

    !!

    !

    !!

    !

    !!

    !

    !!

    (2.9)

    It can be seen that the A matrix was initially NxN, and after being Kron reduced it became MxM.

    Kron reductions were used in the power system to analyze the removal of a line, as explained in

    section 2.2.6.

    2.2.6 Line Removal and Zbus Modif ications

    In order to remove a line, simple metrics on parallel impedances must be understood. If an

    impedance is in parallel with its negative value, the resulting parallel impedance is infinity, or an

    open circuit. This is displayed by the equation below:

    ! ! !! ! ! !!! ! !!

    ! !!!!

    ! !!!"#$!!"!! (2.10)However, negative impedances are impossible to achieve when resistors are involved, but the

    idea shown in the above equation can be applied to removing a line in the power system without

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    17/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !9

    having to rebuild a Ybus from scratch. Using case 4 of zbus modification algorithm [1], which is

    to add an impedance between two buses, an open circuit can be created, thus effectively

    eliminating a tie line between two buses. The modifications to the Zbus can be seen in the

    following equation, where an impedance Zb is added in between buses j and k:

    !!

    !

    !!

    !

    !

    !!! ! !!!

    ! !!"#$! !

    !!! ! !!!

    !!! ! !!!

    !

    !!" ! !!"

    !!! ! !!! ! !!" ! !!" !! ! !!! ! !!! ! !!!"

    !!

    !

    !!

    !!

    (2.11)

    It can be seen that the resulting matrices can be Kron reduced by 1 to obtain a new Zbus of the

    same size (the Zbus is obtained by inverting the original Ybus matrix) that accounts for this

    removed line.

    2.2 .7 Symmetrical Bus Faults (Superposition)

    In order to perform analysis of a symmetrical bus fault to ground, superposition is used [1]. The

    main idea behind this technique is that the fault voltage on the faulted bus is equal to its negative

    value during steady-state operation. When steady-state and fault voltages are added, the result is

    zero, which implies the bus potential is zero itself (ie: it is grounded). From there, a subtransient

    fault current can be calculated, along with changes in voltage on the other buses. This can be

    summarized with the equations below, assuming a fault occurs on bus 4:

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    18/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Design of the Five-Bus System !10

    !!!

    !!!

    !!!

    !!!

    !!!

    ! !"#$

    !

    !

    !

    !!!!

    !

    ! !!! ! !!!!! ; !!! ! !!!!! !!!!!

    !!

    !!

    !!

    !!

    ! !!!!"!#!$%

    !!!!"!#!$%

    !!!!"!#!$%

    !!!!"!#!$%

    !!!!"!#!$%

    ! !!!

    !!!

    !!!

    !!!

    !!!

    ! !!!!"!#!$% ! !!!

    !!!!"!#!$% ! !!!

    !!!!"!#!$% ! !!!

    !

    !!!!"!#!$% ! !!!

    (2.12)

    2.3 Applic ation to Standard Power System

    The above admittance matrix assembly, power calculations, Newton-Raphson algorithm, Kron

    reduction, z-bus modification (including line removal) and symmetrical bus fault methods may

    all be applied to any standard power system. Differences arise when certain buses include tap

    ratios and shunt admittances, for example. If a transient stability study were to be conducted, i.e.

    solving for the clearing time of a fault or solving the general swing equation, different

    approaches would be taken depending on whether the architecture is a single-machine or multi-machine system. In a multi-machine system, certain assumptions would be made to reduce the

    system using Kron reduction and with those values, proceed to a swing solution.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    19/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Simulation Results !11

    3. Simulation Results

    The results are given with the GUI first, and then with a snippet of the code used to generate the

    same results in octave (exception is the Ybus, which was only generated in octave). A sample of

    the results for normal operation analysis obtained in Octave is also given.

    3.1 Generated Ybus

    Figure 6: Generated Ybus

    3.2 Normal Operation

    Figure 7: Results for Normal Operation

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    20/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Simulation Results !12

    octave:1> [results,loadflow] = report_5bus(Y5bus(),1,1);

    Figure 8 : Results f or Normal Operation U sing Oc tave

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    21/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Simulation Results !13

    3.3 Line Removal

    Figure 9: Results for Removing Line Between Bus 1 and Bus 4

    octave:2> [results,loadflow] = report_5bus(removeLine(1,4),1,4);

    Figure 10: Results for Removing Line Between Bus 3 and Bus 5

    octave:2> [results,loadflow] = report_5bus(removeLine(3,5),3,5);

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    22/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Simulation Results !14

    3.4 Symmetrical Bus Fault

    Figure 11: S ymmetrical Bus Fault to Ground on Bus 4

    octave:4>[faultI,faultV] = gen_SymmBusFault(4,NR5bus_driver(Y5bus()));

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    23/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Discussion of Results !15

    4. Discussion of Results

    4.1 Normal Operation

    The voltages obtained using the Newton-Raphson method converged in four iterations (which

    indicate the initial guesses given were very good) and all where within 10% of the slack bys

    voltage. The results obtained in the Normal Operation simulation indicate that Bus 1 generated

    the bulk of the power for the entire system (since bus 2 only generated a constant 45 MW of

    active power). In terms of losses, the entire system had about a 2.61% of active losses present,

    which can be considered relatively low. The active losses are most likely due to active

    impedance of the lines (since other higher order effects are neglected [ie: flux loss, parasitic

    capacitances, etc]).

    The highest loadflow occurred between buses 1 and 4, and between buses 4 and 5, locking in at

    approximately 84 MW and 54 MW respectively. This is due to buses 1 and 4 generating all the

    power in the system; therefore most of the power is transferred between those two buses. The

    high power transferred from bus 4 to 5 is due to the power demand on bus 5 being the highest of

    all buses.

    The lowest loadflow occurred between buses 3 and 5, and between buses 2 and 3, coming in at

    approximately 6 MW and 18 MW respectively (the reasoning for this is explained in the Line

    Removal section below).

    4.2 Line Removal

    After performing every possible permutation of line removals, only the cases at both extremes

    were included in the results section. In terms of voltage stability, no single line removal created

    enough changes to induce voltage instability (the Newton-Raphson method converged in 4

    iterations and all the voltages were within 10% [or +/- 0.106] of the slack bus voltage for all

    possible line removals).

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    24/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Discussion of Results !16

    The biggest losses occurred when the buses having the highest loadflow between their tie line

    had that line removed (highest loadflow is between buses 1 and 4, and between buses 4 and 5, as

    mentioned above). The converse of the above statement also holds true, and the proofs are in the

    results, and explained hereinafter.

    When the line between buses 1 and 4 was removed, the highest active power loss was recorded

    (a loss of approximately 8.46%), which makes sense since it is the main tie line between the two

    buses that generate the power. One reason for this high power loss is due to the power demand

    at bus 5. Since bus 5 is not directly connected to bus 1 (power must go from bus 1 through bus 2

    and then through buses 3 or 4), the path for power becomes longer, meaning more power will be

    lost on the lines through the line impedances. A big problem also stemming from this line

    removal comes from the reactive power on bus 4. According to the specifications, the MVAR

    capabilities on bus 4 are from -40 to 50 MVAR (see Figure 3), in which case these limits are

    exceeded when line 1-4 is removed (33.2663 MVAR [-20 MVAR] = 53.2663 MVAR). This

    would cause the bus to trip, thus potentially causing more problems having this bus out of

    service (the entire generation would have to come from bus 1)1. And finally, another very

    important side effect of this line removal can be seen on bus 2: the entire power generated by bus

    1 now had to be routed by bus 2 to the entire grid. In reality, this could potentially cause

    problems if bus 2 was not rated high enough for this power.

    Other interesting observations were made during simulations: removing the line between bues 4

    and 5 also yielded high active power loss, since bus 5 has the highest power demand and this

    demand now had to be completed routed through bus 3. Furthermore, the lowest loss occurred

    when the line between buses 3 and 5 was removed. This was because this was the farthest tie

    line from power generation and there is little loadflow between the two buses in normal

    operation (as mentioned above).

    1The 5-bus system was simulated as a 4-bus system (without bus 4), and the Newton-Raphson

    method was non-convergent after 100 iterations (might be due to initial guesses) this was notinvestigated further, since it was felt that if bus 4 would trip, the entire five bus system would be

    in trouble and proactive measures (beyond the scope of this report) would have to be taken.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    25/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Discussion of Results !17

    4.3 Symmetrical Bus Fault

    The results obtained in the symmetrical bus faults simulation provide a little insight into the high

    subtransient currents that would be present if all three phases of an entire bus became shorted to

    ground. The probability of having a symmetrical fault is not as great as having just one phase of

    the bus grounded, but the simplicity of the superposition model trumped using a more complex

    unsymmetrical model (and corresponding information is missing for this ie: zero sequence

    impedances and such). Even if the simulations gave an idea of fault currents and voltages, those

    cannot be interpreted as actual phase/line currents/voltages since only a power base of 100 MVA

    was given; there was no information on the voltage or current base, so only per unit values can

    be used and are therefore reported. The highest fault currents were recorded when bus 4 was

    grounded, since this bus has the most tie lines to other buses.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    26/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Conclusion and Future Work !18

    5. Conclusion and Future Work

    5.1 Future Work and Limitations

    Although quite complete, the GUI could be optimized to show Y and Z buses in real time.

    Additionally, adding transient analysis to the remove line function (ie: a ground fault occurs at a

    point along a tie line, the user being able to select the distance of the fault from a bus) could also

    be a nice feature. This was slightly implemented, but not completed, as can be seen by the figure

    below:

    Figure 12: Transient Analysis Option (Future Work)

    By adding these features, perhaps stability (in terms of clearing angle and maximum swing

    analysis) for the generators could also be achieved. A more in depth analysis of symmetrical bus

    faults would also be a nice addition.

    However convenient the proposed future work/additions are, their incorporation was not

    performed primarily because some of the information on the system is lacking: there is no dataon the subtransient and transient impedances of the system or of the generators, no information

    on transformers or distance of the lines, no base voltage or current given, no zero sequence

    impedances (for unsymmetrical faults), and so on.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    27/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Conclusion and Future Work !19

    5.2 Conclusion

    From the provided line data and operating conditions for the above 5-bus transmission system in

    Figure 1, a successful loadflow solution and fault analysis is performed. Matlab and Octave

    software are utilized to compute the necessary numerical methods, i.e. the Newton-Raphson

    iterative process. Furthermore, the Kron reduction technique is performed to reduce the faulted

    network when a symmetrical fault is simulated in the program. Matlab provides a GUI

    (graphical user interface) creator, which was used to create a user-friendly interface that can be

    used to easily simulate and visualize the loadflow results and also the effect of a simulated

    symmetrical fault on the loadflow results. Additionally, a user interactive script was written to

    extend the capabilities to mobile devices that support Octave (the script can also be used in

    Octave on a personal computer as well). Finally, all the results were as expected and seem to

    agree with established principles of theory.

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    28/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    References !20

    6. References

    Bibliography

    [1] Grainger, J. J., & Stevenson, Jr, W. D. (2003). Power Systems Analysis. New

    York: Tata McGraw-Hill.

    Dr. K. Natarajan, Power System Analysis and Design, Engi-0438, Lakehead

    University, Thunder Bay

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    29/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    [This page was left blank intentionally.]

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    30/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 22

    Appendix A MATLAB/Octave Code

    % Filename: c5busMVA.m% Description: calculate powers at each node and either return a vector to% be used with newton raphson to return all powers% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    function[Sval] = c5busMVA(Ybus,V,~)

    all = nargin(); % check to see if all power are to be returned

    I=Ybus*V; % CurrentS=V.*conj(I); % Power at each nodeP=real(S);Q=imag(S); %Real and reactive parts of the powerif(all

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    31/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 23

    % generate matrix with actual line impedances between busesimpMat = [0 z12 0 z14 0;

    z12 0 z23 z42 0;0 z23 0 z43 z35;z14 z42 z43 0 z45;0 0 z35 z45 0];

    ybus = Y5bus();zbus = inv(ybus) % get zbus from ybusVf = Vinit(fbus,1) % fetch initial fault voltageIf = Vf/zbus(fbus,fbus) % find fault currentImat = zeros(5,1); % setup fault current vectorImat(fbus,1) = -If; % setup fault current vectordelV = zeros(5,1); % setup voltage change vectorfaultI = zeros(5,1);

    delV = zbus*Imat; % find change in voltages in dead networkfaultV = Vinit+delV; % use superposition to find fault current

    fori=1:5 % discard low valuesif(abs(faultV(i,1)) < 1e-10)faultV(i,1)=0;end;end;

    fori=1:5 % fault current from other buses flowing into faulted busif(impMat(fbus,i) == 0) % if no connection between buses

    i=i+1; % increment by 1else

    faultI(i,1) = faultV(i,1)/impMat(fbus,i); % find currenti=i+1;

    end;end;

    % Filename: kronRed.m% Description: recursive kron reduction algorithm% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    functionredBus = kronRed(bus,amnt)

    i = 0; % number of iterations of kron reduction

    while(i < amnt) % keep iterating until amount of wanted reductions reachedN = length(bus);bus = bus(1:N-1,1:N-1) - (bus(1:N-1,N)/bus(N,N))*bus(N,1:N-1);i = i+1;

    end;

    redBus = bus; % return final value

    % Filename: loadflow.m% Description: calculate power flow from line to line using line% admittances and line charging values% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    function[S_flow] = loadflow(Vnode1, Vnode2, LineAdm, LineShunt)

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    32/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 24

    % Find currentsI12 = (Vnode1-Vnode2).*LineAdm; % calculate line current from node 1 to node 2Ishunt1 = Vnode1.*LineShunt; % calculate shunt current from node 1 to groundIshunt2 = Vnode2.*LineShunt; % calculate shunt current from node 2 to ground

    % Put answer in a vector/matrix

    S_flow = Vnode1.*(conj(I12) + conj(Ishunt1));

    % Filename: NR5bus_driver.m% Description: drives and automates the use of newton-raphson method% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    functionV=NR5bus_driver(Ybus);

    V=[1.06;1;1;1.047;1]; % initial voltage guess as per given datac=[1;1;1;1;1;1;1]; % initial correction vector not used just to get into while looptol=1e-8; % tolerance can be changed computing to approximately 5 decimals.iter=1; % keep track of # of iterations

    % This is the Pscheduled converted to per unit on 100MVA base (as per given data)% organized in similar manner as 5busMVA function: [P2;P3;P4;P5;Q2;Q3;Q5]Psch=[-45;-40;45-20;-60;-15;-5;-10]/100;

    % Main NR iterationswhile(norm(c)>tol && iter

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    33/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 25

    Vp2 = V;Vp2(3,1) = V3*exp(j*(D3+h)); % x2 = delta3Vp3 = V;Vp3(4,1) = V4*exp(j*(D4+h)); % x3 = delta4Vp4 = V;Vp4(5,1) = V5*exp(j*(D5+h)); % x4 = delta5Vp5 = V;Vp5(2,1) = (V2+h)*exp(j*(D2)); % x5 = V2Vp6 = V;Vp6(3,1) = (V3+h)*exp(j*(D3)); % x6 = V3Vp7 = V;Vp7(5,1) = (V5+h)*exp(j*(D5)); % x7 = V5

    Sorig = c5busMVA(Ybus,V); % Original power vector 1:4 = real power, 5:7 = reactivepower

    % perturb powers and put them in matrixSpert = [c5busMVA(Ybus,Vp1) c5busMVA(Ybus,Vp2) c5busMVA(Ybus,Vp3) c5busMVA(Ybus,Vp4)c5busMVA(Ybus,Vp5) c5busMVA(Ybus,Vp6) c5busMVA(Ybus,Vp7)];

    % Setup an approximate Jacobian using the perturbed and unperturbed powersJ = [(Spert(:,1)-Sorig)/h (Spert(:,2)-Sorig)/h (Spert(:,3)-Sorig)/h (Spert(:,4)-Sorig)/h(Spert(:,5)-Sorig)/h (Spert(:,6)-Sorig)/h (Spert(:,7)-Sorig)/h];

    % Rhs of Newton Rapshon is delta_powersdelta_S = Psch-Sorig;

    % compute the correctioncorr = inv(J)*(delta_S);

    % update voltage using correction data:% corr = [newD2; newD3; newD4; newD5; newV2; newV3; newV5]

    Vnew = zeros(5,1);Vnew(1,1) = V(1,1);Vnew(2,1) = (V2+corr(5,1))*exp(j*(D2+corr(1,1)));Vnew(3,1) = (V3+corr(6,1))*exp(j*(D3+corr(2,1)));Vnew(4,1) = V4*exp(j*(D4+corr(3,1)));Vnew(5,1) = (V5+corr(7,1))*exp(j*(D5+corr(4,1)));

    % Filename: printTable_5bus.m% Description: uses results obtained in other simulations and displays% them is a neat little table (for standalone use, does not% affect GUI)% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    functionprintTable_5bus(report,lineflow)

    disp(' ENGI 0438 - 5 Bus Final Answers (buses 1 thru 5): ')disp('===============================================================================' )disp(' V(pu) Angle(rad) P Gen(MW) Q Gen(MVAR) P Load(MW) Q Load(MVAR)')disp('===============================================================================' )

    disp(report)disp('===============================================================================' )disp(' System Power Totals:')r1 = [sum(report(:,3)) sum(report(:,5)) sum(report(:,4)) sum(report(:,6))sum(report(:,3))-sum(report(:,5)) sum(report(:,4))-sum(report(:,6))];disp('========================================================================' )disp(' P Gen(MW) P Load(MW) Q Gen(MVAR) QLoad(MVAR) Loss(MW) Loss(MVAR)')disp(r1)disp('========================================================================' )disp(' Line Flow: ')disp('=========================================================================================')

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    34/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 26

    disp(' Bus 1 to Bus 2 Bus 1 to Bus 3 Bus 1 to Bus 4 Bus 1 toBus 5');disp(' MW MVAR MW MVAR MW MVAR MWMVAR');r1 = [real(lineflow(1,2)) imag(lineflow(1,2)) real(lineflow(1,3)) imag(lineflow(1,3))real(lineflow(1,4)) imag(lineflow(1,4)) real(lineflow(1,5)) imag(lineflow(1,5))];disp(r1);

    disp(' ----------------------');disp(' Bus 2 to Bus 1 Bus 2 to Bus 3 Bus 2 to Bus 4 Bus 2 toBus 5');disp(' MW MVAR MW MVAR MW MVAR MWMVAR');r1 = [real(lineflow(2,1)) imag(lineflow(2,1)) real(lineflow(2,3)) imag(lineflow(2,3))real(lineflow(2,4)) imag(lineflow(2,4)) real(lineflow(2,5)) imag(lineflow(2,5))];disp(r1);disp(' ----------------------');disp(' Bus 3 to Bus 1 Bus 3 to Bus 2 Bus 3 to Bus 4 Bus 3 toBus 5');disp(' MW MVAR MW MVAR MW MVAR MWMVAR');r1 = [real(lineflow(3,1)) imag(lineflow(3,1)) real(lineflow(3,2)) imag(lineflow(3,2))

    real(lineflow(3,4)) imag(lineflow(3,4)) real(lineflow(3,5)) imag(lineflow(3,5))];disp(r1);disp(' ----------------------');disp(' Bus 4 to Bus 1 Bus 4 to Bus 2 Bus 4 to Bus 3 Bus 4 toBus 5');disp(' MW MVAR MW MVAR MW MVAR MWMVAR');r1 = [real(lineflow(4,1)) imag(lineflow(4,1)) real(lineflow(4,2)) imag(lineflow(4,2))real(lineflow(4,3)) imag(lineflow(4,3)) real(lineflow(4,5)) imag(lineflow(4,5))];disp(r1);disp(' ----------------------');disp(' Bus 5 to Bus 1 Bus 5 to Bus 2 Bus 5 to Bus 3 Bus 5 toBus 4');disp(' MW MVAR MW MVAR MW MVAR MW

    MVAR');r1 = [real(lineflow(5,1)) imag(lineflow(5,1)) real(lineflow(5,2)) imag(lineflow(5,2))real(lineflow(5,3)) imag(lineflow(5,3)) real(lineflow(5,4)) imag(lineflow(5,4))];disp(r1);disp('===================================================================================

    ======');

    % Filename: removeLine.m% Description: uses case4_zbus and kron reduction algorithms to remove a% line by setting a parallel branch with negative impedance% between two buses% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    function[ybusNew] = removeLine(busj,busk)

    ybus = Y5bus();zbus = inv(ybus); % get original zbus from ybus

    z14 = 0.02 + j*0.06;z12 = 0.08 + j*0.24;z42 = 0.06 + j*0.18;z43 = 0.06 + j*0.18;z45 = 0.04 + j*0.12;z23 = 0.01 + j*0.03;

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    35/51

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    36/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 28

    % admittance values as per given data

    Y14 = 1/(0.02 + j*0.06); Ys14 = j*0.03;Y12 = 1/(0.08 + j*0.24); Ys12 = j*0.025;Y42 = 1/(0.06 + j*0.18); Ys42 = j*0.02;Y43 = 1/(0.06 + j*0.18); Ys43 = j*0.02;

    Y45 = 1/(0.04 + j*0.12); Ys45 = j*0.015;Y23 = 1/(0.01 + j*0.03); Ys23 = j*0.01;Y35 = 1/(0.08 + j*0.24); Ys35 = j*0.025;

    V1=V(1,1);V2=V(2,1);V3=V(3,1);V4=V(4,1);V5=V(5,1);

    % setup node voltages starting from 1, going to 5% voltages taken from newton raphson solution% cover any conceivable permutation possible

    Vn1 = [V1 V1 V1 V1 V1;V2 V2 V2 V2 V2;V3 V3 V3 V3 V3;

    V4 V4 V4 V4 V4;V5 V5 V5 V5 V5];

    Vn2 = [V1 V2 V3 V4 V5;V1 V2 V3 V4 V5;V1 V2 V3 V4 V5;V1 V2 V3 V4 V5;V1 V2 V3 V4 V5];

    % setup line shunt and series admittances

    LineAdm = [0 Y12 0 Y14 0;Y12 0 Y23 Y42 0;0 Y23 0 Y43 Y35;

    Y14 Y42 Y43 0 Y45;0 0 Y35 Y45 0];

    LineShunt = [0 Ys12 0 Ys14 0;Ys12 0 Ys23 Ys42 0;0 Ys23 0 Ys43 Ys35;Ys14 Ys42 Ys43 0 Ys45;0 0 Ys35 Ys45 0];

    % removed line admittances must be set to zero to assure no loadflow

    LineAdm(busj,busk) = 0;LineAdm(busk,busj) = 0;LineShunt(busj,busk) = 0;LineShunt(busk,busj) = 0;

    % Filename: Y5bus.m% Description: creates ybus using king of the hill principle% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    functionAdmMatrix = Y5bus()

    % Data from project handout (in same order as provided)

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    37/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 29

    Y14 = 1/(0.02 + j*0.06); Ys14 = j*0.03;Y12 = 1/(0.08 + j*0.24); Ys12 = j*0.025;Y42 = 1/(0.06 + j*0.18); Ys42 = j*0.02;Y43 = 1/(0.06 + j*0.18); Ys43 = j*0.02;Y45 = 1/(0.04 + j*0.12); Ys45 = j*0.015;Y23 = 1/(0.01 + j*0.03); Ys23 = j*0.01;

    Y35 = 1/(0.08 + j*0.24); Ys35 = j*0.025;

    % put in a matrix using king of the hill principle

    AdmMatrix = [Y14+Y12+Ys14+Ys12 -Y12 0 -Y14 0;-Y12 Y12+Y23+Y42+Ys12+Ys23+Ys42 -Y23 -Y42 0;0 -Y23 Y23+Y43+Y35+Ys23+Ys43+Ys35 -Y43 -Y35;-Y14 -Y42 -Y43 Y14+Y42+Y43+Y45+Ys14+Ys42+Ys43+Ys45 -Y45;0 0 -Y35 -Y45 Y35+Y45+Ys35+Ys45];

    % Filename: GUI.m% Description: GUI code for system interface

    % designed using MATLAB GUIDE,% varations using handles done by authors% Authors: Joey Mercier, Jonathan Evangelista, Maxime Veillette

    functionvarargout = GUI(varargin)% GUI MATLAB code for GUI.fig% GUI, by itself, creates a new GUI or raises the existing% singleton*.%% H = GUI returns the handle to a new GUI or the handle to% the existing singleton*.%% GUI('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in GUI.M with the given input arguments.%% GUI('Property','Value',...) creates a new GUI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before GUI_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to GUI_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES

    % Edit the above text to modify the response to help GUI

    % Last Modified by GUIDE v2.5 24-Feb-2013 15:44:06

    % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...

    'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @GUI_OpeningFcn, ...'gui_OutputFcn', @GUI_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);

    ifnargin && ischar(varargin{1})

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    38/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 30

    gui_State.gui_Callback = str2func(varargin{1});end

    ifnargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

    elsegui_mainfcn(gui_State, varargin{:});

    end% End initialization code - DO NOT EDIT

    % --- Executes just before GUI is made visible.functionGUI_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to GUI (see VARARGIN)axes(handles.diag) % set display pictureimshow('diagram.png') % load display picture% make various initial buttons/tables invisibleset(handles.gndBus, 'Visible', 'off');set(handles.busFVTable, 'Visible', 'off');set(handles.busFITable, 'Visible', 'off');set(handles.text6, 'Visible', 'off');set(handles.text7, 'Visible', 'off');set(handles.remBus1, 'Visible', 'off');set(handles.remBus2, 'Visible', 'off');set(handles.tglTran, 'Visible', 'off');set(handles.tranSel, 'Visible', 'off');% Choose default command line output for GUIhandles.output = hObject;

    % Update handles structure

    guidata(hObject, handles);

    % UIWAIT makes GUI wait for user response (see UIRESUME)% uiwait(handles.figure1);

    % --- Outputs from this function are returned to the command line.functionvarargout = GUI_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Get default command line output from handles structurevarargout{1} = handles.output;

    % --- Executes on button press in simButton.functionsimButton_Callback(hObject, eventdata, handles)% hObject handle to simButton (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)if(get(handles.normOp, 'Value') == 1) % if normal operation selected

    % run simulation scripts for normal operation and display data in% corresponding tables

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    39/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 31

    [report,lineflow] = report_5bus(Y5bus(),1,1);set(handles.reportTable, 'Data', report);r1 = [sum(report(:,3)) sum(report(:,5)) sum(report(:,4)) sum(report(:,6))

    sum(report(:,3))-sum(report(:,5)) sum(report(:,4))-sum(report(:,6))];r2 = zeros(5,10);r2(:,1:2:9) = [real(lineflow)]; % set P of lineflowr2(:,2:2:10) = [imag(lineflow)]; % set Q of lineflow

    set(handles.totTable, 'Data', r1);set(handles.flowTable, 'Data', r2);

    elseif(get(handles.busFault, 'Value') == 1)% if bus fault operation selectedVinit = NR5bus_driver(Y5bus()); % get voltages from Newton-Raphson% depending on which bus is to be grounded, perform the simulation with% the particular bus groundedif(get(handles.bus1Gnd, 'Value') == 1)

    [Vf,If] = gen_SymmBusFault(1,Vinit);elseif(get(handles.bus2Gnd, 'Value') == 1)

    [Vf,If] = gen_SymmBusFault(2,Vinit);elseif(get(handles.bus3Gnd, 'Value') == 1)

    [Vf,If] = gen_SymmBusFault(3,Vinit);elseif(get(handles.bus4Gnd, 'Value') == 1)

    [Vf,If] = gen_SymmBusFault(4,Vinit);elseif(get(handles.bus5Gnd, 'Value') == 1)

    [Vf,If] = gen_SymmBusFault(5,Vinit);end;% put all generated information in tablesr1 = [abs(If) angle(If)];set(handles.busFITable, 'Data', r1);r1 = [abs(Vf) angle(Vf)];set(handles.busFVTable, 'Data', r1);r1(:,2) = r1(:,2)*180/pi;r2 = zeros(5,6);r2(:,1:2) = r1;set(handles.reportTable, 'Data', r2);

    elseif(get(handles.remLine, 'Value') == 1)% if remove line selected% depending which buses are selected, perform corresponding simulations% with corresponding line removed from system (ie: faulted line)% the remaining system remains connected throughoutif(get(handles.tglTran, 'Value') == 0)

    if(get(handles.rem1Bus1, 'Value') == 1); % First bus is Bus 1if(get(handles.rem2Bus2, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(1,2),1,2);elseif(get(handles.rem2Bus4, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(1,4),1,4);end;

    elseif(get(handles.rem1Bus2, 'Value') == 1); % First bus is Bus 2

    if(get(handles.rem2Bus1, 'Value') == 1);[report,lineflow] = report_5bus(removeLine(2,1),2,1);elseif(get(handles.rem2Bus3, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(2,3),2,3);elseif(get(handles.rem2Bus4, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(2,4),2,4);end;

    elseif(get(handles.rem1Bus3, 'Value') == 1); % First bus is Bus 3if(get(handles.rem2Bus2, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(3,2),3,2);elseif(get(handles.rem2Bus4, 'Value') == 1);

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    40/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 32

    [report,lineflow] = report_5bus(removeLine(3,4),3,4);elseif(get(handles.rem2Bus5, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(3,5),3,5);end;

    elseif(get(handles.rem1Bus4, 'Value') == 1); % First bus is Bus 4if(get(handles.rem2Bus1, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(4,1),4,1);elseif(get(handles.rem2Bus2, 'Value') == 1);[report,lineflow] = report_5bus(removeLine(4,2),4,2);

    elseif(get(handles.rem2Bus3, 'Value') == 1);[report,lineflow] = report_5bus(removeLine(4,3),4,3);

    elseif(get(handles.rem2Bus5, 'Value') == 1);[report,lineflow] = report_5bus(removeLine(4,5),4,5);

    end;

    elseif(get(handles.rem1Bus5, 'Value') == 1); % First bus is Bus 5if(get(handles.rem2Bus3, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(5,3),5,3);elseif(get(handles.rem2Bus4, 'Value') == 1);

    [report,lineflow] = report_5bus(removeLine(5,4),5,4);end;

    end;% display data in tablesset(handles.reportTable, 'Data', report);r1 = [sum(report(:,3)) sum(report(:,5)) sum(report(:,4)) sum(report(:,6))

    sum(report(:,3))-sum(report(:,5)) sum(report(:,4))-sum(report(:,6))];r2 = zeros(5,10);r2(:,1:2:9) = [real(lineflow)]; % set P of lineflowr2(:,2:2:10) = [imag(lineflow)]; % set Q of lineflowset(handles.totTable, 'Data', r1);set(handles.flowTable, 'Data', r2);

    elseif(get(handles.faultFirstBus, 'Value') == 1) % if fault at first bus

    %% transient code (future work)%

    else% if fault at second bus%% transient code (future work)%

    end;end;

    end;

    % --- Executes when selected object is changed in uipanel2.

    functionuipanel2_SelectionChangeFcn(hObject, eventdata, handles)% hObject handle to the selected object in uipanel2% eventdata structure with the following fields (see UIBUTTONGROUP)% EventName: string 'SelectionChanged' (read only)% OldValue: handle of the previously selected object or empty if none was selected% NewValue: handle of the currently selected object% handles structure with handles and user data (see GUIDATA)

    % these changes in visibilty happen when different options are selected,% and all data in the tables are zeroed when operations are switched, to% prevent pre-simulation confusionif(get(handles.normOp, 'Value') == 1) % if normal operation is selected

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    41/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 33

    axes(handles.diag) % set display pictureimshow('diagram.png')set(handles.reportTable, 'Data', zeros(5,6));set(handles.totTable, 'Data', zeros(1,6));set(handles.flowTable, 'Data', zeros(5,10));

    end;if(get(handles.busFault, 'Value') == 1) % if bus fault is selected

    axes(handles.diag) % set display pictureimshow('b1gnd.png')set(handles.gndBus, 'Visible', 'on');set(handles.flowTable, 'Visible', 'off');set(handles.text5, 'Visible', 'off');set(handles.busFVTable, 'Visible', 'on');set(handles.busFITable, 'Visible', 'on');set(handles.text6, 'Visible', 'on');set(handles.text7, 'Visible', 'on');set(handles.reportTable, 'Data', zeros(5,6));set(handles.totTable, 'Data', zeros(1,6));set(handles.flowTable, 'Data', zeros(5,10));

    elseset(handles.gndBus, 'Visible', 'off');

    set(handles.busFVTable, 'Visible', 'off');set(handles.busFITable, 'Visible', 'off');set(handles.text6, 'Visible', 'off');set(handles.text7, 'Visible', 'off');set(handles.flowTable, 'Visible', 'on');set(handles.text5, 'Visible', 'on');

    end;if(get(handles.remLine, 'Value') == 1) % if remove line is selected

    axes(handles.diag) % set display pictureimshow('r12.png')set(handles.rem1Bus1, 'Value', 1);set(handles.rem2Bus2, 'Value', 1);set(handles.remBus1, 'Visible', 'on');set(handles.remBus2, 'Visible', 'on');

    set(handles.rem2Bus1, 'Visible', 'off');set(handles.rem2Bus2, 'Visible', 'on');set(handles.rem2Bus3, 'Visible', 'off');set(handles.rem2Bus4, 'Visible', 'on');set(handles.rem2Bus5, 'Visible', 'off');set(handles.tglTran, 'Visible', 'on');if(get(handles.tglTran, 'Value') == 1);

    set(handles.text5, 'String', 'Load Flow (MW, MVAR [transient state])');set(handles.tranSel, 'Visible', 'on');

    elseset(handles.text5, 'String', 'Load Flow (MW, MVAR [steady state])');

    end;set(handles.reportTable, 'Data', zeros(5,6));set(handles.totTable, 'Data', zeros(1,6));

    set(handles.flowTable, 'Data', zeros(5,10));else

    set(handles.remBus1, 'Visible', 'off');set(handles.remBus2, 'Visible', 'off');set(handles.tglTran, 'Visible', 'off');set(handles.tranSel, 'Visible', 'off');set(handles.text5, 'String', 'Load Flow (MW, MVAR)');

    end;

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    42/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 34

    % --- Executes when selected object is changed in gndBus.functiongndBus_SelectionChangeFcn(hObject, eventdata, handles)% hObject handle to the selected object in gndBus% eventdata structure with the following fields (see UIBUTTONGROUP)% EventName: string 'SelectionChanged' (read only)% OldValue: handle of the previously selected object or empty if none was selected% NewValue: handle of the currently selected object

    % handles structure with handles and user data (see GUIDATA)% assure the correct bus is grounded in the image according to the selected% busif(get(handles.bus1Gnd, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('b1gnd.png') % load display picture

    elseif(get(handles.bus2Gnd, 'Value') == 1)axes(handles.diag) % set display pictureimshow('b2gnd.png') % load display picture

    elseif(get(handles.bus3Gnd, 'Value') == 1)axes(handles.diag) % set display pictureimshow('b3gnd.png') % load display picture

    elseif(get(handles.bus4Gnd, 'Value') == 1)axes(handles.diag) % set display pictureimshow('b4gnd.png') % load display picture

    elseif(get(handles.bus5Gnd, 'Value') == 1)axes(handles.diag) % set display pictureimshow('b5gnd.png') % load display picture

    end;

    % --- Executes when selected object is changed in remBus1.functionremBus1_SelectionChangeFcn(hObject, eventdata, handles)

    % hObject handle to the selected object in remBus1% eventdata structure with the following fields (see UIBUTTONGROUP)% EventName: string 'SelectionChanged' (read only)% OldValue: handle of the previously selected object or empty if none was selected% NewValue: handle of the currently selected object% handles structure with handles and user data (see GUIDATA)

    % assure the correct line is removed in the image according to the selected% buses, and set buttons visible according to the bus connectivityif(get(handles.rem1Bus1, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r12.png') % load display pictureset(handles.rem2Bus2, 'Value', 1);set(handles.rem2Bus1, 'Visible', 'off');set(handles.rem2Bus2, 'Visible', 'on');set(handles.rem2Bus3, 'Visible', 'off');set(handles.rem2Bus4, 'Visible', 'on');set(handles.rem2Bus5, 'Visible', 'off');

    elseif(get(handles.rem1Bus2, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r12.png') % load display pictureset(handles.rem2Bus1, 'Value', 1);set(handles.rem2Bus1, 'Visible', 'on');set(handles.rem2Bus2, 'Visible', 'off');

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    43/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 35

    set(handles.rem2Bus3, 'Visible', 'on');set(handles.rem2Bus4, 'Visible', 'on');set(handles.rem2Bus5, 'Visible', 'off');

    elseif(get(handles.rem1Bus3, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r23.png') % load display picture

    set(handles.rem2Bus2, 'Value', 1);set(handles.rem2Bus1, 'Visible', 'off');set(handles.rem2Bus2, 'Visible', 'on');set(handles.rem2Bus3, 'Visible', 'off');set(handles.rem2Bus4, 'Visible', 'on');set(handles.rem2Bus5, 'Visible', 'on');

    elseif(get(handles.rem1Bus4, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r14.png') % load display pictureset(handles.rem2Bus1, 'Value', 1);set(handles.rem2Bus1, 'Visible', 'on');set(handles.rem2Bus2, 'Visible', 'on');set(handles.rem2Bus3, 'Visible', 'on');set(handles.rem2Bus4, 'Visible', 'off');set(handles.rem2Bus5, 'Visible', 'on');

    elseif(get(handles.rem1Bus5, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r35.png') % load display pictureset(handles.rem2Bus3, 'Value', 1);set(handles.rem2Bus1, 'Visible', 'off');set(handles.rem2Bus2, 'Visible', 'off');set(handles.rem2Bus3, 'Visible', 'on');set(handles.rem2Bus4, 'Visible', 'on');set(handles.rem2Bus5, 'Visible', 'off');

    end;

    % --- Executes when selected object is changed in remBus2.functionremBus2_SelectionChangeFcn(hObject, eventdata, handles)% hObject handle to the selected object in remBus2% eventdata structure with the following fields (see UIBUTTONGROUP)% EventName: string 'SelectionChanged' (read only)% OldValue: handle of the previously selected object or empty if none was selected% NewValue: handle of the currently selected object% handles structure with handles and user data (see GUIDATA)

    % assure correct image is displayedif(get(handles.rem2Bus1, 'Value') == 1)

    if(get(handles.rem1Bus2, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r12.png') % load display picture

    elseif(get(handles.rem1Bus4, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r14.png') % load display picture

    end;elseif(get(handles.rem2Bus2, 'Value') == 1)

    if(get(handles.rem1Bus1, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r12.png') % load display picture

    elseif(get(handles.rem1Bus3, 'Value') == 1)axes(handles.diag) % set display picture

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    44/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 36

    imshow('r23.png') % load display pictureelseif(get(handles.rem1Bus4, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r24.png') % load display picture

    end;elseif(get(handles.rem2Bus3, 'Value') == 1)

    if(get(handles.rem1Bus2, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r23.png') % load display pictureelseif(get(handles.rem1Bus4, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r34.png') % load display picture

    elseif(get(handles.rem1Bus5, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r35.png') % load display picture

    end;elseif(get(handles.rem2Bus4, 'Value') == 1)

    if(get(handles.rem1Bus1, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r14.png') % load display picture

    elseif(get(handles.rem1Bus2, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r24.png') % load display pictureelseif(get(handles.rem1Bus3, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r34.png') % load display picture

    elseif(get(handles.rem1Bus5, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r45.png') % load display picture

    end;elseif(get(handles.rem2Bus5, 'Value') == 1)

    if(get(handles.rem1Bus3, 'Value') == 1)axes(handles.diag) % set display pictureimshow('r35.png') % load display picture

    elseif(get(handles.rem1Bus4, 'Value') == 1)

    axes(handles.diag) % set display pictureimshow('r45.png') % load display pictureend;

    end;

    % --- Executes on button press in tglTran.functiontglTran_Callback(hObject, eventdata, handles)% hObject handle to tglTran (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)if(get(handles.tglTran, 'Value') == 0)% if steady state analysis selected

    set(handles.tglTran, 'String', 'Steady State Analysis');set(handles.text5, 'String', 'Load Flow (MW, MVAR [steady state])');set(handles.tranSel, 'Visible', 'off');set(handles.flowTable, 'Data', zeros(5,10));

    elseset(handles.tglTran, 'String', 'Transient Analysis'); % if transient selectedset(handles.text5, 'String', 'Load Flow (MW, MVAR [transient state])');set(handles.tranSel, 'Visible', 'on');set(handles.flowTable, 'Data', zeros(5,10));

    end;

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    45/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix A MATLAB/Octave Code ! 37

    % --- Executes on button press in saveData.functionsaveData_Callback(hObject, eventdata, handles)% hObject handle to saveData (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)prompt = {'Enter Filename: '};dlg_title = 'Save Data...';

    num_lines = 1;def = {'FiveBusData'};answer = inputdlg(prompt,dlg_title,num_lines,def); % get filename from userif(isempty(answer)) % if user presses cancel or inputs nothing

    return; % exit functionelse

    if(get(handles.busFault, 'Value') == 1) % only save pertinent infobusFaultVoltage = get(handles.busFVTable, 'Data'); % get databusFaultCurrent = get(handles.busFITable, 'Data'); % get datasave(answer{1}, 'busFaultVoltage', 'busFaultCurrent'); % save to .mat file

    elsesystemResults = get(handles.reportTable, 'Data'); % get datasystemTotals = get(handles.totTable, 'Data'); % get dataloadFlow = get(handles.flowTable, 'Data'); % get data

    save(answer{1}, 'systemResults', 'systemTotals', 'loadFlow'); % save to .mat fileend;end;clear; % clear all

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    46/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix B Solving 5-bus System on Mobile Device Using Octave ! 38

    Appendix B Solving 5-Bus System on Mobile Device Using Octave

    As mentioned briefly in the introduction, Octave is very versatile due to its cross-platform portability. Since the

    codes where written in MATLAB/Octave, it is possible to solve the 5-bus system on a mobile device2. A simple

    user-interactive script was written to simplify the process for normal operation and remove line. The following

    are the results of diaries created using Octave on an Android Smartphone to solve for normal operation and the

    removal of the line between bus 1 and 4:

    octave:7> pwdans = /storage/sdcard0/Octaveoctave:8> startupFxn();

    Hello, Octave is at your disposal!!Root Folder set to:ans = /storage/sdcard0/OctaveStartup Menu:

    [ 1] Run 5 Bus Scripts[ 2] Just use Octave

    pick a number, any number: 1

    5-Bus Analysis:

    [ 1] Normal Operation[ 2] Remove a Line

    [ 3] Exit

    pick a number, any number: 1iter = 1Voltages =

    1.06000 0.00000

    1.02648 -4.888531.02573 -5.218771.04700 -2.577751.01986 -6.01142

    iter = 2

    Voltages =

    1.06000 0.000001.02388 -4.883531.02323 -5.207901.04700 -2.651391.01752 -6.00850

    2Even if this was not a requirement, many applications are migrating to the mobile scene, which is why this

    was done

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    47/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix B Solving 5-bus System on Mobile Device Using Octave ! 39

    iter = 3Voltages =

    1.06000 0.000001.02387 -4.883551.02323 -5.20790

    1.04700 -2.651581.01751 -6.00854

    iter = 4Voltages =

    1.06000 0.000001.02387 -4.883551.02323 -5.207901.04700 -2.651581.01751 -6.00854

    ENGI 0438 - 5 Bus Final Answers (buses 1 thru 5):===============================================================================

    V(pu) Angle(rad) P Gen(MW) Q Gen(MVAR) P Load(MW) Q Load(MVAR)===============================================================================

    1.06000 0.00000 124.42560 -5.10799 0.00000 0.00000

    1.02387 -4.88355 0.00000 0.00000 45.00000 15.000001.02323 -5.20790 0.00000 0.00000 40.00000 5.000001.04700 -2.65158 45.00000 -2.77827 20.00000 -20.000001.01751 -6.00854 0.00000 0.00000 60.00000 10.00000

    ===============================================================================System Power Totals:

    ========================================================================

    P Gen(MW) P Load(MW) Q Gen(MVAR) QLoad(MVAR) Loss(MW) Loss(MVAR)169.4256 165.0000 -7.8863 10.0000 4.4256 -17.8863

    ========================================================================

    Line Flow:=========================================================================================Bus 1 to Bus 2 Bus 1 to Bus 3 Bus 1 to Bus 4 Bus 1 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    39.92719 1.48185 0.00000 0.00000 84.49841 -6.58984 0.00000 0.00000----------------------

    Bus 2 to Bus 1 Bus 2 to Bus 3 Bus 2 to Bus 4 Bus 2 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    -38.77902 -3.46713 18.46534 -4.95901 -24.68632 -6.57385 0.00000 0.00000----------------------

    Bus 3 to Bus 1 Bus 3 to Bus 2 Bus 3 to Bus 4 Bus 3 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    0.00000 0.00000 -18.43136 2.96567 -27.76769 -5.75992 6.19905 -2.20575----------------------

    Bus 4 to Bus 1 Bus 4 to Bus 2 Bus 4 to Bus 3 Bus 4 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    -83.2257 3.7487 25.0466 3.3656 28.2172 2.8222 54.9618 7.2852

    ----------------------Bus 5 to Bus 1 Bus 5 to Bus 2 Bus 5 to Bus 3 Bus 5 to Bus 4MW MVAR MW MVAR MW MVAR MW MVAR

    0.00000 0.00000 0.00000 0.00000 -6.16955 -2.91159 -53.83045 -7.08841=========================================================================================octave:9> diary off

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    48/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix B Solving 5-bus System on Mobile Device Using Octave ! 40

    octave:3> startupFxn();

    Hello, Octave is at your disposal!!Root Folder set to:ans = /storage/sdcard0/OctaveStartup Menu:

    [ 1] Run 5 Bus Scripts[ 2] Just use Octave

    pick a number, any number: 1

    5-Bus Analysis:

    [ 1] Normal Operation[ 2] Remove a Line[ 3] Exit

    pick a number, any number: 2

    Which Line to remove?

    [ 1] 1 - 2[ 2] 1 - 4

    [ 3] 2 - 3[ 4] 2 - 4[ 5] 3 - 4[ 6] 3 - 5[ 7] 4 - 5

    pick a number, any number: 2

    Line Between Buses 1 and 4 Removed...iter = 1Voltages =

    1.06000 0.000001.02647 -16.665821.02571 -17.840451.04700 -18.458441.01986 -20.83877

    iter = 2Voltages =

    1.06000 0.000001.01122 -17.686061.01288 -18.901851.04700 -19.77142

    1.01418 -22.02148

    iter = 3

    Voltages =

    1.06000 0.000001.01089 -17.731171.01260 -18.950031.04700 -19.82866

    1.01407 -22.07648

    iter = 4

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    49/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix B Solving 5-bus System on Mobile Device Using Octave ! 41

    Voltages =

    1.06000 0.000001.01089 -17.731221.01260 -18.950081.04700 -19.828721.01407 -22.07654

    iter = 5Voltages =

    1.06000 0.00000

    1.01089 -17.731221.01260 -18.950081.04700 -19.828721.01407 -22.07654

    ENGI 0438 - 5 Bus Final Answers (buses 1 thru 5):

    ===============================================================================V(pu) Angle(rad) P Gen(MW) Q Gen(MVAR) P Load(MW) Q Load(MVAR)

    ===============================================================================

    1.06000 0.00000 135.24773 -8.36134 0.00000 0.000001.01089 -17.73122 0.00000 0.00000 45.00000 15.000001.01260 -18.95008 0.00000 0.00000 40.00000 5.00000

    1.04700 -19.82872 45.00000 33.23364 20.00000 -20.000001.01407 -22.07654 0.00000 0.00000 60.00000 10.00000

    ===============================================================================System Power Totals:

    ========================================================================P Gen(MW) P Load(MW) Q Gen(MVAR) QLoad(MVAR) Loss(MW) Loss(MVAR)180.2477 165.0000 24.8723 10.0000 15.2477 14.8723

    ========================================================================Line Flow:

    =========================================================================================

    Bus 1 to Bus 2 Bus 1 to Bus 3 Bus 1 to Bus 4 Bus 1 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR135.24773 -4.99054 0.00000 0.00000 0.00000 0.00000 0.00000

    0.00000----------------------

    Bus 2 to Bus 1 Bus 2 to Bus 3 Bus 2 to Bus 4 Bus 2 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    -122.22053 38.70842 63.81787 -27.30989 13.40266 -26.39853 0.000000.00000

    ----------------------Bus 3 to Bus 1 Bus 3 to Bus 2 Bus 3 to Bus 4 Bus 3 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    0.00000 0.00000 -63.35169 26.66114 2.34484 -22.11251 21.00686 -9.54864----------------------

    Bus 4 to Bus 1 Bus 4 to Bus 2 Bus 4 to Bus 3 Bus 4 to Bus 5MW MVAR MW MVAR MW MVAR MW MVAR

    0.00000 0.00000 -12.94892 23.52354 -2.10611 18.58553 40.05503 14.41319

    ----------------------Bus 5 to Bus 1 Bus 5 to Bus 2 Bus 5 to Bus 3 Bus 5 to Bus 4MW MVAR MW MVAR MW MVAR MW MVAR

    0.00000 0.00000 0.00000 0.00000 -20.62449 5.56145 -39.37551 -15.56145=========================================================================================

    octave:4> diary off

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    50/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Appendix B Solving 5-bus System on Mobile Device Using Octave ! 42

    The code used to generate the automated user-interactive script and solutions (startupFxn()) is included

    below:

    % startupFxn.m% used to automate 5-bus solving on octave (can be used on mobile devices)

    % author: Joey Mercier

    function startupFxn()

    disp("");disp("Hello, Octave is at your disposal!!"); % display welcome message

    disp("Root Folder set to:"); % display mobile directory usedpwd

    sel = menu('Startup Menu:', 'Run 5 Bus Scripts', 'Just use Octave');

    if (sel == 1)disp("");sel2 = menu('5-Bus Analysis:', 'Normal Operation', 'Remove a Line', 'Exit');

    if (sel2 == 1)report_5bus(Y5bus(),1,1); % normal operationelseif (sel2 == 2)

    disp("");sel3 = menu('Which Line to remove?', '1 - 2', '1 - 4', '2 - 3', '2 - 4', '3 -

    4', '3 - 5', '4 - 5');switch (sel3)case 1

    disp("Line Between Buses 1 and 2 Removed...");report_5bus(removeLine(1,2),1,2) % remove line between 1 and 2

    case 2disp("Line Between Buses 1 and 4 Removed...");

    report_5bus(removeLine(1,4),1,4) % remove line between 1 and 4case 3

    disp("Line Between Buses 2 and 3 Removed...");report_5bus(removeLine(2,3),2,3) % remove line between 2 and 3

    case 4disp("Line Between Buses 2 and 4 Removed...");report_5bus(removeLine(2,4),2,4) % remove line between 2 and 4

    case 5disp("Line Between Buses 3 and 4 Removed...");report_5bus(removeLine(3,4),3,4) % remove line between 3 and 4

    case 6disp("Line Between Buses 3 and 5 Removed...");report_5bus(removeLine(3,5),3,5) % remove line between 3 and 5

    case 7disp("Line Between Buses 4 and 5 Removed...");report_5bus(removeLine(5,4),5,4) % remove line between 4 and 5

    otherwisedisp("incorrect selection...");return;

    endswitchelseif (sel2 == 3)

    return;endif

    elsereturn;

    endif

  • 8/12/2019 The IEEE Five Bus Power System Analysis

    51/51

    ENGI-0438-WA Electrical Engineering Dept. Lakehead University

    Figure 1 3: Screen Captures of 5 -bus Code Running in Octave on an Android Powe red Mobile Devi ce