Skip to content

2. Quickstart Guide PowerFactory

CVLenerginet edited this page Dec 20, 2024 · 23 revisions

System Requirements

Developed with PowerFactory 2024 SP4 with Python 3.8.8 denpendent on Python packages as specified in requirements.txt

The dependencies can be installed by executing the command "python –m pip install –r requirements.txt"


Note: An example setup of the MTB can be found in the folder setup_examples named MTB_Setup_Example.pfd. This is purely an example to showcase the setup of the MTB and the model used is not in any way representative of a compliant model or plant.

2.1 Preparation

Extract or copy all test bench files into a common folder on your PC.

foulder


testcases sheet


  • The config.ini file in MTB folder can be edited to specify a path specific path of the testcases.xlsx sheet if it is not placed within the common folder. The same is true for the results folder.

excel_settings

2.2 Model Setup in PowerFactory

2.2.1 Import the MTB into the project.

  • Right-click the Network Data folder in your PowerFactory model and Import MTB.pfd from the common folder. The project must be inactive to import using this method.

    PF_import

  • Activate the MTB grid and replace the external grid with MTB. Remember to deactivate the existing external grid, as well as any linked dynamic control used for the external grid. Do this by selecting the elements and marking them as Out of Service.

pq_connect

  • Connect the cubicle at POC, formerly used for the external grid, to the element ”meas.ElmSind”. Copy the cubicle from the busbar used for the external grid and then paste the cubicle to the element ”meas.ElmSind”, Terminal j.

2.2.2 Connecting the MTB to the plant control

There are two main ways to connect the MTB to the model PPC both found in the following sections.

The first method is to connect the MTB via the execute script, where reference signals and the corresponding models are linked.

The second method is to assign the PPC and connect the signals to the MTB via the graphic of the MTB frame.

To add additional custom signals, please refer to 2.5 Custom cases and signals setup

Note that the execute script has other relevant parameters regardless of the method for connecting the MTB to the model PPC. For instance the "Only Setup" and "Post_run_backup". If the value in "Only_setup" is set to 1, the MTB will only set up the selected cases and plots but not run and output any result files. If "Post_run_backup" is set to 1, the MTB will create a project version right after the MTB has been run.

2.2.2.1 MTB connection via execute script:

  1. Open the execute.ComPython script and add the active and reactive PPC controller signal names to the respective value rows in the Input Parameters table.
  2. Add the PPC controller block(s) responsible for controlling the active- and reactive power references. Depending on your specific PPC configuration, this can be a single or multiple blocks, as shown in the picture below.

execute script setup

2.2.2.2 MTB connection via the MTB frame:

Note: Using this setup method requires that the plant references needed to be connected to the User blocks are modeled as signals and not internal parameters in the Pcontrol and Qcontrol blocks of the PPC.

  1. Open the MTB composite frame type (this can be done by right-clicking and selecting "Mark in Graphic"). Scroll down to the "User blocks" area (shaded area in the navigation pane on the picture below) to insert the PPC active- and reactive power control block types.
howto select the mtb type annotated
  1. Select the controller type to place in the MTB Slot by editing the slot and selecting the relevant type from the project library that corresponds with the types used in the project's PPC active and reactive power controllers.

mtb slot anno blocks before connection

  1. Use the signal wiring to connect the setpoints for P, Q, U, and PF controls to their respective inputs in the P- and Q-control blocks with signals from the plant references.

block connection

2.2.3 MTB composite model setup

  1. Add the ElmDsl models for the PPC P- and Q-control at the bottom of the Net Elements in the MTB composite model "MTB.ElmComp"

2.2.3.1 Edit the Initializer_script.ComDpl DPL script

  1. Add the Pcontrol and Qcontrol from the PPC to the external elements columns.

path initializer

  1. The MTB Q control modes are set up with the default values: 0 = Q reference mode, 1 = Q(U) mode, and 2 = PF (cosphi) mode. If these numbers do not correspond with the values in the project Qmode parameter, the script must be used to change the values. To do this, open the script tab in the "initializer_script.ComDpl". Scroll to the bottom of the script and uncomment the section of code that assigns a new value to the Qmode parameter. Ensure that the variable name for the Qmode corresponds with the name in the PPC´s Qcontrol dsl model. It is usually named something with "mode".

  2. If the frequency sensitivity mode is disabled in the project and enabled by changing a parameter value, the FSM part of the scrip highlighted in the black box below the Qmode box should be uncommented, and the control mode parameter set to what it is in the Pcontrol element of the project PPC. Ensure that the FSM parameter's parameter name in the active power control module corresponds with the parameter name after Pcontrol:____. The variable name is sometimes named FSMenable or somewhere along these lines.

