
This lecture is a short introduction to power system dynamics. It discusses the approximation of timevarying phasors, and reviews key aspects of the primary and secondary control methods.

This lecture introduces the DirectQuadratureZero (DQ0) transformation, shows how to use it to analyze linear networks, and discusses the relations between dq0 quantities and phasors.

This lecture presents a dynamic model of the synchronous machine. We demonstrate how to use this model in power system simulations, and explain the relations between the machine's dq0 model and timevarying phasor model.

This lecture focuses on management and control of energy storage devices. We explain how these devices are used for energy balancing, load leveling, peak shaving, and energy trading.
This is a free software tool for analyzing the dynamics of power systems based on dq0 signals. It is designed to simulate and analyze power systems that include several generators and loads, and possibly a large transmission network. The software provides tools for constructing dynamic models of the system components, and enables analysis in the frequency domain or the time domain. The manual (including tutorial) and software provide simple explanations and examples that can help one get started.
This software package supports:
 Dynamic analysis of largescale networks.
 Simulation of complete networks.
 Transient simulations.
 Smallsignal analysis.
To get started,
 Download the software files from MATLAB Central, and copy them to a directory of your choice, e.g., C:\DQ0 dynamics.
 Setup the directory in your MATLAB path. In the MATLAB, go to File > Set Path... and click on Add with Subfolders.... Now, select the directory that contains the DQ0 dynamics folder.
 Save the path for future MATLAB sessions (usually administrator privileges are necessary).
 For more advanced installation options please see the MANUAL.
We kindly request that publications derived from the use of this approach acknowledge this fact by citing reference(s) from the list below. Note: full text of the papers related to this research can be alternatively accessed here.
 R. Machlev, Z. Batushansky, S. Soni, V. Chadliev, J. Belikov, and Y. Levron, "Verification of utilityscale solar photovoltaic plant models for dynamic studies of transmission networks," Energies, 13(12), pp. 3191, 2020.
In recent years, there has been a growing need for accurate models that describe the dynamics of renewable energy sources, especially photovoltaic sources and wind turbines. In light of this gap, this work focuses on the validation of standard dynamic models developed by the Western Electricity Coordinating Council (WECC), using actual measurements from the Western Texas and Southern California transmission networks. The tests are based on the North American Electric Reliability Corporation compliance standards and include dynamic stability tests for voltvar control and primary frequency response. Through an extensive set of field tests, we show that the WECC generic models can be used to simulate real dynamic phenomena in largescale solar photovoltaic power plants, and we propose guidelines for correct usage of these models. The results show that the WECC models are especially accurate when the photovoltaic system is connected with a low impedance to the main network. We also show that the tested WECC models successfully predict the frequency response of an actual grid event that occurred in the Electric Reliability Council of Texas and which resulted in a loss of nearly 1.365 GW. This result supports the use of these models in the study of largescale dynamic phenomena that include renewable energy sources.
 N. Zargari, R. Ofir, Y. Levron, and J. Belikov, "Using dq0 signals based on the central angle reference frame to model the dynamics of largescale power systems," IEEE PES Innovative Smart Grid Technologies Europe, The Hague, The Netherlands, 2020.
With increasing penetration of distributed and renewable sources into power grids, the dynamic behavior of largescale power systems is becoming increasingly complex. These recent developments have led to several models attempting to simplify the analysis of dynamic phenomena, among them are models based on the dq0 transformation. A question that often arises when modeling interconnected systems based on dq0 quantities is how to choose the reference frame. One approach is to model the network and its components using a dq0 transformation that is based on a unified reference frame. However, when no generator is large enough to be considered an infinite bus, the unified reference frame may lead to unstable models, since the real frequency may deviate from the nominal frequency used as a reference. In this paper we propose to solve this problem by using the central angle as a basis for the dq0 transformation. Such an approach leads to models which are valid at high frequencies, and can also be used with systems with varying frequencies and no infinite bus. The proposed approach is demonstrated using networks with 9 and 57 buses.
 Y. Levron, V. Kaparin, and J. Belikov, "Analyzing the dynamics and stability of dq0 systems based on a portHamiltonian approach," Mediterranean Conference on Control and Automation, Akko, Israel, pp. 16, 2019.
