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

Add generation of CGMES profile class #39

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: pre-commit
on:
pull_request:
push:
branches: [main]
branches:
- master

jobs:
pre-commit:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup python
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install Graphviz
shell: bash
run: |
sudo apt-get -y install graphviz

- name: Install Python dependencies
run: |
pip install .[dev]
Expand All @@ -37,4 +32,4 @@ jobs:
if: ${{ always() }}
with:
name: pytest-results
path: cimpy/report.xml
path: report.xml
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
__pycache__
.idea
.venv
./cimpy/__pycache__
*.egg
build/
dist/

*.log
/.pytest_cache
/report.xml

# VSCode
.vscode/*
1 change: 1 addition & 0 deletions cimpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from cimpy.cimexport import cim_export
from cimpy.cimimport import cim_import
from cimpy.cimexport import cim_export_to_string_array
import cimpy.utils
from cimpy.cimexamples import import_example
from cimpy.cimexamples import export_example
Expand Down
172 changes: 87 additions & 85 deletions cimpy/cgmes_v2_4_15/ACDCConverter.py
Original file line number Diff line number Diff line change
@@ -1,85 +1,87 @@
from .ConductingEquipment import ConductingEquipment


class ACDCConverter(ConductingEquipment):
'''
A unit with valves for three phases, together with unit control equipment, essential protective and switching devices, DC storage capacitors, phase reactors and auxiliaries, if any, used for conversion.

:baseS: Base apparent power of the converter pole. Default: 0.0
:idleLoss: Active power loss in pole at no power transfer. Converter configuration data used in power flow. Default: 0.0
:maxUdc: The maximum voltage on the DC side at which the converter should operate. Converter configuration data used in power flow. Default: 0.0
:minUdc: Min allowed converter DC voltage. Converter configuration data used in power flow. Default: 0.0
:numberOfValves: Number of valves in the converter. Used in loss calculations. Default: 0
:ratedUdc: Rated converter DC voltage, also called UdN. Converter configuration data used in power flow. Default: 0.0
:resistiveLoss: Converter configuration data used in power flow. Refer to poleLossP. Default: 0.0
:switchingLoss: Switching losses, relative to the base apparent power `baseS`. Refer to poleLossP. Default: 0.0
:valveU0: Valve threshold voltage. Forward voltage drop when the valve is conducting. Used in loss calculations, i.e. the switchLoss depend on numberOfValves * valveU0. Default: 0.0
:DCTerminals: Default: "list"
:PccTerminal: All converters` DC sides linked to this point of common coupling terminal. Default: None
:p: Active power at the point of common coupling. Load sign convention is used, i.e. positive sign means flow out from a node. Starting value for a steady state solution in the case a simplified power flow model is used. Default: 0.0
:q: Reactive power at the point of common coupling. Load sign convention is used, i.e. positive sign means flow out from a node. Starting value for a steady state solution in the case a simplified power flow model is used. Default: 0.0
:targetPpcc: Real power injection target in AC grid, at point of common coupling. Default: 0.0
:targetUdc: Target value for DC voltage magnitude. Default: 0.0
:idc: Converter DC current, also called Id. Converter state variable, result from power flow. Default: 0.0
:poleLossP: The active power loss at a DC Pole = idleLoss + switchingLoss*|Idc| + resitiveLoss*Idc^2 For lossless operation Pdc=Pac For rectifier operation with losses Pdc=Pac-lossP For inverter operation with losses Pdc=Pac+lossP Converter state variable used in power flow. Default: 0.0
:uc: Converter voltage, the voltage at the AC side of the bridge. Converter state variable, result from power flow. Default: 0.0
:udc: Converter voltage at the DC side, also called Ud. Converter state variable, result from power flow. Default: 0.0
'''

cgmesProfile = ConductingEquipment.cgmesProfile

possibleProfileList = {'class': [cgmesProfile.EQ.value, cgmesProfile.SSH.value, cgmesProfile.SV.value, ],
'baseS': [cgmesProfile.EQ.value, ],
'idleLoss': [cgmesProfile.EQ.value, ],
'maxUdc': [cgmesProfile.EQ.value, ],
'minUdc': [cgmesProfile.EQ.value, ],
'numberOfValves': [cgmesProfile.EQ.value, ],
'ratedUdc': [cgmesProfile.EQ.value, ],
'resistiveLoss': [cgmesProfile.EQ.value, ],
'switchingLoss': [cgmesProfile.EQ.value, ],
'valveU0': [cgmesProfile.EQ.value, ],
'DCTerminals': [cgmesProfile.EQ.value, ],
'PccTerminal': [cgmesProfile.EQ.value, ],
'p': [cgmesProfile.SSH.value, ],
'q': [cgmesProfile.SSH.value, ],
'targetPpcc': [cgmesProfile.SSH.value, ],
'targetUdc': [cgmesProfile.SSH.value, ],
'idc': [cgmesProfile.SV.value, ],
'poleLossP': [cgmesProfile.SV.value, ],
'uc': [cgmesProfile.SV.value, ],
'udc': [cgmesProfile.SV.value, ],
}

serializationProfile = {}

__doc__ += '\n Documentation of parent class ConductingEquipment: \n' + ConductingEquipment.__doc__

def __init__(self, baseS = 0.0, idleLoss = 0.0, maxUdc = 0.0, minUdc = 0.0, numberOfValves = 0, ratedUdc = 0.0, resistiveLoss = 0.0, switchingLoss = 0.0, valveU0 = 0.0, DCTerminals = "list", PccTerminal = None, p = 0.0, q = 0.0, targetPpcc = 0.0, targetUdc = 0.0, idc = 0.0, poleLossP = 0.0, uc = 0.0, udc = 0.0, *args, **kw_args):
super().__init__(*args, **kw_args)

self.baseS = baseS
self.idleLoss = idleLoss
self.maxUdc = maxUdc
self.minUdc = minUdc
self.numberOfValves = numberOfValves
self.ratedUdc = ratedUdc
self.resistiveLoss = resistiveLoss
self.switchingLoss = switchingLoss
self.valveU0 = valveU0
self.DCTerminals = DCTerminals
self.PccTerminal = PccTerminal
self.p = p
self.q = q
self.targetPpcc = targetPpcc
self.targetUdc = targetUdc
self.idc = idc
self.poleLossP = poleLossP
self.uc = uc
self.udc = udc

def __str__(self):
str = 'class=ACDCConverter\n'
attributes = self.__dict__
for key in attributes.keys():
str = str + key + '={}\n'.format(attributes[key])
return str
from .ConductingEquipment import ConductingEquipment
from .CGMESProfile import Profile


class ACDCConverter(ConductingEquipment):
"""
A unit with valves for three phases, together with unit control equipment, essential protective and switching devices, DC storage capacitors, phase reactors and auxiliaries, if any, used for conversion.

:DCTerminals: Default: "list"
:PccTerminal: All converters` DC sides linked to this point of common coupling terminal. Default: None
:baseS: Base apparent power of the converter pole. Default: 0.0
:idc: Converter DC current, also called Id. Converter state variable, result from power flow. Default: 0.0
:idleLoss: Active power loss in pole at no power transfer. Converter configuration data used in power flow. Default: 0.0
:maxUdc: The maximum voltage on the DC side at which the converter should operate. Converter configuration data used in power flow. Default: 0.0
:minUdc: Min allowed converter DC voltage. Converter configuration data used in power flow. Default: 0.0
:numberOfValves: Number of valves in the converter. Used in loss calculations. Default: 0
:p: Active power at the point of common coupling. Load sign convention is used, i.e. positive sign means flow out from a node. Starting value for a steady state solution in the case a simplified power flow model is used. Default: 0.0
:poleLossP: The active power loss at a DC Pole = idleLoss + switchingLoss*|Idc| + resitiveLoss*Idc^2 For lossless operation Pdc=Pac For rectifier operation with losses Pdc=Pac-lossP For inverter operation with losses Pdc=Pac+lossP Converter state variable used in power flow. Default: 0.0
:q: Reactive power at the point of common coupling. Load sign convention is used, i.e. positive sign means flow out from a node. Starting value for a steady state solution in the case a simplified power flow model is used. Default: 0.0
:ratedUdc: Rated converter DC voltage, also called UdN. Converter configuration data used in power flow. Default: 0.0
:resistiveLoss: Converter configuration data used in power flow. Refer to poleLossP. Default: 0.0
:switchingLoss: Switching losses, relative to the base apparent power `baseS`. Refer to poleLossP. Default: 0.0
:targetPpcc: Real power injection target in AC grid, at point of common coupling. Default: 0.0
:targetUdc: Target value for DC voltage magnitude. Default: 0.0
:uc: Converter voltage, the voltage at the AC side of the bridge. Converter state variable, result from power flow. Default: 0.0
:udc: Converter voltage at the DC side, also called Ud. Converter state variable, result from power flow. Default: 0.0
:valveU0: Valve threshold voltage. Forward voltage drop when the valve is conducting. Used in loss calculations, i.e. the switchLoss depend on numberOfValves * valveU0. Default: 0.0
"""

possibleProfileList = {
"class": [Profile.EQ.value, Profile.SV.value, Profile.SSH.value, ],
"DCTerminals": [Profile.EQ.value, ],
"PccTerminal": [Profile.EQ.value, ],
"baseS": [Profile.EQ.value, ],
"idc": [Profile.SV.value, ],
"idleLoss": [Profile.EQ.value, ],
"maxUdc": [Profile.EQ.value, ],
"minUdc": [Profile.EQ.value, ],
"numberOfValves": [Profile.EQ.value, ],
"p": [Profile.SSH.value, ],
"poleLossP": [Profile.SV.value, ],
"q": [Profile.SSH.value, ],
"ratedUdc": [Profile.EQ.value, ],
"resistiveLoss": [Profile.EQ.value, ],
"switchingLoss": [Profile.EQ.value, ],
"targetPpcc": [Profile.SSH.value, ],
"targetUdc": [Profile.SSH.value, ],
"uc": [Profile.SV.value, ],
"udc": [Profile.SV.value, ],
"valveU0": [Profile.EQ.value, ],
}

serializationProfile = {}

recommendedClassProfile = Profile.EQ.value

__doc__ += "\nDocumentation of parent class ConductingEquipment:\n" + ConductingEquipment.__doc__

def __init__(self, DCTerminals = "list", PccTerminal = None, baseS = 0.0, idc = 0.0, idleLoss = 0.0, maxUdc = 0.0, minUdc = 0.0, numberOfValves = 0, p = 0.0, poleLossP = 0.0, q = 0.0, ratedUdc = 0.0, resistiveLoss = 0.0, switchingLoss = 0.0, targetPpcc = 0.0, targetUdc = 0.0, uc = 0.0, udc = 0.0, valveU0 = 0.0, *args, **kw_args):
super().__init__(*args, **kw_args)

self.DCTerminals = DCTerminals
self.PccTerminal = PccTerminal
self.baseS = baseS
self.idc = idc
self.idleLoss = idleLoss
self.maxUdc = maxUdc
self.minUdc = minUdc
self.numberOfValves = numberOfValves
self.p = p
self.poleLossP = poleLossP
self.q = q
self.ratedUdc = ratedUdc
self.resistiveLoss = resistiveLoss
self.switchingLoss = switchingLoss
self.targetPpcc = targetPpcc
self.targetUdc = targetUdc
self.uc = uc
self.udc = udc
self.valveU0 = valveU0

def __str__(self):
str = "class=ACDCConverter\n"
attributes = self.__dict__
for key in attributes.keys():
str = str + key + "={}\n".format(attributes[key])
return str
70 changes: 36 additions & 34 deletions cimpy/cgmes_v2_4_15/ACDCConverterDCTerminal.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
from .DCBaseTerminal import DCBaseTerminal


class ACDCConverterDCTerminal(DCBaseTerminal):
'''
A DC electrical connection point at the AC/DC converter. The AC/DC converter is electrically connected also to the AC side. The AC connection is inherited from the AC conducting equipment in the same way as any other AC equipment. The AC/DC converter DC terminal is separate from generic DC terminal to restrict the connection with the AC side to AC/DC converter and so that no other DC conducting equipment can be connected to the AC side.

:DCConductingEquipment: Default: None
:polarity: Represents the normal network polarity condition. Default: None
'''

cgmesProfile = DCBaseTerminal.cgmesProfile

possibleProfileList = {'class': [cgmesProfile.EQ.value, cgmesProfile.SSH.value, cgmesProfile.TP.value, ],
'DCConductingEquipment': [cgmesProfile.EQ.value, ],
'polarity': [cgmesProfile.EQ.value, ],
}

serializationProfile = {}

__doc__ += '\n Documentation of parent class DCBaseTerminal: \n' + DCBaseTerminal.__doc__

def __init__(self, DCConductingEquipment = None, polarity = None, *args, **kw_args):
super().__init__(*args, **kw_args)

self.DCConductingEquipment = DCConductingEquipment
self.polarity = polarity

def __str__(self):
str = 'class=ACDCConverterDCTerminal\n'
attributes = self.__dict__
for key in attributes.keys():
str = str + key + '={}\n'.format(attributes[key])
return str
from .DCBaseTerminal import DCBaseTerminal
from .CGMESProfile import Profile


class ACDCConverterDCTerminal(DCBaseTerminal):
"""
A DC electrical connection point at the AC/DC converter. The AC/DC converter is electrically connected also to the AC side. The AC connection is inherited from the AC conducting equipment in the same way as any other AC equipment. The AC/DC converter DC terminal is separate from generic DC terminal to restrict the connection with the AC side to AC/DC converter and so that no other DC conducting equipment can be connected to the AC side.

:DCConductingEquipment: Default: None
:polarity: Represents the normal network polarity condition. Default: None
"""

possibleProfileList = {
"class": [Profile.EQ.value, Profile.SSH.value, Profile.TP.value, ],
"DCConductingEquipment": [Profile.EQ.value, ],
"polarity": [Profile.EQ.value, ],
}

serializationProfile = {}

recommendedClassProfile = Profile.EQ.value

__doc__ += "\nDocumentation of parent class DCBaseTerminal:\n" + DCBaseTerminal.__doc__

def __init__(self, DCConductingEquipment = None, polarity = None, *args, **kw_args):
super().__init__(*args, **kw_args)

self.DCConductingEquipment = DCConductingEquipment
self.polarity = polarity

def __str__(self):
str = "class=ACDCConverterDCTerminal\n"
attributes = self.__dict__
for key in attributes.keys():
str = str + key + "={}\n".format(attributes[key])
return str
Loading