diff --git a/examples/quickstart/run_nv_powerflow_WSCC9.py b/examples/quickstart/run_nv_powerflow_WSCC9.py new file mode 100644 index 0000000..906c120 --- /dev/null +++ b/examples/quickstart/run_nv_powerflow_WSCC9.py @@ -0,0 +1,61 @@ +import logging +from pathlib import Path +from pyvolt import network +from pyvolt import nv_powerflow +import numpy +import cimpy +import os +from pyvolt.network import BusType + + +logging.basicConfig(filename='run_nv_powerflow.log', level=logging.INFO, filemode='w') + +#python starts as module in subdirectory, 2 folders up to set the new path +this_file_folder = Path(__file__).parents[2] +p = str(this_file_folder)+"/examples/sample_data/WSCC9" +xml_path = Path(p) + + +xml_files = [os.path.join(xml_path, "WSCC-09_Dyn_Fourth_EQ.xml"), + os.path.join(xml_path, "WSCC-09_Dyn_Fourth_SV.xml"), + os.path.join(xml_path, "WSCC-09_Dyn_Fourth_TP.xml")] + +# Read cim files and create new network.System object +res = cimpy.cim_import(xml_files, "cgmes_v2_4_15") +system = network.System() +base_apparent_power = 100 # MW +system.load_cim_data(res['topology'], base_apparent_power) + +# Set node 1 as slack +system.nodes[4].type=BusType.SLACK + +# Execute power flow analysis +results_pf, num_iter = nv_powerflow.solve(system) + +# Print node voltages +print("Powerflow converged in " + str(num_iter) + " iterations.\n") +print("Results: \n") +voltages = [] +for node in results_pf.nodes: + print('Magnitude {}={}, Phase {}={}'.format(node.topology_node.uuid, numpy.abs(node.voltage_pu), node.topology_node.uuid, numpy.angle(node.voltage_pu, deg=True))) + voltages.append(node.voltage_pu) + +""" +# validation against matpower +matpower_voltages = { + "BUS1": [1.040, 0.000], + "BUS2": [1.025, 9.693], + "BUS3": [1.025, 4.881], + "BUS4": [0.996, -2.306], + "BUS5": [0.966, -3.737], + "BUS6": [1.004, 2.107], + "BUS7": [0.979, 0.836], + "BUS8": [0.997, 3.974], + "BUS9": [0.951, 4.138] +} + +# assertion +for idx, node in enumerate(results_pf.nodes): + print(matpower_voltages[node.topology_node.uuid][0] - numpy.round(numpy.abs(node.voltage_pu),3)) + print(matpower_voltages[node.topology_node.uuid][1] - numpy.round(numpy.angle(node.voltage_pu, deg=True),3)) +""" diff --git a/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_EQ.xml b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_EQ.xml new file mode 100644 index 0000000..6ee42cf --- /dev/null +++ b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_EQ.xml @@ -0,0 +1,1268 @@ + + + + description + + + 16.50 + + + 13.80 + + + 18.00 + + + 230.00 + + + 26500 + + + + + 6334 + + + + + 29358 + + + + + 19169 + + + + + 26962 + + + + + 15724 + + + + + 18467 + + + + + 41 + + + + + 11478 + + + + + BUS6 + + + + BUS8 + + + + BUS9 + + + + BUS3 + + + + BUS2 + + + + BUS7 + + + + BUS4 + + + + BUS1 + + + + BUS5 + + + + Area 1 + + + Zone 1 + + + + PATL + 45000 + + + + TATL + 180 + + + + TATL + 60 + + + + LOAD8 + false + + + + + LOAD8_0 + 1 + + + + LOAD8 + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + LOAD5 + false + + + + + LOAD5_0 + 1 + + + + LOAD5 + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + LOAD6 + false + + + + + LOAD6_0 + 1 + + + + LOAD6 + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + Gen-1076922534 + 85.000000 + 0e+000 + 1 + 0e+000 + 0e+000 + false + + + + GEN3 + false + + 100.000000 + 0e+000 + 0e+000 + 100.000000 + + + + + 13.800000 + 0e+000 + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + + + + GEN3-DYN + 0.00 + 0.00 + 1.3125 + 1.2578 + 0.1813 + 0.2500 + 0.00 + 0.00 + 5 + 0 + 0 + 0 + 3 + + + + + GEN3 + false + 14.145000 + 0e+000 + + + + + GEN3_0 + 1 + + + + Gen-1076922653 + 71.641021 + 0e+000 + 1 + 0e+000 + 0e+000 + false + + + + GEN1 + false + + 1 + 100.000000 + 0e+000 + 0e+000 + 100.000000 + + + + + 16.500000 + 0e+000 + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + + + + GEN1-DYN + 0.00 + 0.00 + 0.1460 + 0.1000 + 0.0608 + 0.0969 + 0.00 + 0.00 + 896 + 0310 + 000 + 000 + 2364 + + + + + GEN1 + false + 17.160000 + 0e+000 + + + + + GEN1_0 + 1 + + + + Gen-1076922483 + 163.000000 + 0e+000 + 1 + 0e+000 + 0e+000 + false + + + + GEN2 + false + + 100.000000 + 0e+000 + 0e+000 + 100.000000 + + + + + 18.000000 + 0e+000 + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + + + + GEN2-DYN + 0.00 + 0.00 + 0.8958 + 0.8645 + 0.1198 + 0.1969 + 0.00 + 0.00 + 600 + 05350 + 000 + 000 + 64 + + + + + GEN2 + false + 18.450000 + 0e+000 + + + + + GEN2_0 + 1 + + + + LINE75 + 16.928000 + 85.169000 + 5.7845e-04 + 1.000000 + 0.0 + false + + 50.784000 + 255.507000 + 0.0004820416 + 0.0 + 160.0000000000 + + + LINE75_0 + 1 + + + + LINE75_1 + 2 + + + + Ratings for branch LINE75 + + + + + Ratings + + + + + Ratings for line LINE75 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE75 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE75 - Emergency + + + + + Emergency + 0e+000 + + + + + LINE96 + 20.631000 + 89.930000 + 6.7675e-04 + 1.000000 + 0.0 + false + + 61.893000 + 269.790000 + 0.0005639572 + 0.0 + 160.0000000000 + + + LINE96_0 + 1 + + + + LINE96_1 + 2 + + + + Ratings for branch LINE96 + + + + + Ratings + + + + + Ratings for line LINE96 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE96 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE96 - Emergency + + + + + Emergency + 0e+000 + + + + + LINE64 + 8.993000 + 48.668000 + 2.9868e-04 + 1.000000 + 0.0 + false + + 26.979000 + 146.004000 + 0.0002488973 + 0.0 + 160.0000000000 + + + LINE64_0 + 1 + + + + LINE64_1 + 2 + + + + Ratings for branch LINE64 + + + + + Ratings + + + + + Ratings for line LINE64 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE64 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE64 - Emergency + + + + + Emergency + 0e+000 + + + + + LINE54 + 5.290000 + 44.965000 + 3.3270e-04 + 1.000000 + 0.0 + false + + 15.870000 + 134.895000 + 0.0002772527 + 0.0 + 160.0000000000 + + + LINE54_0 + 1 + + + + LINE54_1 + 2 + + + + Ratings for branch LINE54 + + + + + Ratings + + + + + Ratings for line LINE54 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE54 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE54 - Emergency + + + + + Emergency + 0e+000 + + + + + LINE89 + 6.295100 + 53.323200 + 3.9509e-04 + 1.000000 + 0.0 + false + + 18.885300 + 159.969600 + 0.0003292376 + 0.0 + 160.0000000000 + + + LINE89_0 + 1 + + + + LINE89_1 + 2 + + + + Ratings for branch LINE89 + + + + + Ratings + + + + + Ratings for line LINE89 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE89 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE89 - Emergency + + + + + Emergency + 0e+000 + + + + + LINE78 + 4.496500 + 38.088000 + 2.8166e-04 + 1.000000 + 0.0 + false + + 13.489500 + 114.264000 + 0.0002347196 + 0.0 + 160.0000000000 + + + LINE78_0 + 1 + + + + LINE78_1 + 2 + + + + Ratings for branch LINE78 + + + + + Ratings + + + + + Ratings for line LINE78 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line LINE78 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line LINE78 - Emergency + + + + + Emergency + 0e+000 + + + + + TR39 + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + TR39_0 + 1 + + + + TR39 + 0e+000 + 0.111598 + 0.0 + 0.0 + 0e+000 + 0.111598 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 13.800000 + 1 + 0 + true + + + + + + + Ratings for branch TR39 + + + + + Ratings + + + + + Ratings for line TR39 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR39 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR39 - Emergency + + + + + Emergency + 0e+000 + + + + + TR39_1 + 2 + + + + TR39 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 230.000000 + 2 + 0 + true + + + + + + + Ratings for branch TR39 + + + + + Ratings + + + + + Ratings for line TR39 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR39 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR39 - Emergency + + + + + Emergency + 0e+000 + + + + + TR14 + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + TR14_0 + 1 + + + + TR14 + 0e+000 + 0.156816 + 0.0 + 0.0 + 0e+000 + 0.156816 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 16.500000 + 1 + 0 + true + + + + + + + Ratings for branch TR14 + + + + + Ratings + + + + + Ratings for line TR14 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR14 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR14 - Emergency + + + + + Emergency + 0e+000 + + + + + TR14_1 + 2 + + + + TR14 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 230.000000 + 2 + 0 + true + + + + + + + Ratings for branch TR14 + + + + + Ratings + + + + + Ratings for line TR14 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR14 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR14 - Emergency + + + + + Emergency + 0e+000 + + + + + TR27 + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + TR27_0 + 1 + + + + TR27 + 0e+000 + 0.202500 + 0.0 + 0.0 + 0e+000 + 0.202500 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 18.000000 + 1 + 0 + true + + + + + + + Ratings for branch TR27 + + + + + Ratings + + + + + Ratings for line TR27 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR27 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR27 - Emergency + + + + + Emergency + 0e+000 + + + + + TR27_1 + 2 + + + + TR27 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 100.000000 + 230.000000 + 2 + 0 + true + + + + + + + Ratings for branch TR27 + + + + + Ratings + + + + + Ratings for line TR27 - Normal + + + + + Normal + 0e+000 + + + + + Ratings for line TR27 - ShortTerm + + + + + ShortTerm + 0e+000 + + + + + Ratings for line TR27 - Emergency + + + + + Emergency + 0e+000 + + + + diff --git a/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_SV.xml b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_SV.xml new file mode 100644 index 0000000..663abb7 --- /dev/null +++ b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_SV.xml @@ -0,0 +1,78 @@ + + + + 14.145000 + 4.664751 + + + + 228.995097 + -3.988800 + + + + 232.910495 + -3.687390 + + + + 235.931330 + -2.216780 + + + + 17.160000 + -0e+000 + + + + 18.450000 + 9.280005 + + + + 235.926956 + 3.719701 + + + + 237.441178 + 1.966716 + + + + 233.652994 + 0.727536 + + + + 100.000000 + 35.000000 + + + + 125.000000 + 50.000000 + + + + 90.000000 + 30.000000 + + + + -85.000000 + 10.859709 + + + + -71.641021 + -27.045923 + + + + -163.000000 + -6.653660 + + + diff --git a/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_TP.xml b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_TP.xml new file mode 100644 index 0000000..2970617 --- /dev/null +++ b/examples/sample_data/WSCC9/WSCC-09_Dyn_Fourth_TP.xml @@ -0,0 +1,147 @@ + + + + description + + + BUS3 + + + + + BUS5 + + + + + BUS6 + + + + + BUS4 + + + + + BUS1 + + + + + BUS2 + + + + + BUS7 + + + + + BUS9 + + + + + BUS8 + + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + +