THESIS DESIGN OF CONTROL TOOLS FOR USE IN MICROGRID SIMULATIONS Submitted by Avpreet Singh Othee Department of Electrical and Computer Engineering In partial fulfillment of the requirements For the Degree of Master of Science Colorado State University Fort Collins, Colorado Summer 2018 Master’s Committee: Advisor: Peter M. Young Daniel Zimmerle George Collins Copyright by Avpreet Singh Othee 2018 All Rights Reserved ABSTRACT DESIGN OF CONTROL TOOLS FOR USE IN MICROGRID SIMULATIONS New technologies are transforming the way electricity is delivered and consumed. In the past two decades, a large amount of research has been done on smart grids and microgrids. This can be attributed to two factors. First is the poliferation of internet. Internet today is as ubiquitous as electricity. This has spawned a new area of technology called the internet of things (IoT). It gives us the ability to connect almost any device to the internet and harness the data. IoT finds use in smart grids that allow utiliy companies to deliver electricity efficiently. The other factor is the advancement in renewable sources of electricty and high power semiconductors coupled with their decreasing cost. These new sources disrupt the traditional way of electicity production and delivery, putting an increased focus on distributed power generation and microgrids. A microgrid is different from a utility grid. The difference is in the size of the grid, power level, a variety of possible sources and the way these are tied together. These characteristics lead to some unique control challenges. Today’s appliances and consumer goods are powered using a standardized AC power. Thus a microrid must deliver uninterrupted and high quality power while at the same time taking into account the vastly different nature of the microsurces that produce the power. This work describes control system tools for different power converters that will be used in simulating microgrids. Simulations are important tool for any researcher. It allows researchers to test their research and theories at a greatly reduced cost. The process of design, testing and verification is an iterative process. Simulations allow a cost effective method of doing research, substituting the actual pro- cess of building experimental systems. This greatly reduces the amount of manpower and capital investment. A microgrid consists of several building blocks. These building blocks can be categorized into microsources, energy stores, converters and the loads. Microsources are devices that produce elec- ii tric power. For example, a photovoltaic panel is a mirosource that produces DC power. Converters act as an interface between microsources and the grid. The constituent chapters in the document describe microsources and converters. The chapters describe the underlying control system and the simulation model of the system designed in Simulink. Some of the tools described are derived from the MATLAB/Simulink Examples library. Origi- nal authors of the simulation models and systems have been duly credited. Colorado State Univer- sity has a vibrant research community. The tools described in this thesis are geared to be used for research into microgrids. The tools are developed in a simulation software called Simulink. The tools would allow future researchers to rapidly build microgrid simulations and test new control system implementations etc. The research described in the thesis builds upon the research by Han on natural gas engine based microgrid [1]. The control tools described here are used to construct a microgrid simulation. The microgrid is built around a natural gas engine. Due to the transport lag in delivering fuel, a natural gas engine exhibits significant deviation in the AC grid frequency when subjected to step load. The microgrid setup along with the control system described here, minimizes the frequency deviation, thus stabilizing the microgrid. Simulation results verify the working of the tools . iii ACKNOWLEDGEMENTS I would like to thank my advisor Dr. Peter Young for his guidance and valuable insights. This work would would not have been possible without his feedback, constructive criticism and oversight. I enjoyed the ocassional side talks about random topics that broadened my horizon and giving a personal touch to the job. I would also like to thank members of my committee Dr. Daniel Zimmerle and Dr. George Collins for their for their oversight, comments and thoughtful questions. I would like to thank Daniel Luckner for his support. I would especially like to thank Dr. Hamidreza Chitsaz for his support and letting me be a part of the CSU Robocup team. It has been a wonderful experience. It gave me an oppurtunity to interact with people from varied backgrounds and helped me explore the world of computer science. Lastly I would like to thank my parents for their continued support and their unwavering faith in me. I would especially like to thank my sister for always being there to support me. Avpreet Singh Othee iv DEDICATION To my parents. Avtar and Preet v TABLE OF CONTENTS ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii ACKNOWLEDGEMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv DEDICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Simulink Simulation Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Document Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Chapter 2 Microgrid Topologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 DC Bus Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 AC Bus Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Chapter 3 Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.1 Engine Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2 Synchronous Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 AC grid frequency control as a power control technique . . . . . . . . . . 20 3.4 Multiple Generator Operation . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4.1 Generator Synchronization . . . . . . . . . . . . . . . . . . . . . . . . 25 Chapter 4 Photvoltaic Power System . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1 Maximum Power Point Tracking . . . . . . . . . . . . . . . . . . . . . . . 29 Chapter 5 Battery Storage System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.1 Battery Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.2 Battery Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 vi 5.2.1 Lithium-ion Battery Charging Algorithm . . . . . . . . . . . . . . . . . 38 5.2.2 Battery Controller Implementation in Simulink . . . . . . . . . . . . . 39 Chapter 6 Universal Bridge Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.1 Reference frame theory and direct quadrature zero transformation . . . . . 43 6.2 Three-phase Bridge Converter . . . . . . . . . . . . . . . . . . . . . . . . 45 6.3 Three-phase bridge converter as a PWM Rectifier . . . . . . . . . . . . . . 47 6.3.1 Unity power factor condition . . . . . . . . . . . . . . . . . . . . . . . 48 6.3.2 Rectifier Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.4 Three-phase bridge converter as a grid forming inverter . . . . . . . . . . . 51 6.4.1 Inverter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6.5 Three-phase bridge converter as a Grid Following / Grid Supporting Inverter 53 6.5.1 Inverter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Chapter 7 Microgrid Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 7.1 Natural Gas Engine Based Microgrid with attached Storage System . . . . 61 7.2 Optimized settings for simulation . . . . . . . . . . . . . . . . . . . . . . 67 7.2.1 Power Electronics Devices modeling . . . . . . . . . . . . . . . . . . . 68 7.2.2 Miscellaneous settings . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Chapter 8 Conclusion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . 70 8.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 8.1.1 Hardware-In-the-Loop Testing . . . . . . . . . . . . . . . . . . . . . . 71 8.1.2 Use of alternate storage technologies . . . . . . . . . . . . . . . . . . . 72 8.1.3 Robust MIMO Control of the microgrid . . . . . . . . . . . . . . . . . 73 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Appendix A MPPT Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 vii Appendix B PID Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Appendix C Additional tools and some implementations . . . . . . . . . . . . . . . . . . 83 Appendix D Summary of important library components . . . . . . . . . . . . . . . . . . . 85 viii LIST OF TABLES 5.1 Li-ion battery specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 7.1 Microgrid system specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ix LIST OF FIGURES 1.1 Simulink Simulation model Description . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1 DC Bus Topology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 AC Bus Topology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.1 Natural gas engine Simulink model. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2 Natural gas engine Simulink model. . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3 Natural gas engine control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.4 Natural gas engine response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.5 Diesel engine response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.6 Synchronous generator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.7 Synchronous generator implementation in Simulink. . . . . . . . . . . . . . . . . . . . 20 3.8 Fequency droop control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1 Equivalent circuit of a PV cell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2 PV Voltage Current Curves. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.3 Boost converter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.4 PV MPPT controller in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5 Power output with and without MPPT controller. . . . . . . . . . . . . . . . . . . . . 34 4.6 PV panel ouput power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.1 Discharge curve for the battery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.2 Lithium-ion battery charging sequence. . . . . . . . . . . . . . . . . . . . . . . . . . 39 5.3 Battery controller with converter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.4 Battery controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.5 Battery Controller GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.6 Battery charging curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 x 6.1 ABC to dq0 transformation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.2 Three-phase bridge converter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.3 Voltage and current axis in dq0 reference frame. . . . . . . . . . . . . . . . . . . . . . 49 6.4 Rectifier Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.5 Rectifier Outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.6 Grid Forming inverter control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6.7 Grid forming inverter outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.8 Grid supporting inverter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.9 Grid supporting inverter Simulink implementationl . . . . . . . . . . . . . . . . . . . 56 6.10 Grid supporting inverter controller GUI . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11 Grid supporting inverter outputsl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 7.1 Natural Gas Engine powered generator output. . . . . . . . . . . . . . . . . . . . . . . 60 7.2 Microgrid control with attached storage systeml . . . . . . . . . . . . . . . . . . . . . 61 7.3 Simulink implementation of the microgrid . . . . . . . . . . . . . . . . . . . . . . . . 64 7.4 Microgrid control with attached storage systeml . . . . . . . . . . . . . . . . . . . . . 65 7.5 Microgrid power share . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 7.6 Battery State of Charge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 C.1 Generator with accomapnying controllers . . . . . . . . . . . . . . . . . . . . . . . . 83 C.2 Batterty controller example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 xi Chapter 1 Introduction It is impossible to imagine modern human civilization without electricity. Utility grids have been the backbone of the energy infrastructure and have largely been unchanged since they were first introduced at the beginning of twentieth century. Utility grid due to its’ centralized nature has some disadvantages. A recent example would be Hurricane Maria that hit the island of Puerto Rico in the fall of 2017. It knocked down most of the island’s electricity grid, rendering almost all the island without power [2]. The issues associated with a centralized grid can be addressed by using distributed sources of energy and decentralizing the electricity grid. Recently, investment in renewable sources has gained a lot of momentum. Advancement in technologies that tap into these renewable sources have transformed the way electricity is consumed. Microgrids that utilize these renewable sources, combined with conventional sources have increasingly been used to mitigate the drawbacks associated with a conventional centralized utility grid. Microgrids installed in some locations in Puerto Rico continued to work even after the utility grid was down. A microgrid is an enveloping term that refers to an electrical installation that might or might not be connected to the utility grid, but in itself has all the components of a grid. Microgrids are installed in remote areas that do not have access to the utility grid. Microgrids are also implemented in sensitive installations such as hospitals, airports etc. that require an uninterrupted power, even in the event of an outage in the utility grid. Microgrids may be installed in areas that have an abundance of one type of natural resource. A microgrid that can tap into such varied sources of energy leads to some interesting design challenges. This thesis is a small contribution towards solving those challenges. This thesis describes the development of control systems in a commercial simulation software package. The control tools are aimed at design and simulation of power systems in microgrid. The text describes a simulation of a microgrid built around a natural gas engine. Potential application of such a microgrid would be in an off-site installation that has an easy access to natural gas. 1 It describes a proposed control system for this type of microgrid, and details construction of a simulation, utilizing the control tools described in the constituent chapters. Various simulation software are available that can simulate electrical power systems and cir- cuits. One such software is the MATLABTM SimulinkTM Simscape Power Systems, Specialized Technology. It is a set of specialized components and algorithms intended to be used in simulation of electrical power systems and power electronic devices [3]. The Specialized Technology com- ponents library is developed by Hydro-Quèbec. Using the library one can implement and simulate power systems. The Simulink environment can be used to implement control system that inte- grates with the power system components. Other simulation and data acquisition tools available in Simulink , coupled with MATLAB’s toolboxes makes the Simulink a suitable choice for simulat- ing control systems for electrical systems. The tools described here builds upon work done by Han and Dr. Peter Young at Colorado State University. Some tools are a derived from the examples in “Simulink Simscape Sim Power Systems, Specialized Technology Toolbox”. 1.1 Simulink Simulation Setup A simulation is a replication of physical phenomenon or real world systems in a virtual setting. Physical systems are characterized by mathematical expressions (differential and algebraic equa- tions) that are solved to get outputs, referred to as simulated outputs. In Simulink environment, these systems are arranged as visual blocks representing systems mimicking physical systems. Data flow between these systems is shown by interconnecting paths representing flow of data. The system is solved by a solver engine using numerical integration techniques. User can specify parameters for the engine such as, solver step time, solver type etc. Simulation is stored in a model file. The model file stores all the information about the con- stituent subsystems and models in an XML format [4]. The building blocks of a Simulink simu- lation are Simulink blocks. A block is analogous to a function. Figure 1.1a shows a hierarchical visual breakdown of a simulation with various subsystems. The bottommost layer in the figure represents the simulation. The subsystem mask is a visual depiction of a subsystem. User inter- 2 acts with the mask when implementing the subsystem. The mask contains all the parameters and model specific values. These parameters give the user a high level of flexibility in customizing the subsystem to suit the simulation requirements. Figure 1.1b shows an actual subsystem mask along with the block parameters dialog box. The parameters can be assigned default values that can be changed later as desired. Simulink Sim Power Systems Specialized Technology Components Working The Simulink Simscape Power Systems Specialized Technology Library is a simulation do- main within Simulink . It lets a user simulate electrical components and power systems, otherwise simulated in specialized electrical simulation software. It combines two otherwise different simu- lation paradigms into one, adding a high level of flexibility towards system design and simulation. It is especially helpful from a controls point of view, for a controls designer working on control for power systems. A simulation using the Simscape Power Systems Specialized Technology com- ponents is distinguished from a regular Simulink system by a "Power GUI" block. The block sets various solver settings and options specific to the Specialized Technology library component. Besides solver settings, the block provides analysis tools that are useful for system analysis. A simulation using the Simscape Power Systems Specialized Technology components is executed in the following steps: [5] 1. The simulation is initialized and sorted into linear and nonlinear blocks. 2. The linear part of the simulation is converted into state-space equations. This linear part of the system is simulated using the S-Function blocks of the MATLAB. The nonlinear part is executed using predefined Simulink blocks.’ 3. The simulation is built and stored inside the Powergui block. The electrical simulation and Simulink simulation reside in separate domains. Special interface blocks must be used to interchange data between these. 3 high level of flexibility in tweaking the subsystem to suit the simulation requirements. Figure 1.1b shows an actual subsystem mask along with the block parameters dialog box. The parameters can be assigned default values that can be changed on purpose. Simulation Model with various subsystems Subsystem Mask – Sets subsystem specific parameters and values Subsystem model (a) Depiction of the layered architecture of a SimulinkTM simulation model. (b) Diesel Generator Controller mask showing various parameters. Figure 1.1: (a) Depiction of layered architecture. (b) A subsystem mask 3 (a) Depiction of the layered architecture of a Simulink simulation model. high level of flexibility in tweaking the subsystem to suit the simulation requirements. Figure 1.1b shows an actual subsystem mask along with the block parameters dialog box. The parameters can be assigned default values that can be changed on purpose. Simulation Model with various subsystems Subsystem Mask – Sets subsystem specific parameters and values Subsystem model (a) Depiction of the layered architecture of a SimulinkTM simulation model. (b) Diesel Generator Controller mask showing various parameters. Figure 1.1: (a) Depiction of layered architecture. (b) A subsystem mask 3 (b) Diesel Generator Controller mask showing various parameters Figure 1.1: (a) Depiction of layered architecture. (b) A subsystem mask 4 1.2 Document Structure This chapter provided some background information on the MATLAB/Simulink software. The rest of the thesis is structured as follows. Next chapter describes microgrid topologies, listing their potential usage, benefits and drawbacks. Chapter 3 describes a generator unit. It describes the modeling and control of an engine followed by description of a synchronous generator. This chap- ter then describes how multiple generators can be setup and controlled. Chapters 4 and 5 describe the photovoltaic system and the battery storage system. Chapter 6 describes control techniques for a three-phase bridge converter. Chapter 7 gives an example implementation of a microgrid using some of the tools developed and described in the thesis. The last chapter lists concluding remarks and suggestions for future work on further development of the library along with potential uses. It describes how simulation techniques such as HIL can be integrated with the tools developed here to further research into microgrids. 5 Chapter 2 Microgrid Topologies Microgrid technologies are getting mainstream adoption due to many factors. One the factors driving this growth is the increasing affordability of renewable technologies such as wind and solar power. This has been supplemented by progress in material science that has increased the efficiency of these energy sources. Coupled with ever increasing demand for high capacity lithium- ion batteries and super-capacitors, microgrid engineers and designers have a myriad of electrical sources to choose from. All these factors when combined present a very promising picture for the microgrids. The abundance of energy sources pose a design and control challenge. These sources have different characteristics, response times and implementation constraints. A designer must be able to recognize these factors when designing a microgrid, to operate them at their full efficiency. The next two sections describe the two widely implemented microgrid topologies. 2.1 DC Bus Topology In a microgrid installation, photovoltaic panel constitutes an important and noticeable com- ponent. This can be attributed to the availability of abundant sunlight and the decreasing cost of photovoltaic panels [6] [7]. Combined with storage units such as batteries and supercapacitors, the DC power constitute a large portion of modern day microgrids. Combining these factors with an ever-increasing shift towards DC load devices, it becomes inevitable to design a microgrid around the DC power. A significant amount of research and literature has used a DC bus based microgrid topologies [8] [9]. The thesis lays out a proposed microgrid topology constructed around a common DC bus. Figure 2.1 shows the schematic and the components of the proposed DC topology. All the electrical sources are connected to a common DC bus. The sectioned blocks are power converters that interface with a source and the bus. The arrows underneath every converter block represents the power flow. The PV and the generators have unidirectional power converters that 6 GEN 2 AC DC GEN 1 AC DC BAT DC DC PV DC DC DC Bus DC AC Load DC Load Figure 2.1: DC Bus Topology. represents the power flow. The PV and the generators have unidirectional power converters that dump power into the DC bus. The battery is connected to the DC bus with a bi-directional DC to DC converter. This allows the battery to act as an energy buffer, supplying power to the DC bus when required. The bidirectional converter allows power flow into the battery during a charge cycle. A DC load can be directly connected to the bus. Microgrids are designed to supplement or work with existing electrical infrastructure. Thus, an AC power converter is an essential component. The AC to DC converter (inverter), connected to a common DC bus, converts the DC power into AC power. All the AC loads are connected the AC bus driven by an inverter. The microgrids in this text are assumed to be working in islanded operation. Thus, the inverter has to generate the AC power without any external AC power prime mover. This type of inverter is called a grid forming inverter. Chapter 6 describes the simulation model and control of a grid forming inverter. 7 Figure 2.1: DC Bus Topology. dump power into the DC bus. The battery is connected to the DC bus with a bi-directional DC to DC converter. This allows the battery to act as an energy buffer, supplying power to the DC bus when required. The bidirectional converter allows power flow into the battery during a charge cycle. A DC load can be directly connected to the bus. Microgrids are designed to supplement or work with existing electrical infrastructure. Thus, an AC power converter is an essential component. The AC to DC converter (inverter), connected to a common DC bus, converts the DC power into AC power. All the AC loads are connected the AC bus driven by an inverter. The microgrids in this text are assumed to be working in islanded operation. Thus, the inverter has to generate the AC power without any external AC power prime mover. This type of inverter is called a grid forming inverter. Chapter 6 describes the simulation model and control of a grid forming inverter. There are some advantages and disadvantages of using a DC bus based microgrid. Multiple generator units in an AC grid require grid synchronization to operate in parallel. Simultaneous 7 operation of these generators, acting as single power source require specialized controllers and infrastructure. These also require control strategies to control output power and maintain grid frequency. A DC bus based microgrid does not require these. The generator units have individual DC power converters (rectifiers), thus no grid synchronization is required. The downside of this topology is the cost of converters and the added complexity associated with these. Each generator unit would require its own rectifier unit. The other disadvantage is the lack of a prime mover on the AC side. Inverters, as opposed to generators, do not have inertia associated with a rotor. The inertia can absorb mild fluctuations induced by load changes. This acts as to stabilize the grid against disturbances. In an inverter powered grid with virtually no inertia, an inductive load can induce unwanted harmonics and destabilize the grid frequency. Control systems have been designed that implement the concept of virtual inertia that can mitigate these issues [10]. 2.2 AC Bus Topology Another microgrid topology is where the DC and AC sources are separate. This topology is cost efficient as the microgrid can be setup by integrating new devices with existing electrical infrastructure, such as rural or remote grid installations. Figure 2.2 shows the schematic of an AC bus based microgrid topology. One can notice the difference the way the generators and the inverter are connected. The inverter is a bidirectional AC to DC converter. In a three-phase system, the AC to DC converter is a three phase bridge converter. The converter acts as a rectifier or inverter by selecting appropriate control algorithm and the desired flow of power. Chapter 6 describes three phase universal bridge and underlying rectifier or inverter control strategies. The bridge converter can push power into the DC bus to charge the battery when excess power is available on the AC side. The inverter used in such configuration is a grid following or grid supporting inverter [11]. A grid supporting inverter converts DC power to AC power but is not the grid master. The inverter follows and maintains the AC power and frequency set by another AC source, usually a prime mover synchronous generator. When multiple generators are employed, the generators are syn- 8 BAT DC DC PV DC DC Wind Turbine Gen AC DC DC Bus DC AC LOAD AC Bus GEN 1 GEN 2 DC Load follows and maintains the AC power and frequency set by another AC source, usually a prime mover synchronous generator. When multiple generators are employed, the generators are syn- chronized to operate in phase producing power as a single power source. The synchronization and load sharing control strategies are discussed in the next chapter. Besides the above mentioned microgrid topologies, there are other possible configurations. Author aims to pursue research into these in the future. 9 Figure 2.2: AC Bus Topology. chronized to operate in phase producing power as a single power source. The synchronization and load sharing control strategies are discussed in the next chapter. Besides the above mentioned microgrid topologies, there are other possible configurations. Author aims to pursue research into these in the future. 9 Chapter 3 Generator A generation unit is an essential component of a microgrid. Internal combustion engines have been around for over a century. Some of their characteristics make them indispensable for use in microgrids. Diesel engines can be modeled using simple linear models because of their predictable performance and quick transient response. The research in this text is geared towards designing of control systems for microgrids that are built using natural gas engines. This chapter describes the detailed Simulink model of a natural gas engine. The engine models used in this library were developed by Yi Han at Colorado State University [1]. The chapter then describes the working of synchronous generator and how multiple generators can be used in various configurations to achieve desired power output. 3.1 Engine An engine is a complex machine with various mechanical systems working together. For a four stroke engine, the engine cycle can be summarized as follows. In the suction cycle, the piston draws fuel from the fuel inlet mechanism. Suction cycle is followed by the compression cycle, in which the piston moves upwards compressing the fuel-air mixture. Then follows the combustion cycle. It is also known as the power stroke. Power stroke is the one that counts for the actual power output from the engine. The combustion cycle is followed by the exhaust cycle. In this cycle the burnt gases from the previous cycle are expelled via the exhaust manifold. Engine consists of various subsystems that contribute to the engine cycle. Figure 3.1 shows the subsystems and their interconnections implemented as a Simulink simulation model. The subsystems and their working is described below. The air filter is modeled as a giant orifice, thus, the air flow is calculated by standard com- pressible fluid flow equations [12]. Air filter subsystem composes the input section. It purifies the 10 air going into the combustion chamber. The air filter introduces a pressure drop and thus, is an essential modeling component. The air filter is modeled as a giant orifice, thus, the air flow is calculated by standard compressible fluid flow equations [12]. The fuel valve controls the amount of fuel going into the engine. The amount of air and fuel mixture going into the engine is known as the Air to Fuel Ratio (AFR). The fuel value controls the ARF and is modeled as a butterfly valve. The mixer block models the mixing of the air and the fuel. The mixer block output is then fed to the turbocharger. One can notice the output port 'AFR'is connected to the mixture block. The AFR output from the engine is used as control variable. A controlled AFR is necessary for increasing the engine efficiency [13]. In case of a natural gas engine, the AFR should be tightly controlled for the engine to operate [11]. The turbocharger consists of a turbine, compressor and a rotor. A turbocharger increases the in- let flow, thus, producing more power with the same size of engine displacement. The turbocharger subsystem models the subcomponents separately. It consists of a compressor that connects to a turbine with a rotor. The compressor compresses the incoming fuel air mixture. The rotor acts as 11 Figure 3.1: Natural gas engine Simulink model showing various subsystems. The fuel valve controls the amount of fuel going into the engine. The amount of air and fuel mixture going into the engine is known as the Air to Fuel Ratio (AFR). The fuel value controls the ARF and is modeled as a butterfly valve. The mixer block models the mixing of the air and the fuel. The mixer block output is then fed to the turbocharger. One can notice the output port ‘AFR’is connected to the mixture block. The AFR output from the engine is used as control variable. A controlled AFR is necessary for increasing the engine efficiency [13]. In case of a natural gas engine, the AFR should be tightly controlled for the engine to operate [1]. The turbocharger consists of a turbine, compressor and a rotor. A turbocharger increases the in- let flow, thus, producing more power with the same size of engine displacement. The turbocharger subsystem models the subcomponents separately. It consists of a compressor that connects to a 11 turbine with a rotor. The compressor compresses the incoming fuel air mixture. The rotor acts as mechanical coupling between the compressor and the turbine. The outputs from the compressor and turbine are then fed into the inter-cooler and engine block, respectively. The inter-cooler reduces the temperature of the compressed flow, thus, increasing the flow density, eventually generating more power. In the model, the inter-cooler is modeled as a volume element. The throttle valve is modeled similarly to the inlet valve with some slight changes. It is the control element that controls the engine speed. Intake manifold distributes the air and fuel mixture into the cylinders for the combustion cycle. It is an important component of an engine due to the requirement of uniform distribution of the mixture to all cylinders. The manifold is modeled on the principle of conservation of energy and the ideal gas laws. The engine block is the part of the model where actual combustion takes place, converting the heat energy into mechanical energy, hence generating the output torque. The mean indicated torque is the output torque of the engine. It is calculated by Ti = mf .QLHV .ηind (3.1) where, mf is the fuel mass in the cylinders, QLHV is the fuel lower heating value and ηind is the indicated efficiency of the engine. The model computes the friction and pumping losses, thus presenting an accurate model of an actual engine. Exhaust manifold collects the exhaust gases generated in the cylinders and vents them out. The exhaust manifold is modeled similarly as the intake manifold. In the model, one can notice the ’volume output states’ from the exhaust manifold goes back into the intercooler. This is because some of the energy from the exhaust gases is extracted for increasing the inlet flow. Figure 3.2 shows the Simulink subsystem mask for a natural gas engine. The library contains simulation models for diesel and natural gas engines. The models are highly detailed and customiz- able. This gives the controls designer a lot of flexibility in designing setting up the simulation for different engine models and sizes. Each subcomponent in the model can be adjusted from the top- 12 most mask. This flexibility to adjust or modify each subsystem allows the model to be accurate, thus, accurately modeling behavior of an actual engine. Usage and function of a subsystem mask was described in Chapter 1. Figure 3.2: Engine Parameters Mask. 13 Figure 3.2: Natural gas engine Simulink model showing various subsystems. 3.1.1 Engine Control Internal combustion engines like diesel and natural gas engines are widely used in small grid installations to drive a generator. Engines have a fundamental advantage over other forms of mi- crosources such as wind and solar energy, such that the energy output is not dependent on envi- ronmental factors. AC grids operate at a fixed frequency that must be maintained for stable grid operation. For a synchronous generator, grid frequency is related to the engine RPM by 13 f = rpm. P 60 (3.2) where P is the number of pole pairs and rpm is the rotor rpm. Hence engine speed control is an essential component of microgrid control. Simple engine speed control in these simulation models is achieved using PID regulators, also called a governor. Chapter 8 discusses use of a MIMO controller for engine speed control. PID controller for engine speed controller is discussed below. A change in the torque experienced by the engine affects the engine rpm. A PID controller measures the engine RPM and compares it with a set reference value. The error is fed to a PID regulator that generates a control output. The control output is the amount of fuel injected into the engine. Fuel control in an engine is achieved using a throttle valve, shown on the left as an input port connected to the throttle block in Figure 3.1. A PID controller is robust in the sense that one doest not need to have detailed knowledge about underlying mathematical model of the plant. The PID gains are carefully tuned to achieve a reasonable performance. Simulation tools developed in the toolbox are intended towards microgrids built around a natural gas engine. In a natural gas engine, besides the control of engine output, another important control variable is the inlet Air to Fuel Ratio (AFR). For a lean burn natural gas engine, AFR should be tightly controlled. Figure 3.3 shows the Simulink implementation of a natural gas engine. Notice there are two separate PID regulators for engine speed control and AFR control. A natural gas engine is different from a diesel engine. In a diesel engine, the fuel is injected directly into the combustion chamber. In contrast, for a pre-mixed lean burn natural gas engine, fuel is injected before the turbocharger. This leads to a considerable fuel transport delay. Therefore a natural gas engine has a poor transient response to sudden load changes compared to a diesel engine. Figure 3.4b shows the engine speed output for a natural gas engine. The load on the engine is varied in steps, shown in Figure 3.4a. Engine speed reference is set at 1800 rpm. PID governor measures the error in the reference and the measured speed commanding a control output that injects fuel into the engine. Notice that after every step change in the load, the engine rpm shows a big variation. The PID regulator tries to maintain the reference. Engine speed settles to 14 1800 Engine Speed Reference (RPM) 27.4 AFR Reference AFR PID(s) PID (Throttle) PID(s) PID Trim Load (Nm) Load (Nm) Fuel Usage Load Nm Throttle_Angle Degs Trim_Valve Degs Speed RPM AFR Fuel Mdot kg/s Natural Gas Engine Speed RPM Engine Speed Air to Fuel Ratio (AFR) directly into the combustion chamber. In contast, for a pre-mixed lean burn natural gas engine, fuel is injected before the turbocharger. This leads to a considerable fuel transport delay. Therefore a natural gas engine has a poor transient response to sudden load changes than a diesel engine. Figure 3.4b shows the engine speed output for a natural gas engine. The load on the engine is varied in steps, shown in Figure 3.4a. Engine speed reference is set at 1800 rpm. PID governor measures the error in the reference and the measured speed commanding a control output that injects fuel into the engine. Notice that after every step change in the load, the engine rpm shows a big variation. The PID regulator ten tries to mainitain the reference. Engine speed settles to the reference is about 30 seconds. Natural gas engine shows an maximum engine speed deviations of about 30 rpm. As mentioned earlier, natural gas engines perform poorly to changes in engine load due to the fuel transport lag. For comparison, Figure 3.5 shows the engine speed output for a diesel engine. 15 Figure 3.3: Natural gas engine and controller implementation in Simulink. the reference is about 30 seconds. Natural gas engine shows an maximum engine speed deviations of about 30 rpm. As mentioned earlier, natural gas engines perform poorly to changes in engine load due to the fuel transport lag. For comparison, Figure 3.5 shows the engine speed output for a diesel engine. The engine is subject to the same load variations as the one displayed in Figure 3.4a. Engine rpm deviates by not more than 0.5 RPM from the reference engine RPM of 1800. Natural gas engines have a poorer transient response than diesel engines but they offer some unique advantages. In order to meet the emission standards set by environment agencies, man- ufactures have to make considerable investment on engines to make them compliant with those standards. This increases the upfront cost of a diesel engine. Natural gas engines are suitable for installation in remote sites where there is an easy access to natural gas, such as remote fracking sites. In addition to the above factors, natural gas is cheaper than diesel [14]. This translates to a lower operating cost for the operational lifetime of the engine. Later chapter addresses the usage of a natural gas engine in a microgrid and device control strategies to mitigate issues of engine response and grid stability. 15 0 500 1000 1500 L o a d ( N m ) 0 100 200 300 400 500 600 Time (seconds) 1780 1790 1800 1810 1820 E n g in e S p e e d ( rp m ) Engine Speed Ref Engine Speed 16 (a) Engine Load. 0 100 200 300 400 500 600 Time (seconds) 0 500 1000 1500 L o a d ( N m ) 0 100 200 300 400 500 600 Time (seconds) 1780 1790 1800 1810 1820 E n g in e S p e e d ( rp m ) Engine Speed Ref Engine Speed (b) Natural Gas Engine Speed Response Figure 3.4: Natural Gas Engine Load input and speed response. 16 (b) Natural gas engine speed response Figure 3.4: Natural gas engine load input and speed response 16 The e n g i n rpm deviates 0 100 200 300 400 500 600 Time (seconds) 1799.6 1799.8 1800 1800.2 1800.4 1800.6 E n g in e S p e e d ( rm p ) Engine Speed Ref Engine Speed Natural engines have a poorer transient response than diesel engines but they offer some unique advantages. In order to meet the emission standards set by environment agencies, man- ufactures have to make considerable investment on engines to make them compliant with those standards. This increases the upfront cost of a diesel engine. Natural gas engines are suitable for installation in remote sites where there is an easy access to natural gas, such as remote fracking sites. In addition to the above factors, natural gas is cheaper than diesel engine [14]. This trans- lates to a lower operating cost for the operational lifetime of the engine. Later chapter addresses the usage of a natural gas engine in a microgrid and device control strategies to mitigate issues of engine response and grid stability. 3.2 Synchronous Generator A synchronous generator is a synchronous machine that converters mechanical energy into electrical energy. A synchronous machine is called so because the frequency of the electric current is synchronized with the rotor. It consists of a rotor with rotor windings that rotates in a stator. The stator windings are connected to the AC mains. Figure 3.6 shows the equivalent circuit for the dq- 17 Figure 3.5: Diesel engine speed response to load variations. 3.2 Synchronous Generator A synchronous generator is a synchronous machine that converters mechanical energy into electrical energy. A synchronous machine is called so because the frequency of the electric current is synchronized with the rotor. It consists of a rotor with rotor windings that rotates in a stator. The stator windings are connected to the AC mains. Figure 3.6 shows the the equivalent circuit for the dq- axis of a three-phase synchronous generator with the reference frame fixed in rotor. The subscripts f and k represent quantities related to the field winding and the damper winding, respectively. The magnetization inductances are shown as Lmd and Lmq. It is convenient to represent the time varying quantities, such as magnetic flux and voltage, in a rotating reference frame that is fixed in the rotor. This transforms the time varying quantities into equivalent DC values. The transformation is described in detail in Chapter 6. Voltage output of the generator in the rotor reference frame for dq axis can be summarized as [15] Vd = rsid − ωrλq + d dt λd (3.3) Vq = rsiq − ωrλd + d dt λq (3.4) 17 axis of a three-phase synchronous generator with the reference frame fixed in rotor. The subscripts f and k represent quantities related to the field winding and the damper winding, respectively. The Id rs - ωrλq + Lls Lmd L′ lkd i′kd r′kd L ′ lfd i′fd r′fd + − V ′ fd + − V ′ kd + − Vd Iq rs + ωrλd - Lls Lmq L′ lkq2 i′kq2 r′kq2 L ′ lkq1 i′kq1 r′kq1 + − V ′ kq1 + − V ′ kq2 + − Vq (b) Equivalent circuit for q-axis Figure 3.6: Synchronous Generator equivalent Circuit in rotor reference frame It is convenient to represent the time varying voltages transformed using the dq0 in the rotating reference frame of rotor. The transformation is described in detail in Chapter 6. Voltage output of the generator in the rotor reference frame for dq axis can be summarized as [15] 18 (a) Equivalent circuit for d-axis. axis of a three-phase synchronous generator with the reference frame fixed in rotor. The subscripts f and k represent quantities related to the field winding and the damper winding, respectively. The magnetization inductances are shown as Lmd and Lmq. Id rs - ωrλq + Lls Lmd L′ lkd i′kd r′kd L ′ lfd i′fd r′fd + V ′ fd + − V ′ kd + − Vd Iq rs + ωrλd - Lls Lmq L′ lkq2 i′kq2 r′kq2 L ′ lkq1 i′kq1 r′kq1 + − V ′ kq1 + − V ′ kq2 + − Vq It is convenient to represent the time varying voltages transformed using the dq0 in the rotating reference frame of rotor. The transformation is described in detail in Chapter 6. Voltage output of the generator in the rotor reference frame for dq axis can be summarized as [15] 18 (b) Equivalent circuit for d-axis. Figure 3.6: Synchronous generator equivalent circuit in rotor reference frame 18 where rs is the stator resistance, id and iq is the axis current, ωr is the rotor angular frequency, λd and λq is the flux linkage for d and q axis respectively. The electromagnetic torque resulting from the generation of electric power is related to the stator currents as Te = (3 2 )(P 2 ) (λdiq − λqid) (3.5) where, P is the number of poles. The synchronous generator is driven by an engine. The library has separate generator models powered by diesel and natural gas engine. Figure 3.7 shows the Sumulink model of a generator. The generator simulation model and the succeeding models described in this chapter are developed by Dr. Peter Young. The engine drives a synchronous generator excited by an IEEE recommended excitation system [16]. The synchronous generator produces electromagnetic torque as described in equation 3.5. The generator outputs the total torque and feeds it into the engine block, thus forming a close loop. All the measurements from the engine and the generator are coupled together in separate measurement buses. 19 3.3 AC grid frequency control as a power control technique A generator is essentially a giant rotating spindle. In addition to the electromagnetic torque that is the byproduct of the electric power generation, there is the mechanical torque. The mechanical torque is independent of the electromagnetic torque and is a function of the rotor inertia. The mechanical torque for a generator with rotor moment of inertia J is written as TM = J ( 2 P ) d dt ωr (3.6) A torque source, in this case an engine, must overcome the mechanical torque and the electro- magnetic torque. Thus, total input inertia to an engine is TI = Te + TM = Te. (3.7) 20 Figure 3.7: Simulink model of Synchronous generator powered by a natural gas engine. 3.3 AC grid frequency control as a power control technique A generator is essentially a giant rotating spindle. In addition to the electromagnetic torque that is the byproduct of the electric power generation, there is the mechanical torque. The mechanical torque is independent of the electromagnetic torque and is a function of the rotor inertia. The mechanical torque for a generator with rotor moment of inertia J is written as TM = J ( 2 P ) d dt ωr (3.6) A torque source, in this case an engine, must overcome the mechanical torque and the electro- magnetic torque. Thus, total input inertia to an engine is TI = Te + TM (3.7) 20 Considering equation 3.5, the torque is a function of current. Thus, any increase in the load or increase in power demand would translate to a higher current being drawn. This leads to an increased torque input on the engine. From equation 3.1, for a steady state operation, i.e. constant fuel would mean a decrease in engine rpm. The engine rpm is directly proportional to the AC output frequency. An engine with a speed controller would inject more fuel into the engine to maintain the speed and cope with the increased torque. Thus, maintaining the AC frequency acts as a power control technique in an AC grid. 3.4 Multiple Generator Operation Microgrids are deployed in varied scenarios with different load requirements. Where a single generator is insufficient to meet the load demand, multiple generators are deployed. The generators act as a single unit servicing the load demand. Over the years, numerous control techniques have been developed to control multiple generation units. The following sections describe two popular multiple generator control techniques. 1. Frequency Droop 2. Isochronous load Share The mode of operation can be selected from the topmost mask as shown in Figure 1.1b . These operating modes are explained in the next section. The synch control block and the generator breaker are used to synchronize the generators when operating in multi-generator mode. Droop Control Frequency and Voltage Droop control are popular control techniques for distributed generation units. Droop control is widely used in the utility power grids to manage and distribute power among various power generation units. The popularity of this technique can be gauged from the plethora of available literature on droop control. The droop control is a decentralized control scheme and is widely popular in application areas where there the cost of a centralized control is very high, or such control is not possible [17]. 21 Droop control is a low-cost load sharing technique implemented using existing grid resources. The load sharing between multiple generator units is achieved within each module by drooping the output frequency as function of generator output power [18]. Generator units that convert mechanical energy into electrical energy have the inherent feature, such that, the power drawn is proportional to the torque on the rotor. The torque, in turn, is proportional to the rotational speed of the engine. Droop technique exploits this feature to achieve load sharing. A droop controller, based on droop curve for individual generator, sets the reference frequency of the generators, thus providing a linear correlation between frequency droop and the load being serviced. Figure 3.8 shows the graphical operation of droop control in two generators G1 and G2. The graph shows the linear relation between the generator power P (when operating alone) vs the output frequency ω. Each generator is evaluated and is assigned a droop curve. A high-power generator would have small frequency variations for an increased load. This would translate to a less steep curve, as evident in the Figure for generator G1 that has a higher output power than G2. All the generation units are connected in parallel to a common AC bus. The AC bus acts as a communication medium. All the generator units continuously monitor the frequency and based on the measured frequency and the droop curve, the controller sets the reference frequency. For example, the reference frequency for a fully loaded generator would be set higher than the actual grid frequency. The generators are preprogrammed with droop control curves, as described in equations 3.8 and 3.9. The load controller injects the bias into the frequency reference using the following formula. bias = fgain ( (fset − fmeas)− ( fdroop ∗ frated ∗ Pmeas Prated )) (3.8) where fgain is the frequency gain, fset and fmeas is the set reference frequency and the measured frequency. fdroop is the frequency droop for the given generator. frated is the rated frequency for the system. Pmeas and Prated is the measured and rated power of the system. The voltage bias to be added to implement the droop is described below. 22 P ω ω0 ωmin ω1 G1 G2 . . Figure 3.8: Frequency Droop Control for two Generator Units with different max power. Droop control is a low-cost load sharing technique implemented using existing grid resources. The load sharing between multiple generator units is achieved within each module by drooping the output frequency as function of generator output power [18]. Generator units that convert mechanical energy into electrical energy have the inherent feature, such that, the power drawn is proportional to the torque on the rotor. The torque, in turn, is proportional to the rotation speed of the engine. Droop technique uses this feature to achieve load sharing. This technique can only be implemented in grids where minor frequency variations among different generator units are acceptable. Figure 3.8 shows the graphical operation of droop control in two generators G1 and G2. The graph shows the linear relation between the generator power P (when operating alone) vs the output frequency ÏL’. Each generator is evaluated and is assigned a droop curve. A high-power generator would have small frequency variations for an increased load. This would translate to a less steep curve, as evident in the Figure for generator G1 that has a higher output power than G2. All the generation units are connected in parallel to a common AC bus. The AC bus acts as a communication medium. All the generator units continuously monitor the frequency and based on the measured frequency and the droop curve, the controller sets the reference frequency. For example, the reference frequency for a fully loaded generator would be set higher than the actual grid frequency. The generator would try to run at the reference speed but due to the load and the linear relation between power and speed, the generator would run at the 22 Figure 3.8: Frequency Droop Control for two Generator Units with different max power. bias = Vgain ( (Vset − Vmeas)− ( Vdroop ∗ Vrated ∗ Qmeas Qrated )) (3.9) where Vgain is the voltage gain, Vset and Vmeas is reference and measured voltage, respectively. Vdroop is the amount of droop for a generator. The amount of droop in absolute terms would be different for each generator based on the it’s output power. In terms of percentage the amount of droop is usually same for each generator. Vrated is the rated voltage output of the generator. Qmeas and Qrated is the measured and rated reactive power of the generator and the system, respectively. Typically, large grids operate at a droop of around 5% [19]. As mentioned previously, a grid controlled using droop technique must be immune to small variations in the frequency. If the generators are synchronized, small frequency variations are absorbed by the grid due to inertia of the rotors. Droop load sharing technique is only applicable where the grid frequency variations due to load changes are small [17]. Isochronous Load Share Frequency droop control for load sharing among distributed generation units used the existing electrical grid infrastructure as a communication medium. This approach reduces system cost as no modifications to the infrastructure are needed. Other than the cost factor, droop control has many downsides. It assumes the generators have a linear power to frequency relation. Secondly, it 23 can only work with a slowly varying load. Thirdly, the grid must be able to tolerate slight errors in the actual generator frequency. These above-mentioned factors play a major role in microgrids. The generator size is small as compared to utility grid, thus the prime movers have less inertia. This translates to a nonlinear relation between the generator output power and the frequency. Also, a lower inertia means that any errors in the frequency cannot be overcome. This can greatly reduce the power quality. Also, microgrids usually has deal with fast varying loads, thus droop control might not work as intended. Microgrids are local installations, thus the cost of a communications infrastructure for a centralized control of the microgrid would be low. In addition to this, there has been a considerable decline in the cost of communications infrastructure, such as wireless mesh networks, or other industry standard bus communication protocols such as CAN or I2C [20] [21]. In an isochronous load share is load sharing control technique the distributed generation units continuously communicate with each other over a communication medium, sharing the grid load information. The generation units send their current power output and receive the overall grid power or load information. The isochronous controller then sets the generator to a set power level proportional to the required grid power demand. This procedure is executed in each of the generators, resulting in a proportional load sharing among all the generators. Thus, the generation units would operate at the same voltage or frequency irrespective of the load [22]. Control blocks inject appropriate bias thus controlling the amount of load share to be assigned based on the actual load information shared over the generator communications bus. The amount of load share for each generator must be determined in advance. The load share is calculated using the known maximum output power of each generator and the maximum load requirement of the system. The load control block computes the frequency bias to be injected into the reference using the underlying formula bias = (( lfac 100 ∗ (Pavg−Pmeas)∗Pgain ∗ ( fmeas Prated ))) + ((100− lfac 100 ) ∗ (fset−fmeas)∗fgain ) (3.10) 24 lfac is the load factor. It is set in the outermost block parameters mask. Pavg is the average power output of all the generators combined. Pmeas is the measured output power of the generator. Pgain and fgain are the power and the frequency gain. These determines the gain for the bias controller. fset and fmeas are the set reference frequency for the grid and the measured frequency of the generator. The bias calculation for the voltage control block is shown below. bias = (( lfac 100 ) ∗ (Qavg−Qmeas)∗Vmeas ∗ Qgain Qrated ) + ((100− lfac 100 ) ∗ (Vset−Vmeas)∗Vgain) ) (3.11) Qavg andQmeas is the average reactive power and the measured reactive power, respectively. Vmeas is the measured voltage. Qgain and Vgain is the gain value for the reactive power and the voltage. Qrated is the rated reactive power for the whole system. 3.4.1 Generator Synchronization An AC waveform consists of electric quantities that are time varying sinusoids. When multiple generation sources are to be connected to power a single load, the sources are connected in parallel. All the sources must be in phase when the generators are physically connected. Failure to do so might lead to high fluctuating voltages and introduce damaging harmonics in the system, that can cause machine damage etc. Synchronization is a process by which various generation units connect to an AC grid. A synchronization controller continuously monitors the main AC bus and the output of the generation unit. The sync block measures the two inputs and computes the error. The errors are, the magnitude, phase and frequency. The controller computes these errors and feeds them to three separate PI regulators. The regulators inject control signals or bias to set the reference values for the generator. The regulators would drive the errors to zero. When the errors are within a threshold, the controller sends the command to close the breaker to connect the generator to the bus at which point the synchronization controller for that generator is turned off and regular isochronous or droop control takes over. In a system with inertial power sources such as synchronous generators 25 powered by an engine or a turbine, small variations in the phase from different sources are absorbed due to the inertia of the grid. Additional figures depicting generator with bias control blocks and synchronization blocks are shown in appendix. 26 Chapter 4 Photvoltaic Power System Photovoltaic (PV) cell is a semiconductor device that generates power from the electromagnetic spectrum corresponding to the visible light. The photons in the visible spectrum have enough energy to free electrons in the solar cell . The cell is fabricated using a semiconductor material, such as silicon, that has been selectively doped to create a potential barrier [23]. The freed electrons generated by the photons create a potential difference which is used to drive current through a circuit. A solar cell is the building block of a solar or photovoltaic array. Chapter 4 Photovoltaic Power System Photovoltaic (PV) cell is a semiconductor device that generates power from the electromagnetic spectrum corresponding to the visible light. The photons in the visible spectrum have enough energy to free electrons in the solar cell . The cell is fabricated using a semiconductor material, such as silicon, that has been selectively doped to create a potential barrier [23]. The freed electrons generated by the photons create a potential difference which is used to drive current through a circuit. A solar cell is the Iph Id Rs Ipv + − Vpv A PV cell is a photodiode that can be modelled using the equivalent circuit depicted in Fig- ure 4.1 (neglecting temperature dependence). Neglecting parallel any resistance in parallel to the current source, the total current output Ipv is Ipv = Iph − Id (4.1) Iph is the current generated in the solar cell when illuminated. The current through the diode Id is modeled as Id = I0(e (Vpv+IpvRs)/VT − 1) (4.2) 27 Figure 4.1: Equivalent circuit of a PV cell. A PV cell is a photodiode that can be modelled using the equivalent circuit depicted in Fig- ure 4.1 (neglecting temperature dependence). Neglecting parallel any resistance in parallel to the current source, the total current output Ipv is Ipv = Iph − Id (4.1) Iph is the current generated in the solar cell when illuminated. The current through the diode Id is modeled as Id = I0(e (Vpv+IpvRs)/VT − 1) (4.2) 27 Where Vpv is the diode output voltage, I0 is the saturation current and VT is the diode thermal voltage. The thermal voltage is a function of temperature. Rs is the internal series resistance of the cell. Thus, total current, from equation 4.1, [24] Ipv = Iph − I0(e(Vpv+IpvRs)/VT − 1) (4.3) A typical single PV cell has a power output of a few watts, therefore, multiple PV cells are combined in series and parallel to achieve required output voltage and power. Such an arrangement of PV cells is called a photovoltaic panel. The PV array simulation block implements an array of photovoltaic cells. The block allows one to model preset PV modules from the National Renewable Energy Laboratory (NREL) System Advisor Model (Jan. 2014) as well as custom defined PV modules [25]. The simulation block is sourced from Simulink Simscape Power Systems, Specialized Technology Library [26]. Figure 4.2 shows the voltage-current characteristics of a PV panel for various solar irradiation values. For a given solar radiation value, the output voltage is a function of the current drawn by the load or vice versa. Total power output of the panel is thus a function of the load impedance. The curve shows the open circuit voltage and the short circuit current on the right and left extrem- ities of the curve, respectively. On the curve (a), one can notice that, for a given value of solar radiation, there is a point on the curve that corresponds to maximum power output. For a load with fixed impedance, the operating point lies somewhere on the curve, that might not correspond the maximum operating point. As the solar radiation fluctuates, the operating point would shift. This leads to a suboptimal solar output if the load impedance is constant. 28 0 50 100 150 200 250 300 350 Voltage (V) 0 100 200 300 400 C ur re nt ( A ) Array type: SunPower SPR-305E-WHT-D; 5 series modules; 66 parallel strings 1 kW/m 2 0.8 kW/m 2 0.6 kW/m 2 0.4 kW/m 2 0.2 kW/m 2 0 50 100 150 200 250 300 350 Voltage (V) 0 5 10 P ow er ( W ) 10 4 1 kW/m 2 0.8 kW/m 2 0.6 kW/m 2 0.4 kW/m 2 0.2 kW/m 2 Figure 4.2: Typical voltage current curves for various solar irradiance values. Changes in solar radiation occur due to sun’s movement, any cloud activity or weather event which affects the total solar radiation received by the panel. 4.1 Maximum Power Point Tracking To extract maximum power output from the PV panel, the voltage and output current of the panel must be controlled. In Figure 4.2, one can notice that, for a given radiation value, the extremities on the graph shows minimum output power. The panel has maximum output power at the knee of the curve, shown as a pink circle. Thus, a controlling device becomes essential that can vary the impedance seen by the PV panel to extract maximum power. This can be achieved by varying the voltage or current drawn from the panel. Such a controller is called a maximum power point tracker, and the underlying technique is called a maximum power point tracking (MPPT) [27]. 29 A popular MPPT technique is called hill climbing or perturb and observe. The perturb and observer algorithm can be summarized as, a change or perturbation of operating voltage of the PV panel would induce a change in the output power, the resulting change in the output power gives the direction of the maximum power point [21]. The MPPT controller controls the duty cycle of a DC/DC converter which will change the current drawn and hence the effective impedance seen by the PV panel. The algorithm is also called hill climb as the perturbation, if in the direction of maximum power point, is analogous to climbing a hill. The MPPT controller reads the voltage and current from the PV panel. In every execution cycle the controller computes the time rate change of power and voltage. It then checks if the rate of change is negative or positive. For a positive rate of change of power, the controller compares the instantaneous rate of change of voltage. For a positive change, it increases the duty cycle, and vice versa. The opposite happens in the case of a negative rate of change in the power. The step size of the duty cycle is fixed and is determined empirically. A large step size would make the controller responsive but can lead to unstable behavior. A small step size would make the controller sluggish. Modified algorithms have been proposed that use an adaptive or variable step size, and have shown to have improved performance over a fixed step size [28]. The code for the algorithm is described in Appendix A. When the controller reaches the maximum power, it oscillates around that point. DC-DC converter can be selected based on the requirements of the solar energy harvesting system. The library implements a boost converter. Figure 4.3 shows the schematic of a boost converter. A boost converter is a switched mode converter that produces DC voltage greater that the input voltage. The main components of a boost converter are, an inductor on the input side, a fully controllable switch in parallel. The switch is a semiconductor switch, such as a MOSFET. Diode D1 acts as a unidirectional switch. A capacitor is added at the output stage to filter out the ripple and smoothen the output. 30 The algorithm is also called hill climb as the perturbation, if in the direction of maximum power point, is analogous to climbing a hill. The MPPT controller reads the voltage and current from the PV panel. In every execution cycle the controller computes the time rate change of power and voltage. It then checks if the rate of change is negative or positive. For a positive rate of change of power, the controller compares the instantaneous rate of change of voltage. For a positive change, it increases the duty cycle, and vice versa. The opposite happens in the case of a negative rate of change in the power. The step size of the duty cycle is fixed and is determined empirically. A large step size would make the controller responsive but can lead to unstable behavior. A small step size would make the controller sluggish. Modified algorithms have been proposed that use an adaptive or variable step size, and have shown to have improved performance over a fixed step size [29].The code for the algorithm is described in Appendix A. When the controller reaches the maximum power, it oscillates around that point. DC-DC converter can be selected based on the requirements of the solar energy harvesting system. The library implements a boost converter. Figure 4.3 shows the circuit diagram of a boost converter. A boost converter is a switched mode converter that produces DC voltage greater that the input voltage. Figure 4.3 shows the schematic of a boost converter. The main components of a boost converter are, an inductor on the input side, a fully controllable switch in parallel. The switch is a semiconductor switch, such as a MOSFET. A diodeD1 acts as a unidirectional switch. A capacitor is added at the output + − Vin L vL Ii S1 D1 Io C1 + − Vout 30 Figure 4.3: Boost converter. A boost circuit can be analyzed using the small ripple approximation [29]. The switch S1 is driven by a controller that feeds a square wave of frequency f and duty cycle D. The converter operates in two states, state one when the switch S1 is closed and state two, when the switch is open. In state one, the input voltage Vin equals the voltage drop across the inductor. VL = Vin (4.4) Given the time period of the square wave is Ts, total time the converter is in state one is, DTs, where D is the duty cycle. In state 2, the switch is open, thus the current flows through the diode D1. This results in the voltage across the inductor and the input voltage to be in series. Inductor voltage in state two is VL = Vin − Vout (4.5) The converter is in state two for (1−D)Ts seconds. Total volt-seconds applied to the inductor over one switching interval are ∫ Ts 0 VLdt = (Vin)DTs + (Vin − Vout)(1−D)Ts (4.6) Equating the term to zero and simplifying, the output voltage for a boost converter is related to the input as 31 Vout = Vin 1−D (4.7) which gives voltage boost since 0 < D < 1. The MPPT controller varies the output voltage by controlling the duty cycle thereby controlling the output power. The boost converter implemented in the library is an average characteristics model that does not simulate the switching devices. The switching devices are replaced by voltage and current sources. Different power electronic component modeling techniques are described in section 7.2.1. Figure 4.4 shows the Simulink implementation of the PV module, MPPT controller and the DC-DC converter. Simulation setup is derived from Examples for Simulink Simscape Power Sys- tems, Specialized Technology. The DC-DC converter is an average characteristics single quadrant boost converter model sourced from Sim Power Systems, IREQ, Power Electronics Library [30]. The following section illustrates the working of an MPPT controller by comparing a PV panel controlled by an MPPT controller and the other connected to a constant load without an MPPT controller. Figure 4.4 shows the SimulinkTM implementation of the PV module, MPPT controller and the DC-DC converter. Simulation setup is derived from Examples for Simulink Simscape Power Sys- tems, Specialized Technology. The DC-DC converter is an average characteristics single quadrant boost converter model sourced from Sim Power Systems, IREQ, Power Electronics Library [31]. The following section illustrates the working of an MPPT controller by comparing a PV panel controlled by an MPPT controller and the other connected to a constant load without an MPPT controller. Avpreet Singh, avpreetsingh@hotmail.com, 2017 ----------------------------------------------------------------- PV output power comparison, with and without an MPPT controller Continuous Param Enabled V I D MPPT Controller using Perturbe & Observe technique Param MPPT Parameters Ir Temp Ramp-up/down Irradiance Irradiance (W/m2)1 Enable MPPT Ir T mm + - PV Array + C2+ C1 + L BL 1 + - D 0 + Load To illustrate the working of the MPPT controller, the PV panel in the two setups is irradiated with similar solar radiation profile shown in Figure 4.5a. Referring to Figure 4.2, the maximum power point, for solar irradiation of 1000 w/m2, occurs at a voltage of 273 V . Maximum power at this point is 1.007× 105 W. The corresponding impedance for maximum power is 0.74 Ω. In the first setup, the PV panel is connected to a DC/DC boost converter controller by an MPPT controller. The controller is connected to a load with an impedance of 100 Ω. In the other setup, the PV panel is connected to a load with an impedance of 0.74 Ω. This corresponds to the maximum power point. 32 Figure 4.4: PV panel block with an MPPT controller simulation in Simulink. 32 To illustrate the working of the MPPT controller, the PV panel in the two setups is irradiated with similar solar radiation profile shown in Figure 4.5a. Referring to Figure 4.2, the maximum power point, for solar irradiation of 1000 w/m2, occurs at a voltage of 273 V. Maximum power at this point is 1.007 × 105 W. The corresponding impedance for maximum power is 0.74 Ω In the first setup, the PV panel is connected to a DC/DC boost converter controlled by an MPPT controller. The controller is connected to a load with an impedance of 100 Ω. In the other setup, the PV panel is connected to a load with an impedance of 0.74 Ω. This corresponds to the maximum power point for irradiation of 1000 w/m2. Figure 4.5b shows the power output from a PV panel, with and without an MPPT controller. For solar radiation value less than 1000 w/m2, the MPPT controlled PV panel shows a higher power output than the constant impedance load. This illustrates that at suboptimal load, the MPPT con- troller adjusts the duty cycle, extracting maximum power from the panel. The constant impedance load is optimized to represent maximum power output at maximum irradiance. This is evident from the power output for solar irradiance levels of 1000 w/m2. The MPPT controller adjusts the panel output to match it with the power output for the optimal load impedance. 33 Figure 4.5b shows the power output from a PV panel, with and without an MPPT controller. For solar radiation value less than 1000 w/m2, the MPPT controlled PV panel shows a higher power output than the constant impedance load. This illustrates that at suboptimal load, the MPPT con- troller adjusts the duty cycle, extracting maximum power from the panel. The constant impedance load is optimized to represent maximum power output at maximum irradiance. This is evident from the adjusts the panel output 0 0.5 1 1.5 2 2.5 3 3.5 4 Time (seconds) 0 200 400 600 800 1000 1200 Ir ra d ia n c e ( W /m 2 ) Irradiance (W/m2) 0 0.5 1 1.5 2 2.5 3 3.5 4 Time (seconds) 0 2 4 6 8 P o w e r (W ) With MPPT Without MPPT (b) Power output from two similar solar panels, with and without an MPPT controller Figure 4.5: PV output with and without an MPPT controller Figure 4.6 shows the plot of output power vs panel voltage for a solar panel controlled using an MPPT controller. The power output is superimposed on the power curves corresponding to various solar irradiance values. Maximum power for a given solar irradiance occurs at the tip of 33 (a) Solar irradiance profile. Figure 4.5b shows the power output from a PV panel, with and without an MPPT controller. For solar radiation value less than 1000 w/m2, the MPPT controlled PV panel shows a higher power output than the constant impedance load. This illustrates that at suboptimal load, the MPPT con- troller adjusts the duty cycle, extracting maximum power from the panel. The constant impedance load is optimized to represent maximum power output at maximum irradiance. This is evident from the power output for solar irradiance levels of 1000 w/m2. The MPPT controller adjusts the panel output to match it with the power output for the optimal load impedance. 200 400 600 800 1000 1200 Ir ra d ia n c e ( W /m 2 ) Irradiance (W/m2) 0 0.5 1 1.5 2 2.5 3 3.5 4 Time (seconds) 0 2 4 6 8 10 P o w e r (W ) 10 4 With MPPT Without MPPT Figure 4.6 shows the plot of output power vs panel voltage for a solar panel controlled using an MPPT controller. The power output is superimposed on the power curves corresponding to various solar irradiance values. Maximum power for a given solar irradiance occurs at the tip of 33 (b) Power output from two similar solar panels, with and without an MPPT controller. Figure 4.5: Power output with and without MPPT controller. Figure 4.6 shows the plot of output power vs panel voltage for a solar panel controlled using an MPPT controller. The power output is superimposed on the power curves corresponding to various solar irradiance values. Maximum power for a given solar irradiance occurs at the tip of the curve. Notice that the MPPT controller tracks the maximum power resulting from changes in the irradiance. This is shows up as a zigzag tracking curve that follows the tips of the power curves. 34 the curve. Notice that the MPPT controller tracks the maximum power resulting from changes in the irradiance. This is shows up as a zigzag curve that follows the tips of the curves. 0 50 100 150 200 250 300 350 Voltage (V) 0 1 2 3 4 5 6 7 8 9 10 P o w e r (W ) 10 4 0.2 kW/m 2 0.4 kW/m 2 0.6 kW/m 2 0.8 kW/m 2 1 kW/m 2 Figure values 34 Figure 4.6: PV panel power output superimposed on the power curves for various irradiance values. 35 Chapter 5 Battery Storage System Grids relying on renewable sources of energy such as wind and photovoltaics require some form of energy buffer. The energy buffer helps to overcome fluctuations in the power output from these sources. The buffer, thus, stabilizes the output to provide a consistent power. Battery banks have been successfully employed in large grids to meet power demands in peak hours. Battery banks are not widely employed because of high investment cost and the issue of economic feasibility. One important characteristic of the battery is that, it is an instantaneous energy source. Energy can be stored in the battery during the charge cycle, when the load demand is low. This stored energy can then be harnessed when needed during high demand. This property of the battery is utilized in microgrids. It acts as an on demand energy source to provide the much necessary power to overcome transients. There are numerous battery storage technologies currently in use. Battery technology refers to the underlying chemistry of the battery and the material composition. Until the recent past, the preferable choice of battery technology has been the lead acid battery. It has a fairly constant voltage operation, and is economical. Another battery type that has been gaining a lot of momen- tum is the lithium-ion battery. Li-ion batteries has the largest energy density and close to 100% storage efficiency compared to all the other commercial battery types [31]. Increasing demand and improvement in manufacturing techniques has lead to decrease in the price and an increase in the energy density. Thus, Li-ion batteries make an ideal choice to act as an energy buffer in a microgrid. The next sections describe the battery model, the charge sequence for a lithium ion battery and the battery controller, respectively. 36 5.1 Battery Model The Simscape Power Systems, Specialized Technology library has a battery model that can simulate various types of batteries [32]. Battery discharge is modeled using fdischarge(it, i ∗, i) = E0 − k Q Q− it .i ∗ −K. Q Q− it .it+ A.r−Bit (5.1) where E0 is the constant voltage, K is polarization constant (units in Ah−1), i∗ is low frequency current dynamics (units in A), i is the battery current, it is the extracted capacity (units in Ah or C), Q is maximum battery capacity (in Ah), A is exponential voltage, and B is the exponential capacity. Battery charging is modeled using the following equation fcharge(it, i ∗, i) = E0 − k Q 0.1Q+ it .i∗ −K. Q Q− it .it+ A.r−Bit (5.2) Nominal voltage is defined in terms of the discharge characteristics. Discharge characteristics of a battery are evaluated by discharging the battery at constant current. Nominal voltage is the battery voltage at the end of the linear voltage response when discharging at constant current. Fig- ure 5.1 shows the discharge curves for a lithium-ion battery at various discharge currents, obtained using plotting function in the battery model. Battery specifications are listed below. Table 5.1: Li-ion battery specifications. Specifications Details Battery Capacity 2.3 Ah Nominal Voltage 3.22 Ah Fully Charged Voltage 3.7 V Internal Resistance 10mΩ 37 0 0.5 1 1.5 2 2.5 3 3.5 Time (hours) 2.5 3 3.5 4 V o lt a g e Nominal Current Discharge Characteristic at 0.43478C (1A) Discharge curve Nominal area Exponential area 0 0.5 1 1.5 2 2.5 3 3.5 Time (hours) 3 3.5 4 V o lt a g e E0 = 3.4916, R = 0.014, K = 0.010489, A = 0.2704, B = 26.5487 1 A 5.2 Battery controller A lithium-ion battery has stringent charge requirements. Failing to meet these might result in permanent damage to the battery [34]. This necessitates that a battery be connected to the application circuit via a battery controller. 5.2.1 Lithium-ion Charging Algorithm Figure 5.2 shows the typical charging sequence in a lithium ion battery [35]. The charging sequence starts with the charger acting as a constant current source. In constant current mode, there is an increase in battery voltage and state of charge. The controller constantly monitors the terminal voltage and when it reaches a reference value, the controller switches from constant current mode to constant voltage mode. The reference value is determined from the battery datasheet and it corresponds to battery voltage at full charge. In constant voltage mode, the battery terminal voltage is held at a constant value. This results in decreasing battery current. Lithium-ion batteries are sensitive to overcharging. The battery charging is terminated when the state of charge is 100%. 37 Figure 5.1: Discharge curve for the battery. 5.2 Battery Controller A lithium-ion battery has stringent charge requirements. Failing to meet these might result in permanent damage to the battery [33]. This necessitates that a battery be connected to the application circuit via a battery controller. 5.2.1 Lithium-ion Battery Charging Algorithm Figure 5.2 shows the typical charging sequence in a lithium ion battery [34]. The charging sequence starts with the charger acting as a constant current source. In constant current mode, there is an increase in battery voltage and state of charge. The controller constantly monitors the terminal voltage and when it reaches a reference value, the controller switches from constant current mode to constant voltage mode. The reference value is determined from the battery datasheet and it corresponds to battery voltage at full charge. In constant voltage mode, the battery terminal voltage is held at a constant value. This results in decreasing battery current. Lithium-ion batteries are sensitive to overcharging. To prevent overcharging, the controller monitors the battery state of charge and the charging is terminated when the state of charge reaches 100%. 38 5.2.2 Figure 5.3 shows Simulink implementation of the battery controller. The controller consists of a battery controller block that contains the control system and a controller function block. The controller function block is responsible for selecting the appropriate controller operation mode. The controller commands a control output ’D’ (Duty cycle) that controls a buck-boost (two quad- rant DC/DC) converter. The converter block is sourced from Simulink Simscape Power Systems, Specialized Technology Library. The two-quadrant DC/DC converter is setup in current control mode. During the charge sequence, the controller monitors the battery SOC and switches from constant current mode to constant voltage mode when the measured SOC exceeds the reference. Figure 5.4 shows the battery controller block. The two quadrant DC/DC converter is setup in current control mode. Based on the selected mode of operation, the controller generates a reference current that is fed to the current regulator. The controller mask allows user to setup the controller in constant voltage mode or constant current mode. In constant voltage mode, the battery controller acts as a constant voltage source when dis- charging. During the charge cycle the controller operates in the charging cycle described in Sub- section 5.2.1. During the charge cycle, the controller transitions from constant current mode to constant voltage mode. This transition is implemented by a selector switch that selects the ap- propriate reference current value ‘Iref’. Control structures that implement such switching suffer from abrupt change in the control output, that shows up as a bump in the controller output. The 38 Figure 5.2: Lithium-ion battery charging sequence. 5.2.2 Battery Controller Implementation in Simulink Figure 5.3 shows Simulink implementation of the battery controller. The controller consists of a battery controller block that contains the control system and a controller function block. The controller function block is responsible for selecting the appropriate controller operation mode. The controller commands a control output ‘D’ (Duty cycle) that controls a buck-boost (two quad- rant DC/DC) converter. The converter block is sourced from Simulink Simscape Power Systems, Specialized Technology Library. The two-quadrant DC/DC converter is setup in current control mode. The battery controller block lets user select way the battery acts, either as a constant voltage source or constant current source. Figure 5.4 shows the battery controller block. The two quadrant DC/DC converter is setup in current control mode. Based on the selected mode of operation, the controller generates a reference current that is fed to the current regulator. In constant voltage source mode, the battery controller acts as a constant voltage source when discharging. During the charge cycle, the controller charges the battery using the charging cycle described in Subsection 5.2.1. The charging algorithm states that the controller should transition from constant current mode to constant voltage mode, when the battery terminal voltage exceeds a set reference value. This transition is implemented by a selector switch that selects the appropriate reference current value ‘Iref’. Control structures that implement such switching suffer from abrupt 39 1 Charge-Discharge i+ - Current Msr + L+ C BL 1 + - D Two-Quadrant DC/DC Converter + C1 1 Bat + 2 Bat - 3 + + R1 4 - chrgModeSel CC-CV Select I Ref V Ref Chrg V Ref Boost V feedback Boost I feedback V Bat D Controller v+- Vout msr [V_out] [V_out] VRefBoost v+- Vin Msr VRefBuck 2 Iref CcCvModeSel 1 measurements [I] [I] 3 Bat SOC 100 D Idc controller output. This results in the controller integrator value to saturate or deviate resulting in a different control output. Such a scenario is avoided by implementing a bumpless transfer of con- trol implemented by tracking the output [36]. Tracking is implemented in the ‘Voltage Regulator Charging’ block shown as an input port ‘TR’. In constant voltage mode, the user has the option of implementing a custom current controller that feeds directly into the current regulator. Sign of the reference current determines the direction of current flow. The battery controller was verified on an A123 lithium-ion battery model. Battery specifica- tions were described in Table 5.1. Figure 5.5 shows the battery voltage during the charge cycle. The battery is charged in the constant current mode at the rate of 1 C. Notice the increase in the battery voltage as the charging progresses. When the battery voltage reaches the fully charged voltage, the controller switches from constant current mode to constant voltage mode. This results in a flat curve resulting from constant voltage as the SOC increases. 39 Figure 5.3: Battery controller with converter Simulink implementation. change in the control output, that shows up as a bump in the controller output. The reason for this abrupt change is because the controller that takes over the control is not tracking the controller output. This results in the controller integrator value to saturate or deviate resulting in a different control output. Such a scenario is avoided by implementing a bumpless transfer of control imple- mented by tracking the output [22]. Tracking is implemented in the ‘Voltage Regulator Charging ’block shown as an input port ‘TR’. As a constant current source, the user has the option of implementing a custom current con- troller that sets the reference current. Sign of the reference current determines the battery charge or discharge mode. Figure 5.5 shows the controller GUI and the parameters mask with the parameter fields. 40 Current Regulator Voltage Regulator Charging Voltage Regulator Discharging + + - - 1 D 1 chrgModeSel PID(s) PID(s) 0 1 *, 2 3 I Ref 5 V Ref Boost 6 V feedback Boost 7 I feedback 4 V Ref Chrg 8 V Bat chrgSel ccCvModeSel VRef VBat stateSelIdx ccCvModeSelIdx Battery Controller 2 CC-CV Select 1 *, 2-IRefCharging[VrefChrg] [VBat] [VBat] [VrefChrg] PID(s) TR [Iref] [Iref] Iref Idc 0 10 20 30 40 50 60 70 80 90 SOC (%) 3.2 3.4 3.6 3.8 V o lt a g e ( V ) Figure 5.5: Battery voltage vs SOC during charge cycle 40 Figure 5.4: Battery controllers. Figure 5.5: Battery controller GUI with the parameters mask. The battery controller was verified on an A123 lithium-ion battery model. Battery specifica- tions were described in Table 5.1. Figure 5.6 shows the battery voltage during the charge cycle. The battery is charged in the constant current mode at the rate of 1 C. Notice the increase in the 41 battery voltage as the charging progresses. When the battery voltage reaches the fully charged voltage, the controller switches from constant current mode to constant voltage mode. This results in a flat curve as the voltage is held constant. The battery continues to draw current and the state of charge keeps on increasing until it is fully charged. At that time, the controller disables the charging. Current Regulator Voltage Regulator Charging Voltage Regulator Discharging + + - - 1 D 1 chrgModeSel PID(s) PID(s) 0 1 *, 2 3 I Ref 5 V Ref Boost 6 V feedback Boost 7 I feedback 4 V Ref Chrg 8 V Bat chrgSel ccCvModeSel VRef VBat stateSelIdx ccCvModeSelIdx Battery Controller 2 CC-CV Select 1 *, 2-IRefCharging[VrefChrg] [VBat] [VBat] [VrefChrg] PID(s) TR [Iref] [Iref] Iref 0 10 20 30 40 50 60 70 80 90 SOC (%) 3.2 3.4 3.6 3.8 V o lt a g e ( V ) 40 Figure 5.6: Battery voltage vs SOC during charge cycle. The State of Charge (SOC) of the battery is an important measurement. It determines the actual capacity of the battery. In a physical system, one does not have the information about the internal chemistry of the battery. Thus, the state of charge must be determined from measurable quantities, such as, instantaneous voltage, current etc. Various techniques have been proposed and developed to determine actual state of charge [35] [36] [27]. The battery simulation model in the Sim Power Systems library computes the state of charge using equation 5.2. 42 Chapter 6 Universal Bridge Converter Microgrids are designed so that they can be deployed to work with existing electrical infras- tructure. Modern electrical infrastructure and electrical appliances are built around the AC grid. PV and battery sources as described in previous sections are DC power sources. Thus, a DC to AC converter becomes an essential component of a microgrid. Microgrid topology like the one described in Chapter 2, section 2.1, require a unidirectional power flow, while some microgrid topologies, like the one described in section 2.2, require a bidirectional power flow. Thus, a con- verter topology that fulfills the above criteria is the three-phase bridge converter. The library is targeted towards research into microgrids, thus, the user must have the flexibility to implement different types of configurations. Keeping this in mind, the library was developed so as accommodate different types of implementations that a researcher might encounter. The chapter describes the reference frame theory, three-phase bridge converter and the bridge converter control techniques, respectively. 6.1 Reference frame theory and direct quadrature zero trans- formation In a three-phase system, the electrical quantities are sinusoids that are functions of rotor posi- tion. Thus, these quantities continuously vary with time, making their analysis difficult. A change of variables can be used to reduce the complexity. This change of variables is a transformation of quantities from one reference frame to other. By selecting appropriate reference frame, one can eliminate all the rotor position-dependent quantities and replace them with equivalent DC type quantities. This type of transformation greatly simplifies the analysis and control of three phase systems. 43 Figure 6.1: ABC to dq0 transformation One of the widely used transform is the direct-quadrature-zero or 'dq0'transformation. Fig- ure 6.1 shows the ABC axis along with the dq0 axis. The dq0 transform is the product of the Clark transform and the Park transform [40]. The Clark transforms converts the ABC vectors to the XYZ reference frame (also called the αβ0 ). The ABC vectors can represent any electrical quantity viz. current or voltage etc. The Clark transform used is described in equation 6.1. Kc =   1 −1 2 −1 2 0 √ 3 2 − √ 3 2 1 2 1 2 1 2   (6.1) The advantage of this transformation is that the three sinusoids are reduced to a single non zero value. The y and the z axis are reduced to zero, thus simplifying the calculations. In next sections it will be described how the dq0 transform can be used to simplify calculations relating the real and the reactive power in three-phase AC systems. This is a power variant form because the transformation matrix is not unitary. In this transformation, the q axis leads the d axis as shown in Figure 6.1. The Clark transform converts the ABC vectors, but because the vectors are a function of the rotor position, they still vary with time. To convert the time varying quantities to DC type values, 43 Figure 6.1: ABC to dq0 transformation. One of the widely used transform is the direct-quadrature-zero or ‘dq0’transformation. Figure 6.1 shows the ABC axis along with the dq0 axis. The dq0 transform is the product of the Clark transform and the Park transform [37]. The Clark transforms converts the ABC vectors to the XYZ reference frame (also called the αβ0). The ABC vectors can represent any electrical quantity viz. current or voltage etc. The Clark transform used is described in equation 6.1. Kc =   1 −1 2 −1 2 0 √ 3 2 − √ 3 2 1 2 1 2 1 2   (6.1) The advantage of this transformation is that the three sinusoids are reduced to a single non zero value. The y and the z axis are reduced to zero, thus simplifying the calculations. This is a power variant form because the transformation matrix is not unitary. In this transformation, the q axis leads the d axis as shown in Figure 6.1. The Clark transform converts the ABC vectors to XYZ, but because the vectors are a function of the rotor position, they still vary with time. To convert the time varying quantities to DC type values, one needs to rotate the XYZ frame at the angular velocity of the rotor. The angle of rotation 44 of the frame θ, is replaced by the product of angular velocity of the rotor and the instantaneous time. Park transform which is described below. Kp =   cos(θ) sin(θ) 0 − sin(θ) cos(θ) 0 0 0 1   (6.2) The dq0 transform is a Clark transformed reference frame rotating at an arbitrary angul