Commit 3435a3e1 authored by Jan Dinkelbach's avatar Jan Dinkelbach
Browse files

Merge branch 'fix-examples' into 'master'

fix path and cim import in se example

See merge request !15
parents db6095ba d6def9f3
......@@ -9,18 +9,22 @@ from pathlib import Path
logging.basicConfig(filename='CIGRE.log', level=logging.INFO, filemode='w')
cim_dir = Path('.') / 'sample_data' / 'CIGRE-MV-NoTap'
cim_files = cim_dir.glob('*.xml')
cim_list = []
for file in cim_files:
cim_list.append(str(file.absolute()))
print(cim_list)
this_file_folder = Path(__file__).resolve().parent
xml_path = this_file_folder / "sample_data" / "CIGRE-MV-NoTap"
xml_files = [xml_path / "Rootnet_FULL_NE_06J16h_DI.xml",
xml_path / "Rootnet_FULL_NE_06J16h_EQ.xml",
xml_path / "Rootnet_FULL_NE_06J16h_SV.xml",
xml_path / "Rootnet_FULL_NE_06J16h_TP.xml"]
xml_files_abs = []
for file in xml_files:
xml_files_abs.append(os.path.abspath(file))
# read cim files and create new network.Systen object
res, _, _ = cimpy.cim_import(cim_list, "cgmes_v2_4_15")
res = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
system = network.System()
base_apparent_power = 25 # MW
system.load_cim_data(res, base_apparent_power)
system.load_cim_data(res['topology'], base_apparent_power)
# Execute power flow analysis
results_pf, num_iter = nv_powerflow.solve(system)
......
......@@ -2,6 +2,7 @@
# The state estimation is performed based on the results using the nv_powerflow implementation
import logging
from pathlib import Path
import numpy as np
from pyvolt import network
from pyvolt import nv_powerflow
......@@ -11,25 +12,24 @@ from pyvolt import results
import cimpy
import os
os.chdir(os.path.dirname(__file__))
logging.basicConfig(filename='CIGRE.log', level=logging.INFO, filemode='w')
xml_path = r".\sample_data\CIGRE-MV-NoTap"
xml_files = [xml_path + r"\Rootnet_FULL_NE_06J16h_DI.xml",
xml_path + r"\Rootnet_FULL_NE_06J16h_EQ.xml",
xml_path + r"\Rootnet_FULL_NE_06J16h_SV.xml",
xml_path + r"\Rootnet_FULL_NE_06J16h_TP.xml"]
this_file_folder = Path(__file__).resolve().parent
xml_path = this_file_folder / "sample_data" / "CIGRE-MV-NoTap"
xml_files = [xml_path / "Rootnet_FULL_NE_06J16h_DI.xml",
xml_path / "Rootnet_FULL_NE_06J16h_EQ.xml",
xml_path / "Rootnet_FULL_NE_06J16h_SV.xml",
xml_path / "Rootnet_FULL_NE_06J16h_TP.xml"]
xml_files_abs = []
for file in xml_files:
xml_files_abs.append(os.path.abspath(file))
# read cim files and create new network.Systen object
res, _, _ = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
res = cimpy.cim_import(xml_files_abs, "cgmes_v2_4_15")
system = network.System()
base_apparent_power = 25 # MW
system.load_cim_data(res, base_apparent_power)
system.load_cim_data(res['topology'], base_apparent_power)
# Execute power flow analysis
results_pf, num_iter_cim = nv_powerflow.solve(system)
......
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