Commit 03552aa7 authored by Philipp Reuber's avatar Philipp Reuber
Browse files

include examples in package

parent fcc34b80
recursive-include examples *.xml
\ No newline at end of file
from cimpy.cimexport import cim_export
from cimpy.cimimport import cim_import
import cimpy.utils
\ No newline at end of file
import cimpy.utils
from cimpy.examples.importCIGREMV import import_example
from cimpy.examples.exportCIGREMV import export_example
import logging
import os
import cimpy
logging.basicConfig(filename='Convert_to_Bus_Branch.log', level=logging.INFO, filemode='w')
xml_files = [r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_XX_YYY_DL_.xml",
r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_XX_YYY_GL_.xml",
r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_XX_YYY_SSH_.xml",
r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_XX_YYY_SV_.xml",
r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_XX_YYY_TP_.xml",
r"..\sampledata\Sample_Grid_Switches\Node-Breaker\20191030T0924Z_YYY_EQ_.xml",]
xml_files_abs = []
for file in xml_files:
xml_files_abs.append(os.path.abspath(file))
# res = cimpy.cimread(xml_files)
res, namespaces = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
bus_branch = cimpy.utils.node_breaker_to_bus_branch(res)
# dicts = cimpy.get_class_attributes_dict(res)
cimpy.cim_export(bus_branch, namespaces, 'Bus_Branch_Converted', 'cgmes_v2_4_15')
\ No newline at end of file
import logging
import os
import cimpy
def export_example():
logging.basicConfig(filename='exportCIGREMV.log', level=logging.INFO, filemode='w')
cwd = os.getcwd()
os.chdir(os.path.dirname(__file__))
xml_files = [r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_DI.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files_abs = []
for file in xml_files:
xml_files_abs.append(os.path.abspath(file))
# res = cimpy.cimread(xml_files)
import_result = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
activeProfileList = ['DI', 'EQ', 'SV', 'TP']
# dicts = cimpy.get_class_attributes_dict(res)
cimpy.cim_export(import_result, 'CIGREMV_reference_cgmes_v2_4_15', 'cgmes_v2_4_15', activeProfileList)
os.chdir(cwd)
import logging
import os
import cimpy
def import_example():
logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w')
cwd = os.getcwd()
os.chdir(os.path.dirname(__file__))
xml_files = [r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_DI.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\..\examples\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files_abs = []
for file in xml_files:
xml_files_abs.append(os.path.abspath(file))
# res = cimpy.cimread(xml_files)
import_result = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
print("\n\n")
results = ["ACLineSegment", "PowerTransformer", "EnergyConsumer"]
for key, value in import_result['topology'].items():
if value.__class__.__name__ in results:
print(value.__str__())
os.chdir(cwd)
......@@ -3,10 +3,10 @@ import os
import cimpy
logging.basicConfig(filename='exportCIGREMV.log', level=logging.INFO, filemode='w')
xml_files = [r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_DI.xml",
r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files = [r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_DI.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files_abs = []
......
......@@ -6,9 +6,10 @@ import cimpy
logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w')
print(os.getcwd())
xml_files = [r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\sampledata\CIGRE_MV\CIGRE_MV_Rudion_With_LoadFLow_Results\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files = [r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_DI.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_EQ.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_SV.xml",
r"..\sampledata\CIGRE_MV\Rootnet_FULL_NE_24J13h_TP.xml", ]
xml_files_abs = []
for file in xml_files:
......
......@@ -8,6 +8,7 @@ if __name__ == '__main__':
description='Python CIM Utilities',
author='Institute for Automation of Complex Power Systems',
author_email='acs-software@eonerc.rwth-aachen.de',
include_package_data=True,
install_requires=[
'lxml',
'xmltodict',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment