Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerFactory to Pandapower Import - Data Validation for Large Transmission Systems #2363

Open
3 of 4 tasks
Sciemon opened this issue Aug 2, 2024 · 5 comments
Open
3 of 4 tasks
Assignees

Comments

@Sciemon
Copy link
Contributor

Sciemon commented Aug 2, 2024

Feature Checklist

Issue

I use the import from PowerFactory as described in
pandapower.readthedocs.io/en/v2.9.0/converter/powerfactory.html

For small systems (e.g. IEEE 39 bus) this works well. You can validate the import by comparing the power flow results and they are similar.

For large transmission systems (e.g. the Texas system example in PF) the power flow results are not the same. It would be sufficient for me as a first step to validate that the topology and admittance matrix are correct and neglect the units and their controllers.

Is there a way to validate the import (of only the admittance matrix)? Are there expected limitations to the accuracy of the imported data (of the admittance matrix) for such large and complex systems?

Thank you in advance!

Label

  • Relevant labels are selected
@pawellytaev pawellytaev self-assigned this Aug 26, 2024
@pawellytaev
Copy link
Contributor

pawellytaev commented Aug 26, 2024

Hi Sciemon, in the Texas grid there are SVC elements that are not covered by the converter yet, but this is already part of a PR: #2348 . this results in huge voltage differences as they automatically control the voltage. Also in the PowerFactory model of the Texas grid the slack is distributed over the loads which pandapower doesn't support. pandapower converts one synchronous machine from PF as an external grid (as it is a reference machine in PF) and sets is as the slack.

I don't know if there is a way to get the admittance matrix from PowerFactory to compare with pandapower. If there is one, please let me know, because such a validation of the admittances would be very beneficial.

There are currently expected limitations to some branch elements, e.g., phase shifters are modeled in different ways in PF and in pandapower, trafos in general can be tricky depending on the settings in Powerfactory. Lines and impedances should be matching. Shunt elements, like loads, filters, should also be converted correctly. If you see differences there, please let us know.

Have you tried out the PF2pp import validation function in pandapower? This gives hints where differences are in the power flow results

import pandapower as pp
import powerfactory as pf

from pandapower.converter.powerfactory.export_pfd_to_pp import from_pfd
from pandapower.converter.powerfactory.validate import validate_pf_conversion

def get_pf_grid(project_name):
    app = pf.GetApplication()
    net = from_pfd(app, project_name, handle_us="Nothing")
    return net, app

if __name__=="__main__":
    net, app = get_pf_grid("Texas Grid") 
    diff = validate_pf_conversion(net)

@Sciemon
Copy link
Contributor Author

Sciemon commented Nov 12, 2024

Thank you @pawellytaev for the clarification. I look forward to #2348 being merged.

PowerFactory is pretty closed, so there is no way to access the admittance matrix.

We now have an interface to pandapower in powfacpy, our wrapper for the python API of PowerFactory (see this tutorial).

One thing I am not yet sure about is the p.u. base of the admittance matrix (see #2446).

I tried to use validate_pf_conversion(net) (in engine/non-interactive mode) but get the following error message:

d:\User\seberlein\FraunhIEE-UniKassel-PowSysStability\powfacpy\venv\Lib\site-packages\pandapower\converter\powerfactory\validate.py in ?(net, is_unbalanced, **kwargs)
    242 
    243     """
    244     logger.debug('starting verification')
    245     replace_zero_branches_with_switches(net)
--> 246     pf_results = _get_pf_results(net, is_unbalanced=is_unbalanced)
    247 
    248     run_control = "controller" in net.keys() and len(net.controller) > 0
    249     for arg in 'trafo_model check_connectivity'.split():

d:\User\seberlein\FraunhIEE-UniKassel-PowSysStability\powfacpy\venv\Lib\site-packages\pandapower\converter\powerfactory\validate.py in ?(net, is_unbalanced)
     20     pf_results = None
     21     if is_unbalanced:
     22         pf_results = _get_pf_results_unbalanced(net)
     23     else:
---> 24         pf_results = _get_pf_results_balanced(net)
     25 
     26     return pf_results

d:\User\seberlein\FraunhIEE-UniKassel-PowSysStability\powfacpy\venv\Lib\site-packages\pandapower\converter\powerfactory\validate.py in ?(net)
     29 def _get_pf_results_balanced(net):
---> 30     pf_switch_status = net.res_switch.pf_closed & \
     31                net.res_switch.pf_in_service if len(net.switch) > 0 and \
     32                                                'res_switch' in net.keys() else pd.Series(dtype=np.float64)
     33     pf_bus_vm = net.res_bus.pf_vm_pu.replace(0, np.nan)

d:\User\seberlein\FraunhIEE-UniKassel-PowSysStability\powfacpy\venv\Lib\site-packages\pandas\core\generic.py in ?(self, name)
   6295             and name not in self._accessors
   6296             and self._info_axis._can_hold_identifiers_and_holds_name(name)
   6297         ):
   6298             return self[name]
-> 6299         return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'pf_closed'

@pawellytaev
Copy link
Contributor

Hi, you get this error message if run a power flow in pandapower after converting the grid. During the conversion, additional columns are added to the pandapower res_... dataframes, which then are used in the validation function. During the power flow res_... tables are reset.

If you don't run a power flow after the conversion and use validate_pf_conversion() right after that, you shouldn't get this error

@vogt31337
Copy link
Contributor

@Sciemon, have you tried what @pawellytaev suggested?

@Sciemon
Copy link
Contributor Author

Sciemon commented Dec 5, 2024

@vogt31337 sorry, i just found the time to look into this again.

@pawellytaev thanks, that works well for example with the IEEE 39 bus example. I usually work with systems with ElmVsc elements not supported by pandapower and there can be very large differences as expected (so cannot validate admittance matrix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants