-
Notifications
You must be signed in to change notification settings - Fork 19
3. Quickstart Guide PSCAD
MARVIenerginet edited this page Oct 15, 2024
·
161 revisions
Developed with PSCAD release 5.0.2 (2023/04/26) with Python 3.7.2 (embedded) dependent on python packages as specified in requirements.txt
Since the script uses the embedded PSCAD python environment (for now #109), the external packages cannot be installed and imported in the standard way. The easiest way around this is the following procedure:
- Install Python 3.7.2
- Install requirements from PSCAD requirements.txt into the python 3.7.2 installation (or a virtual environment). This can be done by executing “python -m pip install -r requirements.txt”.
- Adapt the path in config.ini so it points to the python 3.7.2 installations site-packages folder. The default path is
C:\Program Files\Python37\Lib\site-packages.
- Extract or copy all test bench files and your model (.pscx-file) into the same common folder on your PC.
- Fill in the model-specific information in the 'Settings' sheet in the testcases.xlsx file. The Excel guide can be found here Quickstart Guide Excel
- Open a workspace with all the models and libraries required for running simulations. This includes ETRAN libraries and any resources. In this example the model under test is called 'SimpleSolarFarm'.
- Load in the MTB.pslx project into the workspace. Do this by right-clicking on the Projects folder, click 'Add Existing Project...'.
- Load in the interface.f file. Do this by right-clicking the Resources folder, click 'Add' -> 'Source Code (*.f, *.for, *.f90, *.c, *.cpp)'.
- Load in the execute_pscad.py file. Do this by right-clicking the Resources folder, click 'Add' -> 'Script\Apps (*.py, *.exe, *.bat)'.
- Disconnect and disable the power grid from POC in the model. Make sure to keep any measurements present at POC (Shown below in the red dotted box.). Otherwise the model might not work properly.
- Copy the test bench from the MTB project into the model. Do this by right-clicking the MTB block and clicking 'Copy'. Then go to the model, right click and click 'Paste'. The last step is to connect the MTB block to the POC.
- You can see the different signals the MTB outputs by right clicking on the MTB block and selecting 'Edit Parameters...'. Then go to 'Signal outputs'
- The different output signals are summarized below
-
Pref signal
The 'Pref signal' is the active power reference. It is given in per unit with a base value determined by the 'Pn' value in the 'Settings' sheet in the testcases.xlsx excel document. -
Qref signal
The 'Qref signal' is the reactive power reference for both reactive power control (Q), voltage control (Qu), and power factor control (Qpf) mode. It changes its value based on the Q mode selected at the given time. It is given in per unit when in Q or Qu mode. In Q mode the base value is the 'Pn' value in the 'Settings' sheet. In Qu mode the base value is the 'Un' value in the 'Settings' sheet. In Qpf mode the value is the desired power factor. -
Qref Q mode
The 'Qred Q mode' signal is the reactive power reference when in reactive power control mode. It is given in per units with a base value determined by the 'Pn' value in the 'Settings' sheet. -
Qref Qu mode
The 'Qred Qu mode' signal is the reactive power reference when in voltage control mode. It is given in per units with a base value determined by the 'Un' value in the 'Settings' sheet. -
Qref Qpf mode
The 'Qred Qpf mode' signal is the reactive power reference when in power factor mode. -
Qref mode 3-6
These outputs can be used to create custom Q modes -
Pmode signal
The 'Pmode signal' is a integer output determining the active power mode. The modes are:- mtb_Pmode = 0: FSM and LFSM disabled
- mtb_Pmode = 1: LFSM enabled, FSM disabled
- mtb_Pmode = 2: FSM enabled, LFSM disabled
- mtb_Pmode = 3: FSM and LFSM enabled
-
Qmode signal
The 'Qmode signal' is a integer output determining the reactive power mode. The modes are:- mtb_Qmode = 0: Reactive power mode (Q)
- mtb_Qmode = 1: Voltage mode (Qu)
- mtb_Qmode = 2: Power factor mode (Qpf)
-
Custom signal 1-10
These outputs can be used to create custom signal outputs. In the testcases.xlsx excel document they are used just like the other output signals by inserting an event. Their type names are 'Signal 1', 'Signal 2' and so on. They can be used to for example implement System Guard control or lower the available solar cell irradiance.
-
Pref and Qref_Q
In this given example the PPC takes it's active and reactive power inputs in MW and Mvar. Therefore simple calculations has to be done. In the MTB project conversion blocks are given as templates. The example plant is rated at 10 MW. The 'mtb_Pref' and 'mtb_Qref_Q' signals are therefore multiplied with 10.
-
Pmode and Qmode
If the PPC takes different integer values for the P modes or Q modes than the MTB provides, X-Y tables can be used for the conversion. In this given example the PPC P modes match the MTB outputs, but the Q modes does not. The PPC takes the Qmode inputs reactive power mode = 3, voltage mode = 1, and power factor mode = 2. It is therefore necessary to route the numbers 0->3, 1->1, 2->2. This is done with the X-Y table found in the MTB project. To set it up insert it into the model and double click on the block. Click on the '...' button in the data table row. Change the table to match your desired output.
- This step is different for every model. In this example the P, Q, Qu, and Qpf references are connected in the main canvas. The Qmode and Pmode parameters are connected inside the PPC block.
- The MTB block makes measurement at POC. It is possible to add additional measurements points in the model. This measured data will be exported along side the POC measurements. The block required to do this is called 'Unit measurement' and can be found in the MTB project.
- Copy and paste the block into the model and connect it to the point of interest. When pasting in the block use 'Paste Special' -> 'Paste Transfer' to avoid any issues. In this example the unit measurement block is placed at the inverter terminals.
- To setup the measurement block the voltage base and apparent power base has to be set. This is done by right clicking on the block and selecting 'Edit Parameters...'. Now specify the apparent power base and voltage base. The units are in MVA and kV. In this specific example the Sbase is 10 MVA and the Vbase is 33 kV. The 'Unit alias' parameter specifies the prefix of the output values names.
- The model is now set up and can be run. An example of a set up model can be seen below.
- The MTB will run the cases in parallel. The amount of usable cores depends on both the computer processor and the PSCAD license available. The MTB is by default set to run with a volley count of 8. This means that 8 cases are run simultaneously. To change the volley count change the 'Volley' parameter in the config.ini file.
- To run the simulation, right click on the 'execute_pscad.py' script and press 'Run'.
- You can follow along to see the progress by going to the workspace and selecting 'Simulations Sets' -> 'MTB' -> '?Model name?'. Click on a simulation task to view the preliminary results. A lot of different plots are available inside the MTB block. Double click on the MTB block to access them. The numbering of the simulation tasks does not match the rank of the cases specified in the testcases.xlsx file. This is because the test bench intelligently chooses which cases to run in parallel based on case simulation time. This ensures that the overall simulation time is minimized. To see which simulation task correspond to which simulation case go to the 'Script Output' tab in the bottom of PSCAD. Here the 'execute_pscad.py' scripts output the 'Rank' (given by testcases.xlsx) and the 'Task ID' (corresponding simulation task in PSCAD) along side the 'Casename'.
- To run individual cases right click on the MTB block and select 'Edit Parameters...'. Change the 'Mode' parameter to Manual. Select the desired 'Manual rank'. The rank corresponds to the given rank in the testcases.xlsx excel file. To run the individual case click on 'Run' in the 'Compile And Run' section in PSCAD.
- When simulating individual cases like this the data is not saved. To run and save an individual case the best approach is to change the testcases.xlsx excel file to only have one case that has 'Sand' selected. Then run the MTB like described previously with the MTB block in 'Volley' mode.
- Once the script has finished and the simulation runs are complete the output files can be accessed. They are found in the 'Output' folder. The test bench creates a set of '.csv'- and corresponding '.inf'-files that can be used with the plotter.py to plot the results and optionally compare it with results from PowerFactory. See the Quickstart Guide Plotter.
For further questions or help, please check if the README or the Quickstart Guides contains the answer.
Otherwise, please contact the Energinet simulation model team: simuleringsmodeller@energinet.dk