Development of an Automated Framework for Testing Grid Code Compliance Master’s thesis in Sustainable power engineering and electromobility VIKTOR UGGLARE DEPARTMENT OF ELECTRICAL ENGINEERING CHALMERS UNIVERSITY OF TECHNOLOGY Gothenburg, Sweden 2025 www.chalmers.se www.chalmers.se Master’s thesis 2025 Development of an Automated Framework for Testing Grid Code Compliance VIKTOR UGGLARE Department of Electrical Engineering Division of Electric Power Engineering Chalmers University of Technology Gothenburg, Sweden 2025 Development of an Automated Framework for Testing Grid Code Compliance VIKTOR UGGLARE © VIKTOR UGGLARE, 2025. Supervisor: Shemsedin Salih, Hitachi Energy Examiner: Massimo Bongiorno, Department of Electric Power Engineering Master’s Thesis 2025 Department of Electrical Engineering Division of Electric Power Engineering Chalmers University of Technology SE-412 96 Gothenburg Telephone +46 31 772 1000 Typeset in LATEX, template by Kyriaki Antoniadou-Plytaria Printed by Chalmers Reproservice Gothenburg, Sweden 2025 ii Development of an Automated Framework for Testing Grid Code Compliance VIKTOR UGGLARE Department of Electrical Engineering Chalmers University of Technology Abstract The European Network of Transmission System Operators for Electricity (ENTSO- E) has designed network codes to ensure the safe operation of the European power grids. Each individual transmission system operator (TSO) has then, based on the network codes from ENTSO-E, defined grid codes that all operators connected to the power system must comply with to be allowed to stay connected. The focus of this thesis has been designing simulation tests and developing an automated testing framework to aid in the process of proving grid code compliance. The framework is developed using Energinet’s (the Danish TSO) type D wind farm connection re- quirements as an example. It can easily be adapted for use with any other grid codes. The framework uses simulation models built with DIgSILENT PowerFac- tory. A study case model was developed in PowerFactory to represent a wind farm containing 12 wind turbines with a total rated power of 30 MW and a connection voltage of 220 kV. The framework has then been able to successfully conduct and run load flow calculations and dynamic RMS (Root Mean Square) simulations to identify both compliance and non-compliance with grid code requirements for the study case wind farm. Keywords: Testing framework, grid code compliance, DIgSILENT PowerFactory, load flow calculation, RMS simulation, Requirements for Generators iii List of Acronyms Below is the list of acronyms that have been used throughout this thesis listed in alphabetical order: DCC Demand Connection Code DFIG Doubly Fed Induction Generator DSO Distribution System Operator EMT Electromagnetic Transient ENTSO-E European Network of Transmission System Operators for Electric- ity FRT Fault Ride Through LFSM-O Limited Sensitive Frequency Mode - Overfrequency LFSM-U Limited Sensitive Frequency Mode - Underfrequency PDT Phase-Domain Transient PF Power Factor POC Point of Connection PPC Power Plant Controller PPM Power Plant Module PtX Power-to-X RfG Requirements for Generators RMS Root Mean Square ROCOF Rate Of Change Of Frequency TSO Transmission System Operator v vi Nomenclature Below is the nomenclature of acronyms and variables that have been used throughout this thesis, listed in alphabetical order. fgrid Grid frequency fmean,old Previous measured average frequency fmean,new Newest measured average frequency fR Threshold frequency for active power downward regulation In Nominal current IQ Reactive current Pn Nominal active power Pout Active power output Psp Active power setpoint Ptol Active power tolerance Qout Reactive power output Qsp Reactive power setpoint Qtol Reactive power tolerance treq Required time Uc Nominal voltage Upoc Voltage at the PoC vwind Wind speed Z1, Z2, Z0 Sequence impedances vii Contents List of Acronyms v Nomenclature vi 1 Introduction 1 1.1 Aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Scope & limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Theory 3 2.1 Grid codes & requirements . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 Reactive power capability . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 Frequency deviation . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.1 ROCOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3.2 Over- & underfrequency . . . . . . . . . . . . . . . . . . . . . 7 2.4 Fault ride through . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1 Voltage support . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.5 Active power constraint . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.5.1 Constraint functions . . . . . . . . . . . . . . . . . . . . . . . 10 2.5.2 Emergency control . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6 Reactive power control . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.1 Control functions . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Methods 16 3.1 Simulation model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2 Grid code test framework . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 The structure of the tests . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.1 PQ-capability . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.2 VQ-capability . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.3 Frequency test . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.4 Fault ride through . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.5 Overwind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3.6 P-constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3.7 Q-control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4 Results 21 4.1 PQ-capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.2 VQ-capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 viii Contents 4.3 Frequency deviation . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.4 Fault ride through . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.5 Overwind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.6 P-constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.7 Q-control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5 Conclusion & future work 38 Bibliography 39 A Appendix 1 I B Appendix 2 VIII ix 1 Introduction Electricity is a crucial part in today’s society and allowed for the fast development of the modern age over the past one and a half centuries. From Maxwell and Faraday discoveries and innovations within electromagnetism and electromagnetic induction in the 19th century, leading to the innovation of electric generators and motors [1][2]. Today where electronic devices can be found everywhere, our society is only becoming more and more dependent on electricity to function. According to En- erdata, the global electricity consumption has grown by roughly 150 % since 1990 from about 10 000 TWh to over 25 000 TWh and the global power production has seen a similar increase during the same time period, going from about 12 000 TWh up to just under 30 000 TWh [3][4]. With these trends it puts large responsibility on the global society to make sure a large amount of the power produced comes from renewable sources for this to be sustainable. Today 30 % of the electricity produced comes from renewable sources, an increase with 50 % since 2010, where wind and solar stand for 13.7 % of the global power mix [5][6]. During 2023 new records in global renewable installations were reached with 349 GW of new solar capacity and 113 GW of new wind capacity. In Denmark, two new offshore wind farm with a total capacity of 344 MW were put into operation giving them their power mix a total 67.4 % of wind and solar production [7]. This is an increase from 20 % in 2010, resulting in Denmark having the highest share of wind and solar power in the world. When converter-based production plants (wind farms, solar plants) and consumption plants (PtX-plants, green steel plants) are integrated to the power system, careful consideration of their impact on the power system is required [8]. The European Network of Transmission System Operators for Electricity (ENTSO-E) has defined network codes to facilitate the efficiency and integration of the European electricity market. These codes can be divided into four separate families, Connection, Oper- ations, Market, and Cybersecurity, each with their own set of regulations [9]. The Connection codes has separate regulations for the integration of production plants (Requirements for Generators, RfG) and consumption plants (Demand Connection Code, DCC), also known as grid codes. The purpose of these grid codes are to make sure that, with the integration of new plants, the power system can continue to operate safely and ensure stable operation as well as giving a level playing field for all the plants connected. There are also country-specific regulations, set by the the relevant Transmission System Operator (TSO) and Distribution System Opera- tor (DSO), to furthermore specify the requirements needed for the European power systems harmonious operation. 1 1. Introduction The choice of technology used in a production plant (DFIG, full-converter turbines) or a consumption plant (thyristor-based or active front-end converters) could have an impact on the plant’s ability to satisfy the grid codes. Thus, TSOs require plant owners to perform calculations and simulations to verify their plants fulfill the re- quirements before they are allowed to connect to the grid and start operating [10]. For this, various dynamic simulation tests are carried out for different events in the system to verify the plants dynamic performance. The test reports, together with associated models, are then delivered to the TSOs as proof of grid code compliance. Production plants are also classified as type A, B, C, or D depending on their capac- ity and the voltage level at the grid connection point [11]. The specific thresholds for capacity and voltage level are set by the TSO, which in Denmark is Energinet. Depending on the plant classification there will be different requirements. Type D has the most requirements as these plants have capacities above 25 MW and/or a connection voltage over 110 kV [12]. 1.1 Aim The aim of the thesis is to analyze the integration of a production facility to a power system. The analysis involve carrying out various simulations to verify if the production facility complies with the grid code. An automated testing framework will be developed to support in the analysis of the production facility and a wind farm connecting to the Danish transmission system will be used as a case study. However, the testing framework will be kept generic so it can later be adapted to support the analysis of other types of production plants and consumptions plants. 1.2 Scope & limitations The focus of the thesis will be design of the test process for grid code compliance, the development of the testing framework and its compatibility with the power sys- tem analysis software DIgSILENT PowerFactory. The testing framework will be developed towards generic grid code testing to make it adaptable to multiple grid code requirements with minimum modifications. The discussion in this thesis with regard to specific grid codes are limited to the Danish grid code as set by the Danish TSO Energinet for type D wind farms. The Danish TSO Energinet requires the grid code compliance simulation tests to be performed both in PowerFactory and in the software PSCAD [13]. Thus, the testing framework will not be able to perform a full grid code compliance analysis, but only the parts requiring load flow calculations and dynamic RMS (Root Mean Square) simulations in PowerFactory. The simulation model that will be used as the study case for the thesis will only function as a platform to perform the grid code compliance tests on. Therefore if non-compliance with the grid code is identified, possible reasons for the non-compliance will be discussed but corrective measures will not be suggested. 2 2 Theory 2.1 Grid codes & requirements The European power grid is split into separate synchronous areas with most of them stretching over multiple countries and to ensure its safety and stability, ENSTO-E has put together a set of rules and guidelines for the purpose to "facilitate the harmonisation, integration and efficiency of the European electricity market" [9]. These guidelines, also known as network codes or grid codes, cover the entirety of the power grids operation and are divided into four separate families, "Connection", "Operations", "Market", and "Cybersecurity". These families are then divided into subsections and the subsection that was be relevant for this thesis was "Requirement for Generators" (RfG) within the "Connection" family. This subsection specifies the required capabilities and control functions needed for production plants, both be- fore and after integration to the power system. Even if the network codes set by ENTSO-E cover all of Europe, there are still country-specific requirements set by the relevant TSO’s and DSO’s to further specify the required capabilities and control function parameters needed for them to ensure safe operation of their transmission and distribution systems [12]. The requirements for production plants set by the grid code differs depending on their type classification [12]. There are four classifications, type A to D, which are based on the production plants total rated power Pn and voltage level at the point of connection (POC) Upoc. The thresholds between each type is set by the relevant TSO, which in Denmark is Energinet and their thresholds are presented in Table 2.1 and where 0.8 kW is the threshold to be classified as a production plant [11]. The classification will increase from A to D as the thresholds for Pn and/or Upoc are exceeded. A production plant will be classified as type D as long as at least one of the thresholds are exceeded. Thus, a production plant with Upoc = 20 kV and Pn = 1 MW would be classified as type B, but if Upoc = 220 kV instead it would be classified as type D, even if Pn < 25 MW. The requirements for production plants get more strict and extensive as the type goes from A to D [12]. Table 2.1: Threshold levels for each production plant typing based on rated power Pn and connection voltage Upoc [11] Type A Type B Type C Type D Pn > 0.8 kW > 125 kW > 3 MW > 25 MW Upoc - - - > 110 kV 3 2. Theory 2.2 Reactive power capability The reactive power capability of a production plant describes how much reactive power it can produce/consume at any given operating point in regards to active power production and connection voltage level. The required by the Danish TSO for type D wind farms are presented in figures below [14]. Figure 2.2 shows their requirement with regards to active power production and Figure 2.1 showing it with regards to the POC voltage where Uc represents the nominal voltage, Upoc = 1.0 pu. The wind farm should be able to operate with a setpoint for reactive power anywhere within the hatched areas of both figures. For any given operating point for active power output Pout and Upoc, the smaller area will limit the larger. For example, if Pout = 0.8 pu and Upoc = 0.9 pu, the wind farm is not required to be capable of any consumption reactive power but should still be capable of producing at Qout = 0.33 pu. Figure 2.1: Reactive power capability requirements in regards to the wind farms voltage at point of connection where Uc stands for nominal voltage [14] 4 2. Theory Figure 2.2: Reactive power capability requirements in regards to the active power production, in relation to nominal power, from the wind farm at Upoc = 1 pu [14] 2.3 Frequency deviation As the frequency fluctuates there are requirements for how long a production facility should be capable of staying operational [14]. As presented in figure 2.3, a type D wind farm should be capable of normal power production while the frequency stays within 49.0-51.0 Hz. If the frequency goes down to 47.5-49.0 Hz, the wind farm should be able to stay in normal production for 30 minutes before deviating. The 5 2. Theory requirements are the same between 51.0-51.5 Hz. If the frequency drops down to 47.0-47.5 Hz or increases up to 51.5-52.0 Hz, the wind farm has to stay in normal production for a minimum of 30 s. Below 47.0 Hz and above 52.0 Hz the wind farm is allowed to disconnect as part of its protective measure. After disconnecting as the result of a frequency deviation, the wind farm should be able to automatically reconnect within 3 minutes after the frequency has returned to normal operating conditions, 49.0-51.0 Hz, and during reconnection the gradient for the active power may not exceed 20 % Pn/min [12]. Figure 2.3: Wind power plant specific minimum production times in relation to voltage and frequency [14] 2.3.1 ROCOF During shifts in grid frequency, the wind farm needs to be capable of normal oper- ate through a rate of change of frequency (ROCOF) within ±2.0 Hz/s [12]. If the ROCOF exceeds | ± 2.5| Hz/s for more than 80 ms during a frequency deviation, the wind farm is allowed to trip and disconnect. The Danish TSO specifies that ROCOF should be calculated from the mean values of the measurements from the last 200 ms period which should be updated and recalculated every 20 ms. The ROCOF is then calculated as the average value from the last two mean values, as shown in equation 2.1 below. ROCOF = fmean,new − fmean,old 0.020 [Hz/s] (2.1) 6 2. Theory 2.3.2 Over- & underfrequency The grid code states that a type D wind farm should also be capable to respond to frequency deviations. During the instance of overfrequency the wind farm should lower its active power output [14]. Figure 2.4 shows the frequency response for wind farms where fR represents the limit frequency where the active power downward regulation should begin. The value for fR is set by the TSO with the standard value being 50.2 Hz, but the wind farm should be able to set its value anywhere in the range 50.0-52.0 Hz. If fR is set to 52.0 Hz the downward regulation function is considered turned off. The droop in this context is considered as the change in active power as a function of the grid frequency and could be set to any value in the range 2-12 % of Pn with the standard value being 4 % of Pn. When a frequency deviation above fR is detected, the downward regulation must commence within 2 s and within 15 s it must operate according to the control function within the tolerance of ±10 % of Pn. Figure 2.4: The active power downward regulation in response to increased grid frequency [14] During underfrequency the TSO has to specify the admissible reduction in active power production with the falling frequency and figure 2.5 shows the span, defined by ENTSO-E, where the admissible reduction has to be specified. The span for the reduction rate is between 2-10 % of Pn that is allowed to start between 49.0-49.5 Hz. The admissible active power reduction specified by the Danish TSO is 6 % of Pn starting at 49.0 Hz. 7 2. Theory Figure 2.5: The span set by ENTSO-E where TSOs has to specify their admissible reduction in active power production with falling grid frequency [15] 2.4 Fault ride through When a fault occurs and the voltage drops, the wind farm should be capable of remaining operational for a set amount of time depending on the voltage level at the point of connection. Figure 2.6 shows the voltage profile that the wind farm should be able to withstand [14]. The voltage profile shown drops from Upoc = 1.0 pu down to 0.2 pu as the fault occurs at t = 0. The voltage then increases linearly up 0.9 pu from t = 0.5 s until t = 1.5 s where it then stays stable. The areas around the voltage curve is divided into three sections, Area A, B, and C. Area A is the area above Upoc = 0.9 pu, Area B is the area below Area A but above the voltage curve, and Area C is area below the voltage curve. As long as Upoc stays in area A during a fault in grid the wind farm should continue the production as normal. If the voltage drops into Area B, Upoc < 0.9 pu, this is considered a voltage deviation and the wind farm should switch over to voltage support and prioritize the production of reactive current to help the grid stabilize the voltage. If the voltage would drop into Area C, the wind farm is allowed to disconnect from the grid. 8 2. Theory Figure 2.6: Fault-ride-through requirements for wind turbines [14] 2.4.1 Voltage support During a voltage deviation when the wind farm giving voltage support to the grid, the synchronous component of the reactive current IQ must follow the specified characteristic shown in figure 2.7, where the areas A, B, and C represents the same areas as in figure 2.6 [14]. As the 50 Hz component of Upoc, indicated by the vertical axis in figure 2.7, drops below 0.9 pu IQ should increase linearly from 0 up to 1.0 pu as Upoc drops down to 0.5 pu. If the voltage keeps dropping IQ should be kept at 1.0 pu. After detecting a voltage deviation IQ should follow the characteristic after 100 ms with an accepted tolerance of ±20 % within the design limitations of the wind farm. 9 2. Theory Figure 2.7: Reactive current control requirements during voltage dips for type D Wind farms in Denmark [14] 2.5 Active power constraint The Danish TSO requires type D wind farms to have three different active power constraint functions: absolute power constraint, delta power constraint, and ramp rate constraint [14]. The purpose of the constraint functions is to avoid additional overloading during faults or help support the power grid during other stability de- viations. Thus for the absolute and delta power constraint functions, a wind farm should be capable of continuous regulation of active power to a random setpoint within the interval from 100 % to a maximum of 20 % of rated power. 2.5.1 Constraint functions The absolute power constraint function limits the active power output in the POC to a maximum setpoint value [14]. This function is mainly used to help protect the power grid from from getting overloaded in critical situations. Once a setpoint is given by the TSO, the wind farm has to commence the regulation towards the setpoint within 2 s and operate with a tolerance of 2 % of Pn within 10 s. Delta power constraint, also known as spinning reserve, is mainly used in collab- oration with frequency response functions [14]. The constraint functions limits the active power output with a setpoint-defined value in relation to the available active power. This allows for the upward regulation of power during drops in frequency. 10 2. Theory Similar to absolute power constraint, the regulation towards a new setpoint must commence within 2 s and within 10 s it should operate with a tolerance of ±2 % of Pn. When used for frequency control, as shown in figure 2.8, it must be possible to set the frequency setpoints fmin, fmax, and f1 to f7 to any value in the range 47.0-52.0 Hz. The setpoints f1 to f4 are used to adjust the frequency response the requirements of the ancillary service "critical power frequency". PDelta represents the value of which the constraint function is limiting the active power with. Droop 1, 2, 3, and 4 follow the same requirements, of being set between 2-12 % of Pn. After the detection of a frequency deviations the frequency control should start within 2 s and be completed within 15 s, but when regulating the power upward it is allowed for the regulation time to be increased, due to design limitations, if the upward regulation exceeds 10 % of Pn. During downward regulation below Pmin its allowed for individual wind turbines to shutdown. Figure 2.8: Example of the Delta power constraint function for a type D wind power plant [14] The ramp rate constraint function limits the maximum rate at which the active power production is allowed to change in the events of setpoint changes or wind speed variations [14]. It is normally used to prevent impacts to the stability of the power grid from rapid changes in active power. The ramp rate, both for upward and downward regulation, can be set anywhere within the span of 1 % - 20 % of Pn/min, but no higher than 60 MW/min [12]. The standard setpoint value for the ramp rate constraint for wind power plants, required by the Danish TSO, is 100 kW/s [14]. Similar to the other active power constraint functions the regulation to a new setpoint must commence within 2 s and be completed within 10 s with a maximum allowed tolerance of ±2 % of Pn. 11 2. Theory 2.5.2 Emergency control In case of an emergency a wind farm should be capable of quickly regulating the active power output to a minimum of five predetermined setpoints [14]. These set- points are 70 %, 50 %, 40 %, 25 %, and 0 % of Pn and if an order to lower the output is sent out by the TSO, the wind farm has to start the regulation within 1 s and finish the regulation within 10 s from receiving the order. During a downward regulation it is allowed for individual wind turbine to shut down. If the order would require an increase in active power production, from 25 % to 40 % for example, it is acceptable for the regulation to take longer than the required time of 10 s due design limitations. Wind farms should also be capable to down-regulate the power output automatically at high wind speeds, before the activation of the protective functions at cut-off wind speed, to avoid a sudden drop in power production [14]. The downward regulation can be either continuous or discrete but should be performed within the regulation band shown in Figure 2.9. In the case of discrete regulation, the maximum step size may not exceed 25 % of rated power. The exact parameters for the downward regulation band are project specific and has to be agreed with the TSO upon the commissioning of the wind farm, due to the cut-off wind speed being a turbine specific design parameter and the wind conditions being location dependent. Figure 2.9: Active power regulation window for down regulating the power at wind speeds close to cut-off wind speed [14] 2.6 Reactive power control Type D production plants are required to have three control functions for reactive power, constant Q control, power factor control (PF control), and voltage control [12]. The aim of the control functions is to regulate the amount of reactive power being supplied by the wind farm at the POC [14]. Due to each function controlling the reactive power in relation to different setpoints they are all mutually exclusive, 12 2. Theory only one of them can be activated at any given time. 2.6.1 Control functions During constant Q control the wind farm controls the reactive power specific value independently from the active power output and the voltage level in the POC [14]. In Figure 2.10 it is shown how the operating point of the function stays at the same value for reactive power even as the active power varies. If the setpoint for the control function is changed the wind farm should start adjusting to the new setpoint within 2 s and after 30 s it should operate within the tolerance ±2 of Qn from receiving the order. Figure 2.10: Operating point for constant Q control in relation to active power [14] When using PF control the reactive power is adjusted to stay proportional to the active power in the POC [14]. Figure 2.11 shows the operating point of the PF control function adjusting the reactive power in order to follow a constant gradient towards the active power. The wind farm should be receive a setpoint with a res- olution of 0.01 and the control accuracy of the reactive power should, during a 1 minute period, not deviate by more than 2 % of Qn. Similar to constant Q control, adjustments to a new setpoint should begin within 2 s and be completed within 30 s after receiving a setpoint change. 13 2. Theory Figure 2.11: Operating point for PF control in relation to active power [14] Voltage control is uses reactive power to regulate the voltage in the voltage refer- ence point [14]. Figure 2.12 shows the reactive power in relation to the voltage level at the reference point. The setting for the minimum and maximum voltage levels are based on the nominal voltage and for a nominal voltage of 220 kV the setpoint value for Umax is 245 kV (1.114 pu), but for Umin the setpoint value is not specified. If a setpoint change is requested, the adjustments should commence within 2 s and after 10 s the adjustments should be completed. When operating by the new set- point, the function should not deviate by more than ±2 % of Qn over a period of 1 minute. With the droop configured, the wind farm has to capable of performing the voltage control within the voltage limits and its own dynamic range. When the wind farm reaches the design limits of the control function, it should await possible transformer tap change or other voltage control functions from the power system. 14 2. Theory Figure 2.12: Operating point for voltage control in relation to POC voltage [14] 15 3 Methods 3.1 Simulation model The simulation model that was used as the study case for the thesis was a modified version of the "Wind Farm" example model, found in the "Application Examples" folder in DIgSILENT PowerFactory 2024. The example model was containing of six wind turbines with a rated power of 2.5 MW at 0.69 kV, each connected to a transformer rated at 2.8 MVA 0.69/20 kV Dyn5, resulting in a total rated power of 15 MW with a connection voltage of 20 kV, figure A.1 in the appendix presents the model. This defines the modeled wind farm as a type C production plant, but as the aim of the thesis was to analyze the grid code compliance for a type D production plant, therefore some modifications had to done to the model. Hence the total capacity of the wind farm was increased to 30 MW and the connec- tion voltage was set to 220 kV. This was done by removing all the wind turbines except "WTG 1.1", which was set to represent 12 parallel turbines, increasing the rated power to 30 MW. Similarly the wind turbine transformer "Trf 1.1" and in- terconnecting cable "Cable 1.1" got the same update. A new 20/220 kV Dyn5 transformer was included in the model, replacing the "Grid Connection" cable, to increase the connection point voltage to 220 kV. The 20 kV grid equivalence was replaced with a low impedance voltage source (Z1 = 0.666247 + j1.454687 Ω, Z1 = Z2 = Z0) to represent an infinite grid. Figure A.2 in the appendix presents the the final grid model of the wind farm. The simulation models control system was missing some of the required control function. The missing functions were the Delta P-constraint, the Ramp rate P- constraint, the Overwind downward regulation, and the reactive power Voltage- control. The Delta P-constraint, Ramp rate P-constraint, and the Overwind down- ward regulation functions were added into the "Turbine Controller Turbine 1.1"- block of the the "Turbine System Controller", see Figure A.4 and A.3 in appendix 1. The reactive power Voltage-controller was added to the "Mode Selector"-block in the "Park Controller Park Controller (dynamic)"-block. In the "Park Controller Park Control System (dynamic)"-block, the "Added Command Signals"-block was also added to generate the setpoint variable for the Voltage-controller function, see Figure A.6 and A.5 in appendix 1. All the code for the modified/added controller blocks can be found in Appendix 2. 16 3. Methods 3.2 Grid code test framework To aid in the grid code testing process an automated test framework was developed in Python. The test framework contains of six separate files, an excel file and five python files. The structure of the excel file is that one sheet contains all the neces- sary information about the simulation model that is needed to be able to perform the tests, such as rated power, connection voltage, components variable names etc., and another sheet contains the specific grid code parameters needed to construct the tests and evaluate their results. The work flow of the test framework is shown in Figure 3.1 where the first part of the process is providing the model information and grid code parameters found in the excel file to the "Grid Code Testbench" from where each of the implemented tests can be initiated. The "Grid Code Testbench" functions as the main hub from where the user of the framework is able to initiate the tests. When a test is initi- ated from the "Grid Code Testbench", the automated processes in "RfG Testbench" starts by retrieving the the necessary information and parameters from the excel file and distributes it to either "LDF Study" or "Dyn Study" depending on if the test requires load flow calculations or dynamic simulations. "LDF Study" or "Dyn Study" will then setup the test parameters in DIgSILENT PowerFactory and run the calculations/simulations. The test data will be stored in "RfG Testbench" and processed by the "Post Processing" module, which will present the results in plots together with the requirements. This will make it easier to analyze for grid code compliance. Figure 3.1: Block diagram showing the process of the test framework 17 3. Methods 3.3 The structure of the tests In this section, each test will be explained and what part of the grid code they are testing for compliance. 3.3.1 PQ-capability The purpose of the PQ-curve calculation is to show the reactive power capability of the wind farm in relation to the production of active power. To be able to evaluate the full PQ-capability of the wind farm five PQ-curves are calculated at five different voltage levels (Upoc = 0.9, 0.95, 1.0, 1.05, and 1.06 pu). For each voltage level, 100 load flow calculations are performed while ramping the active power output up from 0 up to 1.0 pu and then back down to 0. During the increase of Pout the wind farm is set to maximum consumption of reactive and during the decrease of Pout it is instead set to maximum production of reactive power. The results are then plotted together with the requirements. 3.3.2 VQ-capability The VQ-curve for the wind farm is calculated is a similar way as the PQ-curve. Here, instead of Pout, the voltage Upoc will be increased from 0.9 pu up to 1.06 pu with maximum reactive power consumption and then it is decreased down to 0.9 pu with maximum reactive power production. To check the dependency of the VQ-capability to active power production, the calculations are performed at Pout set to 0, 0.2, 0.5, 0.8, and 1.0 pu. The results are then plotted together with the requirements. 3.3.3 Frequency test The purpose of the frequency test is the check that the wind farm is capable of staying in production for the required time at specified frequency levels, as well as withstanding the specified ROCOF. The test will be run twice at different frequencies for different amount of times but both tests will start at steady-state operation at 50 Hz and all frequency changes will be at the ROCOF of 2 Hz/s. For the first test at t = 0 the frequency is reduced to 47.0 Hz. After 30 s it is increased up to 52.0 Hz and is kept there for another 30 s. The second start also starts at steady-state operation at 50 Hz but a t = 0 the frequency is lowered to 47.5 Hz and is kept there for 30 min. It is then increased up to 51.5 Hz and kept there for another 30 min. The test parameters are the threshold values describe in section 2.3 and Figure 2.3. 3.3.4 Fault ride through The fault ride through (FRT) test checks if the wind farms is able to stay in pro- duction through the voltage dip specified in Figure 2.6. During the voltage dip the reactive current will also be checked so that it follows the required characteristics specified in Figure 2.7. The test starts at steady-state operation with Upoc and Pout set to 1 pu. At t = 0 Upoc is dropped to 0.2 pu and kept there until t = 0.5 s. From 18 3. Methods t = 0.5 until t = 1.5 s Upoc is linearly increased to 0.9 pu where it is kept for the remainder of the simulation. Pout and IQ are measured during the simulation and are later plotted with the requirements. 3.3.5 Overwind The Overwind test checks the ramp down function of the wind farm as the wind speed closes in on the cut-out wind speed of the wind turbines. The requirements from the danish TSO is that the wind farm should implemented a function that ramps down the active power output in a controlled fashion before reaching the cut- off wind speed [14]. The requirements are shown in Figure 2.9. The requirements set for this project is that the ramp down shall begin between 20-22.5 m/s and reach zero in between 22.5-25 m/s. The controller for the wind farm is designed to adjust the reference signal for Pout linearly between 1.0-0.0 pu as the wind speed increases from 20.5 m/s up to 24.5 m/s. 3.3.6 P-constraint The P-constraint function test runs two simulations, one for each control function. During the simulations the setpoints for the control function are changed to check if they are able to adapt to within the required times. To check the functionality of the P-control functions, the available active power for the wind farm will be changed by decreasing and increasing the wind speed and the frequency will also be ramped down and up. The simulations start from steady-state operation with Pout set to 1.0 pu and fgrid set to 50 Hz. At t = 0, 15, and 30 s the setpoints for control functions are changed. For Absolute P-control the setpoints are set from 1.0 pu down to 0.2 pu, back up to 1.0 pu and then down to 0.8 pu. For Delta P-control the setpoints are changed from 0.0 up to 0.8 pu, back to 0.0 and then up 0.15 pu. At t = 50 s the wind speed is lowered from nominal wind speed of 1 pu (15 m/s) to 0.7 pu (10.5 m/s). At t = 100 s the wind speed is increased back to 1 pu. At t = 150 s the frequency is lowered to 47.8 Hz and at t = 200 s it is increased to 51.4 Hz, both changes are performed with a ROCOF of 2 Hz/s. Table 3.1: Time stamps for the P-constraint function tests Time [s] Description t = 0, 15, 30 Setpoint changes t = 50 Wind speed: 15 m/s -> 10.5 m/s t = 100 Wind speed: 10.5 m/s -> 15 m/s t = 150 fgrid : 50 Hz -> 47.8 Hz t = 200 fgrid : 47.8 Hz -> 51.4 Hz 19 3. Methods 3.3.7 Q-control Just as with the P-constraint function tests, the Q-control test also runs 3 sim- ulations to test the different Q-control functions required by the grid code. The simulations start in steady state operation at unit power factor and at t = 0, 40 s, and 80 s the setpoint for the Q-control functions are changed. This is done to check the control functions ability to adapt to setpoint changes and if they are able to comply within the required times. At t = 120 s the wind speed lowered to reduce Pout down to 0.6 pu and at t = 160 s the wind is returned to nominal wind speed. At t = 200 s the PoC voltage is reduced to 0.9 pu and at t = 240 s it is increased to 1.06 pu. This is done to check how the Q-control functions handle variations in active power output and voltage, whether it complies with the requirements in the grid code. Table 3.2: Time stamps for the Q-control function tests Time [s] Description t = 0, 40, 80 Setpoint changes t = 120 Pout : 1 pu -> 0.6 pu t = 160 Pout : 0.6 pu -> 1 pu t = 200 Upoc : 1 pu -> 0.9 pu t = 240 Upoc : 0.9 pu -> 1.06 pu 20 4 Results This section presents the results of the grid code compliance study conducted on the wind farm case study using the framework developed in this thesis. 4.1 PQ-capability The results from the PQ-capability calculations are shown in Figure 4.1. The solid lines in the graphs show the PQ-capability of the wind farm for different operating conditions and the dashed red lines represent the required capability shown in figure 2.2. For the two cases when Upoc was set to 0.9 pu and 1.06 pu, shown in the Figures 4.1a and 4.1c, their requirements were limited by the required VQ-capability shown in Figure 2.1. That is, at these voltage levels either only production or consumption of reactive power is required by the grid code. For the wind farm to comply with the grid code, it should be able to operate at any given point within the required capability curve, thus the calculated capability curves should fully contain the requirement. From studying the graphs it can be seen that the requirements are fulfilled except for when the active power output is close to 1 pu. Due to losses in the transformers and cables in between the wind turbines and the POC terminal and the rated power of the wind farm is equal to the installed power, the wind farm is not able to deliver rated power to the grid. However, this does not mean that the wind farm is not compliant with the grid code. It just means that the installed capacity that is communicated to the TSO needs to be reduced. 21 4. Results (a) PQ-curve when Upoc = 0.9 pu (b) PQ-curve when Upoc = 0.95, 1.0, and 1.05 pu (c) PQ-curve when Upoc = 1.06 pu Figure 4.1: Results from the PQ-curve calculations at different values of Upoc. The maximum reactive power capability in relation to Pout is shown blue and the required capability in red 4.2 VQ-capability The results from the VQ-capability calculations are shown in Figure 4.2. The solid lines in the graphs show the VQ-capability of the wind farm for different active power outputs and the dashed red lines represent the required capability shown in Figure 2.1. For the case when Pout was set to 1.0 pu, shown in Figure 4.2b, the requirement was limited by the required PQ-capability shown in Figure 2.2. Similar to the PQ-capability, to comply with the grid code the wind farm should be capable of operating at any given point within the required capability curve, 22 4. Results thus the calculated curved should fully contain the requirements. From studying the graphs it can be seen that the wind farm’s VQ-capability is compliant with the grid code. (a) VQ-curve when Pout = 0.2, 0.5, and 0.8 pu (b) VQ-curve when Pout = 1.0 pu Figure 4.2: Results from the VQ-curve calculations at different values of Pout. The maximum reactive power capability of the wind farm in relation to Upoc is shown in blue and the required capability in red 4.3 Frequency deviation The results from the frequency deviation tests are presented in Figure 4.3 and 4.4. The blue lines in the graphs show the active power output Pout and the orange lines show the grid frequency fgrid. The requirement for these tests are that the wind farm should be capable of staying in production through the entirety of the tests. As can be seen in the graphs, Pout never goes down to 0 during the tests thus it complies with the grid code. In Figure 4.3 when fgrid started dropping at t = 0 with ROCOF = 2 Hz/s, Pout increased before it settled back at about 0.98 pu after fgrid stabilized at 0.94 pu (47.0 Hz). This was due to the relation in Equation 4.1 where ω is the angular velocity, H is the inertia, Pm the mechanical power in to the generators, and Pe is the generated electrical power [16]. When the frequency derivative became negative, as the frequency dropped, Pe became greater than Pm, thus the increase in Pout. The controller tried to contain Pout but was too slow and was only able to bring it back 0.98 after fgrid had settled. Similarly, at t = 31.5 s when fgrid increased, there was a drop in Pout as Pm became greater than Pe. This time the controller was able to bring Pout back towards 0.98 pu before the frequency settled. But when fgrid reached 1.004 pu (50.2 Hz) the overfrequency ramp down function activated and started ramping down Pout with a rate of 4 % of Pn/Hz. With fgrid settled at 1.04 23 4. Results pu (52.0 Hz) this resulted in a ramp down of 7.2 % (0.072 pu), thus Pout settled at about 0.91 pu. In Figure 4.4, the resulting ramp down was instead 5.2 % (0.052pu) as fgrid settled at 1.03 pu (51.5 Hz). dω dt = 2π df dt = 1 2H (Pm − Pe) (4.1) Figure 4.3: Results from the Frequency test. The graph is showing the results from the short test 24 4. Results Figure 4.4: Results from the Frequency test. The graph is showing the results from the long test 4.4 Fault ride through The results from the FRT test are shown in Figures 4.5 and 4.6. The requirement for the wind farm during this test is to stay in production through the voltage dip and have the reactive current stay within the required tolerance. Figure 4.5 shows the applied grid voltage Upoc in blue, the active power output Pout in orange, and the reactive current IQ in green, during the test. As Upoc dropped to 0.2 pu at t = 0, Pout dropped down to 0 and IQ increased up to about 1.1 pu. This was due to the "PQ Controller" detected a voltage deviation and went into "voltage support-mode" where production of reactive current is prioritized over active power, as explained in Section 2.4.1. At t = 0.5 s Upoc started to increase and when it passed 0.44 pu IQ started to decrease as part of the "FRT-mode". Pout started to increase at the same time. When Upoc went above 0.8 pu, the "PQ Controller" left "FRT-mode" and the production priority went back to the active power, thus the faster increase in Pout at this point. This also resulted in the decrease IQ slowed down. When Pout almost reached up to its pre-fault value, it dropped down and stabilized at 0.96 pu and at the same time IQ dropped down and stabilized at -0.124 pu. This was due to the current reference from the "PQ Controller" to the "Current Controller" became saturated. Because Upoc was 0.9 pu, and not 1.0 pu, the current had to increase to maintain the power production, which is explained in Equation 4.2. Thus, Pout was not able to reach its pre-fault value and the resulting IQ was because of the reactive power losses in the wind farm due to the wind turbines not producing any reactive power. 25 4. Results S = √ 3UI (4.2) Figure 4.5: Results from the Fault Ride Through test. The graph shows Upoc, Pout, and IQ through the voltage dip Figure 4.6 shows IQ, in blue, as a function of Upoc during the voltage dip, Upoc < 0.9 pu. In orange is the required IQ-Upoc-curve shown in Figure 2.7 and the red dashed lines show the accepted tolerance. When comparing IQ,sim with IQ,ref , it can be seen that IQ,sim was greater than IQ,ref when Upoc was less than 0.5 pu, but stayed within tolerance. IQ,sim started to decrease before Upoc reached 0.5 pu and did not ramp down fast enough as Upoc was increasing. When Upoc reached 0.68 pu, IQ,sim exceeded the tolerance, thus not complying with the grid code. This was due to the "PQ Controller" did not use correct parameters for the "voltage support-mode". It would have been better if the ramp down in IQ was faster as Upoc increased, as well if the ramp down had started at Upoc = 0.5 pu. 26 4. Results Figure 4.6: Results from the Fault Ride Through test. The graph shows IQ in relation to Upoc during the voltage dip together with the requirements 4.5 Overwind The results from the Overwind test is shown in the Figures 4.7 and 4.8. Figure 4.7a shows the the applied wind speed vwind during the test, Figure 4.7b shows the resulting active power output Pout, and Figure 4.8 shows Pout as a function of vwind in blue and the requirement with the dashed red line. The requirement for the wind farm is to ramp down Pout within the red dashed lines as vwind gets close to the cut-off wind speed of the wind turbines, which for this case is 25 m/s. As shown in Figure 4.8 the wind farm is capable of ramping down Pout within the requirement, thus complying with the grid code. 27 4. Results (a) Wind speed over the time (b) Active power over the time Figure 4.7: Results from the Overwind simulation test. Graphs showing the active power output, Pout, and the wind speed, vwind, over the time of the test Figure 4.8: Results from the Overwind simulation test with Pout as a function of vwind together with the requirements 28 4. Results 4.6 P-constraint Figure 4.9 shows the test being run without any of the constraint functions being active. At t = 90 s the wind speed vwind was lowered from 1 pu down to 0.7 pu (15 m/s down to 10.5 m/s) to reduce the amount of available active power, thus the reduction in Pout, and at t = 140 s, vwind was returned to 1 pu. At t = 190 s the grid frequency fgrid was lowered with a ROCOF = 2 Hz/s down to 0.956 pu (47.8 Hz) and at t = 240 s it was increased with the same ROCOF to 1.028 pu (51.4 Hz). This was to check the constraint functions responses to shifts in available active power and frequency. The slight changes in Pout during the shifts in frequency was due the frequency derivative, similarly to what was observed in the Frequency Deviation tests in Section 4.3 and can be explained with Equation 4.1. Figure 4.9: Results from the P-control tests with the "Ramp rate"-constraint func- tion active Figure 4.10 shows the results from the Absolute P-constraint function test. The dashed lines in the graph represents the requirements where Ptol shows the upper tolerance of +2 % Pn, treq shows by what time the wind farm has to start adapting to the new setpoint. Pout represents the active power output from the test and Psp shows the active setpoint. After the request of a setpoint change in the constraint function the wind farm is required to starts adjusting to the new setpoint within 2 s 29 4. Results and operate within Ptol in less than 10 s. From the results presented in Figure 4.10 it can be seen that for each of the setpoint changes, which happened at t = 0, 30 s, and 60 s, Pout started to adjust to the new setpoint within 2 s and reach under Ptol within 10 s. Then during the rest of the test Pout stayed below Ptol through the shifts in both available active power and grid frequency, that was shown in Figure 4.9. The purpose of the absolute P-constraint function is only to limit the maximum active power output, thus any deviation below Psp is allowed, therefore the constraint function complied with the grid code. Figure 4.10: Results from the P-control tests with the "Absolute P"-constraint function active Figure 4.11 shows the results from the Delta P-constraint function test. Similar to the Absolute P-constraint test the graphs shows the active power output, the active setpoint, and the requirements where Ptol shows the tolerance of ±2 % Pn. From the results it can be seen that Pout started adjusting to each setpoint change request within 2 s but was not fast enough to reach within Ptol within 10 s, for the setpoint changes that happened at t = 0 and 30 s. This was due to the constraint function in the "Park Controller" not being fast enough, thus did not comply with the grid code. During the deviation in available active power, at t = 90 s and 140 s, Pout was able stay within the tolerance. During the frequency deviations at t = 190 s and 240 s, the setpoint for the constraint function changed as part of its frequency 30 4. Results response. This resulted in Pout being temporarily outside of tolerance, but because it was able to reach within tolerance in 10 s from the frequency change this could be considered complying with the requirements. Figure 4.11: Results from the P-control tests with the "Delta P"-constraint func- tion active 4.7 Q-control For the Q-control tests the results from each control function will be presented separately in the figures below. Figure 4.12 shows the active power output Pout and voltage level Upoc that was used during the tests of each control function. During the first half of the tests, up to t = 120 s, the control functions response to setpoint changes are being checked, thus the short transient spikes in Pout even though both Pout and Upoc are kept stable. At t = 120 s Pout was lowered to 0.5 pu and at t = 160 it was increased up to 1 pu. At t = 200 s Upoc was lowered to 0.9 pu and at t = 300 s it was increased to 1.06 pu. The changes in Pout during this time period was due to the wind farms response to the voltage change. As seen in Equation 4.2, if the voltage drops, the current has to increase to maintain the same power output. When Upoc was lowered to 0.9 pu the "PQ Controller" reached its limit for the current references used in the "Current Controller", thus the decrease in Pout. 31 4. Results Figure 4.12: Voltage and active power curve used for the Q-control tests Figure 4.13 shows the results from the Constant Q-control function test. The dashed lines in the graph represents the requirements where Qtol shows the tolerance of ±2 % Qn, treq shows by what time the wind farm has to start adapting to the new setpoint. The solid lines show the simulated values with Qsp representing the reactive power setpoint and Qout representing the reactive power output in generator reference. After the request of a setpoint change in the control function the wind farm is required to start adjusting to the new setpoint within 2 s and after 30 s the wind farm should operate within the tolerance of the new setpoint. It can be seen in Figure 4.13 that after each setpoint change Qout started to adapt to the new setpoint before treq and was operating within Qtol until the next setpoint change. When Pout was lowered there were a slight increase in Qout before it stabilized at the setpoint value. Due to the wind farm being connected to an infinite grid the voltage magnitude at the wind turbines was lowered, as described in Equation 4.3 where Vs = Upoc and Vr is the voltage at the turbines [16]. This would then result in an increase in Qout, as described Equation 4.4, but as Qout increased the "PQ Controller" adjusted the output towards the setpoint. When Upoc was lowered to 0.9 pu Qout dropped outside of the tolerance and went from producing to consuming reactive power. The drop in Qout was due to the current reference from the "PQ Controller" to the "Current Controller" becoming saturated. When Upoc was 0.9 pu 32 4. Results no fault was detected by the control system, therefore production of active power was the priority and no reactive power was produced by the wind turbines. Thus, the resulting reactive power measured was the reactive power losses in the cables and transformers between the turbine and the POC. When Upoc was increased to 1.06 pu Qout was able to recover and return to operating with Qtol. The Constant Q-control function was able to comply with the grid code regarding the time requirements for setpoint changes and during shifts in Pout, but during shifts in Upoc it was no longer able to comply when the voltage dropped to the lower limit of where normal production is expected. P = |Vs||Vr| X sin(θr − θs) (4.3) Q = |Vr|2 − |Vs||Vr| X cos(θr − θs) (4.4) Figure 4.13: Results from the Q-control tests when the Constant Q-control func- tion was active Figure 4.14 shows the results from PF-control function test. The upper graph shows the PF for the output power PFout, the requested setpoint PFsp, and the require- ments for the setpoint change time responses. Similar to the Constant Q-control function test, the bottom graphs shows the reactive power output together with the 33 4. Results requested setpoint and the requirements. It can be seen that the control function was capable to adapt to the setpoint changes at t = 0, 40 s, and 80 s within the required times. At t = 120 s Pout was lowered which also lowered Qsp in order to maintain the PF. Just as Pout dropped, PFout dropped as well due to the initial increase in the Q/P-ratio. As Qout was lowered PFout was returned to the follow PFsp. Similarly at t = 160 s when Pout was increased, there was an initial increase in PFout before Qout started to increase and PFout returned to the setpoint value. At t = 200 s when Uout was lowered to 0.9 pu, the same phenomenon as was observed during the Constant Q-control test where the current reference became saturated and resulted in no production of reactive power. The spike in PFout at t = 200 s was due to Qout going from being positive to negative. The slight decrease in Qsp was due to drop in Pout during the voltage drop. At t = 240 s, Uout was increased to 1.06 pu and the PF-control function was able to return to normal operation after a quick surge in reactive power. The quick increase in PFout was due to the change in sign for Qout and the drop was due the quick surge in Qout. 34 4. Results Figure 4.14: Results from the Q-control tests when the PF-control function was active 35 4. Results Figure 4.15 shows the results from the Voltage-control function test. The upper graph shows the POC voltage Upoc and the requested voltage setpoint Usp. The bot- tom graph shows, similar to Constant Q-control and PF-control, the reactive power output with the requested setpoint and the requirements. Unlike the other Q-control functions, Voltage-control has a shorter adjustment time to setpoint changes. Within 10 s of a setpoint change it has operate with Qtol. But similar to the other Q-control functions, Voltage-control was also able to stay within the time requirements after the setpoint changes at t = 0, 40 s, and 80 s. During the Pout deviations at t = 120 s and 160 s, similar deviations in Qout was observed as in the Constant Q-control test. Qout deviated in the opposite direction to Pout due to shifts in the voltage at the wind turbines. When Upoc was lowered to 0.9 pu at t = 200 s, the current reference became saturated and the production of reactive power was stopped, as seen in the other Q-control functions. Qsp was, on the other hand, increased to Qn = 0.33 pu in order to try to push as much reactive power as possible. When Upoc was increased to 1.06 pu at t = 240 s, the voltage control function was able to return to normal operation and Qout was stabilized at -Qn after a quick surge in reactive power. Due to the loss of reactive power production during the drop in Upoc, none of the Q-control functions were able to comply with the grid code. If the converters of the wind turbines would have had a higher current rating or if the nominal power of the wind farm was reduced, the saturation of the current reference could have been avoided. This could have resulted in the Q-control functions, potentially, been able to to comply with the grid code. 36 4. Results Figure 4.15: Results from the Q-control tests when the Voltage-control function was active 37 5 Conclusion & future work The automated testing framework that has been developed during the course of the thesis has been able perform the tasks for what it was designed. It was able to re- trieve the necessary information it needed to be able to construct and run multiple tests in DIgSILENT PowerFactory simulation software. It was able to store, pro- cess, and present the test results to allow the the analysis of the simulation models performance in regards to the grid code set by the Danish TSO for type D wind farms. The framework is still in need of further development due to it only being capable of running load flow calculations and dynamic RMS simulations in DIgSILENT PowerFactory in regards to the requirements for type D wind farms in Denmark. To be able to perform a complete compliance test for the analyzed grid code, it also needs to perform harmonics studies in PowerFactory and EMT simulations in PSCAD. The testing framework has also only been applied to one study case, so how much the framework needs to be modified to handle other study cases is, for now, unknown. The user-friendliness of the testing framework has not been among the top priorities during its development. Thus it requires the user to be at least familiar with coding in Python to be able to use it. The implementation of a user interface could make the framework easier to use, both in initiating the test process and analyze their results, but also for filling in the necessary simulation model information and switching between different grid codes. 38 Bibliography [1] C. Domb, “James Clerk Maxwell,” Encyclopedia Britannica, Jan 24, 2025. [Online]. Avaliable: https://www.britannica.com/biography/ James-Clerk-Maxwell (Accessed on: 2025-01-29). [2] L. Pearce Williams, “Michael Faraday,” Encyclopedia Britannica, Jan 18, 2025. [Online]. Avaliable: https://www.britannica.com/biography/ Michael-Faraday (Accessed on: 2025-01-29). [3] Enerdata, “World Energy Climate Statistics – Yearbook 2024 - Electricity domestic consumption,” 2025. [Online]. Available at https://yearbook. enerdata.net/electricity/electricity-domestic-consumption-data. html (Accessed on: 2025/01/29). [4] Enerdata, “World Energy Climate Statistics – Yearbook 2024 - Electricity production,” 2025. [Online]. Available at https://yearbook.enerdata.net/ electricity/world-electricity-production-statistics.html (Accessed on: 2025/01/29). [5] Enerdata, “World Energy Climate Statistics – Yearbook 2024 - Share of renewables in electricity production,” 2025. [On- line]. Available at https://yearbook.enerdata.net/renewables/ renewable-in-electricity-production-share.html (Accessed on: 2025/01/29). [6] Enerdata, “World Energy Climate Statistics – Yearbook 2024 - Share of wind and solar in electricity production,” 2025. [On- line]. Available at https://yearbook.enerdata.net/renewables/ wind-solar-share-electricity-production.html (Accessed on: 2025/01/29). [7] Vattenfall AB, “Danish offshore wind farms Vesterhav Nord and Vesterhav Syd inaugurated,” 2024. [Online]. Available at https: //group.vattenfall.com/press-and-media/pressreleases/2024/ danish-offshore-wind-farms-vesterhav-nord-and-vesterhav-syd-inaugurated (Accessed on: 2025/01/29). [8] D. Lakshmi, C. Ravi, R. Zahira, S. Palanisamy, and S. Chenniappan, “Chap- ter 1 - introduction to renewable energy sources and bulk power system,” in Power Systems Operation with 100% Renewable Energy Sources (S. Chenniap- pan, S. Padmanaban, and S. Palanisamy, eds.), pp. 1–13, Elsevier, 2024. [9] ENTSO-E, “What are network codes?,” 2025. [Online]. Available at https: //www.entsoe.eu/network_codes/ (Accessed on: 2025/01/28). [10] A. Etxegarai, P. Eguia, E. Torres, G. Buigues, and A. Iturregi, “Current pro- cedures and practices on grid code compliance verification of renewable power 39 https://www.britannica.com/biography/James-Clerk-Maxwell https://www.britannica.com/biography/James-Clerk-Maxwell https://www.britannica.com/biography/Michael-Faraday https://www.britannica.com/biography/Michael-Faraday https://yearbook.enerdata.net/electricity/electricity-domestic-consumption-data.html https://yearbook.enerdata.net/electricity/electricity-domestic-consumption-data.html https://yearbook.enerdata.net/electricity/electricity-domestic-consumption-data.html https://yearbook.enerdata.net/electricity/world-electricity-production-statistics.html https://yearbook.enerdata.net/electricity/world-electricity-production-statistics.html https://yearbook.enerdata.net/renewables/renewable-in-electricity-production-share.html https://yearbook.enerdata.net/renewables/renewable-in-electricity-production-share.html https://yearbook.enerdata.net/renewables/wind-solar-share-electricity-production.html https://yearbook.enerdata.net/renewables/wind-solar-share-electricity-production.html https://group.vattenfall.com/press-and-media/pressreleases/2024/danish-offshore-wind-farms-vesterhav-nord-and-vesterhav-syd-inaugurated https://group.vattenfall.com/press-and-media/pressreleases/2024/danish-offshore-wind-farms-vesterhav-nord-and-vesterhav-syd-inaugurated https://group.vattenfall.com/press-and-media/pressreleases/2024/danish-offshore-wind-farms-vesterhav-nord-and-vesterhav-syd-inaugurated https://www.entsoe.eu/network_codes/ https://www.entsoe.eu/network_codes/ Bibliography generation,” Renewable and Sustainable Energy Reviews, vol. 71, pp. 191–202, 2017. [11] Energinet, “RfG - Approved threshold values,” 2018. Avaliable: https://en.energinet.dk/media/iy5bcz4q/ 16-05118-96-rfg-approved-threshold-values.pdf. [12] Energinet, “RfG - Appendix 1 - Requirements,” 2022. Avaliable: https://en.energinet.dk/media/nqhkokxu/ 1605118115-krav-jvf-rfg-bilag-1-godkendt-af-fsts-22072022-rev-2. pdf. [13] Energinet, “RfG - Appendix 1B - Simulation model requirements,” 2024. Avaliable: https://en.energinet.dk/media/e4mmwrge/ rfg-appendix-1a-generic-signal-list.pdf. [14] Energinet, “Technical regulation 3.2.5 for wind power plants above 11 kw,” 2016. Avaliable: https://en.energinet.dk/media/5pbflmly/ technical-regulation-325-for-wind-power-plants-above-11-kw-revision-4. pdf. [15] E. Commission, “Commission Regulation (EU) 2016/631 of 14 April 2016 establishing a network code on requirements for grid connection of gener- ators,” 2019. Avaliable: https://eur-lex.europa.eu/legal-content/EN/ TXT/?uri=OJ:JOL_2016_112_R_0001#d1e320-1-1. [16] P. S. Kundur and O. P. Malik, Power System Stability and Control. McGraw, 2022. 40 https://en.energinet.dk/media/iy5bcz4q/16-05118-96-rfg-approved-threshold-values.pdf https://en.energinet.dk/media/iy5bcz4q/16-05118-96-rfg-approved-threshold-values.pdf https://en.energinet.dk/media/nqhkokxu/1605118115-krav-jvf-rfg-bilag-1-godkendt-af-fsts-22072022-rev-2.pdf https://en.energinet.dk/media/nqhkokxu/1605118115-krav-jvf-rfg-bilag-1-godkendt-af-fsts-22072022-rev-2.pdf https://en.energinet.dk/media/nqhkokxu/1605118115-krav-jvf-rfg-bilag-1-godkendt-af-fsts-22072022-rev-2.pdf https://en.energinet.dk/media/e4mmwrge/rfg-appendix-1a-generic-signal-list.pdf https://en.energinet.dk/media/e4mmwrge/rfg-appendix-1a-generic-signal-list.pdf https://en.energinet.dk/media/5pbflmly/technical-regulation-325-for-wind-power-plants-above-11-kw-revision-4.pdf https://en.energinet.dk/media/5pbflmly/technical-regulation-325-for-wind-power-plants-above-11-kw-revision-4.pdf https://en.energinet.dk/media/5pbflmly/technical-regulation-325-for-wind-power-plants-above-11-kw-revision-4.pdf https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ:JOL_2016_112_R_0001#d1e320-1-1 https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ:JOL_2016_112_R_0001#d1e320-1-1 A Appendix 1 This appendix contains figures from the simulation model used as the study case for the thesis. The figures depicts the grid schematics of the wind farm models and the control unit for the system. I A. Appendix 1 F ig ur e A .1 : "W in d Fa rm "e xa m pl e m od el fro m D Ig SI LE N T Po we rF ac to ry 20 24 II A. Appendix 1 F ig ur e A .2 : W in d fa rm m od el us ed as th e st ud y ca se fo r th e th es is III A. Appendix 1 F ig ur e A .3 : Sc he m at ic s of th e "T ur bi ne Sy st em C on tr ol le r IV A. Appendix 1 F ig ur e A .4 : Sc he m at ic s of th e "T ur bi ne C on tr ol le r Tu rb in e 1. 1" co nt ro lle r V A. Appendix 1 F ig ur e A .5 : Sc he m at ic s of th e "P ar k C on tr ol le r Pa rk C on tr ol Sy st em (d yn am ic )" VI A. Appendix 1 F ig ur e A .6 : Sc he m at ic s of th e "P ar k C on tr ol le r Pa rk C on tr ol le r (d yn am ic )" VII B Appendix 2 This appendix contains the code for the added control functions for the DIgSILENT PowerFactory model. Due to their length, some of the coding lines are using "..." as a line breaker. Code from the "Overwind Power Reduction"-block in the "Park Controller Park Controller (dynamic)"-block: y = s e l e c t (w_lim_low>=w_lim_high , −1 ,( x1−w_lim_low )/( w_lim_high−w_lim_low ) ) y0 = s e l e c t (y<0,x0 , x0∗(1−y ) ) Code from the "P Limiter"-block in the "Park Controller Park Controller (dynamic)"- block: y0 = s e l e c t ( x0 0 , q_ si gn _ cm d , − q_ si gn _ cm d ) dq = q_ cm d − q !d q_ co sp hi = p ∗( ta n (a co s( co sp hi _ cm d )) − ta n (a co s( co sp h i) )) !d q_ co sp hi = se le ct (c os ph i_ cm d > 0 ,q _ si gn _ cm d ∗ sq rt (s qr (p )+ sq r( q )) ∗ (s q rt (m ax (0 ,1 − sq r( co sp hi _ cm d )) ) − .. . sq rt (m ax (0 ,1 − sq r( co sp h i) )) ), − 1 ∗ q_ si gn _ cm d ∗ sq rt (s qr (p )+ sq r( q )) ∗ (s q rt (m ax (0 ,1 − sq r( co sp hi _ cm d )) ) − sq rt (m ax (0 ,1 − sq r( co sp h i) )) )) dq _ co sp hi = q_ si gn _ cm d ∗ sq rt (s qr (p )+ sq r( q )) ∗ (s q rt (m ax (0 ,1 − sq r( co sp hi _ cm d )) ) − sq rt (m ax (0 ,1 − sq r( co sp h i) )) ) !d q_ co sp hi _ p = co sp hi _ p_ cm d − co sp h i dq _ co sp hi _ p = q_ si gn _ cm d ∗ sq rt (s qr (p )+ sq r( q )) ∗ (s q rt (m ax (0 ,1 − sq r( co sp hi _ p_ cm d )) ) − sq rt (m ax (0 ,1 − sq r( co sp h i) )) ) dq _ u = q_ u_ cm d − q b lo ck ed = pi cd ro _ co ns t( u_ m in − u + 0. 5 ,0 ,T un bl oc k ) de lt a_ q = se le ct (b lo ck ed ,0 ,s el ec t( m od e_ cm d > 2. 5 , dq _ u , se le ct (m od e_ cm d > 1. 5 , dq _ co sp hi _ p , se le ct (m od e_ cm d > 0. 5 , dq _ co sp hi , dq )) )) !d el ta _ q = se le ct (b lo ck ed ,0 ,s el ec t( m od e_ cm d > 2. 5 , dq _ u , se le ct (m od e_ cm d > 1. 5 , dq _ co sp hi _ p , se le ct (m od e_ cm d > 0. 5 , .. . se le ct (c os ph i_ cm d > 0, dq _ co sp hi ,− dq _ co sp hi ), dq )) )) !U se se le ct () in or d er to al lo w m od e ch an ge du ri ng si m u la ti on ru n C od e fro m th e "D el ta Po we r R ed uc tio n" -b lo ck in th e Tu rb in e C on tr ol le r Tu rb in e 1. 1" -b lo ck : y = se le ct (x 0 < 48 ,0 ,s el ec t (x 0 < 49 .5 ,d el ta _ p ∗( x0 − 48 )/ (4 9. 5 − 48 ), se le ct (x 0 < 50 .5 ,d el ta _ p ,s el ec t( x0 < 51 ,d el ta _ p ∗( 2+ 0. 5∗ (x 0 − 50 .5 )/ (5 1 − 50 .5 )) , .. . se le ct (x 0 < 51 .5 ,d el ta _ p ∗( 2. 5+ 0. 5∗ (x 0 − 51 )/ (5 1. 5 − 51 )) ,d el ta _ p ∗( 3+ (x 0 − 51 .5 )/ (5 2 − 51 .5 )) )) )) ) y0 = se le ct (y > 1, 1, y ) IX DEPARTMENT OF SOME SUBJECT OR TECHNOLOGY CHALMERS UNIVERSITY OF TECHNOLOGY Gothenburg, Sweden www.chalmers.se www.chalmers.se List of Acronyms Nomenclature Introduction Aim Scope & limitations Theory Grid codes & requirements Reactive power capability Frequency deviation ROCOF Over- & underfrequency Fault ride through Voltage support Active power constraint Constraint functions Emergency control Reactive power control Control functions Methods Simulation model Grid code test framework The structure of the tests PQ-capability VQ-capability Frequency test Fault ride through Overwind P-constraint Q-control Results PQ-capability VQ-capability Frequency deviation Fault ride through Overwind P-constraint Q-control Conclusion & future work Bibliography Appendix 1 Appendix 2