Automatized AVR tuning with Python in DIgSILENT PowerFactory

Sometimes it is needed to tune an AVR (automatic voltage regulator) to fulfill specific requirements. Requirements such as rise time, overshoot, and settling time are often used to specify the desired behavior for a given step response of the AVR. Since it is difficult to tune the controller by hand, this post presents an automatized AVR tuning methodology using Python and DIgSILENT PowerFactory.

Tuning requirements

The figure below shows the definition of the rise time, overshoot, and settling time. A short description of the requirements can be found below the figure.

definition of rise time, overshoot, and settling time according to Kundur
Definition of rise time, overshoot, and settling time.
Source: P. Kundur, “Power System Stability and Control”, 1994

Rise time (sec)

The rise time defines the time it takes to get from 10 % to 90 % of the step size of a step response in the voltage reference.

Overshoot (%)

The overshoot defines the ratio of the peak value relative to the step size of the voltage step.

Settling time (sec)

The settling time defines the time until the voltage enters and remains within a specified band around the target voltage. The band is specified as a percentage of the step size.

Grid model: Single-machine infinite-bus model

Normally, AVRs are tuned in open-circuit meaning that the synchronous generator is not connected to the grid, but in no-load operation. This means that the response of the AVR can be tuned without the influence of the grid (of course, if you wish to tune in closed-loop conditions it can be also done with the presented approach).

single-machine infinite bus model in DIgSILENT PowerFactory
Single-machine infinite-bus model in DIgSILENT PowerFactory. Please consider that the breaker at the HV-side of the transformer is open and, therefore, the generator is in open-circuit condition.

Excitation and AVR model

To model the excitation and AVR of the synchronous generator I use the IEEE ST3C model which is available in the DIgSILENT PowerFactory standard library. This is a purely arbitrary choice. The code for the AVR tuning can be easily adapted to fit any excitation and AVR model.

The excitation model is implemented using the available IEEE frame called “Frame Synchronous Generator IEEE”.

The AVR parameters Kpr, Kir, and Ka are marked with red circles in the figure below. These parameters are used to tune the response of the AVR.

IEEE ST3C excitation system with the controller parameters to be tuned marked in red

Tuning of the AVR

The plots below show the AVR response to a 5%-voltage-step in open-circuit conditions before and after the tuning. Remember that the parameters Kpr, Kir, and Ka of the AVR (IEEE ST3C model) are used to tune the response.

Initially, the rise time was 0.45 sec with an overshoot of approx. 44 % and a settling time of 3.7 sec. This is clearly not a desirable response. However, with the tuning, we achieve a response time of 0.3 sec with an overshoot of approx. 15 % and a settling time of 1.18 sec. The tuned response is clearly favorable compared to the initial response.

Important note: It is important not to go in saturation with the generator while tuning the AVR. Therefore, the tuning script also plots the excitation voltage where it would be visible if you hit the ceiling voltage. If you go in saturation the voltage step size must be reduced.

The table below shows the full list of parameters of the IEEE ST3C model before and after the tuning. Only Ka, Kpr, and Kir are different. The rest of the parameters is the same. You could use the list of parameters below with the IEEE ST3C model in PowerFactory to reproduce the results shown in the plots above.

IEEE ST3C AVR parameters before and after tuning
AVR parameters of the IEEE ST3C before and after the tuning: Only Ka, Kpr, and Kir are different.

A step-by-step guide for your specific AVR tuning

In the following, I will elaborate on how you can tune your specific AVR using the Python script and PowerFactory model available for download here. The step-by-step guide also refers to the screenshot from the Python script below the list.

  1. Download the Python script and DIgSILENT PowerFactory model 🙂 (you can also use your own PowerFactory model).
  2. Change the AVR to your desired model (create a new common model and add it to the composite frame etc.).
  3. Necessary changes in the Python script:
    1. Define the project name (line 259).
    2. Define the study case name (line 260).
    3. Define the desired tuning requirements regarding rise time, overshoot, and settling time (lines 263-266).
    4. Define the target voltage for the voltage step. The initial voltage setpoint is 1 pu, ie. if vsteptarg = 1.01 pu then the resulting voltage step is 0.01 pu (line 269).
    5. Define the name of the AVR common model and the synchronous generator so that the right components are found by the script (lines 272-273).
    6. Define all AVR parameters that could possibly be tuned (line 276).
    7. Define the AVR parameters that should be tuned. Here it is important that these parameters must be a subset of all available parameters defined in line 276 (line 280).
    8. Define the initial values for all parameters (line 284).
    9. Define the min./max. bounds for all parameters (lines 287-290).
  4. Then you should be ready to go! Don’t forget to close PowerFactory before starting the Python script to avoid license issues.
Python script for automatic AVR tuning in DIgSILENT PowerFactory
Screenshot of the definition section of the Python script for the automatic AVR tuning

Closing remarks about the tuning

The automatized tuning algorithm uses the minimizer of Python’s scipy library with the Powell algorithm. The objective function is the quadratic error of the rise time. Since the Powell algorithm can only handle parameter bounds, but no additional constraints, the objective function also includes the constraints for the overshoot and the settling time.

In case the optimizer does not find a parameter set that satisfies all the requirements, it might happen that the rise time deviates from the target and/or the constraints for the overshoot and/or settling time are violated. In such a case I recommend relaxing the constraints or setting a higher rise time. Alternatively, it might also be possible that the optimizer reaches the min./max. bounds of the tuning parameters. If possible, relaxing those could help to improve the solution.

One very important final remark regarding the open-circuit AVR tuning: Make sure at all times not to go in saturation with the generator. You can see the saturation effect if the excitation voltage hits its maximum and stays there for some time during the step response. If that happens the voltage step size must be reduced to avoid this effect and allow for appropriate tuning.

I hope you enjoyed this article. If so, you might also like the following: Transient stability improvement by re-dispatching of synchronous generators.

More insights to follow in the next article.

Michael

Share this post:

Similar Posts

Leave a Reply