Many open challenges are associated with the nonlinear behavior of largescale power systems, especially when such systems include small distributed generators and fast power electronics based devices. To better understand the complex dynamics of power systems, several authors suggest that such systems may be analyzed using portHamiltonian representations. In this work we extend this approach, and propose a portHamiltonian description for transmission networks which are modeled based on dq0 quantities. We present several results that show how to analyze the system stability and the behavior of the Hamiltonian. The results are demonstrated in several test cases.
 J. Belikov and Y. Levron, "Uses and misuses of quasistatic models in modern power systems," IEEE Transactions on Power Delivery, 33, pp. 32633266, 2018.
Quasistatic models, also known as timevarying phasor models, have been used for many years for dynamic analysis and stability studies in power systems. However, the long track of success of using these models in a broad spectrum of applications resulted in blurring the boundaries between uses and misuses of timevarying phasors. Specifically, one possible misconception is that quasistatic models are always accurate enough when the system dynamics are slow in comparison to the nominal system frequency. This letter shows that in some cases, this assumption is inaccurate and may lead to misleading conclusions regarding the system dynamics and stability.
 J. Belikov and Y. Levron, "A sparse minimalorder dynamic model of power networks based on dq0 signals," IEEE Transactions on Power Systems, 33, pp. 10591067, 2018.
Today the dq0 reference frame is mainly used for modeling and control of traditional electric machines and small power sources. A current challenge is to merge various dq0based models appearing in recent literature to obtain a complete model of a large power system. To this end, in this paper we propose a model describing the dynamics of large transmission networks based on dq0 quantities. The proposed model is based on a standard network topology, uses sparse system matrices, and is of minimal order. We also demonstrate how this model may be used to construct a smallsignal description of a complete system that includes the transmission network, generators, and loads. Results are illustrated on the basis of a long transmission line, and using the 118bus test case network. This paper is accompanied by a free software package.
 J. Belikov and Y. Levron, "Integration of long transmission lines in largescale dq0 dynamic models," Electrical Engineering, 100, pp. 12191228, 2018.
The dq0 transformation is increasingly used today to model distributed sources, complex loads, renewable generators, and power electronicsbased devices. This paper presents a dynamic model of long transmission lines that is based entirely on dq0 quantities, and demonstrates how such a model may be integrated with emerging dq0 models of largescale networks. The model is first developed in the frequency domain and then converted to the time domain, using a statespace representation which inputs and outputs are dq0 signals. The proposed approach may be used to evaluate the stability and dynamic behavior of power systems that include long transmission lines, taking advantage of the dq0 reference frame inherent benefits. This is demonstrated on the basis of a 7bus network, which shows how long transmission lines influence the network dynamics and stability. The proposed models and examples are provided as a part of an opensource software.
 D. Baimel, J. Belikov, J. M. Guerrero, and Y. Levron, "Dynamic modeling of networks, microgrids, and renewable sources in the dq0 reference frame: A survey," IEEE Access, 5, pp. 2132321335, 2017.
With increasing the penetration of distributed and renewable sources into power grids, and with increasing the use of power electronicsbased devices, the dynamic behavior of largescale power systems is becoming increasingly complex. These recent developments have led to several models attempting to simplify the analysis of dynamic phenomena, among them are models based on the dq0 transformation. Many recent works present dq0based models of various power system components, ranging from small renewable sources to complete networks. The purpose of this paper is to review and categorize these works, with an objective to promote a straightforward modeling and the analysis of complex systems, based on dq0 quantities. This paper opens by recalling basic concepts of the dq0 transformation and dq0based models. We then review several recent works related to dq0 modeling and analysis, considering the models of passive components, complete passive networks, synchronous machines, wind turbine systems, photovoltaic inverters, and others.
 Y. Levron and J. Belikov, "Opensource software for modeling and analysis of power networks in the dq0 reference frame," The 12th IEEE PES PowerTech Conference, Manchester, UK, pp. 16, 2017.
