Manual Guide PLC
Manual Guide PLC
106,000+
3,250+ INTERNATIONAL 112+ MILLION
OPEN ACCESS BOOKS AUTHORS AND EDITORS DOWNLOADS
AUTHORS AMONG
BOOKS TOP 1% 12.2%
DELIVERED TO AUTHORS AND EDITORS
MOST CITED SCIENTIST FROM TOP 500 UNIVERSITIES
151 COUNTRIES
Chapter from the book MATLAB - A Ubiquitous Tool for the Practical Engineer
Downloaded from: http://www.intechopen.com/books/matlab-a-ubiquitous-tool-for-
the-practical-engineer
1. Introduction
During the last two decades, a number of research studies on the design of the excitation
controller of synchronous generator have been successfully carried out in order to improve
the damping characteristics of a power system over a wide range of operating points and to
enhance the dynamic stability of power systems (Kundur, 1994; Noroozi et.al., 2008;
Shahgholian, 2010). When load is changing, the operation point of a power system is varied;
especially when there is a large disturbance, such as a three-phase short circuit fault
condition, there are considerable changes in the operating conditions of the power system.
Therefore, it is impossible to obtain optimal operating conditions through a fixed excitation
controller. In (Ghandra et.al., 2008; Hsu & Liu, 1987), self-tuning controllers are introduced
for improving the damping characteristics of a power system over a wide range of operating
conditions. Fuzzy logic controllers (FLCs) constitute knowledge-based systems that include
fuzzy rules and fuzzy membership functions to incorporate human knowledge into their
knowledge base. Applications in the excitation controller design using the fuzzy set theory
have been proposed in (Karnavas & Papadopoulos, 2002; Hiyama et. al., 2006; Hassan et. al.,
2001). Most knowledge-based systems rely upon algorithms that are inappropriate to
implement and require extensive computational time. Artificial neural networks (ANNs)
and their combination with fuzzy logic for excitation control have also been proposed,
(Karnavas & Pantos, 2008; Salem et. al., 2000a, Salem et. al., 2000b). A simple structure with
only one neuron for voltage control is studied in (Malik et. al., 2002; Salem et. al., 2003). The
synergetic control theory (Jiang, 2009) and other nonlinear control techniques, (Akbari &
Amooshahi, 2009; Cao et.al., 2004), are also used in the excitation control.
One of the disadvantages of artificial intelligence methods and nonlinear control techniques
is the complexity of algorithms required for implementation in a digital control system. For
testing of these methods is much more convenient and easier to use software package
Matlab Simulink. So, this chapter presents and compares two methods for the excitation
control of a synchronous generator which are simulated in Matlab Simulink and compared
with conventional control structure. The first method is based on the neural network (NN)
which uses the back-propagation (BP) algorithm to update weights on-line. In addition to
www.intechopen.com
180 MATLAB – A Ubiquitous Tool for the Practical Engineer
the function of voltage control the proposed NN has the function of stabilizing generator
oscillations. The second method proposes a fuzzy logic controller (FLC) for voltage control
and the stabilization of generator oscillations. The proposed control algorithms with neural
networks and a fuzzy controller are tested on a simulation model of synchronous generator
weakly connected through transmissions lines to an AC network. The simulations are
carried out by step changes in voltage reference.
2. Simulation models
Simulation models of synchronous generator and different control structures are made in
Matlab Simulink. The generator is connected over transformer and transmission lines to the
AC network (Fig. 1).
AC
network
Xe
U
SG
equations of the generator in the rotating dq coordinate system, where u, i, r, x and Ψ denote
basis for the mathematical model of the synchronous generator is a system of voltage
1 dΨ d
−ud = r ⋅ id + ⋅ + ω ⋅ Ψq
ωs
(1)
dt
1 dΨ q
−uq = r ⋅ iq + ⋅ − ω ⋅ Ψd
ωs
(2)
dt
1 dΨ f
u f = rf ⋅ i f + ⋅
ωs dt
(3)
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 181
1 dΨ D
0 = rD ⋅ iD + ⋅
ωs dt
(4)
1 dΨ Q
0 = rQ ⋅ iQ + ⋅
ωs dt
(5)
The equations defining the relations between fluxes and currents are:
Ψ d = xd ⋅ id + x ad ⋅ i f + xdD ⋅ iD (6)
Ψ q = xq ⋅ iq + xqQ ⋅ iQ (7)
Ψ f = x ad ⋅ id + x f ⋅ i f + x fD ⋅ iD (8)
Ψ D = xdD ⋅ id + x fD ⋅ i f + xD ⋅ iD (9)
Ψ Q = xqQ ⋅ iq + xQ ⋅ iQ (10)
dδ
= ( ω − 1 ) ⋅ ωs (11)
dt
dω
⋅ (Tm − Te )
1
= (12)
dt 2 H
where δ is angular position of the rotor, ω is angular velocity of the rotor, ωs is synchronous
speed, H is inertia constant, Tm is mechanical torque, and Te is electromagnetic torque.
The electromagnetic torque of the generator Te is determined by equation:
Te = Ψ q ⋅ id − Ψ d ⋅ iq (13)
ud = id ⋅ re + ⋅ + ω ⋅ x e ⋅ iq + usd
ωs dt
x e did
(14)
uq = iq ⋅ re + ⋅ − ω ⋅ x e ⋅ id + usq
x e diq
ωs dt
(15)
www.intechopen.com
182 MATLAB – A Ubiquitous Tool for the Practical Engineer
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 183
w 1 Ud psid
w
Uq 0.05 re
1 Tm Tel psiq
Tm re
Umd psi
delta 0.35 xe
7
Delta xe
w,Tel,delta Umq
0.8 Xd 0.35 Xd1
2 Uf Ud,Uq Xd Xd 1
Uf Goto Umd,Umq
0.51 Xq 0.15 Xd2
3 Um Xq Xd2
Um Goto1
0.35 Xd1 Xq2
Id Idk
Xd1
I 5
I Iq Iqk 0.054 Td2
0.04 Xl Td2
P 3 Xl
P ID Idv Tq2
Q 4 0.04 R
Q IQ Iqv R
100*pi ws
U 6 Ikd,Ikq,Idv,Iqv 1.3 H
Id,Iq,ID,IQ ws
U
H
If 2
If [psid]
Tf
S From7 Xfd=f(psid)
Parameters K,L,M,N,I,P Yd11,Yd12,Yd13 Yq11,Yq12
I,P,Q,S,U,If Yd21,Yd22,Yd23 Yq21,Yq22,
Yd31,Yd32,Yd33 Ad,Bd,Cd,Aq,Bq 0.55
Td01
If
U
Co n tro l loop
G
~
ua b
Clarke ucb
A B C
w
Mechanical torque
[Tm] Tm
Uref If
U
P
Compensation Ifref Ifref
[U] Ug 10 Kp Exitation current
[Q] Q U [If] If D D Uf Uf Q
0.05 K 10 Ki
Kp Chopper
10
PI voltage I
controller
P type excitation
controller
U
1 Um
AC network
voltage Delta
Synchronous
generator
www.intechopen.com
184 MATLAB – A Ubiquitous Tool for the Practical Engineer
For supplying the generator excitation current, an AC/DC converter is simulated. The
AC/DC converter includes a three-phase bridge rectifier, a DC link with a detection of DC
voltage, a braking resistor, and a DC chopper (Fig. 5).
DC link overvoltage
R V1 V4 [UDC] -1
3 x 400 V
protection
C UDC sw1
1
V5 V3 V2 G Uf
~ U=f(D)
1
<
D 0.30 AND
1
[If]
0.01s+1 >
0.05
PWM If
(a) (b)
Fig. 5. AC/DC converter for supplying generator excitation current (a) and simulation
model (b)
b1
b2
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 185
1
1
0.5
Output 0.8
Output
0 0.6
0.4
−0.5
0.2
−1
0
−4 −2 0 2 4 −4 −2 0 2 4
Input Input
ψ (v ) = −1
1
1 + e − cv
(18)
ψ ′(v ) = c = c ⋅ (1 − ψ 2 )
4 e −2 cv
(1 + e −2 cv )2
(19)
The NN uses a simple procedure to update weights on-line and there is no need for any off-
line training. Also, there is no need for an identifier and/or a reference model. The NN is
trained directly in an on-line mode from the inputs and outputs of the generator and there is
no need to determine the states of the system. The NN uses a sampled value of the machine
quantities to compute the error using a modified error function. This error is back-
propagated through the NN to update its weights using the algorithm shown in Fig. 8.
When the weights are adjusted, the output of the neural network is calculated.
W1,Θ1 y1
∑ φ(*)
Two layer feedforward
Neural network
∑ φ(*)
X1
v2 W2,Θ 2
∑ φ(*) y2 o1
X2
∑ φ(*)
∑ φ(*)
Xp
∑ φ(*)
∑ φ(*)
φ´(*) φ´(*)
X ∑
v
e1
X ∑
X ∑
Back
propagation
X ∑
X ∑
X ∑
δ(1) δ(2)
www.intechopen.com
186 MATLAB – A Ubiquitous Tool for the Practical Engineer
Training of the NN with the BP algorithm is described in (Haykin, 1994). Inputs and outputs
of one neuron in the NN can be determined as follows:
y ki = ψ ⎜ ∑ wkij ⋅ x kj + b1 ⎟
⎛ ⎞
⎝ k ⎠
(20)
The BP algorithm is an iterative gradient algorithm designed to minimize the mean square
error between the actual output and the NN desired output. This is a recursive algorithm
starting at the output neuron and working back to the hidden layer adjusting the weights
according to the following equations:
The error function commonly used in the BP algorithm can be expressed as:
ℑ= ( tki − y ki )
1 2
(24)
2
If the neuron is in the output layer, the error function is:
∂ℑ
= t ki − y ki
∂y ki
(25)
If the neuron is in the hidden layer, the error function is recursively calculated as (Haykin,
1994):
= ∑
∂ℑ n( k +1) ∂ℑ
⋅ψ k′+1,p ⋅ wk +1,1,i
∂y ki p =1 ∂y k + 1, p
(26)
If the NN is used for the excitation control of a synchronous generator, it is required that we
not only change the weights based only on the error between the output and the desired
output but also based on the change of the error as follows:
∂ℑ
= ( t ki − y ki ) − ki
dy
∂y ki
(27)
dt
In this way, the modified error function speeds up the BP algorithm and gives faster
convergence. Further, the algorithm becomes appropriate for the on-line learning
implementation. The error function for the NN used for voltage control is expressed as:
∂ℑ
= K (U ref − U ) − k1
dU
∂y ki
(28)
dt
In order to perform the power system stabilization, the active power deviation ΔP and the
derivation of active power dP/dt are to be imported in the modified error function. The
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 187
complete modified error function for the excitation control of a synchronous generator is
given as follows:
∂ℑ ⎡ dU ⎤ ⎡ dP ⎤
= K (U ref − U ) − k1 − k3 ( ΔP ) + k2
∂y ki ⎢⎣ dt ⎥⎦ ⎢⎣ dt ⎥⎦
(29)
The modified error function is divided into two parts. The first part is used for voltage
control and the second part for power system stabilization. Parameters K, k1, k2 and k3 are
given in Table 2. Simulation model of NN control structure is shown in Fig. 9.
K 2.5
k1 0.3
k2 0.6
k3 0.25
Table 2. Parameters of neural network
Mechanical torque w
[Tm] Tm
If
Uref
P
U Ifref Ifref
Compensation
[U]
Ug
[Q] Q U P [If] If D D Uf Uf Q
K
0.05
Neural network Chopper
10 Kp
voltage I
[P] controller
P type excitation
controller
U
1 Um
AC network
voltage Delta
Synchronous
generator
www.intechopen.com
188 MATLAB – A Ubiquitous Tool for the Practical Engineer
voltage control and the second one is the damping control loop with the function of a power
system stabilizer. A fuzzy polar control scheme is applied to these two control loops.
U
- F uzzy logic Um a x v + 2 p.u. I
U re f + e(k) u(k) fre f
control
e d(k) 2 p.u.
+ rules 0 p.u. + 0 p.u.
D K iv I
usta b (k) 0 p.u.
a -P
+Umaxs R
F uzzy logic
control rules ∆ω
-Umaxs R I R-res et filter
As ⋅ Y (k )
Θ(k ) = arctg( ) (32)
X (k )
The phase plane is divided into sectors A and B defined by using two angle membership
functions N(Θ(k)) and P(Θ(k)) (Fig. 11b).
The principles of the fuzzy control scheme and the selection of the membership functions
are described in (Hiyama et. al., 1996). By using the membership functions N(Θ(k)) and
P(Θ(k)) the output control signals u(k) and ustab(k) for each control loop are given as follows:
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 189
α
N (Θ ) P (Θ )
(a) (b)
Fig. 11. Phase plane (a) and angle membership functions (b)
N (Θ(k )) − P(Θ(k ))
u(k ) = ⋅ G(k ) ⋅ U max v
N (Θ(k )) + P(Θ(k ))
(33)
N (Θ(k )) − P(Θ(k ))
ustab (k ) = ⋅ G(k ) ⋅ U max s
N (Θ(k )) + P(Θ(k ))
(34)
and α for the voltage control loop and the damping control loop are given in Tables 3 and 4.
control structure are presented on the Figs. 12, 13, and 14, respectively. Parameters As, Dr
As 0.1
Dr 1
Kiv 10
α
Umaxv 2 p.u.
90°
Table 3. FLC parameters for voltage control loop
As 0.01
Dr 0.01
Umaxs 0.1 p.u.
α 90°
Table 4. FLC parameters for damping control loop
www.intechopen.com
190 MATLAB – A Ubiquitous Tool for the Practical Engineer
e [theta] N_theta
1 s
Uref ed N(theta)
s+1
2
[theta] P_theta
U
P(theta)
2
[e] u [Dv] Gv
G(D)
sqrt Dv
[ed]
2
u [ed] ed
3
Asv [e] e theta theta
[theta1] theta1
Quadrant
[ed] atan 180/pi theta1 calculation
[e]
1 [Gv]
2
1 1
2
[P_theta] 4 s Ifref
Kiv
[thetas] N_thetas 2
[dw] u
N(theta)1
sqrt Ds
[thetas] P_thetas [a]
2
u
P(theta)1 3
Ass
[Ds] Gs
G(D)1
2 dw
dw
Goto8
1 [Gs]
[a] a
2 1
Ustab
[dw] dw thetas thetas 0.1
[P_thetas]
[theta1s] theta1s
Quadrant
calculation
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 191
Mechanical torque w
[Tm] Tm
Uref If
U
[P] P P
Ifref Ifref
0.1 Asv
Compensation
[U] 0.01 Ass
Ug
[If] If D D Uf Uf Q
[Q] Q U 10 Ki
K Fuzzy voltage
0.05 Chopper
controller 10 Kp
I
P type excitation
controller
U
1 Um
AC network
voltage Delta
Synchronous
generator
3. Simulation results
In order to verify the performance of the proposed control structures several simulations
were carried out. In these experiments, voltage reference is changed in 0.1 s from 1 p.u. to
0.9 p.u. or 1.1 p.u. and in 1 s back to 1 p.u. at a constant generator active power.
For the quality analysis of the active power oscillations two numerical criteria are used: the
integral of absolute error (IAE) and the integral of absolute error derivative (IAED). If the
response is better, the amount of criteria is smaller.
Fig. 15 presents active power responses for step changes in voltage reference from 1 p.u. to
0.9 p.u. and back to 1 p.u. at an active power of 0.5 p.u. The numerical criteria of the
responses in Fig. 15 are given in Table 5.
Fig. 15. Active power responses for step changes in voltage reference 1 p.u.-0.9 p.u.-1 p.u. at
an active power of 0.5 p.u.
www.intechopen.com
192 MATLAB – A Ubiquitous Tool for the Practical Engineer
IAE IAED
CCS 0.389 0.279
FLC 0.255 0.097
NN 0.235 0.090
Table 5. Numerical criteria for step changes in voltage reference 1 p.u.-0.9 p.u.-1 p.u. at an
active power of 0.5 p.u.
Fig. 16 shows active power responses for step changes in voltage reference from 1 p.u. to 1.1
p.u. and back to 1 p.u. at an active power of 0.5 p.u. The numerical criteria of the responses
in Fig. 16 are given in Table 6.
Fig. 16. Active power responses for step changes in voltage reference 1 p.u.-1.1 p.u.-1 p.u. at
an active power of 0.5 p.u.
IAE IAED
CCS 0.264 0.196
FLC 0.202 0.092
NN 0.192 0.091
Table 6. Numerical criteria for step changes in voltage reference 1 p.u.-1.1 p.u.-1 p.u. at an
active power of 0.5 p.u.
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 193
Fig. 17 presents active power responses for step changes in voltage reference from 1 p.u. to
0.9 p.u. and back to 1 p.u. at an active power of 0.8 p.u. The numerical criteria of the
responses in Fig. 17 are given in Table 7.
Fig. 17. Active power responses for step changes in voltage reference 1 p.u.-0.9 p.u.-1 p.u. at
an active power of 0.8 p.u.
IAE IAED
CCS 0.52 0.373
FLC 0.248 0.114
NN 0.219 0.106
Table 7. Numerical criteria for step changes in voltage reference 1 p.u.-0.9 p.u.-1 p.u. at an
active power of 0.8 p.u.
Fig. 18 shows active power responses for step changes in voltage reference from 1 p.u. to 1.1
p.u. and back to 1 p.u. at an active power of 0.8 p.u. The numerical criteria of the responses
in Fig. 18 are given in Table 8.
www.intechopen.com
194 MATLAB – A Ubiquitous Tool for the Practical Engineer
Fig. 18. Active power responses for step changes in voltage reference 1 p.u.-1.1 p.u.-1 p.u. at
an active power of 0.8 p.u.
IAE IAED
CCS 0.312 0.234
FLC 0.130 0.097
NN 0.119 0.090
Table 8. Numerical criteria for step changes in voltage reference 1 p.u.-1.1 p.u.-1 p.u. at an
active power of 0.8 p.u.
Based on the numerical criteria it can be concluded that the neural network-based controller
with stabilization effect in the criteria function has two to three percent better damping of
oscillations than the fuzzy logic controller.
4. Conclusion
Three different structures for the excitation control of a synchronous generator were
simulated in Matlab Simulink: the first structure is a conventional control structure which
includes a PI voltage controller, while the second structure includes a fuzzy logic controller,
and the third structure includes a neural network-based voltage controller. Performances of
the proposed algorithms were tested for step changes in voltage reference in the excitation
system of a synchronous generator, which was connected to an AC network through a
transformer and a transmission line.
For the performance analysis of the proposed control structures two numerical criteria were
used: the integral of absolute error and the integral of absolute error derivative. In the
comparison with the PI voltage controller neural network-based controller and the fuzzy
logic controller show a significant damping of oscillations. It is important to emphasize that
www.intechopen.com
Synchronous Generator Advanced Control Strategies Simulation 195
the stabilizer was not used in the conventional control structure, which would definitely
reduce the difference between the conventional and the proposed control structures.
The simulation results show justification for the use of the advanced control structure based
on neural networks and fuzzy logic in the excitation control system of a synchronous
generator. Also, using the software package Matlab Simulink allows users to easily test the
proposed algorithms.
5. References
Akbari, S., & Karim Amooshahi, M. (2009). Power System Stabilizer Design Using
Evolutionary Algorithms, International Review of Electrical Engineering, 4, 5, (October
2009), pp. 925-931.
Cao, Y., Jiang, L., Cheng, S., Chen, D., Malik, O.P., & Hope, G.S. (1994). A nonlinear variable
structure stabilizer for power system stability, IEEE Transactions on Energy
Conversion, 9, 3, (1994), pp. 489-495.
Ghandra, A., Malik, & O. P., Hope, G.S. (1988). A self-tuning controller for the control of
multi-machine power systems, IEEE Trans. On Power Syst., 3, 3, (August 1988), pp.
1065-1071.
Hassan, M.A., Malik, O.P., & Hope, G.S. (1991). A Fuzzy Logic Based Stabilizer for a
Synchronous Machine, IEEE Trans. Energy Conversion, 6, 3, (1991), pp. 407-413.
Haykin, S. (1994). Neural Networks: A Comprehensive Foundation, IEEE Press
Hiyama T., Oniki S., & Nagashima H. (1996). Evaluation of advanced fuzzy logic PSS on
analog network simulator and actual installation on hydro generators, IEEE Trans.
on Energy Conversion, 11, 1, (1996), pp. 125-131.
Hsu, Y.Y., & Liou, K.L. (1987). Design of self-tuning PID power system stabilizers for
synchronous generators, IEEE Trans. on Energy Conversion, 2, 3, (1987), pp. 343-
348.
Jiang, Z. (2009). Design of a nonlinear power system stabilizer using synergetic control
theory, Electric Power Systems Research, 79, 6, (2009), pp. 855-862.
Karnavas, Y.L., & Pantos, S. (2008). Performance evaluation of neural networks for µC
based excitation control of a synchronous generator, Proceedings of 18th
International Conference on Electrical Machines ICEM 2008, Portugal, September
2008.
Karnavas, Y.L., & Papadopoulos, D. P. (2002). AGC for autonomous power system using
combined intelligent techniques, Electric Power Systems Research, 62, 3, (July 2002),
pp. 225-239.
Kundur, P. (1994). Power System Stability and Control, McGraw-Hill
Malik, O.P., Salem, M.M., Zaki, A.M., Mahgoub, O.A., & Abu El-Zahab, E. (2002).
Experimental studies with simple neuro-controller based excitation controller,
IEE Proceedings Generation, Transmission and Distribution, 149, 1, (2002), pp. 108-
113.
Noroozi, N., Khaki, B., & Seifi, A. (2008). Chaotic Oscillations Damping in Power System by
Finite Time Control, International Review of Electrical Engineering, 3, 6, (December
2008), pp. 1032-1038.
www.intechopen.com
196 MATLAB – A Ubiquitous Tool for the Practical Engineer
Salem, M.M., Malik, O.P., Zaki, A.M., Mahgoub, O.A., & Abu El-Zahab, E. (2003).
Simple neuro-controller with modified error function for a synchronous
generator, Electrical Power and Energy Systems, 25, (2003), pp. 759-771.
Salem, M.M., Zaki, A.M., Mahgoub, O.A., Abu El-Zahab, E., & Malik, O.P. (2000a).
Studies on Multi-Machine Power System With a Neural Network Based
Excitation Controller, Proceedings of Power Engineering Society Summer Meeting,
2000.
Salem, M.M., Zaki, A.M., Mahgoub, O.A., Abu El-Zahab, E., & Malik, O.P. (2000b).
Experimental Veification of Generating Unit Excitation Neuro-Controller,
Proceedings of IEEE Power Engineering Society Winter Meeting, 2000.
Shahgholian, G. (2010). Development of State Space Model and Control of the
STATCOM for Improvement of Damping in a Single-Machine Infinite-Bus,
International Review of Electrical Engineering, 5, 1, (February 2010), pp. 1367-1375.
www.intechopen.com
MATLAB - A Ubiquitous Tool for the Practical Engineer
Edited by Prof. Clara Ionescu
ISBN 978-953-307-907-3
Hard cover, 564 pages
Publisher InTech
Published online 13, October, 2011
Published in print edition October, 2011
A well-known statement says that the PID controller is the “bread and butter†of the control engineer. This
is indeed true, from a scientific standpoint. However, nowadays, in the era of computer science, when the
paper and pencil have been replaced by the keyboard and the display of computers, one may equally say that
MATLAB is the “bread†in the above statement. MATLAB has became a de facto tool for the modern
system engineer. This book is written for both engineering students, as well as for practicing engineers. The
wide range of applications in which MATLAB is the working framework, shows that it is a powerful,
comprehensive and easy-to-use environment for performing technical computations. The book includes
various excellent applications in which MATLAB is employed: from pure algebraic computations to data
acquisition in real-life experiments, from control strategies to image processing algorithms, from graphical user
interface design for educational purposes to Simulink embedded systems.
How to reference
In order to correctly reference this scholarly work, feel free to copy and paste the following:
Damir Sumina, Neven Bulić, Marija Mirošević and Mato Mišković (2011). Synchronous Generator Advanced
Control Strategies Simulation, MATLAB - A Ubiquitous Tool for the Practical Engineer, Prof. Clara Ionescu
(Ed.), ISBN: 978-953-307-907-3, InTech, Available from: http://www.intechopen.com/books/matlab-a-
ubiquitous-tool-for-the-practical-engineer/synchronous-generator-advanced-control-strategies-simulation