init script anno

2.2.4 Connect the inverter to the MTB

This next part can be done in two ways. The first is to utilize the MTB built-in Station- and Power Frequency controllers and connect them to the inverter element. The second uses the qdsl element "initializer_qdsl" to control the inverter ElmGenstat.

2.2.4.1 Station- and Power Frequency Controller setup

  1. Open the Station controller under the MTB folder and add the inverter ElmGenstat to the Machines column.

station controller

  1. Open the Power Frequency controller, and under the Load Flow tab, add the inverter.

power-frequency controller

2.2.4.2 Qdsl initializer setup

  1. To initialize the testbench, the second method uses the initializer_qdsl.ElmQdsl. The Qdsl script is located in the MTB composite frame folder. It is by default "Out of Service" and should be "put in service" before running the test bench.

  1. Choose a Qdsl type from the MTB library that best fits the setup of the park model and fill in the data that is not "Set by Script".
    By default the "mtb_init_example_4" is selected and recommended for use. This type requires the input of the user being PPM upper current limit in p.u., the plant nominal reactive power in Mvar and the upper and lower reactive power limits of the plant in p.u. all at the bottom of the parameter pane.

  1. Select the load flow tap of the Qdsl block and connect the respective network elements, e.g., the park inverter (setting up the simplified model).

2.2.5 Execute script

  1. Edit the "execute.ComPython" script by selecting the Python script "execute_pf.py" in the script tab. The complete file path must be defined in the field ‘Script file.’ Click the ‘…’ button and navigate to the execute_pf.py script.

OBS: There might be some issues with the script while setting up the plots and exporting the result files. Go to Tools > User Settings > Parallel Computing > Advanced to fix this. In this tab, check the box "Transfer complete project to all processes".

  1. Pressing Execute, the script does both simulation and plotting of results automatically.

Note: When executing the script, active variations are consolidated, meaning all changes recorded in the active variations will be applied to the Network Data Folder.

2.3 Script Execution Finished

When the script is finished, the output window should look like the snapshot below, with the text ”Python Script ‘execute’ successfully executed” at the bottom.

The study cases set to "TRUE" in the testcases.xslx document should be visible in the project overview.


  • All simulation results are exported to the 'Results' folder, as seen in the picture below. Each has a unique ID to match the study case. The study cases created by the MTB allow users to review all simulations in PowerFactory.

done plotting res-files

  • The test bench creates a set of '.csv'-files that can be used with the MTB Plotter to plot the results and, if relevant to your project, compare them with the results from PSCAD. These can also be found in the 'Results' folder.

2.4 Add Additional Measurements to Plots

If you wish to record more signals or parameters from your model, like monitoring the inverter's active and reactive power output or other DSL blocks, such as protection blocks or PLLs, you can do so from the execute script.

  1. Scroll down to the Measurement object inputs starting from line 18 in the Input parameters table. Here you must give your object a name and the parameter or list of parameters you wish to record the results of. See the picture below.

  2. Add the object from which you want to record the signal values to the External objects table in the same script. Make sure that the object is placed in the correct Meas_obj_X line that corresponds with the chosen string in the Input parameters table:

meas obj

2.5 Custom signal setup

The MTB allows for changing additional custom signals specific for a given PPC. It is possible to connect and control additional signals/parameters from the PPC or other DSL models, such as the protection block in the model either through the execute script or the MTB frame itself. The custom signals can then be changed in the testcases.xslx sheet for each case they are needed.

2.5.1 Custom signal setup via execute script

To setup custom signals from the execute script, rows 12-16 can be used for this.

  1. Input the signal you wish to control to the attribute row and the needed scaling value. The MTB works on a p.u. scale.
  2. Connect the object from which the signal is from in the external objects pane.

custom cases setup execute

2.5.2 Custom signal setup via execute script

From the MTB frame graphic:

  1. Copy the existing slots from the User Blocks section of the frame and place them down by the Custom signals slots. You can also select a new one from the Blocks and Signals under drawing tools. The MTB frame type's Graphical Freeze Mode (the lock icon) must be unlocked in both cases.
  2. Connect the MTB signals to the desired signal input in the object block(s).

custom cases setup graphical

2.6 Toubleshooting

  • Make sure that the P- and Q-control blocks are from the PPC, not the inverter when setting up the MTB.