This paper joins the developing trend of modeling distributed generators based on dq0 quantities, and proposes an opensource software for modeling and analysis of largescale power networks based on dq0 signals. The dynamic models describing the network are provided as statespace objects that are sparse and of minimal order. The software supports integration of various models of synchronous machines, loads and renewable sources, and enables analysis of the complete system, including the feedback between the active units and the transmission network. In addition, functions are provided for computing timedomain transients, and for evaluating the system stability. The package contains several examples demonstrating modeling and stability analysis of small microgrids containing renewable sources, as well as of large networks with a variety of generators and loads.
 J. Belikov and Y. Levron, "Comparison of timevarying phasor and dq0 dynamic models for large transmission networks," International Journal of Electrical Power & Energy Systems, 93, pp. 6574, 2017.
In recent years, with increasing penetration of small distributed generators and fast power electronics based devices, the assumption of quasistatic phasors is becoming increasingly inaccurate. In order to describe fast dynamic behavior and rapid amplitude and phase variations, more accurate dynamic models based on the dq0 transformation are used. To better understand the differences between these two models, in this work we compare their relative accuracy when applied to largescale transmission networks. In this light, the present work describes the two types of models using similar terminology, which is based on dq0 quantities. Based on this result, we show that quasistatic models may be obtained from dq0 models at low frequencies, and that there exists a frequency range in which quasistatic model approximates the dq0 model well. The obtained results allow to estimate the frequency after which the quasistatic model cannot accurately describe the system dynamics, and dq0 models should be used instead.
 Y. Levron and J. Belikov, "Modeling power networks using dynamic phasors in the dq0 reference frame," Electric Power Systems Research, 144, pp. 233–242, 2017.
The dynamic behavior of large power systems has been traditionally studied by means of timevarying phasors, under the assumption that the system is quasistatic. However, with increasing integration of fast renewable and distributed sources into power grids, this assumption is becoming increasingly inaccurate. In this paper, we present a dynamic model of general transmission and distribution networks that uses dynamic phasors in the dq0 reference frame. The model is formulated in the frequency domain, and is based on the network frequency dependent admittance matrix. We also present a simplified version of this model that is obtained by a firstorder Taylor approximation of the dynamic equations. The proposed models extend the quasistatic model to higher frequencies, while employing dq0 signals that are static at steadystate, and therefore combine the advantages of high bandwidth and a welldefined operating point. The models are verified numerically using the 9, 30, and 118bus testcase networks. Simulations show that frequency responses of all models coincide at low frequencies and diverge at high frequencies. In addition, responses of the dq0 model in the time domain and in the abc reference frame are very close to those of the transient model.
 Y. Levron and J. Belikov, "Reduction of power system dynamic models using sparse representations," IEEE Transactions on Power Systems, 32, pp. 38933900, 2017.
This paper proposes a model reduction technique that simplifies the dynamic equations of complex power networks, using sparse representations of the system matrices. Instead of removing components from the state vector, elements from the system matrices are eliminated such that these matrices become sparse. This is achieved by three different numeric algorithms that approximate the original system model using fewer nonzero elements. These algorithms lead to simpler models, since the complexity of operations involving sparse matrices is primarily affected by the matrices density. Furthermore, this approach enables to identify significant dynamic relations between units in the network. The proposed methods are demonstrated on several testcase systems with 9 and 2383buses. In these examples, more than 90% of the elements in the system matrices are eliminated.
 N. R. Chowdhury, R. Ofir, N. Zargari, D. Baimel, J. Belikov, and Y. Levron, "Optimal control of lossy storage devices based on Pontryagin's Minimum Principle," IEEE Transactions on Energy Conversion, 2020.
We consider energy storage systems having nonlinear efficiency functions, which are becoming increasingly important as shown in several recent works, and propose an optimal solution based on Pontryagin's minimum principle. A central challenge in such problems is the hard limits on the state variable, which restrict the use of the minimum principle. To address this challenge, we propose to include the capacity constraints in the objective function with a proper weighting constant. We show that this approach allows formulation of the problem based on the classical minimum principle, and eventually leads to an efficient optimal control strategy. The proposed solution is compared to a dynamic programming algorithm. Numeric experiments reveal that for lossless storage devices dynamic programming is beneficial, since it enables fast and accurate solutions when a low number of samples is used. However, for lossy storage devices the situation is the opposite, and the minimum principle provides faster and more accurate solutions, since its computational complexity is almost unaffected by changes in the system parameters.
 Y. Levron and J. Belikov, "Control of energy storage devices under uncertainty using nonlinear feedback systems," PES General Meeting, Montreal, Canada, 2020.
