NB: "example.uct" is not uploaded yet for data confidentiality reasons, will follow up soon.
A script compliant with EU's SOGL to assess influence of external elements on a grid model. Supports UCTE DEF CGM as well as import from PSSE.
European TSOs are required by European Commission Regulation (EU) 2017/1485 of 2 August 2017 establishing a guideline on electricity transmission system operation to develop a methodology to assess the influence on their system of elements located in another TSO's control area. This script was developed as a proposal for an implementation of a methodology that should be compliant with SOGL's requirements and provides a flexible implementation. The script is a modification and refactoring of the script by Jonathan Baudier (available at https://github.com/JonathanBaudier/InfluenceComputation, released under apache license v2). Major changes:
- support for PSSE file format
- extensive refactoring and testing to improve robustness and increase reusability
- some speed improvements
This version is released under Apache license to match Jonathan's earlier script, see license file.
To be able to run the code fully, you will need the following:
- A working legacy Python (Python 2) installation
- A working Python installation
- A licensed version of PSSE installed (you should be able to run UCTE definition files without this requirement, but the tests for the PSSE file will fail as it needs access to the PSSE API to read the test file.)
- Several python packages installed in legacy Python and Python, see below for more details.
This script should be compatible with any grid model compliant with UCTE data exchange format (UCTE DEF) version 2 (http://cimug.ucaiug.org/Groups/Model%20Exchange/UCTE-format.pdf). However, for large grid size (around 8 000 nodes, 13 000 branches for Continental Europe's Synchronous Area), a large memory space is required. Thus, for this kind of grid 8 GB of RAM are required (16 GB recommended).
The script should also be compatible with grid models in PSSE33. It uses a wrapper around the PSSE python API to get access to the grid topology and gather the relevant information. A complication when using PSSE33 is that it does not support Python 3, while the script is written in Python 3.6. To solve this, the Python 3 process starts a Python 2 process and interfaces using the execnet package. This means, however, that both a working Python 2 and Python 3 interpreter needs to be available on your system to be able to use this functionality.
-
Ensure you have PSSE33 installed, as well as Python 2.7 in folder
C:\Python27
, and a python 3 installation. -
Install necessary Python 3 packages using
pipenv
(docs) with commandpipenv install --dev
-
Get python 2 ready for PSSE is a bit tricky as there are bugs in the default installation. Do the following to fix this:
- Uninstall the buggy versions:
- in a command prompt, navigate to
C:\Python27
- uninstall old numpy, scipy, tables:
python -m pip uninstall numpy
,python -m pip uninstall scipy
,python -m pip uninstall tables
- in a command prompt, navigate to
- reinstall numpy, scipy, tables precompiled version:
- Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and download the right wheel files:
- Numpy:
numpy-1.14.2+mkl-cp27-cp27m-win32.whl
- Scipy:
scipy-1.0.0-cp27-cp27m-win32.whl
- Pytables:
tables-3.4.2-cp27-cp27m-win32.whl
(this to get rid of a buggy version of pytables in the default python 2 install)
- Numpy:
- in a command prompt, navigate to
C:\Python27
- install numpy, scipy and tables (in that order!!!) with a command like
python -m pip install C:\Users\yourusername\Downloads\numpy\numpy-1.14.2+mkl-cp27-cp27m-win32.whl
and something similar for scipy and tables.
- Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and download the right wheel files:
- install other packages:
- in your command promtp, navigate to
C:\Python27
- install requirements_27.txt:
python -m pip install -r C:\path_to_your_repo\requirements_27.txt
- in your command promtp, navigate to
- Uninstall the buggy versions:
-
Try to run all the tests using
pytest
. The model provides two test files: the UCTE model for Europe as provided in Jonathan's original script, and a IEEE 300 bus test model (taken from http://icseg.iti.illinois.edu/ieee-300-bus-system/, saved as.sav
file, and added dummy line ratings.) The tests should take about 2 minutes, and will among others test a full run using the 300 bus test model.
For example, you want to run example.uct
with different settings:
0. Ensure your installation is correct and all tests run, see installation notes above.
- Open the file
settings.py
and check where the settings for example.uct are defined. in this case, on line 8 to 28. - Make the changes you want to those settings.
- Note the name of the settings set (in this case UCT0, see line 8)
- Open the file
main.py
, scroll to the last line, and set to the right settings:main(settings=get_settings(SettingsEnum.UCT0))
- run the script by running main.py.
- inspect the results that will appear in a subfolder output_files.
For example, you want to run my_ieee_model.sav
from PSSE, using the same settings as used in setting set PSSE0
.
0. Ensure your installation is correct and all tests run, see installation notes above.
- Open the file
settings.py
and check where the settingsPSSE0
are defined. in this case, on line 30 to 40. - Copy and paste this setting set with a new name. For example, we call it
myPSSEsettings
: then you copy line 30 to 40 and paste it on line 41, changing the nameSettingsEnum.PSSE0
toSettingsEnum.myPSSEsettings
. Change also the following:- input_file_name should be
my_ieee_model.sav
- case_name should be
Nordics
if you use a model that is a variant of to the Nordics model that you chose. If so, the countries will be set up correctly automatically. If you have a totally new model with a different country setup, pick another case_name. - countries should match the set of countries you are interested in. If you have a different country setup, then you have to make changes to the set_country functions in the code - see there when relevant.
- other settings should be defined as you wish, see settings.py for documentation on their meaning.
- input_file_name should be
- On line 3, extend the enum with your new name
myPSSEsettings
. - Open the file
main.py
, scroll to the last line, and set to the right settings:main(settings=get_settings(SettingsEnum.myPSSEsettings))
- run the script by running main.py.
- inspect the results that will appear in a subfolder output_files.
For each grid element located outside of the investigated control area, the influence is defined as the maximum Line Outage Distribution Factor on any element located in the investigated control area in any N-i situation in which an i element is disconnected. For each grid element located outside of the investigated control area, the influence is defined as the maximum Line Outage Distribution Factor on any element located in the investigated control area in any N-i situation in which an i element is disconnected multiplied by the ratio of MVA thermal limits of the investigated element and the influenced element.
- What to read: all elements over 80 kV plus generators behind step-up transformer are read (this can be adapted in the settings)
- We use Rate A from PSSE as PATL
- multi-section lines are combined into one branch
- Bus bar couplers:
- All lines with rate 0 defined as bus bar couplers
- Transformers:
- 3-winding transformers:
- if 0 to 1 branches relevant: skip
- if 2 branches relevant: change to 2w
- if 3 branches relevant 3 2w transformers with dummy bus (as in PSSE acc to doc)
- 3-winding transformers:
- Code for generator IF calculation is not sped up with numba yet and takes a disproportionately long time to run. My first try to get numba to speed up this code failed, not tried another yet.
- Handling of unicode names is sloppy at best, should be improved later.