Guo Rong
Guo Rong
Guo Rong
by
Rong Guo
MASTER OF SCIENCE
University of Manitoba
Winnipeg, Manitoba
Transient stability studies are required to be carried out for an efficient and secure operation of
power systems. However, due to the limitations of computer memory and processing speed,
large scale interconnected power system is difficult and uneconomical. Hence, the transient
stability of large power system is generally studied by dividing the system into study and
external areas, and the external areas are replaced with a dynamic equivalent circuit to reduce
the calculation time. The research on dynamic equivalent circuit is still worth exploring.
Therefore, this thesis attempts to propose an approach to obtain a dynamic equivalent circuit
generators to boundary buses of a static equivalent circuit. The static equivalent circuit of the
external system can be constructed utilizing the static network reduction features available in
PSS/E. Coherent generator groups within the external system are identified using the non-linear
time domain simulation combined with Prony analysis both available in PSS/E. If a complete
set of dynamic parameters are available, the parameters of equivalent models are calculated by
aggregation methods. If not, the optimization techniques based on minimizing the cost function
are utilized to determine the model parameters of equivalent machines, where the cost function
is defined as the sum of squares of the difference between equivalent system transient voltage
results and the full system transient voltage results. The proposed method is validated with the
ii
New York and New England IEEE 68-bus system. The simulation has shown that the developed
equivalent system is good at mimicking the dynamic features of the original system.
iii
Acknowledgements
First and foremost, I would like to express my sincere gratitude to my academic advisor Prof.
U. D. Annakkage for his support, guidance, advice and patience throughout my graduate studies.
As my supervisor, what he has taught me not only academic and professional knowledge but
also attitude to life. It is a great privilege to study and work under his supervision.
I would like to thank Mitacs Accelerate and Manitoba HVDC Research Centre for
financially supporting my research and for offering the internship opportunity, which provided
me a valuable work experience. A special thanks to Dr. Dharshana Muthumuni for his
I like to thank Prof. Aniruddha Gole, Prof. Shaahin Filizadeh, Prof. Athula Rajapakse and
Prof. Behzad Kordi for the invaluable knowledge they shared during the courses.
I would like to thank my research team for sharing experience, interesting discussions we
had and their encouragement. It is my pleasure to have you all as my colleagues and friends. I
would like to thank all my friends in Winnipeg for their support during these years.
Last but not least, my deepest gratitude goes to my loving parents, for their unconditional
love, support and understanding. Without them, I would not have been the person that I am
today.
iv
Dedication
v
Table of Contents
Abstract.............................................................................................................................ii
Acknowledgements ......................................................................................................... iv
Dedication ......................................................................................................................... v
List of Tables.................................................................................................................... xi
vi
3.1.1 Non-linear Time Domain Simulation .................................................... 21
vii
4.3 Summary ....................................................................................................... 57
References ....................................................................................................................... 63
viii
List of Figures
Figure 2-5. Redrawn single-line diagram of reduced IEEE 68-bus system ............................. 15
Figure 3-1. Swing curves for all generators in external system ............................................... 23
Figure 3-4. Swing curves for generators 14, 15, and 16 .......................................................... 25
Figure 4-7. Single-line diagram of reduced 68-bus system with external system represented by
ix
dynamic equivalent circuit ............................................................................................... 51
Figure 4-8. Best five cases obtained by Monte Carlo method ................................................. 52
Figure 4-9. Worst five cases obtained by Monte Carlo method ............................................... 53
Figure 4-10. Comparison between the good starting scenario and its corresponding optimal
Figure 4-11. Comparison between the bad starting scenario and its corresponding optimal
Figure 4-12. Comparison between the good starting scenario and its corresponding optimal
Figure 4-13. Comparison between the bad starting scenario and its corresponding optimal
x
List of Tables
Table 2-2. Comparison between Original and Static Equivalent System ................................ 15
Table 3-1. Results from Prony Analysis of Fig.3-5 Results – 5 to 8 sec Tie Window ............. 27
xi
Chapter 1 Introduction
In this chapter, the background and motivation of this research are discussed. The research
objectives and the outline of the thesis are listed at the end of this chapter.
Transient stability studies are required to be carried out by the utilities for successful
power systems [1]. The complete power system model for transient stability analysis can
generation stations which are coupled by the algebraic equations describing the
transmission network and loads [2]. With the increasing scale of power systems, handling
a complete set of differential and algebraic equations that describe the entire
interconnected system becomes difficult and uneconomical due to its huge computation
burden. Therefore, it is necessary to divide the interconnected power system into a study
system and one or more external systems. In transient studies, the study system is of
specific interest and represented by a detailed model. In order to investigate the influence
equivalent circuit for the external system, which can be achieved by reducing the number
of generators and network nodes in the external system. The development of dynamic
equivalent circuits has existed for decades, and there are three main approaches reported
1
in literature:
1. Model methods: describe the external system by an approximate linear model [3]-
[5].
2. Coherency methods: identify coherent groups of generators and then replace the
Due to the fact that the linear state equations of the equivalent model cannot reflect
the characteristics of real physical power system components, the dynamic equivalent
circuit generated by the Model methods cannot be directly used for transient stability
methods can be directly used for transient stability studies. However, the Coherency
methods are proposed on the condition that the structure and parameters of the external
system are available, which cannot always be satisfied, especially the dynamic parameters
of the generators.
circuit for external power system. Specifically, there are three motivations that are taken
into account. First, to improve the accuracy of dynamic equivalent circuits, the simulation
2
based method is employed to reduce the errors resulted by coherency identification and
aggregation methods. Second, when the parameters of external generators are not
available, the simulation based method can be applied to this case to determine equivalent
a time-consuming task, this thesis thus provides a much easier way to do this using
The objective of this research is to develop a dynamic equivalent circuit to replace the
external system, which is based on combining the simulation based method with the
coherency method. In detail, the proposed scheme can be achieved following the steps
given below.
• Identify coherency among generators in the external system and aggregate the
• Split the equivalent active power and reactive power in the static equivalent circuit
3
• Tune basic parameters of the fictitious equivalent generator based on optimization
algorithms so that the voltage recovery of the dynamic equivalent system can
• Evaluate the proposed methods with New York and New England IEEE 68-bus
system.
Chapter 2 introduces how to generate a static equivalent circuit for the external
system in software package PSS/E, which is validated with New York and New England
Chapter 3 presents the non-linear time domain simulation and Prony analysis that
are available in PSS/E to identify coherency among generators. After the coherent
generators are identified, Zhukov’s [15],[16] and DYNEQU’s [26] methods for
generator and exciter aggregation of the IEEE 68-bus system are provided.
mathematical model to describe this problem and how to realize this in Python. Monte
4
Carlo, Nelder-Mead and Powell optimization algorithms are used to find optimal
parameters via the fitting process. Moreover, the proposed approach is validated with
5
Chapter 2 Developing a Static
Equivalent Circuit for External System
In this chapter, the procedure of generating a static equivalent circuit to replace the
external system is presented, which is based on the commercially available power system
simulation software PSS/E. A static equivalent circuit for external system is constructed
Buses
A common practical approach to handle a large scale power system is to split it into two
subsystems: the internal system and external systems. The internal system is also known
as the study area in which transient studies are performed. Any system outside the internal
system is known as external system. To generate a static equivalent circuit for the external
system, the internal system remains unchanged while the external system is eliminated
by static equivalent techniques. Boundary buses refer to those buses from which branches
6
connecting internal and external areas, which are required to be retained during the
equivalence process. The relation among internal, external, and boundary buses are
PSS/E uses bus codes 1 to 7 to distinguish different types of buses [4]. This is briefly
described in Table 2-1. Bus codes 1, 2, 3, and 4 are normal bus type codes, referring to
7
load bus, generator bus, swing bus, and off-line bus, respectively. Type codes 5, 6, 7 are
special bus type codes only used for the equivalent construction. Bus type code 5 is
assigned to the load bus, which is needed to be retained during the equivalencing process.
changing bus type code 2 to 6. Bus type code 7 is used to preserve the slack bus that is
not deleted by equivalencing. All bus type codes can be obtained and changed by
accessing the Bus tab. When the equivalence process is complete, all special type codes
Type 4 Inactive
bus
Before reducing the network, the generation netting activity (NETG/GNET) [14] is used
8
generators to be replaced by NETG/GNET may be specified by the area, owner, zone,
base kV, and bus number options. Activity NETG/GNET processes all selected generators
and swing buses (type code 2 or 3, respectively) except those designated as retained
generators indicated by type codes 6 or 7. The following steps are involved in this netting
process.
In short, activity NETG/GNET deletes the generation at a single bus with no other
effects on the system by changing bus type code to 1. This bus will be further eliminated
power system loads, the equivalent loads are assigned the identifier 99.
reduction [14]-[17]. Static reduction involves eliminating the external buses and branches
to reduce the scale and complexity of the external system, which can be achieved by
employing the Gaussian elimination method to reduce the admittance matrix of the
9
external system. The admittance matrix of the external system is given by
𝐼 𝑌 𝑌𝑅𝐷 𝑉𝑅
[ 𝑅 ] = [ 𝑅𝑅 ][ ] (2. 1)
𝐼𝐷 𝑌𝐷𝑅 𝑌𝐷𝐷 𝑉𝐷
where the subscripts 𝑅 and 𝐷 denote nodes in the external system to be retained and
deleted, respectively. Hence, 𝐼𝑅 and 𝑉𝑅 represent node current and voltage at the nodes to
be retained, and 𝐼𝐷 and 𝑉𝐷 are node current and voltage at the nodes to be deleted.
The desired form of an equivalent circuit only contains 𝐼𝑅 and 𝑉𝑅 , with variables 𝐼𝐷
and 𝑉𝐷 assumed to be linearly dependent on variables 𝐼𝑅 and 𝑉𝑅 . The second row of (2.1)
is rearranged as:
−1 (𝐼
𝑉𝐷 = 𝑌𝐷𝐷 𝐷 − 𝑌𝐷𝑅 𝑉𝑅 ) (2. 2)
Substituting (2.2) into the first row of (2.1), the current equation of 𝐼𝑅 can be written
as
−1 −1 (2. 3)
𝐼𝑅 = (𝑌𝑅𝑅 − 𝑌𝑅𝐷 𝑌𝐷𝐷 𝑌𝐷𝑅 )𝑉𝑅 + 𝑌𝑅𝐷 𝑌𝐷𝐷 𝐼𝐷
Due to the fact that all boundary buses are retained [18], the first term of (3) can be
regarded as new equivalent transmission lines between the boundary buses and static
shunts connecting the boundary buses. The second term represents a set of equivalent
currents injected at boundary buses. These equivalent currents reproduce the effect of
load currents at the deleted nodes, which can be transformed to equivalent constant real
and reactive power loads at boundary buses. The static equivalent circuit is shown in
Figure 2-2.
10
Figure 2-2. Static equivalent circuit of external system
A static equivalent circuit obtained by the method discussed above can be implemented
by activity EEQV in PSS/E [14]. This activity starts with a solved power flow model
containing external buses and boundary buses, and leaves the resulting equivalent circuit
in the working file. Activity EEQV effectively accomplishes the following tasks of
The equivalent circuit generated by activity EEQV represents the original network
model with a reduced network model in the working file consisting of a unequivalenced
internal system and an equivalenced external system (see Figure 2-3). In the equivalence
process, activity EEQV performs all mathematical operations involved in the admittance
matrix reduction automatically. All type 1 buses in the external system are eliminated,
whereas boundary buses of the external system are automatically retained. Buses that are
11
indicated by type code 4 are not included in the equivalent circuit so that the relevant
computation can be ignored. If the bus type code is 5, 6, or 7, activity EEQV will not
delete it but change the type code back to 1, 2, or 3, respectively. When activity EEQV
introduces equivalent branches, loads, and bus shunts to retained boundary buses, these
External
System
Before Use
Study of EEQV
System
Equivalent
of External System
After Use
Study of EEQV
System
Consider the IEEE 68-bus system shown in Figure 2-4, which is a reduced order
12
equivalent of the inter-connected New England test system (NETS) and New York power
system (NYPS) [19]. This system contains five areas shown to be bounded by thin dashed
lines in Figure 2-4. Now assume that Area-1 is interested in carrying out security analysis,
while the remaining portion, including Area-2, 3, 4, 5, can be regarded as the external
area. As can be seen from Figure 2-4, thick dashed lines separate the 68-bus system into
entirely retained. Subsystem 1 that will be replaced by its equivalent network has two
boundary buses that connect the internal system through six tie lines, as shown in Figure
2-4. It is expected that only the boundary buses 53 and 61 are retained as the result of
creating an equivalent circuit of the external area, and all of other buses will be removed
in Subsystem 1.
13
Since there are no other boundary buses (except buses 53 and 61) required to be
retained after the equivalence process, there is no need to change any bus type codes. The
generation netting with loads was implemented in Subsystem 1. Generators 10-16 in the
external system were replaced by corresponding negative loads at this stage, and all bus
NETG/GNET.
Subsequently, the network reduction was performed in the external system. After
building an electrical equivalent circuit of the external system, the redrawn single line
diagram of the IEEE 68-bus system with new branches, loads, and shunt are shown in
Figure 2-5. As compared to Figure 2-4, it is apparent that there are some changes in
topology due to the effect of network reduction. Table 2-2 presents a comparison between
the original system and the reduced system. It is seen that Area 2, 3, 4, 5 were removed
from the original system, the total number of buses was reduced to 38, and the number of
branches decreased from 69 to 38. The equivalence process removed all generators and
transformers in the external system. The boundary buses of the external system were
retained so that loads at boundary buses 53 and 61 were retained in the reduced system.
There were one equivalent fixed shunt and one equivalent load attached to boundary buses
53 and 61 respectively in the external area, each with a circuit identifier of 99.
14
subsystem 2 subsystem 1
NETS
G3
G2
G7 03
G5 62 02
07 59
63
05
23 G4 65 58 60
20
04 64
G6 19 66 57
06 67
56
68
22 52
21 37 61
55
27
24
G9
09 28
53
29 26 25 54
08 01
G8 G1
AREA 1
Areas 5 1
Buses 68 38
Branches 69 38
Total generators 16 9
Total transformers 19 11
Total loads 36 22
Fixed shunts 0 2
15
To validate the effectiveness of the network equivalence scheme used in this chapter,
bus voltages and power flow results of the original system and the reduced system are
compared as below. It is seen from Table 2-3, the voltage values and angles at retained
buses have no change before and after static equivalencing. Table 2-4 illustrates that the
active and reactive power through retained lines in the equivalent circuit are the same as
those in the original system. For simplicity, only few bus voltages and power flows are
16
Table 2-4. Comparison of Power Flows at Retained Lines
Fault level is another critical metric for evaluation after network reduction. Fault
level is also known as short circuit capacity, which is used to measure the ability of an
equipment or system to sustain under the worst short circuit condition. There are four
main types of short circuit faults: 1) single line to earth; 2) line to line; 3) line to line to
ground; and 4) three phase. Among these types, a three phase fault leads to the maximum
fault current. The fault level of the bus in power system is defined as the product of the
pre-fault voltage and the fault current of the bus. As the voltage at a bus prior to fault is
close to nominal value 1 p.u., the maximum short circuit current is used to describe the
fault level, which is the magnitude of three phase fault current [20]. Three phase fault
ASCC to both original and static equivalent systems, the fault levels at retained buses
17
before and after static equivalencing are compared, as shown in Table 2-5. It can be seen
that the static equivalent model of the external system resulted in reduced fault levels at
the buses in the internal subsystem as expected. Moreover, the fault levels can be
the Chapter 4.
1 74.4 69.53
2 45.11 42.2
3 48.25 45.77
4 57.49 57.01
5 38.84 38.67
6 54.45 53.93
7 47.13 46.88
8 46.5 44.51
9 37.58 37.1
19 62.18 60.91
20 42.98 42.57
21 58.12 56.14
22 61.47 60.13
23 57.71 56.56
24 64.15 60.89
18
25 70.16 60.92
26 51.44 47.65
27 53.74 49.11
28 30 29.26
29 34.85 34.06
37 75.22 67.83
52 64.94 58.06
53 97.6 45.17
54 94.46 72.61
55 75.07 62.94
56 70.28 57.79
57 76.23 57.83
58 77.46 59.19
59 66.78 49.07
60 73.95 50.57
61 119.37 41.86
62 65.37 55.63
63 65.81 54.77
64 27.54 25.63
65 61.96 53.28
66 66.08 56.83
67 63.21 58.39
68 86.19 79.61
19
2.6 Summary
This chapter presented how to develop a static equivalent circuit for the external system
by using commercially available power system simulation software PSS/E, and New
England & New York 68-bus system was used to demonstrate the effectiveness of the
proposed scheme.
First, the power system was first divided into a study area and an external area. The
study area was then kept unchanged, and then activity NETG/GNET is applied in the
external system to net the generation with load. Second, activity EEQV was used to
To validate the performance of the static equivalent circuit, bus voltages, power
transfer and faults levels of the reduced system were compared with that of the original
system. The comparison results have shown that the static equivalent circuit developed
20
Chapter 3 Coherency Identification,
Generators and Exciters Aggregation
Previous chapter presented how to reduce the scale and complexity of external system in
PSS/E. However, the generated static equivalent circuit cannot reflect the dynamic
synchronous generators in the external area while retaining their influence on the internal
area, which can be achieved by aggregation of coherent generators. This thesis determines
the coherent generators using non-linear time domain simulation, making use of the great
identifying coherent generators, generators and their exciters in each coherent group are
group.
Section 3.1.1 introduces how to use non-linear time domain simulation to identify
that is carried out in the IEEE 68-bus system using the non-linear time domain simulation.
Coherent generators are identified by means of non-linear time domain simulation. The
21
coherency identification technique is based on the comparison of time domain responses
when the power system is disturbed. In this method, a three phase fault is applied in the
study area and the rotor angles of generators in the external system are compared.
Generators are defined as coherent if relative differences between their rotor angles
remain constant within a specified tolerance over a certain period of time following a
where ∆𝜃𝑖 (𝑡) = 𝜃𝑖 (𝑡) − 𝜃𝑖 (0) and ∆𝜃𝑗 (𝑡) = 𝜃𝑗 (𝑡) − 𝜃𝑗 (0) are the angular deviations at
time instant 𝑡 for generator 𝑖 and 𝑗 . The absolute difference of rotor angles deviation
between two coherent generators less than a specified tolerance 𝜉 for the entire simulation.
In this research, dynamic responses of generators to the fault are simulated by PSS/E
to identify coherent generators. Time domain responses of generators in the external area
are monitored, and those generators with rotor angles swinging together are considered
to be coherent.
The adopted coherent method was applied to the New England & New York 68-bus case.
In this case, a three phase fault at bus 55 is applied at 0.1 s and cleared at 0.15 s. The rotor
angle plots obtained from the PSS/E of generators 10-16 with respect to the generator at
bus 10 is given in Figure 3-1. For the purpose of clarity, the generator swing curves are
22
classified into different figures depending on the curve similarity, as shown in Figs. 3-2-
3-4.
23
Figure 3-2. Swing curves for generators 10 and 11
24
Figure 3-4. Swing curves for generators 14, 15, and 16
Dynamic simulation results showed that generators in the external system can be
divided into three coherent groups. As shown in Figure 3-2, it is seen that generators 10
and 11 swinging together are coherent, Generators 12 and 13 are coherent due to the
closeness of their rotor angle variations, as shown in Figure 3-3. Figure 3-4 depicts that
generators 14, 15, and 16 have the most similar swing curves; therefore, they are
considered as a coherent group. The results of coherent generators identification using the
non-linear time domain simulation are similar to the results in [22] where the two-time
equivalent generators are obtained at this stage to represent the dynamic behaviors of
25
external system. However, it is noted that there are only two boundary buses (i.e., buses
53 and 61) retaining in the external system, limiting the number of equivalent generators
to two. Therefore, in the next section, Prony analysis is employed to divide generators in
a given signal into its dominant modes of oscillation in terms of amplitude, frequency,
damping, and relative phases [23]. In [24], the basic principle of Prony analysis is
presented. In this research, Prony analysis is used for calculating complex eigenvalues
interaction mechanisms. Prony analysis is available in the PSS/E software, and one can
The time window 5 to 8 sec in Figure 3-5 were selected for Prony analysis. The first
5 second traces were ignored, allowing well-damped modes to die out and the system to
regain linearity. The analysis results using Prony techniques in the PSS/E are presented
in Appendix B, and dominant components of each generator are listed in Table 3-1.
26
Table 3-1. Results from Prony Analysis of Fig.3-5 Results – 5 to 8 sec Tie Window
10 1 29.499 -- --
11 1 63.271 -- --
12 1 25.474 -- --
2 2.0979 -- --
14 1 49.389 -- --
15 1 31.512 -- --
16 1 61.475 -- --
It can be seen from Table 3-1 that generators 10, 11, 12, and 13 have a roughly 0.7
dominant component and a 0.7 Hz component of about a half the size. Therefore, we
27
classify generators 10, 11, 12, and 13 as a coherent group, while generators 14, 15, and
It is observed from Figure 2-4. Single-line diagram of IEEE 68-bus power system
geographically far away from boundary bus 61. For this reason, the equivalent generator
used to represent the coherent group containing generator 14 is attached to boundary bus
53. Therefore, the equivalent generator obtained by aggregating generators 10, 11, 12,
28
3.3 Generator Aggregation
After coherent generators are identified, generators in each coherent group are aggregated
into an equivalent generator that represents each individual coherent group. The
Zhukov’s method [15], [16] and detailed aggregation method provided by DYNRED [26].
Zhukov’s method that has been reported in [15], [16] is used here. However, unlike the
original Zhukov’s method, the equivalent generator is directly connected to the boundary
bus. For this reason, the terminal voltage of the equivalent generator is equal to the voltage
of the boundary bus, where the equivalent generator is attached. The electrical active and
reactive power outputs of the equivalent generator are scaled up to match the total
where 𝑃𝑒𝑞 and 𝑄𝑒𝑞 are the real and reactive power of the equivalent generator, 𝑃𝑖 and 𝑄𝑖
are real and reactive power of generator 𝑖, 𝑛 denotes the number of coherent generators
in the same coherent group. The swing equation of the rotor is given by
𝑑𝜔𝑖
𝑀𝑖 = 𝑃𝑚𝑖 − 𝑃𝑒𝑖 − 𝐷𝑖 𝜔𝑖 (3.3)
𝑑𝑡
where 𝑀𝑖 , 𝑃𝑚𝑖 , 𝑃𝑒𝑖 , 𝐷𝑖 and 𝜔𝑖 denote respectively the generator inertia, mechanical
power, electrical power, damping constants, and angular speed of generator 𝑖 . Since
29
coherent generators have almost identical angular frequencies and thus assumed to be
𝑛 𝑛 𝑛 𝑛
𝑑𝜔
(∑ 𝑀𝑖 ) = ∑ 𝑃𝑚𝑖 − ∑ 𝑃𝑒𝑖 − (∑ 𝐷𝑖 ) 𝜔 (3.4)
𝑑𝑡
𝑖=1 𝑖=1 𝑖=1 𝑖=1
The mechanical and electrical power of the equivalent generator is the sum of those
equivalent generator are also defined as the sum of inertia and damping constant of all
𝑀𝑒𝑞 = ∑ 𝑀𝑖 (3.5)
𝑖=1
𝐷𝑒𝑞 = ∑ 𝐷𝑖 (3.6)
𝑖=1
As all the generators in one coherent group are connected to the boundary bus, their
transient, and sub-transient d- and q-axes reactance can be calculated by paralleling the
reactance of all the individual generators in the same coherent group, which can be
expressed as follows:
1
𝑋𝑒𝑞 = (3.7)
∑𝑛𝑖=1 𝑋𝑖
In this section, equations of the equivalent generator model are presented. The parameters
of the GENROU dynamic model [27] are obtained using a weighted least square method
30
[26]. As mentioned earlier, since the equivalent generator has been moved to the boundary
bus, the terminal voltage of the equivalent generator is equal to that of the boundary bus.
The rating, inertia, and damping constants of the equivalent generator are the sum of the
equivalent reactance can be summarized below. Under the generator initial conditions,
𝑃
𝛿𝑖 = tan−1 (3.8)
𝐸𝑡2
+𝑄
(𝑋𝑞𝑖 )
where,
1
𝑌𝑑𝑖 = (3.10)
𝑋𝑑𝑖
1
𝑌𝑞𝑖 = (3.11)
𝑋𝑞𝑖
2
𝑋𝑑𝑒 = (3.12)
1 1 1 1
∑𝑛𝑖=1 ( + )−( ) )
𝑋𝑞𝑖 𝑋𝑑𝑖 cos2(𝛿𝑖 − 𝛿𝑒
−
𝑋𝑑𝑖 𝑋𝑞𝑖
2
𝑋𝑞𝑒 = (3.13)
1 1 1 1
∑𝑛𝑖=1 ( ) ( ) )
𝑋𝑑𝑖 + 𝑋𝑞𝑖 + 𝑋𝑞𝑖 − 𝑋𝑑𝑖 cos2(𝛿𝑖 − 𝛿𝑒
31
′
2
𝑋𝑑𝑒 = (3.14)
1 1 1 1
∑𝑛𝑖=1 ( ′ + ′ ) − ( ′ − ′ ) cos2(𝛿𝑖 − 𝛿𝑒 )
𝑋𝑑𝑖 𝑋𝑞𝑖 𝑋𝑞𝑖 𝑋𝑑𝑖
′
2
𝑋𝑞𝑒 = (3.15)
1 1 1 1
∑𝑛𝑖=1 ( ′ + ′ ) + ( ′ − ′ ) cos2(𝛿𝑖 − 𝛿𝑒 )
𝑋𝑑𝑖 𝑋𝑞𝑖 𝑋𝑞𝑖 𝑋𝑑𝑖
′′
2
𝑋𝑑𝑒 = (3.16)
1 1 1 1′
∑𝑛𝑖=1 ( ′′ + ′′ ) − ( ′′ − ′ ) cos2(𝛿𝑖 − 𝛿𝑒 )
𝑋𝑑𝑖 𝑋𝑞𝑖 𝑋𝑞𝑖 𝑋𝑑𝑖
′′
2
𝑋𝑞𝑒 = (3.17)
1 1 1 1
∑𝑛𝑖=1 ( ′′ + ′′ ) + ( ′′ − ′′ ) cos2(𝛿𝑖 − 𝛿𝑒 )
𝑋𝑑𝑖 𝑋𝑞𝑖 𝑋𝑞𝑖 𝑋𝑑𝑖
In the previous section, the identified coherent generators in a group are aggregated to an
equivalent generator. The associated exciters are needed to be aggregated as well. The
aggregation of exciter models in this research is based on the method described in [6]. In
[6], a trajectory sensitivity method [28] was used to find the optimal parameters of the
equivalent exciter model. It was reported that the equivalent regulator gain 𝐾𝐴 has the
greatest impact on improving the performance of the equivalent exciter. The value of 𝐾𝐴
can be easily obtained by an MVA weighted average method. The mathematical definition
is given by
where 𝐾𝐴𝑖 , 𝑀𝑉𝐴𝑖 , and 𝐻𝑖 are the regulator gain, generator MVA base, and inertia constant
of the exciter for generator 𝑖, respectively; and 𝑛 is the number of generators equipped
with exciter models in the coherent group. It is noted that the generator inertia is included
32
in the formula (3.18). This is because in the system data, all MVA bases of the external
generators have been converted to 100. Multiplying the MVA base of 100 by the
corresponding inertia constant can restore the ratio of MAV base between generators.
Other equivalent exciter parameters are set to those of the most dominant unit in the
coherent group.
The generator and exciter aggregation methods described above are applied to New
England and New York system. The six generators in the external system that need to be
aggregated are represented by the two-axis model and equipped with Type AC-4 [29]
exciters. Table A.1 provides the detailed synchronous machine data for generators 10-16
on a 100 MVA base. Table A.2 gives the Type AC-4 exciter data for these six generators
(The generator data and exciter data are given in Appendix A). The equivalent generators
are modeled using the GENROU dynamic model. It is important to note that 𝑋𝑑 , 𝑋𝑞 , 𝑋𝑑′ ,
𝑋𝑞′ , 𝑋𝑑′′ , 𝑋𝑞′′ , 𝑋𝑙 , 𝐻 , and 𝐷 are in per unit based on generator MVA base, and 𝑋𝑑′′ must
equal to 𝑋𝑞′′ for this type of generator model. The IEEE type AC4A excitation is chosen
divided into two coherent groups. Therefore, two equivalent generators and two
models calculated by two approaches (i.e., Zhukov’s method and detailed aggregation
33
method provided by DYNRED) are summarized in Table 3-3. Table 3-4 shows the results
of equivalent exciters using descried exciter aggregation method. For the sake of
simplicity, we use the abbreviations for Zhukov’s method and detailed aggregation
method provided by DYNRED, namely Zhukov and DYNRED. As shown in Table 3-3,
Parameters (G10, G11, G12 and G13) (G14, G15 and G16)
34
Table 3-3. Estimated Parameters of Equivalent Exciter
Equivalent
0.01 1.0 10 100 10 0
exciter 1
Equivalent
0.01 1.0 10 100 10 0
exciter 2
3.6 Summary
In this chapter, the non-linear time domain simulation was first employed to identify
coherent groups of generators. Then, Prony analysis was used as an aide in the
interpretation of non-linear time domain simulation results; particularly in the case that
the number of coherent groups is greater than the number of boundary buses so that
generators need to be further grouped. Both two methods can be implemented in the
generators were identified, generators with their exciters in a coherent group were
methods used to determine the parameter values of equivalent generators and exciters
have been presented. IEEE 68-bus system was used to validate the coherent identification
and aggregation of the coherent generators and their exciters, indicating that dynamic
features of the external area now can be represented by two equivalent generators with
The aggregation methods discussed in this chapter are only suitable for the case that
35
the complete set of modelling data is available. To improve the accuracy of dynamic
considerable effect on the study area will be further turned in the next chapter.
36
Chapter 4 Dynamic Equivalent Circuit
for External System
The dynamic equivalent circuit for an external system is constructed by adding equivalent
generator and exciter models, which represent the dynamics of the external system, to
boundary buses of the static equivalent circuit. A static equivalent circuit of the external
of the external generator and their exciters are available, the parameters of equivalent
presents a fitting process for determining model parameters, which can be used to
improve the accuracy of the dynamic equivalent circuit by eliminating errors brought by
coherent identification and dynamic aggregation. In particular, the proposed curve fitting
techniques can also be used to determine the parameters of equivalent models when the
In this subsection, the equivalent system refers to the reduced system, consisting of the
unchanged internal system and the dynamic equivalent external system. The proposed
fitting process determines the parameters of equivalent generators in an iterative way. The
dynamic parameters of equivalent generators are identified by fitting the response of the
equivalent system with the original system. The optimal parameters of equivalent
37
generators are obtained by minimizing the error between the dynamic response of the
original system and the equivalent system. The transient voltage recovery waveforms are
used to as the error criterion for the fitting process. To investigate the effect of the external
system on the dynamic performance of the internal system, the voltage recovery
characteristics at the buses in the internal system are studied. The transient voltage
at each simulation time instant are chosen to form an objective function for the fitting
process, given by
𝑛
2
𝑚𝑖𝑛𝑓(𝑥) = ∑[𝑉𝑓 (𝑖) − 𝑉𝑒 (𝑥, 𝑖)] (4.1)
𝑖=0
subject to
𝑥𝑙𝑜𝑤 ≤ 𝑥 ≤ 𝑥𝑢𝑝
where the subscripts 𝑓 and 𝑒 denote the full system and the equivalent system,
respectively. The voltage values are given by points on the transient voltage recovery
waveform and 𝑛 is the total number of points over the simulation period. 𝑉𝑓 (𝑖) is the
voltage value (known in advance) at point 𝑖 obtained from the full system, 𝑉𝑒 (𝑥, 𝑖) is the
voltage value at point 𝑖 obtained from the equivalent system. Here, 𝑥 denotes the
parameter to be identified by the fitting process. The voltage value of the equivalent
system at point 𝑖 varies as a function of the parameter 𝑥. 𝑥𝑙𝑜𝑤 and 𝑥𝑢𝑝 are the parameter
lower and upper bounds. The basic principle of the objective function is to search for
38
optimal parameters so that the dynamic responses of the reduced system can be roughly
close to the dynamic responses of the full system. The fitting process is depicted in Figure
4-1.
+
error Termination Yes Dynamic
criteria satisfied? equivalent
-
Equivalent
Simulated No
system
outputs
Optimization
New parameters Algorithm
on the PSS/E Application Program Interface (API). Each iteration of the algorithm
automatically:
API provides various functions that allow Python to read and write from and to
39
PSS/E by creating an interface between them. The algorithm runs PSS/E within Python
environment. Simulation results will be analyzed in Python for next iteration. The
iteration between Python and PSS/E is illustrated in the following flowchart (of Figure 4-
2).
Start
Equivalent system
with initial
parameters
Assign new
parameters to Export PSS/E
equivalent model simulation results
(PSS/E) to Python
Evaluate error
Update parameters
function in Python
(Python)
No
Stop criterion
satisfied?
Yes
End
40
The overall process of the proposed method is composed of four functions listed
below:
Function-4: Plotting
The fitting process is an iterative process, as shown in Figure 4-3, with each iteration
Function-4 is used to plot the desired results when the iteration process ends.
Function-2: Run
dynamic simulations
Yes
More cases ?
No
41
4.1.1 Function-1: Dynamic Simulation Setup
Dynamic simulation setup function aims to get the case prepared for performing a
dynamic simulation in PSS/E. This function starts with a solved PSS/E load flow case,
1. Activity CONL: convert constant MVA loads to desired constant power, constant
4. Activity FACT: factorize the admittance matrix (Y matrix) that will be used in
activity TYSL
The flow chart of function-1 is shown in Figure 4-4. The first column provides a
brief description of the activities described above, the second column indicates the
instructions are given in the last column. This function results in a converted power flow
case which needs to be saved in its converted form for subsequent dynamic analyses. Note
that this converted case should be saved using a different name because the conversion
42
Dynamic simulation setup
Activity
Convert loads psspy.conl()
CONL
Activity
Convert generators psspy.cong()
CONG
43
4.1.2 Function-2: Dynamic Simulation Procedures
The flow chart of the dynamic simulation process is shown in Figure 4-5. It is seen
that the simulation procedures are described in the left column, and the right column
44
Dynamic simulation procedures
Function Python
psspy.run(initial time)
Run the simulation and apply psspy.dist_bus_fault()
disturbances psspy.run(fault time)
psspy.dist_clear_faylt()
More snapshot?
End
45
4.1.3 Function-3: Data Evaluation
The results of dynamic simulations are saved in a binary file (*.out), which can be
exported to excel spreadsheets using the dyntools module. To perform data evaluation in
Python, we need to convert the desired column data in the excel file to an array of values.
Then, voltage values at each time instant obtained from equivalent system are compared
to that of the full system. In this optimization problem, there is no mathematical function
that can be used to express the relationship between the inputs (i.e., equivalent model
parameters) and the outputs (i.e., voltage responses). The system output corresponding to
the specific set of system inputs can only be obtained by using time domain simulation
tools. As such, the objective function which relates the outputs, i.e., the transient voltage
responses, to the inputs, i.e., the parameters of equivalent models, cannot take derivatives.
Three optimization algorithms, namely Monte Carlo method, Nelder-Mead method and
Powell method, are adopted here to determine the equivalent parameters by minimizing
the objective function. These three optimization methods are chosen because they do not
require any derivative information. In the following, a brief introduction to three methods,
The Monte Carlo method aims to generate a large number of random samples and then
use these samples to calculate the values of interest. In the Monte Carlo method,
generating random variables with known probability distribution is the main task,
46
therefore the Monte Carlo method is also known as random sampling [30].
In this research, uniform distribution are used to generate random variables for
function: 𝑟𝑎𝑛𝑑𝑜𝑚. 𝑢𝑛𝑖𝑓𝑜𝑟𝑚(𝑥, 𝑦) . The Python code for this method is presented in
Appendix C.1.
Nelder-Mead Method is used to find the maximum and minimum values of the objective
and is usually applied to nonlinear optimization problems with unknown derivatives [31].
dimensional space, and then calculates the corresponding objective function value of each
point. The purpose is to obtain an optimal point by finding a new test point to replace the
old test point. The worst point will be replaced by the reflection point of the centroid of
the remaining n points. If the reflection point is better than the previous points, the search
is continued in the direction of the reflection point; if not, all points are shrunk in a better
direction. There are four potential operations for updating points at each iteration, namely,
reflection, expansion, contraction and shrink, and one of them might be implemented by
judging current situations. More details of the Nelder-Mead algorithm can be found in
[32].
47
The spicy.optimize package provides several commonly used optimization
Powell method is also known as the directional acceleration method, which was proposed
by Powell in 1964 [33]. It is a search method that uses the properties of conjugate
effective direct search method. The principle is to establish a direction set, where the
directions in this set are linearly dependent of each other. Starting from the initial point
(𝑥0 ), a linear search is performed to find the optimal solution along this direction (using
the Brent method), so that a new position (𝑥1 ) is obtained. Then, by adding a new direction
of (𝑥1 − 𝑥0 ) to the direction set, the first direction in the original set is removed. The
algorithm keeps iterating until there is no significant improvements. More details of the
48
4.1.4 Function-4: Plotting
Last function is used to plot the optimal results so as to provide a visual comparison
between the transient voltage recovery waveforms of the full system and that of the
equivalent system. The flow chart of function-4 is shown below (Figure 4-6), where
CHNF function under dyntools module provides methods to access and post process the
data from PSSE dynamics simulation studies channel output files (.out). Optnchn is a
dictionary under matplotlib module specifying channels to plot and plotting options.
Filename (.*out)
optnchn
Line graphs
End
49
4.2 Results and Discussion
equivalent generators. The original transient voltage response is obtained from the full
New England & New York 68-bus system (Figure 2-4. Single-line diagram of IEEE 68-
bus power system). The reduced 68-bus system for validating the fitting process is shown
in Figure 4-7. It is seen from Figure 4-7, the reduced 68-bus system consists of an
unchanged internal system and a dynamic equivalent external system, where generators
in the external area (generators 10-16) are replaced by two equivalent generators at
boundary buses 53 and 61. To investigate the influence of external system on the dynamic
performance of internal system, a fault is applied in the internal system and the dynamic
responses of buses in the internal system are analyzed. Here, we only take two main
process.
⚫ H: inertia
⚫ D: damping coefficient
These two parameters for each equivalent generator must be determined such that
the objective function is minimized. For both the full system and the reduced system, a
three phase fault was applied at bus 37 at 1 second and cleared after six cycles (100ms).
The transient voltage response of bus 27, which is one bus away from bus 37 and close
to the external system, is monitored. Therefore, the accuracy of the proposed fitting
50
process using optimization algorithms is examined by how well the terminal voltage at
bus 27 of the reduced system match with that of the full system.
subsystem 2 subsystem 1
NETS
G3
G2
G7 03
G5 62 02
07 59
63
05
23 G4 65 58 60
20
04 64
G6 19 66 57
06 67
56 Ge1
68
22 52
21 37 61
55
27
24
G9
09 Ge2
28
53
29 26 25 54
08 01
G8 G1
AREA 1
Figure 4-7. Single-line diagram of reduced 68-bus system with external system
To validate the Monte Carlo method, the corresponding ranges of four parameters were
given. The best five fitting curves are plotted, as shown in Figure 4-8. It is seen that the
transient voltage recovery waveforms of the reduced system match well with that of the
full system. In addition, the worst five cases are also plotted, as shown in Figure 4-9, as
a comparison to the good matching in Figure 4-8. It turns out that the Monte Carlo method
51
Figure 4-8. Best five cases obtained by Monte Carlo method
52
Figure 4-9. Worst five cases obtained by Monte Carlo method
In the case that the complete dynamic parameters of generators are available, the
in Chapter 3. For IEEE 68-bus system, the aggregation values of parameters H and D
53
(H1=161.875, D1=24.665, H2=350, D2=100) can be used as a good starting point for
equivalent parameters H and D are set to random values (e.g., H1=0.5, D1=0.2, H2=0.5,
D2=0.2), which can be regarded as bad initial values to begin the optimization process.
The fitting process utilizing Nelder-Mead method were validated under both
situations. Simulation results are shown in Figs. 4-10-4-11. Figure 4-10 compares the
scenario in which good initial values are used to its corresponding optimal result obtained
by fitting process utilizing Nelder-Mead method. Figure 4-11 compares the scenario in
which bad initial values are used to its corresponding optimal result obtained by fitting
process using Nelder-Mead method. It is seen that the Nelder-Mead method fails to
converge to a critical point of objective function with if the starting point is not good
enough. That is, it fails to find optimal values for parameters H and D of equivalent
generators when the optimization process starts with bad initial values.
54
Figure 4-10. Comparison between the good starting scenario and its corresponding
Figure 4-11. Comparison between the bad starting scenario and its corresponding optimal
55
4.2.4 Validation of Powell Method
Similar to the procedures of validating the Nelder Mead method, the comparison of good
initial scenario with its optimal scenario obtained by using Powell method is shown in
Figure 4-12. Meanwhile, the optimal scenario resulted from Powell method starts with
bad initial values are compared to the scenario in which its bad initial values are used,
which are shown in Figure 4-13. By comparison, Powell method is efficient in finding
optimal parameters for H and D to match the full system voltage responses, even if the
Figure 4-12. Comparison between the good starting scenario and its corresponding
56
Figure 4-13. Comparison between the bad starting scenario and its corresponding optimal
4.3 Summary
the parameters of equivalent generators. The objective function is defined as the sum of
square of the differences in voltage response obtained from the full system and the
corresponding ones obtained from the dynamic equivalent system. The fitting process can
be implemented using the following procedures in the Python environment. First, we set
up the power flow case for dynamic simulation. Second, the dynamic simulations are
performed in PSS/E, of which the simulation results are then exported to Python for data
evaluation. Dynamic simulations and data evaluation are repeated until we get the
minimum value of the objective function. The last step is to plot the desired results. For
57
data evaluation, three optimization algorithms including Mento Carlo method, Nelder-
Mead Method and Powell method are used for this research. These methods are adopted
mathematical definition.
Simulations were performed to validate the proposed fitting process using three
optimization algorithms. Monte Carlo and Powell methods were proved to be effective in
identifying the equivalent parameters even when we do not have the complete dynamic
method is easy to implement, it may fail to converge to a critical point of the objective
function with bad initial values. In other words, we cannot use Nelder-Mead method to
determine the parameters of equivalent models when complete dynamic data are not
accessible.
58
Chapter 5 Conclusions and Future
Work
This section presents the conclusions and contributions of the thesis and future work can
5.1 Conclusions
The power system is not a static system. It is a dynamic system and vulnerable to various
types of disturbances such as short circuit faults, loss of a transmission line, power
split the power system into two sub systems, internal and external. Internal system is the
part of the network in which the simulations need to be performed. This thesis proposed
to develop a dynamic equivalent circuit for external power system using integrated
The proposed approach starts with generating a static equivalent circuit in PSS/E
for the external system to significantly reduce the size of external network, which can be
established following four steps: 1) Distinguish study and external areas. 2) Change bus
type code to retain the desired buses in the external system. 3) Net generation with
equivalent circuit for external system using Gauss elimination method. This is described
59
in Chapter 3. After the static equivalent circuit was established, the dynamic equivalent
circuit for external system can be constructed by adding equivalent generators and
associated controls at the boundary buses, where the equivalent generators are obtained
by analyzing the coherency among generators in the external system. In this research, the
non-linear time domain simulation was conducted to identify coherent generators since it
is easy to implement in PSS/E. Moreover, Prony analysis that is also available in PSS/E
was used to further group the external generators, which is based on comparing the
of each generator. After the coherent groups were identified, generators and equipped
exciter. The equivalent generator parameters were calculated based on the Zhukov’s
method or DYNEQU’s method, while the aggregate exciter parameters were calculated
by using the MVA-base weighted Ka, with the time constants set to those from the exciter
of the most dominant unit in a coherent group. This part is presented in Chapter 4. Chapter
voltage recovery close to that of the full system. An optimization based fitting process
was proposed to determine the values of equivalent model parameters, in which Monte
Carlo, Nelder-Mead and Powell optimization methods were employed. New York and
New England IEEE 68 bus was used for validating the effectiveness of the proposed
method in constructing a dynamic equivalent circuit. It was shown that the proposed
60
approach based on Monte Carlo and Powell methods are effective to search optimal
an optimal solution in the case that the choice of initial values is not good enough.
5.2 Contributions
This thesis presented an approach to develop a dynamic equivalent circuit for the external
system while remaining its effects on the study system. The main feature of this approach
is the use of a nonlinear optimization based fitting process to determine the model
supplement the coherency method, where coherent generators were identified using non-
linear time domain simulation combined with Prony analysis features available in the
PSS/E software. The developed approach using integrated commercial software PSS/E
and Python is easier and more automated, thus repeatable. Validations proved that Monte
Carlo and Powell methods were effective in determining the parameters of equivalent
generators even when the parameters of external generators are not available.
The future work of this thesis are proposed from the following perspectives
• The proposed optimization method for determining the equivalent parameters can
generators (rating, reactance, inertia, damping and time constants) on the transient
61
voltage recovery properties of the equivalent system. Based on the understanding
gained in the above task, some rules to tune the basic parameters of the equivalent
• Only the parameters of equivalent generators were investigated in this thesis. The
• In this research, three optimization methods are used. However, the Powell
method does not use any gradient evaluations, it may take longer to find the
minimum. There might be other more efficient optimization algorithms that can
62
References
applications in power system stability analyses,” IEEE Power Eng. Soc., vol. 11, no.
[2] B. Stott, “Power system dynamic response calculations,” Proc. IEEE, vol. 67, no. 2
[3] S. Takeda and S. Nishida, “Derivation of Dynamic Equivalents for Stability Analysis,”
Assessment,” Elect. Power Energy Syst., vol. 6, no. 5, pp. 13-25, 1980.
[5] S. Olivera and J. Queiroz, “Modal Dynamic Equivalents for Electric Power Systems.
I: Theory,” IEEE Trans. Power Syst., vol. 3, no. 6, pp. 65-79, 1988.
of exciter models for constructing power system dynamic equivalents,” IEEE Trans.
Power App. Syst., vol. PAS-104, no. 11, pp. 3056-3063, 1985.
63
[8] L. Wang, M. Klein, S. Yirga and P. Kundur, “Dynamic reduction of large power
systems for stability studies,” IEEE Trans. Power Syst., vol. 12, no. 2, pp. 889-895,
1997.
[9] X. Lei, D. Povh and O. Ruhle, “Industrial approaches for dynamic equivalents of
large power systems,” in Proc. IEEE Power Eng. Soc. Winter Meeting, New York
thirteen-machine system,” IEEE Trans. Power App. Syst., vol. PAS-100, no. 3, pp.
1324-1332, 1981.
measurement-based gray box and hybrid dynamic equivalents,” IEEE Trans. Power
[12] P. Ju, L. Q. Ni and F. Wu, “Dynamic equivalents of power systems with online
measurements. Part 1: Theory,” Proc. Inst. Elect. Eng. Gen. Transm. Distrib., vol.
systems with online measurements Part 2: Applications,” Proc. Inst. Elect. Eng. Gen.
[14] PTI, PSS/E Application Guide (Vol. I). PSS/E Brochure, 2002.
64
[15] S. W. Peter and P. M. Mangalore, Power System Dynamics and Stability, London:
IEEE Trans. Power Apparatus Syst., vol. PAS-97, no. 4, pp. 1060-1069, 1978.
[17] T. L. Baldwin and L. M. Arun and G. Phadke, “Dynamic ward equivalents for
transient stability analysis,” IEEE Trans. Power Syst., vol. 9, no. 1, pp. 59-67, 1994.
power system,” in 2014 Eighteenth Nat. Power Syst. Conf. (NPSC), Guwahati, 2014,
pp. 1-6.
[20] G.P. Deng, Y.Z. Sun and Jian Xu, “A new voltage stability analysis method by
considering short circuit capacity”, Autom. Electr. Power Syst., vol. 33, no. 8, pp. 15-
19, 2009.
[21] J. P. Yang, G. H. Cheng and Z. Xu, “Dynamic reduction of large power system in
PSS/E,” IEEE/PES Tran. and Distrib. Conf. Exhib., Dalian, China, 2005, pp. 1-4.
large power systems using structure preservation technique,” IEEE Trans. Power
[23] IEEE Task Force Identification of Electromechanical Modes in Power Systems June
65
2012.
[24] J. F. Hauer, C. J. Demeure and L. L. Scharf, “Initial results in prony analysis of power
system response signals,” IEEE Trans. Power Syst., vol. 5, no. 1, pp. 80-89, 1990.
[27] S. W. Peter and M. A. Pai, Power system dynamics and stability, New York: Willey,
2008.
[28] P. M. Frank, An introduction to sensitivity theory, New York: Academic Press 1978.
[29] I. C. Report, “Excitation Models for Power System Stability Studies,” IEEE Trans.
[31] Jr. J. E. Dennis and V. Torczon, “Direct search methods on parallel machines,” SIAM
[32] F. Gao and L. Han, “Implementing the Nelder-Mead simplex algorithm with adaptive
parameters,” Comput. Optim. Appl., vol. 51, no. 1, pp. 259-277, 2012.
[33] M. J. D. Powell, “An efficient method for finding the minimum of a function of
several variables without calculating derivatives,” Comput. J., vol. 7, pp. 155-162,
66
1964.
[34] X. Du, J. Dang, Y. Wang, X. Liu and S. Li, “An algorithm multi-resolution medical
image registration based on firefly algorithm and powell,” IEEE Conf. Intell. Syst.
[35] Y. Lei and V. Zhang, “An improved 2D-3D medical image registration algorithm
based on modified mutual information and expanded Powell method,” in IEEE Int.
Conf. Medical Imaging Physics Eng. (ICMIPE), Shenyang, 2013, pp. 24-29.
67
Appendix A Test System Data
68
Table A. 1. (continued) Generator Dynamic Data on 100 MVA Base
69
Appendix B Prony Analysis Result
70
71
Figure B. 1. Prony analysis results
Real and imaginary parts of eigenvalues in sec-1 and rad/sec denote the mode damping
and frequency, respectively. The last column in Figure B.1 provides the frequency in Hz
72
Appendix C Python Code
73
lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0,
_winreg.KEY_READ)
lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
_winreg.CloseKey(ptikey)
_winreg.CloseKey(lverkey)
return lverdir
pssedir = latest_psse_location()
pssedir = str(pssedir) # convert unicode to str
pssbindir = os.path.join(pssedir,'PSSBIN')
# Check if running from Python Interpreter
exename = sys.executable
p, nx = os.path.split(exename)
nx = nx.lower()
if nx in ['python.exe', 'pythonw.exe']:
os.environ['PATH'] = pssbindir + ';' + os.environ['PATH']
sys.path.insert(0,pssbindir)
import redirect
redirect.psse2py()
import psspy
import dyntools
def prepare_dynamic_simulation():
ierr = psspy.psseinit(buses=150000)
psspy.case(savfile)
# Convert loads
psspy.conl(0,1,1,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,2,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,3,[0,0],[100.0,0.0,0.0,100.0])
74
# Convert generators
psspy.cong()
def col2array(book):
first_sheet = book.sheet_by_index(0)
cells = first_sheet.col_slice(colx=1, start_rowx=4)
col_list = []
for cell in cells:
col_list.append(cell.value)
col_array = np.asarray(col_list)
return col_array
if len(n_range_pairs) != 2 * n:
75
print("mc_sampling error: n_range_paris length is not correct")
exit()
sample = []
for i in range(n):
sample.append(random.uniform(n_range_pairs[i * 2], n_range_pairs[i * 2 + 1]))
return sample
def run_dynamic_simulation(snp):
76
print 'Simulation finished at time', time.ctime()
print 'Dynamic simulation for SNP', snp + ' complete! \n\n'
# 1. Data extraction/information
def test_data_extraction(chnfobj):
# 6. One trace in each subplot, more than one trace in one plot and all trace in one plot
for top five
def test_subplots_trace_all(chnfobj):
chnfobj.set_plot_page_options(size='letter', orientation='portrait')
chnfobj.set_plot_markers('square', 'triangle_up', 'thin_diamond', 'plus', 'x',
'circle', 'star', 'hexagon1')
chnfobj.set_plot_line_styles('solid', 'dashed', 'dashdot', 'dotted')
chnfobj.set_plot_line_colors('blue', 'red', 'black', 'green', 'cyan', 'magenta', 'pink',
'purple')
optnchn1 =
{1:{'chns':{a:1}},2:{'chns':{b:1}},3:{'chns':{c:1}},4:{'chns':{d:1}},5:{'chns':{e:1}}}
pn,x = os.path.splitext(a)
pltfile1 = pn+'.png'
77
figfiles1 = chnfobj.xyplots(optnchn1,optnfmt,pltfile1)
figfiles2 = chnfobj.xyplots(optnchn2,optnfmt,pltfile2)
figfiles3 = chnfobj.xyplots(optnchn3,optnfmt,pltfile3)
figfiles = figfiles1[:]
figfiles.extend(figfiles2)
figfiles.extend(figfiles3)
if figfiles:
print 'Plot fils saved:'
for f in figfiles:
78
print ' ', f
def test6():
chnf = dyntools.CHNF(outlst)
test_subplots_trace_all(chnf)
chnf.plots_show()
def run_full_system():
psspy.psseinit(buses=80000)
psspy.read(0,r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_system_raw_data.
raw""")
psspy.fnsl([0,0,0,0,1,1,99,0])
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,2,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,3,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.ordr(0)
psspy.fact()
psspy.tysl(0)
psspy.save(r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system_raw_
data.sav""")
psspy.lines_per_page_one_device(1,90)
psspy.progress_output(2,r"""C:\Users\guor\Desktop\PSSE_Python\output\progress
report 0.txt""",[0,0])
79
psspy.case(r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system_raw_
data.sav""")
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_syste
m_dynamic_data.dyr""","","","")
psspy.dynamics_solution_param_2()
psspy.bsys(1,0,[0.0,0.0],0,[],1,[27],0,[],0,[])
psspy.chsb(1,0,[1,17,1,1,13,0])
psspy.snap([498,177,17,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_
full_system.snp""")
psspy.case(r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system_raw_
data.sav""")
psspy.rstr(r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system.snp""")
psspy.strt(0,r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system.out""
")
psspy.run(0, 1.0,1000,1,0)
psspy.dist_bus_fault(37,1, 345.0,[0.0,-0.2E+10])
psspy.run(0, 1.1,1000,1,0)
psspy.dist_clear_fault(1)
psspy.run(0, 10.0,1000,1,0)
psspy.lines_per_page_one_device(2,10000000)
psspy.progress_output(1,"",[0,0])
chnf =
dyntools.CHNF(r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system.
out""")
test_data_extraction(chnf)
80
# Files Used
study_folder = r'C:\Users\guor\Desktop\PSSE_Python\\'
savfile = os.path.join(study_folder,'IEEE68_equivalent_system_data.sav')
out_files = r"""C:\Users\guor\Desktop\PSSE_Python\output\\"""
savcfile = os.path.join(out_files,'IEEE68_equivalent_system_data_cnv.sav')
outfilepath = os.path.join(study_folder,'*.out')
if __name__ == '__main__':
FILE_PATH = r"C:\Users\guor\Desktop\PSSE_Python\output"
# delete all files from last run
for root, dirs, files in os.walk(FILE_PATH):
for this_file in files:
os.remove(os.path.join(root, this_file))
# run base case
run_full_system()
# read base file
BASE_FILE = "IEEE68_full_system.xlsx"
book = xlrd.open_workbook(FILE_PATH + "\\" + BASE_FILE)
base_array = col2array(book)
book.release_resources()
del book
TOP_N = 5
top_n_list = []
WORST_N = 7
worst_n_list = []
best_evaluation_history = []
81
saved_list = None
K1 = 5
K2 = 5
prepare_dynamic_simulation()
print 'Total Simulation using serial processing strated at time ' + time.ctime()
start = time.time()
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_equivalent
_system_dynamic_data.dyr""","","","")
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",5, a)
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",6, b)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",5, c)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",6, d)
psspy.snap([329,118,9,0,0],"C:\Users\guor\Desktop\PSSE_Python\output\\" + str(x)
+ '.snp')
# run simulation
run_dynamic_simulation(str(x))
82
# =============choose top 5================
# compare
if len(base_array) != len(compare_array):
break
evaluation_value = sum((base_array - compare_array) ** 2)
top_n_list.append([evaluation_value, [a, b, c, d], x,
"C:\Users\guor\Desktop\PSSE_Python\output\\" + str(x) + '.out'])
top_n_list.sort()
worst_n_list.append([evaluation_value, [a, b, c, d], x,
"C:\Users\guor\Desktop\PSSE_Python\output\\" + str(x) + '.out'])
worst_n_list.sort(reverse=True)
best_evaluation_history.append(top_n_list[0][0])
# first N
if len(top_n_list) <= TOP_N:
continue
# new minimum
if evaluation_value <= top_n_list[-1][0]:
top_n_list.pop()
# worst N
if len(worst_n_list) <= WORST_N:
continue
83
# new maximum
if evaluation_value >= worst_n_list[-1][0]:
worst_n_list.pop()
print '\n Top Three: \n'
print(top_n_list)
# plot maximum
outlst = []
for i in range(len(worst_n_list)):
outlst.append(worst_n_list[i][3])
84
print outlst
[a,b,c,d,e,g,h] = outlst
base_out =
r"""C:\Users\guor\Desktop\PSSE_Python\output\IEEE68_full_system.out"""
outlst.append(base_out)
test6()
85
C.2 Nelder-Mead Method
import os, sys, xlrd, random, re, os.path
import numpy as np
import matplotlib
import glob
import time
from scipy.optimize import minimize
# Get installed location of latest PSS(R)E version
def latest_psse_location():
import _winreg
ptiloc = r"SOFTWARE\PTI"
ptikey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ptiloc, 0,
_winreg.KEY_READ)
ptikeyinfo = _winreg.QueryInfoKey(ptikey)
numptisubkeys = ptikeyinfo[0]
vdict = {}
for i in range(numptisubkeys):
vernum = _winreg.EnumKey(ptikey, i)
try:
n = int(vernum[-2:])
vdict[n]=vernum
except:
pass
vers = vdict.keys()
vers.sort()
k = vers[-1]
lver = vdict[k]
86
lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0,
_winreg.KEY_READ)
lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
_winreg.CloseKey(ptikey)
_winreg.CloseKey(lverkey)
return lverdir
pssedir = latest_psse_location()
pssedir = str(pssedir) # convert unicode to str
pssbindir = os.path.join(pssedir,'PSSBIN')
import redirect
redirect.psse2py()
import psspy
import dyntools
def prepare_dynamic_simulation():
ierr = psspy.psseinit(buses=150000)
psspy.case(savfile)
# Convert loads
87
psspy.conl(0,1,1,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,2,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,3,[0,0],[100.0,0.0,0.0,100.0])
# Convert generators
psspy.cong()
def col2array(book):
first_sheet = book.sheet_by_index(0)
cells = first_sheet.col_slice(colx=1, start_rowx=4)
col_list = []
for cell in cells:
col_list.append(cell.value)
col_array = np.asarray(col_list)
return col_array
def run_dynamic_simulation(snp):
88
process_id = os.getpid()
print("Process ID:{}".format(process_id))
psspy.lines_per_page_one_device(1,90)
psspy.progress_output(2,out_files + 'progress report ' + snp + '.txt',[0,0])
psspy.case(savcfile)
psspy.rstr(out_files + snp + '.snp')
psspy.dynamics_solution_param_2()
psspy.voltage_channel([1,17,1,27],"") # only add bus 154 voltage as channel 42 using
different API
psspy.strt(1,out_files + snp + '.out')
psspy.run(0, 1.0,1000,1,0)
psspy.dist_bus_fault(37,1, 345.0,[0.0,-0.2E+10])
psspy.run(0, 1.1,1000,1,0)
psspy.dist_clear_fault(1)
psspy.run(0, 10.0,1000,1,0)
psspy.lines_per_page_one_device(2,10000000)
psspy.progress_output(1,"",[0,0])
print 'Simulation finished at time', time.ctime()
print 'Dynamic simulation for SNP', snp + ' complete! \n\n'
# 1. Data extraction/information
def test_data_extraction(chnfobj):
def run_full_system():
psspy.psseinit(buses=80000)
89
psspy.read(0,r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_system_raw_data.
raw""")
psspy.fnsl([0,0,0,0,1,1,99,0])
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,2,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,3,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.ordr(0)
psspy.fact()
psspy.tysl(0)
psspy.save(out_files+'IEEE68_full_system_raw_data.sav')
psspy.lines_per_page_one_device(1,90)
psspy.progress_output(2,out_files+'progress report 0.txt',[0,0])
psspy.case(out_files+'IEEE68_full_system_raw_data.sav')
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_syste
m_dynamic_data.dyr""","","","")
psspy.dynamics_solution_param_2()
psspy.bsys(1,0,[0.0,0.0],0,[],1,[27],0,[],0,[])
psspy.chsb(1,0,[1,17,1,1,13,0])
psspy.snap([498,177,17,1,1],out_files+'IEEE68_full_system.snp')
psspy.case(out_files+'IEEE68_full_system_raw_data.sav')
psspy.rstr(out_files+'IEEE68_full_system.snp')
psspy.strt(0,out_files+'IEEE68_full_system.out')
psspy.run(0, 1.0,1000,1,0)
psspy.dist_bus_fault(37,1, 345.0,[0.0,-0.2E+10])
psspy.run(0, 1.1,1000,1,0)
90
psspy.dist_clear_fault(1)
psspy.run(0, 10.0,1000,1,0)
psspy.lines_per_page_one_device(2,10000000)
psspy.progress_output(1,"",[0,0])
chnf = dyntools.CHNF(out_files+'IEEE68_full_system.out')
test_data_extraction(chnf)
# Files Used
study_folder = r'C:\Users\guor\Desktop\PSSE_Python\\'
savfile = os.path.join(study_folder,'IEEE68_equivalent_system_data.sav')
out_files = r"""C:\Users\guor\Desktop\PSSE_Python\output7\\"""
savcfile = os.path.join(out_files,'IEEE68_equivalent_system_data_cnv.sav')
outfilepath = os.path.join(out_files,'*.out')
def losfunc(x):
global counter
# run base case
run_full_system()
# read base file
book = xlrd.open_workbook(out_files+'IEEE68_full_system.xlsx')
base_array = col2array(book)
book.release_resources()
del book
# run compare case
prepare_dynamic_simulation()
ierr = psspy.psseinit(buses=80000)
psspy.case(savfile)
91
[a,b,c,d]=x
if a < 0 or b < 0 or c <0 or d < 0:
return 10000000000000
0
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_equivalent
_system_dynamic_data.dyr""","","","")
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",5, a)
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",6, b)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",5, c)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",6, d)
psspy.snap([329,118,9,0,0],out_files + str(counter) + '.snp')
# run simulation
run_dynamic_simulation(str(counter))
chnf = dyntools.CHNF(out_files + str(counter) + '.out')
test_data_extraction(chnf)
92
print(a, b, c, d, se)
for _ in range(5):
print("########################################")
return se
# 6. One trace in each subplot, more than one trace in one plot and all trace in one plot
for top five
def test_subplots_trace_all(chnfobj):
chnfobj.set_plot_page_options(size='letter', orientation='portrait')
chnfobj.set_plot_markers('square', 'triangle_up', 'thin_diamond', 'plus', 'x',
'circle', 'star', 'hexagon1')
chnfobj.set_plot_line_styles('solid', 'dashed', 'dashdot', 'dotted')
chnfobj.set_plot_line_colors('blue', 'red', 'black', 'green', 'cyan', 'magenta', 'pink',
'purple')
optnchn1 = {1:{'chns':{a:1}},2:{'chns':{b:1}}}
pn,x = os.path.splitext(a)
pltfile1 = pn+'.png'
figfiles1 = chnfobj.xyplots(optnchn1,optnfmt,pltfile1)
93
optnchn2 = {1:{'chns':{a:1, base_out:1}},
2:{'chns':{b:1, base_out:1}},
}
pn,x = os.path.splitext(b)
pltfile2 = pn+'.png'
figfiles2 = chnfobj.xyplots(optnchn2,optnfmt,pltfile2)
figfiles3 = chnfobj.xyplots(optnchn3,optnfmt,pltfile3)
figfiles = figfiles1[:]
figfiles.extend(figfiles2)
figfiles.extend(figfiles3)
if figfiles:
print 'Plot fils saved:'
for f in figfiles:
print ' ', f
def test6():
chnf = dyntools.CHNF(outlst)
test_subplots_trace_all(chnf)
94
chnf.plots_show()
if __name__ == '__main__':
FILE_PATH = r"C:\Users\guor\Desktop\PSSE_Python\output7"
counter = 1
# delete all files from last run
for root, dirs, files in os.walk(FILE_PATH):
for this_file in files:
os.remove(os.path.join(root, this_file))
# plot
file_list = glob.glob(r"C:\Users\guor\Desktop\PSSE_Python\output7\*.out")
biggest_number = 0
for file_path in file_list:
try:
file_number = int(file_path.split("\\")[-1][:-4])
if file_number > biggest_number:
biggest_number = file_number
95
except ValueError:
continue
solution_file_path = FILE_PATH + "\\" + str(biggest_number) + ".out"
print(solution_file_path)
# plot
outlst =[] # creat object
outlst.extend([r"C:\Users\guor\Desktop\PSSE_Python\output7\1.out",
solution_file_path])
print(outlst)
[a,b]=outlst
base_out =
r"""C:\Users\guor\Desktop\PSSE_Python\output7\IEEE68_full_system.out"""
outlst.append(base_out)
test6()
96
C.3 Powell Method
import os, sys, xlrd, random, re, os.path
import numpy as np
import matplotlib
import glob
import time
from scipy.optimize import minimize
vers = vdict.keys()
vers.sort()
k = vers[-1]
97
lver = vdict[k]
lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0,
_winreg.KEY_READ)
lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
_winreg.CloseKey(ptikey)
_winreg.CloseKey(lverkey)
return lverdir
pssedir = latest_psse_location()
pssedir = str(pssedir) # convert unicode to str
pssbindir = os.path.join(pssedir,'PSSBIN')
import redirect
redirect.psse2py()
import psspy
import dyntools
def prepare_dynamic_simulation():
ierr = psspy.psseinit(buses=150000)
psspy.case(savfile)
98
# Convert loads
psspy.conl(0,1,1,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,2,[0,0],[100.0,0.0,0.0,100.0])
psspy.conl(0,1,3,[0,0],[100.0,0.0,0.0,100.0])
# Convert generators
psspy.cong()
def col2array(book):
first_sheet = book.sheet_by_index(0)
cells = first_sheet.col_slice(colx=1, start_rowx=4)
col_list = []
for cell in cells:
col_list.append(cell.value)
col_array = np.asarray(col_list)
return col_array
def run_dynamic_simulation(snp):
99
print 'The snapshot file is', snp + '.'
process_id = os.getpid()
print("Process ID:{}".format(process_id))
psspy.lines_per_page_one_device(1,90)
psspy.progress_output(2,out_files + 'progress report ' + snp + '.txt',[0,0])
psspy.case(savcfile)
psspy.rstr(out_files + snp + '.snp')
psspy.dynamics_solution_param_2()
psspy.voltage_channel([1,17,1,27],"") # only add bus 154 voltage as channel 42 using
different API
psspy.strt(1,out_files + snp + '.out')
psspy.run(0, 1.0,1000,1,0)
psspy.dist_bus_fault(37,1, 345.0,[0.0,-0.2E+10])
psspy.run(0, 1.1,1000,1,0)
psspy.dist_clear_fault(1)
psspy.run(0, 10.0,1000,1,0)
psspy.lines_per_page_one_device(2,10000000)
psspy.progress_output(1,"",[0,0])
print 'Simulation finished at time', time.ctime()
print 'Dynamic simulation for SNP', snp + ' complete! \n\n'
# 1. Data extraction/information
def test_data_extraction(chnfobj):
def run_full_system():
100
psspy.psseinit(buses=80000)
psspy.read(0,r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_system_raw_data.
raw""")
psspy.fnsl([0,0,0,0,1,1,99,0])
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,2,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,3,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.ordr(0)
psspy.fact()
psspy.tysl(0)
psspy.save(out_files+'IEEE68_full_system_raw_data.sav')
psspy.lines_per_page_one_device(1,90)
psspy.progress_output(2,out_files+'progress report 0.txt',[0,0])
psspy.case(out_files+'IEEE68_full_system_raw_data.sav')
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_full_syste
m_dynamic_data.dyr""","","","")
psspy.dynamics_solution_param_2()
psspy.bsys(1,0,[0.0,0.0],0,[],1,[27],0,[],0,[])
psspy.chsb(1,0,[1,17,1,1,13,0])
psspy.snap([498,177,17,1,1],out_files+'IEEE68_full_system.snp')
psspy.case(out_files+'IEEE68_full_system_raw_data.sav')
psspy.rstr(out_files+'IEEE68_full_system.snp')
psspy.strt(0,out_files+'IEEE68_full_system.out')
psspy.run(0, 1.0,1000,1,0)
psspy.dist_bus_fault(37,1, 345.0,[0.0,-0.2E+10])
101
psspy.run(0, 1.1,1000,1,0)
psspy.dist_clear_fault(1)
psspy.run(0, 10.0,1000,1,0)
psspy.lines_per_page_one_device(2,10000000)
psspy.progress_output(1,"",[0,0])
chnf = dyntools.CHNF(out_files+'IEEE68_full_system.out')
test_data_extraction(chnf)
# Files Used
study_folder = r'C:\Users\guor\Desktop\PSSE_Python\\'
savfile = os.path.join(study_folder,'IEEE68_equivalent_system_data.sav')
out_files = r"""C:\Users\guor\Desktop\PSSE_Python\output8_3\\"""
savcfile = os.path.join(out_files,'IEEE68_equivalent_system_data_cnv.sav')
outfilepath = os.path.join(out_files,'*.out')
def losfunc(x):
global counter
# run base case
run_full_system()
# read base file
book = xlrd.open_workbook(out_files+'IEEE68_full_system.xlsx')
base_array = col2array(book)
book.release_resources()
del book
102
psspy.case(savfile)
[a,b,c,d]=x
if a < 0 or b < 0 or c <0 or d < 0:
return 10000000000000
0
psspy.dyre_new([1,1,1,1],r"""C:\Users\guor\Desktop\PSSE_Python\IEEE68_equivalent
_system_dynamic_data.dyr""","","","")
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",5, a)
psspy.change_plmod_con(53,r"""1""",r"""GENROU""",6, b)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",5, c)
psspy.change_plmod_con(61,r"""1""",r"""GENROU""",6, d)
psspy.snap([329,118,9,0,0],out_files + str(counter) + '.snp')
# run simulation
run_dynamic_simulation(str(counter))
chnf = dyntools.CHNF(out_files + str(counter) + '.out')
test_data_extraction(chnf)
103
for _ in range(5):
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print(a, b, c, d, se)
for _ in range(5):
print("########################################")
return se
# 6. One trace in each subplot, more than one trace in one plot and all trace in one plot
for top five
def test_subplots_trace_all(chnfobj):
chnfobj.set_plot_page_options(size='letter', orientation='portrait')
chnfobj.set_plot_markers('square', 'triangle_up', 'thin_diamond', 'plus', 'x',
'circle', 'star', 'hexagon1')
chnfobj.set_plot_line_styles('solid', 'dashed', 'dashdot', 'dotted')
chnfobj.set_plot_line_colors('blue', 'red', 'black', 'green', 'cyan', 'magenta', 'pink',
'purple')
optnchn1 = {1:{'chns':{a:1}},2:{'chns':{b:1}}}
pn,x = os.path.splitext(a)
pltfile1 = pn+'.png'
figfiles1 = chnfobj.xyplots(optnchn1,optnfmt,pltfile1)
104
handlelength=1.5, handletextpad=0.5, fontsize=8, frame=False)
figfiles2 = chnfobj.xyplots(optnchn2,optnfmt,pltfile2)
figfiles3 = chnfobj.xyplots(optnchn3,optnfmt,pltfile3)
figfiles = figfiles1[:]
figfiles.extend(figfiles2)
figfiles.extend(figfiles3)
if figfiles:
print 'Plot fils saved:'
for f in figfiles:
print ' ', f
def test6():
chnf = dyntools.CHNF(outlst)
105
test_subplots_trace_all(chnf)
chnf.plots_show()
if __name__ == '__main__':
FILE_PATH = r"C:\Users\guor\Desktop\PSSE_Python\output8_3"
counter = 1
# delete all files from last run
for root, dirs, files in os.walk(FILE_PATH):
for this_file in files:
os.remove(os.path.join(root, this_file))
# plot
file_list = glob.glob(r"C:\Users\guor\Desktop\PSSE_Python\output8_3\*.out")
biggest_number = 0
for file_path in file_list:
try:
file_number = int(file_path.split("\\")[-1][:-4])
106
if file_number > biggest_number:
biggest_number = file_number
except ValueError:
continue
solution_file_path = FILE_PATH + "\\" + str(biggest_number) + ".out"
print(solution_file_path)
# plot
outlst =[] # creat object
outlst.extend([r"C:\Users\guor\Desktop\PSSE_Python\output8_3\1.out",
solution_file_path])
print(outlst)
[a,b]=outlst
base_out =
r"""C:\Users\guor\Desktop\PSSE_Python\output8_3\IEEE68_full_system.out"""
outlst.append(base_out)
test6()
107