We propose here a nonlinear control scheme for energy storage devices that is designed to operate under uncertainty conditions, but does not require a statistical representation of future signals. We first use Pontryagin's minimum principle to develop an optimal control law. This control law is shown to be unstable, and therefore only converges to the optimal solution if future values of the load signal are known. We then show a modified control law that is suboptimal but stable, and therefore can work efficiently without any information on future signals. This modified controller is shown to work well in several practical test cases.
 Y. Levron, N. Zargari, and J. Belikov, "Optimal control of energy storage devices based on Pontryagin's minimum principle and the shortest path method," Innovative Smart Grid Technologies Europe, Bucharest, Romania, pp. 15, 2019.
Optimal control strategies for storage devices have been extensively explored in recent years. Two leading approaches are solutions based on dynamic programming and solutions that stem from Pontryagin's minimum principle. Recent studies propose an optimal control strategy for storage devices which is based on the idea of the shortest path: the optimal generated energy must follow the shortest path within two bounds set by the load profile and the device capacity. The current paper continues these studies and shows that the shortest path principle may be derived directly from Pontryagin's minimum principle. This result is of theoretical interest since it demonstrates that the intuitive shortest path method can be easily extended to handle more complex systems. Based on this result we also develop a lowcomplexity algorithm for calculating the shortest path, which is tested in several case studies.
 A. Fahima, R. Ofir, J. Belikov, and Y. Levron, "Minimal energy storage required for stability of low inertia distributed sources," International Energy Conference, Limassol, Cyprus, pp. 15, 2018.
Recently there have been extensive research efforts to identify possible adverse effects of distributed sources and power electronics based devices when integrated into existing power grids, where two main challenges are low rotational inertia and stability. This paper studies the dynamics and stability of two simple systems: an ideal power source and a simple synchronous machine, both connected to an infinite bus. The objective in both cases is to determine analytically the minimal storage device that is necessary for stability. One objective of this analysis is educational  to demonstrate the crucial function of local energy storage as part of any power source, and specifically to show that ideal power sources are unstable when no local energy storage is present. Another objective is to approximate the size of local storage devices in practical designs, using simple analytic expressions and limited data.
 D. Akinyele, J. Belikov and Y. Levron, "Battery storage technologies for electrical applications: Impact in standalone photovoltaic systems," Energies, 10, pp. 139, 2017.
Batteries are promising storage technologies for stationary applications because of their maturity, and the ease with which they are designed and installed compared to other technologies. However, they pose threats to the environment and human health. Several studies have discussed the various battery technologies and applications, but evaluating the environmental impact of batteries in electrical systems remains a gap that requires concerted research efforts. This study first presents an overview of batteries and compares their technical properties such as the cycle life, power and energy densities, efficiencies and the costs. It proposes an optimal battery technology sizing and selection strategy, and then assesses the environmental impact of batteries in a typical renewable energy application by using a standalone photovoltaic (PV) system as a case study. The greenhouse gas (GHG) impact of the batteries is evaluated based on the life cycle emission rate parameter. Results reveal that the battery has a significant impact in the energy system, with a GHG impact of about 36–68% in a 1.5 kW PV system for different locations. The paper discusses new batteries, strategies to minimize battery impact and provides insights into the selection of batteries with improved cycling capacity, higher lifespan and lower cost that can achieve lower environmental impacts for future applications.
 Y. Levron, J. M. Guerrero, and Y. Beck, "Optimal power flow in microgrids with energy storage," IEEE Transactions on Power Systems, 28, pp. 32263234, 2013.
Energy storage may improve power management in microgrids that include renewable energy sources. The storage devices match energy generation to consumption, facilitating a smooth and robust energy balance within the microgrid. This paper addresses the optimal control of the microgrid's energy storage devices. Stored energy is controlled to balance power generation of renewable sources to optimize overall power consumption at the microgrid point of common coupling. Recent works emphasize constraints imposed by the storage device itself, such as limited capacity and internal losses. However, these works assume flat, highly simplified network models, which overlook the physical connectivity. This work proposes an optimal power flow solution that considers the entire system: the storage device limits, voltages limits, currents limits, and power limits. The power network may be arbitrarily complex, and the proposed solver obtains a globally optimal solution.
 Y. Levron and D. Shmilovitz, "Power systems' optimal peakshaving applying secondary storage," Electric Power Systems Research, 89, pp. 8084, 2012.
Energy storage devices can facilitate more efficient energy management by regulating the peak of generated power. Managing the stored energy usually presents a complicated optimization problem. In this paper, we show an optimal “peak shaving” strategy, that enables minimization of the power peak and derive an analytic design method for attaining optimal peak shaving. The analysis reveals the lowest possible peak, given only the load's demand profile and the storage capacity. The effects of losses in the storage device are analyzed numerically, showing the increase of power peak associated with the increase of loss.
 Y. Levron and D. Shmilovitz, "Optimal power management in fueled systems with finite storage capacity," IEEE Transactions on Circuits and Systems I: Regular Papers, 57, pp. 22212231, 2009.
Fueled power systems using secondary energy storage are analyzed. A generic model of such systems is suggested, and an optimal power management strategy that maximizes efficiency is derived analytically. The model and optimal management solution emphasizes the constraint imposed by finite storage capacity. The optimal generated energy is established independently of the system's capacity, and load, and general characteristics of it are derived and proved. The analytic solution provides an intuitive comprehension into the optimal power management, without needing numeric simulations.
 Y. Levron, J. Belikov, and D. Baimel, "A tutorial on dynamics and control of power systems with distributed and renewable energy sources based on the DQ0 transformation," Applied Sciences, 8, pp. 148, 2018.
In light of increasing integration of renewable and distributed energy sources, power~systems are undergoing significant changes. Due to the fast dynamics of such sources, the system is in many cases not quasistatic, and cannot be accurately described by timevarying phasors. In such systems the classic power flow equations do not apply, and alternative models should be used instead. In this light, this paper offers a tutorial on the dynamics and control of power systems with distributed and renewable energy sources, based mainly on the dq0 transformation. The paper opens by recalling basic concepts of dq0 quantities and dq0based models. We then explain how to model and analyze passive networks, synchronous machines, threephase inverters, and how to systematically construct dq0based models of complex systems. We also highlight the idea that dq0 models may be viewed as a natural extension of timevarying phasor models, and discuss the correct use and validity of each approach.
 D. Baimel, J. Belikov, J. M. Guerrero, and Y. Levron, "Dynamic modeling of networks, microgrids, and renewable sources in the dq0 reference frame: A survey," IEEE Access, 5, pp. 2132321335, 2017.
With increasing the penetration of distributed and renewable sources into power grids, and with increasing the use of power electronicsbased devices, the dynamic behavior of largescale power systems is becoming increasingly complex. These recent developments have led to several models attempting to simplify the analysis of dynamic phenomena, among them are models based on the dq0 transformation. Many recent works present dq0based models of various power system components, ranging from small renewable sources to complete networks. The purpose of this paper is to review and categorize these works, with an objective to promote a straightforward modeling and the analysis of complex systems, based on dq0 quantities. This paper opens by recalling basic concepts of the dq0 transformation and dq0based models. We then review several recent works related to dq0 modeling and analysis, considering the models of passive components, complete passive networks, synchronous machines, wind turbine systems, photovoltaic inverters, and others.
Yoash Levron The Andrew and Erna Viterbi Faculty of Electrical Engineering, Technion—Israel Institute of Technology, Haifa 3200003, Israel Email: Send Mail 
Juri Belikov Department of Software Science, Tallinn University of Technology, Akadeemia tee 15a, 12618 Tallinn, Estonia Email: Send Mail 