From 91782a755af6e54cc9340272ad65505e328928cb Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Tue, 23 Oct 2018 13:54:50 -0600 Subject: [PATCH 01/25] Second commit --- .../Capacitors/test_capacitor_connectivity.py | 77 ++++++++++++ .../opendss/Lines/test_line_connectivity.py | 110 ++++++++++++++++++ .../readers/opendss/Lines/test_line_length.py | 39 +++++++ 3 files changed, 226 insertions(+) create mode 100644 tests/readers/opendss/Capacitors/test_capacitor_connectivity.py create mode 100644 tests/readers/opendss/Lines/test_line_connectivity.py create mode 100644 tests/readers/opendss/Lines/test_line_length.py diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py new file mode 100644 index 00000000..af8a0e31 --- /dev/null +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +""" +test_capacitor_connectivity.py +---------------------------------- + +Tests for parsing all the attributes of Capacitors when reading from OpenDSS to Ditto +""" + +import os +import math +import pytest +import numpy as np + +from ditto.store import Store +from ditto.readers.opendss.read import Reader + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_capacitor_connectivity(): + m = Store() + r = Reader( + master_file=os.path.join(current_directory, "test_capacitor_connectivity.dss") + ) + r.parse(m) + m.set_names() + + assert len(m["cap1"].phase_capacitors) == 3 # Cap1 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["cap1"].phase_capacitors] + ) == pytest.approx(600 * 10 ** 3, 0.0001) + assert m["cap1"].nominal_voltage == float(4.16) * 10 ** 3 + # assert m["cap1"].connection_type is None # Default is set as Y + assert m["cap1"].delay is None + assert m["cap1"].mode is None + assert m["cap1"].low is None + assert m["cap1"].high is None + # assert m["cap1"].resistance is None # 0.0 + assert m["cap1"].resistance0 is None + # assert m["cap1"].reactance is None # 0.0 + assert m["cap1"].reactance0 is None + assert m["cap1"].susceptance is None + assert m["cap1"].susceptance0 is None + assert m["cap1"].conductance is None + assert m["cap1"].conductance0 is None + assert m["cap1"].pt_ratio is None + assert m["cap1"].ct_ratio is None + assert m["cap1"].pt_phase is None + assert m["cap1"].connecting_element == "bus1" + # assert m["cap1"].positions is None # [] + assert m["cap1"].measuring_element is None + # assert m["cap1"].substation_name is None # '' + assert m["cap1"].feeder_name == "sourcebus_src" + assert m["cap1"].is_substation == 0 + + assert set([pc.phase for pc in m["cap1"].phase_capacitors]) == set(["A", "B", "C"]) + assert [ + phase_capacitor.switch for phase_capacitor in m["cap1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["cap1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections for phase_capacitor in m["cap1"].phase_capacitors + ] == [None, None, None] + + assert len(m["cap2"].phase_capacitors) == 1 # Cap2 is a one phase capacitor + assert m["cap2"].phase_capacitors[0].var == 100 * 10 ** 3 + + assert len(m["cap3"].phase_capacitors) == 1 # Cap3 is a one phase capacitor + assert m["cap3"].phase_capacitors[0].var == 200.37 * 10 ** 3 + + assert len(m["cap4"].phase_capacitors) == 2 # Cap4 is a two phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["cap4"].phase_capacitors] + ) == pytest.approx(400 * 10 ** 3, 0.0001) diff --git a/tests/readers/opendss/Lines/test_line_connectivity.py b/tests/readers/opendss/Lines/test_line_connectivity.py new file mode 100644 index 00000000..8d3c964b --- /dev/null +++ b/tests/readers/opendss/Lines/test_line_connectivity.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- + +""" +test_line_connectivity.py +---------------------------------- + +Tests for checking the line connectivity and all the attributes of line and wire +""" +import logging +import os + +import six + +import tempfile +import pytest as pt + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_line_connectivity(): + """Tests if line length units are in meters.""" + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_line_length.dss + m = Store() + r = Reader( + master_file=os.path.join(current_directory, "test_line_connectivity.dss") + ) + r.parse(m) + m.set_names() + # assert len(m["line1"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line1"].nominal_voltage == float(4.16) * 10 ** 3 + # assert m["line1"].line_type == "underground" # Default is overhead, ditto changed it to underground since it checks for OH in linecode + assert m["line1"].length == 100 + assert m["line1"].is_fuse is None + assert m["line1"].is_switch is None + assert m["line1"].is_banked is None + # assert m["line1"].faultrate is None # 0.1 + # assert m["line1"].positions is None # [] + # assert m["line1"].impedance_matrix is None # Value + # assert m["line1"].capacitance_matrix is None # Value + assert m["line1"].substation_name is None + assert m["line1"].feeder_name == "sourcebus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + assert m["line1"].is_sectionalizer is None + # assert m["line1"].nameclass is None ## '' + assert m["line1"].is_substation == 0 ## Value is 0, assumed None + assert m["line1"].is_network_protector is None + + for w in m["line1"].wires: + # assert w.nameclass is None # Value is '' + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + """ + assert m["line1"].from_element == "sourcebus" + assert m["line1"].to_element == "bus1" + +# assert len(m["line2"].wires) == 4 + assert m["line2"].from_element == "bus1" + assert m["line2"].to_element == "bus2" + + #assert len(m["line3"].wires) == 3 + assert m["line3"].from_element == "bus2" + assert m["line3"].to_element == "bus3" + + #assert len(m["line4"].wires) == 3 + assert m["line4"].from_element == "bus3" + assert m["line4"].to_element == "bus4" + + #assert len(m["line1"].wires) == 3 + assert m["line5"].from_element == "bus1" + assert m["line5"].to_element == "bus5" + assert (m["line5"].length) == float(1500 * 0.3048) #units = ft + + #assert len(m["line1"].wires) == 3 + assert m["line6"].from_element == "bus4" + assert m["line6"].to_element == "bus6" + + #assert len(m["line1"].wires) == 3 + assert m["line7"].from_element == "bus1" + assert m["line7"].to_element == "bus2" + +""" diff --git a/tests/readers/opendss/Lines/test_line_length.py b/tests/readers/opendss/Lines/test_line_length.py new file mode 100644 index 00000000..533de170 --- /dev/null +++ b/tests/readers/opendss/Lines/test_line_length.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +""" +test_line_length.py +---------------------------------- + +Tests for checking the line length values are all in meters. +""" +import logging +import os + +import six + +import tempfile +import pytest as pt + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_line_length(): + """Tests if line length units are in meters.""" + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_line_length.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_line_length.dss")) + r.parse(m) + m.set_names() + + # Check that line lengths are in meters + assert (m["line1"].length) == float(100) + assert (m["line2"].length) == float(83.47 * 304.8) # units = kft + assert (m["line3"].length) == float(200 * 0.3048) # units = ft + assert (m["line4"].length) == float(1.01 * 1609.34) # units = mi + assert (m["line5"].length) == float(2040.12 * 0.01) # units = cm + assert (m["line6"].length) == float(1666.87 * 0.0254) # units = in From f2466274b756c7467dbed51151bc59bc7591c1ca Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Tue, 23 Oct 2018 16:07:36 -0600 Subject: [PATCH 02/25] Adding the markdown file --- docs/OpenDSS/read.md | 93 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 docs/OpenDSS/read.md diff --git a/docs/OpenDSS/read.md b/docs/OpenDSS/read.md new file mode 100644 index 00000000..1178c9e1 --- /dev/null +++ b/docs/OpenDSS/read.md @@ -0,0 +1,93 @@ +# To see whether an attribute is tested or not + +## Line +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| nominal_voltage | yes | +| line_type | no | +| length | yes | +| from_element | yes | +| to_element | yes | +| is_fuse | no | +| is_switch | no | +| is_banked | no | +| faultrate | no | +| wires | yes | +| positions | no | +| impedance_matrix | no | +| capacitance_matrix | no | +| substation_name | no | +| feeder_name | no | +| is_recloser | no | +| is_breaker | no | +| is_sectionalizer | no | +| nameclass | no | +| is_substation | no | +| is_network_protector| no | + + +## Wire +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| phase | yes | +| nameclass | no | +| X | no | +| Y | no | +| diameter | no | +| gmr | no | +| ampacity | no | +| emergency_ampacity | no | +| resistance | no | +| insulation_thickness| no | +| is_fuse | no | +| is_switch | no | +| is_open | no | +| interrupting_rating | no | +| concentric_neutral_gmr | no | +| concentric_neutral_resistance | no | +| concentric_neutral_diameter | no | +| concentric_outside_diameter | no | +| concentric_neutral_nstrand | no | +| drop | no | +| is_recloser | no | +| is_breaker | no | +| is_network_protector| no | +| is_sectionalizer | no | + +## Capacitor +| Attribute | Tested | +| :------------------:|:-------:| +| nominal_voltage | yes | +| connection_type | yes | +| delay | no | +| mode | no | +| low | no | +| high | no | +| resistance | no | +| resistance0 | no | +| reactance | no | +| reactance0 | no | +| susceptance | no | +| susceptance0 | no | +| conductance | no | +| conductance0 | no | +| pt_ratio | no | +| ct_ratio | no | +| pt_phase | no | +| connecting_element | no | +| positions | no | +| measuring_element | no | +| substation_name | no | +| feeder_name | no | +| is_substation | no | + +## Phase Capacitor +| Attribute | Tested | +| :------------------:|:-------:| +| phase | yes | +| var | no | +| switch | no | +| sections | no | +| normalsections | no | From 3b8875cdcf95e31fe9624ebea9b13591ee38bb16 Mon Sep 17 00:00:00 2001 From: telgindy Date: Wed, 31 Oct 2018 10:55:07 -0600 Subject: [PATCH 03/25] Adding various linecode configurations --- .../readers/opendss/Lines/test_linecodes.dss | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tests/readers/opendss/Lines/test_linecodes.dss diff --git a/tests/readers/opendss/Lines/test_linecodes.dss b/tests/readers/opendss/Lines/test_linecodes.dss new file mode 100644 index 00000000..90e58304 --- /dev/null +++ b/tests/readers/opendss/Lines/test_linecodes.dss @@ -0,0 +1,89 @@ +Clear + +New circuit.test_linecodes basekv=12.47 pu=1.01 phases=3 bus1=sourcebus + +! Linecode 1 is taken from IEEE 8500 test system Linecodes.dss +New Linecode.3-1/0C_2/0CN_T nphases=3 r1=0.3489 x1=0.426198 r0=0.588811 x0=1.29612 c1=10.4308823411236 c0=4.48501282215346 units=km baseFreq=60 normamps=310 emergamps=310 faultrate=0.1 pctperm=20 repair=3 + +! Linecode 2 is taken from IEEE 8500 test system Linecodes.dss +New Linecode.1P_#8CU_#8N nphases=3 r1=2.15622 x1=0.539412 r0=2.5511 x0=1.78041 c1=8.05740467479414 c0=4.52209592389387 units=km baseFreq=60 normamps=1 emergamps=1 faultrate=0.1 pctperm=20 repair=3 + +! Linecode 3 is taken from IEEE 8500 test system Linecodes.dss +New Linecode.3P_3#500_AL_EPR_CD nphases=3 r1=0.072514 x1=0.001056 r0=0.140678 x0=-0.043807 c1=0 c0=0 units=km baseFreq=60 normamps=1110 emergamps=1110 faultrate=0.1 pctperm=20 repair=3 + +! Linecode 4 is taken from IEEE 8500 test system Linecodes2.dss +New Linecode.3ph_h-397_acsr397_acsr397_acsr2/0_acsr nphases=3 Units=km +~ Rmatrix=[0.270019 |0.109951 0.264634 |0.113538 0.110747 0.271698 ] +~ Xmatrix=[0.695974 |0.33351 0.708729 |0.308271 0.350259 0.692021 ] +~ Cmatrix=[9.13606 |-2.66777 9.62226 |-2.17646 -3.15664 9.43197 ] + +! Linecode 5 is taken from IEEE 8500 test system Linecodes2.dss +New Linecode.1ph-2_acsrxx4_acsr nphases=1 Units=km +~ Rmatrix=[1.12339 ] +~ Xmatrix=[0.937794 ] +~ Cmatrix=[6.49582 ] + +! Linecode 6 is taken from IEEE 8500 test system Linecodes2.dss +New Linecode.2ph_h-2_acsrx2_acsr2_acsr nphases=2 Units=km +~ Rmatrix=[1.13148 |0.142066 1.13362 ] +~ Xmatrix=[0.884886 |0.366115 0.882239 ] +~ Cmatrix=[7.33718 |-2.39809 7.33718 ] + +! Linecode 7 is taken from IEEE 8500 test system Triplex_Linecodes.dss +New Linecode.750_Triplex nphases=2 units=kft ! ohms per 1000 ft +~ rmatrix=[ 0.04974733 0.02342157 | 0.02342157 0.04974733 ] +~ xmatrix=[ 0.02782436 0.00669472 | 0.00669472 0.02782436 ] +~ cmatrix=[ 3.00000000 -2.40000000 | -2.40000000 3.00000000 ] +~ NormAmps=580 {580 1.25 *} + + +! Linecode 8 is taken from IEEE 8500 test system Triplex_Linecodes.dss +New Linecode.4/0Triplex nphases=2 units=kft !ohms per 1000 ft +~ rmatrix=[ 0.40995115 0.11809509 | 0.11809509 0.40995115 ] +~ xmatrix=[ 0.16681819 0.12759250 | 0.12759250 0.16681819 ] +~ cmatrix=[ 3.00000000 -2.40000000 | -2.40000000 3.00000000 ] +~ Normamps=156 {156 1.25 *} + + +! Linecode 9 is empty +New Linecode.empty nphases=3 units=km + +! Linecode 10 only has r1 set +New Linecode.r1_only nphases=3 r1=0.3489 units=km + + +! Linecode 11 only has r0 set +New Linecode.r0_only nphases=3 r0=0.588811 units=km + +! Linecode 12 only has x1 set +New Linecode.x1_only nphases=3 x1=0.426198 units=km + +! Linecode 13 only has x0 set +New Linecode.x0_only nphases=3 x0=1.29612 units=km + +! Linecode 14 only has c1 set +New Linecode.c1_only nphases=3 c1=10.4308823411236 units=km + +! Linecode 14 only has c0 set +New Linecode.x0_only nphases=3 c0=4.38501282215346 units=km + +New Line.line1 Bus1=bus1 Bus2=bus2 phases=3 Length=10 linecode=3-1/0C_2/0CN_T units=m +New Line.line2 Bus1=bus2 Bus2=bus3 phases=1 Length=10 linecode=1P_#8CU_#8 units=m +New Line.line3 Bus1=bus3 Bus2=bus4 phases=3 Length=10 linecode=3P_3#500_AL_EPR_CD units=m +New Line.line4 Bus1=bus4 Bus2=bus5 phases=3 Length=10 linecode=3ph_h-397_acsr397_acsr397_acsr2/0_acsr units=m +New Line.line5 Bus1=bus5 Bus2=bus6 phases=1 Length=10 linecode=1ph-2_acsrxx4_acsr units=m +New Line.line6 Bus1=bus6 Bus2=bus7 phases=2 Length=10 linecode=2ph_h-2_acsrx2_acsr2_acsr units=m +New Line.line7 Bus1=bus7 Bus2=bus8 phases=2 Length=10 linecode=750_Triplex units=m +New Line.line8 Bus1=bus8 Bus2=bus9 phases=2 Length=10 linecode=4/0Triplex units=m +New Line.line9 Bus1=bus9 Bus2=bus10 phases=3 Length=10 linecode=empty units=m +New Line.line10 Bus1=bus10 Bus2=bus11 phases=3 Length=10 linecode=r1_only units=m +New Line.line11 Bus1=bus11 Bus2=bus12 phases=3 Length=10 linecode=r0_only units=m +New Line.line12 Bus1=bus12 Bus2=bus13 phases=3 Length=10 linecode=x1_only units=m +New Line.line13 Bus1=bus13 Bus2=bus14 phases=3 Length=10 linecode=x0_only units=m +New Line.line14 Bus1=bus14 Bus2=bus15 phases=3 Length=10 linecode=c1_only units=m +New Line.line15 Bus1=bus15 Bus2=bus16 phases=3 Length=10 linecode=c0_only units=m + + +Set Voltagebases=[12.47] +Calcvoltagebases +Solve From 890b3077abda83bcaf16d76939d9e28005891f5c Mon Sep 17 00:00:00 2001 From: telgindy Date: Thu, 1 Nov 2018 10:04:40 -0600 Subject: [PATCH 04/25] fixing name typo and adding phases --- .../readers/opendss/Lines/test_linecodes.dss | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/readers/opendss/Lines/test_linecodes.dss b/tests/readers/opendss/Lines/test_linecodes.dss index 90e58304..aa3c9f04 100644 --- a/tests/readers/opendss/Lines/test_linecodes.dss +++ b/tests/readers/opendss/Lines/test_linecodes.dss @@ -67,21 +67,21 @@ New Linecode.c1_only nphases=3 c1=10.4308823411236 units=km ! Linecode 14 only has c0 set New Linecode.x0_only nphases=3 c0=4.38501282215346 units=km -New Line.line1 Bus1=bus1 Bus2=bus2 phases=3 Length=10 linecode=3-1/0C_2/0CN_T units=m -New Line.line2 Bus1=bus2 Bus2=bus3 phases=1 Length=10 linecode=1P_#8CU_#8 units=m -New Line.line3 Bus1=bus3 Bus2=bus4 phases=3 Length=10 linecode=3P_3#500_AL_EPR_CD units=m -New Line.line4 Bus1=bus4 Bus2=bus5 phases=3 Length=10 linecode=3ph_h-397_acsr397_acsr397_acsr2/0_acsr units=m -New Line.line5 Bus1=bus5 Bus2=bus6 phases=1 Length=10 linecode=1ph-2_acsrxx4_acsr units=m -New Line.line6 Bus1=bus6 Bus2=bus7 phases=2 Length=10 linecode=2ph_h-2_acsrx2_acsr2_acsr units=m -New Line.line7 Bus1=bus7 Bus2=bus8 phases=2 Length=10 linecode=750_Triplex units=m -New Line.line8 Bus1=bus8 Bus2=bus9 phases=2 Length=10 linecode=4/0Triplex units=m -New Line.line9 Bus1=bus9 Bus2=bus10 phases=3 Length=10 linecode=empty units=m -New Line.line10 Bus1=bus10 Bus2=bus11 phases=3 Length=10 linecode=r1_only units=m -New Line.line11 Bus1=bus11 Bus2=bus12 phases=3 Length=10 linecode=r0_only units=m -New Line.line12 Bus1=bus12 Bus2=bus13 phases=3 Length=10 linecode=x1_only units=m -New Line.line13 Bus1=bus13 Bus2=bus14 phases=3 Length=10 linecode=x0_only units=m -New Line.line14 Bus1=bus14 Bus2=bus15 phases=3 Length=10 linecode=c1_only units=m -New Line.line15 Bus1=bus15 Bus2=bus16 phases=3 Length=10 linecode=c0_only units=m +New Line.line1 Bus1=bus1.1.2.3 Bus2=bus2.1.2.3 phases=3 Length=10 linecode=3-1/0C_2/0CN_T units=m +New Line.line2 Bus1=bus2.3 Bus2=bus3.3 phases=1 Length=10 linecode=1P_#8CU_#8N units=m +New Line.line3 Bus1=bus2.1.2.3 Bus2=bus4.1.2.3 phases=3 Length=10 linecode=3P_3#500_AL_EPR_CD units=m +New Line.line4 Bus1=bus4.1.2.3 Bus2=bus5.1.2.3 phases=3 Length=10 linecode=3ph_h-397_acsr397_acsr397_acsr2/0_acsr units=m +New Line.line5 Bus1=bus5.2 Bus2=bus6.2 phases=1 Length=10 linecode=1ph-2_acsrxx4_acsr units=m +New Line.line6 Bus1=bus5.1.3 Bus2=bus7.1.3 phases=2 Length=10 linecode=2ph_h-2_acsrx2_acsr2_acsr units=m +New Line.line7 Bus1=bus5.1.2 Bus2=bus8.1.2 phases=2 Length=10 linecode=750_Triplex units=m +New Line.line8 Bus1=bus5.2.3 Bus2=bus9.2.3 phases=2 Length=10 linecode=4/0Triplex units=m +New Line.line9 Bus1=bus4.1.2.3 Bus2=bus10.1.2.3 phases=3 Length=10 linecode=empty units=m +New Line.line10 Bus1=bus10.1.2.3 Bus2=bus11.1.2.3 phases=3 Length=10 linecode=r1_only units=m +New Line.line11 Bus1=bus11.1.2.3 Bus2=bus12.1.2.3 phases=3 Length=10 linecode=r0_only units=m +New Line.line12 Bus1=bus12.1.2.3 Bus2=bus13.1.2.3 phases=3 Length=10 linecode=x1_only units=m +New Line.line13 Bus1=bus13.1.2.3 Bus2=bus14.1.2.3 phases=3 Length=10 linecode=x0_only units=m +New Line.line14 Bus1=bus14.1.2.3 Bus2=bus15.1.2.3 phases=3 Length=10 linecode=c1_only units=m +New Line.line15 Bus1=bus15.1.2.3 Bus2=bus16.1.2.3 phases=3 Length=10 linecode=c0_only units=m Set Voltagebases=[12.47] From a5b6111f2dca943abd847170b84bcc18a1190a80 Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Wed, 7 Nov 2018 10:57:29 -0700 Subject: [PATCH 05/25] Transformers and Regulators --- docs/read.md | 209 ++++++++++++++++++ tests/readers/opendss/Loads/test_loads.dss | 7 + .../opendss/Regulators/test_regulators.dss | 20 ++ 3 files changed, 236 insertions(+) create mode 100644 docs/read.md create mode 100644 tests/readers/opendss/Loads/test_loads.dss create mode 100644 tests/readers/opendss/Regulators/test_regulators.dss diff --git a/docs/read.md b/docs/read.md new file mode 100644 index 00000000..31fe0815 --- /dev/null +++ b/docs/read.md @@ -0,0 +1,209 @@ +# To see whether an attribute is tested or not + +## Line +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| nominal_voltage | yes | +| line_type | no | +| length | yes | +| from_element | yes | +| to_element | yes | +| is_fuse | no | +| is_switch | no | +| is_banked | no | +| faultrate | no | +| wires | yes | +| positions | no | +| impedance_matrix | yes | +| capacitance_matrix | yes | +| substation_name | no | +| feeder_name | yes | +| is_recloser | no | +| is_breaker | no | +| is_sectionalizer | no | +| nameclass | yes | +| is_substation | no | +| is_network_protector| no | + + +## Wire +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| phase | yes | +| nameclass | yes | +| X | yes | +| Y | yes | +| diameter | yes | +| gmr | yes | +| ampacity | yes | +| emergency_ampacity | yes | +| resistance | yes | +| insulation_thickness| no | +| is_fuse | no | +| is_switch | no | +| is_open | no | +| interrupting_rating | no | +| concentric_neutral_gmr | no | +| concentric_neutral_resistance | no | +| concentric_neutral_diameter | no | +| concentric_outside_diameter | no | +| concentric_neutral_nstrand | no | +| drop | no | +| is_recloser | no | +| is_breaker | no | +| is_network_protector| no | +| is_sectionalizer | no | + +## Capacitor +| Attribute | Tested | +| :------------------:|:-------:| +| nominal_voltage | yes | +| connection_type | yes | +| delay | no | +| mode | no | +| low | no | +| high | no | +| resistance | no | +| resistance0 | no | +| reactance | no | +| reactance0 | no | +| susceptance | no | +| susceptance0 | no | +| conductance | no | +| conductance0 | no | +| pt_ratio | no | +| ct_ratio | no | +| pt_phase | no | +| connecting_element | no | +| positions | no | +| measuring_element | no | +| substation_name | no | +| feeder_name | no | +| is_substation | no | + +## Phase Capacitor +| Attribute | Tested | +| :------------------:|:-------:| +| phase | yes | +| var | no | +| switch | no | +| sections | no | +| normalsections | no | + +## Transformer +| Attribute | Tested | +| :------------------:|:-------:| +| name | no | +| install_type | no | +| noload_loss | no | +| phase_shift | no | +| from_element | yes | +| to_element | yes | +| reactances | yes | +| windings | yes | +| positions | no | +| loadloss | no | +| normhkva | no | +| is_center_tap | no | +| is_substation | no | +| substation_name | no | +| feeder_name | yes | + +## Winding +| Attribute | Tested | +| :------------------:|:-------:| +| connection_type | yes | +| voltage_type | no | +| nominal_voltage | yes | +| voltage_limit | no | +| resistance | yes | +| reverse_resistance | no | +| phase_windings | yes | +| rated_power | yes | +| emergency_power | no | + + +## Phase Winding +| Attribute | Tested | +| :------------------:|:-------:| +| tap_position | no | +| phase | yes | +| compensator_r | no | +| compensator_x | no | + +## Regulator +| Attribute | Tested | +| :------------------:|:-------:| +| name | no | +| delay | yes | +| highstep | no | +| lowstep | no | +| pt_ratio | yes | +| ct_ratio | no | +| phase_shift | no | +| ltc | no | +| bandwidth | yes | +| bandcenter | yes | +| voltage_limit | no | +| from_element | yes | +| to_element | yes | +|connected_transformer| yes | +| pt_phase | no | +| reactances | yes | +| windings | no | +| positions | no | +| winding | yes | +| ct_prim | no | +| noload_loss | no | +| substation_name | no | +| feeder_name | yes | +| setpoint | no | +| is_substation | no | + +## Load +| Attribute | Tested | +| :------------------:|:-------:| +| name | no | +| connection_type | no | +| nominal_voltage | yes | +| vmin | yes | +| vmax | yes | +| phase_loads | yes | +| positions | no | +| timeseries | no | +| connecting_element | yes | +| rooftop_area | no | +| peak_p | no | +| peak_q | no | +| peak_coincident_p | no | +| peak_coincident_q | no | +| yearly_energy | no | +| num_levels | no | +| num_users | no | +| substation_name | no | +| feeder_name | yes | +| upstream_transformer_name | no | +| transformer_connected_kva | no | +| is_substation | no | +| is_center_tap | no | +| center_tap_perct_1_N| no | +| center_tap_perct_N_2| no | +| center_tap_perct_1_2| no | + +## PhaseLoad +| Attribute | Tested | +| :------------------:|:-------:| +| phase | no | +| p | no | +| q | no | +| model | no | +| use_zip | no | +| drop | no | +| ppercentcurrent | no | +| qpercentcurrent | no | +| ppercentpower | no | +| qpercentpower | no | +| ppercentimpedance | no | +| qpercentimpedance | no | diff --git a/tests/readers/opendss/Loads/test_loads.dss b/tests/readers/opendss/Loads/test_loads.dss new file mode 100644 index 00000000..05c20f5c --- /dev/null +++ b/tests/readers/opendss/Loads/test_loads.dss @@ -0,0 +1,7 @@ +Clear + +new circuit.loadtest basekV=1 phases=1 pu=1.0 bus1=src + +new load.zipv bus1=load.1 kW=1 pf=0.88 phases=1 kV=1 model=8 vminpu=0.0 vmaxpu=1.2 +~ zipv=(0.855,-0.9855,1.1305,2.559,-2.963,1.404,0.87) + diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss new file mode 100644 index 00000000..e4039b5a --- /dev/null +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -0,0 +1,20 @@ +Clear + +New circuit.test_regulators basekv=115 pu=1.01 bus1=sourcebus + +! Regulator No. 1 + +New Transformer.VREG2_A phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.1, 190-8593.1) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 +New Transformer.VREG2_B phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.2, 190-8593.2) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 +New Transformer.VREG2_C phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.3, 190-8593.3) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 + +New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band=2 +New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 +New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 + +! Regulator No. 2 + +New Transformer.regxfmr_B18865 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 enabled=True +New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 + + From 7bd1953d5ca9d1111084eac09b152ae31be57b82 Mon Sep 17 00:00:00 2001 From: telgindy Date: Wed, 7 Nov 2018 14:43:44 -0700 Subject: [PATCH 06/25] Adding additional transformer test cases --- .../Transformers/test_transformer_kv.dss | 57 +++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.dss b/tests/readers/opendss/Transformers/test_transformer_kv.dss index d0a70fbc..c35e2db1 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.dss +++ b/tests/readers/opendss/Transformers/test_transformer_kv.dss @@ -2,16 +2,65 @@ Clear New circuit.test_transformer_kv basekv=115 pu=1.01 phases=3 bus1=sourcebus +! Delta-Wye substation transformer from IEEE 8500 test system + New Transformer.substation phases=3 windings=2 XHL=(8 1000 /) ~ wdg=1 bus=sourcebus conn=delta kv=115 kva=5000 %r=(.5 1000 /) XHT=4 ~ wdg=2 bus=bus1 conn=wye kv=4.16 kva=5000 %r=(.5 1000 /) XLT=4 + +! Regulator Transformer from IEEE 8500 test system New Transformer.reg1 phases=3 Buses=[bus1 bus2] windings=2 kVs=[4.16 4.16] kVAs=[1666 1666] +! Two phase delta configuration transformer New Transformer.xfm1 phases=2 windings=2 XHL=2 -~ wdg=1 bus=bus2.1.3 conn=Wye kv=4.16 kva=500 %r=.55 XHT=1 -~ wdg=2 bus=bus3.1.3 conn=Wye kv=0.48 kva=500 %r=.55 XLT=1 +~ wdg=1 bus=bus2.1.3 conn=Delta kv=4.16 kva=500 %r=.55 XHT=1 +~ wdg=2 bus=bus3.1.2 conn=Wye kv=0.48 kva=500 %r=.55 XLT=1 + + +! Three phase Delta-Wye substation Transformer from 4kV SMART-DS region P4U + +New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=69.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_12 wdg=2 conn=wye Kv=4.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_13 XHL=0.9616652224137047 + +! Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U + +New Transformer.tr(r:p4udt27-p4udt27lv) phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 + +! Three phase Delta-Wye Transformer (modified) from 4kV SMART-DS region P4U + +New Transformer.tr(r:p4udt27-p4udt27lv)_1 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 + +! Three phase Delta-Delta Transformer (modified) from 4kV SMART-DS region P4U + +New Transformer.tr(r:p4udt27-p4udt27lv)_2 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 + +! Three phase Wye-Delta Transformer (modified) from 4kV SMART-DS region P4U + +New Transformer.tr(r:p4udt27-p4udt27lv)_3 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 + +! Center Tap Transformer from 4kV SMART-DS region P4U + +New Transformer.tr(r:p4udt25-p4udt25lv) phases=1 windings=3 %loadloss=0.798816 %Noloadloss=0.472 normhkva=27.5 wdg=1 conn=wye bus=p4udt25.2 Kv=2.3094 kva=25.0 EmergHKVA=37.5 %r=0.266272 wdg=2 conn=wye bus=p4udt25lv.1.0 Kv=0.120089 kva=25.0 EmergHKVA=37.5 %r=0.532544 wdg=3 conn=wye bus=p4udt25lv.0.2 Kv=0.120089 kva=25.0 EmergHKVA=37.5 %r=0.532544 XHL=2.4 XLT=2.4 XHT=1.6 + + +! Center Tap Transformer from IEEE 8500 test case + +New Transformer.T21396254A phases=1 windings=3 wdg=1 bus=L2804253.1 kv=7.2 kVA=15 wdg=2 bus=X2804253A.1.0 kv=0.12 kVA=15 wdg=3 bus=X2804253A.0.2 kv=0.12 kVA=15 %imag=0.5 %Rs=[0.6 1.2 1.2] %noloadloss=.2 Xhl=2.04 Xht=2.04 Xlt=1.36 + + +! Single phase Wye-Wye Transformer (for regulator) From IEEE 8500 Test case +New Transformer.FEEDER_REGA phases=1 windings=2 Bank=FEEDER_REG buses=(regxfmr_HVMV_Sub_LSB.1, _HVMV_Sub_LSB.1) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(27500, 27500) xhl=0.1 %loadloss=.001 wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 + + +! Single phase Wye-Wye Transformers from Epri J-1 Feeder +New Transformer.B13659-1C phases=1 wdg=1 bus=B13659.3 kv=7.2 kVA=15 wdg=2 bus=X_B13659-C.3 kv=0.24 kVA=15 %loadloss=1.04 %noloadloss=0.34 XHL=1.5 normhkva=15 emerghkva=21 +New Transformer.B4551-1A phases=1 wdg=1 bus=B4551.1 kv=7.2 kVA=15 wdg=2 bus=X_B4551-A.1 kv=0.24 kVA=15 %loadloss=1.04 %noloadloss=0.34 XHL=1.5 normhkva=15 emerghkva=21 + + +! Three phase Wye-Wye Transformer from Epri J-1 Feeder +New Transformer.5865228330A-1ABC phases=3 wdg=1 bus=5865228330A.1.2.3 kv=12.47 kVA=2000 wdg=2 bus=X_5865228330A kv=0.416 kVA=2000 %loadloss=0.7 %noloadloss=0.05 XHL=5 normhkva=2000.01 emerghkva=2800 + -Set Voltagebases=[115, 4.16, .48] +Set Voltagebases=[115, 12.7, 7.2, 4.16, 4.0, 0.48, 0.416, 0.12] Calcvoltagebases -Solve \ No newline at end of file +Solve From 8873db0834b53c61982088db03ce79af859d694f Mon Sep 17 00:00:00 2001 From: telgindy Date: Wed, 7 Nov 2018 14:48:53 -0700 Subject: [PATCH 07/25] Adding extra 4-node feeder case --- tests/readers/opendss/Transformers/test_transformer_kv.dss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.dss b/tests/readers/opendss/Transformers/test_transformer_kv.dss index c35e2db1..909cb9b9 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.dss +++ b/tests/readers/opendss/Transformers/test_transformer_kv.dss @@ -17,6 +17,11 @@ New Transformer.xfm1 phases=2 windings=2 XHL=2 ~ wdg=1 bus=bus2.1.3 conn=Delta kv=4.16 kva=500 %r=.55 XHT=1 ~ wdg=2 bus=bus3.1.2 conn=Wye kv=0.48 kva=500 %r=.55 XLT=1 +! Three phase wye-wye transformer from IEEE 4 node feeder +new transformer.t1 xhl=6 +~ wdg=1 bus=n2 conn=wye kV=12.47 kVA=6000 %r=0.5 +~ wdg=2 bus=n3 conn=wye kV=4.16 kVA=6000 %r=0.5 + ! Three phase Delta-Wye substation Transformer from 4kV SMART-DS region P4U From ef926bf109942037973fbdc2cc49ef0a5d92e0ac Mon Sep 17 00:00:00 2001 From: telgindy Date: Wed, 7 Nov 2018 14:53:24 -0700 Subject: [PATCH 08/25] Adding extra transformer cases - specifically delta-wye single phase (not feasible) --- .../opendss/Transformers/test_transformer_kv.dss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.dss b/tests/readers/opendss/Transformers/test_transformer_kv.dss index 909cb9b9..db49459a 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.dss +++ b/tests/readers/opendss/Transformers/test_transformer_kv.dss @@ -65,6 +65,16 @@ New Transformer.B4551-1A phases=1 wdg=1 bus=B4551.1 kv=7.2 kVA=15 wdg=2 bus=X_B4 ! Three phase Wye-Wye Transformer from Epri J-1 Feeder New Transformer.5865228330A-1ABC phases=3 wdg=1 bus=5865228330A.1.2.3 kv=12.47 kVA=2000 wdg=2 bus=X_5865228330A kv=0.416 kVA=2000 %loadloss=0.7 %noloadloss=0.05 XHL=5 normhkva=2000.01 emerghkva=2800 +! Single phase delta-wye transformer. This is a dummy test as we don't expect to see delta configurations on a single phase +new transformer.t1 phases=1 xhl=6 +~ wdg=1 bus=n2.3 conn=delta kV=12.47 kVA=6000 %r=0.5 +~ wdg=2 bus=n3.1.2 conn=wye kV=4.16 kVA=6000 %r=0.5 + +! Single phase wye-delta transformer. This is a dummy test as we don't expect to see delta configurations on a single phase +new transformer.t1 phases=1 xhl=6 +~ wdg=1 bus=n2.3 conn=wye kV=12.47 kVA=6000 %r=0.5 +~ wdg=2 bus=n3.1.2 conn=delta kV=4.16 kVA=6000 %r=0.5 + Set Voltagebases=[115, 12.7, 7.2, 4.16, 4.0, 0.48, 0.416, 0.12] Calcvoltagebases From 672dd4631622669e06498fc806c0eac9ad205969 Mon Sep 17 00:00:00 2001 From: telgindy Date: Wed, 7 Nov 2018 17:30:37 -0700 Subject: [PATCH 09/25] added new regulators from SMART-DS and other IEEE systems. Now includes three single phase regulators and one three phase regulator --- .../opendss/Regulators/test_regulators.dss | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index e4039b5a..fd52cf56 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -2,7 +2,7 @@ Clear New circuit.test_regulators basekv=115 pu=1.01 bus1=sourcebus -! Regulator No. 1 +! Regulator No. 1 from IEEE 8500 test case New Transformer.VREG2_A phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.1, 190-8593.1) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 New Transformer.VREG2_B phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.2, 190-8593.2) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 @@ -12,9 +12,32 @@ New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band= New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 -! Regulator No. 2 +! Regulator No. 2 from IEEE 8500 test case New Transformer.regxfmr_B18865 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 enabled=True New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 +! Substation regulator from SMART-DS P4U region +New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=69.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_12 wdg=2 conn=wye Kv=4.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_13 XHL=0.9616652224137047 +New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 maxtapchange=10 ptratio=19.0 band=1.9919999999999998 vreg = 123.60000000000001 + +! Rural regulator from SMART-DS rural region +New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (124700,124700) kvas=(10000,10000) +New RegControl.reg_creguladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6 + + +! Regulator from IEEE 13 node feeder + +New Transformer.Reg1 phases=1 XHL=0.01 kVAs=[1666 1666] +~ Buses=[650.1 RG60.1] kVs=[2.4 2.4] %LoadLoss=0.01 +new regcontrol.Reg1 transformer=Reg1 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 + +New Transformer.Reg2 phases=1 XHL=0.01 kVAs=[1666 1666] +~ Buses=[650.2 RG60.2] kVs=[2.4 2.4] %LoadLoss=0.01 +new regcontrol.Reg2 transformer=Reg2 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 + +New Transformer.Reg3 phases=1 XHL=0.01 kVAs=[1666 1666] +~ Buses=[650.3 RG60.3] kVs=[2.4 2.4] %LoadLoss=0.01 +new regcontrol.Reg3 transformer=Reg3 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 + From 585bd896e260d80eac97df04d51314c7132e932d Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Thu, 15 Nov 2018 16:05:43 -0700 Subject: [PATCH 10/25] Add more test cases --- docs/read.md | 228 +-- .../test_capacitor_connectivity.dss | 28 +- .../Capacitors/test_capacitor_connectivity.py | 378 +++++ .../opendss/Lines/test_concentricneutral.dss | 3 + .../opendss/Lines/test_line_connectivity.py | 2 +- tests/readers/opendss/Lines/test_linecodes.py | 856 +++++++++++ .../opendss/Lines/test_linegeometries.dss | 15 +- .../opendss/Lines/test_linegeometries.py | 25 + tests/readers/opendss/Lines/test_wiredata.dss | 3 + tests/readers/opendss/Loads/test_loads.py | 124 ++ tests/readers/opendss/Nodes/test_nodes.dss | 5 + tests/readers/opendss/Nodes/test_nodes.py | 0 .../opendss/Powersource/test_powersource.dss | 5 + .../opendss/Powersource/test_powersource.py | 46 + .../opendss/Powersource/test_powersource.py~ | 46 + .../opendss/Regulators/test_regulators.py | 804 +++++++++++ .../Transformers/test_transformer_kv.dss | 14 +- .../Transformers/test_transformer_kv.py | 1281 ++++++++++++++++- 18 files changed, 3756 insertions(+), 107 deletions(-) create mode 100644 tests/readers/opendss/Lines/test_concentricneutral.dss create mode 100644 tests/readers/opendss/Lines/test_linecodes.py create mode 100644 tests/readers/opendss/Lines/test_wiredata.dss create mode 100644 tests/readers/opendss/Loads/test_loads.py create mode 100644 tests/readers/opendss/Nodes/test_nodes.dss create mode 100644 tests/readers/opendss/Nodes/test_nodes.py create mode 100644 tests/readers/opendss/Powersource/test_powersource.dss create mode 100644 tests/readers/opendss/Powersource/test_powersource.py create mode 100644 tests/readers/opendss/Powersource/test_powersource.py~ create mode 100644 tests/readers/opendss/Regulators/test_regulators.py diff --git a/docs/read.md b/docs/read.md index 31fe0815..d9cbf2db 100644 --- a/docs/read.md +++ b/docs/read.md @@ -5,26 +5,26 @@ | :------------------:|:-------:| | name | yes | | nominal_voltage | yes | -| line_type | no | +| line_type | yes | | length | yes | | from_element | yes | | to_element | yes | -| is_fuse | no | -| is_switch | no | -| is_banked | no | -| faultrate | no | +| is_fuse | no | # Tarek needs to send this +| is_switch | no | # Tarek needs to send this +| is_banked | no | # Not now +| faultrate | no | # Tarek needs to send this | wires | yes | -| positions | no | +| positions | no | # Not now | impedance_matrix | yes | -| capacitance_matrix | yes | -| substation_name | no | -| feeder_name | yes | -| is_recloser | no | -| is_breaker | no | -| is_sectionalizer | no | +| capacitance_matrix | yes | # Tarek needs to send this +| substation_name | no | # Not implemented +| feeder_name | yes | # Document it +| is_recloser | no | # Document it that its in the name +| is_breaker | no |# Document it that its in the name +| is_sectionalizer | no | # Not now | nameclass | yes | -| is_substation | no | -| is_network_protector| no | +| is_substation | no | # Not now +| is_network_protector| no | # Not now ## Wire @@ -40,29 +40,29 @@ | ampacity | yes | | emergency_ampacity | yes | | resistance | yes | -| insulation_thickness| no | -| is_fuse | no | -| is_switch | no | +| insulation_thickness| no |# Needs to be implemented +| is_fuse | no | # needs to be deprecated +| is_switch | no | # needs to be deprecated | is_open | no | -| interrupting_rating | no | -| concentric_neutral_gmr | no | -| concentric_neutral_resistance | no | -| concentric_neutral_diameter | no | -| concentric_outside_diameter | no | -| concentric_neutral_nstrand | no | -| drop | no | -| is_recloser | no | -| is_breaker | no | -| is_network_protector| no | -| is_sectionalizer | no | +| interrupting_rating | no | # Not for now +| concentric_neutral_gmr | no | # Needs to be implemented +| concentric_neutral_resistance | no | # Needs to be implemented +| concentric_neutral_diameter | no | # Needs to be implemented +| concentric_outside_diameter | no | # Needs to be implemented +| concentric_neutral_nstrand | no | # Needs to be implemented +| drop | no | # doesn't need testing, possible deprecation +| is_recloser | no |# needs to be deprecated +| is_breaker | no |# needs to be deprecated +| is_network_protector| no | # doesn't need testing, needs to be deprecated +| is_sectionalizer | no |# needs to be deprecated ## Capacitor | Attribute | Tested | | :------------------:|:-------:| | nominal_voltage | yes | | connection_type | yes | -| delay | no | -| mode | no | +| delay | yes | +| mode | yes | | low | no | | high | no | | resistance | no | @@ -73,14 +73,14 @@ | susceptance0 | no | | conductance | no | | conductance0 | no | -| pt_ratio | no | +| pt_ratio | yes | | ct_ratio | no | -| pt_phase | no | +| pt_phase | yes | | connecting_element | no | | positions | no | -| measuring_element | no | +| measuring_element | yes | | substation_name | no | -| feeder_name | no | +| feeder_name | yes | | is_substation | no | ## Phase Capacitor @@ -96,114 +96,150 @@ | Attribute | Tested | | :------------------:|:-------:| | name | no | -| install_type | no | -| noload_loss | no | -| phase_shift | no | +| install_type | no | #not needed +| noload_loss | yes | +| phase_shift | no | # Tarek to check if this exists in opendss and set it | from_element | yes | | to_element | yes | | reactances | yes | | windings | yes | -| positions | no | -| loadloss | no | -| normhkva | no | -| is_center_tap | no | -| is_substation | no | -| substation_name | no | -| feeder_name | yes | +| positions | no | # Not needed +| loadloss | yes | +| normhkva | yes | +| is_center_tap | yes | +| is_substation | no | # Not needed +| substation_name | no | # Not needed +| feeder_name | yes | # mention that the feeder name is set from the circuit rather than the feeder ## Winding | Attribute | Tested | | :------------------:|:-------:| | connection_type | yes | -| voltage_type | no | +| voltage_type | no | # Needs to be implemented , raise issue | nominal_voltage | yes | -| voltage_limit | no | +| voltage_limit | no | # Tarek to create a test case with a voltage regulator included, raise issue | resistance | yes | -| reverse_resistance | no | +| reverse_resistance | no | # Needs to be implemented , raise issue | phase_windings | yes | | rated_power | yes | -| emergency_power | no | +| emergency_power | yes | ## Phase Winding | Attribute | Tested | | :------------------:|:-------:| -| tap_position | no | +| tap_position | no | # Tarek looks into this | phase | yes | -| compensator_r | no | -| compensator_x | no | +| compensator_r | yes | +| compensator_x | yes | ## Regulator | Attribute | Tested | | :------------------:|:-------:| | name | no | | delay | yes | -| highstep | no | -| lowstep | no | +| highstep | yes | +| lowstep | no | # needs to be implemented ( equal to highstep), raise an issue | pt_ratio | yes | -| ct_ratio | no | -| phase_shift | no | -| ltc | no | +| ct_ratio | no | # Tarek to look at this +| phase_shift | no | # Tarek to check if this exists in opendss and set it +| ltc | no | # not implemented | bandwidth | yes | | bandcenter | yes | -| voltage_limit | no | +| voltage_limit | no | # Tarek to create a test case with a voltage regulator included, raise issue | from_element | yes | | to_element | yes | |connected_transformer| yes | -| pt_phase | no | +| pt_phase | no | # Bhavya needs to add | reactances | yes | -| windings | no | -| positions | no | -| winding | yes | -| ct_prim | no | -| noload_loss | no | -| substation_name | no | +| windings | no | # Deprecate but a big api change +| positions | no | # Not now +| winding | yes | # Change name to pt_winding, check all the readers and writers +| ct_prim | no | # Tarek to set for an example +| noload_loss | no |# Deprecate along with windings but a big api change +| substation_name | no |# Not needed | feeder_name | yes | -| setpoint | no | -| is_substation | no | +| setpoint | no | #Needs to be implemented, Raise an issue, read it from vreg +| is_substation | no |# Not needed ## Load | Attribute | Tested | | :------------------:|:-------:| | name | no | -| connection_type | no | +| connection_type | no | # Tarek to create an example | nominal_voltage | yes | | vmin | yes | | vmax | yes | | phase_loads | yes | -| positions | no | -| timeseries | no | +| positions | no | # Not now +| timeseries | no | # Test later | connecting_element | yes | -| rooftop_area | no | -| peak_p | no | -| peak_q | no | -| peak_coincident_p | no | -| peak_coincident_q | no | -| yearly_energy | no | -| num_levels | no | -| num_users | no | -| substation_name | no | +| rooftop_area | no | # Not implemented +| peak_p | no | # Deprecate +| peak_q | no | # Deprecate +| peak_coincident_p | no | # Might Replace with peak coincident factor +| peak_coincident_q | no | # Might Replace with peak coincident factor +| yearly_energy | no | # Not implemented +| num_levels | no |# Not implemented +| num_users | no |# Not implemented +| substation_name | no |# not needed | feeder_name | yes | -| upstream_transformer_name | no | -| transformer_connected_kva | no | -| is_substation | no | -| is_center_tap | no | -| center_tap_perct_1_N| no | -| center_tap_perct_N_2| no | -| center_tap_perct_1_2| no | +| upstream_transformer_name | no | # Not implemented +| transformer_connected_kva | no | # Not implemented +| is_substation | no |# Not implemented +| is_center_tap | no |# Not implemented +| center_tap_perct_N_2| no |# Not implemented +| center_tap_perct_1_N| no |# Not implemented +| center_tap_perct_1_2| no |# Not implemented ## PhaseLoad | Attribute | Tested | | :------------------:|:-------:| -| phase | no | -| p | no | -| q | no | -| model | no | -| use_zip | no | +| phase | no | # Bhavya to check this +| p | yes | +| q | yes | +| model | yes | +| use_zip | yes | | drop | no | -| ppercentcurrent | no | -| qpercentcurrent | no | -| ppercentpower | no | -| qpercentpower | no | -| ppercentimpedance | no | -| qpercentimpedance | no | +| ppercentcurrent | yes | +| qpercentcurrent | yes | +| ppercentpower | yes | +| qpercentpower | yes | +| ppercentimpedance | yes | +| qpercentimpedance | yes | + +## PowerSource +| Attribute | Tested | +| :------------------:|:-------:| +| name | no | +| nominal_voltage | no | +| per_unit | no | +| phases | no | +| positions | no | +| is_sourcebus | no | +| rated_power | no | +| emergency_power | no | +| connection_type | no | +| cutout_percent | no | +| cutin_percent | no | +| resistance | no | +| reactance | no | +| v_max_pu | no | +| v_min_pu | no | +| power_factor | no | +| connecting_element | no | +| phase_angle | no | +| positive_sequence_impedance | no | +| zero_sequence_impedance | no | + +## Nodes +| Attribute | Tested | +| :------------------:|:-------:| +| name | no | +| nominal_voltage | no | +| phases | no | +| positions | no | +| substation_name | no | +| feeder_name | no | +| is_substation | no | +| is_substation_connection | no | diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index e564a398..2c30b5eb 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss @@ -14,6 +14,32 @@ New Capacitor.Cap3 Bus1=bus3.1 phases=1 kVAR=200.37 kV=2.4 ! Capacitor Cap4 should be a two phase capacitor (2 PhaseCapacitor objects) connected to bus4 on phase A and C New Capacitor.Cap4 Bus1=bus4.1.3 phases=2 kVAR=400 kV=2.4 +! Capacitors from epri_j1 +New Line.OH_B4904 bus1=B4909.1.2.3 bus2=B4904.1.2.3 length=161.84879 units=m linecode=OH-3X_477AAC_4/0AAACN phases=3 enabled=True +New Line.OH_B18944 bus1=B18941.1.2.3 bus2=B18944.1.2.3 length=141.1224 units=m linecode=OH-3X_4CU_4CUN phases=3 enabled=True +New Linecode.OH-3X_477AAC_4/0AAACN nphases=3 r1=0.12241009 x1=0.39494091 r0=0.33466485 x0=1.2742766 c1=11.1973 c0=4.8089 units=km baseFreq=60 normamps=732 emergamps=871 +New Linecode.OH-3X_4CU_4CUN nphases=3 r1=0.85376372 x1=0.49484991 r0=1.2302027 x0=1.5569817 c1=8.7903 c0=4.2476 units=km baseFreq=60 normamps=142 emergamps=142 + +New Capacitor.B4909-1 bus=B4909 kV=12.47 kvar=900 conn=wye +New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 +~ type=volt ON=120.5 OFF=125 PTphase=2 PTratio=60 + +New Capacitor.B18944-1 bus=B18941 kV=12.47 kvar=1200 conn=wye +New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 +~ type=volt ON=118 OFF=124 PTphase=1 PTratio=60 + +! Capacitors from ieee 8500-node test feeder +New Capacitor.CAPBank0A Bus1=R42246.1 kv=7.2 kvar=400 phases=1 conn=wye +New Capacitor.CAPBank0B Bus1=R42246.2 kv=7.2 kvar=400 phases=1 conn=wye +New Capacitor.CAPBank0C Bus1=R42246.3 kv=7.2 kvar=400 phases=1 conn=wye + +! This is a 3-phase capacitor bank +New Capacitor.CAPBank3 Bus1=R18242 kv=12.47112 kvar=900 conn=wye + +! 3-phase capacitor with number of phases mentioned +New Capacitor.CAPBank3-1 Bus1=R18242 kv=12.47112 kvar=900 conn=wye phases=3 + + Set Voltagebases=[4.16, 2.4] Calcvoltagebases -Solve \ No newline at end of file +Solve diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py index af8a0e31..ca26af38 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py @@ -75,3 +75,381 @@ def test_capacitor_connectivity(): assert sum( [phase_capacitor.var for phase_capacitor in m["cap4"].phase_capacitors] ) == pytest.approx(400 * 10 ** 3, 0.0001) + + # Capacitors from epri_j1 + assert len(m["b4909-1"].phase_capacitors) == 3 # b4909-1 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["b4909-1"].phase_capacitors] + ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["b4909-1"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["b4909-1"].connection_type == "Y" + assert m["b4909-1"].delay == 30 + assert m["b4909-1"].mode == "voltage" + # assert m["b4909-1"].low is None # 115.0 + # assert m["b4909-1"].high is None # 126.0 + # assert m["b4909-1"].resistance is None # 0.0 + assert m["b4909-1"].resistance0 is None + # assert m["b4909-1"].reactance is None # 0.0 + assert m["b4909-1"].reactance0 is None + assert m["b4909-1"].susceptance is None + assert m["b4909-1"].susceptance0 is None + assert m["b4909-1"].conductance is None + assert m["b4909-1"].conductance0 is None + assert m["b4909-1"].pt_ratio == 60 + # assert m["b4909-1"].ct_ratio is None # 60 + assert m["b4909-1"].pt_phase == "B" + assert m["b4909-1"].connecting_element == "b4909" + # assert m["b4909-1"].positions is None # [] + assert m["b4909-1"].measuring_element == "Line.OH_B4904" + # assert m["b4909-1"].substation_name is None # '' + assert m["b4909-1"].feeder_name == "sourcebus_src" + assert m["b4909-1"].is_substation == 0 + + assert set([pc.phase for pc in m["b4909-1"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["b4909-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["b4909-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["b4909-1"].phase_capacitors + ] == [None, None, None] + # oh_b4904 + # assert len(m["oh_b4904"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["oh_b4904"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert ( + m["oh_b4904"].nameclass == "OH-3X_477AAC_4/0AAACN" + ) # Linecode is OH-3X_477AAC_4/0AAACN + assert m["oh_b4904"].line_type == "overhead" # OH in lincecode + assert m["oh_b4904"].from_element == "b4909" + assert m["oh_b4904"].to_element == "b4904" + assert m["oh_b4904"].length == pytest.approx(161.84879) + assert m["oh_b4904"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["oh_b4904"].is_fuse is None + assert m["oh_b4904"].is_switch is None + assert m["oh_b4904"].is_banked is None + assert m["oh_b4904"].faultrate == 0.1 + # assert m["oh_b4904"].positions is None # [] + # assert m["oh_b4904"].impedance_matrix == None # Fill in later # [[(0.09813333+0.2153j), (0.04013333+0.0947j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.09813333+0.2153j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.04013333+0.0947j), (0.09813333+0.2153j)]] + # assert m["oh_b4904"].capacitance_matrix == None # [[(2.8+0j), (-0.6+0j), (-0.6+0j)], [(-0.6+0j), (2.8+0j), (-0.6+0j)], [(-0.6+0j), (-0.6+0j), (2.8+0j)]] + assert m["oh_b4904"].substation_name is None + assert m["oh_b4904"].feeder_name == "sourcebus_src" + assert m["oh_b4904"].is_recloser is None + assert m["oh_b4904"].is_breaker is None + assert m["oh_b4904"].is_sectionalizer is None + assert m["oh_b4904"].is_substation == 0 + assert m["oh_b4904"].is_network_protector is None + + for w in m["oh_b4904"].wires: + assert w.nameclass == "4/0AAACN" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity == float(732) # 400.0 + # assert w.emergency_ampacity == float(871) # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + assert ( + len(m["b18944-1"].phase_capacitors) == 3 + ) # b18944-1 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["b18944-1"].phase_capacitors] + ) == pytest.approx(1200 * 10 ** 3, 0.0001) + assert m["b18944-1"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["b18944-1"].connection_type == "Y" + assert m["b18944-1"].delay == 31 + assert m["b18944-1"].mode == "voltage" + # assert m["b18944-1"].low is None # 115.0 + # assert m["b18944-1"].high is None # 126.0 + # assert m["b18944-1"].resistance is None # 0.0 + assert m["b18944-1"].resistance0 is None + # assert m["b18944-1"].reactance is None # 0.0 + assert m["b18944-1"].reactance0 is None + assert m["b18944-1"].susceptance is None + assert m["b18944-1"].susceptance0 is None + assert m["b18944-1"].conductance is None + assert m["b18944-1"].conductance0 is None + assert m["b18944-1"].pt_ratio == 60 + # assert m["b18944-1"].ct_ratio is None # 60.0 + # assert m["b18944-1"].pt_phase == "B" # A + assert m["b18944-1"].connecting_element == "b18941" + # assert m["b18944-1"].positions is None # [] + assert m["b18944-1"].measuring_element == "Line.OH_B18944" + # assert m["b18944-1"].substation_name is None # '' + assert m["b18944-1"].feeder_name == "sourcebus_src" + assert m["b18944-1"].is_substation == 0 + + assert set([pc.phase for pc in m["b18944-1"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["b18944-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["b18944-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["b18944-1"].phase_capacitors + ] == [None, None, None] + # oh_b18944 + # assert len(m["oh_b18944"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["oh_b18944"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["oh_b18944"].nameclass == "OH-3X_4CU_4CUN" # Linecode is OH-3X_4CU_4CUN + assert m["oh_b18944"].line_type == "overhead" # OH in lincecode + assert m["oh_b18944"].from_element == "b18941" + assert m["oh_b18944"].to_element == "b18944" + assert m["oh_b18944"].length == pytest.approx(141.1224) + assert m["oh_b18944"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["oh_b18944"].is_fuse is None + assert m["oh_b18944"].is_switch is None + assert m["oh_b18944"].is_banked is None + assert m["oh_b18944"].faultrate == 0.1 + # assert m["oh_b18944"].positions is None # [] + # assert m["oh_b18944"].impedance_matrix == None # Fill in later # [[(0.09813333+0.2153j), (0.04013333+0.0947j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.09813333+0.2153j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.04013333+0.0947j), (0.09813333+0.2153j)]] + # assert m["oh_b18944"].capacitance_matrix == None # [[(2.8+0j), (-0.6+0j), (-0.6+0j)], [(-0.6+0j), (2.8+0j), (-0.6+0j)], [(-0.6+0j), (-0.6+0j), (2.8+0j)]] + assert m["oh_b18944"].substation_name is None + assert m["oh_b18944"].feeder_name == "sourcebus_src" + assert m["oh_b18944"].is_recloser is None + assert m["oh_b18944"].is_breaker is None + assert m["oh_b18944"].is_sectionalizer is None + assert m["oh_b18944"].is_substation == 0 + assert m["oh_b18944"].is_network_protector is None + + for w in m["oh_b18944"].wires: + assert w.nameclass == "4CUN" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(142) # 400.0 + # assert w.emergency_ampacity == float(142) # 600.0 + # assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Capacitors from ieee 8500-node test feeder + + assert ( + len(m["capbank0a"].phase_capacitors) == 1 + ) # capbank0a is a single phase capacitor + assert m["capbank0a"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0a"].nominal_voltage == float(7.2) * 10 ** 3 + assert m["capbank0a"].connection_type == "Y" + assert m["capbank0a"].delay == None + assert m["capbank0a"].mode == None + assert m["capbank0a"].low is None + assert m["capbank0a"].high is None + # assert m["capbank0a"].resistance is None # 0.0 + assert m["capbank0a"].resistance0 is None + # assert m["capbank0a"].reactance is None # 0.0 + assert m["capbank0a"].reactance0 is None + assert m["capbank0a"].susceptance is None + assert m["capbank0a"].susceptance0 is None + assert m["capbank0a"].conductance is None + assert m["capbank0a"].conductance0 is None + assert m["capbank0a"].pt_ratio == None + assert m["capbank0a"].ct_ratio is None + assert m["capbank0a"].pt_phase == None + assert m["capbank0a"].connecting_element == "r42246" + # assert m["capbank0a"].positions is None # [] + assert m["capbank0a"].measuring_element == None + # assert m["capbank0a"].substation_name is None # '' + assert m["capbank0a"].feeder_name == "sourcebus_src" + assert m["capbank0a"].is_substation == 0 + + assert m["capbank0a"].phase_capacitors[0].phase == "A" + assert m["capbank0a"].phase_capacitors[0].switch == None + assert m["capbank0a"].phase_capacitors[0].sections == None + assert m["capbank0a"].phase_capacitors[0].normalsections == None + + assert ( + len(m["capbank0b"].phase_capacitors) == 1 + ) # capbank0b is a single phase capacitor + assert m["capbank0b"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0b"].nominal_voltage == float(7.2) * 10 ** 3 + assert m["capbank0b"].connection_type == "Y" + assert m["capbank0b"].delay == None + assert m["capbank0b"].mode == None + assert m["capbank0b"].low is None + assert m["capbank0b"].high is None + # assert m["capbank0b"].resistance is None # 0.0 + assert m["capbank0b"].resistance0 is None + # assert m["capbank0b"].reactance is None # 0.0 + assert m["capbank0b"].reactance0 is None + assert m["capbank0b"].susceptance is None + assert m["capbank0b"].susceptance0 is None + assert m["capbank0b"].conductance is None + assert m["capbank0b"].conductance0 is None + assert m["capbank0b"].pt_ratio == None + assert m["capbank0b"].ct_ratio is None + assert m["capbank0b"].pt_phase == None + assert m["capbank0b"].connecting_element == "r42246" + # assert m["capbank0b"].positions is None # [] + assert m["capbank0b"].measuring_element == None + # assert m["capbank0b"].substation_name is None # '' + assert m["capbank0b"].feeder_name == "sourcebus_src" + assert m["capbank0b"].is_substation == 0 + + assert m["capbank0b"].phase_capacitors[0].phase == "B" + assert m["capbank0b"].phase_capacitors[0].switch == None + assert m["capbank0b"].phase_capacitors[0].sections == None + assert m["capbank0b"].phase_capacitors[0].normalsections == None + + assert ( + len(m["capbank0c"].phase_capacitors) == 1 + ) # capbank0c is a single phase capacitor + assert m["capbank0c"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0c"].nominal_voltage == float(7.2) * 10 ** 3 + assert m["capbank0c"].connection_type == "Y" + assert m["capbank0c"].delay == None + assert m["capbank0c"].mode == None + assert m["capbank0c"].low is None + assert m["capbank0c"].high is None + # assert m["capbank0c"].resistance is None # 0.0 + assert m["capbank0c"].resistance0 is None + # assert m["capbank0c"].reactance is None # 0.0 + assert m["capbank0c"].reactance0 is None + assert m["capbank0c"].susceptance is None + assert m["capbank0c"].susceptance0 is None + assert m["capbank0c"].conductance is None + assert m["capbank0c"].conductance0 is None + assert m["capbank0c"].pt_ratio == None + assert m["capbank0c"].ct_ratio is None + assert m["capbank0c"].pt_phase == None + assert m["capbank0c"].connecting_element == "r42246" + # assert m["capbank0c"].positions is None # [] + assert m["capbank0c"].measuring_element == None + # assert m["capbank0c"].substation_name is None # '' + assert m["capbank0c"].feeder_name == "sourcebus_src" + assert m["capbank0c"].is_substation == 0 + + assert m["capbank0c"].phase_capacitors[0].phase == "C" + assert m["capbank0c"].phase_capacitors[0].switch == None + assert m["capbank0c"].phase_capacitors[0].sections == None + assert m["capbank0c"].phase_capacitors[0].normalsections == None + + # This is a 3-phase capacitor bank + assert ( + len(m["capbank3"].phase_capacitors) == 3 + ) # capbank3 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["capbank3"].phase_capacitors] + ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["capbank3"].nominal_voltage == float(12.47112) * 10 ** 3 + assert m["capbank3"].connection_type == "Y" + assert m["capbank3"].delay == None + assert m["capbank3"].mode == None + assert m["capbank3"].low is None + assert m["capbank3"].high is None + # assert m["capbank3"].resistance is None # 0.0 + assert m["capbank3"].resistance0 is None + # assert m["capbank3"].reactance is None # 0.0 + assert m["capbank3"].reactance0 is None + assert m["capbank3"].susceptance is None + assert m["capbank3"].susceptance0 is None + assert m["capbank3"].conductance is None + assert m["capbank3"].conductance0 is None + assert m["capbank3"].pt_ratio == None + assert m["capbank3"].ct_ratio is None + assert m["capbank3"].pt_phase == None + assert m["capbank3"].connecting_element == "r18242" + # assert m["capbank3"].positions is None # [] + assert m["capbank3"].measuring_element == None + # assert m["capbank3"].substation_name is None # '' + assert m["capbank3"].feeder_name == "sourcebus_src" + assert m["capbank3"].is_substation == 0 + + assert set([pc.phase for pc in m["capbank3"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["capbank3"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["capbank3"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["capbank3"].phase_capacitors + ] == [None, None, None] + + # 3-phase capacitor with number of phases mentioned + assert ( + len(m["capbank3-1"].phase_capacitors) == 3 + ) # capbank3-1 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["capbank3-1"].phase_capacitors] + ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["capbank3-1"].nominal_voltage == float(12.47112) * 10 ** 3 + assert m["capbank3-1"].connection_type == "Y" + assert m["capbank3-1"].delay == None + assert m["capbank3-1"].mode == None + assert m["capbank3-1"].low is None + assert m["capbank3-1"].high is None + # assert m["capbank3-1"].resistance is None # 0.0 + assert m["capbank3-1"].resistance0 is None + # assert m["capbank3-1"].reactance is None # 0.0 + assert m["capbank3-1"].reactance0 is None + assert m["capbank3-1"].susceptance is None + assert m["capbank3-1"].susceptance0 is None + assert m["capbank3-1"].conductance is None + assert m["capbank3-1"].conductance0 is None + assert m["capbank3-1"].pt_ratio == None + assert m["capbank3-1"].ct_ratio is None + assert m["capbank3-1"].pt_phase == None + assert m["capbank3-1"].connecting_element == "r18242" + # assert m["capbank3-1"].positions is None # [] + assert m["capbank3-1"].measuring_element == None + # assert m["capbank3-1"].substation_name is None # '' + assert m["capbank3-1"].feeder_name == "sourcebus_src" + assert m["capbank3-1"].is_substation == 0 + + assert set([pc.phase for pc in m["capbank3-1"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["capbank3-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["capbank3-1"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["capbank3-1"].phase_capacitors + ] == [None, None, None] diff --git a/tests/readers/opendss/Lines/test_concentricneutral.dss b/tests/readers/opendss/Lines/test_concentricneutral.dss new file mode 100644 index 00000000..1c110c53 --- /dev/null +++ b/tests/readers/opendss/Lines/test_concentricneutral.dss @@ -0,0 +1,3 @@ +New CNDATA.250_1/3 k=13 DiaStrand=0.064 Rstrand=2.816666667 epsR=2.3 +~ InsLayer=0.220 DiaIns=1.06 DiaCable=1.16 Rac=0.076705 GMRac=0.20568 diam=0.573 +~ Runits=kft Radunits=in GMRunits=in diff --git a/tests/readers/opendss/Lines/test_line_connectivity.py b/tests/readers/opendss/Lines/test_line_connectivity.py index 8d3c964b..012fa14e 100644 --- a/tests/readers/opendss/Lines/test_line_connectivity.py +++ b/tests/readers/opendss/Lines/test_line_connectivity.py @@ -24,7 +24,7 @@ def test_line_connectivity(): from ditto.store import Store from ditto.readers.opendss.read import Reader - # test on the test_line_length.dss + # test on the test_line_connectivity.dss m = Store() r = Reader( master_file=os.path.join(current_directory, "test_line_connectivity.dss") diff --git a/tests/readers/opendss/Lines/test_linecodes.py b/tests/readers/opendss/Lines/test_linecodes.py new file mode 100644 index 00000000..5d110ff6 --- /dev/null +++ b/tests/readers/opendss/Lines/test_linecodes.py @@ -0,0 +1,856 @@ +# -*- coding: utf-8 -*- + +""" +test_linecodes.py +---------------------------------- + +Tests for checking the line codes +""" +import logging +import os + +import six + +import tempfile +import pytest as pt + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_linecodes(): + """Tests if linecodes are read correctly.""" + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_linecodes.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_linecodes.dss")) + r.parse(m) + m.set_names() + + # Line 1 + # assert len(m["line1"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line1"].nameclass == "3-1/0C_2/0CN_T" # Linecode is 3-1/0C_2/0CN_T + assert m["line1"].line_type == "underground" # OH not in linecode + assert m["line1"].from_element == "bus1" + assert m["line1"].to_element == "bus2" + assert m["line1"].length == 10 + assert m["line1"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line1"].is_fuse is None + assert m["line1"].is_switch is None + assert m["line1"].is_banked is None + assert m["line1"].faultrate == 0.1 + # assert m["line1"].positions is None # [] + assert m["line1"].impedance_matrix == None # Fill in later + assert m["line1"].capacitance_matrix == [ + [(0.008448926 + 0j), (-0.001981957 + 0j), (-0.001981957 + 0j)], + [(-0.001981957 + 0j), (0.008448926 + 0j), (-0.001981957 + 0j)], + [(-0.001981957 + 0j), (-0.001981957 + 0j), (0.008448926 + 0j)], + ] + assert m["line1"].substation_name is None + assert m["line1"].feeder_name == "sourcebus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + assert m["line1"].is_sectionalizer is None + assert m["line1"].is_substation == 0 + assert m["line1"].is_network_protector is None + + for w in m["line1"].wires: + assert w.nameclass == "T" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(310) + assert w.emergency_ampacity == float(310) + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 2 + # assert len(m["line2"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line2"].nameclass == "1P_#8CU_#8N" # Linecode is 1P_#8CU_#8N + assert m["line2"].line_type == "underground" # OH not in linecode + assert m["line2"].from_element == "bus2" + assert m["line2"].to_element == "bus3" + assert m["line2"].length == 10 + assert m["line2"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line2"].is_fuse is None + assert m["line2"].is_switch is None + assert m["line2"].is_banked is None + assert m["line2"].faultrate == 0.1 + # assert m["line2"].positions is None # [] + # assert m["line2"].impedance_matrix == None # Fill in later + # assert m["line2"].capacitance_matrix == [[(0.008448926+0j), (-0.001981957+0j), (-0.001981957+0j)], [(-0.001981957+0j), (0.008448926+0j), (-0.001981957+0j)], [(-0.001981957+0j), (-0.001981957+0j), (0.008448926+0j)]] # Fill in later + assert m["line2"].substation_name is None + assert m["line2"].feeder_name == "sourcebus_src" + assert m["line2"].is_recloser is None + assert m["line2"].is_breaker is None + assert m["line2"].is_sectionalizer is None + assert m["line2"].is_substation == 0 + assert m["line2"].is_network_protector is None + + for w in m["line2"].wires: + assert w.nameclass == "#8N" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(1) + assert w.emergency_ampacity == float(1) + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 3 + # assert len(m["line3"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line3"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert ( + m["line3"].nameclass == "3P_3#500_AL_EPR_CD" + ) # Linecode is 3P_3#500_AL_EPR_CD + assert m["line3"].line_type == "underground" # OH not in linecode + assert m["line3"].from_element == "bus2" + assert m["line3"].to_element == "bus4" + assert m["line3"].length == 10 + assert m["line3"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line3"].is_fuse is None + assert m["line3"].is_switch is None + assert m["line3"].is_banked is None + assert m["line3"].faultrate == 0.1 + # assert m["line3"].positions is None # [] + # assert m["line3"].impedance_matrix == None # Fill in later + # assert m["line3"].capacitance_matrix == [[(0.008448926+0j), (-0.001981957+0j), (-0.001981957+0j)], [(-0.001981957+0j), (0.008448926+0j), (-0.001981957+0j)], [(-0.001981957+0j), (-0.001981957+0j), (0.008448926+0j)]] # Fill in later + assert m["line3"].substation_name is None + assert m["line3"].feeder_name == "sourcebus_src" + assert m["line3"].is_recloser is None + assert m["line3"].is_breaker is None + assert m["line3"].is_sectionalizer is None + assert m["line3"].is_substation == 0 + assert m["line3"].is_network_protector is None + + for w in m["line3"].wires: + assert w.nameclass == "AL-EPR-CD" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(1110) + assert w.emergency_ampacity == float(1110) + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 4 + # assert len(m["line4"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line4"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert ( + m["line4"].nameclass == "3ph_h-397_acsr397_acsr397_acsr2/0_acsr" + ) # Linecode is 3ph_h-397_acsr397_acsr397_acsr2/0_acsr + assert m["line4"].line_type == "underground" # OH not in linecode + assert m["line4"].from_element == "bus4" + assert m["line4"].to_element == "bus5" + assert m["line4"].length == 10 + assert m["line4"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line4"].is_fuse is None + assert m["line4"].is_switch is None + assert m["line4"].is_banked is None + # assert m["line4"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line4"].positions is None # [] + actual_impedance_matrix = [ + [ + (0.000270019 + 0.000695974j), + (0.000109951 + 0.00033351j), + (0.000113538 + 0.000308271j), + ], + [ + (0.000109951 + 0.00033351j), + (0.000264634 + 0.000708729j), + (0.000110747 + 0.000350259j), + ], + [ + (0.000113538 + 0.000308271j), + (0.000110747 + 0.000350259j), + (0.000271698 + 0.000692021j), + ], + ] + assert m["line4"].impedance_matrix == actual_impedance_matrix + assert m["line4"].capacitance_matrix == [ + [(0.00913606 + 0j), (-0.00266777 + 0j), (-0.00217646 + 0j)], + [(-0.00266777 + 0j), (0.00962226 + 0j), (-0.00315664 + 0j)], + [(-0.00217646 + 0j), (-0.00315664 + 0j), (0.00943197 + 0j)], + ] + assert m["line4"].substation_name is None + assert m["line4"].feeder_name == "sourcebus_src" + assert m["line4"].is_recloser is None + assert m["line4"].is_breaker is None + assert m["line4"].is_sectionalizer is None + assert m["line4"].is_substation == 0 + assert m["line4"].is_network_protector is None + + for w in m["line4"].wires: + assert w.nameclass == "acsr397-acsr397-acsr2/0-acsr" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 5 + # assert len(m["line5"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line5"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert ( + m["line5"].nameclass == "1ph-2_acsrxx4_acsr" + ) # Linecode is 1ph-2_acsrxx4_acsr + assert m["line5"].line_type == "underground" # OH not in linecode + assert m["line5"].from_element == "bus5" + assert m["line5"].to_element == "bus6" + assert m["line5"].length == 10 + assert m["line5"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line5"].is_fuse is None + assert m["line5"].is_switch is None + assert m["line5"].is_banked is None + # assert m["line5"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line5"].positions is None # [] + actual_impedance_matrix = [[(0.00112339 + 0.000937794j)]] + assert m["line5"].impedance_matrix == actual_impedance_matrix + assert m["line5"].capacitance_matrix == [[(0.00649582 + 0j)]] + assert m["line5"].substation_name is None + assert m["line5"].feeder_name == "sourcebus_src" + assert m["line5"].is_recloser is None + assert m["line5"].is_breaker is None + assert m["line5"].is_sectionalizer is None + assert m["line5"].is_substation == 0 + assert m["line5"].is_network_protector is None + + for w in m["line5"].wires: + assert w.nameclass == "acsr" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 6 + # assert len(m["line6"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line6"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert ( + m["line6"].nameclass == "2ph_h-2_acsrx2_acsr2_acsr" + ) # Linecode is 2ph_h-2_acsrx2_acsr2_acsr + assert m["line6"].line_type == "underground" # OH not in linecode + assert m["line6"].from_element == "bus5" + assert m["line6"].to_element == "bus7" + assert m["line6"].length == 10 + assert m["line6"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line6"].is_fuse is None + assert m["line6"].is_switch is None + assert m["line6"].is_banked is None + # assert m["line6"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line6"].positions is None # [] + actual_impedance_matrix = [ + [(0.00113148 + 0.000884886j), (0.000142066 + 0.000366115j)], + [(0.000142066 + 0.000366115j), (0.00113362 + 0.000882239j)], + ] + assert m["line6"].impedance_matrix == actual_impedance_matrix + assert m["line6"].capacitance_matrix == [ + [(0.00733718 + 0j), (-0.00239809 + 0j)], + [(-0.00239809 + 0j), (0.00733718 + 0j)], + ] + assert m["line6"].substation_name is None + assert m["line6"].feeder_name == "sourcebus_src" + assert m["line6"].is_recloser is None + assert m["line6"].is_breaker is None + assert m["line6"].is_sectionalizer is None + assert m["line6"].is_substation == 0 + assert m["line6"].is_network_protector is None + + for w in m["line6"].wires: + assert w.nameclass == "acsrx2-acsr2-acsr" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 7 + # assert len(m["line7"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line7"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line7"].nameclass == "750_Triplex" # Linecode is 750_Triplex + assert m["line7"].line_type == "underground" # OH not in linecode + assert m["line7"].from_element == "bus5" + assert m["line7"].to_element == "bus8" + assert m["line7"].length == 10 + assert m["line7"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line7"].is_fuse is None + assert m["line7"].is_switch is None + assert m["line7"].is_banked is None + # assert m["line7"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line7"].positions is None # [] + actual_impedance_matrix = [ + [(0.000163213 + 9.128727e-05j), (7.684242e-05 + 2.19643e-05j)], + [(7.684242e-05 + 2.19643e-05j), (0.000163213 + 9.128727e-05j)], + ] # Converted from meters to kft + assert m["line7"].impedance_matrix == actual_impedance_matrix + assert m["line7"].capacitance_matrix == [ + [(0.00984252 + 0j), (-0.007874016 + 0j)], + [(-0.007874016 + 0j), (0.00984252 + 0j)], + ] # Converted from meters to kft + assert m["line7"].substation_name is None + assert m["line7"].feeder_name == "sourcebus_src" + assert m["line7"].is_recloser is None + assert m["line7"].is_breaker is None + assert m["line7"].is_sectionalizer is None + assert m["line7"].is_substation == 0 + assert m["line7"].is_network_protector is None + + for w in m["line7"].wires: + assert w.nameclass == "750_Triplex" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(580) + assert w.emergency_ampacity == float(580 * 1.25) + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 8 + # assert len(m["line8"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line8"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line8"].nameclass == "4/0Triplex" # Linecode is 4/0Triplex + assert m["line8"].line_type == "underground" # OH not in linecode + assert m["line8"].from_element == "bus5" + assert m["line8"].to_element == "bus9" + assert m["line8"].length == 10 + assert m["line8"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line8"].is_fuse is None + assert m["line8"].is_switch is None + assert m["line8"].is_banked is None + # assert m["line8"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line8"].positions is None # [] + actual_impedance_matrix = [ + [(0.001344984 + 0.0005473038j), (0.0003874511 + 0.0004186106j)], + [(0.0003874511 + 0.0004186106j), (0.001344984 + 0.0005473038j)], + ] # Converted from meters to kft + assert m["line8"].impedance_matrix == actual_impedance_matrix + assert m["line8"].capacitance_matrix == [ + [(0.00984252 + 0j), (-0.007874016 + 0j)], + [(-0.007874016 + 0j), (0.00984252 + 0j)], + ] # Converted from meters to kft + assert m["line8"].substation_name is None + assert m["line8"].feeder_name == "sourcebus_src" + assert m["line8"].is_recloser is None + assert m["line8"].is_breaker is None + assert m["line8"].is_sectionalizer is None + assert m["line8"].is_substation == 0 + assert m["line8"].is_network_protector is None + + for w in m["line8"].wires: + assert w.nameclass == "4/0Triplex" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == float(156) + assert w.emergency_ampacity == float(156 * 1.25) + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 9 + # assert len(m["line9"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line9"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line9"].nameclass == "empty" # Linecode is empty + assert m["line9"].line_type == "underground" # OH not in linecode + assert m["line9"].from_element == "bus4" + assert m["line9"].to_element == "bus10" + assert m["line9"].length == 10 + assert m["line9"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line9"].is_fuse is None + assert m["line9"].is_switch is None + assert m["line9"].is_banked is None + # assert m["line9"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line9"].positions is None # [] + assert m["line9"].impedance_matrix == [ + [ + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.47e-05j), + (4.013333e-05 + 9.47e-05j), + ], + [ + (4.013333e-05 + 9.47e-05j), + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.47e-05j), + ], + [ + (4.013333e-05 + 9.47e-05j), + (4.013333e-05 + 9.47e-05j), + (9.813333e-05 + 0.0002153j), + ], + ] + assert m["line9"].capacitance_matrix == [ + [(0.0028 + 0j), (-0.0006 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (0.0028 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (-0.0006 + 0j), (0.0028 + 0j)], + ] + assert m["line9"].substation_name is None + assert m["line9"].feeder_name == "sourcebus_src" + assert m["line9"].is_recloser is None + assert m["line9"].is_breaker is None + assert m["line9"].is_sectionalizer is None + assert m["line9"].is_substation == 0 + assert m["line9"].is_network_protector is None + + for w in m["line9"].wires: + assert w.nameclass == "empty" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 10 + # assert len(m["line10"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line10"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line10"].nameclass == "r1_only" # Linecode is r1_only + assert m["line10"].line_type == "underground" # OH not in linecode + assert m["line10"].from_element == "bus10" + assert m["line10"].to_element == "bus11" + assert m["line10"].length == 10 + assert m["line10"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line10"].is_fuse is None + assert m["line10"].is_switch is None + assert m["line10"].is_banked is None + # assert m["line10"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line10"].positions is None # [] + # assert m["line10"].impedance_matrix == None + # assert m["line10"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line10"].substation_name is None + assert m["line10"].feeder_name == "sourcebus_src" + assert m["line10"].is_recloser is None + assert m["line10"].is_breaker is None + assert m["line10"].is_sectionalizer is None + assert m["line10"].is_substation == 0 + assert m["line10"].is_network_protector is None + + for w in m["line10"].wires: + assert w.nameclass == "r1_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 11 + # assert len(m["line11"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line11"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line11"].nameclass == "r0_only" # Linecode is r0_only + assert m["line11"].line_type == "underground" # OH not in linecode + assert m["line11"].from_element == "bus11" + assert m["line11"].to_element == "bus12" + assert m["line11"].length == 10 + assert m["line11"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line11"].is_fuse is None + assert m["line11"].is_switch is None + assert m["line11"].is_banked is None + # assert m["line11"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line11"].positions is None # [] + # assert m["line11"].impedance_matrix == None + # assert m["line11"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line11"].substation_name is None + assert m["line11"].feeder_name == "sourcebus_src" + assert m["line11"].is_recloser is None + assert m["line11"].is_breaker is None + assert m["line11"].is_sectionalizer is None + assert m["line11"].is_substation == 0 + assert m["line11"].is_network_protector is None + + for w in m["line11"].wires: + assert w.nameclass == "r0_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 12 + # assert len(m["line12"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line12"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line12"].nameclass == "x1_only" # Linecode is x1_only + assert m["line12"].line_type == "underground" # OH not in linecode + assert m["line12"].from_element == "bus12" + assert m["line12"].to_element == "bus13" + assert m["line12"].length == 10 + assert m["line12"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line12"].is_fuse is None + assert m["line12"].is_switch is None + assert m["line12"].is_banked is None + # assert m["line12"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line12"].positions is None # [] + # assert m["line12"].impedance_matrix == None + # assert m["line12"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line12"].substation_name is None + assert m["line12"].feeder_name == "sourcebus_src" + assert m["line12"].is_recloser is None + assert m["line12"].is_breaker is None + assert m["line12"].is_sectionalizer is None + assert m["line12"].is_substation == 0 + assert m["line12"].is_network_protector is None + + for w in m["line12"].wires: + assert w.nameclass == "x1_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 13 + # assert len(m["line13"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line13"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line13"].nameclass == "x0_only" # Linecode is x0_only + assert m["line13"].line_type == "underground" # OH not in linecode + assert m["line13"].from_element == "bus13" + assert m["line13"].to_element == "bus14" + assert m["line13"].length == 10 + assert m["line13"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line13"].is_fuse is None + assert m["line13"].is_switch is None + assert m["line13"].is_banked is None + # assert m["line13"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line13"].positions is None # [] + # assert m["line13"].impedance_matrix == None + # assert m["line13"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line13"].substation_name is None + assert m["line13"].feeder_name == "sourcebus_src" + assert m["line13"].is_recloser is None + assert m["line13"].is_breaker is None + assert m["line13"].is_sectionalizer is None + assert m["line13"].is_substation == 0 + assert m["line13"].is_network_protector is None + + for w in m["line13"].wires: + assert w.nameclass == "x0_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 14 + # assert len(m["line14"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line14"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line14"].nameclass == "c1_only" # Linecode is c1_only + assert m["line14"].line_type == "underground" # OH not in linecode + assert m["line14"].from_element == "bus14" + assert m["line14"].to_element == "bus15" + assert m["line14"].length == 10 + assert m["line14"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line14"].is_fuse is None + assert m["line14"].is_switch is None + assert m["line14"].is_banked is None + # assert m["line14"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line14"].positions is None # [] + # assert m["line14"].impedance_matrix == None + # assert m["line14"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line14"].substation_name is None + assert m["line14"].feeder_name == "sourcebus_src" + assert m["line14"].is_recloser is None + assert m["line14"].is_breaker is None + assert m["line14"].is_sectionalizer is None + assert m["line14"].is_substation == 0 + assert m["line14"].is_network_protector is None + + for w in m["line14"].wires: + assert w.nameclass == "c1_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None + + # Line 15 + # assert len(m["line15"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line15"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line15"].nameclass == "c0_only" # Linecode is c0_only + assert m["line15"].line_type == "underground" # OH not in linecode + assert m["line15"].from_element == "bus15" + assert m["line15"].to_element == "bus16" + assert m["line15"].length == 10 + assert m["line15"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line15"].is_fuse is None + assert m["line15"].is_switch is None + assert m["line15"].is_banked is None + # assert m["line15"].faultrate is None # 0.1 ( Default = 0.1 ? in opendssdirect) + # assert m["line15"].positions is None # [] + # assert m["line15"].impedance_matrix == None + # assert m["line15"].capacitance_matrix == [[(0.0028+0j), (-0.0006+0j), (-0.0006+0j)], [(-0.0006+0j), (0.0028+0j), (-0.0006+0j)], [(-0.0006+0j), (-0.0006+0j), (0.0028+0j)]] + assert m["line15"].substation_name is None + assert m["line15"].feeder_name == "sourcebus_src" + assert m["line15"].is_recloser is None + assert m["line15"].is_breaker is None + assert m["line15"].is_sectionalizer is None + assert m["line15"].is_substation == 0 + assert m["line15"].is_network_protector is None + + for w in m["line15"].wires: + assert w.nameclass == "c0_only" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + # assert w.ampacity is None # 400.0 + # assert w.emergency_ampacity is None # 600.0 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # 0 + # assert w.is_switch is None # 0 + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + # assert w.is_recloser is None # 0 + # assert w.is_breaker is None # 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None diff --git a/tests/readers/opendss/Lines/test_linegeometries.dss b/tests/readers/opendss/Lines/test_linegeometries.dss index 0ab49809..4933c633 100644 --- a/tests/readers/opendss/Lines/test_linegeometries.dss +++ b/tests/readers/opendss/Lines/test_linegeometries.dss @@ -2,6 +2,9 @@ Clear New Circuit.test_circuit +Redirect test_wiredata.dss +Redirect test_concentricneutral.dss + New Wiredata.ACSR336 GMR=0.0255000 DIAM=0.7410000 RAC=0.3060000 NormAmps=530.0000 Runits=mi radunits=in gmrunits=ft New Wiredata.ACSR1/0 GMR=0.0044600 DIAM=0.3980000 RAC=1.120000 NormAmps=230.0000 Runits=mi radunits=in gmrunits=ft @@ -12,10 +15,20 @@ New Linegeometry.HC2_336_1neut_0Mess nconds=4 nphases=3 ~ cond=3 Wire=ACSR336 x=0.5737 h=13.716 units=m ~ cond=4 Wire= ACSR1/0 x=0 h=14.648 ! units=m ! neutral +New LineGeometry.606 nconds=3 nphases=3 units=ft +~ cond=1 Wire=1/0_ACSR cncable=250_1/3 x=-0.5 h= -4 +~ cond=2 Wire=1/0_ACSR cncable=250_1/3 x=0 h= -4 +~ cond=3 Wire=1/0_ACSR cncable=250_1/3 x=0.5 h= -4 + New Line.Line1 Bus1=bus1.1.2.3 Bus2=bus2.1.2.3 ~ Geometry= HC2_336_1neut_0Mess ~ Length=300 units=ft +New Line.Line2 Bus1=bus2.1.2.3 Bus3=bus2.1.2.3 +~ Geometry= 606 +~ Length=1 units=mi + + Set Voltagebases=[4.8,34.5,115.0] Calcvoltagebases -Solve \ No newline at end of file +Solve diff --git a/tests/readers/opendss/Lines/test_linegeometries.py b/tests/readers/opendss/Lines/test_linegeometries.py index d3ddb159..3e36f174 100644 --- a/tests/readers/opendss/Lines/test_linegeometries.py +++ b/tests/readers/opendss/Lines/test_linegeometries.py @@ -68,3 +68,28 @@ def test_linegeometries(): assert phased_wires["N"].resistance == pytest.approx( 1.12 * 0.000621371 * 300 * 0.3048, 0.00001 ) + + assert len(m["line2"].wires) == 3 # Line1 should have 3 wires + assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C"]) + + phased_wires = {} + for wire in m["line2"].wires: + phased_wires[wire.phase] = wire + + # Nameclass + for p in ["A", "B", "C"]: + assert phased_wires[p].nameclass == "250_1/3" + + # for p in ["A", "B", "C"]: + # assert phased_wires[p].concentric_neutral_resistance == pytest.approx( + # 0.076705 * 0.000621371 * 300 * 0.3048, 0.00001 + # ) + + for p in ["A", "B", "C"]: + assert phased_wires[p].concentric_neutral_diameter == 0.064 * 0.0254 + + for p in ["A", "B", "C"]: + assert phased_wires[p].concentric_neutral_outside_diameter == 1.16 * 0.0254 + + for p in ["A", "B", "C"]: + assert phased_wires[p].concentric_neutral_nstrand == 13 diff --git a/tests/readers/opendss/Lines/test_wiredata.dss b/tests/readers/opendss/Lines/test_wiredata.dss new file mode 100644 index 00000000..750a96f9 --- /dev/null +++ b/tests/readers/opendss/Lines/test_wiredata.dss @@ -0,0 +1,3 @@ +New WireData.1/0_ACSR Rac=0.646847 Runits=km GMRac=0.13589 GMRUnits=cm Radius=0.50546 Radunits=cm Normamps=260 Emergamps=260 +New WireData.1000_CU Rac=0.042875 Runits=km GMRac=1.121921 GMRUnits=cm Radius=1.46177 Radunits=cm Normamps=1300 Emergamps=1300 + diff --git a/tests/readers/opendss/Loads/test_loads.py b/tests/readers/opendss/Loads/test_loads.py new file mode 100644 index 00000000..82e24691 --- /dev/null +++ b/tests/readers/opendss/Loads/test_loads.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- + +""" +test_loads.py +---------------------------------- + +Tests for parsing all values of Loads from OpenDSS into DiTTo. +""" + +import os +import math +import pytest +import numpy as np + +from ditto.store import Store +from ditto.readers.opendss.read import Reader + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_loads(): + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_loads.dss")) + r.parse(m) + m.set_names() + + precision = 0.001 + # assert m["load_load_zipv"].connection_type == None # Y + assert m["load_zipv"].vmin == 0.0 + assert m["load_zipv"].vmax == 1.2 + assert m["load_zipv"].connecting_element == "load" + assert m["load_zipv"].nominal_voltage == 1 * 10 ** 3 + # assert m["load_zipv"].num_users == None # 1.0 + assert m["load_zipv"].feeder_name == "src_src" + + # assert m["load_zipv"].positions == None # [] + # assert m["load_zipv"].timeseries == None # [] + assert m["load_zipv"].rooftop_area == None + assert m["load_zipv"].peak_p == None + assert m["load_zipv"].peak_q == None + assert m["load_zipv"].peak_coincident_p == None + assert m["load_zipv"].peak_coincident_q == None + assert m["load_zipv"].yearly_energy == None + assert m["load_zipv"].num_levels == None + assert m["load_zipv"].substation_name == None + assert m["load_zipv"].upstream_transformer_name == None + assert m["load_zipv"].transformer_connected_kva == None + assert m["load_zipv"].is_substation == 0 + assert m["load_zipv"].is_center_tap == None + assert m["load_zipv"].center_tap_perct_1_N == None + assert m["load_zipv"].center_tap_perct_N_2 == None + assert m["load_zipv"].center_tap_perct_1_2 == None + + assert len(m["load_zipv"].phase_loads) == 1 # Load is a one phase load + assert m["load_zipv"].phase_loads[0].phase == "A" + assert m["load_zipv"].phase_loads[0].p == 1 * 10 ** 3 + assert m["load_zipv"].phase_loads[0].q == pytest.approx( + 1.0 * math.sqrt(1.0 / 0.88 ** 2 - 1) * 10 ** 3, precision + ) + assert m["load_zipv"].phase_loads[0].model == 8 + assert m["load_zipv"].phase_loads[0].use_zip == 1 + assert m["load_zipv"].phase_loads[0].ppercentcurrent == -0.9855 * 100 + assert m["load_zipv"].phase_loads[0].qpercentcurrent == -2.963 * 100 + assert m["load_zipv"].phase_loads[0].ppercentpower == 1.1305 * 100 + assert m["load_zipv"].phase_loads[0].qpercentpower == 1.404 * 100 + assert m["load_zipv"].phase_loads[0].ppercentimpedance == 0.855 * 100 + assert m["load_zipv"].phase_loads[0].qpercentimpedance == 2.559 * 100 + assert m["load_zipv"].phase_loads[0].drop == 0 + + +""" + # P and Q values should be equally divided accross phase loads + # Here we sum P and Q and check that the obtained values match the values in the DSS file + # + precision = 0.001 + assert len(m["load_load1"].phase_loads) == 3 # Load1 is a three phase load + assert sum( + [phase_load.p for phase_load in m["load_load1"].phase_loads] + ) == pytest.approx(5400 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load1"].phase_loads] + ) == pytest.approx(4285 * 10 ** 3, precision) + + assert len(m["load_load2"].phase_loads) == 3 # Load2 is a three phase load + assert sum( + [phase_load.p for phase_load in m["load_load2"].phase_loads] + ) == pytest.approx(3466 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load2"].phase_loads] + ) == pytest.approx(3466.0 * math.sqrt(1.0 / 0.9 ** 2 - 1) * 10 ** 3, precision) + + assert len(m["load_load3"].phase_loads) == 2 # Load3 is a two phase load + assert sum( + [phase_load.p for phase_load in m["load_load3"].phase_loads] + ) == pytest.approx(1600 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load3"].phase_loads] + ) == pytest.approx(980 * 10 ** 3, precision) + + assert len(m["load_load4"].phase_loads) == 2 # Load4 is a two phase load + assert sum( + [phase_load.p for phase_load in m["load_load4"].phase_loads] + ) == pytest.approx(1555 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load4"].phase_loads] + ) == pytest.approx(1555.0 * math.sqrt(1.0 / 0.95 ** 2 - 1) * 10 ** 3, precision) + + assert len(m["load_load5"].phase_loads) == 1 # Load5 is a one phase load + assert sum( + [phase_load.p for phase_load in m["load_load5"].phase_loads] + ) == pytest.approx(650 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load5"].phase_loads] + ) == pytest.approx(500.5 * 10 ** 3, precision) + + assert len(m["load_load6"].phase_loads) == 1 # Load6 is a one phase load + assert sum( + [phase_load.p for phase_load in m["load_load6"].phase_loads] + ) == pytest.approx(623.21 * 10 ** 3, precision) + assert sum( + [phase_load.q for phase_load in m["load_load6"].phase_loads] + ) == pytest.approx(623.21 * math.sqrt(1.0 / 0.85 ** 2 - 1) * 10 ** 3, precision) + +""" diff --git a/tests/readers/opendss/Nodes/test_nodes.dss b/tests/readers/opendss/Nodes/test_nodes.dss new file mode 100644 index 00000000..c35362a4 --- /dev/null +++ b/tests/readers/opendss/Nodes/test_nodes.dss @@ -0,0 +1,5 @@ +Clear + +New Circuit.P4U bus1=st_mat pu=0.99 basekV=230.0 R1=1.1208 X1=3.5169 R0=1.1208 X0=3.5169 + + diff --git a/tests/readers/opendss/Nodes/test_nodes.py b/tests/readers/opendss/Nodes/test_nodes.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/readers/opendss/Powersource/test_powersource.dss b/tests/readers/opendss/Powersource/test_powersource.dss new file mode 100644 index 00000000..c35362a4 --- /dev/null +++ b/tests/readers/opendss/Powersource/test_powersource.dss @@ -0,0 +1,5 @@ +Clear + +New Circuit.P4U bus1=st_mat pu=0.99 basekV=230.0 R1=1.1208 X1=3.5169 R0=1.1208 X0=3.5169 + + diff --git a/tests/readers/opendss/Powersource/test_powersource.py b/tests/readers/opendss/Powersource/test_powersource.py new file mode 100644 index 00000000..c82e7933 --- /dev/null +++ b/tests/readers/opendss/Powersource/test_powersource.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +""" +test_powersource.py +---------------------------------- + +Tests for parsing all values of power source from OpenDSS into DiTTo. +""" + +import os +import math +import pytest +import numpy as np + +from ditto.store import Store +from ditto.readers.opendss.read import Reader + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_powersource(): + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_powersource.dss")) + r.parse(m) + m.set_names() + + assert m["Vsource.source"].nominal_voltage == 230.0 * 10 ** 3 + assert m["Vsource.source"].per_unit == 0.99 + assert m["Vsource.source"].is_sourcebus == 1 + # assert m["Vsource.source"].rated_power == None # 100000000.0 + # assert m["Vsource.source"].emergency_power == None # 14331000000.0 + assert m["Vsource.source"].zero_sequence_impedance == 1.1208 + 3.5169j + assert m["Vsource.source"].positive_sequence_impedance == 1.1208 + 3.5169j + # assert m["Vsource.source"].phase_angle == None # 0.0 + assert m["Vsource.source"].connecting_element == "st_mat" + + # assert m["Vsource.source"].phases == None # [] + # assert m["Vsource.source"].positions == None # [] + assert m["Vsource.source"].connection_type == None + assert m["Vsource.source"].cutout_percent == None + assert m["Vsource.source"].cutin_percent == None + assert m["Vsource.source"].resistance == None + assert m["Vsource.source"].reactance == None + assert m["Vsource.source"].v_max_pu == None + assert m["Vsource.source"].v_min_pu == None + assert m["Vsource.source"].power_factor == None diff --git a/tests/readers/opendss/Powersource/test_powersource.py~ b/tests/readers/opendss/Powersource/test_powersource.py~ new file mode 100644 index 00000000..5b9bbe59 --- /dev/null +++ b/tests/readers/opendss/Powersource/test_powersource.py~ @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +""" +test_powersource.py +---------------------------------- + +Tests for parsing all values of power source from OpenDSS into DiTTo. +""" + +import os +import math +import pytest +import numpy as np + +from ditto.store import Store +from ditto.readers.opendss.read import Reader + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_powersource(): + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_powersource.dss")) + r.parse(m) + m.set_names() + + assert m["Vsource.source"].nominal_voltage == 230.0 * 10 ** 3 + assert m["Vsource.source"].per_unit == 0.99 + assert m["Vsource.source"].is_sourcebus == 1 +# assert m["Vsource.source"].rated_power == None # 100000000.0 +# assert m["Vsource.source"].emergency_power == None # 14331000000.0 + assert m["Vsource.source"].zero_sequence_impedance == 1.1208 + 3.5169j + assert m["Vsource.source"].positive_sequence_impedance == 1.1208 + 3.5169j +# assert m["Vsource.source"].phase_angle == None # 0.0 + assert m["Vsource.source"].connecting_element == "st_mat" + +# assert m["Vsource.source"].phases == None # [] +# assert m["Vsource.source"].positions == None # [] + assert m["Vsource.source"].connection_type == None + assert m["Vsource.source"].cutout_percent == None + assert m["Vsource.source"].cutin_percent == None + assert m["Vsource.source"].resistance == None + assert m["Vsource.source"].reactance == None + assert m["Vsource.source"].v_max_pu == None + assert m["Vsource.source"].v_min_pu == None + assert m["Vsource.source"].power_factor == None diff --git a/tests/readers/opendss/Regulators/test_regulators.py b/tests/readers/opendss/Regulators/test_regulators.py new file mode 100644 index 00000000..46dbbee8 --- /dev/null +++ b/tests/readers/opendss/Regulators/test_regulators.py @@ -0,0 +1,804 @@ +# -*- coding: utf-8 -*- + +""" +test_regulators.py +---------------------------------- + +Tests for parsing all values of Regulators from OpenDSS into DiTTo. +""" + +import os +import math +import pytest +import numpy as np + +from ditto.store import Store +from ditto.readers.opendss.read import Reader + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_regulators(): + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_regulators.dss")) + r.parse(m) + m.set_names() + + # ! Regulator No. 1 from IEEE 8500 test case + assert len(m["vreg2_a"].windings) == 2 # Transformer vreg2_a should have 2 Windings + assert m["vreg2_a"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["vreg2_a"].windings[1].nominal_voltage == 7.2 * 10 ** 3 + + assert len(m["vreg2_b"].windings) == 2 # Transformer VREG_B should have 2 Windings + assert m["vreg2_b"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["vreg2_b"].windings[1].nominal_voltage == 7.2 * 10 ** 3 + + assert len(m["vreg2_c"].windings) == 2 # Transformer VREG_C should have 2 Windings + assert m["vreg2_c"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["vreg2_c"].windings[1].nominal_voltage == 7.2 * 10 ** 3 + + assert m["vreg2_a"].feeder_name == "sourcebus_src" + # assert m["vreg2_a"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["vreg2_a"].loadloss == 0.01 # loadloss or noloadloss? + assert m["vreg2_a"].phase_shift == None + assert m["vreg2_a"].is_substation == 0 + # assert m["vreg2_a"].normhkva == None # 11000.0 + assert m["vreg2_a"].install_type == None + assert m["vreg2_a"].from_element == "regxfmr_190-8593" + assert m["vreg2_a"].to_element == "190-8593" + assert m["vreg2_a"].reactances == [0.1] + # assert m["vreg2_a"].positions == None # [] + assert m["vreg2_a"].is_center_tap == 0 + # assert m["vreg2_a"].substation_name == None # '' + + assert m["vreg2_a"].windings[0].connection_type == "Y" + assert m["vreg2_a"].windings[1].connection_type == "Y" + + assert m["vreg2_a"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["vreg2_a"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["vreg2_a"].windings[0].emergency_power == None # 15000000.0 + # assert m["vreg2_a"].windings[1].emergency_power == None # 15000000.0 + + # assert m["vreg2_a"].windings[0].resistance == None # 0.005 + # assert m["vreg2_a"].windings[1].resistance == None # 0.005 + + assert m["vreg2_a"].windings[0].voltage_type == None + assert m["vreg2_a"].windings[1].voltage_type == None + + assert m["vreg2_a"].windings[0].voltage_limit == None + assert m["vreg2_a"].windings[1].voltage_limit == None + + assert m["vreg2_a"].windings[0].reverse_resistance == None + assert m["vreg2_a"].windings[1].reverse_resistance == None + + # assert m["vreg2_a"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["vreg2_a"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["vreg2_a"].windings[0].phase_windings[0].phase == "A" + + assert m["vreg2_a"].windings[1].phase_windings[0].phase == "A" + + # assert m["vreg2_a"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_a"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_a"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["vreg2_a"].windings[1].phase_windings[0].compensator_x == None # 0.0 + + assert m["regulator_vreg2_a"].winding == 2 + # assert m["regulator_vreg2_a"].ct_prim == None # 300.0 + assert m["regulator_vreg2_a"].noload_loss == None + # assert m["regulator_vreg2_a"].delay == None # 15.0 + # assert m["regulator_vreg2_a"].highstep == None # 16 + assert m["regulator_vreg2_a"].lowstep == None + assert m["regulator_vreg2_a"].pt_ratio == 60 + assert m["regulator_vreg2_a"].ct_ratio == None + assert m["regulator_vreg2_a"].bandwidth == 2 + assert m["regulator_vreg2_a"].bandcenter == 125 + # assert m["regulator_vreg2_a"].voltage_limit == None # 0.0 + assert m["regulator_vreg2_a"].connected_transformer == "vreg2_a" + assert m["regulator_vreg2_a"].from_element == "regxfmr_190-8593" + assert m["regulator_vreg2_a"].to_element == "190-8593" + assert m["regulator_vreg2_a"].pt_phase == "A" + assert m["regulator_vreg2_a"].reactances == [0.1] + assert m["regulator_vreg2_a"].phase_shift == None + assert m["regulator_vreg2_a"].ltc == None + # assert m["regulator_vreg2_a"].positions == None # [] + assert m["regulator_vreg2_a"].ltc == None + # assert m["regulator_vreg2_a"].substation_name == None # '' + assert m["regulator_vreg2_a"].feeder_name == "sourcebus_src" + assert m["regulator_vreg2_a"].is_substation == 0 + assert m["regulator_vreg2_a"].setpoint == None + + assert m["vreg2_b"].feeder_name == "sourcebus_src" + # assert m["vreg2_b"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["vreg2_b"].loadloss == 0.01 # loadloss or noloadloss? + assert m["vreg2_b"].phase_shift == None + assert m["vreg2_b"].is_substation == 0 + # assert m["vreg2_b"].normhkva == None # 11000.0 + assert m["vreg2_b"].install_type == None + assert m["vreg2_b"].from_element == "regxfmr_190-8593" + assert m["vreg2_b"].to_element == "190-8593" + assert m["vreg2_b"].reactances == [0.1] + # assert m["vreg2_b"].positions == None # [] + assert m["vreg2_b"].is_center_tap == 0 + # assert m["vreg2_b"].substation_name == None # '' + + assert m["vreg2_b"].windings[0].connection_type == "Y" + assert m["vreg2_b"].windings[1].connection_type == "Y" + + assert m["vreg2_b"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["vreg2_b"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["vreg2_b"].windings[0].emergency_power == None # 15000000.0 + # assert m["vreg2_b"].windings[1].emergency_power == None # 15000000.0 + + # assert m["vreg2_b"].windings[0].resistance == None # 0.005 + # assert m["vreg2_b"].windings[1].resistance == None # 0.005 + + assert m["vreg2_b"].windings[0].voltage_type == None + assert m["vreg2_b"].windings[1].voltage_type == None + + assert m["vreg2_b"].windings[0].voltage_limit == None + assert m["vreg2_b"].windings[1].voltage_limit == None + + assert m["vreg2_b"].windings[0].reverse_resistance == None + assert m["vreg2_b"].windings[1].reverse_resistance == None + + # assert m["vreg2_b"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["vreg2_b"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["vreg2_b"].windings[0].phase_windings[0].phase == "B" + + assert m["vreg2_b"].windings[1].phase_windings[0].phase == "B" + + # assert m["vreg2_b"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_b"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_b"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["vreg2_b"].windings[1].phase_windings[0].compensator_x == None # 0.0 + + assert m["regulator_vreg2_b"].winding == 2 + # assert m["regulator_vreg2_b"].ct_prim == None # 300.0 + assert m["regulator_vreg2_b"].noload_loss == None + # assert m["regulator_vreg2_b"].delay == None # 15.0 + # assert m["regulator_vreg2_b"].highstep == None # 16 + assert m["regulator_vreg2_b"].lowstep == None + assert m["regulator_vreg2_b"].pt_ratio == 60 + assert m["regulator_vreg2_b"].ct_ratio == None + assert m["regulator_vreg2_b"].bandwidth == 2 + assert m["regulator_vreg2_b"].bandcenter == 125 + # assert m["regulator_vreg2_b"].voltage_limit == None # 0.0 + assert m["regulator_vreg2_b"].connected_transformer == "vreg2_b" + assert m["regulator_vreg2_b"].from_element == "regxfmr_190-8593" + assert m["regulator_vreg2_b"].to_element == "190-8593" + assert m["regulator_vreg2_b"].pt_phase == "B" + assert m["regulator_vreg2_b"].reactances == [0.1] + assert m["regulator_vreg2_b"].phase_shift == None + assert m["regulator_vreg2_b"].ltc == None + # assert m["regulator_vreg2_b"].positions == None # [] + assert m["regulator_vreg2_b"].ltc == None + # assert m["regulator_vreg2_b"].substation_name == None # '' + assert m["regulator_vreg2_b"].feeder_name == "sourcebus_src" + assert m["regulator_vreg2_b"].is_substation == 0 + assert m["regulator_vreg2_b"].setpoint == None + + assert m["vreg2_c"].feeder_name == "sourcebus_src" + # assert m["vreg2_c"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["vreg2_c"].loadloss == 0.01 # loadloss or noloadloss? + assert m["vreg2_c"].phase_shift == None + assert m["vreg2_c"].is_substation == 0 + # assert m["vreg2_c"].normhkva == None # 11000.0 + assert m["vreg2_c"].install_type == None + assert m["vreg2_c"].from_element == "regxfmr_190-8593" + assert m["vreg2_c"].to_element == "190-8593" + assert m["vreg2_c"].reactances == [0.1] + # assert m["vreg2_c"].positions == None # [] + assert m["vreg2_c"].is_center_tap == 0 + # assert m["vreg2_c"].substation_name == None # '' + + assert m["vreg2_c"].windings[0].connection_type == "Y" + assert m["vreg2_c"].windings[1].connection_type == "Y" + + assert m["vreg2_c"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["vreg2_c"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["vreg2_c"].windings[0].emergency_power == None # 15000000.0 + # assert m["vreg2_c"].windings[1].emergency_power == None # 15000000.0 + + # assert m["vreg2_c"].windings[0].resistance == None # 0.005 + # assert m["vreg2_c"].windings[1].resistance == None # 0.005 + + assert m["vreg2_c"].windings[0].voltage_type == None + assert m["vreg2_c"].windings[1].voltage_type == None + + assert m["vreg2_c"].windings[0].voltage_limit == None + assert m["vreg2_c"].windings[1].voltage_limit == None + + assert m["vreg2_c"].windings[0].reverse_resistance == None + assert m["vreg2_c"].windings[1].reverse_resistance == None + + # assert m["vreg2_c"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["vreg2_c"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["vreg2_c"].windings[0].phase_windings[0].phase == "C" + + assert m["vreg2_c"].windings[1].phase_windings[0].phase == "C" + + # assert m["vreg2_c"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_c"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["vreg2_c"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["vreg2_c"].windings[1].phase_windings[0].compensator_x == None # 0.0 + + assert m["regulator_vreg2_c"].winding == 2 + # assert m["regulator_vreg2_c"].ct_prim == None # 300.0 + assert m["regulator_vreg2_c"].noload_loss == None + # assert m["regulator_vreg2_c"].delay == None # 15.0 + # assert m["regulator_vreg2_c"].highstep == None # 16 + assert m["regulator_vreg2_c"].lowstep == None + assert m["regulator_vreg2_c"].pt_ratio == 60 + assert m["regulator_vreg2_c"].ct_ratio == None + assert m["regulator_vreg2_c"].bandwidth == 2 + assert m["regulator_vreg2_c"].bandcenter == 125 + # assert m["regulator_vreg2_c"].voltage_limit == None # 0.0 + assert m["regulator_vreg2_c"].connected_transformer == "vreg2_c" + assert m["regulator_vreg2_c"].from_element == "regxfmr_190-8593" + assert m["regulator_vreg2_c"].to_element == "190-8593" + assert m["regulator_vreg2_c"].pt_phase == "C" + assert m["regulator_vreg2_c"].reactances == [0.1] + assert m["regulator_vreg2_c"].phase_shift == None + assert m["regulator_vreg2_c"].ltc == None + # assert m["regulator_vreg2_c"].positions == None # [] + assert m["regulator_vreg2_c"].ltc == None + # assert m["regulator_vreg2_c"].substation_name == None # '' + assert m["regulator_vreg2_c"].feeder_name == "sourcebus_src" + assert m["regulator_vreg2_c"].is_substation == 0 + assert m["regulator_vreg2_c"].setpoint == None + + # Regulator No. 2 from IEEE 8500 test case + assert ( + len(m["regxfmr_b18865"].windings) == 2 + ) # Transformer regxfmr_b18865 should have 2 Windings + assert m["regxfmr_b18865"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["regxfmr_b18865"].windings[1].nominal_voltage == 7.2 * 10 ** 3 + + assert m["regxfmr_b18865"].feeder_name == "sourcebus_src" + # assert m["regxfmr_b18865"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["regxfmr_b18865"].loadloss == None # 0.4 + assert m["regxfmr_b18865"].phase_shift == None + assert m["regxfmr_b18865"].is_substation == 0 + # assert m["regxfmr_b18865"].normhkva == None # 11000.0 + assert m["regxfmr_b18865"].install_type == None + assert m["regxfmr_b18865"].from_element == "b18865" + assert m["regxfmr_b18865"].to_element == "b18865reg" + assert m["regxfmr_b18865"].reactances == [0.01] + # assert m["regxfmr_b18865"].positions == None # [] + assert m["regxfmr_b18865"].is_center_tap == 0 + # assert m["regxfmr_b18865"].substation_name == None # '' + + assert m["regxfmr_b18865"].windings[0].connection_type == "Y" + assert m["regxfmr_b18865"].windings[1].connection_type == "Y" + + assert m["regxfmr_b18865"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["regxfmr_b18865"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["regxfmr_b18865"].windings[0].emergency_power == None # 15000000.0 + # assert m["regxfmr_b18865"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regxfmr_b18865"].windings[0].resistance == None # 0.2 + # assert m["regxfmr_b18865"].windings[1].resistance == None # 0.2 + + assert m["regxfmr_b18865"].windings[0].voltage_type == None + assert m["regxfmr_b18865"].windings[1].voltage_type == None + + assert m["regxfmr_b18865"].windings[0].voltage_limit == None + assert m["regxfmr_b18865"].windings[1].voltage_limit == None + + assert m["regxfmr_b18865"].windings[0].reverse_resistance == None + assert m["regxfmr_b18865"].windings[1].reverse_resistance == None + + # assert m["regxfmr_b18865"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["regxfmr_b18865"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["regxfmr_b18865"].windings[0].phase_windings[0].phase == "C" + + assert m["regxfmr_b18865"].windings[1].phase_windings[0].phase == "C" + + # assert m["regxfmr_b18865"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regxfmr_b18865"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regxfmr_b18865"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["regxfmr_b18865"].windings[1].phase_windings[0].compensator_x == None # 0.0 + + assert m["regulator_regxfmr_b18865_ctrl"].winding == 2 + # assert m["regulator_regxfmr_b18865_ctrl"].ct_prim == None # 300.0 + assert m["regulator_regxfmr_b18865_ctrl"].noload_loss == None + assert m["regulator_regxfmr_b18865_ctrl"].delay == 45 + # assert m["regulator_regxfmr_b18865_ctrl"].highstep == None # 16 + assert m["regulator_regxfmr_b18865_ctrl"].lowstep == None + assert m["regulator_regxfmr_b18865_ctrl"].pt_ratio == 60 + assert m["regulator_regxfmr_b18865_ctrl"].ct_ratio == None + assert m["regulator_regxfmr_b18865_ctrl"].bandwidth == 2 + assert m["regulator_regxfmr_b18865_ctrl"].bandcenter == 124 + # assert m["regulator_regxfmr_b18865_ctrl"].voltage_limit == None # 0.0 + assert m["regulator_regxfmr_b18865_ctrl"].connected_transformer == "regxfmr_b18865" + assert m["regulator_regxfmr_b18865_ctrl"].from_element == "b18865" + assert m["regulator_regxfmr_b18865_ctrl"].to_element == "b18865reg" + assert m["regulator_regxfmr_b18865_ctrl"].pt_phase == "C" + assert m["regulator_regxfmr_b18865_ctrl"].reactances == [0.01] + assert m["regulator_regxfmr_b18865_ctrl"].phase_shift == None + assert m["regulator_regxfmr_b18865_ctrl"].ltc == None + # assert m["regulator_regxfmr_b18865_ctrl"].positions == None # [] + assert m["regulator_regxfmr_b18865_ctrl"].ltc == None + # assert m["regulator_regxfmr_b18865_ctrl"].substation_name == None # '' + assert m["regulator_regxfmr_b18865_ctrl"].feeder_name == "sourcebus_src" + assert m["regulator_regxfmr_b18865_ctrl"].is_substation == 0 + assert m["regulator_regxfmr_b18865_ctrl"].setpoint == None + + # Substation regulator from SMART-DS P4U region + assert ( + len(m["sb5_p4uhs0_4_trans_439"].windings) == 2 + ) # Transformer sb5_p4uhs0_4_trans_439 should have 2 Windings + assert m["sb5_p4uhs0_4_trans_439"].windings[0].nominal_voltage == 69.0 * 10 ** 3 + assert m["sb5_p4uhs0_4_trans_439"].windings[1].nominal_voltage == 4.0 * 10 ** 3 + + assert m["sb5_p4uhs0_4_trans_439"].feeder_name == "sourcebus_src" + # assert m["sb5_p4uhs0_4_trans_439"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["sb5_p4uhs0_4_trans_439"].loadloss == None # 0.9616652 ?? taken from XHL Value + assert m["sb5_p4uhs0_4_trans_439"].phase_shift == None + assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 + # assert m["sb5_p4uhs0_4_trans_439"].normhkva == None # 8800.0 + assert m["sb5_p4uhs0_4_trans_439"].install_type == None + assert m["sb5_p4uhs0_4_trans_439"].from_element == "sb5_p4uhs0_4_node_5_12" + assert m["sb5_p4uhs0_4_trans_439"].to_element == "sb5_p4uhs0_4_node_5_13" + assert m["sb5_p4uhs0_4_trans_439"].reactances == [pytest.approx(0.9616652224137047)] + # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] + assert m["sb5_p4uhs0_4_trans_439"].is_center_tap == 0 + # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].connection_type == "D" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].connection_type == "Y" + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].rated_power == 8000 * 10 ** 3 + assert m["sb5_p4uhs0_4_trans_439"].windings[1].rated_power == 8000 * 10 ** 3 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].emergency_power == None # 12000000.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].emergency_power == None # 12000000.0 + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].resistance == pytest.approx( + 0.4808326112068522 + ) + assert m["sb5_p4uhs0_4_trans_439"].windings[1].resistance == pytest.approx( + 0.4808326112068522 + ) + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].voltage_type == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].voltage_type == None + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].voltage_limit == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].voltage_limit == None + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].reverse_resistance == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].reverse_resistance == None + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].phase == "A" + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].phase == "B" + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].phase == "C" + + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].phase == "A" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].phase == "B" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].phase == "C" + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].compensator_r == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].compensator_r == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].compensator_r == None # 0.0 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].compensator_r == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].compensator_r == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].compensator_r == None # 0.0 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].compensator_x == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].compensator_x == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].compensator_x == None # 0.0 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].compensator_x == None # 0.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].compensator_x == None # 0.0 + + assert m["regulator_sb5_p4uhs0_4_reg_439"].winding == 2 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].ct_prim == None # 300.0 + assert m["regulator_sb5_p4uhs0_4_reg_439"].noload_loss == None + # assert m["regulator_sb5_p4uhs0_4_reg_439"].delay == 15 + assert m["regulator_sb5_p4uhs0_4_reg_439"].highstep == 10 + assert m["regulator_sb5_p4uhs0_4_reg_439"].lowstep == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].pt_ratio == 19 + assert m["regulator_sb5_p4uhs0_4_reg_439"].ct_ratio == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].bandwidth == 1.9919999999999998 + assert m["regulator_sb5_p4uhs0_4_reg_439"].bandcenter == 123.60000000000001 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].voltage_limit == None # 0.0 + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].connected_transformer + == "sb5_p4uhs0_4_trans_439" + ) + assert m["regulator_sb5_p4uhs0_4_reg_439"].from_element == "sb5_p4uhs0_4_node_5_12" + assert m["regulator_sb5_p4uhs0_4_reg_439"].to_element == "sb5_p4uhs0_4_node_5_13" + assert m["regulator_sb5_p4uhs0_4_reg_439"].pt_phase == "A" + assert m["regulator_sb5_p4uhs0_4_reg_439"].reactances == [ + pytest.approx(0.9616652224137047) + ] + assert m["regulator_sb5_p4uhs0_4_reg_439"].phase_shift == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None + # assert m["regulator_sb5_p4uhs0_4_reg_439"].positions == None # [] + assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None + # assert m["regulator_sb5_p4uhs0_4_reg_439"].substation_name == None # '' + assert m["regulator_sb5_p4uhs0_4_reg_439"].feeder_name == "sourcebus_src" + assert m["regulator_sb5_p4uhs0_4_reg_439"].is_substation == 0 + assert m["regulator_sb5_p4uhs0_4_reg_439"].setpoint == None + + # Rural regulator from SMART-DS rural region + assert ( + len(m["trans_reg_creduladortension"].windings) == 2 + ) # Transformer trans_reg_creduladortension should have 2 Windings + assert ( + m["trans_reg_creduladortension"].windings[0].nominal_voltage == 124700 * 10 ** 3 + ) + assert ( + m["trans_reg_creduladortension"].windings[1].nominal_voltage == 124700 * 10 ** 3 + ) + + assert m["trans_reg_creduladortension"].feeder_name == "sourcebus_src" + # assert m["trans_reg_creduladortension"].noload_loss == 0.0 # 0.0 #loadloss or noloadloss? + # assert m["trans_reg_creduladortension"].loadloss == None # 0.4 + assert m["trans_reg_creduladortension"].phase_shift == None + assert m["trans_reg_creduladortension"].is_substation == 0 + # assert m["trans_reg_creduladortension"].normhkva == None # 11000.0 + assert m["trans_reg_creduladortension"].install_type == None + assert m["trans_reg_creduladortension"].from_element == "rdt222-rdt298x" + assert m["trans_reg_creduladortension"].to_element == "rdt222" + # assert m["trans_reg_creduladortension"].reactances == None # [7.0] + # assert m["trans_reg_creduladortension"].positions == None # [] + assert m["trans_reg_creduladortension"].is_center_tap == 0 + # assert m["trans_reg_creduladortension"].substation_name == None # '' + + assert m["trans_reg_creduladortension"].windings[0].connection_type == "Y" + assert m["trans_reg_creduladortension"].windings[1].connection_type == "Y" + + assert m["trans_reg_creduladortension"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["trans_reg_creduladortension"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["trans_reg_creduladortension"].windings[0].emergency_power == None # 15000000.0 + # assert m["trans_reg_creduladortension"].windings[1].emergency_power == None # 15000000.0 + + # assert m["trans_reg_creduladortension"].windings[0].resistance == None # 0.2 + # assert m["trans_reg_creduladortension"].windings[1].resistance == None # 0.2 + + assert m["trans_reg_creduladortension"].windings[0].voltage_type == None + assert m["trans_reg_creduladortension"].windings[1].voltage_type == None + + assert m["trans_reg_creduladortension"].windings[0].voltage_limit == None + assert m["trans_reg_creduladortension"].windings[1].voltage_limit == None + + assert m["trans_reg_creduladortension"].windings[0].reverse_resistance == None + assert m["trans_reg_creduladortension"].windings[1].reverse_resistance == None + + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["trans_reg_creduladortension"].windings[0].phase_windings[0].phase == "A" + assert m["trans_reg_creduladortension"].windings[0].phase_windings[1].phase == "B" + assert m["trans_reg_creduladortension"].windings[0].phase_windings[2].phase == "C" + + assert m["trans_reg_creduladortension"].windings[1].phase_windings[0].phase == "A" + assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].phase == "B" + assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].phase == "C" + + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[0].compensator_r == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[1].compensator_r == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[2].compensator_r == None # 0.0 + + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[0].compensator_r == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].compensator_r == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].compensator_r == None # 0.0 + + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[0].compensator_x == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[1].compensator_x == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[0].phase_windings[2].compensator_x == None # 0.0 + + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].compensator_x == None # 0.0 + # assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].compensator_x == None # 0.0 + + assert m["regulator_reg_creguladortension"].winding == 2 + # assert m["regulator_reg_creguladortension"].ct_prim == None # 300.0 + assert m["regulator_reg_creguladortension"].noload_loss == None + # assert m["regulator_reg_creguladortension"].delay == None # 15.0 + # assert m["regulator_reg_creguladortension"].highstep == None # 16 + assert m["regulator_reg_creguladortension"].lowstep == None + assert m["regulator_reg_creguladortension"].pt_ratio == 60 + assert m["regulator_reg_creguladortension"].ct_ratio == None + assert m["regulator_reg_creguladortension"].bandwidth == 2.4 + assert m["regulator_reg_creguladortension"].bandcenter == 123.6 + # assert m["regulator_reg_creguladortension"].voltage_limit == None # 0.0 + # assert m["regulator_reg_creguladortension"].connected_transformer == "trans_reg_creduladortension" + # assert m["regulator_reg_creguladortension"].from_element == "rdt222-rdt298x" + # assert m["regulator_reg_creguladortension"].to_element == "rdt222" + assert m["regulator_reg_creguladortension"].pt_phase == "A" + # assert m["regulator_reg_creguladortension"].reactances == None + assert m["regulator_reg_creguladortension"].phase_shift == None + assert m["regulator_reg_creguladortension"].ltc == None + # assert m["regulator_reg_creguladortension"].positions == None # [] + assert m["regulator_reg_creguladortension"].ltc == None + # assert m["regulator_reg_creguladortension"].substation_name == None # '' + assert m["regulator_reg_creguladortension"].feeder_name == "sourcebus_src" + assert m["regulator_reg_creguladortension"].is_substation == 0 + assert m["regulator_reg_creguladortension"].setpoint == None + + # Regulator from IEEE 13 node feeder + assert len(m["reg1"].windings) == 2 # Transformer reg1 should have 2 Windings + assert m["reg1"].windings[0].nominal_voltage == 2.4 * 10 ** 3 + assert m["reg1"].windings[1].nominal_voltage == 2.4 * 10 ** 3 + + assert m["reg1"].feeder_name == "sourcebus_src" + # assert m["reg1"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["reg1"].loadloss == 0.01 + assert m["reg1"].phase_shift == None + assert m["reg1"].is_substation == 0 + # assert m["reg1"].normhkva == None # 1832.6 + assert m["reg1"].install_type == None + assert m["reg1"].from_element == "650" + assert m["reg1"].to_element == "rg60" + assert m["reg1"].reactances == [0.01] + # assert m["reg1"].positions == None # [] + assert m["reg1"].is_center_tap == 0 + # assert m["reg1"].substation_name == None # '' + + assert m["reg1"].windings[0].connection_type == "Y" + assert m["reg1"].windings[1].connection_type == "Y" + + assert m["reg1"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["reg1"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["reg1"].windings[0].emergency_power == None # 2499000.0 + # assert m["reg1"].windings[1].emergency_power == None # 2499000.0 + + # assert m["reg1"].windings[0].resistance == None # 0.005 + # assert m["reg1"].windings[1].resistance == None # 0.005 + + assert m["reg1"].windings[0].voltage_type == None + assert m["reg1"].windings[1].voltage_type == None + + assert m["reg1"].windings[0].voltage_limit == None + assert m["reg1"].windings[1].voltage_limit == None + + assert m["reg1"].windings[0].reverse_resistance == None + assert m["reg1"].windings[1].reverse_resistance == None + + # assert m["reg1"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["reg1"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["reg1"].windings[0].phase_windings[0].phase == "A" + + assert m["reg1"].windings[1].phase_windings[0].phase == "A" + + assert m["reg1"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["reg1"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["reg1"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["reg1"].windings[1].phase_windings[0].compensator_x == float(9) + + assert m["regulator_reg1"].winding == 2 + assert m["regulator_reg1"].ct_prim == 700 + assert m["regulator_reg1"].noload_loss == None + # assert m["regulator_reg1"].delay == None # 15.0 + # assert m["regulator_reg1"].highstep == None # 16 + assert m["regulator_reg1"].lowstep == None + assert m["regulator_reg1"].pt_ratio == 20 + assert m["regulator_reg1"].ct_ratio == None + assert m["regulator_reg1"].bandwidth == 2 + assert m["regulator_reg1"].bandcenter == 122 + # assert m["regulator_reg1"].voltage_limit == None # 0.0 + assert m["regulator_reg1"].connected_transformer == "reg1" + assert m["regulator_reg1"].from_element == "650" + assert m["regulator_reg1"].to_element == "rg60" + assert m["regulator_reg1"].pt_phase == "A" + assert m["regulator_reg1"].reactances == [0.01] + assert m["regulator_reg1"].phase_shift == None + assert m["regulator_reg1"].ltc == None + # assert m["regulator_reg1"].positions == None # [] + assert m["regulator_reg1"].ltc == None + # assert m["regulator_reg1"].substation_name == None # '' + assert m["regulator_reg1"].feeder_name == "sourcebus_src" + assert m["regulator_reg1"].is_substation == 0 + assert m["regulator_reg1"].setpoint == None + + assert len(m["reg2"].windings) == 2 # Transformer reg2 should have 2 Windings + assert m["reg2"].windings[0].nominal_voltage == 2.4 * 10 ** 3 + assert m["reg2"].windings[1].nominal_voltage == 2.4 * 10 ** 3 + + assert m["reg2"].feeder_name == "sourcebus_src" + # assert m["reg2"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["reg2"].loadloss == 0.01 + assert m["reg2"].phase_shift == None + assert m["reg2"].is_substation == 0 + # assert m["reg2"].normhkva == None # 1832.6 + assert m["reg2"].install_type == None + assert m["reg2"].from_element == "650" + assert m["reg2"].to_element == "rg60" + assert m["reg2"].reactances == [0.01] + # assert m["reg2"].positions == None # [] + assert m["reg2"].is_center_tap == 0 + # assert m["reg2"].substation_name == None # '' + + assert m["reg2"].windings[0].connection_type == "Y" + assert m["reg2"].windings[1].connection_type == "Y" + + assert m["reg2"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["reg2"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["reg2"].windings[0].emergency_power == None # 2499000.0 + # assert m["reg2"].windings[1].emergency_power == None # 2499000.0 + + # assert m["reg2"].windings[0].resistance == None # 0.005 + # assert m["reg2"].windings[1].resistance == None # 0.005 + + assert m["reg2"].windings[0].voltage_type == None + assert m["reg2"].windings[1].voltage_type == None + + assert m["reg2"].windings[0].voltage_limit == None + assert m["reg2"].windings[1].voltage_limit == None + + assert m["reg2"].windings[0].reverse_resistance == None + assert m["reg2"].windings[1].reverse_resistance == None + + # assert m["reg2"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["reg2"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg2"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["reg2"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["reg2"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg2"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["reg2"].windings[0].phase_windings[0].phase == "B" + + assert m["reg2"].windings[1].phase_windings[0].phase == "B" + + assert m["reg2"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["reg2"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["reg2"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["reg2"].windings[1].phase_windings[0].compensator_x == float(9) + + assert m["regulator_reg2"].winding == 2 + assert m["regulator_reg2"].ct_prim == 700 + assert m["regulator_reg2"].noload_loss == None + # assert m["regulator_reg2"].delay == None # 15.0 + # assert m["regulator_reg2"].highstep == None # 16 + assert m["regulator_reg2"].lowstep == None + assert m["regulator_reg2"].pt_ratio == 20 + assert m["regulator_reg2"].ct_ratio == None + assert m["regulator_reg2"].bandwidth == 2 + assert m["regulator_reg2"].bandcenter == 122 + # assert m["regulator_reg2"].voltage_limit == None # 0.0 + assert m["regulator_reg2"].connected_transformer == "reg2" + assert m["regulator_reg2"].from_element == "650" + assert m["regulator_reg2"].to_element == "rg60" + assert m["regulator_reg2"].pt_phase == "B" + assert m["regulator_reg2"].reactances == [0.01] + assert m["regulator_reg2"].phase_shift == None + assert m["regulator_reg2"].ltc == None + # assert m["regulator_reg2"].positions == None # [] + assert m["regulator_reg2"].ltc == None + # assert m["regulator_reg2"].substation_name == None # '' + assert m["regulator_reg2"].feeder_name == "sourcebus_src" + assert m["regulator_reg2"].is_substation == 0 + assert m["regulator_reg2"].setpoint == None + + assert len(m["reg3"].windings) == 2 # Transformer reg3 should have 2 Windings + assert m["reg3"].windings[0].nominal_voltage == 2.4 * 10 ** 3 + assert m["reg3"].windings[1].nominal_voltage == 2.4 * 10 ** 3 + + assert m["reg3"].feeder_name == "sourcebus_src" + # assert m["reg3"].noload_loss == None # 0.0 #loadloss or noloadloss? + assert m["reg3"].loadloss == 0.01 + assert m["reg3"].phase_shift == None + assert m["reg3"].is_substation == 0 + # assert m["reg3"].normhkva == None # 1832.6 + assert m["reg3"].install_type == None + assert m["reg3"].from_element == "650" + assert m["reg3"].to_element == "rg60" + assert m["reg3"].reactances == [0.01] + # assert m["reg3"].positions == None # [] + assert m["reg3"].is_center_tap == 0 + # assert m["reg3"].substation_name == None # '' + + assert m["reg3"].windings[0].connection_type == "Y" + assert m["reg3"].windings[1].connection_type == "Y" + + assert m["reg3"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["reg3"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["reg3"].windings[0].emergency_power == None # 2499000.0 + # assert m["reg3"].windings[1].emergency_power == None # 2499000.0 + + # assert m["reg3"].windings[0].resistance == None # 0.005 + # assert m["reg3"].windings[1].resistance == None # 0.005 + + assert m["reg3"].windings[0].voltage_type == None + assert m["reg3"].windings[1].voltage_type == None + + assert m["reg3"].windings[0].voltage_limit == None + assert m["reg3"].windings[1].voltage_limit == None + + assert m["reg3"].windings[0].reverse_resistance == None + assert m["reg3"].windings[1].reverse_resistance == None + + # assert m["reg3"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["reg3"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg3"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["reg3"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["reg3"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg3"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["reg3"].windings[0].phase_windings[0].phase == "C" + + assert m["reg3"].windings[1].phase_windings[0].phase == "C" + + assert m["reg3"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["reg3"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["reg3"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["reg3"].windings[1].phase_windings[0].compensator_x == float(9) + + assert m["regulator_reg3"].winding == 2 + assert m["regulator_reg3"].ct_prim == 700 + assert m["regulator_reg3"].noload_loss == None + # assert m["regulator_reg3"].delay == None # 15.0 + # assert m["regulator_reg3"].highstep == None # 16 + assert m["regulator_reg3"].lowstep == None + assert m["regulator_reg3"].pt_ratio == 20 + assert m["regulator_reg3"].ct_ratio == None + assert m["regulator_reg3"].bandwidth == 2 + assert m["regulator_reg3"].bandcenter == 122 + # assert m["regulator_reg3"].voltage_limit == None # 0.0 + assert m["regulator_reg3"].connected_transformer == "reg3" + assert m["regulator_reg3"].from_element == "650" + assert m["regulator_reg3"].to_element == "rg60" + assert m["regulator_reg3"].pt_phase == "C" + assert m["regulator_reg3"].reactances == [0.01] + assert m["regulator_reg3"].phase_shift == None + assert m["regulator_reg3"].ltc == None + # assert m["regulator_reg3"].positions == None # [] + assert m["regulator_reg3"].ltc == None + # assert m["regulator_reg3"].substation_name == None # '' + assert m["regulator_reg3"].feeder_name == "sourcebus_src" + assert m["regulator_reg3"].is_substation == 0 + assert m["regulator_reg3"].setpoint == None diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.dss b/tests/readers/opendss/Transformers/test_transformer_kv.dss index db49459a..3e43cb15 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.dss +++ b/tests/readers/opendss/Transformers/test_transformer_kv.dss @@ -29,19 +29,19 @@ New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=6 ! Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U -New Transformer.tr(r:p4udt27-p4udt27lv) phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 +New Transformer.tr(r:p4udt27-p4udt27lv) phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 ! Three phase Delta-Wye Transformer (modified) from 4kV SMART-DS region P4U -New Transformer.tr(r:p4udt27-p4udt27lv)_1 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 +New Transformer.tr(r:p4udt27-p4udt27lv)_1 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=wye Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 ! Three phase Delta-Delta Transformer (modified) from 4kV SMART-DS region P4U -New Transformer.tr(r:p4udt27-p4udt27lv)_2 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 +New Transformer.tr(r:p4udt27-p4udt27lv)_2 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=delta Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 ! Three phase Wye-Delta Transformer (modified) from 4kV SMART-DS region P4U -New Transformer.tr(r:p4udt27-p4udt27lv)_3 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 +New Transformer.tr(r:p4udt27-p4udt27lv)_3 phases=3 windings=2 %loadloss=1.74408 %Noloadloss=0.6 normhkva=82.5 wdg=1 conn=wye Kv=4.0 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27 wdg=2 conn=delta Kv=0.48 kva=75.0 EmergHKVA=112.5 %R=0.87204 bus=p4udt27lv XHL=3.240000000000000 ! Center Tap Transformer from 4kV SMART-DS region P4U @@ -53,7 +53,7 @@ New Transformer.tr(r:p4udt25-p4udt25lv) phases=1 windings=3 %loadloss=0.798816 % New Transformer.T21396254A phases=1 windings=3 wdg=1 bus=L2804253.1 kv=7.2 kVA=15 wdg=2 bus=X2804253A.1.0 kv=0.12 kVA=15 wdg=3 bus=X2804253A.0.2 kv=0.12 kVA=15 %imag=0.5 %Rs=[0.6 1.2 1.2] %noloadloss=.2 Xhl=2.04 Xht=2.04 Xlt=1.36 -! Single phase Wye-Wye Transformer (for regulator) From IEEE 8500 Test case +! Single phase Wye-Wye Transformer (for regulator) From IEEE 8500 Test case New Transformer.FEEDER_REGA phases=1 windings=2 Bank=FEEDER_REG buses=(regxfmr_HVMV_Sub_LSB.1, _HVMV_Sub_LSB.1) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(27500, 27500) xhl=0.1 %loadloss=.001 wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 @@ -66,12 +66,12 @@ New Transformer.B4551-1A phases=1 wdg=1 bus=B4551.1 kv=7.2 kVA=15 wdg=2 bus=X_B4 New Transformer.5865228330A-1ABC phases=3 wdg=1 bus=5865228330A.1.2.3 kv=12.47 kVA=2000 wdg=2 bus=X_5865228330A kv=0.416 kVA=2000 %loadloss=0.7 %noloadloss=0.05 XHL=5 normhkva=2000.01 emerghkva=2800 ! Single phase delta-wye transformer. This is a dummy test as we don't expect to see delta configurations on a single phase -new transformer.t1 phases=1 xhl=6 +new transformer.t1_1 phases=1 xhl=6 ~ wdg=1 bus=n2.3 conn=delta kV=12.47 kVA=6000 %r=0.5 ~ wdg=2 bus=n3.1.2 conn=wye kV=4.16 kVA=6000 %r=0.5 ! Single phase wye-delta transformer. This is a dummy test as we don't expect to see delta configurations on a single phase -new transformer.t1 phases=1 xhl=6 +new transformer.t1_2 phases=1 xhl=6 ~ wdg=1 bus=n2.3 conn=wye kV=12.47 kVA=6000 %r=0.5 ~ wdg=2 bus=n3.1.2 conn=delta kV=4.16 kVA=6000 %r=0.5 diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.py b/tests/readers/opendss/Transformers/test_transformer_kv.py index f1c1918d..06c4cb7b 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.py +++ b/tests/readers/opendss/Transformers/test_transformer_kv.py @@ -23,7 +23,6 @@ def test_transformer_kv(): r = Reader(master_file=os.path.join(current_directory, "test_transformer_kv.dss")) r.parse(m) m.set_names() - # Substation is a 115kV/4.16kV step-down two windings transformer assert ( len(m["substation"].windings) == 2 @@ -42,3 +41,1283 @@ def test_transformer_kv(): assert m["xfm1"].windings[1].nominal_voltage == 0.48 * 10 ** 3 # TODO: Three windings, center-taps and so on... + + assert m["substation"].feeder_name == "sourcebus_src" + # assert m["substation"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["substation"].loadloss == None # 0.001, loadloss or noloadloss? + assert m["substation"].phase_shift == None + assert m["substation"].is_substation == 0 + # assert m["substation"].normhkva == None # 5500.0 + assert m["substation"].install_type == None + assert m["substation"].from_element == "sourcebus" + assert m["substation"].to_element == "bus1" + # assert m["substation"].reactances == None # 0.008 + # assert m["substation"].positions == None # [] + assert m["substation"].is_center_tap == 0 + # assert m["substation"].substation_name == None # '' + + assert m["substation"].windings[0].connection_type == "D" + assert m["substation"].windings[1].connection_type == "Y" + + assert m["substation"].windings[0].rated_power == 5000 * 10 ** 3 + assert m["substation"].windings[1].rated_power == 5000 * 10 ** 3 + + # assert m["substation"].windings[0].emergency_power == None # 7500000.0 + # assert m["substation"].windings[1].emergency_power == None # 7500000.0 + + assert m["substation"].windings[0].resistance == 0.0005 + assert m["substation"].windings[1].resistance == 0.0005 + + assert m["substation"].windings[0].voltage_type == None + assert m["substation"].windings[1].voltage_type == None + + assert m["substation"].windings[0].voltage_limit == None + assert m["substation"].windings[1].voltage_limit == None + + assert m["substation"].windings[0].reverse_resistance == None + assert m["substation"].windings[1].reverse_resistance == None + + # assert m["substation"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["substation"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["substation"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["substation"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["substation"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["substation"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["substation"].windings[0].phase_windings[0].phase == "A" + assert m["substation"].windings[0].phase_windings[1].phase == "B" + assert m["substation"].windings[0].phase_windings[2].phase == "C" + + assert m["substation"].windings[1].phase_windings[0].phase == "A" + assert m["substation"].windings[1].phase_windings[1].phase == "B" + assert m["substation"].windings[1].phase_windings[2].phase == "C" + + assert m["substation"].windings[0].phase_windings[0].compensator_r == None + assert m["substation"].windings[0].phase_windings[1].compensator_r == None + assert m["substation"].windings[0].phase_windings[2].compensator_r == None + + assert m["substation"].windings[1].phase_windings[0].compensator_r == None + assert m["substation"].windings[1].phase_windings[1].compensator_r == None + assert m["substation"].windings[1].phase_windings[2].compensator_r == None + + assert m["substation"].windings[0].phase_windings[0].compensator_x == None + assert m["substation"].windings[0].phase_windings[1].compensator_x == None + assert m["substation"].windings[0].phase_windings[2].compensator_x == None + + assert m["substation"].windings[1].phase_windings[0].compensator_x == None + assert m["substation"].windings[1].phase_windings[1].compensator_x == None + assert m["substation"].windings[1].phase_windings[2].compensator_x == None + + assert m["reg1"].feeder_name == "sourcebus_src" + # assert m["reg1"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["reg1"].loadloss == None # 0.4, loadloss or noloadloss? + assert m["reg1"].phase_shift == None + assert m["reg1"].is_substation == 0 + # assert m["reg1"].normhkva == None # 1832.6 + assert m["reg1"].install_type == None + assert m["reg1"].from_element == "bus1" + assert m["reg1"].to_element == "bus2" + # assert m["reg1"].reactances == None # 7.0 + # assert m["reg1"].positions == None # [] + assert m["reg1"].is_center_tap == 0 + # assert m["reg1"].substation_name == None # '' + + # assert m["reg1"].windings[0].connection_type == None # Y + # assert m["reg1"].windings[1].connection_type == None # Y + + assert m["reg1"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["reg1"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["reg1"].windings[0].emergency_power == None # 2499000.0 + # assert m["reg1"].windings[1].emergency_power == None # 2499000.0 + + # assert m["reg1"].windings[0].resistance == None # 0.2 + # assert m["reg1"].windings[1].resistance == None # 0.2 + + assert m["reg1"].windings[0].voltage_type == None + assert m["reg1"].windings[1].voltage_type == None + + assert m["reg1"].windings[0].voltage_limit == None + assert m["reg1"].windings[1].voltage_limit == None + + assert m["reg1"].windings[0].reverse_resistance == None + assert m["reg1"].windings[1].reverse_resistance == None + + # assert m["reg1"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["reg1"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["reg1"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["reg1"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["reg1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["reg1"].windings[0].phase_windings[0].phase == "A" + assert m["reg1"].windings[0].phase_windings[1].phase == "B" + assert m["reg1"].windings[0].phase_windings[2].phase == "C" + + assert m["reg1"].windings[1].phase_windings[0].phase == "A" + assert m["reg1"].windings[1].phase_windings[1].phase == "B" + assert m["reg1"].windings[1].phase_windings[2].phase == "C" + + assert m["reg1"].windings[0].phase_windings[0].compensator_r == None + assert m["reg1"].windings[0].phase_windings[1].compensator_r == None + assert m["reg1"].windings[0].phase_windings[2].compensator_r == None + + assert m["reg1"].windings[1].phase_windings[0].compensator_r == None + assert m["reg1"].windings[1].phase_windings[1].compensator_r == None + assert m["reg1"].windings[1].phase_windings[2].compensator_r == None + + assert m["reg1"].windings[0].phase_windings[0].compensator_x == None + assert m["reg1"].windings[0].phase_windings[1].compensator_x == None + assert m["reg1"].windings[0].phase_windings[2].compensator_x == None + + assert m["reg1"].windings[1].phase_windings[0].compensator_x == None + assert m["reg1"].windings[1].phase_windings[1].compensator_x == None + assert m["reg1"].windings[1].phase_windings[2].compensator_x == None + + assert m["xfm1"].feeder_name == "sourcebus_src" + # assert m["xfm1"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["xfm1"].loadloss == None # 1.1, loadloss or noloadloss? + assert m["xfm1"].phase_shift == None + assert m["xfm1"].is_substation == 0 + # assert m["xfm1"].normhkva == None # 550.0 + assert m["xfm1"].install_type == None + assert m["xfm1"].from_element == "bus2" + assert m["xfm1"].to_element == "bus3" + assert m["xfm1"].reactances == [float(2)] + # assert m["xfm1"].positions == None # [] + assert m["xfm1"].is_center_tap == 0 + # assert m["xfm1"].substation_name == None # '' + + assert m["xfm1"].windings[0].connection_type == "D" + assert m["xfm1"].windings[1].connection_type == "Y" + + assert m["xfm1"].windings[0].rated_power == 500 * 10 ** 3 + assert m["xfm1"].windings[1].rated_power == 500 * 10 ** 3 + + # assert m["xfm1"].windings[0].emergency_power == None # 750000.0 + # assert m["xfm1"].windings[1].emergency_power == None # 750000.0 + + assert m["xfm1"].windings[0].resistance == 0.55 + assert m["xfm1"].windings[1].resistance == 0.55 + + assert m["xfm1"].windings[0].voltage_type == None + assert m["xfm1"].windings[1].voltage_type == None + + assert m["xfm1"].windings[0].voltage_limit == None + assert m["xfm1"].windings[1].voltage_limit == None + + assert m["xfm1"].windings[0].reverse_resistance == None + assert m["xfm1"].windings[1].reverse_resistance == None + + # assert m["xfm1"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["xfm1"].windings[0].phase_windings[1].tap_position == None # 1.0 + + # assert m["xfm1"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["xfm1"].windings[1].phase_windings[1].tap_position == None # 1.0 + + assert m["xfm1"].windings[0].phase_windings[0].phase == "A" + assert m["xfm1"].windings[0].phase_windings[1].phase == "C" + + assert m["xfm1"].windings[1].phase_windings[0].phase == "A" + assert m["xfm1"].windings[1].phase_windings[1].phase == "C" + + assert m["xfm1"].windings[0].phase_windings[0].compensator_r == None + assert m["xfm1"].windings[0].phase_windings[1].compensator_r == None + + assert m["xfm1"].windings[1].phase_windings[0].compensator_r == None + assert m["xfm1"].windings[1].phase_windings[1].compensator_r == None + + assert m["xfm1"].windings[0].phase_windings[0].compensator_x == None + assert m["xfm1"].windings[0].phase_windings[1].compensator_x == None + + assert m["xfm1"].windings[1].phase_windings[0].compensator_x == None + assert m["xfm1"].windings[1].phase_windings[1].compensator_x == None + + # Three phase wye-wye transformer from IEEE 4 node feeder + + # t1 is a 12.47kV/4.16kV two windings distribution transformer + assert len(m["t1"].windings) == 2 # Transformer t1 should have 2 Windings + assert m["t1"].windings[0].nominal_voltage == 12.47 * 10 ** 3 + assert m["t1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 + + assert m["t1"].feeder_name == "sourcebus_src" + # assert m["t1"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["t1"].loadloss == None # 1.0, loadloss or noloadloss? + assert m["t1"].phase_shift == None + assert m["t1"].is_substation == 0 + # assert m["t1"].normhkva == None # 6600.0 + assert m["t1"].install_type == None + assert m["t1"].from_element == "n2" + assert m["t1"].to_element == "n3" + assert m["t1"].reactances == [float(6)] + # assert m["t1"].positions == None # [] + assert m["t1"].is_center_tap == 0 + # assert m["t1"].substation_name == None # '' + + assert m["t1"].windings[0].connection_type == "Y" + # assert m["t1"].windings[1].connection_type == "Y" # Connection is mentioned as Delta + + assert m["t1"].windings[0].rated_power == 6000 * 10 ** 3 + assert m["t1"].windings[1].rated_power == 6000 * 10 ** 3 + + # assert m["t1"].windings[0].emergency_power == None # 9000000.0 + # assert m["t1"].windings[1].emergency_power == None # 9000000.0 + + assert m["t1"].windings[0].resistance == 0.5 + assert m["t1"].windings[1].resistance == 0.5 + + assert m["t1"].windings[0].voltage_type == None + assert m["t1"].windings[1].voltage_type == None + + assert m["t1"].windings[0].voltage_limit == None + assert m["t1"].windings[1].voltage_limit == None + + assert m["t1"].windings[0].reverse_resistance == None + assert m["t1"].windings[1].reverse_resistance == None + + # assert m["t1"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1"].windings[1].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1"].windings[0].phase_windings[0].phase == "C" # Assumed it is phase 3 + + # assert m["t1"].windings[1].phase_windings[0].phase == "C" # Assumed it is phase 3 + + assert m["t1"].windings[0].phase_windings[0].compensator_r == None + + assert m["t1"].windings[1].phase_windings[0].compensator_r == None + + assert m["t1"].windings[0].phase_windings[0].compensator_x == None + + assert m["t1"].windings[1].phase_windings[0].compensator_x == None + + # Three phase Delta-wye substation Transformer from 4kv SMART-DS region P4U + assert ( + len(m["sb5_p4uhs0_4_trans_439"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["sb5_p4uhs0_4_trans_439"].windings[0].nominal_voltage == 69.0 * 10 ** 3 + assert m["sb5_p4uhs0_4_trans_439"].windings[1].nominal_voltage == 4.0 * 10 ** 3 + + assert m["sb5_p4uhs0_4_trans_439"].feeder_name == "sourcebus_src" + # assert m["sb5_p4uhs0_4_trans_439"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["sb5_p4uhs0_4_trans_439"].loadloss == None # 0.9616652, loadloss or noloadloss? + assert m["sb5_p4uhs0_4_trans_439"].phase_shift == None + assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 + # assert m["sb5_p4uhs0_4_trans_439"].normhkva == None # 8800.0 + assert m["sb5_p4uhs0_4_trans_439"].install_type == None + assert m["sb5_p4uhs0_4_trans_439"].from_element == "sb5_p4uhs0_4_node_5_12" + assert m["sb5_p4uhs0_4_trans_439"].to_element == "sb5_p4uhs0_4_node_5_13" + assert m["sb5_p4uhs0_4_trans_439"].reactances == [pytest.approx(0.9616652224137047)] + # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] + assert m["sb5_p4uhs0_4_trans_439"].is_center_tap == 0 + # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].connection_type == "D" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].connection_type == "Y" + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].rated_power == 8000 * 10 ** 3 + assert m["sb5_p4uhs0_4_trans_439"].windings[1].rated_power == 8000 * 10 ** 3 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].emergency_power == None # 12000000.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].emergency_power == None # 12000000.0 + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].resistance == pytest.approx( + 0.4808326112068522, 0.0000001 + ) + assert m["sb5_p4uhs0_4_trans_439"].windings[1].resistance == pytest.approx( + 0.4808326112068522, 0.0000001 + ) + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].voltage_type == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].voltage_type == None + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].voltage_limit == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].voltage_limit == None + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].reverse_resistance == None + assert m["sb5_p4uhs0_4_trans_439"].windings[1].reverse_resistance == None + + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].phase == "A" + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].phase == "B" + assert m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].phase == "C" + + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].phase == "A" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].phase == "B" + assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].phase == "C" + + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].compensator_r == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].compensator_r == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].compensator_r == None + ) + + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].compensator_r == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].compensator_r == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].compensator_r == None + ) + + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[0].compensator_x == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[1].compensator_x == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[0].phase_windings[2].compensator_x == None + ) + + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[0].compensator_x == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].compensator_x == None + ) + assert ( + m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].compensator_x == None + ) + + # Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U + assert ( + len(m["tr(r:p4udt27-p4udt27lv)"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].nominal_voltage == 4.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].nominal_voltage == 0.48 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)"].feeder_name == "sourcebus_src" + assert m["tr(r:p4udt27-p4udt27lv)"].noload_loss == 0.6 + assert m["tr(r:p4udt27-p4udt27lv)"].loadloss == 1.74408 + assert m["tr(r:p4udt27-p4udt27lv)"].phase_shift == None + assert m["tr(r:p4udt27-p4udt27lv)"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)"].normhkva == 82.5 + assert m["tr(r:p4udt27-p4udt27lv)"].install_type == None + assert m["tr(r:p4udt27-p4udt27lv)"].from_element == "p4udt27" + assert m["tr(r:p4udt27-p4udt27lv)"].to_element == "p4udt27lv" + assert m["tr(r:p4udt27-p4udt27lv)"].reactances == [pytest.approx(3.240000000000000)] + # assert m["tr(r:p4udt27-p4udt27lv)"].positions == None # [] + assert m["tr(r:p4udt27-p4udt27lv)"].is_center_tap == 0 + # assert m["tr(r:p4udt27-p4udt27lv)"].substation_name == None # '' + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].connection_type == "Y" + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].connection_type == "Y" + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].rated_power == 75.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].rated_power == 75.0 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].emergency_power == 112.5 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].emergency_power == 112.5 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].resistance == 0.87204 + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].resistance == 0.87204 + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].voltage_type == None + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].voltage_type == None + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].voltage_limit == None + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].voltage_limit == None + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].reverse_resistance == None + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].reverse_resistance == None + + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[2].phase == "C" + + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[2].phase == "C" + + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[0].compensator_r == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[1].compensator_r == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[2].compensator_r == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[0].compensator_r == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[1].compensator_r == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[2].compensator_r == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[0].compensator_x == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[1].compensator_x == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[0].phase_windings[2].compensator_x == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[0].compensator_x == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[1].compensator_x == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)"].windings[1].phase_windings[2].compensator_x == None + ) + + # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert ( + len(m["tr(r:p4udt27-p4udt27lv)_1"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].nominal_voltage == 4.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].nominal_voltage == 0.48 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_1"].feeder_name == "sourcebus_src" + assert m["tr(r:p4udt27-p4udt27lv)_1"].noload_loss == 0.6 + assert m["tr(r:p4udt27-p4udt27lv)_1"].loadloss == 1.74408 + assert m["tr(r:p4udt27-p4udt27lv)_1"].phase_shift == None + assert m["tr(r:p4udt27-p4udt27lv)_1"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].normhkva == 82.5 + assert m["tr(r:p4udt27-p4udt27lv)_1"].install_type == None + assert m["tr(r:p4udt27-p4udt27lv)_1"].from_element == "p4udt27" + assert m["tr(r:p4udt27-p4udt27lv)_1"].to_element == "p4udt27lv" + assert m["tr(r:p4udt27-p4udt27lv)_1"].reactances == [ + pytest.approx(3.240000000000000) + ] + # assert m["tr(r:p4udt27-p4udt27lv)_1"].positions == None # [] + assert m["tr(r:p4udt27-p4udt27lv)_1"].is_center_tap == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].substation_name == None # '' + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].connection_type == "D" + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].connection_type == "Y" + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].rated_power == 75.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].rated_power == 75.0 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].emergency_power == 112.5 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].emergency_power == 112.5 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].resistance == 0.87204 + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].resistance == 0.87204 + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].voltage_type == None + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].voltage_type == None + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].voltage_limit == None + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].voltage_limit == None + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].reverse_resistance == None + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].reverse_resistance == None + + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[2].phase == "C" + + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[2].phase == "C" + + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].phase_windings[2].compensator_x + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].phase_windings[2].compensator_x + == None + ) + + # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert ( + len(m["tr(r:p4udt27-p4udt27lv)_2"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].nominal_voltage == 4.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].nominal_voltage == 0.48 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_2"].feeder_name == "sourcebus_src" + assert m["tr(r:p4udt27-p4udt27lv)_2"].noload_loss == 0.6 + assert m["tr(r:p4udt27-p4udt27lv)_2"].loadloss == 1.74408 + assert m["tr(r:p4udt27-p4udt27lv)_2"].phase_shift == None + assert m["tr(r:p4udt27-p4udt27lv)_2"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].normhkva == 82.5 + assert m["tr(r:p4udt27-p4udt27lv)_2"].install_type == None + assert m["tr(r:p4udt27-p4udt27lv)_2"].from_element == "p4udt27" + assert m["tr(r:p4udt27-p4udt27lv)_2"].to_element == "p4udt27lv" + assert m["tr(r:p4udt27-p4udt27lv)_2"].reactances == [ + pytest.approx(3.240000000000000) + ] + # assert m["tr(r:p4udt27-p4udt27lv)_2"].positions == None # [] + assert m["tr(r:p4udt27-p4udt27lv)_2"].is_center_tap == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].substation_name == None # '' + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].connection_type == "D" + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].connection_type == "D" + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].rated_power == 75.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].rated_power == 75.0 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].emergency_power == 112.5 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].emergency_power == 112.5 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].resistance == 0.87204 + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].resistance == 0.87204 + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].voltage_type == None + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].voltage_type == None + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].voltage_limit == None + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].voltage_limit == None + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].reverse_resistance == None + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].reverse_resistance == None + + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[2].phase == "C" + + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[2].phase == "C" + + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].phase_windings[2].compensator_x + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].phase_windings[2].compensator_x + == None + ) + + # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert ( + len(m["tr(r:p4udt27-p4udt27lv)_3"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].nominal_voltage == 4.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].nominal_voltage == 0.48 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_3"].feeder_name == "sourcebus_src" + assert m["tr(r:p4udt27-p4udt27lv)_3"].noload_loss == 0.6 + assert m["tr(r:p4udt27-p4udt27lv)_3"].loadloss == 1.74408 + assert m["tr(r:p4udt27-p4udt27lv)_3"].phase_shift == None + assert m["tr(r:p4udt27-p4udt27lv)_3"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].normhkva == 82.5 + assert m["tr(r:p4udt27-p4udt27lv)_3"].install_type == None + assert m["tr(r:p4udt27-p4udt27lv)_3"].from_element == "p4udt27" + assert m["tr(r:p4udt27-p4udt27lv)_3"].to_element == "p4udt27lv" + assert m["tr(r:p4udt27-p4udt27lv)_3"].reactances == [ + pytest.approx(3.240000000000000) + ] + # assert m["tr(r:p4udt27-p4udt27lv)_3"].positions == None # [] + assert m["tr(r:p4udt27-p4udt27lv)_3"].is_center_tap == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].substation_name == None # '' + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].connection_type == "Y" + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].connection_type == "D" + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].rated_power == 75.0 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].rated_power == 75.0 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].emergency_power == 112.5 * 10 ** 3 + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].emergency_power == 112.5 * 10 ** 3 + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].resistance == 0.87204 + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].resistance == 0.87204 + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].voltage_type == None + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].voltage_type == None + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].voltage_limit == None + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].voltage_limit == None + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].reverse_resistance == None + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].reverse_resistance == None + + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[2].phase == "C" + + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[0].phase == "A" + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[1].phase == "B" + assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[2].phase == "C" + + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[0].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[1].compensator_r + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[2].compensator_r + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].phase_windings[2].compensator_x + == None + ) + + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[0].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[1].compensator_x + == None + ) + assert ( + m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].phase_windings[2].compensator_x + == None + ) + + # Center Tap Transformer from 4kV SMART-DS region P4U + assert ( + len(m["tr(r:p4udt25-p4udt25lv)"].windings) == 3 + ) # Transformer tr(r:p4udt25-p4udt25lv) should have 3 Windings + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].nominal_voltage == 2.3094 * 10 ** 3 + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[1].nominal_voltage == 0.120089 * 10 ** 3 + ) + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[2].nominal_voltage == 0.120089 * 10 ** 3 + ) + + assert m["tr(r:p4udt25-p4udt25lv)"].feeder_name == "sourcebus_src" + assert m["tr(r:p4udt25-p4udt25lv)"].noload_loss == 0.472 + assert m["tr(r:p4udt25-p4udt25lv)"].loadloss == 0.798816 + assert m["tr(r:p4udt25-p4udt25lv)"].phase_shift == None + assert m["tr(r:p4udt25-p4udt25lv)"].is_substation == 0 + assert m["tr(r:p4udt25-p4udt25lv)"].normhkva == 27.5 + assert m["tr(r:p4udt25-p4udt25lv)"].install_type == None + assert m["tr(r:p4udt25-p4udt25lv)"].from_element == "p4udt25" + assert m["tr(r:p4udt25-p4udt25lv)"].to_element == "p4udt25lv" + # assert m["tr(r:p4udt25-p4udt25lv)"].reactances == [float(2.4)] + # assert m["tr(r:p4udt25-p4udt25lv)"].positions == None # [] + assert m["tr(r:p4udt25-p4udt25lv)"].is_center_tap == 1 + # assert m["tr(r:p4udt25-p4udt25lv)"].substation_name == None # '' + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].connection_type == "Y" + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].connection_type == "Y" + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].connection_type == "Y" + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].rated_power == 25.0 * 10 ** 3 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].rated_power == 25.0 * 10 ** 3 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].rated_power == 25.0 * 10 ** 3 + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].emergency_power == 37.5 * 10 ** 3 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].emergency_power == 37.5 * 10 ** 3 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].emergency_power == 37.5 * 10 ** 3 + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].resistance == 0.266272 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].resistance == 0.532544 + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].resistance == 0.532544 + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].voltage_type == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].voltage_type == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].voltage_type == None + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].voltage_limit == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].voltage_limit == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].voltage_limit == None + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].reverse_resistance == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].reverse_resistance == None + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].reverse_resistance == None + + # assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].phase_windings[0].tap_position == None # 1.0 + + assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].phase_windings[0].phase == "B" + assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].phase_windings[0].phase == "B" + assert m["tr(r:p4udt25-p4udt25lv)"].windings[2].phase_windings[0].phase == "B" + + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[0].phase_windings[0].compensator_r == None + ) + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[1].phase_windings[0].compensator_r == None + ) + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[2].phase_windings[0].compensator_r == None + ) + + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[0].phase_windings[0].compensator_x == None + ) + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[1].phase_windings[0].compensator_x == None + ) + assert ( + m["tr(r:p4udt25-p4udt25lv)"].windings[2].phase_windings[0].compensator_x == None + ) + + # Center Tap Transformer from IEEE 8500 test case + assert ( + len(m["t21396254a"].windings) == 3 + ) # Transformer t21396254a should have 3 Windings + assert m["t21396254a"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["t21396254a"].windings[1].nominal_voltage == 0.12 * 10 ** 3 + assert m["t21396254a"].windings[2].nominal_voltage == 0.12 * 10 ** 3 + + assert m["t21396254a"].feeder_name == "sourcebus_src" + assert m["t21396254a"].noload_loss == 0.2 + # assert m["t21396254a"].loadloss == None # 1.8 + assert m["t21396254a"].phase_shift == None + assert m["t21396254a"].is_substation == 0 + # assert m["t21396254a"].normhkva == None # 16.5 + assert m["t21396254a"].install_type == None + assert m["t21396254a"].from_element == "l2804253" + assert m["t21396254a"].to_element == "x2804253a" + # assert m["t21396254a"].reactances == [float(2.4)] # [2.04, 2.04, 1.36] + # assert m["t21396254a"].positions == None # [] + assert m["t21396254a"].is_center_tap == 1 + # assert m["t21396254a"].substation_name == None # '' + + # assert m["t21396254a"].windings[0].connection_type == None # Y + # assert m["t21396254a"].windings[1].connection_type == None # Y + # assert m["t21396254a"].windings[2].connection_type == None # Y + + assert m["t21396254a"].windings[0].rated_power == 15 * 10 ** 3 + assert m["t21396254a"].windings[1].rated_power == 15 * 10 ** 3 + assert m["t21396254a"].windings[2].rated_power == 15 * 10 ** 3 + + # assert m["t21396254a"].windings[0].emergency_power == None # 22500.0 + # assert m["t21396254a"].windings[1].emergency_power == None # 22500.0 + # assert m["t21396254a"].windings[2].emergency_power == None # 22500.0 + + assert m["t21396254a"].windings[0].resistance == 0.6 + assert m["t21396254a"].windings[1].resistance == 1.2 + assert m["t21396254a"].windings[2].resistance == 1.2 + + assert m["t21396254a"].windings[0].voltage_type == None + assert m["t21396254a"].windings[1].voltage_type == None + assert m["t21396254a"].windings[2].voltage_type == None + + assert m["t21396254a"].windings[0].voltage_limit == None + assert m["t21396254a"].windings[1].voltage_limit == None + assert m["t21396254a"].windings[2].voltage_limit == None + + assert m["t21396254a"].windings[0].reverse_resistance == None + assert m["t21396254a"].windings[1].reverse_resistance == None + assert m["t21396254a"].windings[2].reverse_resistance == None + + # assert m["t21396254a"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["t21396254a"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["t21396254a"].windings[2].phase_windings[0].tap_position == None # 1.0 + + assert m["t21396254a"].windings[0].phase_windings[0].phase == "A" + assert m["t21396254a"].windings[1].phase_windings[0].phase == "A" + assert m["t21396254a"].windings[2].phase_windings[0].phase == "A" + + assert m["t21396254a"].windings[0].phase_windings[0].compensator_r == None + assert m["t21396254a"].windings[1].phase_windings[0].compensator_r == None + assert m["t21396254a"].windings[2].phase_windings[0].compensator_r == None + + assert m["t21396254a"].windings[0].phase_windings[0].compensator_x == None + assert m["t21396254a"].windings[1].phase_windings[0].compensator_x == None + assert m["t21396254a"].windings[2].phase_windings[0].compensator_x == None + + # Single phase Wye-Wye Transformer (for regulator) From IEEE 8500 Test case + assert ( + len(m["feeder_rega"].windings) == 2 + ) # Transformer feeder_rega should have 2 Windings + assert m["feeder_rega"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["feeder_rega"].windings[1].nominal_voltage == 7.2 * 10 ** 3 + + assert m["feeder_rega"].feeder_name == "sourcebus_src" + # assert m["feeder_rega"].noload_loss == None # 0.0 + assert m["feeder_rega"].loadloss == 0.001 + assert m["feeder_rega"].phase_shift == None + assert m["feeder_rega"].is_substation == 0 + # assert m["feeder_rega"].normhkva == None # 30250.0 + assert m["feeder_rega"].install_type == None + assert m["feeder_rega"].from_element == "regxfmr_hvmv_sub_lsb" + assert m["feeder_rega"].to_element == "_hvmv_sub_lsb" + assert m["feeder_rega"].reactances == [0.1] + # assert m["feeder_rega"].positions == None # [] + assert m["feeder_rega"].is_center_tap == 0 + # assert m["feeder_rega"].substation_name == None # '' + + # assert m["feeder_rega"].windings[0].connection_type == None # Y + # assert m["feeder_rega"].windings[1].connection_type == None # Y + + assert m["feeder_rega"].windings[0].rated_power == 27500 * 10 ** 3 + assert m["feeder_rega"].windings[1].rated_power == 27500 * 10 ** 3 + + # assert m["feeder_rega"].windings[0].emergency_power == None # 41250000.0 + # assert m["feeder_rega"].windings[1].emergency_power == None # 41250000.0 + + # assert m["feeder_rega"].windings[0].resistance == None # 0.0005 + # assert m["feeder_rega"].windings[1].resistance == None # 0.0005 + + assert m["feeder_rega"].windings[0].voltage_type == None + assert m["feeder_rega"].windings[1].voltage_type == None + + assert m["feeder_rega"].windings[0].voltage_limit == None + assert m["feeder_rega"].windings[1].voltage_limit == None + + assert m["feeder_rega"].windings[0].reverse_resistance == None + assert m["feeder_rega"].windings[1].reverse_resistance == None + + # assert m["feeder_rega"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["feeder_rega"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["feeder_rega"].windings[0].phase_windings[0].phase == "A" + assert m["feeder_rega"].windings[1].phase_windings[0].phase == "A" + + assert m["feeder_rega"].windings[0].phase_windings[0].compensator_r == None + assert m["feeder_rega"].windings[1].phase_windings[0].compensator_r == None + + assert m["feeder_rega"].windings[0].phase_windings[0].compensator_x == None + assert m["feeder_rega"].windings[1].phase_windings[0].compensator_x == None + + # Single phase Wye-Wye Transformers from Epri J-1 Feeder + assert ( + len(m["b13659-1c"].windings) == 2 + ) # Transformer b13659-1c should have 2 Windings + assert m["b13659-1c"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["b13659-1c"].windings[1].nominal_voltage == 0.24 * 10 ** 3 + + assert m["b13659-1c"].feeder_name == "sourcebus_src" + assert m["b13659-1c"].noload_loss == 0.34 + assert m["b13659-1c"].loadloss == 1.04 + assert m["b13659-1c"].phase_shift == None + assert m["b13659-1c"].is_substation == 0 + assert m["b13659-1c"].normhkva == 15 + assert m["b13659-1c"].install_type == None + assert m["b13659-1c"].from_element == "b13659" + assert m["b13659-1c"].to_element == "x_b13659-c" + assert m["b13659-1c"].reactances == [1.5] + # assert m["b13659-1c"].positions == None # [] + assert m["b13659-1c"].is_center_tap == 0 + # assert m["b13659-1c"].substation_name == None # '' + + assert m["b13659-1c"].windings[0].connection_type == "Y" + assert m["b13659-1c"].windings[1].connection_type == "Y" + + assert m["b13659-1c"].windings[0].rated_power == 15 * 10 ** 3 + assert m["b13659-1c"].windings[1].rated_power == 15 * 10 ** 3 + + assert m["b13659-1c"].windings[1].emergency_power == 21 * 10 ** 3 + assert m["b13659-1c"].windings[1].emergency_power == 21 * 10 ** 3 + + # assert m["b13659-1c"].windings[0].resistance == None # 0.52 + # assert m["b13659-1c"].windings[1].resistance == None # 0.52 + + assert m["b13659-1c"].windings[0].voltage_type == None + assert m["b13659-1c"].windings[1].voltage_type == None + + assert m["b13659-1c"].windings[0].voltage_limit == None + assert m["b13659-1c"].windings[1].voltage_limit == None + + assert m["b13659-1c"].windings[0].reverse_resistance == None + assert m["b13659-1c"].windings[1].reverse_resistance == None + + # assert m["b13659-1c"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["b13659-1c"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["b13659-1c"].windings[0].phase_windings[0].phase == "C" + assert m["b13659-1c"].windings[1].phase_windings[0].phase == "C" + + assert m["b13659-1c"].windings[0].phase_windings[0].compensator_r == None + assert m["b13659-1c"].windings[1].phase_windings[0].compensator_r == None + + assert m["b13659-1c"].windings[0].phase_windings[0].compensator_x == None + assert m["b13659-1c"].windings[1].phase_windings[0].compensator_x == None + + assert ( + len(m["b4551-1a"].windings) == 2 + ) # Transformer b4551-1a should have 2 Windings + assert m["b4551-1a"].windings[0].nominal_voltage == 7.2 * 10 ** 3 + assert m["b4551-1a"].windings[1].nominal_voltage == 0.24 * 10 ** 3 + + assert m["b4551-1a"].feeder_name == "sourcebus_src" + assert m["b4551-1a"].noload_loss == 0.34 + assert m["b4551-1a"].loadloss == 1.04 + assert m["b4551-1a"].phase_shift == None + assert m["b4551-1a"].is_substation == 0 + assert m["b4551-1a"].normhkva == 15 + assert m["b4551-1a"].install_type == None + assert m["b4551-1a"].from_element == "b4551" + assert m["b4551-1a"].to_element == "x_b4551-a" + assert m["b4551-1a"].reactances == [1.5] + # assert m["b4551-1a"].positions == None # [] + assert m["b4551-1a"].is_center_tap == 0 + # assert m["b4551-1a"].substation_name == None # '' + + # assert m["b4551-1a"].windings[0].connection_type == None # Y + # assert m["b4551-1a"].windings[1].connection_type == None # Y + + assert m["b4551-1a"].windings[0].rated_power == 15 * 10 ** 3 + assert m["b4551-1a"].windings[1].rated_power == 15 * 10 ** 3 + + assert m["b4551-1a"].windings[1].emergency_power == 21 * 10 ** 3 + assert m["b4551-1a"].windings[1].emergency_power == 21 * 10 ** 3 + + # assert m["b4551-1a"].windings[0].resistance == None # 0.52 + # assert m["b4551-1a"].windings[1].resistance == None # 0.52 + + assert m["b4551-1a"].windings[0].voltage_type == None + assert m["b4551-1a"].windings[1].voltage_type == None + + assert m["b4551-1a"].windings[0].voltage_limit == None + assert m["b4551-1a"].windings[1].voltage_limit == None + + assert m["b4551-1a"].windings[0].reverse_resistance == None + assert m["b4551-1a"].windings[1].reverse_resistance == None + + # assert m["b4551-1a"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["b4551-1a"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["b4551-1a"].windings[0].phase_windings[0].phase == "A" + assert m["b4551-1a"].windings[1].phase_windings[0].phase == "A" + + assert m["b4551-1a"].windings[0].phase_windings[0].compensator_r == None + assert m["b4551-1a"].windings[1].phase_windings[0].compensator_r == None + + assert m["b4551-1a"].windings[0].phase_windings[0].compensator_x == None + assert m["b4551-1a"].windings[1].phase_windings[0].compensator_x == None + + # Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U + assert ( + len(m["5865228330a-1abc"].windings) == 2 + ) # Transformer should have 2 Windings + assert m["5865228330a-1abc"].windings[0].nominal_voltage == 12.47 * 10 ** 3 + assert m["5865228330a-1abc"].windings[1].nominal_voltage == 0.416 * 10 ** 3 + + assert m["5865228330a-1abc"].feeder_name == "sourcebus_src" + assert m["5865228330a-1abc"].noload_loss == 0.05 + assert m["5865228330a-1abc"].loadloss == 0.7 + assert m["5865228330a-1abc"].phase_shift == None + assert m["5865228330a-1abc"].is_substation == 0 + assert m["5865228330a-1abc"].normhkva == 2000.01 + assert m["5865228330a-1abc"].install_type == None + assert m["5865228330a-1abc"].from_element == "5865228330a" + assert m["5865228330a-1abc"].to_element == "x_5865228330a" + assert m["5865228330a-1abc"].reactances == [5] + # assert m["5865228330a-1abc"].positions == None # [] + assert m["5865228330a-1abc"].is_center_tap == 0 + # assert m["5865228330a-1abc"].substation_name == None # '' + + # assert m["5865228330a-1abc"].windings[0].connection_type == None # Y + # assert m["5865228330a-1abc"].windings[1].connection_type == None # Y + + assert m["5865228330a-1abc"].windings[0].rated_power == 2000 * 10 ** 3 + assert m["5865228330a-1abc"].windings[1].rated_power == 2000 * 10 ** 3 + + assert m["5865228330a-1abc"].windings[0].emergency_power == 2800 * 10 ** 3 + assert m["5865228330a-1abc"].windings[1].emergency_power == 2800 * 10 ** 3 + + # assert m["5865228330a-1abc"].windings[0].resistance == None # 0.35 + # assert m["5865228330a-1abc"].windings[1].resistance == None # 0.35 + + assert m["5865228330a-1abc"].windings[0].voltage_type == None + assert m["5865228330a-1abc"].windings[1].voltage_type == None + + assert m["5865228330a-1abc"].windings[0].voltage_limit == None + assert m["5865228330a-1abc"].windings[1].voltage_limit == None + + assert m["5865228330a-1abc"].windings[0].reverse_resistance == None + assert m["5865228330a-1abc"].windings[1].reverse_resistance == None + + # assert m["5865228330a-1abc"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["5865228330a-1abc"].windings[0].phase_windings[1].tap_position == None # 1.0 + # assert m["5865228330a-1abc"].windings[0].phase_windings[2].tap_position == None # 1.0 + + # assert m["5865228330a-1abc"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["5865228330a-1abc"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["5865228330a-1abc"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["5865228330a-1abc"].windings[0].phase_windings[0].phase == "A" + assert m["5865228330a-1abc"].windings[0].phase_windings[1].phase == "B" + assert m["5865228330a-1abc"].windings[0].phase_windings[2].phase == "C" + + assert m["5865228330a-1abc"].windings[1].phase_windings[0].phase == "A" + assert m["5865228330a-1abc"].windings[1].phase_windings[1].phase == "B" + assert m["5865228330a-1abc"].windings[1].phase_windings[2].phase == "C" + + assert m["5865228330a-1abc"].windings[0].phase_windings[0].compensator_r == None + assert m["5865228330a-1abc"].windings[0].phase_windings[1].compensator_r == None + assert m["5865228330a-1abc"].windings[0].phase_windings[2].compensator_r == None + + assert m["5865228330a-1abc"].windings[1].phase_windings[0].compensator_r == None + assert m["5865228330a-1abc"].windings[1].phase_windings[1].compensator_r == None + assert m["5865228330a-1abc"].windings[1].phase_windings[2].compensator_r == None + + assert m["5865228330a-1abc"].windings[0].phase_windings[0].compensator_x == None + assert m["5865228330a-1abc"].windings[0].phase_windings[1].compensator_x == None + assert m["5865228330a-1abc"].windings[0].phase_windings[2].compensator_x == None + + assert m["5865228330a-1abc"].windings[1].phase_windings[0].compensator_x == None + assert m["5865228330a-1abc"].windings[1].phase_windings[1].compensator_x == None + assert m["5865228330a-1abc"].windings[1].phase_windings[2].compensator_x == None + + # Single phase delta-wye transformer. This is a dummy test as we don't expect to see delta configurations on a single phase + assert len(m["t1_1"].windings) == 2 # Transformer t1_1 should have 2 Windings + assert m["t1_1"].windings[0].nominal_voltage == 12.47 * 10 ** 3 + assert m["t1_1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 + + assert m["t1_1"].feeder_name == "sourcebus_src" + # assert m["t1_1"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["t1_1"].loadloss == None # 1.0, loadloss or noloadloss? + assert m["t1_1"].phase_shift == None + assert m["t1_1"].is_substation == 0 + # assert m["t1_1"].normhkva == None # 6600.0 + assert m["t1_1"].install_type == None + assert m["t1_1"].from_element == "n2" + assert m["t1_1"].to_element == "n3" + assert m["t1_1"].reactances == [float(6)] + # assert m["t1_1"].positions == None # [] + assert m["t1_1"].is_center_tap == 0 + # assert m["t1_1"].substation_name == None # '' + + assert m["t1_1"].windings[0].connection_type == "D" + assert m["t1_1"].windings[1].connection_type == "Y" + + assert m["t1_1"].windings[0].rated_power == 6000 * 10 ** 3 + assert m["t1_1"].windings[1].rated_power == 6000 * 10 ** 3 + + # assert m["t1_1"].windings[0].emergency_power == None # 9000000.0 + # assert m["t1_1"].windings[1].emergency_power == None # 9000000.0 + + assert m["t1_1"].windings[0].resistance == 0.5 + assert m["t1_1"].windings[1].resistance == 0.5 + + assert m["t1_1"].windings[0].voltage_type == None + assert m["t1_1"].windings[1].voltage_type == None + + assert m["t1_1"].windings[0].voltage_limit == None + assert m["t1_1"].windings[1].voltage_limit == None + + assert m["t1_1"].windings[0].reverse_resistance == None + assert m["t1_1"].windings[1].reverse_resistance == None + + # assert m["t1_1"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1_1"].windings[1].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1_1"].windings[0].phase_windings[0].phase == "C" # Assumed it is phase 3 + # assert m["t1_1"].windings[1].phase_windings[0].phase == "C" # Assumed it is phase 3 + + assert m["t1_1"].windings[0].phase_windings[0].compensator_r == None + + assert m["t1_1"].windings[1].phase_windings[0].compensator_r == None + + assert m["t1_1"].windings[0].phase_windings[0].compensator_x == None + + assert m["t1_1"].windings[1].phase_windings[0].compensator_x == None + + # Single phase wye-delta transformer. This is a dummy test as we don't expect to see delta configurations on a single phase + assert len(m["t1_2"].windings) == 2 # Transformer t1_2 should have 2 Windings + assert m["t1_2"].windings[0].nominal_voltage == 12.47 * 10 ** 3 + assert m["t1_2"].windings[1].nominal_voltage == 4.16 * 10 ** 3 + + assert m["t1_2"].feeder_name == "sourcebus_src" + # assert m["t1_2"].noload_loss == None # 0.0 #loadloss or noloadloss? + # assert m["t1_2"].loadloss == None # 1.0, loadloss or noloadloss? + assert m["t1_2"].phase_shift == None + assert m["t1_2"].is_substation == 0 + # assert m["t1_2"].normhkva == None # 6600.0 + assert m["t1_2"].install_type == None + assert m["t1_2"].from_element == "n2" + assert m["t1_2"].to_element == "n3" + assert m["t1_2"].reactances == [float(6)] + # assert m["t1_2"].positions == None # [] + assert m["t1_2"].is_center_tap == 0 + # assert m["t1_2"].substation_name == None # '' + + assert m["t1_2"].windings[0].connection_type == "Y" + assert m["t1_2"].windings[1].connection_type == "D" + + assert m["t1_2"].windings[0].rated_power == 6000 * 10 ** 3 + assert m["t1_2"].windings[1].rated_power == 6000 * 10 ** 3 + + # assert m["t1_2"].windings[0].emergency_power == None # 9000000.0 + # assert m["t1_2"].windings[1].emergency_power == None # 9000000.0 + + assert m["t1_2"].windings[0].resistance == 0.5 + assert m["t1_2"].windings[1].resistance == 0.5 + + assert m["t1_2"].windings[0].voltage_type == None + assert m["t1_2"].windings[1].voltage_type == None + + assert m["t1_2"].windings[0].voltage_limit == None + assert m["t1_2"].windings[1].voltage_limit == None + + assert m["t1_2"].windings[0].reverse_resistance == None + assert m["t1_2"].windings[1].reverse_resistance == None + + # assert m["t1_2"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1_2"].windings[1].phase_windings[0].tap_position == None # 1.0 + + # assert m["t1_2"].windings[0].phase_windings[0].phase == "C" # Assumed it is phase 3 + # assert m["t1_2"].windings[1].phase_windings[0].phase == "C" # Assumed it is phase 3 + + assert m["t1_2"].windings[0].phase_windings[0].compensator_r == None + + assert m["t1_2"].windings[1].phase_windings[0].compensator_r == None + + assert m["t1_2"].windings[0].phase_windings[0].compensator_x == None + + assert m["t1_2"].windings[1].phase_windings[0].compensator_x == None From bb6b93bb3ef4826fe81200883639a5f268d63053 Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Thu, 15 Nov 2018 16:09:59 -0700 Subject: [PATCH 11/25] Removed the swap file --- .../opendss/Powersource/test_powersource.py~ | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 tests/readers/opendss/Powersource/test_powersource.py~ diff --git a/tests/readers/opendss/Powersource/test_powersource.py~ b/tests/readers/opendss/Powersource/test_powersource.py~ deleted file mode 100644 index 5b9bbe59..00000000 --- a/tests/readers/opendss/Powersource/test_powersource.py~ +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -test_powersource.py ----------------------------------- - -Tests for parsing all values of power source from OpenDSS into DiTTo. -""" - -import os -import math -import pytest -import numpy as np - -from ditto.store import Store -from ditto.readers.opendss.read import Reader - -current_directory = os.path.realpath(os.path.dirname(__file__)) - - -def test_powersource(): - m = Store() - r = Reader(master_file=os.path.join(current_directory, "test_powersource.dss")) - r.parse(m) - m.set_names() - - assert m["Vsource.source"].nominal_voltage == 230.0 * 10 ** 3 - assert m["Vsource.source"].per_unit == 0.99 - assert m["Vsource.source"].is_sourcebus == 1 -# assert m["Vsource.source"].rated_power == None # 100000000.0 -# assert m["Vsource.source"].emergency_power == None # 14331000000.0 - assert m["Vsource.source"].zero_sequence_impedance == 1.1208 + 3.5169j - assert m["Vsource.source"].positive_sequence_impedance == 1.1208 + 3.5169j -# assert m["Vsource.source"].phase_angle == None # 0.0 - assert m["Vsource.source"].connecting_element == "st_mat" - -# assert m["Vsource.source"].phases == None # [] -# assert m["Vsource.source"].positions == None # [] - assert m["Vsource.source"].connection_type == None - assert m["Vsource.source"].cutout_percent == None - assert m["Vsource.source"].cutin_percent == None - assert m["Vsource.source"].resistance == None - assert m["Vsource.source"].reactance == None - assert m["Vsource.source"].v_max_pu == None - assert m["Vsource.source"].v_min_pu == None - assert m["Vsource.source"].power_factor == None From 23cc6658da0233b42648ebb47838bafd7eb17f18 Mon Sep 17 00:00:00 2001 From: telgindy Date: Tue, 27 Nov 2018 10:25:58 -0700 Subject: [PATCH 12/25] adding fuse test cases --- tests/readers/opendss/Lines/test_fuses.dss | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/readers/opendss/Lines/test_fuses.dss diff --git a/tests/readers/opendss/Lines/test_fuses.dss b/tests/readers/opendss/Lines/test_fuses.dss new file mode 100644 index 00000000..1caf3100 --- /dev/null +++ b/tests/readers/opendss/Lines/test_fuses.dss @@ -0,0 +1,21 @@ +Clear + +New circuit.test_fuses basekv=12.47 pu=1.01 phases=3 bus1=sourcebus + +New Line.origin Units=km Length=0.001 bus1=sourcebus bus2=node1 phases=3 + +New Line.line1 Units=km Length=0.001 bus1=node1.1.2.3 bus2=node2.1.2.3 switch=n enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 +New Fuse.Fuse_1 monitoredobj=Line.line1 enabled=y + +New Line.line2 Units=km Length=0.001 bus1=node1.1 bus2=node3.1 switch=n enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 +New Fuse.Fuse_2 monitoredobj=Line.line2 enabled=y + +New Line.line3 Units=km Length=0.001 bus1=node1.3 bus2=node4.3 switch=n enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 +New Fuse.Fuse_3 monitoredobj=Line.line3 enabled=y + +New Line.line4 Units=km Length=0.001 bus1=node1.2.3 bus2=node4.2.3 switch=n enabled=y phases=2 Normamps=3000 EmergencyAmps=4000 +New Fuse.Fuse_4 monitoredobj=Line.line4 enabled=y + +Set Voltagebases=[12.47] +Calcvoltagebases +Solve From 7abc130e4cde898b69dfe03c368f88ceff71367f Mon Sep 17 00:00:00 2001 From: telgindy Date: Tue, 27 Nov 2018 10:51:15 -0700 Subject: [PATCH 13/25] ephasor transformers left-shifted and phase angle set by phase regardless of if one,two or three phase --- ditto/formats/gridlabd/base.py | 4 +- ditto/formats/gridlabd/schema.json | 6 + ditto/readers/gridlabd/read.py | 158 +++++++++++++- ditto/readers/opendss/read.py | 7 +- ditto/writers/ephasor/write.py | 199 ++++++++++-------- examples/cli/config.json | 4 +- tests/readers/opendss/Lines/test_switches.dss | 25 +++ 7 files changed, 299 insertions(+), 104 deletions(-) create mode 100644 tests/readers/opendss/Lines/test_switches.dss diff --git a/ditto/formats/gridlabd/base.py b/ditto/formats/gridlabd/base.py index e27b7941..d50c7ea3 100644 --- a/ditto/formats/gridlabd/base.py +++ b/ditto/formats/gridlabd/base.py @@ -29,7 +29,7 @@ def __getitem__(self, k): def __setitem__(self, k, v): if k not in [p["name"] for p in self._properties]: - raise AttributeError( - "Unable to set {} with {} on {}".format(k, v, self.__class__.__name__) + print( + "Warning: Unable to set {} with {} on {}".format(k, v, self.__class__.__name__) ) return setattr(self, "_{}".format(k), v) diff --git a/ditto/formats/gridlabd/schema.json b/ditto/formats/gridlabd/schema.json index 79fbe8bd..c55b3393 100644 --- a/ditto/formats/gridlabd/schema.json +++ b/ditto/formats/gridlabd/schema.json @@ -701,6 +701,12 @@ ] }, + "house":{ + "parent":"node", + "properties":[ + ] + }, + "load": { "parent": "node", "properties": [ diff --git a/ditto/readers/gridlabd/read.py b/ditto/readers/gridlabd/read.py index 796c9a8b..dec6dc7a 100644 --- a/ditto/readers/gridlabd/read.py +++ b/ditto/readers/gridlabd/read.py @@ -526,12 +526,12 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): obj = entries[1].split(":") obj_class = obj[0] if ( - obj_class == "house" - or obj_class == "solar" + #obj_class == "house" + obj_class == "solar" or obj_class == "inverter" or obj_class == "waterheater" or obj_class == "climate" - or obj_class == "ZIPload" + #or obj_class == "ZIPload" or obj_class == "tape.recorder" or obj_class == "player" or obj_class == "tape.collector" @@ -655,7 +655,7 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): except AttributeError: pass - if obj_type == "triplex_node" or obj_type == "triplex_meter": + if obj_type == "triplex_node" or obj_type == "triplex_meter" or obj_type == "house": api_node = Node(model) try: api_node.name = obj["name"] @@ -679,6 +679,16 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): api_node.phases = phases except AttributeError: pass + try: + parent = obj["parent"] + # Create a dummy line from house node to the parent + api_line = Line(model) + api_line.name=api_node.name+"_"+parent + api_line.from_element = parent + api_line.to_element = api_node.name + api_line.length = 0.01 + except: + pass if obj_type == "transformer": @@ -917,7 +927,7 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): windings.append(winding3) api_transformer.windings = windings - if obj_type == "load": + if obj_type == "load" or obj_type=="ZIPload": api_load = Load(model) api_node = None @@ -955,7 +965,7 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): if not has_parent: api_node.phases = list(map(lambda x: Unicode(x), phases)) except AttributeError: - pass + phases = [''] num_phases = 0 # The use_zip parameter is used to determine whether the load is zip or not. @@ -1348,8 +1358,140 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): phaseloads.append(phaseload) + else: + num_phases = num_phases + 1 + phaseload = PhaseLoad(model) + phaseload.phase = phase + phaseload.p = 0 # Default value + phaseload.q = 0 + try: + complex_power = complex(obj["constant_power"]) + p = complex_power.real + q = complex_power.imag + if ( + p != 0 + ): # Assume that unless ZIP is specifically specified only one of constant_power, constant_current and constant_impedance is used. A real part of 0 means that I or Z is being used instead. + phaseload.p = p + phaseload.q = q + phaseload.model = ( + 1 + ) # The opendss model number (specifying constant power) + phaseload.use_zip = 0 + phaseloads.append(phaseload) + continue + except AttributeError: + pass + + try: + # Firstly check if it's using a non-zip model. + complex_impedance = complex(obj["constant_impedance"]) + complex_voltage = complex( + obj["voltage"] + ) # Needed to compute the power + if ( + complex_impedance.real != 0 + ): # Assume that unless ZIP is specifically specified only one of constant_power, constant_current and constant_impedance is used. A real part of 0 means that I or P is being used instead. + p = ( + ( + ( + complex_voltage.real ** 2 + + complex_voltage.imag ** 2 + ) + ) + / complex_impedance.conjugate() + ).real + q = ( + ( + ( + complex_voltage.real ** 2 + + complex_voltage.imag ** 2 + ) + ) + / complex_impedance.conjugate() + ).imag + phaseload.p = p + phaseload.q = q + phaseload.model = ( + 2 + ) # The opendss model number (specifying constant impedance) + phaseload.use_zip = 0 + phaseloads.append(phaseload) + continue + except AttributeError: + pass + + try: + # Firstly check if it's using a non-zip model. + complex_current = complex(obj["constant_current"]) + complex_voltage = complex( + obj["voltage"] + ) # Needed to compute the power + p = (complex_voltage * complex_current.conjugate()).real + q = (complex_voltage * complex_current.conjugate()).imag + if ( + complex_current.real != 0 + ): # Assume that unless ZIP is specifically specified only one of constant_power, constant_current and constant_impedance is used. A real part of 0 means that Z or P is being used instead. + phaseload.p = p + phaseload.q = q + phaseload.use_zip = 0 + phaseload.model = ( + 5 + ) # The opendss model number (specifying constant current) + phaseloads.append(phaseload) + continue + except AttributeError: + pass + + try: + base_power = float(obj["base_power"]) + p = base_power + phaseload.p = p + except AttributeError: + pass + except ValueError: + data = obj["base_power"].split("*") + if data[0] in all_schedules: + phaseload.p = float(all_schedules[data[0]]) * float( + data[1] + ) + if data[1] in all_schedules: + phaseload.p = float(all_schedules[data[1]]) * float( + data[0] + ) + + try: + # Require all six elements to compute the ZIP load model + current_fraction = float(obj["current_fraction"]) + current_pf = float(obj["current_pf"]) + power_fraction = float(obj["power_fraction"]) + power_pf = float(obj["power_pf"]) + impedance_fraction = float(obj["impedance_fraction"]) + impedance_pf = float(obj["impedance_pf"]) + + phaseload.ppercentcurrent = current_fraction * current_pf + phaseload.qpercentcurrent = current_fraction * ( + 1 - current_pf + ) + phaseload.ppercentpower = power_fraction * power_pf + phaseload.qpercentpower = power_fraction * (1 - power_pf) + phaseload.ppercentimpedance = ( + impedance_fraction * impedance_pf + ) + phaseload.qpercentimpedance = impedance_fraction * ( + 1 - impedance_pf + ) + phaseload.use_zip = 1 + except AttributeError: + pass + + phaseloads.append(phaseload) + + if num_phases > 0: api_load.phase_loads = phaseloads + else: + import pdb;pdb.set_trace() + if obj_type == "fuse": api_line = Line(model) @@ -2182,12 +2324,12 @@ def parse(self, model, origin_datetime="2017 Jun 1 2:00PM"): pass try: - api_regulator.high_from = obj["from"] + api_regulator.from_element = obj["from"] except AttributeError: pass try: - api_regulator.low_to = obj["to"] + api_regulator.to_element = obj["to"] except AttributeError: pass diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index 897c9a3a..bd3772f6 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -702,13 +702,13 @@ def parse_lines(self, model): # If the line is disabled we ignore it unless it's a switch fuses = dss.utils.class_to_dataframe("Fuse") fuses_names = [ - d["MonitoredObj"][0].lower().split(".")[1] for name, d in fuses.items() + d["MonitoredObj"].lower().split(".")[1] for name, d in fuses.items() ] # In the same way, reclosers are also attached to line objects reclosers = dss.utils.class_to_dataframe("recloser") reclosers_names = [ - d["MonitoredObj"][0].lower().split(".")[1] for name, d in reclosers.items() + d["MonitoredObj"].lower().split(".")[1] for name, d in reclosers.items() ] start = time.time() @@ -1206,6 +1206,7 @@ def parse_lines(self, model): this_line_wireData_code = this_line_geometry["wire"] # If empty, convert it to None + this_line_wireData = None if this_line_wireData_code == "": this_line_wireData_code = None @@ -1224,8 +1225,6 @@ def parse_lines(self, model): ) ) pass - else: - this_line_wireData = None # If we have valid WireData if this_line_wireData is not None: diff --git a/ditto/writers/ephasor/write.py b/ditto/writers/ephasor/write.py index de5f3f04..ea2e7166 100644 --- a/ditto/writers/ephasor/write.py +++ b/ditto/writers/ephasor/write.py @@ -167,7 +167,7 @@ def switch(self): obj_dict["Switch Name"].append( line.name + "_" + wire.phase.lower() ) - if hasattr(line, "is_open") and line.is_open == 1: + if hasattr(wire, "is_open") and wire.is_open == 1: obj_dict["Normal Status"].append("0") else: obj_dict["Normal Status"].append("1") @@ -306,13 +306,11 @@ def line(self): np.real(line.length), units ) + tmp_phase=['a','b','c'] if hasattr(line, "from_element") and line.from_element is not None: logger.debug(" bus1={from_el}".format(from_el=line.from_element)) if hasattr(line, "wires") and line.wires is not None: - for temp_phase in ["a", "b", "c"]: - obj_dict["bus0" + temp_phase][index] = ( - line.from_element + "_" + temp_phase - ) + wire_cnt = 0 for wire in line.wires: if ( hasattr(wire, "phase") @@ -320,18 +318,16 @@ def line(self): and wire.phase != "N" ): # logger.debug('.{p}'.format(p=self.phase_mapping(wire.phase))) - obj_dict["bus0" + wire.phase.lower()][index] = ( - line.from_element + "_" + wire.phase.lower() - ) - # obj_dict['bus1' + wire.phase.lower()][index] = line.to_element+ "_" + wire.phase.lower() + # obj_dict["bus0" + wire.phase.lower()][index] = ( + # line.from_element + "_" + wire.phase.lower() + # ) + obj_dict["bus0"+tmp_phase[wire_cnt]][index] = line.from_element+"_"+wire.phase.lower() + wire_cnt+=1 if hasattr(line, "to_element") and line.to_element is not None: logger.debug(" bus2={to_el}".format(to_el=line.to_element)) if hasattr(line, "wires") and line.wires is not None: - for temp_phase in ["a", "b", "c"]: - obj_dict["bus1" + temp_phase][index] = ( - line.to_element + "_" + temp_phase - ) + wire_cnt = 0 for wire in line.wires: if ( hasattr(wire, "phase") @@ -339,11 +335,12 @@ def line(self): and wire.phase != "N" ): # logger.debug('.{p}'.format(p=self.phase_mapping(wire.phase))) - obj_dict["bus1" + wire.phase.lower()][index] = ( - line.to_element + "_" + wire.phase.lower() - ) + # obj_dict["bus1" + wire.phase.lower()][index] = ( + # line.to_element + "_" + wire.phase.lower() + # ) + obj_dict["bus1"+tmp_phase[wire_cnt]][index] = line.to_element+"_"+wire.phase.lower() + wire_cnt+=1 - # obj_dict['bus1' + wire.phase.lower()][index] = line.from_element if ( hasattr(line, "faultrate") @@ -362,7 +359,7 @@ def line(self): R = np.real(Z) # Resistance matrix X = np.imag(Z) # Reactance matrix except: - logger.error( + self.logger.error( "Problem with impedance matrix in line {name}".format( name=line.name ) @@ -422,7 +419,7 @@ def line(self): C = np.array(line.capacitance_matrix) kf2mil = 0.189394 result += "Bmatrix=(" - for rc, row in enumerate(Z): + for rc, row in enumerate(C): #Should only be a real matrix for ec, elt in enumerate(row): num_str = str(ec + 1) + str(rc + 1) if num_str in valid: @@ -436,16 +433,19 @@ def line(self): # -.602 siemens per mile # convet to micor se B = 0 - if np.imag(elt) != 0: - B = 1 / self.convert_from_meters( - np.imag(elt), units, inverse=True - ) - logger.debug("Sub ", B) - B = 1 / (np.imag(elt) * line.length) - + # if np.imag(elt) != 0: + # B = 1 / self.convert_from_meters( + # np.imag(elt), units, inverse=True + # )*1e3*2*60*math.pi + if elt !=0: + B = np.real(self.convert_from_meters( + elt, units, inverse=True + )*1e-3*2*60*math.pi) + + #import pdb;pdb.set_trace() logger.debug("Siemens line units ", B) - logger.debug(np.imag(B) * 0.000621371) - B = np.imag(B) * 0.000621371 * 1e6 + # logger.debug(np.imag(B) * 0.000621371) + # B = np.imag(B) * 0.000621371 * 1e6 logger.debug("done", B) # B = self.convert_from_meters(np.imag(B), units, inverse=True) @@ -466,6 +466,7 @@ def line(self): # print B # print line.name # exit(0) + obj_dict[name][index] = B result += "{e} ".format( e=self.convert_from_meters( np.real(elt), units, inverse=True @@ -497,7 +498,6 @@ def line(self): np.real(B), units, inverse=False ) B = B * 1e6 - obj_dict[name][index] = B # print "Siemens line units ", B /(2.6526) # obj_dict[name][index] = B /(2.6526) @@ -692,7 +692,7 @@ def transformer(self): index ] = "delta" else: - logger.error( + self.logger.error( "Unsupported type of connection {conn} for transformer {name}".format( conn=winding.connection_type, name=i.name ) @@ -710,15 +710,17 @@ def transformer(self): hasattr(winding, "phase_windings") and winding.phase_windings is not None ): + phase_cnt = 0 + phases = ['A','B','C'] N_phases.append(len(winding.phase_windings)) for pw in winding.phase_windings: - obj_dict["W1Bus " + pw.phase][index] = ( + obj_dict["W1Bus " + phases[phase_cnt]][index] = ( i.from_element + "_" + pw.phase ) - obj_dict["W2Bus " + pw.phase][index] = ( + obj_dict["W2Bus " + phases[phase_cnt]][index] = ( i.to_element + "_" + pw.phase ) - tap_name = "Tap " + pw.phase + tap_name = "Tap " + phases[phase_cnt] if pw.tap_position is None: obj_dict[tap_name][index] = 0 else: @@ -729,9 +731,10 @@ def transformer(self): # obj_dict[tap_name][index] = self._transformer_dict[i.from_element][tap_name] # else: # obj_dict[tap_name][index] = pw.tap_position + phase_cnt+=1 if len(np.unique(N_phases)) != 1: - logger.error( + self.logger.error( "Did not find the same number of phases accross windings of transformer {name}".format( name=i.name ) @@ -741,7 +744,7 @@ def transformer(self): logger.debug(" phases={Np}".format(Np=N_phases[0])) logger.debug(" windings={N}".format(N=len(i.windings))) except: - logger.error( + self.logger.error( "Could not write the number of phases for transformer {name}".format( name=i.name ) @@ -857,9 +860,9 @@ def source(self): obj_dict["ID"][index] = i.name obj_dict["V (kV)"][index] = i.nominal_voltage for ph in i.phases: - if str(ph.default_value).lower() in set(["a", "b", "c"]): - obj_dict["bus " + str(ph.default_value).upper()][index] = ( - i.name + "_" + str(ph.default_value).lower() + if str(ph).lower() in set(["a", "b", "c"]): + obj_dict["bus " + str(ph).upper()][index] = ( + i.name + "_" + str(ph).lower() ) df7 = pd.DataFrame(obj_dict) @@ -893,7 +896,7 @@ def bus(self): :rtype: dataframe """ - obj_dict = {"Bus": [], "Voltage (V)": [], "Angle (deg)": []} + obj_dict = {"Bus": [], "BaseVoltage":[], "Voltage (V)": [], "Angle (deg)": [], "Type":[]} nodes = [i for i in self.m.models if isinstance(i, Node)] index = 0 # for c,i in enumerate(nodes): @@ -907,24 +910,37 @@ def bus(self): for node in self._nodes + self._powersources: if hasattr(node, "name"): letter_phases = set() - for phase in node.phases: + for phase_unicode in node.phases: + phase = phase_unicode.default_value.lower() if ( - phase.default_value == "A" - or phase.default_value == "B" - or phase.default_value == "C" + phase== "a" + or phase== "b" + or phase== "c" ): - letter_phases.add(phase.default_value) - obj_dict["Bus"].append(node.name + "_" + phase.default_value) - obj_dict["Voltage (V)"].append(node.nominal_voltage) - if len(letter_phases) == 1: - obj_dict["Angle (deg)"].append(0) - if len(letter_phases) == 2: - obj_dict["Angle (deg)"].append(0) - obj_dict["Angle (deg)"].append(180) - if len(letter_phases) == 3: + letter_phases.add(phase) + obj_dict["Bus"].append(node.name + "_" + phase) + obj_dict["BaseVoltage"].append(node.nominal_voltage) + if isinstance(node.nominal_voltage, float): + obj_dict["Voltage (V)"].append(node.nominal_voltage/math.sqrt(3)) + else: + obj_dict["Voltage (V)"].append(node.nominal_voltage) + obj_dict["Type"].append("PV") #No generators so all nodes are PV buses + if 'a' in letter_phases: obj_dict["Angle (deg)"].append(0) + if 'b' in letter_phases: obj_dict["Angle (deg)"].append(120) + if 'c' in letter_phases: obj_dict["Angle (deg)"].append(-120) + +# if len(letter_phases) == 1: +# obj_dict["Angle (deg)"].append(0) +# if len(letter_phases) == 2: +# obj_dict["Angle (deg)"].append(0) +# obj_dict["Angle (deg)"].append(180) +# if len(letter_phases) == 3: +# obj_dict["Angle (deg)"].append(0) +# obj_dict["Angle (deg)"].append(120) +# obj_dict["Angle (deg)"].append(-120) index = index + 1 """ line_dict = {} @@ -955,7 +971,7 @@ def bus(self): # index = pd.Index(['1'], name='ID') # df9 = pd.DataFrame(obj_dict, columns=columns) df9 = pd.DataFrame(obj_dict) - df9 = df9[["Bus", "Voltage (V)", "Angle (deg)"]] + df9 = df9[["Bus", "BaseVoltage", "Voltage (V)", "Angle (deg)", "Type"]] logger.debug(obj_dict) return df9 @@ -970,17 +986,17 @@ def load(self): """ obj_dict = { - "Bus A": [], - "Bus B": [], - "Bus C": [], + "Bus 1": [], + "Bus 2": [], + "Bus 3": [], "ID": [], "Type": [], - "P_a (kW)": [], - "Q_a (kVAr)": [], - "P_b (kW)": [], - "Q_b (kVAr)": [], - "P_c (kW)": [], - "Q_c (kVAr)": [], + "P_1 (kW)": [], + "Q_1 (kVAr)": [], + "P_2 (kW)": [], + "Q_2 (kVAr)": [], + "P_3 (kW)": [], + "Q_3 (kVAr)": [], "V (kV)": [], "Bandwidth (pu)": [], "Conn. type": [], @@ -1019,7 +1035,10 @@ def load(self): value.append(None) index += 1 load_dict[n_name] = index - obj_dict["ID"][index] = n_name + if 'load_' == n_name[0:5]: + obj_dict["ID"][index] = n_name[5:] + else: + obj_dict["ID"][index] = n_name else: index = load_dict[n_name] @@ -1027,25 +1046,27 @@ def load(self): for key, value in obj_dict.items(): value.append(None) index += 1 - obj_dict["ID"][index] = i.name + if 'load_' == i.name[0:5]: + obj_dict["ID"][index] = i.name[5:] + else: + obj_dict["ID"][index] = i.name if hasattr(i, "nominal_voltage") and i.nominal_voltage is not None: # logger.debug(' nominal_voltage {nv};'.format(nv=i.nominal_voltage)) obj_dict["V (kV)"][index] = i.nominal_voltage / 1000.0 - if hasattr(i, "connecting_element") and i.connecting_element is not None: - # logger.debug(' parent n{ce};'.format(ce=i.connecting_element)) - for temp_phase in ["a", "b", "c"]: - obj_dict["Bus " + temp_phase.upper()][index] = ( - i.connecting_element + "_" + temp_phase - ) + phase_cnt = 1 if hasattr(i, "phase_loads") and i.phase_loads is not None: phases = "" for j in i.phase_loads: if hasattr(j, "phase") and j.phase is not None: phases = phases + j.phase - logger.debug("here", i.name, str(j.p), j.phase) + if hasattr(i, "connecting_element") and i.connecting_element is not None: + obj_dict["Bus " + str(phase_cnt)][index] = ( + i.connecting_element + "_" + j.phase.lower() + ) + if hasattr(j, "use_zip") and j.use_zip is not None: if ( @@ -1105,10 +1126,10 @@ def load(self): ) ) obj_dict["Type"][index] = "ZIP" - obj_dict["P_" + j.phase.lower() + " (kW)"][index] = ( + obj_dict["P_" + str(phase_cnt) + " (kW)"][index] = ( j.p / 1000.0 ) - obj_dict["Q_" + j.phase.lower() + " (kVAr)"][index] = ( + obj_dict["Q_" + str(phase_cnt) + " (kVAr)"][index] = ( j.q / 1000.0 ) obj_dict["K_p"][index] = ( @@ -1140,10 +1161,10 @@ def load(self): cp=str(complex(j.p, j.q)).strip("()"), ) ) - obj_dict["P_" + j.phase.lower() + " (kW)"][ + obj_dict["P_" + str(phase_cnt) + " (kW)"][ index ] = (abs(j.p) / 1000.0) - obj_dict["Q_" + j.phase.lower() + " (kVAr)"][ + obj_dict["Q_" + str(phase_cnt) + " (kVAr)"][ index ] = (abs(j.q) / 1000.0) @@ -1164,21 +1185,22 @@ def load(self): obj_dict["K_i"][index] = 1 obj_dict["K_z"][index] = 0 obj_dict["Type"][index] = "ZIP" + phase_cnt+=1 df3 = pd.DataFrame(obj_dict) df3 = df3[ [ - "Bus A", - "Bus B", - "Bus C", + "Bus 1", + "Bus 2", + "Bus 3", "ID", "Type", - "P_a (kW)", - "Q_a (kVAr)", - "P_b (kW)", - "Q_b (kVAr)", - "P_c (kW)", - "Q_c (kVAr)", + "P_1 (kW)", + "Q_1 (kVAr)", + "P_2 (kW)", + "Q_2 (kVAr)", + "P_3 (kW)", + "Q_3 (kVAr)", "V (kV)", "Bandwidth (pu)", "Conn. type", @@ -1227,9 +1249,9 @@ def write(self, m, **kwargs): engine="xlsxwriter", ) - df1.to_excel(writer, "Line 3-phase", index=False) + df1.to_excel(writer, "Multiphase Line", index=False) # workbook = writer.book - worksheet = writer.sheets["Line 3-phase"] + worksheet = writer.sheets["Multiphase Line"] worksheet.set_column(0, 25, 16) @@ -1239,9 +1261,9 @@ def write(self, m, **kwargs): worksheet.set_column(0, 25, 16) - df3.to_excel(writer, "Load 3-phase", index=False) + df3.to_excel(writer, "Multiphase Load", index=False) # workbook = writer.book - worksheet = writer.sheets["Load 3-phase"] + worksheet = writer.sheets["Multiphase Load"] worksheet.set_column(0, 19, 16) @@ -1262,6 +1284,7 @@ def write(self, m, **kwargs): worksheet = writer.sheets["Bus"] worksheet.set_column(0, 3, 16) + writer.save() if __name__ == "__main__": diff --git a/examples/cli/config.json b/examples/cli/config.json index 6207eceb..c5818303 100644 --- a/examples/cli/config.json +++ b/examples/cli/config.json @@ -1,5 +1,5 @@ -{"data_folder_path": "./tests/data/cyme/ieee_4node/", +{"data_folder_path": "./tests/data/small_cases/cyme/ieee_13node/", "equipment_filename": "equipment.txt", "network_filename": "network.txt", - "load_filename": "load.txt" + "load_filename": "loads.txt" } diff --git a/tests/readers/opendss/Lines/test_switches.dss b/tests/readers/opendss/Lines/test_switches.dss new file mode 100644 index 00000000..22bb97bb --- /dev/null +++ b/tests/readers/opendss/Lines/test_switches.dss @@ -0,0 +1,25 @@ +Clear + +New circuit.test_switches basekv=12.47 pu=1.01 phases=3 bus1=sourcebus + +New Line.origin Units=km Length=0.001 bus1=sourcebus bus2=node1 phases=3 + +New Line.switch1 Units=km Length=0.001 bus1=node1 bus2=node2 switch=y enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 + +New Line.switch2 Unites=km Length=0.001 bus1=node1 bus2=node3 switch=y enabled=n phases=3 Normamps=3000 EmergencyAmps=4000 + +New Line.switch3 Unites=km Length=0.001 bus1=node1.1.2.3 bus2=node4.1.2.3 switch=y enabled=n phases=3 Normamps=3000 EmergencyAmps=4000 + +New Line.switch4 Unites=km Length=0.001 bus1=node1.1.2.3 bus2=node5.1.2.3 switch=y enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 + +New Line.switch5 Unites=km Length=0.001 bus1=node1.1 bus2=node6.1 switch=y enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 + +New Line.switch6 Unites=km Length=0.001 bus1=node1.3 bus2=node7.3 switch=y enabled=n phases=1 Normamps=3000 EmergencyAmps=4000 + +New Line.switch7 Unites=km Length=0.001 bus1=node1.2.3 bus2=node8.2.3 switch=y enabled=n phases=2 Normamps=3000 EmergencyAmps=4000 + +New Line.switch8 Unites=km Length=0.001 bus1=node1.1.2 bus2=node9.1.2 switch=y enabled=y phases=2 Normamps=3000 EmergencyAmps=4000 + +Set Voltagebases=[12.47] +Calcvoltagebases +Solve From 668f3d3bceea774e656e1f04bdf3e8ab8a2e3f49 Mon Sep 17 00:00:00 2001 From: telgindy Date: Tue, 27 Nov 2018 12:30:46 -0700 Subject: [PATCH 14/25] adding faultrate information in test_line_length.dss --- tests/readers/opendss/Lines/test_line_length.dss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/readers/opendss/Lines/test_line_length.dss b/tests/readers/opendss/Lines/test_line_length.dss index 690345f0..c272312d 100644 --- a/tests/readers/opendss/Lines/test_line_length.dss +++ b/tests/readers/opendss/Lines/test_line_length.dss @@ -28,6 +28,10 @@ New Line.line6 Bus1=bus2.1 Bus2=bus6.1 phases=1 Length=1666.87 units=in ! Line 8 uses like to have the same characteristics as line 1 ! New Line.line8 Bus1=bus7 Bus2=Bus8 like=line1 Length=300 +New Line.line9 bus1=bus2 bus2=bus9 length=1.01 units=mi faultrate=0 +New Line.line10 bus1=bus2 bus2=bus10 length=1.01 units=mi faultrate=0.1 +New Line.line11 bus1=bus2 bus2=bus11 length=1.01 units=mi faultrate=1.0 + Set Voltagebases=[4.16] Calcvoltagebases -Solve \ No newline at end of file +Solve From efd776c9636da7bb5a403ecd0d8aa7ba0dc3470b Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Wed, 12 Dec 2018 14:57:45 -0700 Subject: [PATCH 15/25] Updated Test Cases for all elements --- docs/OpenDSS/Default_Values.json | 13 + docs/OpenDSS/Default_values.xlsx | Bin 0 -> 21627 bytes docs/OpenDSS/read.md | 93 --- .../test_capacitor_connectivity.dss | 6 +- .../Capacitors/test_capacitor_connectivity.py | 276 +++++--- .../opendss/Concentric/test_concentric.dss | 13 + .../opendss/Concentric/test_concentric.py | 85 +++ .../opendss/Lines/test_concentricneutral.dss | 2 +- tests/readers/opendss/Lines/test_fuses.dss | 10 +- tests/readers/opendss/Lines/test_fuses.py | 335 +++++++++ .../opendss/Lines/test_line_connectivity.py | 406 ++++++++++- .../readers/opendss/Lines/test_line_length.py | 634 +++++++++++++++++- .../opendss/Lines/test_linegeometries.dss | 26 +- .../opendss/Lines/test_linegeometries.py | 19 +- tests/readers/opendss/Lines/test_switches.dss | 16 +- tests/readers/opendss/Lines/test_switches.py | 614 +++++++++++++++++ tests/readers/opendss/Lines/test_wiredata.dss | 4 +- tests/readers/opendss/Loads/test_loads.py | 60 +- tests/readers/opendss/Nodes/buscoord.dss | 4 + tests/readers/opendss/Nodes/test_nodes.dss | 12 + tests/readers/opendss/Nodes/test_nodes.py | 81 +++ .../readers/opendss/Powersource/buscoord.dss | 1 + .../opendss/Powersource/test_powersource.dss | 2 +- .../opendss/Powersource/test_powersource.py | 27 +- .../opendss/Regulators/test_regulators.dss | 2 +- .../opendss/Regulators/test_regulators.py | 182 ++--- .../Transformers/test_transformer_kv.py | 182 ++--- {docs => tests/readers/opendss}/read.md | 132 ++-- 28 files changed, 2701 insertions(+), 536 deletions(-) create mode 100644 docs/OpenDSS/Default_Values.json create mode 100644 docs/OpenDSS/Default_values.xlsx delete mode 100644 docs/OpenDSS/read.md create mode 100644 tests/readers/opendss/Concentric/test_concentric.dss create mode 100644 tests/readers/opendss/Concentric/test_concentric.py create mode 100644 tests/readers/opendss/Lines/test_fuses.py create mode 100644 tests/readers/opendss/Lines/test_switches.py create mode 100644 tests/readers/opendss/Nodes/buscoord.dss create mode 100644 tests/readers/opendss/Powersource/buscoord.dss rename {docs => tests/readers/opendss}/read.md (66%) diff --git a/docs/OpenDSS/Default_Values.json b/docs/OpenDSS/Default_Values.json new file mode 100644 index 00000000..3e5c57f4 --- /dev/null +++ b/docs/OpenDSS/Default_Values.json @@ -0,0 +1,13 @@ +{ + "OpenDSS": { + "faultrate": 0.1, + "normamps" : 400.0, + "emergamps" : 600.0, + "R1" : 0.0580, + "X1" : 0.1206, + "R0" : 0.1784, + "X0" : 0.4047, + "C1" : 3.4e-9, + "C0" : 1.6e-9 + } +} diff --git a/docs/OpenDSS/Default_values.xlsx b/docs/OpenDSS/Default_values.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6f9110b82558b502b3228cc9548db97b68d22fcf GIT binary patch literal 21627 zcmeEuW0$4Nx@Fq7ZQE9*?X0wItJ1cuO53*WO53*8x%as}Zg-!3e!=bcLo7tRW2_bH znR7mhB`*aGf&u^r00961KnS4o$;Fid2mmk%2>^f$00E>WY-{6WY~!S>>~3f5s7>c) zZAFj|0z{Du0Q9~7|6l)ucVHrUO}3u_Cip7OErhDsY;s5+rXd;{F6CFl4M3j#l9@Hq zAXroLFzj033`ROz*k*$T($|-%S~zb<+LFpG9AH#^+Hs+F+^@+jHkb6Ulu=<*0wfaS z#V1;4h^@Szyey6e3IKGMFSn7N(N^I7;7`4^i9_=IR`sDuEQ7p=)T z%2xnMLr4MVq*uLV#z?ss%7`iVD-+zjFgx+t4*dkv&GrnEa8 zwvfZ3QXH?eJ1tg_!?~n5YP37Y&R>v$EgJrj(;ruJ6nDduVGSh!@EiR3$GTI6P`Sec z)@~klzphr-INaFW;HHRU@Bv+_`^uKsXK|;65Jr01)@)DHEq`QdKhklt^v8j9_G%63 zTit&n_Uj86K>q*2bE66a@%^`vN`J!@`Ww%>4#rlF^mKoX{~yQygTecMeD#WW8M(i4 zEdCxc^0c@Siy$QBDk$DgsOWg22a%K2;t){ zOGN|{3O8|+Yh`fCtGzQg6`4b_n0>|00HVv{!{TGw4@q|lm(Ccf@|Kc3snIQBvH2U3 zT7+pjH7rQvLY!bU-ZVeWAsLNLgXb#1MIoh&%HW!2_T1Bi=?vecc^o;#6@ZsZRyTG`AIMIsiYXQt^N!=$+n zzM2gzH{)6E1MHCfI#Sac8UtZEt0!x~HXE-SpWWpa& z4X@1^{9i3P%w6fsO>+RbHX$B_BFJeb8K}SeE>JDSVY#7)sA;y7=qH2Mfdz7U2c0;7G<8&Y(h{2u(pxV9f+Yp&PzbC zqI10FBw5;58GWtf8?z(Mq#=Zot8DCuK#JbM% z)DoXWs123om4qG3Urm;Qb2mXI#MUR(ZM-ERJFGIVF{F= z1*er{p}iOP4%9sv7g=HZ1|xK~0+bg}>232iV!ts~D(f~qc+$#|a^1)y>v3o^z0S+- zOJOIa{6{v6z!F@u4DpRndbBP;>DPlq?=u(2^N}v*9+>I<0-)Gnul_Y-Wz70^AWsV@ zx($QpGyI>Mik#h=qx>N`{$$VOoJ2Slr;4n?S3BJsm=sKD8h0fXxTihormsXJ7}-a5 zhV9?IiCc^`?XpC%Q7x81ZT$>+xjg%t1%9Y)!L0T?{jfr75I=|6hHMPvI(kXc2C}UL z-B*8n4W|{GXf}MY3yCS{(Fy3TKtb`7MqoJA6j%an@vSUF8;k>n+k`9ji{=>*)Lvof z#B*%|knV-0;Ej&m({#D*f)w47sXH-59T2Eq#dQ?5FZS;mwAWbnCfs1jAg4WLJ#}Li z$(0S@`>ze6H~gQq}Yb zbe=a9pn?J|ue@;0G}I9$XI$W=XrpXA`CT}t+>!F4q1ux`A=&y;-dh)DVn+kQJna9P z6P(TURb4q=H@c&7gpW(%SpfPqcNod~i&Vj!s>WYCIyQzqBQ_MX8y1=V@OQ5!7R6=- zVf~FH3#ZHM1e9Y4D>VAVs-vu>sqAP4=Sp5-ZFeM0bYuBf#l@94nSJ^WXWBAof=94K z*3^LGoVuomT~>VU{@&8b$XGowbun?nS7+54hrvn*gVr>|nl1+4%aRHIx3&Dc zBE>ZCLkRf3kFBppHz$=NmBc&#bxcih zdn;&^O3AYh=xe&48<9m#q$G6Anf37lkKBll#Rpg2w6c-i;k<-%KthxTp7h47uG(>z z5`IDbREm8Q$u~e!ZU@|I%9-2J^i&Q@PaPw)473;N3`fEkR_%q966zil;*^#UUx5LG?z5Asops>;9I@;H;Ouq?DhxqLU1BKJ~o?tO#}Gc|2-KE0knQmpTv z)VNVu4y0=;oqnDFG3`?IJ)HWP$@bgw16+S*`Cwl>30N!f%kqbie*dkO`gKH2i65oo z&5NH&?T2-z4rs3tPE>v|0cMn17r%!j*{m6=h!4vq$-D%DPjgB{q<=_~DjNCPvQFL$ zn2eQc>kQz1QhdTOj}{f4E{3NH@^noMIE0`>eA!411I&*)GIzW+OORp2FUv9yu-|J8 z?bGO=V#C+E>tiEm_zo}Z+}>nP%_*@Agl0uThS{CuBEJz5Y8v-K!qe+;5U#hVN+jt* zDc_5Rktg@@vWuemVHGg^Iv#`q*X0KrD(?wMs6V--vNTvh-}5OMvMIZcr2Fk~WXSs| z^#Eo3ZiFzq+`M#P_KfYXpAq%=y+JUh6HAYzW7(nk{`6PMly@fUg{44G$)b@UEXyjZ zClRy6Se3iP75r-M1i4fgSGCB}fqg_r;2bV&wu?c4InmfX(d>hliF;^-NKYdgg^jDF zyd8#(D?zjuoEFo7@T;ohUqT4P-k7n@mW+tL@tFeN2|n676!d~Q^0VuQ_Gr4A%FA9v zHgs5JE@I?lBxfHYX)6E;oU$VoXi><2DBocT9oykSuyL#01hc(`fDgpp%*s`K`q(A_ z*a=?JT;kX|N5q3*@A#7h1}_-G^!`h-jqowv9yWn%K8p?CiB&vO<#C1PWwbpM52}sLVVA*{{Zz?i{VETM&rHINE>?cA!`q z+J^7@&ai5KL$j1f1rAXtJ*!!2aqP~dHSaH;qSg>dE=32GzpYxqqX8+2W}+D9>38+i z>0g7i7?^k5w>?feejI6<;h$U<43UludNa;iz8|M*q-_U^IGs_Ja+41$Oq^dHl~{KtJ_Vfm#LRjmkNDE2lvkS71(w=u7Xhea0@bk zSZ;=P9<-rk+naEwMIRImtqb{&t)55gfL%Wty99mu1b8P2+*@bw z22G~)2L(i5NVge}CPPWh)EJ^uT0S_B*8t(|5V2uyPUPkOXk)?0^T12J&o$=e9Kr@!1#Y;b4*Eycc?a-Vg*jitQTyrS2Dp4DxVBF0O zVbJNBshI6ZI+kG#WG3CfIQL-s=R02vkw;pC+~Hkd#DcKjt2#t;hpFHmyVle2%R7 zW7Y*2Ifx=Plg>*);x&-gQ^%Lkx_1!O*1E--CD5jBv#d2Mf!HVD*yyb6`r)?S30R?@ zU2-AN%;7>9VC%Uxy{3bFI1oWjL$O#+%2k1bh#li0gjxqz1H3f@2wM65!K}nu-v9!! z2Zs4Lqdc2``%SvZ1{q3wjhb@YSeX}XH< zH63Czb@Gv((U1037tG9gK5gsHKk1q|aHZ%igUT_g zpoL7wqA~7Mq_SC|E9{*EAzXJSleMf64ClkkvT-Jwx;Z*o%SAY(5F}O&KIKo$`BLeF z_LBGC){I_z9XYHqc`Z5f_=4ep<@dBPpt${^=qCr(V8hIQFj^ysKJaT6hWtg=|I0LJ z=Xr1AnhM2Dl>)@zvV8!zXK;VKPn9Qf%&c>w-W8UOm`1=pqNX7Z^m=dHQqKv$nt_H^ z*0a~$ijBqqP~)j7`&H@=mWi@TnN1sYElI_{3My@!Y6lqghw2KS{0$Z=GLCgekO)$z z_azYp`xIgj2T-L`h&Ayn!2YrwaPGR8+zq$D@1)DR8BIy)fiPKYrBM~}DZzX}GZ1xOkQ>}rx?CGV0DtVHwJy)!lI z5v_og#e`aHO`wot8?#HKMe^3_Z|@lGfe-$qryqpgn;EOqBbE)hN`ks%C&8Ik{E0{U zgcbgIQt@z8Q6lCRIpQ)GoHZ((_%tjL-)7w#+XSHyzU8{UZ9HU(3uU<-JeeZlh%39w zlqiI{8%UlhTDp~BVx$adxQgLnHId0&{nH@#Ofz^?9L7MxH!%?c@g@v9f5Dnr3+}Ci zNWzT}MSGh#AKL5p7;2;6y|NTq3~gU?VKr?Z)1Ja03OonR)>`fzVw}CU3gdAy<5TES ztA&hEE_rS8sfO0A(P2Ru3*I@(p_hn}PKsqVo#Z?`;x43VDg3?lxI$3Q_3kAk<bwzCPlL)x}WD1z5QA$r5)>WbtU&S+>}cG{OUJLYj#l))8^j zr+aW`9TAY$eV0yc7QZDes-<4dZTnX)Fq=%tR|`C_=aY#yPOOvQ$ax#jWfcqh667Nk ztB(fEVoq(PwM;fnY`=fA3-^uRKC7#CF4(6{gCj4DWsN&WTqwMGGRnjTic4G-jXQ$k zrT83$JFH4w%T4hMS8L$~=^3=%$rQt*0EO_=M|MFhMdD$!L#l9ufc^1&K+m0s-J;^= zJ_hX4L1?C~9pH641x1*Zwv8qc=;}%w@XjQEc0r?I+^`pgDpQ(|MSP=fl^kdrpm~8R zi~+_oxA<$HnA&R<)Z@KX`(PD6&R~|RQKFBM0ZV-+>gqoI#L}TR9=`sOz#CvY=4C+u z0HVKBc>f`0V)>iE)wE((IZ*y0aN$JPcn*>sqFe)l5^wd=GM6<|IR*q7qNY%G3 z&uAH&;F>(MV34=FqpP1@R?~c)#bNd)t)cF0>|qC~VBU0g!j|yVLw8=-J(2z=lD9Flnh7A^9A#)>MF1X}1N?4{v2C0YM9M3lBKddGTl*a0W;`V9sK#$Qwo+%`oSWbmg=H4%ya71`` zfd(xz2L?k(Sfg0deO63)imM@)KV*5ZFt0e@Td(e@E&V(d>QcCQgLR^H`zUb818iDyvM$xX#Dk*yH zrA*Uo;zOy^^^hRzwSA~FBMOT34J1=*5N88`dSRPKNYjZJ_jO>;rD-QgEOvK_ePAOl3t7h?(ZwvIxM^P!!9- z2n#!5I_kh;QuB~ya>%4?w=gYuOl*BlSO(ST4<8L z8xyXcpk3EDMT7Sk|YCyml?^dghWPm2p=$ zpHo~5kmiNbV1dJ(PI>so2`jP(@$V8+z2mtuv6ch*^a!ZkMP_Z2a@@(LBB|ZL`4ytb zlA{?~CCSo;M8n3mZxeuuYsTk|6_e}><9kE__}eB9+3b{z;_Bluo%WgB zE!1L~5czlV)`Orl8;_jidY63cL|ktHo^wcM}1{PuTx~OU=<2j2{@qmAXO4x^~Ml zgu&;wNdQBZ(EBkE0k(5bDA6~pk5ozab^TrO;m|*WqD&rq-pt_@Th^X9 zdwm&P(RmsgN#4^OGv&Sk8Fv$ysnAvp%e#Q^8C!S_jdqmQ(80H#IpQ`4fUzc(Ib38DgJm6f+Ft^=TZC+f}H z(9;6pTv+{e3TP13ysiRo16C&OxM zW5}|jr}wZ{1j2e+#5?mrvQbPA7k`Gp@W zO#`D?*@?)sUu|5HHUAozrFm}3YCDdOD9q`Wquv@brHrTH7h+q=+AiupSvlgLt-*@# zghl&*&Q7xZZRIK2F}rNv35)OSq)01yn6NkykZLT$sg814nak5EGK@&VK&iE!n9A2% z_FgQ!kPEhIdRou(v-@-kyvfT6?{p+IGSk7}7)i1rR)zR8A8j=C-Bq^^S)RGLXaw)1 zTd(RNc*0@vLv=Sz_0Nt`WWzB4Awso7iBbpsH73s5Ov#9pieE{<=$tCosyNmfP-0IW zO4%z_d(SSi^L-T%(2T*o@F6VvjB-<))XJcUGzC!aDa8$mth91N+YVHlQwJnF?vSBN zEK-Xh!RcbzG<^8bbjOxp_T9)aWJB%0@X>vW8zVoz0u-~!{H1*4(PA&gj)t#~9@mQ` zggqjCQG(r?^ioium-E+i9K$BClGpl*_#yAGF^Z&UrcQi}Ke=J^?e^T)Byg-Z!kVM< zB{0s{M@_il*}Cwj_fj@|4?SAt^7=562$%JZZAJ`!c+Kn3I|F-5tf;u?U@ym1XLj%O zna9uqmXBn@iUdNudrjgduPCq^K&qV;;|fi zp4_x%=CRF?m>HcL5fG4T2bfM~V#9Sw($Zc?rE1fG@?qWf61+8%u-A+OjV;I0NKM;e z67;rP1A98z_|9NNIctDV&2;4$1>%D4cN`4}1q=gKt9 zfNYrg;t*l5_r~etHT1jTVKk3Id8P@>jomwwNzlvOY)t9+yKD^3;65UA*>>dUt-r2- zRh{7xmfqA)*6BoExjcTH)A>xx;Rt8hyxV*Cv^>P!Q~a_oXSh&- zkr0OJWrosQr@DXT5}Jzz(h(3dg^bh+`g{?di|u>I1ZA*6c?E*NLL#s$$HE8JWJl^O zieRyjFJNE$G|lyM&L{zovl!xeM0U6Mo$E}EbYDzZ2S)5}F%^3$a_ynS*|(@4R~!s- zf@j+7`)cQ`zF&$Q-5f-wt?!F+A|=HeQ6x)0^K9cdlOy(Yd=)9vq8)WLC$6=XRNW?` zlG9AeTenrpQ53|&-1$9k zarL-DD(erG+D~HMxcc>BBK?dg+-y|XMD{Sj&YZ&!pRjneM6)Et_|#wmYNlNxL%~yycE8_UVg2 zDYY99-Bk@Ez;>1yasY0kH`gMH^@kran8Rdr3KCBb-1tjJa=^Ow9M0-9LoWgi=7cJx z*a-cUpJvM*5BN$SP2|(-&@Gw$jvd}e3@xLQKj$q*i~qH>TCE*K7NdMlvI+hHylx#y zmwkzvGS?T`1+mi<_ThQr1=_~Tj{{8rBDoGDDNjLt%Bp{kWq}<;gzht;t(w9As$eO=W=669l9A5 z@1!%*6_p=uP%umNhaeM;retNsAcW4ed|~0HTh(G}C0HQQqW(P|ptZF9uG*$Mp7RRZ zJS0#Ruwzc9N2f5Bd*@r);DHI4J*%;TFl(-1?a!&O^(Lx#nj+L~I!W*Oy&r&=B7(Kp zaij!G4?y>1ktKEu{OrUEC=IA3#-9zZDkN#K$BZ?9Qh%WkZjC|^vAB(j~fFvgHfRsNF z^I9d`_I5a0HdG$SXmrm#YjNY-PLM7;42qRPyT3Cw$+38uF=ee- z!1`jBc(<>+HgG$bV8twf>jTT2EjOUTn&kI?tCQ5Fg}K?r1It6a zM1_Lv<*5b7j#Du=!DnZe*rkP)*#>A@`2c&RjP>;It$4d3oUDP>6t8Y)kWQlxGWA(87OTEnj38zyPWeefR@)DTIgUCRFO#J-Gky|-qK!RO z2YLfkREj#*=+AG>ArgUcbH61e2&tNSZ_AJwNwBPsRaRPzim$>@L9aPx&d@ zoBnvHh>65y7doGa_>npU=x+d8FoYrgaf(@`zs$Su-VMyhlKnxXFve6zf3If$KJd)8 zR3iu!I-pJ{k@H7d;hJE=*xfHrQ2_wxQ(<({1PDG(X&%qL%<(wr&xG^t2@C~x(LFG` zc;vB;xxyz;#8e3ykg*xTOg3S*p$=0iT--_tGWV#iW3iF7Z5`mp3@5&VF1{U!dffw5yt#NJ%RR3dOukW z3YErkDiBkwj+X@o`c-q`@V6OTx9ZdhCug#KuOdW7*dj-PgBC|9c7E zrTRpO{aXT+|8rH2^KWBM{_jwZpc|Z_Ihf+NWP<8h|8MivgB8F8bp36Fj|A`8UxI{9R6%DVIy(T@Ia%ETttsT zqzySfUo6{Jw>WCaB)~u+F|$Ht&N>>*YBSm2qf(kZ35gMz6fLMyQpx`DzfTiQlMUDW zl8{w%(;1MwF?eJ&q>p%XjvC}yMP?!?LUpUuDd8J!SM&Y8{qHDi>?FjAA9L}-SUM~TO40Irc>Z=9Q*A?^BucIfDTyJ>I#f>+S-5ESVZ~Z7}4!A{QCI z#F@m%fds~etE*&~4G8p!#W}A9jU(!!(rz54DLMivbG`yt5(S!c8fH$!wA-l6^QCQh zovqAFK#mH$3f#{Y(sc#e-~NdrE+*>tC~&g1vgR7x1exdh&LGXo)bKX7%zRaY+jbRV zyLhHiXd#P|774nARb#3*Y9!$V+D8nq{R88&PK>&#r2Fh$*1l?*Y_jJMO|IE=o&SNL&ix-NW?U)8W zbUY1gZ~0J-K$!3mMqq=uG0q6q{0$L=e(IiftzQH-L2gb$)~7z5mZ-UyI_h=F(Sbzk zhnD>cT0Awpt$s$%QOw#iYAe)TGkFp)^Ur$&@g6(=q* zch>PE6!p$sDPkk1f1p%NGOF69;aacUzK9Y!X^<%araU^eE0~@+^tQXj|0l3P`fWk= ze#5Z#TUjvwL%$2dzoca?dX)j;uaFX#W-9?%0*$B-3eD^(Us2`3&Kf5~J>xr~gexz* z+O!t}N^A&M1v=kOo6b(#N?6$|9hv=0S}+Zl92g8pQ6cGF89yJLnbY-tvrr<(N5l_4 zCsDq0_mNl{NK_7 zJ?6OfJ=IY3`fHdq4gq-@(*+1%L=3p| zumkr;h(QWyP^V z0^xaQA8?8x7Rb1SlA$SaXX<$k@*Vt!E z4nz`;EXZCo#|Joq&88gzhOW>j_hFGMi$ldov^SB%uvCyk@}EwC^eC(JAj96D5o1oF zuX9kaOP$_h+lwOtiP4~#vOzN!0Vi@B<1U}ymi_M{(~FMKCHp-yMDW*fo4@m?C7$n>Z%`4BL4h14+_wfxlCMnK$2l4sp$e6@#C|zxcDjC$K%fFX09{U z<3}oVUwpD|m;5bnX5?}z$$YY}B?kqImz;QFB%(2-%?mWmyVP2aj{~ChD8%qG@Qa95 zUNXJ}=Nc8-AVhFnOOFYM-xgWquy`MF4%#pdZopaBh@BRAfz=iCzo5|WSE3+cxZ zdNV!RtSXtv0horcP3{*{tF)e%`mE#aNw38m0YreNXQ3`|$q6kVpGCys zO$jLb`cWPjA>y7RYb<2D;y0##6e#Znz$5cGpqqyS#62PZH3#ydRF_VsKa2 zaBx$v3Bziyt9A^p$RhOp;NETk`LhNXga+aT5RY9-F2_fJbhHRg`Q=^BI$LdW}z z2?AGdzcWMC{Uw%*yk17c`rn^}!6&rzU})ToPT^dUQ-qNfw=2SEpUJ_u_Xk-OJ&A}% zIOW}|Ax)svAy>!)mS8s&%pTkup7sD+yp+T7Tx$dda~!YBa+Exe!L@Gh|cWhY3*&=)OgIB6;Ym@f2=tM`T(jKDv{CO@#3(Pt$Va zWEe9y*IjASYCDFKQ{)haXEUFp`iwsF_)+Vu8j)TS?zv>9P%!8l{-LO!KSi?2 zHLWfaGnO;h;DJ%ZR6CIq_M--;!|KT2UB~cT0Ug0WW3+DG61g%cjE_Y8>LH)-X)Ha= zve$d;;wv2gxT`qoEIxm|m6^=z@Kqa6S*G1-4m~_R2wJ3dc=?TyUELmM%XQQqFcT(T zj)M-i3%PoObj(JAGnA|;w2`-308SA-r?aNgtS1uF?%9*^lQXTx%)n?08*lVvhD$#v zyD^jH8vYJ(rbf+~seF^YbBl?Zmo;szXiG1J291Alqx=~qoFZ9ttjT+|S-EiLbFA#D zkpf1sGLNAzZGx@fjG>?lCxoJ78mP09ratSWJ}ZBklBX$Ve*nc`jf(1a@VG77c@QGF zDi~~nlXzr^THKJ<5m^N_l_utqz+9RJC~rW|Oc3Lww9;npZsBZR)+zd%mN?R>K8j(E z!5@8xhI=ykO=GAnEo6a7uGOFw+kyEs3Leo?l!&~=kBm%dW`Nt~rO^VSnTnXj@&)-A zqkqW_td)2{3q4<{#RXF$+veF-KN%CfE<_}e>t}-O7#L$*s%PQ=tuC!^5-iIsPQEp@ z+Ajn?&AoI1YWxg)1SjqhH>O@<^WY5(g=|@Tza6D2yU()0E!+x{6`a0K{HT~tV6G!} z#NX=b^wi+dVZR~*98M=0{W5A$;|^Y2clE~1mO8@cI1{6Zxgz9U@>7kn`&h%OCT8WR z@iF99(tGpH=y+1gfFC>MHrVkO#~i`T4^4{(sZJN15>7(6_hHL#g%|3m3T-}QX&tI8 z>005C7TqN~b{4!NfO{Eeb0(N%G&*Ga!|Ur6)*6^;AYkMc*q*JO#W;9xs>u0AvL-a0 z1!&GBvz}ka);ktWz+L@#JnVcqiWQILg=|xZDPHHWM-tieBGwZ$q9C?9ILT?hd?>BJ zHzb#76S4HW5tIWI^AMZLgIq9F$3JR*o;p*(Z|lV={Dhl7djaV%HE+QlNsq>+~bq*JzF=KK#=kWQu66|Bcb z%`6Vjbtf?_-0Gr@{24n`qeHV6gaxUwPk}}Wc# zOSM$eHA<_&qzx9)|D<(JP0 zizwF>8Kk)TZlQkm31_3Tuu;9`E$S=0S+s>!RZf{;{)!fd!K4`$9D{-CnqX+*Qn#| zE}mY-`ite-FP?&F` z6~Ji>P97cA^Jk(ZMrkCMb;R6mYwn!uw9Yh>u92F#nxgMorKQ&9XB9)uXFyV7trCSH zL?PlnrE(UTBnpGz-t*;*e>V`s?s?N&_DZMHGs58LzJMO;p*f`rY+xqYY}jpLoR}~H z%ErZ{?l@Xk;R04To1A61tD>GsygLsg9M=e}{`sHSN5eY+PcyPXzCtmt6Dl5ZxP&Q59ErvGaOdJjPpN>imDd9fBdKmGlHL^I(!G{XrK2g+k&*<29 z!p6@OW!<`z*SqnWp7waOn0`LU(foSPVdWz%!xNsiR560O_%Fd@*-SEn?8~sJ4|bR6 zP5l;*ovX4Ab3iX;5&@n?SF#alu6SRf7ORdel0(|~$DIpkM0Znru0@rij`K*Pxm(V5 zojv#u;U=5D>}P7@7cz)%5q6!|rb{F@DWe`|R4Yr-Egvq&rF$+RvsiZbCFD$ z=qs2iDw@kIBs*G99%Q-y7;G>S@*q)YY`~_ERK+VTeAc;ZS49G0wryuKXm4864cb2| z-KZ+QY)z6-HAtfhG6Ll->8pb&g|-vEDD8uyW6p4OT{c%y)VYqAT3gg${f!uWX%Wx_ zP|FFGv8}DHtv*SkX^)bgaoLq$;WlQ}NBLVdqPU7rA5{t@(Q>BmfR-{&+wM*8M_5kJe7$>$BrojXE_=q&GkH z*U+=IaEv=A9j^S)U^d6W-J2Izp-5Jw06jG-5t<7OX8A$5@$qYaN+pLJQtRjq_^i|! z2nUFuwn7Ny>=irp28nY6-y{9a5*uo_mzlJs;vT^V7?R5gW_XCQasjdUOmkL;6$kha z=FXU(FwkXkutp)}p|!ILky{!USmgc70*~XMni(X8zYTy~JJM)X)sNqDwm0E!vgIXH zQE~-MJS^#z@;CQUKHw&$uv^j7-Ge)5i1Tm+hJKm(S|XZ{rv^SQj92#h{d!HBfp-vj zXA}IfP`|?iRt&nZz(+#|X1(wtfsL4S=??WKDe%L0lDw^Y#Im89Ehz+vZBMtvF?hox95gg{P0b`)}l^JypebRvyQq!V8J%_^7 zTJrE@M?DO>4{&WmQD&0)0P6=m;e;3D!+r2&f1ZQiD~oAR*GaFj{1`U%(By-Oh{6of+5nhy`^_pZQtm>>E+*JZ*FTQsow7yp>NlK_+JF{*P*`u zI%D;(Q-1$_((3Oset|K);e8A!qEEn|!fu`ke}Z6ymDq_|RE~fRURS}^QevM_K0NDj zjC&3a?4}RcGTwMfu}$FOXcpRlg7yv3&1$YaS82NiYdKEWQ6On~V)f_gy3&DVWhKLg zW7SciYl9R>J}~-y23BgLAxmTV4p$_?+!;n+BCuyF$}FsJb-^3xWgD+(_Px~txOf#c zKF_1Q@p)_tx~If%rvoK8WA*s*#W_brFK&Ms2%fnAzPZ=Q*g?tI$>}c=rvHClGtwED+l1?f>O<&3m@pX47>*cH7>FB> z0M^Z6-eQjZVyY6rlmlZ2^9K6?Mx2Yq3;NFar0%XXJVvh zpaEreKZp5DA4NN5xs4D3&Tlbi+$d4oA#$oTe=!5(?W zV)pa=4x;*OC_o zFAD`3bxB;SIk#uVdptuKGg>Ef-e#=)3T>K&L4}Tdz7%%|tiQ4Fq)DN;p-E|+_moDf z%^%ouq27IM)1IVijHBpgwKiWA?KuC*@Y~+u3(B~zadBr+#@h4Rx$-*75qBv@>g?%` zRJJ|spwRoqW9KP<`3ecjwrx$Ny_Fs8lBq2j-{$9L*QJi@ZM2fBvd%|V{4~lFZ}{4XLzfGLt@-3f)X~85pTML~ z*N;=I_SlSDaL4vO!-Qx!4!s*5nL^JzRe^uu&0Q9 zw`fpaRE6DxgivN2sFwZdRs+a@RH*#&|j8n%;!KWlh&Qnb!&aq+Cg+cq;+ztNQ^^WjsjcK0C4*VTXXogn-Tgb?;>vqOK1A&X z;&XRr!9OGcG673I4EnfAKFHtK*c~8W&$WP0Q0ix4t%9 zE4sn>~qEn#tESFpGG^KIK!a+bSUKe{Jr(xQp(u&t7+P$vuAD1~@Q8uie9(wxi?$ASdyXU`)-utcimoIzk($hSx zZ_ex#^Ey!_wy(2l?a|EXOA4Z{#@J1LSaWFq&#%YMtg2ZqX7}`q$u9HoqxExZSZ_~r zURd;I@@X;YnA3BP?rM8&@M_#i4a5$l9wKVCI2 zxsNpwYI&S|aRQhK6@h&$0pvuOSWqyU20kirYom3F5E6kH<9RT`}6I>izTk|Q%o(R^^B%1 zn7Az@ZTjZ+N5GAV(^@!|vE=eTd(+W)w`+U;k7Lp8c3M1~o--zFwsPC`{xxmX8$&VBlX>Qz8)U5DYG(7iD{KZSB&c#>g^!4#@ z|GQ|pR>fu4(jTjqY(E%g__Jifib^Xs%bm9u-KiGsS9<*N$BFGiChI&SLKZN8`m*Q2 zcaGQ$=>R*9d&fe%jiTnWeC$>spEG(uDRE(TB&N}8=SWN&0GP4uMsO&7}l&ed+@mDscPuMH$R^&D!(KBYY`7? z!8das|5N9gTiJzoSuNQAVc|=mIY-S*mrmca;&hMvj@#J_j->C8Z)RSpw{Y(-dy8+Z zf3LmUJ7@o0^Ju>Y&kyx3d$;v67ca3l@)3DnTv5=vx4C2e*I9Z$x3TrBnij3Nzv036 zD?00~CzkT2wLb;!Dp^p?)Bm?y{Pb+sZ+eU0^_1Dz?$7-w4J(2fnRJ083D{4vgT*$C z#&WJ*fH$fEs7GhPG=k_0z#&7VgS5~!q8}%O(E61Pev||3a3OTfs0WT9v;s3RaK{1e z<44fVK|etPVNyGAq!ZV966mI&Z%s#-QX+`e6!1oMbW_l`)*?*#1swUo;ui2mTXa*< z_je&o*)4_D6!2~@bW_lGXdq0n2M$wVaSM3A2D&NeE8r2Ps48JK1-u>}-4ygywg^+$ z)v%fZUUQ3X3i_%%gekIGSWN-1(L*-{eYq3D6fRw?rhpeep__ufjssyzxdB#F48f~9 z(2YT#7DpJ9ZwxjDeUcpA0Q7-ZyTbnU3k3uNu5ypgm+ Y8yf-MtiYlVxVat(=K@C@PWXX%0OvZY(EtDd literal 0 HcmV?d00001 diff --git a/docs/OpenDSS/read.md b/docs/OpenDSS/read.md deleted file mode 100644 index 1178c9e1..00000000 --- a/docs/OpenDSS/read.md +++ /dev/null @@ -1,93 +0,0 @@ -# To see whether an attribute is tested or not - -## Line -| Attribute | Tested | -| :------------------:|:-------:| -| name | yes | -| nominal_voltage | yes | -| line_type | no | -| length | yes | -| from_element | yes | -| to_element | yes | -| is_fuse | no | -| is_switch | no | -| is_banked | no | -| faultrate | no | -| wires | yes | -| positions | no | -| impedance_matrix | no | -| capacitance_matrix | no | -| substation_name | no | -| feeder_name | no | -| is_recloser | no | -| is_breaker | no | -| is_sectionalizer | no | -| nameclass | no | -| is_substation | no | -| is_network_protector| no | - - -## Wire -| Attribute | Tested | -| :------------------:|:-------:| -| name | yes | -| phase | yes | -| nameclass | no | -| X | no | -| Y | no | -| diameter | no | -| gmr | no | -| ampacity | no | -| emergency_ampacity | no | -| resistance | no | -| insulation_thickness| no | -| is_fuse | no | -| is_switch | no | -| is_open | no | -| interrupting_rating | no | -| concentric_neutral_gmr | no | -| concentric_neutral_resistance | no | -| concentric_neutral_diameter | no | -| concentric_outside_diameter | no | -| concentric_neutral_nstrand | no | -| drop | no | -| is_recloser | no | -| is_breaker | no | -| is_network_protector| no | -| is_sectionalizer | no | - -## Capacitor -| Attribute | Tested | -| :------------------:|:-------:| -| nominal_voltage | yes | -| connection_type | yes | -| delay | no | -| mode | no | -| low | no | -| high | no | -| resistance | no | -| resistance0 | no | -| reactance | no | -| reactance0 | no | -| susceptance | no | -| susceptance0 | no | -| conductance | no | -| conductance0 | no | -| pt_ratio | no | -| ct_ratio | no | -| pt_phase | no | -| connecting_element | no | -| positions | no | -| measuring_element | no | -| substation_name | no | -| feeder_name | no | -| is_substation | no | - -## Phase Capacitor -| Attribute | Tested | -| :------------------:|:-------:| -| phase | yes | -| var | no | -| switch | no | -| sections | no | -| normalsections | no | diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index 2c30b5eb..feb92179 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss @@ -1,6 +1,6 @@ Clear -New circuit.test_capacitor_connectivity basekv=4.16 pu=1.01 phases=3 bus1=sourcebus +New circuit.test_capacitor_connectivity basekv=4.16 pu=1.01 phases=3 bus1=SourceBus ! Capacitor Cap1 should be a three phase capacitor (3 PhaseCapacitor objects) connected to bus1 New Capacitor.Cap1 Bus1=bus1 phases=3 kVAR=600 kV=4.16 @@ -15,10 +15,10 @@ New Capacitor.Cap3 Bus1=bus3.1 phases=1 kVAR=200.37 kV=2.4 New Capacitor.Cap4 Bus1=bus4.1.3 phases=2 kVAR=400 kV=2.4 ! Capacitors from epri_j1 -New Line.OH_B4904 bus1=B4909.1.2.3 bus2=B4904.1.2.3 length=161.84879 units=m linecode=OH-3X_477AAC_4/0AAACN phases=3 enabled=True -New Line.OH_B18944 bus1=B18941.1.2.3 bus2=B18944.1.2.3 length=141.1224 units=m linecode=OH-3X_4CU_4CUN phases=3 enabled=True New Linecode.OH-3X_477AAC_4/0AAACN nphases=3 r1=0.12241009 x1=0.39494091 r0=0.33466485 x0=1.2742766 c1=11.1973 c0=4.8089 units=km baseFreq=60 normamps=732 emergamps=871 New Linecode.OH-3X_4CU_4CUN nphases=3 r1=0.85376372 x1=0.49484991 r0=1.2302027 x0=1.5569817 c1=8.7903 c0=4.2476 units=km baseFreq=60 normamps=142 emergamps=142 +New Line.OH_B4904 bus1=B4909.1.2.3 bus2=B4904.1.2.3 length=161.84879 units=m linecode=OH-3X_477AAC_4/0AAACN phases=3 enabled=True +New Line.OH_B18944 bus1=B18941.1.2.3 bus2=B18944.1.2.3 length=141.1224 units=m linecode=OH-3X_4CU_4CUN phases=3 enabled=True New Capacitor.B4909-1 bus=B4909 kV=12.47 kvar=900 conn=wye New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py index ca26af38..22ecd594 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py @@ -26,10 +26,12 @@ def test_capacitor_connectivity(): r.parse(m) m.set_names() + # Capacitor Cap1 should be a three phase capacitor (3 PhaseCapacitor objects) connected to bus1 assert len(m["cap1"].phase_capacitors) == 3 # Cap1 is a three phase capacitor assert sum( [phase_capacitor.var for phase_capacitor in m["cap1"].phase_capacitors] ) == pytest.approx(600 * 10 ** 3, 0.0001) + assert m["cap1"].name == "cap1" assert m["cap1"].nominal_voltage == float(4.16) * 10 ** 3 # assert m["cap1"].connection_type is None # Default is set as Y assert m["cap1"].delay is None @@ -37,22 +39,22 @@ def test_capacitor_connectivity(): assert m["cap1"].low is None assert m["cap1"].high is None # assert m["cap1"].resistance is None # 0.0 - assert m["cap1"].resistance0 is None + # assert m["cap1"].resistance0 is None # Not implemented for now # assert m["cap1"].reactance is None # 0.0 - assert m["cap1"].reactance0 is None + # assert m["cap1"].reactance0 is None # Not implemented for now assert m["cap1"].susceptance is None - assert m["cap1"].susceptance0 is None + # assert m["cap1"].susceptance0 is None # Not implemented for now assert m["cap1"].conductance is None - assert m["cap1"].conductance0 is None + # assert m["cap1"].conductance0 is None # Not implemented for now assert m["cap1"].pt_ratio is None assert m["cap1"].ct_ratio is None assert m["cap1"].pt_phase is None assert m["cap1"].connecting_element == "bus1" - # assert m["cap1"].positions is None # [] + # assert m["cap1"].positions is None # [] assert m["cap1"].measuring_element is None - # assert m["cap1"].substation_name is None # '' + # assert m["cap1"].substation_name == '' # Not implemented for now assert m["cap1"].feeder_name == "sourcebus_src" - assert m["cap1"].is_substation == 0 + # assert m["cap1"].is_substation == 0 # Not implemented for now assert set([pc.phase for pc in m["cap1"].phase_capacitors]) == set(["A", "B", "C"]) assert [ @@ -65,22 +67,122 @@ def test_capacitor_connectivity(): phase_capacitor.normalsections for phase_capacitor in m["cap1"].phase_capacitors ] == [None, None, None] + # Capacitor Cap2 should be a one phase capacitor (1 PhaseCapacitor object) connected to bus2 on phase C assert len(m["cap2"].phase_capacitors) == 1 # Cap2 is a one phase capacitor assert m["cap2"].phase_capacitors[0].var == 100 * 10 ** 3 + assert m["cap2"].name == "cap2" + assert m["cap2"].nominal_voltage == float(2.4) * 10 ** 3 + # assert m["cap2"].connection_type is None # Default is set as Y + assert m["cap2"].delay is None + assert m["cap2"].mode is None + assert m["cap2"].low is None + assert m["cap2"].high is None + # assert m["cap2"].resistance is None # 0.0 + # assert m["cap2"].resistance0 is None # Not implemented for now + # assert m["cap2"].reactance is None # 0.0 + # assert m["cap2"].reactance0 is None # Not implemented for now + assert m["cap2"].susceptance is None + # assert m["cap2"].susceptance0 is None # Not implemented for now + assert m["cap2"].conductance is None + # assert m["cap2"].conductance0 is None # Not implemented for now + assert m["cap2"].pt_ratio is None + assert m["cap2"].ct_ratio is None + assert m["cap2"].pt_phase is None + assert m["cap2"].connecting_element == "bus2" + # assert m["cap2"].positions is None # [] + assert m["cap2"].measuring_element is None + # assert m["cap2"].substation_name == '' # Not implemented for now + assert m["cap2"].feeder_name == "sourcebus_src" + # assert m["cap2"].is_substation == 0 # Not implemented for now + + assert m["cap2"].phase_capacitors[0].phase == "C" + assert m["cap2"].phase_capacitors[0].switch == None + assert m["cap2"].phase_capacitors[0].sections == None + assert m["cap2"].phase_capacitors[0].normalsections == None + + # Capacitor Cap3 should be a one phase capacitor (1 PhaseCapacitor object) connected to bus3 on phase A assert len(m["cap3"].phase_capacitors) == 1 # Cap3 is a one phase capacitor assert m["cap3"].phase_capacitors[0].var == 200.37 * 10 ** 3 + assert m["cap3"].name == "cap3" + assert m["cap3"].nominal_voltage == float(2.4) * 10 ** 3 + # assert m["cap3"].connection_type is None # Default is set as Y + assert m["cap3"].delay is None + assert m["cap3"].mode is None + assert m["cap3"].low is None + assert m["cap3"].high is None + # assert m["cap3"].resistance is None # 0.0 + # assert m["cap3"].resistance0 is None # Not implemented for now + # assert m["cap3"].reactance is None # 0.0 + # assert m["cap3"].reactance0 is None # Not implemented for now + assert m["cap3"].susceptance is None + # assert m["cap3"].susceptance0 is None # Not implemented for now + assert m["cap3"].conductance is None + # assert m["cap3"].conductance0 is None # Not implemented for now + assert m["cap3"].pt_ratio is None + assert m["cap3"].ct_ratio is None + assert m["cap3"].pt_phase is None + assert m["cap3"].connecting_element == "bus3" + # assert m["cap3"].positions is None # [] + assert m["cap3"].measuring_element is None + # assert m["cap3"].substation_name == '' # Not implemented for now + assert m["cap3"].feeder_name == "sourcebus_src" + # assert m["cap3"].is_substation == 0 # Not implemented for now + + assert m["cap3"].phase_capacitors[0].phase == "A" + assert m["cap3"].phase_capacitors[0].switch == None + assert m["cap3"].phase_capacitors[0].sections == None + assert m["cap3"].phase_capacitors[0].normalsections == None + + # Capacitor Cap4 should be a two phase capacitor (2 PhaseCapacitor objects) connected to bus4 on phase A and C assert len(m["cap4"].phase_capacitors) == 2 # Cap4 is a two phase capacitor assert sum( [phase_capacitor.var for phase_capacitor in m["cap4"].phase_capacitors] ) == pytest.approx(400 * 10 ** 3, 0.0001) + assert m["cap4"].name == "cap4" + assert m["cap4"].nominal_voltage == float(2.4) * 10 ** 3 + # assert m["cap4"].connection_type is None # Default is set as Y + assert m["cap4"].delay is None + assert m["cap4"].mode is None + assert m["cap4"].low is None + assert m["cap4"].high is None + # assert m["cap4"].resistance is None # 0.0 + # assert m["cap4"].resistance0 is None # Not implemented for now + # assert m["cap4"].reactance is None # 0.0 + # assert m["cap4"].reactance0 is None # Not implemented for now + assert m["cap4"].susceptance is None + # assert m["cap4"].susceptance0 is None # Not implemented for now + assert m["cap4"].conductance is None + # assert m["cap4"].conductance0 is None # Not implemented for now + assert m["cap4"].pt_ratio is None + assert m["cap4"].ct_ratio is None + assert m["cap4"].pt_phase is None + assert m["cap4"].connecting_element == "bus4" + # assert m["cap4"].positions is None # [] + assert m["cap4"].measuring_element is None + # assert m["cap4"].substation_name == '' # Not implemented for now + assert m["cap4"].feeder_name == "sourcebus_src" + # assert m["cap4"].is_substation == 0 # Not implemented for now + + assert set([pc.phase for pc in m["cap4"].phase_capacitors]) == set(["A", "C"]) + assert [ + phase_capacitor.switch for phase_capacitor in m["cap4"].phase_capacitors + ] == [None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["cap4"].phase_capacitors + ] == [None, None] + assert [ + phase_capacitor.normalsections for phase_capacitor in m["cap4"].phase_capacitors + ] == [None, None] + # Capacitors from epri_j1 assert len(m["b4909-1"].phase_capacitors) == 3 # b4909-1 is a three phase capacitor assert sum( [phase_capacitor.var for phase_capacitor in m["b4909-1"].phase_capacitors] ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["b4909-1"].name == "b4909-1" assert m["b4909-1"].nominal_voltage == float(12.47) * 10 ** 3 assert m["b4909-1"].connection_type == "Y" assert m["b4909-1"].delay == 30 @@ -88,22 +190,22 @@ def test_capacitor_connectivity(): # assert m["b4909-1"].low is None # 115.0 # assert m["b4909-1"].high is None # 126.0 # assert m["b4909-1"].resistance is None # 0.0 - assert m["b4909-1"].resistance0 is None + # assert m["b4909-1"].resistance0 is None # Not implemented for now # assert m["b4909-1"].reactance is None # 0.0 - assert m["b4909-1"].reactance0 is None + # assert m["b4909-1"].reactance0 is None # Not implemented for now assert m["b4909-1"].susceptance is None - assert m["b4909-1"].susceptance0 is None + # assert m["b4909-1"].susceptance0 is None # Not implemented for now assert m["b4909-1"].conductance is None - assert m["b4909-1"].conductance0 is None + # assert m["b4909-1"].conductance0 is None # Not implemented for now assert m["b4909-1"].pt_ratio == 60 # assert m["b4909-1"].ct_ratio is None # 60 assert m["b4909-1"].pt_phase == "B" assert m["b4909-1"].connecting_element == "b4909" # assert m["b4909-1"].positions is None # [] assert m["b4909-1"].measuring_element == "Line.OH_B4904" - # assert m["b4909-1"].substation_name is None # '' + # assert m["b4909-1"].substation_name == '' # Not implemented for now assert m["b4909-1"].feeder_name == "sourcebus_src" - assert m["b4909-1"].is_substation == 0 + # assert m["b4909-1"].is_substation == 0 # Not implemented for now assert set([pc.phase for pc in m["b4909-1"].phase_capacitors]) == set( ["A", "B", "C"] @@ -122,6 +224,7 @@ def test_capacitor_connectivity(): # assert len(m["oh_b4904"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD # Phases of the different wires # assert set([w.phase for w in m["oh_b4904"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["oh_b4904"].name == "oh_b4904" assert ( m["oh_b4904"].nameclass == "OH-3X_477AAC_4/0AAACN" ) # Linecode is OH-3X_477AAC_4/0AAACN @@ -132,18 +235,18 @@ def test_capacitor_connectivity(): assert m["oh_b4904"].nominal_voltage == float(4.16) * 10 ** 3 assert m["oh_b4904"].is_fuse is None assert m["oh_b4904"].is_switch is None - assert m["oh_b4904"].is_banked is None + # assert m["oh_b4904"].is_banked is None # Not implemented for now assert m["oh_b4904"].faultrate == 0.1 - # assert m["oh_b4904"].positions is None # [] - # assert m["oh_b4904"].impedance_matrix == None # Fill in later # [[(0.09813333+0.2153j), (0.04013333+0.0947j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.09813333+0.2153j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.04013333+0.0947j), (0.09813333+0.2153j)]] - # assert m["oh_b4904"].capacitance_matrix == None # [[(2.8+0j), (-0.6+0j), (-0.6+0j)], [(-0.6+0j), (2.8+0j), (-0.6+0j)], [(-0.6+0j), (-0.6+0j), (2.8+0j)]] - assert m["oh_b4904"].substation_name is None + # assert m["oh_b4904"].positions == [] # Not implemented for now + # assert m["oh_b4904"].impedance_matrix == [[(0.0001931617+0.0006880528j), (7.075159e-05+0.0002931119j), (7.075159e-05+0.0002931119j)], [(7.075159e-05+0.00029311...075159e-05+0.0002931119j)], [(7.075159e-05+0.0002931119j), (7.075159e-05+0.0002931119j), (0.0001931617+0.0006880528j)]] + # assert m["oh_b4904"].capacitance_matrix == [[(0.009067833+0j), (-0.002129467+0j), (-0.002129467+0j)], [(-0.002129467+0j), (0.009067833+0j), (-0.002129467+0j)], [(-0.002129467+0j), (-0.002129467+0j), (0.009067833+0j)]] + # assert m["oh_b4904"].substation_name is None assert m["oh_b4904"].feeder_name == "sourcebus_src" assert m["oh_b4904"].is_recloser is None assert m["oh_b4904"].is_breaker is None - assert m["oh_b4904"].is_sectionalizer is None - assert m["oh_b4904"].is_substation == 0 - assert m["oh_b4904"].is_network_protector is None + # assert m["oh_b4904"].is_sectionalizer is None # Not implemented for now + # assert m["oh_b4904"].is_substation == 0 # Not implemented for now + # assert m["oh_b4904"].is_network_protector is None # Not implemented for now for w in m["oh_b4904"].wires: assert w.nameclass == "4/0AAACN" @@ -151,24 +254,24 @@ def test_capacitor_connectivity(): assert w.Y is None assert w.diameter is None assert w.gmr is None - # assert w.ampacity == float(732) # 400.0 - # assert w.emergency_ampacity == float(871) # 600.0 + assert w.ampacity == float(732) + assert w.emergency_ampacity == float(871) assert w.resistance is None - # assert w.insulation_thickness is None # 0.0 - # assert w.is_fuse is None # 0 - # assert w.is_switch is None # 0 + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # 0 # Needs to be deprecated + # assert w.is_switch is None # 0 # Needs to be deprecated assert w.is_open is None - assert w.interrupting_rating is None + # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - assert w.drop == 0 - # assert w.is_recloser is None # 0 - # assert w.is_breaker is None # 0 - assert w.is_network_protector is None - assert w.is_sectionalizer is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # 0 # Needs to be deprecated + # assert w.is_breaker is None # 0 # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated assert ( len(m["b18944-1"].phase_capacitors) == 3 @@ -176,6 +279,7 @@ def test_capacitor_connectivity(): assert sum( [phase_capacitor.var for phase_capacitor in m["b18944-1"].phase_capacitors] ) == pytest.approx(1200 * 10 ** 3, 0.0001) + assert m["b18944-1"].name == "b18944-1" assert m["b18944-1"].nominal_voltage == float(12.47) * 10 ** 3 assert m["b18944-1"].connection_type == "Y" assert m["b18944-1"].delay == 31 @@ -192,7 +296,7 @@ def test_capacitor_connectivity(): assert m["b18944-1"].conductance0 is None assert m["b18944-1"].pt_ratio == 60 # assert m["b18944-1"].ct_ratio is None # 60.0 - # assert m["b18944-1"].pt_phase == "B" # A + assert m["b18944-1"].pt_phase == "A" assert m["b18944-1"].connecting_element == "b18941" # assert m["b18944-1"].positions is None # [] assert m["b18944-1"].measuring_element == "Line.OH_B18944" @@ -217,6 +321,7 @@ def test_capacitor_connectivity(): # assert len(m["oh_b18944"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD # Phases of the different wires # assert set([w.phase for w in m["oh_b18944"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["oh_b18944"].name == "oh_b18944" assert m["oh_b18944"].nameclass == "OH-3X_4CU_4CUN" # Linecode is OH-3X_4CU_4CUN assert m["oh_b18944"].line_type == "overhead" # OH in lincecode assert m["oh_b18944"].from_element == "b18941" @@ -225,18 +330,18 @@ def test_capacitor_connectivity(): assert m["oh_b18944"].nominal_voltage == float(4.16) * 10 ** 3 assert m["oh_b18944"].is_fuse is None assert m["oh_b18944"].is_switch is None - assert m["oh_b18944"].is_banked is None + # assert m["oh_b18944"].is_banked is None # Not implemented for now assert m["oh_b18944"].faultrate == 0.1 - # assert m["oh_b18944"].positions is None # [] - # assert m["oh_b18944"].impedance_matrix == None # Fill in later # [[(0.09813333+0.2153j), (0.04013333+0.0947j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.09813333+0.2153j), (0.04013333+0.0947j)], [(0.04013333+0.0947j), (0.04013333+0.0947j), (0.09813333+0.2153j)]] - # assert m["oh_b18944"].capacitance_matrix == None # [[(2.8+0j), (-0.6+0j), (-0.6+0j)], [(-0.6+0j), (2.8+0j), (-0.6+0j)], [(-0.6+0j), (-0.6+0j), (2.8+0j)]] - assert m["oh_b18944"].substation_name is None + # assert m["oh_b18944"].positions is None # [] # Not implemented for now + # assert m["oh_b18944"].impedance_matrix == None # [[(0.0009792434+0.0008488938j), (0.0001254797+0.0003540439j), (0.0001254797+0.0003540439j)], [(0.0001254797+0.00035404...0001254797+0.0003540439j)], [(0.0001254797+0.0003540439j), (0.0001254797+0.0003540439j), (0.0009792434+0.0008488938j)]] + # assert m["oh_b18944"].capacitance_matrix == None # [[(0.007276067+0j), (-0.001514233+0j), (-0.001514233+0j)], [(-0.001514233+0j), (0.007276067+0j), (-0.001514233+0j)], [(-0.001514233+0j), (-0.001514233+0j), (0.007276067+0j)]] + # assert m["oh_b18944"].substation_name is None # Not implemented for now assert m["oh_b18944"].feeder_name == "sourcebus_src" assert m["oh_b18944"].is_recloser is None assert m["oh_b18944"].is_breaker is None - assert m["oh_b18944"].is_sectionalizer is None - assert m["oh_b18944"].is_substation == 0 - assert m["oh_b18944"].is_network_protector is None + # assert m["oh_b18944"].is_sectionalizer is None # Not implemented for now + # assert m["oh_b18944"].is_substation == 0 # Not implemented for now + # assert m["oh_b18944"].is_network_protector is None # Not implemented for now for w in m["oh_b18944"].wires: assert w.nameclass == "4CUN" @@ -244,24 +349,24 @@ def test_capacitor_connectivity(): assert w.Y is None assert w.diameter is None assert w.gmr is None - assert w.ampacity == float(142) # 400.0 - # assert w.emergency_ampacity == float(142) # 600.0 - # assert w.resistance is None - # assert w.insulation_thickness is None # 0.0 - # assert w.is_fuse is None # 0 - # assert w.is_switch is None # 0 + assert w.ampacity == float(142) + assert w.emergency_ampacity == float(142) + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # 0 # Needs to be deprecated + # assert w.is_switch is None # 0 # Needs to be deprecated assert w.is_open is None - assert w.interrupting_rating is None + # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - assert w.drop == 0 - # assert w.is_recloser is None # 0 - # assert w.is_breaker is None # 0 - assert w.is_network_protector is None - assert w.is_sectionalizer is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # 0 # Needs to be deprecated + # assert w.is_breaker is None # 0 # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated # Capacitors from ieee 8500-node test feeder @@ -269,6 +374,7 @@ def test_capacitor_connectivity(): len(m["capbank0a"].phase_capacitors) == 1 ) # capbank0a is a single phase capacitor assert m["capbank0a"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0a"].name == "capbank0a" assert m["capbank0a"].nominal_voltage == float(7.2) * 10 ** 3 assert m["capbank0a"].connection_type == "Y" assert m["capbank0a"].delay == None @@ -276,22 +382,22 @@ def test_capacitor_connectivity(): assert m["capbank0a"].low is None assert m["capbank0a"].high is None # assert m["capbank0a"].resistance is None # 0.0 - assert m["capbank0a"].resistance0 is None + # assert m["capbank0a"].resistance0 is None # Not implemented for now # assert m["capbank0a"].reactance is None # 0.0 - assert m["capbank0a"].reactance0 is None + # assert m["capbank0a"].reactance0 is None # Not implemented for now assert m["capbank0a"].susceptance is None - assert m["capbank0a"].susceptance0 is None + # assert m["capbank0a"].susceptance0 is None # Not implemented for now assert m["capbank0a"].conductance is None - assert m["capbank0a"].conductance0 is None + # assert m["capbank0a"].conductance0 is None # Not implemented for now assert m["capbank0a"].pt_ratio == None assert m["capbank0a"].ct_ratio is None assert m["capbank0a"].pt_phase == None assert m["capbank0a"].connecting_element == "r42246" # assert m["capbank0a"].positions is None # [] assert m["capbank0a"].measuring_element == None - # assert m["capbank0a"].substation_name is None # '' + # assert m["capbank0a"].substation_name is None # '' # Not implemented for now assert m["capbank0a"].feeder_name == "sourcebus_src" - assert m["capbank0a"].is_substation == 0 + # assert m["capbank0a"].is_substation == 0 # Not implemented for now assert m["capbank0a"].phase_capacitors[0].phase == "A" assert m["capbank0a"].phase_capacitors[0].switch == None @@ -302,6 +408,7 @@ def test_capacitor_connectivity(): len(m["capbank0b"].phase_capacitors) == 1 ) # capbank0b is a single phase capacitor assert m["capbank0b"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0b"].name == "capbank0b" assert m["capbank0b"].nominal_voltage == float(7.2) * 10 ** 3 assert m["capbank0b"].connection_type == "Y" assert m["capbank0b"].delay == None @@ -309,22 +416,22 @@ def test_capacitor_connectivity(): assert m["capbank0b"].low is None assert m["capbank0b"].high is None # assert m["capbank0b"].resistance is None # 0.0 - assert m["capbank0b"].resistance0 is None + # assert m["capbank0b"].resistance0 is None # Not implemented for now # assert m["capbank0b"].reactance is None # 0.0 - assert m["capbank0b"].reactance0 is None + # assert m["capbank0b"].reactance0 is None # Not implemented for now assert m["capbank0b"].susceptance is None - assert m["capbank0b"].susceptance0 is None + # assert m["capbank0b"].susceptance0 is None # Not implemented for now assert m["capbank0b"].conductance is None - assert m["capbank0b"].conductance0 is None + # assert m["capbank0b"].conductance0 is None # Not implemented for now assert m["capbank0b"].pt_ratio == None assert m["capbank0b"].ct_ratio is None assert m["capbank0b"].pt_phase == None assert m["capbank0b"].connecting_element == "r42246" # assert m["capbank0b"].positions is None # [] assert m["capbank0b"].measuring_element == None - # assert m["capbank0b"].substation_name is None # '' + # assert m["capbank0b"].substation_name == '' # Not implemented for now assert m["capbank0b"].feeder_name == "sourcebus_src" - assert m["capbank0b"].is_substation == 0 + # assert m["capbank0b"].is_substation == 0 # Not implemented for now assert m["capbank0b"].phase_capacitors[0].phase == "B" assert m["capbank0b"].phase_capacitors[0].switch == None @@ -335,6 +442,7 @@ def test_capacitor_connectivity(): len(m["capbank0c"].phase_capacitors) == 1 ) # capbank0c is a single phase capacitor assert m["capbank0c"].phase_capacitors[0].var == 400 * 10 ** 3 + assert m["capbank0c"].name == "capbank0c" assert m["capbank0c"].nominal_voltage == float(7.2) * 10 ** 3 assert m["capbank0c"].connection_type == "Y" assert m["capbank0c"].delay == None @@ -342,22 +450,22 @@ def test_capacitor_connectivity(): assert m["capbank0c"].low is None assert m["capbank0c"].high is None # assert m["capbank0c"].resistance is None # 0.0 - assert m["capbank0c"].resistance0 is None + # assert m["capbank0c"].resistance0 is None # Not implemented for now # assert m["capbank0c"].reactance is None # 0.0 - assert m["capbank0c"].reactance0 is None + # assert m["capbank0c"].reactance0 is None # Not implemented for now assert m["capbank0c"].susceptance is None - assert m["capbank0c"].susceptance0 is None + # assert m["capbank0c"].susceptance0 is None # Not implemented for now assert m["capbank0c"].conductance is None - assert m["capbank0c"].conductance0 is None + # assert m["capbank0c"].conductance0 is None # Not implemented for now assert m["capbank0c"].pt_ratio == None assert m["capbank0c"].ct_ratio is None assert m["capbank0c"].pt_phase == None assert m["capbank0c"].connecting_element == "r42246" # assert m["capbank0c"].positions is None # [] assert m["capbank0c"].measuring_element == None - # assert m["capbank0c"].substation_name is None # '' + # assert m["capbank0c"].substation_name == '' assert m["capbank0c"].feeder_name == "sourcebus_src" - assert m["capbank0c"].is_substation == 0 + # assert m["capbank0c"].is_substation == 0 # Not implemented for now assert m["capbank0c"].phase_capacitors[0].phase == "C" assert m["capbank0c"].phase_capacitors[0].switch == None @@ -371,6 +479,7 @@ def test_capacitor_connectivity(): assert sum( [phase_capacitor.var for phase_capacitor in m["capbank3"].phase_capacitors] ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["capbank3"].name == "capbank3" assert m["capbank3"].nominal_voltage == float(12.47112) * 10 ** 3 assert m["capbank3"].connection_type == "Y" assert m["capbank3"].delay == None @@ -378,22 +487,22 @@ def test_capacitor_connectivity(): assert m["capbank3"].low is None assert m["capbank3"].high is None # assert m["capbank3"].resistance is None # 0.0 - assert m["capbank3"].resistance0 is None + # assert m["capbank3"].resistance0 is None # Not implemented for now # assert m["capbank3"].reactance is None # 0.0 - assert m["capbank3"].reactance0 is None + # assert m["capbank3"].reactance0 is None # Not implemented for now assert m["capbank3"].susceptance is None - assert m["capbank3"].susceptance0 is None + # assert m["capbank3"].susceptance0 is None # Not implemented for now assert m["capbank3"].conductance is None - assert m["capbank3"].conductance0 is None + # assert m["capbank3"].conductance0 is None # Not implemented for now assert m["capbank3"].pt_ratio == None assert m["capbank3"].ct_ratio is None assert m["capbank3"].pt_phase == None assert m["capbank3"].connecting_element == "r18242" # assert m["capbank3"].positions is None # [] assert m["capbank3"].measuring_element == None - # assert m["capbank3"].substation_name is None # '' + # assert m["capbank3"].substation_name == '' # Not implemented for now assert m["capbank3"].feeder_name == "sourcebus_src" - assert m["capbank3"].is_substation == 0 + # assert m["capbank3"].is_substation == 0 # Not implemented for now assert set([pc.phase for pc in m["capbank3"].phase_capacitors]) == set( ["A", "B", "C"] @@ -417,28 +526,29 @@ def test_capacitor_connectivity(): [phase_capacitor.var for phase_capacitor in m["capbank3-1"].phase_capacitors] ) == pytest.approx(900 * 10 ** 3, 0.0001) assert m["capbank3-1"].nominal_voltage == float(12.47112) * 10 ** 3 + assert m["capbank3-1"].name == "capbank3-1" assert m["capbank3-1"].connection_type == "Y" assert m["capbank3-1"].delay == None assert m["capbank3-1"].mode == None assert m["capbank3-1"].low is None assert m["capbank3-1"].high is None # assert m["capbank3-1"].resistance is None # 0.0 - assert m["capbank3-1"].resistance0 is None + # assert m["capbank3-1"].resistance0 is None # Not implemented for now # assert m["capbank3-1"].reactance is None # 0.0 - assert m["capbank3-1"].reactance0 is None + # assert m["capbank3-1"].reactance0 is None # Not implemented for now assert m["capbank3-1"].susceptance is None - assert m["capbank3-1"].susceptance0 is None + # assert m["capbank3-1"].susceptance0 is None # Not implemented for now assert m["capbank3-1"].conductance is None - assert m["capbank3-1"].conductance0 is None + # assert m["capbank3-1"].conductance0 is None # Not implemented for now assert m["capbank3-1"].pt_ratio == None assert m["capbank3-1"].ct_ratio is None assert m["capbank3-1"].pt_phase == None assert m["capbank3-1"].connecting_element == "r18242" # assert m["capbank3-1"].positions is None # [] assert m["capbank3-1"].measuring_element == None - # assert m["capbank3-1"].substation_name is None # '' + # assert m["capbank3-1"].substation_name == '' # Not implemented for now assert m["capbank3-1"].feeder_name == "sourcebus_src" - assert m["capbank3-1"].is_substation == 0 + # assert m["capbank3-1"].is_substation == 0 # Not implemented for now assert set([pc.phase for pc in m["capbank3-1"].phase_capacitors]) == set( ["A", "B", "C"] diff --git a/tests/readers/opendss/Concentric/test_concentric.dss b/tests/readers/opendss/Concentric/test_concentric.dss new file mode 100644 index 00000000..b9352ddb --- /dev/null +++ b/tests/readers/opendss/Concentric/test_concentric.dss @@ -0,0 +1,13 @@ +Clear + +New Circuit.Name1 bus1=cnbus pu=1.0416666666666667 basekV=13.200000000000001 R1=0.001 X1=0.001 R0=0.001 X0=0.001 + +New CNDATA.cndata1 nsLayer=0.005283199999999999 DiaIns=0.039116 k=21 DiaStrand=0.0032639 Rstrand=2.103036027191271e-05 Diam=0.0285496 DiaCable=0.053085999999999994 Rac=3.541824598903899e-05 GmrStrand=0.00127096266 GMRac=0.0111252 Runits=m Radunits=m GMRunits=m + +New LineGeometry.Geometry_1 Nconds=4 Nphases=3 Units=m Cond=1 CNCable=cndata1 X=0.0 H=-0.9144000000000001 Normamps=725.0 Emergamps=905.0 Cond=2 CNCable=cndata1 X=0.42672 H=-0.9144000000000001 Normamps=725.0 Emergamps=905.0 Cond=3 CNCable=cndata1 X=0.70104 H=-0.7924800000000001 Normamps=725.0 Emergamps=905.0 Cond=4 CNCable=cndata1 X=0.0 H=-0.67056 Normamps=725.0 Emergamps=905.0 Reduce=y + +New Line.line1 Units=km Length=0.14602968000000002 bus1=bus1.1.2.3 bus2=bus2.1.2.3 switch=n enabled=y phases=3 geometry=Geometry_1 + +Set Voltagebases=[13.200000000000001 ] +Calcvoltagebases +Solve diff --git a/tests/readers/opendss/Concentric/test_concentric.py b/tests/readers/opendss/Concentric/test_concentric.py new file mode 100644 index 00000000..3b9ba201 --- /dev/null +++ b/tests/readers/opendss/Concentric/test_concentric.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +""" +test_line_connectivity.py +---------------------------------- + +Tests for checking the line connectivity and all the attributes of line and wire +""" +import logging +import os + +import six + +import tempfile +import pytest as pt + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_line_connectivity(): + """Tests if line length units are in meters.""" + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_line_connectivity.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_concentric.dss")) + r.parse(m) + m.set_names() + + assert m["line1"].name == "line1" + assert ( + len(m["line1"].wires) == 4 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert set([w.phase for w in m["line1"].wires]) == set( + ["A", "B", "C", "N"] + ) # Neutral wire is not counted. TBD + assert m["line1"].from_element == "bus1" + assert m["line1"].to_element == "bus2" + assert m["line1"].nominal_voltage == float(13.200000000000001) * 10 ** 3 + assert m["line1"].line_type == "underground" + assert m["line1"].length == pt.approx(0.14602968000000002 * 1000) + assert m["line1"].is_fuse is None + assert m["line1"].is_switch is None + assert m["line1"].is_banked is None + assert m["line1"].faultrate == 0.1 + # assert m["line1"].positions is None # [] + # assert m["line1"].impedance_matrix is None # [[(3.889112e-05+6.05343e-05j), (-6.045299e-10-1.058095e-09j), (-3.3978949999999997e-10-5.525341e-10j)], [(-6.045299e-1....656239e-09j)], [(-3.3978949999999997e-10-5.525341e-10j), (-8.839466e-10-1.656239e-09j), (3.889101e-05+6.053392e-05j)]] + # assert m["line1"].capacitance_matrix is None # [[(0.4063406+0j), 0j, 0j], [0j, (0.4063406+0j), 0j], [0j, 0j, (0.4063406+0j)]] + assert m["line1"].substation_name is None + assert m["line1"].feeder_name == "cnbus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + assert m["line1"].is_sectionalizer is None + assert m["line1"].nameclass == "" + assert m["line1"].is_substation == 0 + assert m["line1"].is_network_protector is None + + for w in m["line1"].wires: + assert w.nameclass == "cndata1" + assert w.X == 0.0 + assert w.Y == pt.approx(-0.9144000000000001) + # assert w.diameter == 0.0285496 + # assert w.gmr == 0.0111252 + # assert w.ampacity is None # -1.0 + # assert w.emergency_ampacity is None # -1.0 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + assert w.is_fuse == 0 + assert w.is_switch is None + assert w.is_open is None + assert w.interrupting_rating is None + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + assert w.drop == 0 + assert w.is_recloser == 0 + assert w.is_breaker == 0 + assert w.is_network_protector is None + assert w.is_sectionalizer is None diff --git a/tests/readers/opendss/Lines/test_concentricneutral.dss b/tests/readers/opendss/Lines/test_concentricneutral.dss index 1c110c53..84866d90 100644 --- a/tests/readers/opendss/Lines/test_concentricneutral.dss +++ b/tests/readers/opendss/Lines/test_concentricneutral.dss @@ -1,3 +1,3 @@ -New CNDATA.250_1/3 k=13 DiaStrand=0.064 Rstrand=2.816666667 epsR=2.3 +New CNDATA.cndata1 k=13 DiaStrand=0.064 Rstrand=2.816666667 epsR=2.3 ~ InsLayer=0.220 DiaIns=1.06 DiaCable=1.16 Rac=0.076705 GMRac=0.20568 diam=0.573 ~ Runits=kft Radunits=in GMRunits=in diff --git a/tests/readers/opendss/Lines/test_fuses.dss b/tests/readers/opendss/Lines/test_fuses.dss index 1caf3100..4572b21c 100644 --- a/tests/readers/opendss/Lines/test_fuses.dss +++ b/tests/readers/opendss/Lines/test_fuses.dss @@ -4,17 +4,17 @@ New circuit.test_fuses basekv=12.47 pu=1.01 phases=3 bus1=sourcebus New Line.origin Units=km Length=0.001 bus1=sourcebus bus2=node1 phases=3 -New Line.line1 Units=km Length=0.001 bus1=node1.1.2.3 bus2=node2.1.2.3 switch=n enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 +New Line.line1 Units=km Length=0.001 bus1=node1.1.2.3 bus2=node2.1.2.3 switch=n enabled=y phases=3 Normamps=3000 EmergAmps=4000 New Fuse.Fuse_1 monitoredobj=Line.line1 enabled=y -New Line.line2 Units=km Length=0.001 bus1=node1.1 bus2=node3.1 switch=n enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 +New Line.line2 Units=km Length=0.001 bus1=node1.1 bus2=node3.1 switch=n enabled=y phases=1 Normamps=3000 EmergAmps=4000 New Fuse.Fuse_2 monitoredobj=Line.line2 enabled=y -New Line.line3 Units=km Length=0.001 bus1=node1.3 bus2=node4.3 switch=n enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 +New Line.line3 Units=km Length=0.001 bus1=node1.3 bus2=node4.3 switch=n enabled=y phases=1 Normamps=3000 EmergAmps=4000 New Fuse.Fuse_3 monitoredobj=Line.line3 enabled=y -New Line.line4 Units=km Length=0.001 bus1=node1.2.3 bus2=node4.2.3 switch=n enabled=y phases=2 Normamps=3000 EmergencyAmps=4000 -New Fuse.Fuse_4 monitoredobj=Line.line4 enabled=y +New Line.line4 Units=km Length=0.001 bus1=node1.2.3 bus2=node4.2.3 switch=n enabled=y phases=2 Normamps=3000 EmergAmps=4000 +New Fuse.Fuse_4 monitoredobj=Line.line4 enabled=True Set Voltagebases=[12.47] Calcvoltagebases diff --git a/tests/readers/opendss/Lines/test_fuses.py b/tests/readers/opendss/Lines/test_fuses.py new file mode 100644 index 00000000..c70212b9 --- /dev/null +++ b/tests/readers/opendss/Lines/test_fuses.py @@ -0,0 +1,335 @@ +# -*- coding: utf-8 -*- + +""" +test_fuses.py +---------------------------------- + +Tests for fuse attribute of Line +""" +import logging +import os + +import six + +import tempfile +import pytest as pt +import json + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_fuses(): + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_fuses.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_fuses.dss")) + r.parse(m) + m.set_names() + + # Reading OpenDSS default values + with open( + os.path.join(current_directory, "../../../../docs/OpenDSS/Default_Values.json") + ) as f: + json_data = json.load(f) + + # assert len(m["origin"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["origin"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["origin"].name == "origin" + assert m["origin"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["origin"].line_type == "underground" + assert m["origin"].length == 0.001 * 1000 # units = km + assert m["origin"].from_element == "sourcebus" + assert m["origin"].to_element == "node1" + assert m["origin"].is_fuse is None + assert m["origin"].is_switch is None + # assert m["origin"].is_banked is None # Not implemented for now + assert m["origin"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["origin"].positions is None # Not implemented for now + assert m["origin"].impedance_matrix == [ + [ + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + ], + ] # units = km + assert m["origin"].capacitance_matrix == [ + [(0.0028 + 0j), (-0.0006 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (0.0028 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (-0.0006 + 0j), (0.0028 + 0j)], + ] # units = km + # assert m["origin"].substation_name is None # Not implemented for now + assert m["origin"].feeder_name == "sourcebus_src" + assert m["origin"].is_recloser is None + assert m["origin"].is_breaker is None + # assert m["origin"].is_sectionalizer is None # Not implemented for now + assert m["origin"].nameclass == "" + # assert m["origin"].is_substation == 0 # Not implemented for now + # assert m["origin"].is_network_protector is None # Not implemented for now + + for w in m["origin"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # assert len(m["line1"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line1"].name == "line1" + assert m["line1"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line1"].line_type == "underground" + assert m["line1"].length == 0.001 * 1000 # units = km + assert m["line1"].from_element == "node1" + assert m["line1"].to_element == "node2" + assert m["line1"].is_fuse == 1 + assert m["line1"].is_switch is None + # assert m["line1"].is_banked is None # Not implemented for now + assert m["line1"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line1"].positions is None # Not implemented for now + assert m["line1"].impedance_matrix == [ + [ + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + ], + ] # units = km + assert m["line1"].capacitance_matrix == [ + [(0.0028 + 0j), (-0.0006 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (0.0028 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (-0.0006 + 0j), (0.0028 + 0j)], + ] # units = km + # assert m["line1"].substation_name is None # Not implemented for now + assert m["line1"].feeder_name == "sourcebus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + # assert m["line1"].is_sectionalizer is None # Not implemented for now + assert m["line1"].nameclass == "line1" + # assert m["line1"].is_substation == 0 # Not implemented for now + # assert m["line1"].is_network_protector is None # Not implemented for now + + for w in m["line1"].wires: + assert w.nameclass == "line1" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert ( + len(m["line2"].wires) == 1 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert m["line2"].wires[0].phase == "A" + assert m["line2"].name == "line2" + assert m["line2"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line2"].line_type == "underground" + assert m["line2"].length == 0.001 * 1000 # units = km + assert m["line2"].from_element == "node1" + assert m["line2"].to_element == "node3" + assert m["line2"].is_fuse == 1 + assert m["line2"].is_switch is None + # assert m["line2"].is_banked is None # Not implemented for now + assert m["line2"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line2"].positions is None # Not implemented for now + assert m["line2"].impedance_matrix == [[(5.8e-05 + 0.0001206j)]] # units = km + assert m["line2"].capacitance_matrix == [[(0.0034 + 0j)]] # units = km + # assert m["line2"].substation_name is None # Not implemented for now + assert m["line2"].feeder_name == "sourcebus_src" + assert m["line2"].is_recloser is None + assert m["line2"].is_breaker is None + # assert m["line2"].is_sectionalizer is None # Not implemented for now + assert m["line2"].nameclass == "line2" + # assert m["line2"].is_substation == 0 # Not implemented for now + # assert m["line2"].is_network_protector is None # Not implemented for now + + for w in m["line2"].wires: + assert w.nameclass == "line2" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["line3"].wires) == 1 + # Phases of the different wires + assert m["line3"].wires[0].phase == "C" + assert m["line3"].name == "line3" + assert m["line3"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line3"].line_type == "underground" + assert m["line3"].length == 0.001 * 1000 # units = km + assert m["line3"].from_element == "node1" + assert m["line3"].to_element == "node4" + assert m["line3"].is_fuse == 1 + assert m["line3"].is_switch is None + # assert m["line3"].is_banked is None # Not implemented for now + assert m["line3"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line3"].positions is None # Not implemented for now + assert m["line3"].impedance_matrix == [[(5.8e-05 + 0.0001206j)]] # units = km + assert m["line3"].capacitance_matrix == [[(0.0034 + 0j)]] # units = km + # assert m["line3"].substation_name is None # Not implemented for now + assert m["line3"].feeder_name == "sourcebus_src" + assert m["line3"].is_recloser is None + assert m["line3"].is_breaker is None + # assert m["line3"].is_sectionalizer is None # Not implemented for now + assert m["line3"].nameclass == "line3" + # assert m["line3"].is_substation == 0 # Not implemented for now + # assert m["line3"].is_network_protector is None # Not implemented for now + + for w in m["line3"].wires: + assert w.nameclass == "line3" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["line4"].wires) == 2 + # Phases of the different wires + assert set([w.phase for w in m["line4"].wires]) == set(["B", "C"]) + assert m["line4"].name == "line4" + assert m["line4"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["line4"].line_type == "underground" + assert m["line4"].length == 0.001 * 1000 # units = km + assert m["line4"].from_element == "node1" + assert m["line4"].to_element == "node4" + assert m["line4"].is_fuse == 1 + assert m["line4"].is_switch is None + # assert m["line4"].is_banked is None # Not implemented for now + assert m["line4"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line4"].positions is None # Not implemented for now + assert m["line4"].impedance_matrix == [ + [(9.813333e-05 + 0.0002153j), (4.013333e-05 + 9.470000000000001e-05j)], + [(4.013333e-05 + 9.470000000000001e-05j), (9.813333e-05 + 0.0002153j)], + ] # units = km + assert m["line4"].capacitance_matrix == [ + [(0.0028 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (0.0028 + 0j)], + ] # units = km + # assert m["line4"].substation_name is None # Not implemented for now + assert m["line4"].feeder_name == "sourcebus_src" + assert m["line4"].is_recloser is None + assert m["line4"].is_breaker is None + # assert m["line4"].is_sectionalizer is None # Not implemented for now + assert m["line4"].nameclass == "line4" + # assert m["line4"].is_substation == 0 # Not implemented for now + # assert m["line4"].is_network_protector is None # Not implemented for now + + for w in m["line4"].wires: + assert w.nameclass == "line4" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated diff --git a/tests/readers/opendss/Lines/test_line_connectivity.py b/tests/readers/opendss/Lines/test_line_connectivity.py index 012fa14e..c01e4e4d 100644 --- a/tests/readers/opendss/Lines/test_line_connectivity.py +++ b/tests/readers/opendss/Lines/test_line_connectivity.py @@ -4,7 +4,7 @@ test_line_connectivity.py ---------------------------------- -Tests for checking the line connectivity and all the attributes of line and wire +Tests for checking the line connectivity. """ import logging import os @@ -13,6 +13,7 @@ import tempfile import pytest as pt +import json logger = logging.getLogger(__name__) @@ -20,7 +21,6 @@ def test_line_connectivity(): - """Tests if line length units are in meters.""" from ditto.store import Store from ditto.readers.opendss.read import Reader @@ -31,80 +31,412 @@ def test_line_connectivity(): ) r.parse(m) m.set_names() + + # Reading OpenDSS default values + with open( + os.path.join(current_directory, "../../../../docs/OpenDSS/Default_Values.json") + ) as f: + json_data = json.load(f) + + # Line1 connects sourcebus to bus1 and should have 4 wires: A, B, C, and N # assert len(m["line1"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD # Phases of the different wires # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line1"].name == "line1" assert m["line1"].nominal_voltage == float(4.16) * 10 ** 3 - # assert m["line1"].line_type == "underground" # Default is overhead, ditto changed it to underground since it checks for OH in linecode + assert m["line1"].line_type == "underground" assert m["line1"].length == 100 + assert m["line1"].from_element == "sourcebus" + assert m["line1"].to_element == "bus1" assert m["line1"].is_fuse is None assert m["line1"].is_switch is None - assert m["line1"].is_banked is None - # assert m["line1"].faultrate is None # 0.1 - # assert m["line1"].positions is None # [] - # assert m["line1"].impedance_matrix is None # Value - # assert m["line1"].capacitance_matrix is None # Value - assert m["line1"].substation_name is None + # assert m["line1"].is_banked is None # Not implemented for now + assert m["line1"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line1"].positions is None # Not implemented for now + assert m["line1"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line1"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line1"].substation_name is None # Not implemented for now assert m["line1"].feeder_name == "sourcebus_src" assert m["line1"].is_recloser is None assert m["line1"].is_breaker is None - assert m["line1"].is_sectionalizer is None - # assert m["line1"].nameclass is None ## '' - assert m["line1"].is_substation == 0 ## Value is 0, assumed None - assert m["line1"].is_network_protector is None + # assert m["line1"].is_sectionalizer is None # Not implemented for now + assert m["line1"].nameclass == "" + # assert m["line1"].is_substation == 0 # Not implemented for now + # assert m["line1"].is_network_protector is None # Not implemented for now for w in m["line1"].wires: - # assert w.nameclass is None # Value is '' + assert w.nameclass == "" assert w.X is None assert w.Y is None assert w.diameter is None assert w.gmr is None - # assert w.ampacity is None # 400.0 - # assert w.emergency_ampacity is None # 600.0 + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None - # assert w.insulation_thickness is None # 0.0 - # assert w.is_fuse is None # 0 - # assert w.is_switch is None # 0 + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - assert w.interrupting_rating is None + # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - assert w.drop == 0 - # assert w.is_recloser is None # 0 - # assert w.is_breaker is None # 0 - assert w.is_network_protector is None - assert w.is_sectionalizer is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated - """ - assert m["line1"].from_element == "sourcebus" - assert m["line1"].to_element == "bus1" - -# assert len(m["line2"].wires) == 4 + # Line2 connects bus1 to bus2 and should have 4 wires: A, B, C, and N + # assert len(m["line2"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line2"].name == "line2" + assert m["line2"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line2"].line_type == "underground" + assert m["line2"].length == 200 assert m["line2"].from_element == "bus1" assert m["line2"].to_element == "bus2" + assert m["line2"].is_fuse is None + assert m["line2"].is_switch is None + # assert m["line2"].is_banked is None # Not implemented for now + assert m["line2"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line2"].positions is None # Not implemented for now + assert m["line2"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line2"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line2"].substation_name is None # Not implemented for now + assert m["line2"].feeder_name == "sourcebus_src" + assert m["line2"].is_recloser is None + assert m["line2"].is_breaker is None + # assert m["line2"].is_sectionalizer is None # Not implemented for now + assert m["line2"].nameclass == "" + # assert m["line2"].is_substation == 0 # Not implemented for now + # assert m["line2"].is_network_protector is None # Not implemented for now + + for w in m["line2"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated - #assert len(m["line3"].wires) == 3 + # Line3 connects bus2 to bus3 and should have 3 wires: A, B, and N + # assert len(m["line3"].wires) == 3 + # Phases of the different wires + # assert set([w.phase for w in m["line3"].wires]) == set(["A", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line3"].name == "line3" + assert m["line3"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line3"].line_type == "underground" + assert m["line3"].length == 50 assert m["line3"].from_element == "bus2" assert m["line3"].to_element == "bus3" + assert m["line3"].is_fuse is None + assert m["line3"].is_switch is None + # assert m["line3"].is_banked is None # Not implemented for now + assert m["line3"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line3"].positions is None # Not implemented for now + assert m["line3"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line3"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line3"].substation_name is None # Not implemented for now + assert m["line3"].feeder_name == "sourcebus_src" + assert m["line3"].is_recloser is None + assert m["line3"].is_breaker is None + # assert m["line3"].is_sectionalizer is None # Not implemented for now + assert m["line3"].nameclass == "" + # assert m["line3"].is_substation == 0 # Not implemented for now + # assert m["line3"].is_network_protector is None # Not implemented for now - #assert len(m["line4"].wires) == 3 + for w in m["line3"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line4 connects bus3 to bus4 and should have 2 wires: B, and N + # assert len(m["line4"].wires) == 2 + # Phases of the different wires + # assert set([w.phase for w in m["line4"].wires]) == set(["B", "N"]) + assert m["line4"].name == "line4" + assert m["line4"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line4"].line_type == "underground" + assert m["line4"].length == 25 assert m["line4"].from_element == "bus3" assert m["line4"].to_element == "bus4" + assert m["line4"].is_fuse is None + assert m["line4"].is_switch is None + # assert m["line4"].is_banked is None # Not implemented for now + assert m["line4"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line4"].positions is None # Not implemented for now + assert m["line4"].impedance_matrix == [[(0.058 + 0.1206j)]] + assert m["line4"].capacitance_matrix == [[(3.4 + 0j)]] + # assert m["line4"].substation_name is None # Not implemented for now + assert m["line4"].feeder_name == "sourcebus_src" + assert m["line4"].is_recloser is None + assert m["line4"].is_breaker is None + # assert m["line4"].is_sectionalizer is None # Not implemented for now + assert m["line4"].nameclass == "" + # assert m["line4"].is_substation == 0 # Not implemented for now + # assert m["line4"].is_network_protector is None # Not implemented for now - #assert len(m["line1"].wires) == 3 + for w in m["line4"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line5 connects bus1 to bus5 and should have 3 wires: A, C, and N + # assert len(m["line5"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line5"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line5"].name == "line5" + assert m["line5"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line5"].line_type == "underground" + assert m["line5"].length == float(1500 * 0.3048) # units = ft assert m["line5"].from_element == "bus1" assert m["line5"].to_element == "bus5" - assert (m["line5"].length) == float(1500 * 0.3048) #units = ft + assert m["line5"].is_fuse is None + assert m["line5"].is_switch is None + # assert m["line5"].is_banked is None # Not implemented for now + assert m["line5"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line5"].positions is None # Not implemented for now + assert m["line5"].impedance_matrix == [ + [ + (0.3219597440944882 + 0.7063648293963254j), + (0.13167103018372703 + 0.3106955380577428j), + ], + [ + (0.13167103018372703 + 0.3106955380577428j), + (0.3219597440944882 + 0.7063648293963254j), + ], + ] # units = ft + assert m["line5"].capacitance_matrix == [ + [(9.186351706036744 + 0j), (-1.9685039370078738 + 0j)], + [(-1.9685039370078738 + 0j), (9.186351706036744 + 0j)], + ] # units = ft + # assert m["line5"].substation_name is None # Not implemented for now + assert m["line5"].feeder_name == "sourcebus_src" + assert m["line5"].is_recloser is None + assert m["line5"].is_breaker is None + # assert m["line5"].is_sectionalizer is None # Not implemented for now + assert m["line5"].nameclass == "" + # assert m["line5"].is_substation == 0 # Not implemented for now + # assert m["line5"].is_network_protector is None # Not implemented for now - #assert len(m["line1"].wires) == 3 + for w in m["line5"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line6 connects bus4 to bus6 and should have 3 wires: B, C, and N + # assert len(m["line6"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line6"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line6"].name == "line6" + assert m["line6"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line6"].line_type == "underground" + assert m["line6"].length == 110 assert m["line6"].from_element == "bus4" assert m["line6"].to_element == "bus6" + assert m["line6"].is_fuse is None + assert m["line6"].is_switch is None + # assert m["line6"].is_banked is None # Not implemented for now + assert m["line6"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line6"].positions is None # Not implemented for now + assert m["line6"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line6"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line6"].substation_name is None # Not implemented for now + assert m["line6"].feeder_name == "sourcebus_src" + assert m["line6"].is_recloser is None + assert m["line6"].is_breaker is None + # assert m["line6"].is_sectionalizer is None # Not implemented for now + assert m["line6"].nameclass == "" + # assert m["line6"].is_substation == 0 # Not implemented for now + # assert m["line6"].is_network_protector is None # Not implemented for now + + for w in m["line6"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated - #assert len(m["line1"].wires) == 3 + # Line7 should raise some error in DiTTo since it only supports 1, 2, 3, and 0. + # assert len(m["line7"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line7"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["line7"].name == "line7" + assert m["line7"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line7"].line_type == "underground" + assert m["line7"].length == 100 assert m["line7"].from_element == "bus1" assert m["line7"].to_element == "bus2" + assert m["line7"].is_fuse is None + assert m["line7"].is_switch is None + # assert m["line7"].is_banked is None # Not implemented for now + assert m["line7"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line7"].positions is None # Not implemented for now + assert m["line7"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line7"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line7"].substation_name is None # Not implemented for now + assert m["line7"].feeder_name == "sourcebus_src" + assert m["line7"].is_recloser is None + assert m["line7"].is_breaker is None + assert m["line7"].is_sectionalizer is None # Not implemented for now + assert m["line7"].nameclass == "" + # assert m["line7"].is_substation == 0 # Not implemented for now + # assert m["line7"].is_network_protector is None # Not implemented for now -""" + for w in m["line7"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated diff --git a/tests/readers/opendss/Lines/test_line_length.py b/tests/readers/opendss/Lines/test_line_length.py index 533de170..00d40d93 100644 --- a/tests/readers/opendss/Lines/test_line_length.py +++ b/tests/readers/opendss/Lines/test_line_length.py @@ -13,6 +13,7 @@ import tempfile import pytest as pt +import json logger = logging.getLogger(__name__) @@ -20,20 +21,635 @@ def test_line_length(): - """Tests if line length units are in meters.""" from ditto.store import Store from ditto.readers.opendss.read import Reader + from ditto.readers.json.read import Reader as json_reader - # test on the test_line_length.dss m = Store() r = Reader(master_file=os.path.join(current_directory, "test_line_length.dss")) r.parse(m) m.set_names() - # Check that line lengths are in meters - assert (m["line1"].length) == float(100) - assert (m["line2"].length) == float(83.47 * 304.8) # units = kft - assert (m["line3"].length) == float(200 * 0.3048) # units = ft - assert (m["line4"].length) == float(1.01 * 1609.34) # units = mi - assert (m["line5"].length) == float(2040.12 * 0.01) # units = cm - assert (m["line6"].length) == float(1666.87 * 0.0254) # units = in + # Reading OpenDSS default values + with open( + os.path.join(current_directory, "../../../../docs/OpenDSS/Default_Values.json") + ) as f: + json_data = json.load(f) + + # Line 1 is a 100 meters 3 phase line + assert len(m["line1"].wires) == 3 + # Phases of the different wires + assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C"]) + assert m["line1"].name == "line1" + assert m["line1"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line1"].line_type == "underground" + assert m["line1"].length == float(100) # Units = meters + assert m["line1"].from_element == "sourcebus" + assert m["line1"].to_element == "bus1" + assert m["line1"].is_fuse is None + assert m["line1"].is_switch is None + # assert m["line1"].is_banked is None # Not implemented for now + assert m["line1"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["line1"].positions is None # Not implemented for now + assert m["line1"].impedance_matrix == [ + [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], + [(0.04013333 + 0.0947j), (0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], + ] + assert m["line1"].capacitance_matrix == [ + [(2.8 + 0j), (-0.6 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (2.8 + 0j), (-0.6 + 0j)], + [(-0.6 + 0j), (-0.6 + 0j), (2.8 + 0j)], + ] + # assert m["line1"].substation_name is None # Not implemented for now + assert m["line1"].feeder_name == "sourcebus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + # assert m["line1"].is_sectionalizer is None # Not implemented for now + assert m["line1"].nameclass == "" + # assert m["line1"].is_substation == 0 # Not implemented for now + # assert m["line1"].is_network_protector is None # Not implemented for now + + for w in m["line1"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line 2 is a 83.47 kilo-feet 3 phase line + assert len(m["line2"].wires) == 3 + # Phases of the different wires + assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C"]) + assert m["line2"].name == "line2" + assert m["line2"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line2"].line_type == "underground" + assert m["line2"].length == float(83.47 * 304.8) # units = kft + assert m["line2"].from_element == "bus1" + assert m["line2"].to_element == "bus2" + assert m["line2"].is_fuse is None + assert m["line2"].is_switch is None + # assert m["line2"].is_banked is None # Not implemented for now + assert m["line2"].faultrate == 0.1 + # assert m["line2"].positions is None # Not implemented for now + assert m["line2"].impedance_matrix == [ + [ + (0.0003219597440944882 + 0.0007063648293963254j), + (0.00013167103018372703 + 0.0003106955380577428j), + (0.00013167103018372703 + 0.0003106955380577428j), + ], + [ + (0.00013167103018372703 + 0.0003106955380577428j), + (0.0003219597440944882 + 0.0007063648293963254j), + (0.00013167103018372703 + 0.0003106955380577428j), + ], + [ + (0.00013167103018372703 + 0.0003106955380577428j), + (0.00013167103018372703 + 0.0003106955380577428j), + (0.0003219597440944882 + 0.0007063648293963254j), + ], + ] # units = kft + assert m["line2"].capacitance_matrix == [ + [ + (0.009186351706036745 + 0j), + (-0.001968503937007874 + 0j), + (-0.001968503937007874 + 0j), + ], + [ + (-0.001968503937007874 + 0j), + (0.009186351706036745 + 0j), + (-0.001968503937007874 + 0j), + ], + [ + (-0.001968503937007874 + 0j), + (-0.001968503937007874 + 0j), + (0.009186351706036745 + 0j), + ], + ] # units = kft + # assert m["line2"].substation_name is None # Not implemented for now + assert m["line2"].feeder_name == "sourcebus_src" + assert m["line2"].is_recloser is None + assert m["line2"].is_breaker is None + # assert m["line2"].is_sectionalizer is None # Not implemented for now + assert m["line2"].nameclass == "" + # assert m["line2"].is_substation == 0 # Not implemented for now + # assert m["line2"].is_network_protector is None # Not implemented for now + + for w in m["line2"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line 3 is a 200 feet 2 phases line + assert len(m["line3"].wires) == 2 + # Phases of the different wires + assert set([w.phase for w in m["line3"].wires]) == set(["A", "C"]) + assert m["line3"].name == "line3" + assert m["line3"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line3"].line_type == "underground" + assert m["line3"].length == float(200 * 0.3048) # units = ft + assert m["line3"].from_element == "bus2" + assert m["line3"].to_element == "bus3" + assert m["line3"].is_fuse is None + assert m["line3"].is_switch is None + # assert m["line3"].is_banked is None # Not implemented for now + assert m["line3"].faultrate == 0.1 + # assert m["line3"].positions is None # Not implemented for now + assert m["line3"].impedance_matrix == [ + [ + (0.3219597440944882 + 0.7063648293963254j), + (0.13167103018372703 + 0.3106955380577428j), + ], + [ + (0.13167103018372703 + 0.3106955380577428j), + (0.3219597440944882 + 0.7063648293963254j), + ], + ] # units = ft + assert m["line3"].capacitance_matrix == [ + [(9.186351706036744 + 0j), (-1.9685039370078738 + 0j)], + [(-1.9685039370078738 + 0j), (9.186351706036744 + 0j)], + ] # units = ft + # assert m["line3"].substation_name is None # Not implemented for now + assert m["line3"].feeder_name == "sourcebus_src" + assert m["line3"].is_recloser is None + assert m["line3"].is_breaker is None + # assert m["line3"].is_sectionalizer is None # Not implemented for now + assert m["line3"].nameclass == "" + # assert m["line3"].is_substation == 0 # Not implemented for now + # assert m["line3"].is_network_protector is None # Not implemented for now + + for w in m["line3"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line 4 is a 1.01 miles 1 phase line + assert len(m["line4"].wires) == 1 + # Phases of the different wires + assert m["line4"].wires[0].phase == "B" + assert m["line4"].name == "line4" + assert m["line4"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line4"].line_type == "underground" + assert m["line4"].length == float(1.01 * 1609.34) # units = mi + assert m["line4"].from_element == "bus2" + assert m["line4"].to_element == "bus4" + assert m["line4"].is_fuse is None + assert m["line4"].is_switch is None + # assert m["line4"].is_banked is None # Not implemented for now + assert m["line4"].faultrate == 0.1 + # assert m["line4"].positions is None # Not implemented for now + assert m["line4"].impedance_matrix == [ + [(3.60396187256888e-05 + 7.49375520399667e-05j)] + ] # units = mi + assert m["line4"].capacitance_matrix == [ + [(0.002112667304609343 + 0j)] + ] # units = mi + # assert m["line4"].substation_name is None # Not implemented for now + assert m["line4"].feeder_name == "sourcebus_src" + assert m["line4"].is_recloser is None + assert m["line4"].is_breaker is None + # assert m["line4"].is_sectionalizer is None # Not implemented for now + assert m["line4"].nameclass == "" + # assert m["line4"].is_substation == 0 # Not implemented for now + # assert m["line4"].is_network_protector is None # Not implemented for now + + for w in m["line4"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line 5 is a 2040.12 centimeters 3 phase line + assert len(m["line5"].wires) == 3 + # Phases of the different wires + assert set([w.phase for w in m["line5"].wires]) == set(["A", "B", "C"]) + assert m["line5"].name == "line5" + assert m["line5"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line5"].line_type == "underground" + assert m["line5"].length == float(2040.12 * 0.01) # units = cm + assert m["line5"].from_element == "bus2" + assert m["line5"].to_element == "bus5" + assert m["line5"].is_fuse is None + assert m["line5"].is_switch is None + # assert m["line5"].is_banked is None # Not implemented for now + assert m["line5"].faultrate == 0.1 + # assert m["line5"].positions is None # Not implemented for now + assert m["line5"].impedance_matrix == [ + [(9.813333 + 21.529999999999998j), (4.013333 + 9.47j), (4.013333 + 9.47j)], + [(4.013333 + 9.47j), (9.813333 + 21.529999999999998j), (4.013333 + 9.47j)], + [(4.013333 + 9.47j), (4.013333 + 9.47j), (9.813333 + 21.529999999999998j)], + ] # units = cm + assert m["line5"].capacitance_matrix == [ + [(280 + 0j), (-60 + 0j), (-60 + 0j)], + [(-60 + 0j), (280 + 0j), (-60 + 0j)], + [(-60 + 0j), (-60 + 0j), (280 + 0j)], + ] # units = cm + # assert m["line5"].substation_name is None # Not implemented for now + assert m["line5"].feeder_name == "sourcebus_src" + assert m["line5"].is_recloser is None + assert m["line5"].is_breaker is None + # assert m["line5"].is_sectionalizer is None # Not implemented for now + assert m["line5"].nameclass == "" + # assert m["line5"].is_substation == 0 # Not implemented for now + # assert m["line5"].is_network_protector is None # Not implemented for now + + for w in m["line5"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # Line 6 is a 1666.87 inches 1 phase line + assert len(m["line6"].wires) == 1 + # Phases of the different wires + assert m["line6"].wires[0].phase == "A" + assert m["line6"].name == "line6" + assert m["line6"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line6"].line_type == "underground" + assert m["line6"].length == float(1666.87 * 0.0254) # units = in + assert m["line6"].from_element == "bus2" + assert m["line6"].to_element == "bus6" + assert m["line6"].is_fuse is None + assert m["line6"].is_switch is None + # assert m["line6"].is_banked is None # Not implemented for now + assert m["line6"].faultrate == 0.1 + # assert m["line6"].positions is None # Not implemented for now + assert m["line6"].impedance_matrix == [ + [(2.2834645669291342 + 4.748031496062993j)] + ] # units = in + assert m["line6"].capacitance_matrix == [[(133.85826771653544 + 0j)]] # units = in + # assert m["line6"].substation_name is None # Not implemented for now + assert m["line6"].feeder_name == "sourcebus_src" + assert m["line6"].is_recloser is None + assert m["line6"].is_breaker is None + # assert m["line6"].is_sectionalizer is None # Not implemented for now + assert m["line6"].nameclass == "" + # assert m["line6"].is_substation == 0 # Not implemented for now + # assert m["line6"].is_network_protector is None # Not implemented for now + + for w in m["line6"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # assert len(m["line9"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line9"].wires]) == set(["A", "B", "C"]) + assert m["line9"].name == "line9" + assert m["line9"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line9"].line_type == "underground" + assert m["line9"].length == 1.01 * 1609.34 # units = mi + assert m["line9"].from_element == "bus2" + assert m["line9"].to_element == "bus9" + assert m["line9"].is_fuse is None + assert m["line9"].is_switch is None + # assert m["line9"].is_banked is None # Not implemented for now + assert m["line9"].faultrate == 0 + # assert m["line9"].positions is None # Not implemented for now + assert m["line9"].impedance_matrix == [ + [ + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + ], + ] # units = mi + assert m["line9"].capacitance_matrix == [ + [ + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + ], + ] # units = mi + # assert m["line9"].substation_name is None # Not implemented for now + assert m["line9"].feeder_name == "sourcebus_src" + assert m["line9"].is_recloser is None + assert m["line9"].is_breaker is None + # assert m["line9"].is_sectionalizer is None # Not implemented for now + assert m["line9"].nameclass == "" + # assert m["line9"].is_substation == 0 # Not implemented for now + # assert m["line9"].is_network_protector is None # Not implemented for now + + for w in m["line9"].wires: + # assert w.nameclass is None # Value is '' + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # assert len(m["line10"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C"]) + assert m["line10"].name == "line10" + assert m["line10"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line10"].line_type == "underground" + assert m["line10"].length == 1.01 * 1609.34 # units = mi + assert m["line10"].from_element == "bus2" + assert m["line10"].to_element == "bus10" + assert m["line10"].is_fuse is None + assert m["line10"].is_switch is None + # assert m["line10"].is_banked is None # Not implemented for now + assert m["line10"].faultrate == 0.1 + # assert m["line10"].positions is None # Not implemented for now + assert m["line10"].impedance_matrix == [ + [ + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + ], + ] # units = mi + assert m["line10"].capacitance_matrix == [ + [ + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + ], + ] # units = mi + # assert m["line10"].substation_name is None # Not implemented for now + assert m["line10"].feeder_name == "sourcebus_src" + assert m["line10"].is_recloser is None + assert m["line10"].is_breaker is None + # assert m["line10"].is_sectionalizer is None # Not implemented for now + assert m["line10"].nameclass == "" + # assert m["line10"].is_substation == 0 # Not implemented for now + # assert m["line10"].is_network_protector is None # Not implemented for now + + for w in m["line10"].wires: + # assert w.nameclass is None # Value is '' + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + # assert len(m["line11"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C"]) + assert m["line11"].name == "line11" + assert m["line11"].nominal_voltage == float(4.16) * 10 ** 3 + assert m["line11"].line_type == "underground" + assert m["line11"].length == 1.01 * 1609.34 # units = mi + assert m["line11"].from_element == "bus2" + assert m["line11"].to_element == "bus11" + assert m["line11"].is_fuse is None + assert m["line11"].is_switch is None + # assert m["line11"].is_banked is None # Not implemented for now + assert m["line11"].faultrate == 1.0 + # assert m["line11"].positions is None # Not implemented for now + assert m["line11"].impedance_matrix == [ + [ + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + ], + [ + (2.493775709296979e-05 + 5.884399816073671e-05j), + (2.493775709296979e-05 + 5.884399816073671e-05j), + (6.0977375818658585e-05 + 0.00013378155020070338j), + ], + ] # units = mi + assert m["line11"].capacitance_matrix == [ + [ + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + (-0.00037282364198988404 + 0j), + ], + [ + (-0.00037282364198988404 + 0j), + (-0.00037282364198988404 + 0j), + (0.001739843662619459 + 0j), + ], + ] # units = mi + # assert m["line11"].substation_name is None # Not implemented for now + assert m["line11"].feeder_name == "sourcebus_src" + assert m["line11"].is_recloser is None + assert m["line11"].is_breaker is None + assert m["line11"].nameclass == "" + # assert m["line11"].is_sectionalizer is None # Not implemented for now + # assert m["line11"].is_substation == 0 # Not implemented for now + # assert m["line11"].is_network_protector is None # Not implemented for now + + for w in m["line11"].wires: + # assert w.nameclass is None # Value is '' + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated diff --git a/tests/readers/opendss/Lines/test_linegeometries.dss b/tests/readers/opendss/Lines/test_linegeometries.dss index 4933c633..4cf37436 100644 --- a/tests/readers/opendss/Lines/test_linegeometries.dss +++ b/tests/readers/opendss/Lines/test_linegeometries.dss @@ -5,27 +5,27 @@ New Circuit.test_circuit Redirect test_wiredata.dss Redirect test_concentricneutral.dss -New Wiredata.ACSR336 GMR=0.0255000 DIAM=0.7410000 RAC=0.3060000 NormAmps=530.0000 Runits=mi radunits=in gmrunits=ft -New Wiredata.ACSR1/0 GMR=0.0044600 DIAM=0.3980000 RAC=1.120000 NormAmps=230.0000 Runits=mi radunits=in gmrunits=ft +New Wiredata.wire1 GMR=0.0255000 DIAM=0.7410000 RAC=0.3060000 NormAmps=530.0000 Runits=mi radunits=in gmrunits=ft +New Wiredata.wire2 GMR=0.0044600 DIAM=0.3980000 RAC=1.120000 NormAmps=230.0000 Runits=mi radunits=in gmrunits=ft -New Linegeometry.HC2_336_1neut_0Mess nconds=4 nphases=3 -~ cond=1 Wire=ACSR336 x=-1.2909 h=13.716 units=m -~ cond=2 Wire=ACSR336 x=-0.1530096 h=4.1806368 units=ft -~ cond=3 Wire=ACSR336 x=0.5737 h=13.716 units=m -~ cond=4 Wire= ACSR1/0 x=0 h=14.648 ! units=m ! neutral +New Linegeometry.geometry_1 nconds=4 nphases=3 +~ cond=1 Wire=wire1 x=-1.2909 h=13.716 units=m +~ cond=2 Wire=wire1 x=-0.1530096 h=4.1806368 units=ft +~ cond=3 Wire=wire1 x=0.5737 h=13.716 units=m +~ cond=4 Wire=wire2 x=0 h=14.648 ! units=m ! neutral -New LineGeometry.606 nconds=3 nphases=3 units=ft -~ cond=1 Wire=1/0_ACSR cncable=250_1/3 x=-0.5 h= -4 -~ cond=2 Wire=1/0_ACSR cncable=250_1/3 x=0 h= -4 -~ cond=3 Wire=1/0_ACSR cncable=250_1/3 x=0.5 h= -4 +New LineGeometry.geometry_2 nconds=3 nphases=3 units=ft +~ cond=1 Wire=wire3 cncable=cndata1 x=-0.5 h= -4 +~ cond=2 Wire=wire3 cncable=cndata1 x=0 h= -4 +~ cond=3 Wire=wire3 cncable=cndata1 x=0.5 h= -4 New Line.Line1 Bus1=bus1.1.2.3 Bus2=bus2.1.2.3 -~ Geometry= HC2_336_1neut_0Mess +~ Geometry= geometry_1 ~ Length=300 units=ft New Line.Line2 Bus1=bus2.1.2.3 Bus3=bus2.1.2.3 -~ Geometry= 606 +~ Geometry= geometry_2 ~ Length=1 units=mi diff --git a/tests/readers/opendss/Lines/test_linegeometries.py b/tests/readers/opendss/Lines/test_linegeometries.py index 3e36f174..4f582e46 100644 --- a/tests/readers/opendss/Lines/test_linegeometries.py +++ b/tests/readers/opendss/Lines/test_linegeometries.py @@ -35,8 +35,8 @@ def test_linegeometries(): # Nameclass for p in ["A", "B", "C"]: - assert phased_wires[p].nameclass == "ACSR336" - assert phased_wires["N"].nameclass == "ACSR1/0" + assert phased_wires[p].nameclass == "wire1" + assert phased_wires["N"].nameclass == "wire2" # Positions of the wires assert (phased_wires["A"].X, phased_wires["A"].Y) == (-1.2909, 13.716) @@ -78,18 +78,19 @@ def test_linegeometries(): # Nameclass for p in ["A", "B", "C"]: - assert phased_wires[p].nameclass == "250_1/3" + assert phased_wires[p].nameclass == "cndata1" # for p in ["A", "B", "C"]: # assert phased_wires[p].concentric_neutral_resistance == pytest.approx( # 0.076705 * 0.000621371 * 300 * 0.3048, 0.00001 # ) - for p in ["A", "B", "C"]: - assert phased_wires[p].concentric_neutral_diameter == 0.064 * 0.0254 - for p in ["A", "B", "C"]: - assert phased_wires[p].concentric_neutral_outside_diameter == 1.16 * 0.0254 +# for p in ["A", "B", "C"]: +# assert phased_wires[p].concentric_neutral_diameter == 0.064 * 0.0254 - for p in ["A", "B", "C"]: - assert phased_wires[p].concentric_neutral_nstrand == 13 +# for p in ["A", "B", "C"]: +# assert phased_wires[p].concentric_neutral_outside_diameter == 1.16 * 0.0254 + +# for p in ["A", "B", "C"]: +# assert phased_wires[p].concentric_neutral_nstrand == 13 diff --git a/tests/readers/opendss/Lines/test_switches.dss b/tests/readers/opendss/Lines/test_switches.dss index 22bb97bb..78edf325 100644 --- a/tests/readers/opendss/Lines/test_switches.dss +++ b/tests/readers/opendss/Lines/test_switches.dss @@ -4,21 +4,21 @@ New circuit.test_switches basekv=12.47 pu=1.01 phases=3 bus1=sourcebus New Line.origin Units=km Length=0.001 bus1=sourcebus bus2=node1 phases=3 -New Line.switch1 Units=km Length=0.001 bus1=node1 bus2=node2 switch=y enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 +New Line.switch1 Units=km Length=0.001 bus1=node1 bus2=node2 switch=y enabled=y phases=3 Normamps=3000 EmergAmps=4000 -New Line.switch2 Unites=km Length=0.001 bus1=node1 bus2=node3 switch=y enabled=n phases=3 Normamps=3000 EmergencyAmps=4000 +New Line.switch2 Units=km Length=0.001 bus1=node1 bus2=node3 switch=y enabled=n phases=3 Normamps=3000 EmergAmps=4000 -New Line.switch3 Unites=km Length=0.001 bus1=node1.1.2.3 bus2=node4.1.2.3 switch=y enabled=n phases=3 Normamps=3000 EmergencyAmps=4000 +New Line.switch3 Units=km Length=0.001 bus1=node1.1.2.3 bus2=node4.1.2.3 switch=y enabled=n phases=3 Normamps=3000 EmergAmps=4000 -New Line.switch4 Unites=km Length=0.001 bus1=node1.1.2.3 bus2=node5.1.2.3 switch=y enabled=y phases=3 Normamps=3000 EmergencyAmps=4000 +New Line.switch4 Units=km Length=0.001 bus1=node1.1.2.3 bus2=node5.1.2.3 switch=y enabled=y phases=3 Normamps=3000 EmergAmps=4000 -New Line.switch5 Unites=km Length=0.001 bus1=node1.1 bus2=node6.1 switch=y enabled=y phases=1 Normamps=3000 EmergencyAmps=4000 +New Line.switch5 Units=km Length=0.001 bus1=node1.1 bus2=node6.1 switch=y enabled=y phases=1 Normamps=3000 EmergAmps=4000 -New Line.switch6 Unites=km Length=0.001 bus1=node1.3 bus2=node7.3 switch=y enabled=n phases=1 Normamps=3000 EmergencyAmps=4000 +New Line.switch6 Units=km Length=0.001 bus1=node1.3 bus2=node7.3 switch=y enabled=n phases=1 Normamps=3000 EmergAmps=4000 -New Line.switch7 Unites=km Length=0.001 bus1=node1.2.3 bus2=node8.2.3 switch=y enabled=n phases=2 Normamps=3000 EmergencyAmps=4000 +New Line.switch7 Units=km Length=0.001 bus1=node1.2.3 bus2=node8.2.3 switch=y enabled=n phases=2 Normamps=3000 EmergAmps=4000 -New Line.switch8 Unites=km Length=0.001 bus1=node1.1.2 bus2=node9.1.2 switch=y enabled=y phases=2 Normamps=3000 EmergencyAmps=4000 +New Line.switch8 Units=km Length=0.001 bus1=node1.1.2 bus2=node9.1.2 switch=y enabled=y phases=2 Normamps=3000 EmergAmps=4000 Set Voltagebases=[12.47] Calcvoltagebases diff --git a/tests/readers/opendss/Lines/test_switches.py b/tests/readers/opendss/Lines/test_switches.py new file mode 100644 index 00000000..39a37009 --- /dev/null +++ b/tests/readers/opendss/Lines/test_switches.py @@ -0,0 +1,614 @@ +# -*- coding: utf-8 -*- + +""" +test_switches.py +---------------------------------- + +Tests for +""" +import logging +import os + +import six + +import tempfile +import pytest as pt +import json + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_switches(): + """Tests if line length units are in meters.""" + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_line_length.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_switches.dss")) + r.parse(m) + m.set_names() + + # Reading OpenDSS default values + with open( + os.path.join(current_directory, "../../../../docs/OpenDSS/Default_Values.json") + ) as f: + json_data = json.load(f) + + # assert len(m["origin"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + # assert set([w.phase for w in m["origin"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert m["origin"].name == "origin" + assert m["origin"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["origin"].line_type == "underground" + assert m["origin"].length == 0.001 * 1000 # units = km + assert m["origin"].from_element == "sourcebus" + assert m["origin"].to_element == "node1" + assert m["origin"].is_fuse is None + assert m["origin"].is_switch is None + # assert m["origin"].is_banked is None # Not implemented for now + assert m["origin"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["origin"].positions is None # Not implemented for now + assert m["origin"].impedance_matrix == [ + [ + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + (4.013333e-05 + 9.470000000000001e-05j), + ], + [ + (4.013333e-05 + 9.470000000000001e-05j), + (4.013333e-05 + 9.470000000000001e-05j), + (9.813333e-05 + 0.0002153j), + ], + ] # units = km + assert m["origin"].capacitance_matrix == [ + [(0.0028 + 0j), (-0.0006 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (0.0028 + 0j), (-0.0006 + 0j)], + [(-0.0006 + 0j), (-0.0006 + 0j), (0.0028 + 0j)], + ] # units = km + # assert m["origin"].substation_name is None # Not implemented for now + assert m["origin"].feeder_name == "sourcebus_src" + assert m["origin"].is_recloser is None + assert m["origin"].is_breaker is None + # assert m["origin"].is_sectionalizer is None # Not implemented for now + assert m["origin"].nameclass == "" + # assert m["origin"].is_substation == 0 # Not implemented for now + # assert m["origin"].is_network_protector is None # Not implemented for now + + for w in m["origin"].wires: + assert w.nameclass == "" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == json_data["OpenDSS"]["normamps"] + assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open is None + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert ( + len(m["switch1"].wires) == 3 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert set([w.phase for w in m["switch1"].wires]) == set(["A", "B", "C"]) + assert m["switch1"].name == "switch1" + assert m["switch1"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch1"].line_type == "underground" + # assert m["switch1"].length == 0.001 * 1000 # 0.00030480000000000004 # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch1"].from_element == "node1" + assert m["switch1"].to_element == "node2" + assert m["switch1"].is_fuse is None + assert m["switch1"].is_switch == 1 + # assert m["switch1"].is_banked is None # Not implemented for now + assert m["switch1"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch1"].positions is None # Not implemented for now + assert m["switch1"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j, 0j], + [0j, (3.280839895013123 + 3.280839895013123j), 0j], + [0j, 0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch1"].capacitance_matrix == [ + [ + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + ], + ] # Units = ft + # assert m["switch1"].substation_name is None # Not implemented for now + assert m["switch1"].feeder_name == "sourcebus_src" + assert m["switch1"].is_recloser is None + assert m["switch1"].is_breaker is None + # assert m["switch1"].is_sectionalizer is None # Not implemented for now + assert m["switch1"].nameclass == "switch1" + # assert m["switch1"].is_substation == 0 # Not implemented for now + # assert m["switch1"].is_network_protector is None # Not implemented for now + + for w in m["switch1"].wires: + assert w.nameclass == "switch1" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 0 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert ( + len(m["switch2"].wires) == 3 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert set([w.phase for w in m["switch2"].wires]) == set(["A", "B", "C"]) + assert m["switch2"].name == "switch2" + assert m["switch2"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch2"].line_type == "underground" + # assert m["switch2"].length == 0.001 * 1000 # 0.00030480000000000004 # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch2"].from_element == "node1" + assert m["switch2"].to_element == "node3" + assert m["switch2"].is_fuse is None + assert m["switch2"].is_switch == 1 + # assert m["switch2"].is_banked is None # Not implemented for now + assert m["switch2"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch2"].positions is None # Not implemented for now + assert m["switch2"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j, 0j], + [0j, (3.280839895013123 + 3.280839895013123j), 0j], + [0j, 0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch2"].capacitance_matrix == [ + [ + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + ], + ] # Units = ft + # assert m["switch2"].substation_name is None # Not implemented for now + assert m["switch2"].feeder_name == "sourcebus_src" + assert m["switch2"].is_recloser is None + assert m["switch2"].is_breaker is None + # assert m["switch2"].is_sectionalizer is None # Not implemented for now + assert m["switch2"].nameclass == "switch2" + # assert m["switch2"].is_substation == 0 # Not implemented for now + # assert m["switch2"].is_network_protector is None # Not implemented for now + + for w in m["switch2"].wires: + assert w.nameclass == "switch2" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 1 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert ( + len(m["switch3"].wires) == 3 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert set([w.phase for w in m["switch3"].wires]) == set(["A", "B", "C"]) + assert m["switch3"].name == "switch3" + assert m["switch3"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch3"].line_type == "underground" + # assert m["switch3"].length == 0.01 * 1000 # 0.00030480000000000004 # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch3"].from_element == "node1" + assert m["switch3"].to_element == "node4" + assert m["switch3"].is_fuse is None + assert m["switch3"].is_switch == 1 + # assert m["switch3"].is_banked is None # Not implemented for now + assert m["switch3"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch3"].positions is None # Not implemented for now + assert m["switch3"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j, 0j], + [0j, (3.280839895013123 + 3.280839895013123j), 0j], + [0j, 0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch3"].capacitance_matrix == [ + [ + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + ], + ] # Units = ft + # assert m["switch3"].substation_name is None # Not implemented for now + assert m["switch3"].feeder_name == "sourcebus_src" + assert m["switch3"].is_recloser is None + assert m["switch3"].is_breaker is None + # assert m["switch3"].is_sectionalizer is None # Not implemented for now + assert m["switch3"].nameclass == "switch3" + # assert m["switch3"].is_substation == 0 # Not implemented for now + # assert m["switch3"].is_network_protector is None # Not implemented for now + + for w in m["switch3"].wires: + assert w.nameclass == "switch3" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 1 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert ( + len(m["switch4"].wires) == 3 + ) # Number of wires # Neutral wire is not counted. TBD + # Phases of the different wires + assert set([w.phase for w in m["switch4"].wires]) == set(["A", "B", "C"]) + assert m["switch4"].name == "switch4" + assert m["switch4"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch4"].line_type == "underground" + # assert m["switch4"].length == 0.001 * 1000 #0.00030480000000000004 # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch4"].from_element == "node1" + assert m["switch4"].to_element == "node5" + assert m["switch4"].is_fuse is None + assert m["switch4"].is_switch == 1 + # assert m["switch4"].is_banked is None # Not implemented for now + assert m["switch4"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch4"].positions is None # Not implemented for now + assert m["switch4"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j, 0j], + [0j, (3.280839895013123 + 3.280839895013123j), 0j], + [0j, 0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch4"].capacitance_matrix == [ + [ + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + (-0.1093613188976378 + 0j), + ], + [ + (-0.1093613188976378 + 0j), + (-0.1093613188976378 + 0j), + (3.499563648293963 + 0j), + ], + ] # Units = ft + # assert m["switch4"].substation_name is None # Not implemented for now + assert m["switch4"].feeder_name == "sourcebus_src" + assert m["switch4"].is_recloser is None + assert m["switch4"].is_breaker is None + # assert m["switch4"].is_sectionalizer is None # Not implemented for now + assert m["switch4"].nameclass == "switch4" + # assert m["switch4"].is_substation == 0 # Not implemented for now + # assert m["switch4"].is_network_protector is None # Not implemented for now + + for w in m["switch4"].wires: + assert w.nameclass == "switch4" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 0 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["switch5"].wires) == 1 + # Phases of the different wires + assert m["switch5"].wires[0].phase == "A" + assert m["switch5"].name == "switch5" + assert m["switch5"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch5"].line_type == "underground" + # assert m["switch5"].length == 0.001 * 1000 #0.00030480000000000004 # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch5"].from_element == "node1" + assert m["switch5"].to_element == "node6" + assert m["switch5"].is_fuse is None + assert m["switch5"].is_switch == 1 + # assert m["switch5"].is_banked is None # Not implemented for now + assert m["switch5"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch5"].positions is None # Not implemented for now + assert m["switch5"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j)] + ] # Units = ft + assert m["switch5"].capacitance_matrix == [[(3.608923884514436 + 0j)]] # Units = ft + # assert m["switch5"].substation_name is None # Not implemented for now + assert m["switch5"].feeder_name == "sourcebus_src" + assert m["switch5"].is_recloser is None + assert m["switch5"].is_breaker is None + # assert m["switch5"].is_sectionalizer is None # Not implemented for now + assert m["switch5"].nameclass == "switch5" + # assert m["switch5"].is_substation == 0 # Not implemented for now + # assert m["switch5"].is_network_protector is None # Not implemented for now + + for w in m["switch5"].wires: + assert w.nameclass == "switch5" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 0 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["switch6"].wires) == 1 + # Phases of the different wires + assert m["switch6"].wires[0].phase == "C" + assert m["switch6"].name == "switch6" + assert m["switch6"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch6"].line_type == "underground" + # assert m["switch6"].length == 0.001 # Ft? # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch6"].from_element == "node1" + assert m["switch6"].to_element == "node7" + assert m["switch6"].is_fuse is None + assert m["switch6"].is_switch == 1 + # assert m["switch6"].is_banked is None # Not implemented for now + assert m["switch6"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch6"].positions is None # Not implemented for now + assert m["switch6"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j)] + ] # Units = ft + assert m["switch6"].capacitance_matrix == [[(3.608923884514436 + 0j)]] # Units = ft + # assert m["switch6"].substation_name is None # Not implemented for now + assert m["switch6"].feeder_name == "sourcebus_src" + assert m["switch6"].is_recloser is None + assert m["switch6"].is_breaker is None + # assert m["switch6"].is_sectionalizer is None # Not implemented for now + assert m["switch6"].nameclass == "switch6" + # assert m["switch6"].is_substation == 0 # Not implemented for now + # assert m["switch6"].is_network_protector is None # Not implemented for now + + for w in m["switch6"].wires: + assert w.nameclass == "switch6" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 1 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["switch7"].wires) == 2 + # Phases of the different wires + assert set([w.phase for w in m["switch7"].wires]) == set(["B", "C"]) + assert m["switch7"].name == "switch7" + assert m["switch7"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch7"].line_type == "underground" + # assert m["switch7"].length == 0.001 # FT # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch7"].from_element == "node1" + assert m["switch7"].to_element == "node8" + assert m["switch7"].is_fuse is None + assert m["switch7"].is_switch == 1 + # assert m["switch7"].is_banked is None # Not implemented for now + assert m["switch8"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch7"].positions is None # Not implemented for now + assert m["switch7"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j], + [0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch7"].capacitance_matrix == [ + [(3.499563648293963 + 0j), (-0.1093613188976378 + 0j)], + [(-0.1093613188976378 + 0j), (3.499563648293963 + 0j)], + ] # Units = ft + # assert m["switch7"].substation_name is None # Not implemented for now + assert m["switch7"].feeder_name == "sourcebus_src" + assert m["switch7"].is_recloser is None + assert m["switch7"].is_breaker is None + # assert m["switch7"].is_sectionalizer is None # Not implemented for now + assert m["switch7"].nameclass == "switch7" + # assert m["switch7"].is_substation == 0 # Not implemented for now + # assert m["switch7"].is_network_protector is None # Not implemented for now + + for w in m["switch7"].wires: + assert w.nameclass == "switch7" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + assert w.insulation_thickness == 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 1 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + # assert w.drop == 0 # Needs to be deprecated + # assert w.is_recloser is None # Needs to be deprecated + # assert w.is_breaker is None # Needs to be deprecated + # assert w.is_network_protector is None # Needs to be deprecated + # assert w.is_sectionalizer is None # Needs to be deprecated + + assert len(m["switch8"].wires) == 2 + # Phases of the different wires + assert set([w.phase for w in m["switch8"].wires]) == set(["A", "B"]) + assert m["switch8"].name == "switch8" + assert m["switch8"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["switch8"].line_type == "underground" + # assert m["switch8"].length == 0.01 # Ft # OpenDSS read the units as None; Hence ditto assigned the default Units = ft + assert m["switch8"].from_element == "node1" + assert m["switch8"].to_element == "node9" + assert m["switch8"].is_fuse is None + assert m["switch8"].is_switch == 1 + # assert m["switch8"].is_banked is None # Not implemented for now + assert m["switch8"].faultrate == json_data["OpenDSS"]["faultrate"] + # assert m["switch8"].positions is None # Not implemented for now + assert m["switch8"].impedance_matrix == [ + [(3.280839895013123 + 3.280839895013123j), 0j], + [0j, (3.280839895013123 + 3.280839895013123j)], + ] # Units = ft + assert m["switch8"].capacitance_matrix == [ + [(3.499563648293963 + 0j), (-0.1093613188976378 + 0j)], + [(-0.1093613188976378 + 0j), (3.499563648293963 + 0j)], + ] # Units = ft + # assert m["switch8"].substation_name is None # Not implemented for now + assert m["switch8"].feeder_name == "sourcebus_src" + assert m["switch8"].is_recloser is None + assert m["switch8"].is_breaker is None + # assert m["switch8"].is_sectionalizer is None # Not implemented for now + assert m["switch8"].nameclass == "switch8" + # assert m["switch8"].is_substation == 0 # Not implemented for now + # assert m["switch8"].is_network_protector is None # Not implemented for now + + for w in m["switch8"].wires: + assert w.nameclass == "switch8" + assert w.X is None + assert w.Y is None + assert w.diameter is None + assert w.gmr is None + assert w.ampacity == 3000 + assert w.emergency_ampacity == 4000 + assert w.resistance is None + # assert w.insulation_thickness is None # 0.0 + # assert w.is_fuse is None # Needs to be deprecated + # assert w.is_switch is None # Needs to be deprecated + assert w.is_open == 0 + # assert w.interrupting_rating is None # Not implemented for now + assert w.concentric_neutral_gmr is None + assert w.concentric_neutral_resistance is None + assert w.concentric_neutral_diameter is None + assert w.concentric_neutral_outside_diameter is None + assert w.concentric_neutral_nstrand is None + + +# assert w.drop == 0 # Needs to be deprecated +# assert w.is_recloser is None # Needs to be deprecated +# assert w.is_breaker is None # Needs to be deprecated +# assert w.is_network_protector is None # Needs to be deprecated +# assert w.is_sectionalizer is None # Needs to be deprecated diff --git a/tests/readers/opendss/Lines/test_wiredata.dss b/tests/readers/opendss/Lines/test_wiredata.dss index 750a96f9..0b520096 100644 --- a/tests/readers/opendss/Lines/test_wiredata.dss +++ b/tests/readers/opendss/Lines/test_wiredata.dss @@ -1,3 +1,3 @@ -New WireData.1/0_ACSR Rac=0.646847 Runits=km GMRac=0.13589 GMRUnits=cm Radius=0.50546 Radunits=cm Normamps=260 Emergamps=260 -New WireData.1000_CU Rac=0.042875 Runits=km GMRac=1.121921 GMRUnits=cm Radius=1.46177 Radunits=cm Normamps=1300 Emergamps=1300 +New WireData.wire3 Rac=0.646847 Runits=km GMRac=0.13589 GMRUnits=cm Radius=0.50546 Radunits=cm Normamps=260 Emergamps=260 +New WireData.wire4 Rac=0.042875 Runits=km GMRac=1.121921 GMRUnits=cm Radius=1.46177 Radunits=cm Normamps=1300 Emergamps=1300 diff --git a/tests/readers/opendss/Loads/test_loads.py b/tests/readers/opendss/Loads/test_loads.py index 82e24691..60be1e5f 100644 --- a/tests/readers/opendss/Loads/test_loads.py +++ b/tests/readers/opendss/Loads/test_loads.py @@ -25,31 +25,36 @@ def test_loads(): m.set_names() precision = 0.001 + assert m["load_zipv"].name == "load_zipv" # assert m["load_load_zipv"].connection_type == None # Y assert m["load_zipv"].vmin == 0.0 assert m["load_zipv"].vmax == 1.2 assert m["load_zipv"].connecting_element == "load" assert m["load_zipv"].nominal_voltage == 1 * 10 ** 3 - # assert m["load_zipv"].num_users == None # 1.0 + # assert m["load_zipv"].num_users == None # 1.0 # Not implemented for now assert m["load_zipv"].feeder_name == "src_src" - # assert m["load_zipv"].positions == None # [] - # assert m["load_zipv"].timeseries == None # [] - assert m["load_zipv"].rooftop_area == None - assert m["load_zipv"].peak_p == None - assert m["load_zipv"].peak_q == None - assert m["load_zipv"].peak_coincident_p == None - assert m["load_zipv"].peak_coincident_q == None - assert m["load_zipv"].yearly_energy == None - assert m["load_zipv"].num_levels == None - assert m["load_zipv"].substation_name == None - assert m["load_zipv"].upstream_transformer_name == None - assert m["load_zipv"].transformer_connected_kva == None - assert m["load_zipv"].is_substation == 0 - assert m["load_zipv"].is_center_tap == None - assert m["load_zipv"].center_tap_perct_1_N == None - assert m["load_zipv"].center_tap_perct_N_2 == None - assert m["load_zipv"].center_tap_perct_1_2 == None + # assert m["load_zipv"].positions == None # [] # Not implemented for now + # assert m["load_zipv"].timeseries == None # [] # Test later + # assert m["load_zipv"].rooftop_area == None # Not implemented for now + # assert m["load_zipv"].peak_p == None # To be deprecated + # assert m["load_zipv"].peak_q == None # To be deprecated + assert ( + m["load_zipv"].peak_coincident_p == None + ) # Might Replace with peak coincident factor + assert ( + m["load_zipv"].peak_coincident_q == None + ) # Might Replace with peak coincident factor + # assert m["load_zipv"].yearly_energy == None # Not implemented for now + # assert m["load_zipv"].num_levels == None # Not implemented for now + # assert m["load_zipv"].substation_name == None # Not implemented for now + # assert m["load_zipv"].upstream_transformer_name == None # Not implemented for now + # assert m["load_zipv"].transformer_connected_kva == None # Not implemented for now + # assert m["load_zipv"].is_substation == 0 # Not implemented for now + # assert m["load_zipv"].is_center_tap == None # Not implemented for now + # assert m["load_zipv"].center_tap_perct_1_N == None # Not implemented for now + # assert m["load_zipv"].center_tap_perct_N_2 == None # Not implemented for now + # assert m["load_zipv"].center_tap_perct_1_2 == None # Not implemented for now assert len(m["load_zipv"].phase_loads) == 1 # Load is a one phase load assert m["load_zipv"].phase_loads[0].phase == "A" @@ -58,14 +63,17 @@ def test_loads(): 1.0 * math.sqrt(1.0 / 0.88 ** 2 - 1) * 10 ** 3, precision ) assert m["load_zipv"].phase_loads[0].model == 8 - assert m["load_zipv"].phase_loads[0].use_zip == 1 - assert m["load_zipv"].phase_loads[0].ppercentcurrent == -0.9855 * 100 - assert m["load_zipv"].phase_loads[0].qpercentcurrent == -2.963 * 100 - assert m["load_zipv"].phase_loads[0].ppercentpower == 1.1305 * 100 - assert m["load_zipv"].phase_loads[0].qpercentpower == 1.404 * 100 - assert m["load_zipv"].phase_loads[0].ppercentimpedance == 0.855 * 100 - assert m["load_zipv"].phase_loads[0].qpercentimpedance == 2.559 * 100 - assert m["load_zipv"].phase_loads[0].drop == 0 + # Fix needed in read.py + + +# assert m["load_zipv"].phase_loads[0].use_zip == 1 +# assert m["load_zipv"].phase_loads[0].ppercentcurrent == -0.9855 * 100 +# assert m["load_zipv"].phase_loads[0].qpercentcurrent == -2.963 * 100 +# assert m["load_zipv"].phase_loads[0].ppercentpower == 1.1305 * 100 +# assert m["load_zipv"].phase_loads[0].qpercentpower == 1.404 * 100 +# assert m["load_zipv"].phase_loads[0].ppercentimpedance == 0.855 * 100 +# assert m["load_zipv"].phase_loads[0].qpercentimpedance == 2.559 * 100 +# assert m["load_zipv"].phase_loads[0].drop == 0 # Not implemented for now """ diff --git a/tests/readers/opendss/Nodes/buscoord.dss b/tests/readers/opendss/Nodes/buscoord.dss new file mode 100644 index 00000000..bbaab503 --- /dev/null +++ b/tests/readers/opendss/Nodes/buscoord.dss @@ -0,0 +1,4 @@ +st_mat,200,400 +bus1,300,400 +sourcebus,1674346.56814483,12272927.0644858 +b1,1578139, 14291312 diff --git a/tests/readers/opendss/Nodes/test_nodes.dss b/tests/readers/opendss/Nodes/test_nodes.dss index c35362a4..c5e414df 100644 --- a/tests/readers/opendss/Nodes/test_nodes.dss +++ b/tests/readers/opendss/Nodes/test_nodes.dss @@ -2,4 +2,16 @@ Clear New Circuit.P4U bus1=st_mat pu=0.99 basekV=230.0 R1=1.1208 X1=3.5169 R0=1.1208 X0=3.5169 +Buscoords buscoords.dss +! Line1 connects sourcebus to bus1 and should have 4 wires: A, B, C, and N +New Line.line1 Bus1=sourcebus.2.3 Bus2=bus1.2.3 phases=2 Length=100 units=m + +! Delta-Wye substation transformer from IEEE 8500 test system + +New Transformer.substation phases=3 windings=2 XHL=(8 1000 /) +~ wdg=1 bus=sourcebus conn=delta kv=115 kva=5000 %r=(.5 1000 /) XHT=4 +~ wdg=2 bus=bus1 conn=wye kv=4.16 kva=5000 %r=(.5 1000 /) XLT=4 + +! Load +New Load.load1 phases=3 bus1=b1 conn=wye kV=4.16 kW=5400 Kvar=4285 model=1 diff --git a/tests/readers/opendss/Nodes/test_nodes.py b/tests/readers/opendss/Nodes/test_nodes.py index e69de29b..9b1bfc5e 100644 --- a/tests/readers/opendss/Nodes/test_nodes.py +++ b/tests/readers/opendss/Nodes/test_nodes.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +""" +test_nodes.py +---------------------------------- + +Tests for checking all the attributes of nodes. +""" +import logging +import os + +import six + +import tempfile +import pytest as pt + +logger = logging.getLogger(__name__) + +current_directory = os.path.realpath(os.path.dirname(__file__)) + + +def test_line_length(): + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + # test on the test_nodes.dss + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_nodes.dss")) + r.parse(m) + m.set_names() + + assert (m["st_mat"].name) == "st_mat" + assert (m["st_mat"].nominal_voltage) == None + assert (m["st_mat"].phases) == [] + assert (m["st_mat"].positions[0].long) == float(200) + assert (m["st_mat"].positions[0].lat) == float(400) + assert (m["st_mat"].positions[0].elevation) == 0 + assert (m["st_mat"].feeder_name) == "st_mat_src" + # assert (m["st_mat"].substation_name) == None # Not implemented for now + # assert (m["st_mat"].is_substation) == 0 # Not implemented for now + # assert (m["st_mat"].is_substation_connection) == 0 # Not implemented for now + + assert (m["bus1"].name) == "bus1" + assert (m["bus1"].nominal_voltage) == None + assert (m["bus1"].phases[0].default_value) == "A" + assert (m["bus1"].phases[1].default_value) == "B" + assert (m["bus1"].phases[2].default_value) == "C" + # assert (each.default_value for each in m["bus1"].phases) == set(["A", "B", "C"]) + assert (m["bus1"].positions[0].long) == float(300) + assert (m["bus1"].positions[0].lat) == float(400) + assert (m["bus1"].positions[0].elevation) == 0 + assert (m["bus1"].feeder_name) == "st_mat_src" + # assert (m["bus1"].substation_name) == None # Not implemented for now + # assert (m["bus1"].is_substation) == 0 # Not implemented for now + # assert (m["bus1"].is_substation_connection) == 0 # Not implemented for now + + assert (m["sourcebus"].name) == "sourcebus" + assert (m["sourcebus"].nominal_voltage) == None + assert (m["sourcebus"].phases[0].default_value) == "A" + assert (m["sourcebus"].phases[1].default_value) == "B" + assert (m["sourcebus"].phases[2].default_value) == "C" + assert (m["sourcebus"].positions[0].long) == float(1674346.56814483) + assert (m["sourcebus"].positions[0].lat) == float(12272927.0644858) + assert (m["sourcebus"].positions[0].elevation) == 0 + assert (m["sourcebus"].feeder_name) == "st_mat_src" + # assert (m["sourcebus"].substation_name) == None # Not implemented for now + # assert (m["sourcebus"].is_substation) == 0 # Not implemented for now + # assert (m["sourcebus"].is_substation_connection) == 0 # Not implemented for now + + assert (m["b1"].name) == "b1" + assert (m["b1"].nominal_voltage) == None + assert (m["b1"].phases[0].default_value) == "A" + assert (m["b1"].phases[1].default_value) == "B" + assert (m["b1"].phases[2].default_value) == "C" + assert (m["b1"].positions[0].long) == float(1578139) + assert (m["b1"].positions[0].lat) == float(14291312) + assert (m["b1"].positions[0].elevation) == 0 + assert (m["b1"].feeder_name) == "st_mat_src" + # assert (m["b1"].substation_name) == None # Not implemented for now + # assert (m["b1"].is_substation) == 0 # Not implemented for now + # assert (m["b1"].is_substation_connection) == 0 # Not implemented for now diff --git a/tests/readers/opendss/Powersource/buscoord.dss b/tests/readers/opendss/Powersource/buscoord.dss new file mode 100644 index 00000000..1d2c757e --- /dev/null +++ b/tests/readers/opendss/Powersource/buscoord.dss @@ -0,0 +1 @@ +st_mat,200,400 diff --git a/tests/readers/opendss/Powersource/test_powersource.dss b/tests/readers/opendss/Powersource/test_powersource.dss index c35362a4..5b400087 100644 --- a/tests/readers/opendss/Powersource/test_powersource.dss +++ b/tests/readers/opendss/Powersource/test_powersource.dss @@ -1,5 +1,5 @@ Clear -New Circuit.P4U bus1=st_mat pu=0.99 basekV=230.0 R1=1.1208 X1=3.5169 R0=1.1208 X0=3.5169 +New Circuit.P4U bus1=st_mat pu=0.99 basekV=230.0 R1=1.1208 X1=3.5169 R0=1.1208 X0=3.5169 phases=3 diff --git a/tests/readers/opendss/Powersource/test_powersource.py b/tests/readers/opendss/Powersource/test_powersource.py index c82e7933..b7db3263 100644 --- a/tests/readers/opendss/Powersource/test_powersource.py +++ b/tests/readers/opendss/Powersource/test_powersource.py @@ -24,6 +24,7 @@ def test_powersource(): r.parse(m) m.set_names() + assert m["Vsource.source"].name == "Vsource.source" assert m["Vsource.source"].nominal_voltage == 230.0 * 10 ** 3 assert m["Vsource.source"].per_unit == 0.99 assert m["Vsource.source"].is_sourcebus == 1 @@ -31,16 +32,20 @@ def test_powersource(): # assert m["Vsource.source"].emergency_power == None # 14331000000.0 assert m["Vsource.source"].zero_sequence_impedance == 1.1208 + 3.5169j assert m["Vsource.source"].positive_sequence_impedance == 1.1208 + 3.5169j - # assert m["Vsource.source"].phase_angle == None # 0.0 + # assert m["Vsource.source"].phase_angle == None # 0.0 # To be deprecated assert m["Vsource.source"].connecting_element == "st_mat" - # assert m["Vsource.source"].phases == None # [] - # assert m["Vsource.source"].positions == None # [] - assert m["Vsource.source"].connection_type == None - assert m["Vsource.source"].cutout_percent == None - assert m["Vsource.source"].cutin_percent == None - assert m["Vsource.source"].resistance == None - assert m["Vsource.source"].reactance == None - assert m["Vsource.source"].v_max_pu == None - assert m["Vsource.source"].v_min_pu == None - assert m["Vsource.source"].power_factor == None + # assert (m["Vsource.source"].phases) == set(["A", "B", "C"]) + # assert (m["Vsource.source"].phases[1].default_value) == "B" + # assert (m["Vsource.source"].phases[2].default_value) == "C" + # assert (m["Vsource.source"].positions[0].long) == float(200) + # assert (m["Vsource.source"].positions[0].lat) == float(400) + # assert (m["Vsource.source"].positions[0].elevation) == 0 + # assert m["Vsource.source"].connection_type == None # To be deprecated + # assert m["Vsource.source"].cutout_percent == None # To be deprecated + # assert m["Vsource.source"].cutin_percent == None # To be deprecated + # assert m["Vsource.source"].resistance == None # To be deprecated + # assert m["Vsource.source"].reactance == None # To be deprecated + # assert m["Vsource.source"].v_max_pu == None # To be deprecated + # assert m["Vsource.source"].v_min_pu == None # To be deprecated + # assert m["Vsource.source"].power_factor == None # To be deprecated diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index fd52cf56..4d6be724 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -23,7 +23,7 @@ New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 ! Rural regulator from SMART-DS rural region New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (124700,124700) kvas=(10000,10000) -New RegControl.reg_creguladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6 +New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6 ! Regulator from IEEE 13 node feeder diff --git a/tests/readers/opendss/Regulators/test_regulators.py b/tests/readers/opendss/Regulators/test_regulators.py index 46dbbee8..bd0748d7 100644 --- a/tests/readers/opendss/Regulators/test_regulators.py +++ b/tests/readers/opendss/Regulators/test_regulators.py @@ -25,6 +25,7 @@ def test_regulators(): m.set_names() # ! Regulator No. 1 from IEEE 8500 test case + assert m["vreg2_a"].name == "vreg2_a" assert len(m["vreg2_a"].windings) == 2 # Transformer vreg2_a should have 2 Windings assert m["vreg2_a"].windings[0].nominal_voltage == 7.2 * 10 ** 3 assert m["vreg2_a"].windings[1].nominal_voltage == 7.2 * 10 ** 3 @@ -41,15 +42,15 @@ def test_regulators(): # assert m["vreg2_a"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_a"].loadloss == 0.01 # loadloss or noloadloss? assert m["vreg2_a"].phase_shift == None - assert m["vreg2_a"].is_substation == 0 + # assert m["vreg2_a"].is_substation == 0 # Not implemented for now # assert m["vreg2_a"].normhkva == None # 11000.0 - assert m["vreg2_a"].install_type == None + # assert m["vreg2_a"].install_type == None # Not implemented for now assert m["vreg2_a"].from_element == "regxfmr_190-8593" assert m["vreg2_a"].to_element == "190-8593" assert m["vreg2_a"].reactances == [0.1] - # assert m["vreg2_a"].positions == None # [] + # assert m["vreg2_a"].positions == None # [] # Not implemented for now assert m["vreg2_a"].is_center_tap == 0 - # assert m["vreg2_a"].substation_name == None # '' + # assert m["vreg2_a"].substation_name == None # '' # Not implemented for now assert m["vreg2_a"].windings[0].connection_type == "Y" assert m["vreg2_a"].windings[1].connection_type == "Y" @@ -88,6 +89,7 @@ def test_regulators(): # assert m["vreg2_a"].windings[1].phase_windings[0].compensator_x == None # 0.0 + assert m["regulator_vreg2_a"].name == "regulator_vreg2_a" assert m["regulator_vreg2_a"].winding == 2 # assert m["regulator_vreg2_a"].ct_prim == None # 300.0 assert m["regulator_vreg2_a"].noload_loss == None @@ -105,27 +107,27 @@ def test_regulators(): assert m["regulator_vreg2_a"].pt_phase == "A" assert m["regulator_vreg2_a"].reactances == [0.1] assert m["regulator_vreg2_a"].phase_shift == None - assert m["regulator_vreg2_a"].ltc == None - # assert m["regulator_vreg2_a"].positions == None # [] - assert m["regulator_vreg2_a"].ltc == None - # assert m["regulator_vreg2_a"].substation_name == None # '' + # assert m["regulator_vreg2_a"].ltc == None # Not implemented for now + # assert m["regulator_vreg2_a"].positions == None # [] # Not implemented for now + # assert m["regulator_vreg2_a"].substation_name == None # '' # Not implemented for now assert m["regulator_vreg2_a"].feeder_name == "sourcebus_src" - assert m["regulator_vreg2_a"].is_substation == 0 + # assert m["regulator_vreg2_a"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_a"].setpoint == None + assert m["vreg2_b"].name == "vreg2_b" assert m["vreg2_b"].feeder_name == "sourcebus_src" # assert m["vreg2_b"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_b"].loadloss == 0.01 # loadloss or noloadloss? assert m["vreg2_b"].phase_shift == None - assert m["vreg2_b"].is_substation == 0 + # assert m["vreg2_b"].is_substation == 0 # Not implemented for now # assert m["vreg2_b"].normhkva == None # 11000.0 - assert m["vreg2_b"].install_type == None + # assert m["vreg2_b"].install_type == None # Not implemented for now assert m["vreg2_b"].from_element == "regxfmr_190-8593" assert m["vreg2_b"].to_element == "190-8593" assert m["vreg2_b"].reactances == [0.1] - # assert m["vreg2_b"].positions == None # [] + # assert m["vreg2_b"].positions == None # [] # Not implemented for now assert m["vreg2_b"].is_center_tap == 0 - # assert m["vreg2_b"].substation_name == None # '' + # assert m["vreg2_b"].substation_name == None # '' # Not implemented for now assert m["vreg2_b"].windings[0].connection_type == "Y" assert m["vreg2_b"].windings[1].connection_type == "Y" @@ -164,6 +166,7 @@ def test_regulators(): # assert m["vreg2_b"].windings[1].phase_windings[0].compensator_x == None # 0.0 + assert m["regulator_vreg2_b"].name == "regulator_vreg2_b" assert m["regulator_vreg2_b"].winding == 2 # assert m["regulator_vreg2_b"].ct_prim == None # 300.0 assert m["regulator_vreg2_b"].noload_loss == None @@ -181,27 +184,27 @@ def test_regulators(): assert m["regulator_vreg2_b"].pt_phase == "B" assert m["regulator_vreg2_b"].reactances == [0.1] assert m["regulator_vreg2_b"].phase_shift == None - assert m["regulator_vreg2_b"].ltc == None - # assert m["regulator_vreg2_b"].positions == None # [] - assert m["regulator_vreg2_b"].ltc == None - # assert m["regulator_vreg2_b"].substation_name == None # '' + # assert m["regulator_vreg2_b"].ltc == None # Not implemented for now + # assert m["regulator_vreg2_b"].positions == None # [] # Not implemented for now + # assert m["regulator_vreg2_b"].substation_name == None # '' # Not implemented for now assert m["regulator_vreg2_b"].feeder_name == "sourcebus_src" - assert m["regulator_vreg2_b"].is_substation == 0 + # assert m["regulator_vreg2_b"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_b"].setpoint == None + assert m["vreg2_c"].name == "vreg2_c" assert m["vreg2_c"].feeder_name == "sourcebus_src" # assert m["vreg2_c"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_c"].loadloss == 0.01 # loadloss or noloadloss? assert m["vreg2_c"].phase_shift == None - assert m["vreg2_c"].is_substation == 0 + # assert m["vreg2_c"].is_substation == 0 # Not implemented for now # assert m["vreg2_c"].normhkva == None # 11000.0 - assert m["vreg2_c"].install_type == None + # assert m["vreg2_c"].install_type == None # Not implemented for now assert m["vreg2_c"].from_element == "regxfmr_190-8593" assert m["vreg2_c"].to_element == "190-8593" assert m["vreg2_c"].reactances == [0.1] - # assert m["vreg2_c"].positions == None # [] + # assert m["vreg2_c"].positions == None # [] # Not implemented for now assert m["vreg2_c"].is_center_tap == 0 - # assert m["vreg2_c"].substation_name == None # '' + # assert m["vreg2_c"].substation_name == None # '' # Not implemented for now assert m["vreg2_c"].windings[0].connection_type == "Y" assert m["vreg2_c"].windings[1].connection_type == "Y" @@ -240,6 +243,7 @@ def test_regulators(): # assert m["vreg2_c"].windings[1].phase_windings[0].compensator_x == None # 0.0 + assert m["regulator_vreg2_c"].name == "regulator_vreg2_c" assert m["regulator_vreg2_c"].winding == 2 # assert m["regulator_vreg2_c"].ct_prim == None # 300.0 assert m["regulator_vreg2_c"].noload_loss == None @@ -257,15 +261,15 @@ def test_regulators(): assert m["regulator_vreg2_c"].pt_phase == "C" assert m["regulator_vreg2_c"].reactances == [0.1] assert m["regulator_vreg2_c"].phase_shift == None - assert m["regulator_vreg2_c"].ltc == None - # assert m["regulator_vreg2_c"].positions == None # [] - assert m["regulator_vreg2_c"].ltc == None - # assert m["regulator_vreg2_c"].substation_name == None # '' + # assert m["regulator_vreg2_c"].ltc == None # Not implemented for now + # assert m["regulator_vreg2_c"].positions == None # [] # Not implemented for now + # assert m["regulator_vreg2_c"].substation_name == None # '' # Not implemented for now assert m["regulator_vreg2_c"].feeder_name == "sourcebus_src" - assert m["regulator_vreg2_c"].is_substation == 0 + # assert m["regulator_vreg2_c"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_c"].setpoint == None # Regulator No. 2 from IEEE 8500 test case + assert m["regxfmr_b18865"].name == "regxfmr_b18865" assert ( len(m["regxfmr_b18865"].windings) == 2 ) # Transformer regxfmr_b18865 should have 2 Windings @@ -276,15 +280,15 @@ def test_regulators(): # assert m["regxfmr_b18865"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["regxfmr_b18865"].loadloss == None # 0.4 assert m["regxfmr_b18865"].phase_shift == None - assert m["regxfmr_b18865"].is_substation == 0 + # assert m["regxfmr_b18865"].is_substation == 0 # Not implemented for now # assert m["regxfmr_b18865"].normhkva == None # 11000.0 - assert m["regxfmr_b18865"].install_type == None + # assert m["regxfmr_b18865"].install_type == None # Not implemented for now assert m["regxfmr_b18865"].from_element == "b18865" assert m["regxfmr_b18865"].to_element == "b18865reg" assert m["regxfmr_b18865"].reactances == [0.01] - # assert m["regxfmr_b18865"].positions == None # [] + # assert m["regxfmr_b18865"].positions == None # [] # Not implemented for now assert m["regxfmr_b18865"].is_center_tap == 0 - # assert m["regxfmr_b18865"].substation_name == None # '' + # assert m["regxfmr_b18865"].substation_name == None # '' # Not implemented for now assert m["regxfmr_b18865"].windings[0].connection_type == "Y" assert m["regxfmr_b18865"].windings[1].connection_type == "Y" @@ -323,6 +327,7 @@ def test_regulators(): # assert m["regxfmr_b18865"].windings[1].phase_windings[0].compensator_x == None # 0.0 + assert m["regulator_regxfmr_b18865_ctrl"].name == "regulator_regxfmr_b18865_ctrl" assert m["regulator_regxfmr_b18865_ctrl"].winding == 2 # assert m["regulator_regxfmr_b18865_ctrl"].ct_prim == None # 300.0 assert m["regulator_regxfmr_b18865_ctrl"].noload_loss == None @@ -340,15 +345,15 @@ def test_regulators(): assert m["regulator_regxfmr_b18865_ctrl"].pt_phase == "C" assert m["regulator_regxfmr_b18865_ctrl"].reactances == [0.01] assert m["regulator_regxfmr_b18865_ctrl"].phase_shift == None - assert m["regulator_regxfmr_b18865_ctrl"].ltc == None - # assert m["regulator_regxfmr_b18865_ctrl"].positions == None # [] - assert m["regulator_regxfmr_b18865_ctrl"].ltc == None - # assert m["regulator_regxfmr_b18865_ctrl"].substation_name == None # '' + # assert m["regulator_regxfmr_b18865_ctrl"].ltc == None # Not implemented for now + # assert m["regulator_regxfmr_b18865_ctrl"].positions == None # [] # Not implemented for now + # assert m["regulator_regxfmr_b18865_ctrl"].substation_name == None # '' # Not implemented for now assert m["regulator_regxfmr_b18865_ctrl"].feeder_name == "sourcebus_src" - assert m["regulator_regxfmr_b18865_ctrl"].is_substation == 0 + # assert m["regulator_regxfmr_b18865_ctrl"].is_substation == 0 # Not implemented for now assert m["regulator_regxfmr_b18865_ctrl"].setpoint == None # Substation regulator from SMART-DS P4U region + assert m["sb5_p4uhs0_4_trans_439"].name == "sb5_p4uhs0_4_trans_439" assert ( len(m["sb5_p4uhs0_4_trans_439"].windings) == 2 ) # Transformer sb5_p4uhs0_4_trans_439 should have 2 Windings @@ -359,15 +364,15 @@ def test_regulators(): # assert m["sb5_p4uhs0_4_trans_439"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["sb5_p4uhs0_4_trans_439"].loadloss == None # 0.9616652 ?? taken from XHL Value assert m["sb5_p4uhs0_4_trans_439"].phase_shift == None - assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 + # assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 # Not implemented for now # assert m["sb5_p4uhs0_4_trans_439"].normhkva == None # 8800.0 - assert m["sb5_p4uhs0_4_trans_439"].install_type == None + # assert m["sb5_p4uhs0_4_trans_439"].install_type == None # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].from_element == "sb5_p4uhs0_4_node_5_12" assert m["sb5_p4uhs0_4_trans_439"].to_element == "sb5_p4uhs0_4_node_5_13" assert m["sb5_p4uhs0_4_trans_439"].reactances == [pytest.approx(0.9616652224137047)] - # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] + # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].is_center_tap == 0 - # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' + # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].windings[0].connection_type == "D" assert m["sb5_p4uhs0_4_trans_439"].windings[1].connection_type == "Y" @@ -426,6 +431,7 @@ def test_regulators(): # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[1].compensator_x == None # 0.0 # assert m["sb5_p4uhs0_4_trans_439"].windings[1].phase_windings[2].compensator_x == None # 0.0 + assert m["regulator_sb5_p4uhs0_4_reg_439"].name == "regulator_sb5_p4uhs0_4_reg_439" assert m["regulator_sb5_p4uhs0_4_reg_439"].winding == 2 # assert m["regulator_sb5_p4uhs0_4_reg_439"].ct_prim == None # 300.0 assert m["regulator_sb5_p4uhs0_4_reg_439"].noload_loss == None @@ -448,15 +454,15 @@ def test_regulators(): pytest.approx(0.9616652224137047) ] assert m["regulator_sb5_p4uhs0_4_reg_439"].phase_shift == None - assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None - # assert m["regulator_sb5_p4uhs0_4_reg_439"].positions == None # [] - assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None - # assert m["regulator_sb5_p4uhs0_4_reg_439"].substation_name == None # '' + # assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None # Not implemented for now + # assert m["regulator_sb5_p4uhs0_4_reg_439"].positions == None # [] # Not implemented for now + # assert m["regulator_sb5_p4uhs0_4_reg_439"].substation_name == None # '' # Not implemented for now assert m["regulator_sb5_p4uhs0_4_reg_439"].feeder_name == "sourcebus_src" - assert m["regulator_sb5_p4uhs0_4_reg_439"].is_substation == 0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].is_substation == 0 # Not implemented for now assert m["regulator_sb5_p4uhs0_4_reg_439"].setpoint == None # Rural regulator from SMART-DS rural region + assert m["trans_reg_creduladortension"].name == "trans_reg_creduladortension" assert ( len(m["trans_reg_creduladortension"].windings) == 2 ) # Transformer trans_reg_creduladortension should have 2 Windings @@ -471,15 +477,15 @@ def test_regulators(): # assert m["trans_reg_creduladortension"].noload_loss == 0.0 # 0.0 #loadloss or noloadloss? # assert m["trans_reg_creduladortension"].loadloss == None # 0.4 assert m["trans_reg_creduladortension"].phase_shift == None - assert m["trans_reg_creduladortension"].is_substation == 0 + # assert m["trans_reg_creduladortension"].is_substation == 0 # Not implemented for now # assert m["trans_reg_creduladortension"].normhkva == None # 11000.0 - assert m["trans_reg_creduladortension"].install_type == None + # assert m["trans_reg_creduladortension"].install_type == None # Not implemented for now assert m["trans_reg_creduladortension"].from_element == "rdt222-rdt298x" assert m["trans_reg_creduladortension"].to_element == "rdt222" # assert m["trans_reg_creduladortension"].reactances == None # [7.0] - # assert m["trans_reg_creduladortension"].positions == None # [] + # assert m["trans_reg_creduladortension"].positions == None # [] # Not implemented for now assert m["trans_reg_creduladortension"].is_center_tap == 0 - # assert m["trans_reg_creduladortension"].substation_name == None # '' + # assert m["trans_reg_creduladortension"].substation_name == None # '' # Not implemented for now assert m["trans_reg_creduladortension"].windings[0].connection_type == "Y" assert m["trans_reg_creduladortension"].windings[1].connection_type == "Y" @@ -534,6 +540,9 @@ def test_regulators(): # assert m["trans_reg_creduladortension"].windings[1].phase_windings[1].compensator_x == None # 0.0 # assert m["trans_reg_creduladortension"].windings[1].phase_windings[2].compensator_x == None # 0.0 + assert ( + m["regulator_reg_creguladortension"].name == "regulator_reg_creguladortension" + ) assert m["regulator_reg_creguladortension"].winding == 2 # assert m["regulator_reg_creguladortension"].ct_prim == None # 300.0 assert m["regulator_reg_creguladortension"].noload_loss == None @@ -545,21 +554,24 @@ def test_regulators(): assert m["regulator_reg_creguladortension"].bandwidth == 2.4 assert m["regulator_reg_creguladortension"].bandcenter == 123.6 # assert m["regulator_reg_creguladortension"].voltage_limit == None # 0.0 - # assert m["regulator_reg_creguladortension"].connected_transformer == "trans_reg_creduladortension" - # assert m["regulator_reg_creguladortension"].from_element == "rdt222-rdt298x" - # assert m["regulator_reg_creguladortension"].to_element == "rdt222" + assert ( + m["regulator_reg_creguladortension"].connected_transformer + == "trans_reg_creduladortension" + ) + assert m["regulator_reg_creguladortension"].from_element == "rdt222-rdt298x" + assert m["regulator_reg_creguladortension"].to_element == "rdt222" assert m["regulator_reg_creguladortension"].pt_phase == "A" # assert m["regulator_reg_creguladortension"].reactances == None assert m["regulator_reg_creguladortension"].phase_shift == None - assert m["regulator_reg_creguladortension"].ltc == None - # assert m["regulator_reg_creguladortension"].positions == None # [] - assert m["regulator_reg_creguladortension"].ltc == None - # assert m["regulator_reg_creguladortension"].substation_name == None # '' + # assert m["regulator_reg_creguladortension"].ltc == None # Not implemented for now + # assert m["regulator_reg_creguladortension"].positions == None # [] # Not implemented for now + # assert m["regulator_reg_creguladortension"].substation_name == None # '' # Not implemented for now assert m["regulator_reg_creguladortension"].feeder_name == "sourcebus_src" - assert m["regulator_reg_creguladortension"].is_substation == 0 + # assert m["regulator_reg_creguladortension"].is_substation == 0 # Not implemented for now assert m["regulator_reg_creguladortension"].setpoint == None # Regulator from IEEE 13 node feeder + assert m["reg1"].name == "reg1" assert len(m["reg1"].windings) == 2 # Transformer reg1 should have 2 Windings assert m["reg1"].windings[0].nominal_voltage == 2.4 * 10 ** 3 assert m["reg1"].windings[1].nominal_voltage == 2.4 * 10 ** 3 @@ -568,15 +580,15 @@ def test_regulators(): # assert m["reg1"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg1"].loadloss == 0.01 assert m["reg1"].phase_shift == None - assert m["reg1"].is_substation == 0 + # assert m["reg1"].is_substation == 0 # Not implemented for now # assert m["reg1"].normhkva == None # 1832.6 - assert m["reg1"].install_type == None + # assert m["reg1"].install_type == None # Not implemented for now assert m["reg1"].from_element == "650" assert m["reg1"].to_element == "rg60" assert m["reg1"].reactances == [0.01] - # assert m["reg1"].positions == None # [] + # assert m["reg1"].positions == None # [] # Not implemented for now assert m["reg1"].is_center_tap == 0 - # assert m["reg1"].substation_name == None # '' + # assert m["reg1"].substation_name == None # '' # Not implemented for now assert m["reg1"].windings[0].connection_type == "Y" assert m["reg1"].windings[1].connection_type == "Y" @@ -616,6 +628,7 @@ def test_regulators(): assert m["reg1"].windings[0].phase_windings[0].compensator_x == float(9) assert m["reg1"].windings[1].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg1"].name == "regulator_reg1" assert m["regulator_reg1"].winding == 2 assert m["regulator_reg1"].ct_prim == 700 assert m["regulator_reg1"].noload_loss == None @@ -633,14 +646,14 @@ def test_regulators(): assert m["regulator_reg1"].pt_phase == "A" assert m["regulator_reg1"].reactances == [0.01] assert m["regulator_reg1"].phase_shift == None - assert m["regulator_reg1"].ltc == None - # assert m["regulator_reg1"].positions == None # [] - assert m["regulator_reg1"].ltc == None - # assert m["regulator_reg1"].substation_name == None # '' + # assert m["regulator_reg1"].ltc == None # Not implemented for now + # assert m["regulator_reg1"].positions == None # [] # Not implemented for now + # assert m["regulator_reg1"].substation_name == None # '' # Not implemented for now assert m["regulator_reg1"].feeder_name == "sourcebus_src" - assert m["regulator_reg1"].is_substation == 0 + # assert m["regulator_reg1"].is_substation == 0 # Not implemented for now assert m["regulator_reg1"].setpoint == None + assert m["reg2"].name == "reg2" assert len(m["reg2"].windings) == 2 # Transformer reg2 should have 2 Windings assert m["reg2"].windings[0].nominal_voltage == 2.4 * 10 ** 3 assert m["reg2"].windings[1].nominal_voltage == 2.4 * 10 ** 3 @@ -649,15 +662,15 @@ def test_regulators(): # assert m["reg2"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg2"].loadloss == 0.01 assert m["reg2"].phase_shift == None - assert m["reg2"].is_substation == 0 + # assert m["reg2"].is_substation == 0 # Not implemented for now # assert m["reg2"].normhkva == None # 1832.6 - assert m["reg2"].install_type == None + # assert m["reg2"].install_type == None # Not implemented for now assert m["reg2"].from_element == "650" assert m["reg2"].to_element == "rg60" assert m["reg2"].reactances == [0.01] - # assert m["reg2"].positions == None # [] + # assert m["reg2"].positions == None # [] # Not implemented for now assert m["reg2"].is_center_tap == 0 - # assert m["reg2"].substation_name == None # '' + # assert m["reg2"].substation_name == None # '' # Not implemented for now assert m["reg2"].windings[0].connection_type == "Y" assert m["reg2"].windings[1].connection_type == "Y" @@ -697,6 +710,7 @@ def test_regulators(): assert m["reg2"].windings[0].phase_windings[0].compensator_x == float(9) assert m["reg2"].windings[1].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg2"].name == "regulator_reg2" assert m["regulator_reg2"].winding == 2 assert m["regulator_reg2"].ct_prim == 700 assert m["regulator_reg2"].noload_loss == None @@ -714,14 +728,14 @@ def test_regulators(): assert m["regulator_reg2"].pt_phase == "B" assert m["regulator_reg2"].reactances == [0.01] assert m["regulator_reg2"].phase_shift == None - assert m["regulator_reg2"].ltc == None - # assert m["regulator_reg2"].positions == None # [] - assert m["regulator_reg2"].ltc == None - # assert m["regulator_reg2"].substation_name == None # '' + # assert m["regulator_reg2"].ltc == None # Not implemented for now + # assert m["regulator_reg2"].positions == None # [] # Not implemented for now + # assert m["regulator_reg2"].substation_name == None # '' # Not implemented for now assert m["regulator_reg2"].feeder_name == "sourcebus_src" - assert m["regulator_reg2"].is_substation == 0 + # assert m["regulator_reg2"].is_substation == 0 # Not implemented for now assert m["regulator_reg2"].setpoint == None + assert m["reg3"].name == "reg3" assert len(m["reg3"].windings) == 2 # Transformer reg3 should have 2 Windings assert m["reg3"].windings[0].nominal_voltage == 2.4 * 10 ** 3 assert m["reg3"].windings[1].nominal_voltage == 2.4 * 10 ** 3 @@ -730,15 +744,15 @@ def test_regulators(): # assert m["reg3"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg3"].loadloss == 0.01 assert m["reg3"].phase_shift == None - assert m["reg3"].is_substation == 0 + # assert m["reg3"].is_substation == 0 # Not implemented for now # assert m["reg3"].normhkva == None # 1832.6 - assert m["reg3"].install_type == None + # assert m["reg3"].install_type == None # Not implemented for now assert m["reg3"].from_element == "650" assert m["reg3"].to_element == "rg60" assert m["reg3"].reactances == [0.01] - # assert m["reg3"].positions == None # [] + # assert m["reg3"].positions == None # [] # Not implemented for now assert m["reg3"].is_center_tap == 0 - # assert m["reg3"].substation_name == None # '' + # assert m["reg3"].substation_name == None # '' # Not implemented for now assert m["reg3"].windings[0].connection_type == "Y" assert m["reg3"].windings[1].connection_type == "Y" @@ -778,6 +792,7 @@ def test_regulators(): assert m["reg3"].windings[0].phase_windings[0].compensator_x == float(9) assert m["reg3"].windings[1].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg3"].name == "regulator_reg3" assert m["regulator_reg3"].winding == 2 assert m["regulator_reg3"].ct_prim == 700 assert m["regulator_reg3"].noload_loss == None @@ -795,10 +810,9 @@ def test_regulators(): assert m["regulator_reg3"].pt_phase == "C" assert m["regulator_reg3"].reactances == [0.01] assert m["regulator_reg3"].phase_shift == None - assert m["regulator_reg3"].ltc == None - # assert m["regulator_reg3"].positions == None # [] - assert m["regulator_reg3"].ltc == None - # assert m["regulator_reg3"].substation_name == None # '' + # assert m["regulator_reg3"].ltc == None # Not implemented for now + # assert m["regulator_reg3"].positions == None # [] # Not implemented for now + # assert m["regulator_reg3"].substation_name == None # '' # Not implemented for now assert m["regulator_reg3"].feeder_name == "sourcebus_src" - assert m["regulator_reg3"].is_substation == 0 + # assert m["regulator_reg3"].is_substation == 0 # Not implemented for now assert m["regulator_reg3"].setpoint == None diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.py b/tests/readers/opendss/Transformers/test_transformer_kv.py index 06c4cb7b..daf04b29 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.py +++ b/tests/readers/opendss/Transformers/test_transformer_kv.py @@ -23,38 +23,27 @@ def test_transformer_kv(): r = Reader(master_file=os.path.join(current_directory, "test_transformer_kv.dss")) r.parse(m) m.set_names() + # Substation is a 115kV/4.16kV step-down two windings transformer + assert m["substation"].name == "substation" assert ( len(m["substation"].windings) == 2 ) # Transformer substation should have 2 Windings assert m["substation"].windings[0].nominal_voltage == 115 * 10 ** 3 assert m["substation"].windings[1].nominal_voltage == 4.16 * 10 ** 3 - - # reg1 is a 4.16kV/4.16kV two windings regulator - assert len(m["reg1"].windings) == 2 # Transformer reg1 should have 2 Windings - assert m["reg1"].windings[0].nominal_voltage == 4.16 * 10 ** 3 - assert m["reg1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 - - # xfm1 is a 4.16kV/0.48kV two windings distribution transformer - assert len(m["xfm1"].windings) == 2 # Transformer xfm1 should have 2 Windings - assert m["xfm1"].windings[0].nominal_voltage == 4.16 * 10 ** 3 - assert m["xfm1"].windings[1].nominal_voltage == 0.48 * 10 ** 3 - - # TODO: Three windings, center-taps and so on... - assert m["substation"].feeder_name == "sourcebus_src" - # assert m["substation"].noload_loss == None # 0.0 #loadloss or noloadloss? - # assert m["substation"].loadloss == None # 0.001, loadloss or noloadloss? + # assert m["substation"].noload_loss == None # 0.0 + # assert m["substation"].loadloss == None # 0.001 assert m["substation"].phase_shift == None - assert m["substation"].is_substation == 0 + # assert m["substation"].is_substation == 0 # Not implemented for now # assert m["substation"].normhkva == None # 5500.0 - assert m["substation"].install_type == None + # assert m["substation"].install_type == None # Not implemented for now assert m["substation"].from_element == "sourcebus" assert m["substation"].to_element == "bus1" # assert m["substation"].reactances == None # 0.008 - # assert m["substation"].positions == None # [] + # assert m["substation"].positions == None # [] # Not implemented for now assert m["substation"].is_center_tap == 0 - # assert m["substation"].substation_name == None # '' + # assert m["substation"].substation_name == None # '' # Not implemented for now assert m["substation"].windings[0].connection_type == "D" assert m["substation"].windings[1].connection_type == "Y" @@ -109,19 +98,24 @@ def test_transformer_kv(): assert m["substation"].windings[1].phase_windings[1].compensator_x == None assert m["substation"].windings[1].phase_windings[2].compensator_x == None + # reg1 is a 4.16kV/4.16kV two windings regulator + assert m["reg1"].name == "reg1" + assert len(m["reg1"].windings) == 2 # Transformer reg1 should have 2 Windings + assert m["reg1"].windings[0].nominal_voltage == 4.16 * 10 ** 3 + assert m["reg1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 assert m["reg1"].feeder_name == "sourcebus_src" # assert m["reg1"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["reg1"].loadloss == None # 0.4, loadloss or noloadloss? assert m["reg1"].phase_shift == None - assert m["reg1"].is_substation == 0 + # assert m["reg1"].is_substation == 0 # Not implemented for now # assert m["reg1"].normhkva == None # 1832.6 - assert m["reg1"].install_type == None + # assert m["reg1"].install_type == None # Not implemented for now assert m["reg1"].from_element == "bus1" assert m["reg1"].to_element == "bus2" # assert m["reg1"].reactances == None # 7.0 - # assert m["reg1"].positions == None # [] + # assert m["reg1"].positions == None # [] # Not implemented for now assert m["reg1"].is_center_tap == 0 - # assert m["reg1"].substation_name == None # '' + # assert m["reg1"].substation_name == None # '' # Not implemented for now # assert m["reg1"].windings[0].connection_type == None # Y # assert m["reg1"].windings[1].connection_type == None # Y @@ -176,19 +170,24 @@ def test_transformer_kv(): assert m["reg1"].windings[1].phase_windings[1].compensator_x == None assert m["reg1"].windings[1].phase_windings[2].compensator_x == None + # xfm1 is a 4.16kV/0.48kV two windings distribution transformer + assert m["xfm1"].name == "xfm1" + assert len(m["xfm1"].windings) == 2 # Transformer xfm1 should have 2 Windings + assert m["xfm1"].windings[0].nominal_voltage == 4.16 * 10 ** 3 + assert m["xfm1"].windings[1].nominal_voltage == 0.48 * 10 ** 3 assert m["xfm1"].feeder_name == "sourcebus_src" # assert m["xfm1"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["xfm1"].loadloss == None # 1.1, loadloss or noloadloss? assert m["xfm1"].phase_shift == None - assert m["xfm1"].is_substation == 0 + # assert m["xfm1"].is_substation == 0 # Not implemented for now # assert m["xfm1"].normhkva == None # 550.0 - assert m["xfm1"].install_type == None + # assert m["xfm1"].install_type == None # Not implemented for now assert m["xfm1"].from_element == "bus2" assert m["xfm1"].to_element == "bus3" assert m["xfm1"].reactances == [float(2)] - # assert m["xfm1"].positions == None # [] + # assert m["xfm1"].positions == None # [] # Not implemented for now assert m["xfm1"].is_center_tap == 0 - # assert m["xfm1"].substation_name == None # '' + # assert m["xfm1"].substation_name == None # '' # Not implemented for now assert m["xfm1"].windings[0].connection_type == "D" assert m["xfm1"].windings[1].connection_type == "Y" @@ -238,6 +237,7 @@ def test_transformer_kv(): # Three phase wye-wye transformer from IEEE 4 node feeder # t1 is a 12.47kV/4.16kV two windings distribution transformer + assert m["t1"].name == "t1" assert len(m["t1"].windings) == 2 # Transformer t1 should have 2 Windings assert m["t1"].windings[0].nominal_voltage == 12.47 * 10 ** 3 assert m["t1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 @@ -246,18 +246,18 @@ def test_transformer_kv(): # assert m["t1"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["t1"].loadloss == None # 1.0, loadloss or noloadloss? assert m["t1"].phase_shift == None - assert m["t1"].is_substation == 0 + # assert m["t1"].is_substation == 0 # Not implemented for now # assert m["t1"].normhkva == None # 6600.0 - assert m["t1"].install_type == None + # assert m["t1"].install_type == None # Not implemented for now assert m["t1"].from_element == "n2" assert m["t1"].to_element == "n3" assert m["t1"].reactances == [float(6)] - # assert m["t1"].positions == None # [] + # assert m["t1"].positions == None # [] # Not implemented for now assert m["t1"].is_center_tap == 0 - # assert m["t1"].substation_name == None # '' + # assert m["t1"].substation_name == None # '' # Not implemented for now assert m["t1"].windings[0].connection_type == "Y" - # assert m["t1"].windings[1].connection_type == "Y" # Connection is mentioned as Delta + assert m["t1"].windings[1].connection_type == "Y" assert m["t1"].windings[0].rated_power == 6000 * 10 ** 3 assert m["t1"].windings[1].rated_power == 6000 * 10 ** 3 @@ -294,6 +294,7 @@ def test_transformer_kv(): assert m["t1"].windings[1].phase_windings[0].compensator_x == None # Three phase Delta-wye substation Transformer from 4kv SMART-DS region P4U + assert m["sb5_p4uhs0_4_trans_439"].name == "sb5_p4uhs0_4_trans_439" assert ( len(m["sb5_p4uhs0_4_trans_439"].windings) == 2 ) # Transformer should have 2 Windings @@ -304,15 +305,15 @@ def test_transformer_kv(): # assert m["sb5_p4uhs0_4_trans_439"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["sb5_p4uhs0_4_trans_439"].loadloss == None # 0.9616652, loadloss or noloadloss? assert m["sb5_p4uhs0_4_trans_439"].phase_shift == None - assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 + # assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 # Not implemented for now # assert m["sb5_p4uhs0_4_trans_439"].normhkva == None # 8800.0 - assert m["sb5_p4uhs0_4_trans_439"].install_type == None + # assert m["sb5_p4uhs0_4_trans_439"].install_type == None # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].from_element == "sb5_p4uhs0_4_node_5_12" assert m["sb5_p4uhs0_4_trans_439"].to_element == "sb5_p4uhs0_4_node_5_13" assert m["sb5_p4uhs0_4_trans_439"].reactances == [pytest.approx(0.9616652224137047)] - # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] + # assert m["sb5_p4uhs0_4_trans_439"].positions == None # [] # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].is_center_tap == 0 - # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' + # assert m["sb5_p4uhs0_4_trans_439"].substation_name == None # '' # Not implemented for now assert m["sb5_p4uhs0_4_trans_439"].windings[0].connection_type == "D" assert m["sb5_p4uhs0_4_trans_439"].windings[1].connection_type == "Y" @@ -396,6 +397,7 @@ def test_transformer_kv(): ) # Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U + assert m["tr(r:p4udt27-p4udt27lv)"].name == "tr(r:p4udt27-p4udt27lv)" assert ( len(m["tr(r:p4udt27-p4udt27lv)"].windings) == 2 ) # Transformer should have 2 Windings @@ -406,15 +408,15 @@ def test_transformer_kv(): assert m["tr(r:p4udt27-p4udt27lv)"].noload_loss == 0.6 assert m["tr(r:p4udt27-p4udt27lv)"].loadloss == 1.74408 assert m["tr(r:p4udt27-p4udt27lv)"].phase_shift == None - assert m["tr(r:p4udt27-p4udt27lv)"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)"].is_substation == 0 # Not implemented for now # assert m["tr(r:p4udt27-p4udt27lv)"].normhkva == 82.5 - assert m["tr(r:p4udt27-p4udt27lv)"].install_type == None + # assert m["tr(r:p4udt27-p4udt27lv)"].install_type == None # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)"].from_element == "p4udt27" assert m["tr(r:p4udt27-p4udt27lv)"].to_element == "p4udt27lv" assert m["tr(r:p4udt27-p4udt27lv)"].reactances == [pytest.approx(3.240000000000000)] - # assert m["tr(r:p4udt27-p4udt27lv)"].positions == None # [] + # assert m["tr(r:p4udt27-p4udt27lv)"].positions == None # [] # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)"].is_center_tap == 0 - # assert m["tr(r:p4udt27-p4udt27lv)"].substation_name == None # '' + # assert m["tr(r:p4udt27-p4udt27lv)"].substation_name == None # '' # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)"].windings[0].connection_type == "Y" assert m["tr(r:p4udt27-p4udt27lv)"].windings[1].connection_type == "Y" @@ -494,6 +496,7 @@ def test_transformer_kv(): ) # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert m["tr(r:p4udt27-p4udt27lv)_1"].name == "tr(r:p4udt27-p4udt27lv)_1" assert ( len(m["tr(r:p4udt27-p4udt27lv)_1"].windings) == 2 ) # Transformer should have 2 Windings @@ -504,17 +507,17 @@ def test_transformer_kv(): assert m["tr(r:p4udt27-p4udt27lv)_1"].noload_loss == 0.6 assert m["tr(r:p4udt27-p4udt27lv)_1"].loadloss == 1.74408 assert m["tr(r:p4udt27-p4udt27lv)_1"].phase_shift == None - assert m["tr(r:p4udt27-p4udt27lv)_1"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_1"].is_substation == 0 # Not implemented for now # assert m["tr(r:p4udt27-p4udt27lv)_1"].normhkva == 82.5 - assert m["tr(r:p4udt27-p4udt27lv)_1"].install_type == None + # assert m["tr(r:p4udt27-p4udt27lv)_1"].install_type == None # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_1"].from_element == "p4udt27" assert m["tr(r:p4udt27-p4udt27lv)_1"].to_element == "p4udt27lv" assert m["tr(r:p4udt27-p4udt27lv)_1"].reactances == [ pytest.approx(3.240000000000000) ] - # assert m["tr(r:p4udt27-p4udt27lv)_1"].positions == None # [] + # assert m["tr(r:p4udt27-p4udt27lv)_1"].positions == None # [] # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_1"].is_center_tap == 0 - # assert m["tr(r:p4udt27-p4udt27lv)_1"].substation_name == None # '' + # assert m["tr(r:p4udt27-p4udt27lv)_1"].substation_name == None # '' # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[0].connection_type == "D" assert m["tr(r:p4udt27-p4udt27lv)_1"].windings[1].connection_type == "Y" @@ -606,6 +609,7 @@ def test_transformer_kv(): ) # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert m["tr(r:p4udt27-p4udt27lv)_2"].name == "tr(r:p4udt27-p4udt27lv)_2" assert ( len(m["tr(r:p4udt27-p4udt27lv)_2"].windings) == 2 ) # Transformer should have 2 Windings @@ -616,17 +620,17 @@ def test_transformer_kv(): assert m["tr(r:p4udt27-p4udt27lv)_2"].noload_loss == 0.6 assert m["tr(r:p4udt27-p4udt27lv)_2"].loadloss == 1.74408 assert m["tr(r:p4udt27-p4udt27lv)_2"].phase_shift == None - assert m["tr(r:p4udt27-p4udt27lv)_2"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_2"].is_substation == 0 # Not implemented for now # assert m["tr(r:p4udt27-p4udt27lv)_2"].normhkva == 82.5 - assert m["tr(r:p4udt27-p4udt27lv)_2"].install_type == None + # assert m["tr(r:p4udt27-p4udt27lv)_2"].install_type == None # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_2"].from_element == "p4udt27" assert m["tr(r:p4udt27-p4udt27lv)_2"].to_element == "p4udt27lv" assert m["tr(r:p4udt27-p4udt27lv)_2"].reactances == [ pytest.approx(3.240000000000000) ] - # assert m["tr(r:p4udt27-p4udt27lv)_2"].positions == None # [] + # assert m["tr(r:p4udt27-p4udt27lv)_2"].positions == None # [] # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_2"].is_center_tap == 0 - # assert m["tr(r:p4udt27-p4udt27lv)_2"].substation_name == None # '' + # assert m["tr(r:p4udt27-p4udt27lv)_2"].substation_name == None # '' # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[0].connection_type == "D" assert m["tr(r:p4udt27-p4udt27lv)_2"].windings[1].connection_type == "D" @@ -718,6 +722,7 @@ def test_transformer_kv(): ) # Three phase Wye-Wye Transformer (modified) from 4kV SMART-DS region P4U + assert m["tr(r:p4udt27-p4udt27lv)_3"].name == "tr(r:p4udt27-p4udt27lv)_3" assert ( len(m["tr(r:p4udt27-p4udt27lv)_3"].windings) == 2 ) # Transformer should have 2 Windings @@ -728,17 +733,17 @@ def test_transformer_kv(): assert m["tr(r:p4udt27-p4udt27lv)_3"].noload_loss == 0.6 assert m["tr(r:p4udt27-p4udt27lv)_3"].loadloss == 1.74408 assert m["tr(r:p4udt27-p4udt27lv)_3"].phase_shift == None - assert m["tr(r:p4udt27-p4udt27lv)_3"].is_substation == 0 + # assert m["tr(r:p4udt27-p4udt27lv)_3"].is_substation == 0 # Not implemented for now # assert m["tr(r:p4udt27-p4udt27lv)_3"].normhkva == 82.5 - assert m["tr(r:p4udt27-p4udt27lv)_3"].install_type == None + # assert m["tr(r:p4udt27-p4udt27lv)_3"].install_type == None # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_3"].from_element == "p4udt27" assert m["tr(r:p4udt27-p4udt27lv)_3"].to_element == "p4udt27lv" assert m["tr(r:p4udt27-p4udt27lv)_3"].reactances == [ pytest.approx(3.240000000000000) ] - # assert m["tr(r:p4udt27-p4udt27lv)_3"].positions == None # [] + # assert m["tr(r:p4udt27-p4udt27lv)_3"].positions == None # [] # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_3"].is_center_tap == 0 - # assert m["tr(r:p4udt27-p4udt27lv)_3"].substation_name == None # '' + # assert m["tr(r:p4udt27-p4udt27lv)_3"].substation_name == None # '' # Not implemented for now assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[0].connection_type == "Y" assert m["tr(r:p4udt27-p4udt27lv)_3"].windings[1].connection_type == "D" @@ -830,6 +835,7 @@ def test_transformer_kv(): ) # Center Tap Transformer from 4kV SMART-DS region P4U + assert m["tr(r:p4udt25-p4udt25lv)"].name == "tr(r:p4udt25-p4udt25lv)" assert ( len(m["tr(r:p4udt25-p4udt25lv)"].windings) == 3 ) # Transformer tr(r:p4udt25-p4udt25lv) should have 3 Windings @@ -845,15 +851,15 @@ def test_transformer_kv(): assert m["tr(r:p4udt25-p4udt25lv)"].noload_loss == 0.472 assert m["tr(r:p4udt25-p4udt25lv)"].loadloss == 0.798816 assert m["tr(r:p4udt25-p4udt25lv)"].phase_shift == None - assert m["tr(r:p4udt25-p4udt25lv)"].is_substation == 0 + # assert m["tr(r:p4udt25-p4udt25lv)"].is_substation == 0 # Not implemented for now assert m["tr(r:p4udt25-p4udt25lv)"].normhkva == 27.5 - assert m["tr(r:p4udt25-p4udt25lv)"].install_type == None + # assert m["tr(r:p4udt25-p4udt25lv)"].install_type == None # Not implemented for now assert m["tr(r:p4udt25-p4udt25lv)"].from_element == "p4udt25" assert m["tr(r:p4udt25-p4udt25lv)"].to_element == "p4udt25lv" # assert m["tr(r:p4udt25-p4udt25lv)"].reactances == [float(2.4)] - # assert m["tr(r:p4udt25-p4udt25lv)"].positions == None # [] + # assert m["tr(r:p4udt25-p4udt25lv)"].positions == None # [] # Not implemented for now assert m["tr(r:p4udt25-p4udt25lv)"].is_center_tap == 1 - # assert m["tr(r:p4udt25-p4udt25lv)"].substation_name == None # '' + # assert m["tr(r:p4udt25-p4udt25lv)"].substation_name == None # '' # Not implemented for now assert m["tr(r:p4udt25-p4udt25lv)"].windings[0].connection_type == "Y" assert m["tr(r:p4udt25-p4udt25lv)"].windings[1].connection_type == "Y" @@ -912,6 +918,7 @@ def test_transformer_kv(): ) # Center Tap Transformer from IEEE 8500 test case + assert m["t21396254a"].name == "t21396254a" assert ( len(m["t21396254a"].windings) == 3 ) # Transformer t21396254a should have 3 Windings @@ -923,15 +930,15 @@ def test_transformer_kv(): assert m["t21396254a"].noload_loss == 0.2 # assert m["t21396254a"].loadloss == None # 1.8 assert m["t21396254a"].phase_shift == None - assert m["t21396254a"].is_substation == 0 + # assert m["t21396254a"].is_substation == 0 # Not implemented for now # assert m["t21396254a"].normhkva == None # 16.5 - assert m["t21396254a"].install_type == None + # assert m["t21396254a"].install_type == None # Not implemented for now assert m["t21396254a"].from_element == "l2804253" assert m["t21396254a"].to_element == "x2804253a" # assert m["t21396254a"].reactances == [float(2.4)] # [2.04, 2.04, 1.36] - # assert m["t21396254a"].positions == None # [] + # assert m["t21396254a"].positions == None # [] # Not implemented for now assert m["t21396254a"].is_center_tap == 1 - # assert m["t21396254a"].substation_name == None # '' + # assert m["t21396254a"].substation_name == '' # Not implemented for now # assert m["t21396254a"].windings[0].connection_type == None # Y # assert m["t21396254a"].windings[1].connection_type == None # Y @@ -978,6 +985,7 @@ def test_transformer_kv(): assert m["t21396254a"].windings[2].phase_windings[0].compensator_x == None # Single phase Wye-Wye Transformer (for regulator) From IEEE 8500 Test case + assert m["feeder_rega"].name == "feeder_rega" assert ( len(m["feeder_rega"].windings) == 2 ) # Transformer feeder_rega should have 2 Windings @@ -988,15 +996,15 @@ def test_transformer_kv(): # assert m["feeder_rega"].noload_loss == None # 0.0 assert m["feeder_rega"].loadloss == 0.001 assert m["feeder_rega"].phase_shift == None - assert m["feeder_rega"].is_substation == 0 + # assert m["feeder_rega"].is_substation == 0 # Not implemented for now # assert m["feeder_rega"].normhkva == None # 30250.0 - assert m["feeder_rega"].install_type == None + # assert m["feeder_rega"].install_type == None # Not implemented for now assert m["feeder_rega"].from_element == "regxfmr_hvmv_sub_lsb" assert m["feeder_rega"].to_element == "_hvmv_sub_lsb" assert m["feeder_rega"].reactances == [0.1] - # assert m["feeder_rega"].positions == None # [] + # assert m["feeder_rega"].positions == None # [] # Not implemented for now assert m["feeder_rega"].is_center_tap == 0 - # assert m["feeder_rega"].substation_name == None # '' + # assert m["feeder_rega"].substation_name == None # '' # Not implemented for now # assert m["feeder_rega"].windings[0].connection_type == None # Y # assert m["feeder_rega"].windings[1].connection_type == None # Y @@ -1032,6 +1040,7 @@ def test_transformer_kv(): assert m["feeder_rega"].windings[1].phase_windings[0].compensator_x == None # Single phase Wye-Wye Transformers from Epri J-1 Feeder + assert m["b13659-1c"].name == "b13659-1c" assert ( len(m["b13659-1c"].windings) == 2 ) # Transformer b13659-1c should have 2 Windings @@ -1042,15 +1051,15 @@ def test_transformer_kv(): assert m["b13659-1c"].noload_loss == 0.34 assert m["b13659-1c"].loadloss == 1.04 assert m["b13659-1c"].phase_shift == None - assert m["b13659-1c"].is_substation == 0 + # assert m["b13659-1c"].is_substation == 0 # Not implemented for now assert m["b13659-1c"].normhkva == 15 - assert m["b13659-1c"].install_type == None + # assert m["b13659-1c"].install_type == None # Not implemented for now assert m["b13659-1c"].from_element == "b13659" assert m["b13659-1c"].to_element == "x_b13659-c" assert m["b13659-1c"].reactances == [1.5] - # assert m["b13659-1c"].positions == None # [] + # assert m["b13659-1c"].positions == None # [] # Not implemented for now assert m["b13659-1c"].is_center_tap == 0 - # assert m["b13659-1c"].substation_name == None # '' + # assert m["b13659-1c"].substation_name == None # '' # Not implemented for now assert m["b13659-1c"].windings[0].connection_type == "Y" assert m["b13659-1c"].windings[1].connection_type == "Y" @@ -1085,6 +1094,8 @@ def test_transformer_kv(): assert m["b13659-1c"].windings[0].phase_windings[0].compensator_x == None assert m["b13659-1c"].windings[1].phase_windings[0].compensator_x == None + # Single phase Wye-Wye Transformers from Epri J-1 Feeder + assert m["b4551-1a"].name == "b4551-1a" assert ( len(m["b4551-1a"].windings) == 2 ) # Transformer b4551-1a should have 2 Windings @@ -1095,15 +1106,15 @@ def test_transformer_kv(): assert m["b4551-1a"].noload_loss == 0.34 assert m["b4551-1a"].loadloss == 1.04 assert m["b4551-1a"].phase_shift == None - assert m["b4551-1a"].is_substation == 0 + # assert m["b4551-1a"].is_substation == 0 # Not implemented for now assert m["b4551-1a"].normhkva == 15 - assert m["b4551-1a"].install_type == None + # assert m["b4551-1a"].install_type == None # Not implemented for now assert m["b4551-1a"].from_element == "b4551" assert m["b4551-1a"].to_element == "x_b4551-a" assert m["b4551-1a"].reactances == [1.5] - # assert m["b4551-1a"].positions == None # [] + # assert m["b4551-1a"].positions == None # [] # Not implemented for now assert m["b4551-1a"].is_center_tap == 0 - # assert m["b4551-1a"].substation_name == None # '' + # assert m["b4551-1a"].substation_name == None # '' # Not implemented for now # assert m["b4551-1a"].windings[0].connection_type == None # Y # assert m["b4551-1a"].windings[1].connection_type == None # Y @@ -1139,6 +1150,7 @@ def test_transformer_kv(): assert m["b4551-1a"].windings[1].phase_windings[0].compensator_x == None # Three phase Wye-Wye Transformer from 4kV SMART-DS region P4U + assert m["5865228330a-1abc"].name == "5865228330a-1abc" assert ( len(m["5865228330a-1abc"].windings) == 2 ) # Transformer should have 2 Windings @@ -1149,15 +1161,15 @@ def test_transformer_kv(): assert m["5865228330a-1abc"].noload_loss == 0.05 assert m["5865228330a-1abc"].loadloss == 0.7 assert m["5865228330a-1abc"].phase_shift == None - assert m["5865228330a-1abc"].is_substation == 0 + # assert m["5865228330a-1abc"].is_substation == 0 # Not implemented for now assert m["5865228330a-1abc"].normhkva == 2000.01 - assert m["5865228330a-1abc"].install_type == None + # assert m["5865228330a-1abc"].install_type == None # Not implemented for now assert m["5865228330a-1abc"].from_element == "5865228330a" assert m["5865228330a-1abc"].to_element == "x_5865228330a" assert m["5865228330a-1abc"].reactances == [5] - # assert m["5865228330a-1abc"].positions == None # [] + # assert m["5865228330a-1abc"].positions == None # [] # Not implemented for now assert m["5865228330a-1abc"].is_center_tap == 0 - # assert m["5865228330a-1abc"].substation_name == None # '' + # assert m["5865228330a-1abc"].substation_name == None # '' # Not implemented for now # assert m["5865228330a-1abc"].windings[0].connection_type == None # Y # assert m["5865228330a-1abc"].windings[1].connection_type == None # Y @@ -1213,6 +1225,7 @@ def test_transformer_kv(): assert m["5865228330a-1abc"].windings[1].phase_windings[2].compensator_x == None # Single phase delta-wye transformer. This is a dummy test as we don't expect to see delta configurations on a single phase + assert m["t1_1"].name == "t1_1" assert len(m["t1_1"].windings) == 2 # Transformer t1_1 should have 2 Windings assert m["t1_1"].windings[0].nominal_voltage == 12.47 * 10 ** 3 assert m["t1_1"].windings[1].nominal_voltage == 4.16 * 10 ** 3 @@ -1221,15 +1234,15 @@ def test_transformer_kv(): # assert m["t1_1"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["t1_1"].loadloss == None # 1.0, loadloss or noloadloss? assert m["t1_1"].phase_shift == None - assert m["t1_1"].is_substation == 0 + # assert m["t1_1"].is_substation == 0 # Not implemented for now # assert m["t1_1"].normhkva == None # 6600.0 - assert m["t1_1"].install_type == None + # assert m["t1_1"].install_type == None # Not implemented for now assert m["t1_1"].from_element == "n2" assert m["t1_1"].to_element == "n3" assert m["t1_1"].reactances == [float(6)] - # assert m["t1_1"].positions == None # [] + # assert m["t1_1"].positions == None # [] # Not implemented for now assert m["t1_1"].is_center_tap == 0 - # assert m["t1_1"].substation_name == None # '' + # assert m["t1_1"].substation_name == None # '' # Not implemented for now assert m["t1_1"].windings[0].connection_type == "D" assert m["t1_1"].windings[1].connection_type == "Y" @@ -1268,6 +1281,7 @@ def test_transformer_kv(): assert m["t1_1"].windings[1].phase_windings[0].compensator_x == None # Single phase wye-delta transformer. This is a dummy test as we don't expect to see delta configurations on a single phase + assert m["t1_2"].name == "t1_2" assert len(m["t1_2"].windings) == 2 # Transformer t1_2 should have 2 Windings assert m["t1_2"].windings[0].nominal_voltage == 12.47 * 10 ** 3 assert m["t1_2"].windings[1].nominal_voltage == 4.16 * 10 ** 3 @@ -1276,15 +1290,15 @@ def test_transformer_kv(): # assert m["t1_2"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["t1_2"].loadloss == None # 1.0, loadloss or noloadloss? assert m["t1_2"].phase_shift == None - assert m["t1_2"].is_substation == 0 + # assert m["t1_2"].is_substation == 0 # Not implemented for now # assert m["t1_2"].normhkva == None # 6600.0 - assert m["t1_2"].install_type == None + # assert m["t1_2"].install_type == None # Not implemented for now assert m["t1_2"].from_element == "n2" assert m["t1_2"].to_element == "n3" assert m["t1_2"].reactances == [float(6)] - # assert m["t1_2"].positions == None # [] + # assert m["t1_2"].positions == None # [] # Not implemented for now assert m["t1_2"].is_center_tap == 0 - # assert m["t1_2"].substation_name == None # '' + # assert m["t1_2"].substation_name == None # '' # Not implemented for now assert m["t1_2"].windings[0].connection_type == "Y" assert m["t1_2"].windings[1].connection_type == "D" diff --git a/docs/read.md b/tests/readers/opendss/read.md similarity index 66% rename from docs/read.md rename to tests/readers/opendss/read.md index d9cbf2db..a9bc3f56 100644 --- a/docs/read.md +++ b/tests/readers/opendss/read.md @@ -9,18 +9,18 @@ | length | yes | | from_element | yes | | to_element | yes | -| is_fuse | no | # Tarek needs to send this -| is_switch | no | # Tarek needs to send this +| is_fuse | yes | +| is_switch | yes | | is_banked | no | # Not now -| faultrate | no | # Tarek needs to send this +| faultrate | yes | | wires | yes | | positions | no | # Not now | impedance_matrix | yes | | capacitance_matrix | yes | # Tarek needs to send this | substation_name | no | # Not implemented | feeder_name | yes | # Document it -| is_recloser | no | # Document it that its in the name -| is_breaker | no |# Document it that its in the name +| is_recloser | no | # Document that its in the name +| is_breaker | no | # Document that its in the name | is_sectionalizer | no | # Not now | nameclass | yes | | is_substation | no | # Not now @@ -30,7 +30,6 @@ ## Wire | Attribute | Tested | | :------------------:|:-------:| -| name | yes | | phase | yes | | nameclass | yes | | X | yes | @@ -40,62 +39,63 @@ | ampacity | yes | | emergency_ampacity | yes | | resistance | yes | -| insulation_thickness| no |# Needs to be implemented +| insulation_thickness| no | # Needs to be implemented | is_fuse | no | # needs to be deprecated | is_switch | no | # needs to be deprecated -| is_open | no | +| is_open | yes | | interrupting_rating | no | # Not for now | concentric_neutral_gmr | no | # Needs to be implemented -| concentric_neutral_resistance | no | # Needs to be implemented +| concentric_neutral_resistance | no | # Needs to be implemented | concentric_neutral_diameter | no | # Needs to be implemented | concentric_outside_diameter | no | # Needs to be implemented | concentric_neutral_nstrand | no | # Needs to be implemented | drop | no | # doesn't need testing, possible deprecation -| is_recloser | no |# needs to be deprecated -| is_breaker | no |# needs to be deprecated +| is_recloser | no | # needs to be deprecated +| is_breaker | no | # needs to be deprecated | is_network_protector| no | # doesn't need testing, needs to be deprecated -| is_sectionalizer | no |# needs to be deprecated +| is_sectionalizer | no | # needs to be deprecated ## Capacitor | Attribute | Tested | | :------------------:|:-------:| +| name | yes | | nominal_voltage | yes | | connection_type | yes | | delay | yes | | mode | yes | -| low | no | -| high | no | -| resistance | no | -| resistance0 | no | -| reactance | no | -| reactance0 | no | -| susceptance | no | -| susceptance0 | no | -| conductance | no | -| conductance0 | no | +| low | no | # Create issue +| high | no | # Create issue +| resistance | no | # Create issue +| resistance0 | no | # Not implemented +| reactance | no | # Create issue +| reactance0 | no | # Not implemented +| susceptance | no | # Include in the same issues as conductance +| susceptance0 | no | # Not implemented +| conductance | no | # cmatrix is used to represent, create issue if opendss gives defaults or we set the values +| conductance0 | no | # Not implemented | pt_ratio | yes | -| ct_ratio | no | +| ct_ratio | no | # Create issue | pt_phase | yes | -| connecting_element | no | -| positions | no | -| measuring_element | yes | -| substation_name | no | +| connecting_element | yes | # Bhavya to Check if it is bus ; Confirmed +| positions | no | # implement from BusCoords.dss ; implement later +| measuring_element | yes | # Double check if it is in controller ; Confirmed +| substation_name | no | # Not implemented | feeder_name | yes | -| is_substation | no | +| is_substation | no | # Not implemented ## Phase Capacitor | Attribute | Tested | | :------------------:|:-------:| | phase | yes | -| var | no | -| switch | no | -| sections | no | -| normalsections | no | +| var | no | # kvar, sum of each var = kvar ; bhavya to check ; Confirmed +| switch | no | # Create issue to see if it is included in opendss +| sections | no | # Create issue to see if it is included in opendss +| normalsections | no | # Create issue to see if it is included in opendss ## Transformer | Attribute | Tested | | :------------------:|:-------:| -| name | no | +| name | yes | | install_type | no | #not needed | noload_loss | yes | | phase_shift | no | # Tarek to check if this exists in opendss and set it @@ -136,7 +136,7 @@ ## Regulator | Attribute | Tested | | :------------------:|:-------:| -| name | no | +| name | yes | | delay | yes | | highstep | yes | | lowstep | no | # needs to be implemented ( equal to highstep), raise an issue @@ -150,7 +150,7 @@ | from_element | yes | | to_element | yes | |connected_transformer| yes | -| pt_phase | no | # Bhavya needs to add +| pt_phase | yes | | reactances | yes | | windings | no | # Deprecate but a big api change | positions | no | # Not now @@ -165,7 +165,7 @@ ## Load | Attribute | Tested | | :------------------:|:-------:| -| name | no | +| name | yes | | connection_type | no | # Tarek to create an example | nominal_voltage | yes | | vmin | yes | @@ -195,12 +195,12 @@ ## PhaseLoad | Attribute | Tested | | :------------------:|:-------:| -| phase | no | # Bhavya to check this +| phase | yes | | p | yes | | q | yes | | model | yes | | use_zip | yes | -| drop | no | +| drop | no | # Not tested | ppercentcurrent | yes | | qpercentcurrent | yes | | ppercentpower | yes | @@ -211,35 +211,35 @@ ## PowerSource | Attribute | Tested | | :------------------:|:-------:| -| name | no | -| nominal_voltage | no | -| per_unit | no | -| phases | no | -| positions | no | -| is_sourcebus | no | -| rated_power | no | -| emergency_power | no | -| connection_type | no | -| cutout_percent | no | -| cutin_percent | no | -| resistance | no | -| reactance | no | -| v_max_pu | no | -| v_min_pu | no | -| power_factor | no | -| connecting_element | no | -| phase_angle | no | -| positive_sequence_impedance | no | -| zero_sequence_impedance | no | +| name | yes | +| nominal_voltage | yes | +| per_unit | yes | +| phases | no | # CHeck +| positions | no | # Create buscoords.dss and test; +| is_sourcebus | yes | +| rated_power | no | # Create issue +| emergency_power | no | # Create issue +| connection_type | no | # Needs to be deprecated +| cutout_percent | no | # Needs to be deprecated +| cutin_percent | no | # Needs to be deprecated +| resistance | no | # Needs to be deprecated +| reactance | no |# Needs to be deprecated +| v_max_pu | no |# Needs to be deprecated +| v_min_pu | no |# Needs to be deprecated +| power_factor | no |# Needs to be deprecated +| connecting_element | yes | +| phase_angle | no | # Needs to be deprecated +| positive_sequence_impedance | yes | +| zero_sequence_impedance | yes | ## Nodes | Attribute | Tested | | :------------------:|:-------:| -| name | no | -| nominal_voltage | no | -| phases | no | -| positions | no | -| substation_name | no | -| feeder_name | no | -| is_substation | no | -| is_substation_connection | no | +| name | yes | +| nominal_voltage | no | # Double check , create issue +| phases | yes | +| positions | yes | # Create buscoords.dss and test; loads and capacitors - later +| substation_name | no | #not implemented +| feeder_name | yes | +| is_substation | no | # not implemented +| is_substation_connection | no | # not implemented From ffbf633fae961ba0cfd24b012a81461d85d1a687 Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Wed, 12 Dec 2018 15:01:24 -0700 Subject: [PATCH 16/25] Added attributes only which are implemented till now --- docs/OpenDSS/Attributes.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/OpenDSS/Attributes.json diff --git a/docs/OpenDSS/Attributes.json b/docs/OpenDSS/Attributes.json new file mode 100644 index 00000000..67a5d57c --- /dev/null +++ b/docs/OpenDSS/Attributes.json @@ -0,0 +1,20 @@ +{ + "OpenDSS": { + "Line": ["name","nominal_voltage","line_type","length","from_element","to_element","is_fuse","is_switch","faultrate","wires","impedance_matrix", + "capacitance_matrix","feeder_name","is_recloser","is_breaker","nameclass"], + "Wire": ["name","phase","nameclass","X","Y","diameter","gmr","ampacity","emergency_ampacity","resistance","is_open"], + "Capacitor": ["nominal_voltage","connection_type","delay","mode","low","high","resistance","reactance","susceptance","conductance","pt_ratio", + "ct_ratio","pt_phase","connecting_element","positions","measuring_element","feeder_name"], + "PhaseCapacitor" : ["phase","var"], + "Transformer" : ["name", "noload_loss","from_element","to_element","reactances","windings","loadloss","normhkva","is_center_tap","feeder_name"], + "Winding" : ["connection_type","nominal_voltage","resistance","phase_windings","rated_power","emergency_power"], + "PhaseWinding" : ["phase","compensator_r","compensator_x"], + "Regulator" : ["name","delay","highstep","pt_ratio","bandwidth","bandcenter","voltage_limit","from_element","to_element", + "connected_transformer","pt_phase","reactances","feeder_name"], + "Load" : ["name","connection_type","nominal_voltage","vmin","vmax","phase_loads","connecting_element","feeder_name"], + "PhaseLoad" : ["phase","p","q","model","use_zip","ppercentcurrent","qpercentcurrent","ppercentpower","qpercentpower","ppercentimpedance","qpercentimpedance"], + "PowerSource" : ["name","nominal_voltage","per_unit","phases","positions","is_sourcebus","rated_power", + "emergency_power","connecting_element","positive_sequence_impedance","zero_sequence_impedance"], + "Nodes" : ["name","nominal_voltage","phases","positions","feeder_name"], + } +} From 58c377372cc4bbe3549955758bd8d991832ab21f Mon Sep 17 00:00:00 2001 From: kavuribhavya Date: Wed, 12 Dec 2018 15:20:02 -0700 Subject: [PATCH 17/25] Changing names of testcases --- tests/readers/opendss/Concentric/test_concentric.py | 8 +++----- tests/readers/opendss/Nodes/test_nodes.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/readers/opendss/Concentric/test_concentric.py b/tests/readers/opendss/Concentric/test_concentric.py index 3b9ba201..8fa216b8 100644 --- a/tests/readers/opendss/Concentric/test_concentric.py +++ b/tests/readers/opendss/Concentric/test_concentric.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ -test_line_connectivity.py +test_concentric.py ---------------------------------- -Tests for checking the line connectivity and all the attributes of line and wire +Tests for checking the concenctric properties """ import logging import os @@ -19,12 +19,10 @@ current_directory = os.path.realpath(os.path.dirname(__file__)) -def test_line_connectivity(): - """Tests if line length units are in meters.""" +def test_concentric(): from ditto.store import Store from ditto.readers.opendss.read import Reader - # test on the test_line_connectivity.dss m = Store() r = Reader(master_file=os.path.join(current_directory, "test_concentric.dss")) r.parse(m) diff --git a/tests/readers/opendss/Nodes/test_nodes.py b/tests/readers/opendss/Nodes/test_nodes.py index 9b1bfc5e..5522a292 100644 --- a/tests/readers/opendss/Nodes/test_nodes.py +++ b/tests/readers/opendss/Nodes/test_nodes.py @@ -19,7 +19,7 @@ current_directory = os.path.realpath(os.path.dirname(__file__)) -def test_line_length(): +def test_nodes(): from ditto.store import Store from ditto.readers.opendss.read import Reader From 1b2db6ff55117c9a19144edfcba09dc08e1c5922 Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 10:06:37 -0700 Subject: [PATCH 18/25] Adding tests with vmin and vmax provided --- .../opendss/Capacitors/test_capacitor_connectivity.dss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index feb92179..7c52fb79 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss @@ -24,10 +24,16 @@ New Capacitor.B4909-1 bus=B4909 kV=12.47 kvar=900 conn=wye New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 ~ type=volt ON=120.5 OFF=125 PTphase=2 PTratio=60 +New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 +~ type=volt Vmin=120.5 Vmax=125 PTphase=2 PTratio=60 + New Capacitor.B18944-1 bus=B18941 kV=12.47 kvar=1200 conn=wye New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 ~ type=volt ON=118 OFF=124 PTphase=1 PTratio=60 +New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 +~ type=volt Vmin=118 Vmax=124 PTphase=1 PTratio=60 + ! Capacitors from ieee 8500-node test feeder New Capacitor.CAPBank0A Bus1=R42246.1 kv=7.2 kvar=400 phases=1 conn=wye New Capacitor.CAPBank0B Bus1=R42246.2 kv=7.2 kvar=400 phases=1 conn=wye From 33e1fbfd8a5cbe84cb6c8438bd46208f52bda50b Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 10:09:21 -0700 Subject: [PATCH 19/25] different names for controllers --- .../opendss/Capacitors/test_capacitor_connectivity.dss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index 7c52fb79..1677c202 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss @@ -21,7 +21,7 @@ New Line.OH_B4904 bus1=B4909.1.2.3 bus2=B4904.1.2.3 length=161.84879 units=m lin New Line.OH_B18944 bus1=B18941.1.2.3 bus2=B18944.1.2.3 length=141.1224 units=m linecode=OH-3X_4CU_4CUN phases=3 enabled=True New Capacitor.B4909-1 bus=B4909 kV=12.47 kvar=900 conn=wye -New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 +New Capcontrol.B4909-2 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 ~ type=volt ON=120.5 OFF=125 PTphase=2 PTratio=60 New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 @@ -31,7 +31,7 @@ New Capacitor.B18944-1 bus=B18941 kV=12.47 kvar=1200 conn=wye New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 ~ type=volt ON=118 OFF=124 PTphase=1 PTratio=60 -New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 +New Capcontrol.B18944-2 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 ~ type=volt Vmin=118 Vmax=124 PTphase=1 PTratio=60 ! Capacitors from ieee 8500-node test feeder From 57f9f995c9e305812db142436bd6304be2a86ef9 Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 10:44:33 -0700 Subject: [PATCH 20/25] Adding phase shift info based on connection type --- ditto/readers/opendss/read.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index bd3772f6..a903ae1b 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -1531,6 +1531,19 @@ def parse_transformers(self, model): ) ) + + if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "wye": + api_transformer.phase_shift = 0 + + if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "delta": + api_transformer.phase_shift = 0 + + if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "delta": + api_transformer.phase_shift = -30 + + if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "wye": + api_transformer.phase_shift = -30 + for w in range(N_windings): windings.append(Winding(model)) From af20df41d91f84d4f346383d8e7362274ce72894 Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 11:01:50 -0700 Subject: [PATCH 21/25] adding vlimit parameters to test --- .../readers/opendss/Regulators/test_regulators.dss | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index 4d6be724..a83d8da6 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -8,9 +8,9 @@ New Transformer.VREG2_A phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-859 New Transformer.VREG2_B phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.2, 190-8593.2) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 New Transformer.VREG2_C phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.3, 190-8593.3) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 -New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band=2 -New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 -New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 +New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band=2 vlimit=8.0 +New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 vlimit=0 +New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 ! Regulator No. 2 from IEEE 8500 test case @@ -22,19 +22,19 @@ New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=6 New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 maxtapchange=10 ptratio=19.0 band=1.9919999999999998 vreg = 123.60000000000001 ! Rural regulator from SMART-DS rural region -New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (124700,124700) kvas=(10000,10000) -New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6 +New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (12.47,12.47) kvas=(10000,10000) +New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 ! Regulator from IEEE 13 node feeder New Transformer.Reg1 phases=1 XHL=0.01 kVAs=[1666 1666] ~ Buses=[650.1 RG60.1] kVs=[2.4 2.4] %LoadLoss=0.01 -new regcontrol.Reg1 transformer=Reg1 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 +new regcontrol.Reg1 transformer=Reg1 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 vlimit=0 New Transformer.Reg2 phases=1 XHL=0.01 kVAs=[1666 1666] ~ Buses=[650.2 RG60.2] kVs=[2.4 2.4] %LoadLoss=0.01 -new regcontrol.Reg2 transformer=Reg2 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 +new regcontrol.Reg2 transformer=Reg2 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 vlimit=2.8 New Transformer.Reg3 phases=1 XHL=0.01 kVAs=[1666 1666] ~ Buses=[650.3 RG60.3] kVs=[2.4 2.4] %LoadLoss=0.01 From 43301a7de076531e8959a80c4baf0e30d16aeab8 Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 11:12:00 -0700 Subject: [PATCH 22/25] Adding phase_shift to regulators --- ditto/readers/opendss/read.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index a903ae1b..7ede3ef7 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -1695,6 +1695,18 @@ def parse_regulators(self, model): # Total number of windings N_windings = int(trans["windings"]) + if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "wye": + api_regulator.phase_shift = 0 + + if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "delta": + api_regulator.phase_shift = 0 + + if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "delta": + api_regulator.phase_shift = -30 + + if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "wye": + api_regulator.phase_shift = -30 + # Initialize the list of Windings api_regulator.windings = [Winding(model) for _ in range(N_windings)] From e4166d8deaca36dc7f3e7a145e6ab400027c6d8b Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 11:15:38 -0700 Subject: [PATCH 23/25] Added two CTPrim examples --- tests/readers/opendss/Regulators/test_regulators.dss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index a83d8da6..df64c1c4 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -15,7 +15,7 @@ New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band= ! Regulator No. 2 from IEEE 8500 test case New Transformer.regxfmr_B18865 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 enabled=True -New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 +New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 CTPrim=0.12 ! Substation regulator from SMART-DS P4U region New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=69.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_12 wdg=2 conn=wye Kv=4.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_13 XHL=0.9616652224137047 @@ -23,7 +23,7 @@ New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 ! Rural regulator from SMART-DS rural region New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (12.47,12.47) kvas=(10000,10000) -New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 +New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 CTPrim=0.2 ! Regulator from IEEE 13 node feeder From 4ae1b6d52d357015620c684d7db074bdb390bba3 Mon Sep 17 00:00:00 2001 From: Tarek Elgindy Date: Fri, 22 Feb 2019 14:00:37 -0700 Subject: [PATCH 24/25] adding tap information for regulators --- ditto/readers/opendss/read.py | 6 ++++++ .../opendss/Regulators/test_regulators.dss | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index 7ede3ef7..9d5815ae 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -1793,6 +1793,12 @@ def parse_regulators(self, model): api_regulator.windings[w].phase_windings[ p ].tap_position = float(trans["taps"][w]) + if "tapnum" in data: + api_regulator.windings[w].phase_windings[ + p + ].tap_position = float(data["tapnum"][w]) + + # compensator_r if "R" in data: diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index df64c1c4..d42062fc 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -8,22 +8,30 @@ New Transformer.VREG2_A phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-859 New Transformer.VREG2_B phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.2, 190-8593.2) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 New Transformer.VREG2_C phases=1 windings=2 bank=VREG2 buses=(regxfmr_190-8593.3, 190-8593.3) conns=(wye, wye) kvs=(7.2, 7.2) kvas=(10000, 10000) xhl=0.1 %loadloss=.01 Wdg=2 Maxtap=1.1 Mintap=0.9 ppm=0 -New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band=2 vlimit=8.0 -New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 vlimit=0 -New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 +New RegControl.VREG2_A transformer=VREG2_A winding=2 vreg=125 ptratio=60 band=2 vlimit=8.0 TapNum=0 +New RegControl.VREG2_B transformer=VREG2_B winding=2 vreg=125 ptratio=60 band=2 vlimit=0 TapNum=-3 +New RegControl.VREG2_C transformer=VREG2_C winding=2 vreg=125 ptratio=60 band=2 TapNum=2 ! Regulator No. 2 from IEEE 8500 test case -New Transformer.regxfmr_B18865 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 enabled=True +New Transformer.regxfmr_B18865 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 tap=2 enabled=True New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 CTPrim=0.12 +! Regulator No. 2 from IEEE 8500 test case + +New Transformer.regxfmr_B18865_2 phases=1 windings=2 buses=(B18865.3, B18865reg.3) conns=(wye, wye) kvs=(7.2,7.2) kvas=(10000, 10000) xhl=0.01 Maxtap=1.1 Mintap=0.9 tap=2 enabled=True +New RegControl.regxfmr_B18865_ctrl transformer=regxfmr_B18865 winding=2 vreg=124 ptratio=60 band=2 enabled=True delay=45 CTPrim=0.12 TapNum=3 + + + + ! Substation regulator from SMART-DS P4U region New Transformer.sb5_p4uhs0_4_trans_439 phases=3 windings=2 wdg=1 conn=delta Kv=69.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_12 wdg=2 conn=wye Kv=4.0 kva=8000.0 %R=0.4808326112068522 bus=sb5_p4uhs0_4_node_5_13 XHL=0.9616652224137047 New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 maxtapchange=10 ptratio=19.0 band=1.9919999999999998 vreg = 123.60000000000001 ! Rural regulator from SMART-DS rural region New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (12.47,12.47) kvas=(10000,10000) -New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 CTPrim=0.2 +New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 CTPrim=0.2 TapNum=2 ! Regulator from IEEE 13 node feeder From 74d7bc6aed1b3a62e096554bc58dd4ecade8f45e Mon Sep 17 00:00:00 2001 From: Kavuri Date: Wed, 6 Mar 2019 14:09:28 -0700 Subject: [PATCH 25/25] Updated tests for Lines, capacitors and regulators --- ditto/readers/opendss/read.py | 64 ++- .../test_capacitor_connectivity.dss | 8 +- .../Capacitors/test_capacitor_connectivity.py | 90 ++++ .../opendss/Lines/test_line_connectivity.py | 138 +----- .../opendss/Regulators/test_regulators.dss | 4 +- .../opendss/Regulators/test_regulators.py | 440 +++++++++++++++++- 6 files changed, 585 insertions(+), 159 deletions(-) diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index 9d5815ae..acc14837 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -46,7 +46,6 @@ def timeit(method): - def timed(*args, **kw): ts = time.time() result = method(*args, **kw) @@ -1531,17 +1530,32 @@ def parse_transformers(self, model): ) ) - - if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "wye": + if ( + N_windings >= 2 + and data["conns"][0].lower() == "wye" + and data["conns"][1].lower() == "wye" + ): api_transformer.phase_shift = 0 - if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "delta": + if ( + N_windings >= 2 + and data["conns"][0].lower() == "delta" + and data["conns"][1].lower() == "delta" + ): api_transformer.phase_shift = 0 - if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "delta": + if ( + N_windings >= 2 + and data["conns"][0].lower() == "wye" + and data["conns"][1].lower() == "delta" + ): api_transformer.phase_shift = -30 - if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "wye": + if ( + N_windings >= 2 + and data["conns"][0].lower() == "delta" + and data["conns"][1].lower() == "wye" + ): api_transformer.phase_shift = -30 for w in range(N_windings): @@ -1694,17 +1708,32 @@ def parse_regulators(self, model): # Total number of windings N_windings = int(trans["windings"]) - - if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "wye": + if ( + N_windings >= 2 + and trans["conns"][0].lower() == "wye" + and trans["conns"][1].lower() == "wye" + ): api_regulator.phase_shift = 0 - if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "delta": + if ( + N_windings >= 2 + and trans["conns"][0].lower() == "delta" + and trans["conns"][1].lower() == "delta" + ): api_regulator.phase_shift = 0 - if N_windings >= 2 and data["conns"][0].lower() == "wye" and data["conns"][1].lower() == "delta": + if ( + N_windings >= 2 + and trans["conns"][0].lower() == "wye" + and trans["conns"][1].lower() == "delta" + ): api_regulator.phase_shift = -30 - if N_windings >= 2 and data["conns"][0].lower() == "delta" and data["conns"][1].lower() == "wye": + if ( + N_windings >= 2 + and trans["conns"][0].lower() == "delta" + and trans["conns"][1].lower() == "wye" + ): api_regulator.phase_shift = -30 # Initialize the list of Windings @@ -1719,6 +1748,13 @@ def parse_regulators(self, model): ] except: pass + try: + if trans["conns"][w].lower() == "wye": + api_regulator.windings[w].connection_type = "Y" + elif trans["conns"][w].lower() == "delta": + api_regulator.windings[w].connection_type = "D" + except: + pass # nominal_voltage for w in range(N_windings): @@ -1793,12 +1829,10 @@ def parse_regulators(self, model): api_regulator.windings[w].phase_windings[ p ].tap_position = float(trans["taps"][w]) - if "tapnum" in data: + if "TapNum" in data: api_regulator.windings[w].phase_windings[ p - ].tap_position = float(data["tapnum"][w]) - - + ].tap_position = float(data["TapNum"]) # compensator_r if "R" in data: diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index 1677c202..c1e99456 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss @@ -21,17 +21,19 @@ New Line.OH_B4904 bus1=B4909.1.2.3 bus2=B4904.1.2.3 length=161.84879 units=m lin New Line.OH_B18944 bus1=B18941.1.2.3 bus2=B18944.1.2.3 length=141.1224 units=m linecode=OH-3X_4CU_4CUN phases=3 enabled=True New Capacitor.B4909-1 bus=B4909 kV=12.47 kvar=900 conn=wye -New Capcontrol.B4909-2 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 +New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 ~ type=volt ON=120.5 OFF=125 PTphase=2 PTratio=60 -New Capcontrol.B4909-1 Capacitor=B4909-1 element=Line.OH_B4904 terminal=1 Delay=30 +New Capacitor.B4909-2 bus=B4909 kV=12.47 kvar=900 conn=wye +New Capcontrol.B4909-2 Capacitor=B4909-2 element=Line.OH_B4904 terminal=1 Delay=30 ~ type=volt Vmin=120.5 Vmax=125 PTphase=2 PTratio=60 New Capacitor.B18944-1 bus=B18941 kV=12.47 kvar=1200 conn=wye New Capcontrol.B18944-1 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 ~ type=volt ON=118 OFF=124 PTphase=1 PTratio=60 -New Capcontrol.B18944-2 Capacitor=B18944-1 element=Line.OH_B18944 terminal=1 Delay=31 +New Capacitor.B18944-2 bus=B18941 kV=12.47 kvar=1200 conn=wye +New Capcontrol.B18944-2 Capacitor=B18944-2 element=Line.OH_B18944 terminal=1 Delay=31 ~ type=volt Vmin=118 Vmax=124 PTphase=1 PTratio=60 ! Capacitors from ieee 8500-node test feeder diff --git a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py index 22ecd594..5df1e04f 100644 --- a/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py @@ -220,6 +220,50 @@ def test_capacitor_connectivity(): phase_capacitor.normalsections for phase_capacitor in m["b4909-1"].phase_capacitors ] == [None, None, None] + + assert len(m["b4909-2"].phase_capacitors) == 3 # b4909-2 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["b4909-2"].phase_capacitors] + ) == pytest.approx(900 * 10 ** 3, 0.0001) + assert m["b4909-2"].name == "b4909-2" + assert m["b4909-2"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["b4909-2"].connection_type == "Y" + assert m["b4909-2"].delay == 30 + assert m["b4909-2"].mode == "voltage" + assert m["b4909-2"].low == 120.5 + assert m["b4909-2"].high == 125 + # assert m["b4909-2"].resistance is None # 0.0 + # assert m["b4909-2"].resistance0 is None # Not implemented for now + # assert m["b4909-2"].reactance is None # 0.0 + # assert m["b4909-2"].reactance0 is None # Not implemented for now + assert m["b4909-2"].susceptance is None + # assert m["b4909-2"].susceptance0 is None # Not implemented for now + assert m["b4909-2"].conductance is None + # assert m["b4909-2"].conductance0 is None # Not implemented for now + assert m["b4909-2"].pt_ratio == 60 + # assert m["b4909-2"].ct_ratio is None # 60 + assert m["b4909-2"].pt_phase == "B" + assert m["b4909-2"].connecting_element == "b4909" + # assert m["b4909-2"].positions is None # [] + assert m["b4909-2"].measuring_element == "Line.OH_B4904" + # assert m["b4909-2"].substation_name == '' # Not implemented for now + assert m["b4909-2"].feeder_name == "sourcebus_src" + # assert m["b4909-2"].is_substation == 0 # Not implemented for now + + assert set([pc.phase for pc in m["b4909-2"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["b4909-2"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["b4909-2"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["b4909-2"].phase_capacitors + ] == [None, None, None] + # oh_b4904 # assert len(m["oh_b4904"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD # Phases of the different wires @@ -317,6 +361,52 @@ def test_capacitor_connectivity(): phase_capacitor.normalsections for phase_capacitor in m["b18944-1"].phase_capacitors ] == [None, None, None] + + assert ( + len(m["b18944-2"].phase_capacitors) == 3 + ) # b18944-2 is a three phase capacitor + assert sum( + [phase_capacitor.var for phase_capacitor in m["b18944-2"].phase_capacitors] + ) == pytest.approx(1200 * 10 ** 3, 0.0001) + assert m["b18944-2"].name == "b18944-2" + assert m["b18944-2"].nominal_voltage == float(12.47) * 10 ** 3 + assert m["b18944-2"].connection_type == "Y" + assert m["b18944-2"].delay == 31 + assert m["b18944-2"].mode == "voltage" + assert m["b18944-2"].low == 118 + assert m["b18944-2"].high == 124 + # assert m["b18944-2"].resistance is None # 0.0 + assert m["b18944-2"].resistance0 is None + # assert m["b18944-2"].reactance is None # 0.0 + assert m["b18944-2"].reactance0 is None + assert m["b18944-2"].susceptance is None + assert m["b18944-2"].susceptance0 is None + assert m["b18944-2"].conductance is None + assert m["b18944-2"].conductance0 is None + assert m["b18944-2"].pt_ratio == 60 + # assert m["b18944-2"].ct_ratio is None # 60.0 + assert m["b18944-2"].pt_phase == "A" + assert m["b18944-2"].connecting_element == "b18941" + # assert m["b18944-2"].positions is None # [] + assert m["b18944-2"].measuring_element == "Line.OH_B18944" + # assert m["b18944-2"].substation_name is None # '' + assert m["b18944-2"].feeder_name == "sourcebus_src" + assert m["b18944-2"].is_substation == 0 + + assert set([pc.phase for pc in m["b18944-2"].phase_capacitors]) == set( + ["A", "B", "C"] + ) + assert [ + phase_capacitor.switch for phase_capacitor in m["b18944-2"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.sections for phase_capacitor in m["b18944-2"].phase_capacitors + ] == [None, None, None] + assert [ + phase_capacitor.normalsections + for phase_capacitor in m["b18944-2"].phase_capacitors + ] == [None, None, None] + # oh_b18944 # assert len(m["oh_b18944"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD # Phases of the different wires diff --git a/tests/readers/opendss/Lines/test_line_connectivity.py b/tests/readers/opendss/Lines/test_line_connectivity.py index c01e4e4d..7afcb92d 100644 --- a/tests/readers/opendss/Lines/test_line_connectivity.py +++ b/tests/readers/opendss/Lines/test_line_connectivity.py @@ -38,10 +38,10 @@ def test_line_connectivity(): ) as f: json_data = json.load(f) - # Line1 connects sourcebus to bus1 and should have 4 wires: A, B, C, and N - # assert len(m["line1"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Line1 connects sourcebus to bus1 and should have 3 wires: A, B, C + assert len(m["line1"].wires) == 3 # Phases of the different wires - # assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line1"].wires]) == set(["A", "B", "C"]) assert m["line1"].name == "line1" assert m["line1"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line1"].line_type == "underground" @@ -50,9 +50,7 @@ def test_line_connectivity(): assert m["line1"].to_element == "bus1" assert m["line1"].is_fuse is None assert m["line1"].is_switch is None - # assert m["line1"].is_banked is None # Not implemented for now assert m["line1"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line1"].positions is None # Not implemented for now assert m["line1"].impedance_matrix == [ [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j), (0.04013333 + 0.0947j)], [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], @@ -63,14 +61,10 @@ def test_line_connectivity(): [(-0.6 + 0j), (2.8 + 0j), (-0.6 + 0j)], [(-0.6 + 0j), (-0.6 + 0j), (2.8 + 0j)], ] - # assert m["line1"].substation_name is None # Not implemented for now assert m["line1"].feeder_name == "sourcebus_src" assert m["line1"].is_recloser is None assert m["line1"].is_breaker is None - # assert m["line1"].is_sectionalizer is None # Not implemented for now assert m["line1"].nameclass == "" - # assert m["line1"].is_substation == 0 # Not implemented for now - # assert m["line1"].is_network_protector is None # Not implemented for now for w in m["line1"].wires: assert w.nameclass == "" @@ -82,25 +76,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated - # Line2 connects bus1 to bus2 and should have 4 wires: A, B, C, and N - # assert len(m["line2"].wires) == 4 # Number of wires # Neutral wire is not counted. TBD + # Line2 connects bus1 to bus2 and should have 3 wires: A, B, C + assert len(m["line2"].wires) == 3 # Phases of the different wires - # assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line2"].wires]) == set(["A", "B", "C"]) assert m["line2"].name == "line2" assert m["line2"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line2"].line_type == "underground" @@ -109,9 +95,7 @@ def test_line_connectivity(): assert m["line2"].to_element == "bus2" assert m["line2"].is_fuse is None assert m["line2"].is_switch is None - # assert m["line2"].is_banked is None # Not implemented for now assert m["line2"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line2"].positions is None # Not implemented for now assert m["line2"].impedance_matrix == [ [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j), (0.04013333 + 0.0947j)], [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], @@ -122,14 +106,10 @@ def test_line_connectivity(): [(-0.6 + 0j), (2.8 + 0j), (-0.6 + 0j)], [(-0.6 + 0j), (-0.6 + 0j), (2.8 + 0j)], ] - # assert m["line2"].substation_name is None # Not implemented for now assert m["line2"].feeder_name == "sourcebus_src" assert m["line2"].is_recloser is None assert m["line2"].is_breaker is None - # assert m["line2"].is_sectionalizer is None # Not implemented for now assert m["line2"].nameclass == "" - # assert m["line2"].is_substation == 0 # Not implemented for now - # assert m["line2"].is_network_protector is None # Not implemented for now for w in m["line2"].wires: assert w.nameclass == "" @@ -141,25 +121,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated - # Line3 connects bus2 to bus3 and should have 3 wires: A, B, and N - # assert len(m["line3"].wires) == 3 + # Line3 connects bus2 to bus3 and should have 2 wires: A, B + assert len(m["line3"].wires) == 2 # Phases of the different wires - # assert set([w.phase for w in m["line3"].wires]) == set(["A", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line3"].wires]) == set(["A", "B"]) assert m["line3"].name == "line3" assert m["line3"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line3"].line_type == "underground" @@ -168,9 +140,7 @@ def test_line_connectivity(): assert m["line3"].to_element == "bus3" assert m["line3"].is_fuse is None assert m["line3"].is_switch is None - # assert m["line3"].is_banked is None # Not implemented for now assert m["line3"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line3"].positions is None # Not implemented for now assert m["line3"].impedance_matrix == [ [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], @@ -179,14 +149,10 @@ def test_line_connectivity(): [(2.8 + 0j), (-0.6 + 0j)], [(-0.6 + 0j), (2.8 + 0j)], ] - # assert m["line3"].substation_name is None # Not implemented for now assert m["line3"].feeder_name == "sourcebus_src" assert m["line3"].is_recloser is None assert m["line3"].is_breaker is None - # assert m["line3"].is_sectionalizer is None # Not implemented for now assert m["line3"].nameclass == "" - # assert m["line3"].is_substation == 0 # Not implemented for now - # assert m["line3"].is_network_protector is None # Not implemented for now for w in m["line3"].wires: assert w.nameclass == "" @@ -198,25 +164,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated - # Line4 connects bus3 to bus4 and should have 2 wires: B, and N - # assert len(m["line4"].wires) == 2 + # Line4 connects bus3 to bus4 and should have 1 wire: B + assert len(m["line4"].wires) == 1 # Phases of the different wires - # assert set([w.phase for w in m["line4"].wires]) == set(["B", "N"]) + assert set([w.phase for w in m["line4"].wires]) == set(["B"]) assert m["line4"].name == "line4" assert m["line4"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line4"].line_type == "underground" @@ -225,19 +183,13 @@ def test_line_connectivity(): assert m["line4"].to_element == "bus4" assert m["line4"].is_fuse is None assert m["line4"].is_switch is None - # assert m["line4"].is_banked is None # Not implemented for now assert m["line4"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line4"].positions is None # Not implemented for now assert m["line4"].impedance_matrix == [[(0.058 + 0.1206j)]] assert m["line4"].capacitance_matrix == [[(3.4 + 0j)]] - # assert m["line4"].substation_name is None # Not implemented for now assert m["line4"].feeder_name == "sourcebus_src" assert m["line4"].is_recloser is None assert m["line4"].is_breaker is None - # assert m["line4"].is_sectionalizer is None # Not implemented for now assert m["line4"].nameclass == "" - # assert m["line4"].is_substation == 0 # Not implemented for now - # assert m["line4"].is_network_protector is None # Not implemented for now for w in m["line4"].wires: assert w.nameclass == "" @@ -249,25 +201,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated - # Line5 connects bus1 to bus5 and should have 3 wires: A, C, and N - # assert len(m["line5"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Line5 connects bus1 to bus5 and should have 2 wires: A, C + assert len(m["line5"].wires) == 2 # Phases of the different wires - # assert set([w.phase for w in m["line5"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line5"].wires]) == set(["A", "C"]) assert m["line5"].name == "line5" assert m["line5"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line5"].line_type == "underground" @@ -276,9 +220,7 @@ def test_line_connectivity(): assert m["line5"].to_element == "bus5" assert m["line5"].is_fuse is None assert m["line5"].is_switch is None - # assert m["line5"].is_banked is None # Not implemented for now assert m["line5"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line5"].positions is None # Not implemented for now assert m["line5"].impedance_matrix == [ [ (0.3219597440944882 + 0.7063648293963254j), @@ -293,14 +235,10 @@ def test_line_connectivity(): [(9.186351706036744 + 0j), (-1.9685039370078738 + 0j)], [(-1.9685039370078738 + 0j), (9.186351706036744 + 0j)], ] # units = ft - # assert m["line5"].substation_name is None # Not implemented for now assert m["line5"].feeder_name == "sourcebus_src" assert m["line5"].is_recloser is None assert m["line5"].is_breaker is None - # assert m["line5"].is_sectionalizer is None # Not implemented for now assert m["line5"].nameclass == "" - # assert m["line5"].is_substation == 0 # Not implemented for now - # assert m["line5"].is_network_protector is None # Not implemented for now for w in m["line5"].wires: assert w.nameclass == "" @@ -312,25 +250,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated - # Line6 connects bus4 to bus6 and should have 3 wires: B, C, and N - # assert len(m["line6"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + # Line6 connects bus4 to bus6 and should have 2 wires: B, C + assert len(m["line6"].wires) == 2 # Phases of the different wires - # assert set([w.phase for w in m["line6"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line6"].wires]) == set(["B", "C"]) assert m["line6"].name == "line6" assert m["line6"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line6"].line_type == "underground" @@ -339,9 +269,7 @@ def test_line_connectivity(): assert m["line6"].to_element == "bus6" assert m["line6"].is_fuse is None assert m["line6"].is_switch is None - # assert m["line6"].is_banked is None # Not implemented for now assert m["line6"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line6"].positions is None # Not implemented for now assert m["line6"].impedance_matrix == [ [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], @@ -350,14 +278,10 @@ def test_line_connectivity(): [(2.8 + 0j), (-0.6 + 0j)], [(-0.6 + 0j), (2.8 + 0j)], ] - # assert m["line6"].substation_name is None # Not implemented for now assert m["line6"].feeder_name == "sourcebus_src" assert m["line6"].is_recloser is None assert m["line6"].is_breaker is None - # assert m["line6"].is_sectionalizer is None # Not implemented for now assert m["line6"].nameclass == "" - # assert m["line6"].is_substation == 0 # Not implemented for now - # assert m["line6"].is_network_protector is None # Not implemented for now for w in m["line6"].wires: assert w.nameclass == "" @@ -369,25 +293,17 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated # Line7 should raise some error in DiTTo since it only supports 1, 2, 3, and 0. - # assert len(m["line7"].wires) == 3 # Number of wires # Neutral wire is not counted. TBD + assert len(m["line7"].wires) == 2 # Phases of the different wires - # assert set([w.phase for w in m["line7"].wires]) == set(["A", "B", "C", "N"]) # Neutral wire is not counted. TBD + assert set([w.phase for w in m["line7"].wires]) == set(["A", "B"]) assert m["line7"].name == "line7" assert m["line7"].nominal_voltage == float(4.16) * 10 ** 3 assert m["line7"].line_type == "underground" @@ -396,9 +312,7 @@ def test_line_connectivity(): assert m["line7"].to_element == "bus2" assert m["line7"].is_fuse is None assert m["line7"].is_switch is None - # assert m["line7"].is_banked is None # Not implemented for now assert m["line7"].faultrate == json_data["OpenDSS"]["faultrate"] - # assert m["line7"].positions is None # Not implemented for now assert m["line7"].impedance_matrix == [ [(0.09813333 + 0.2153j), (0.04013333 + 0.0947j)], [(0.04013333 + 0.0947j), (0.09813333 + 0.2153j)], @@ -407,14 +321,10 @@ def test_line_connectivity(): [(2.8 + 0j), (-0.6 + 0j)], [(-0.6 + 0j), (2.8 + 0j)], ] - # assert m["line7"].substation_name is None # Not implemented for now assert m["line7"].feeder_name == "sourcebus_src" assert m["line7"].is_recloser is None assert m["line7"].is_breaker is None - assert m["line7"].is_sectionalizer is None # Not implemented for now assert m["line7"].nameclass == "" - # assert m["line7"].is_substation == 0 # Not implemented for now - # assert m["line7"].is_network_protector is None # Not implemented for now for w in m["line7"].wires: assert w.nameclass == "" @@ -426,17 +336,9 @@ def test_line_connectivity(): assert w.emergency_ampacity == json_data["OpenDSS"]["emergamps"] assert w.resistance is None assert w.insulation_thickness == 0.0 - # assert w.is_fuse is None # Needs to be deprecated - # assert w.is_switch is None # Needs to be deprecated assert w.is_open is None - # assert w.interrupting_rating is None # Not implemented for now assert w.concentric_neutral_gmr is None assert w.concentric_neutral_resistance is None assert w.concentric_neutral_diameter is None assert w.concentric_neutral_outside_diameter is None assert w.concentric_neutral_nstrand is None - # assert w.drop == 0 # Needs to be deprecated - # assert w.is_recloser is None # Needs to be deprecated - # assert w.is_breaker is None # Needs to be deprecated - # assert w.is_network_protector is None # Needs to be deprecated - # assert w.is_sectionalizer is None # Needs to be deprecated diff --git a/tests/readers/opendss/Regulators/test_regulators.dss b/tests/readers/opendss/Regulators/test_regulators.dss index d42062fc..7b2fe7bd 100644 --- a/tests/readers/opendss/Regulators/test_regulators.dss +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -31,7 +31,7 @@ New RegControl.sb5_p4uhs0_4_reg_439 transformer=sb5_p4uhs0_4_trans_439 winding=2 ! Rural regulator from SMART-DS rural region New Transformer.trans_reg_creduladortension phases=3 windings=2 buses=(rdt222-rdt298x.1.2.3, rdt222.1.2.3) conns=(wye,wye) kvs = (12.47,12.47) kvas=(10000,10000) -New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6a vlimit=12.6 CTPrim=0.2 TapNum=2 +New RegControl.reg_creguladortension transformer=trans_reg_creduladortension phases=3 winding=2 ptratio=60 band=2.4 vreg=123.6 vlimit=12.6 CTPrim=0.2 TapNum=2 ! Regulator from IEEE 13 node feeder @@ -47,5 +47,3 @@ new regcontrol.Reg2 transformer=Reg2 winding=2 vreg=122 band=2 ptratio=20 ct New Transformer.Reg3 phases=1 XHL=0.01 kVAs=[1666 1666] ~ Buses=[650.3 RG60.3] kVs=[2.4 2.4] %LoadLoss=0.01 new regcontrol.Reg3 transformer=Reg3 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 - - diff --git a/tests/readers/opendss/Regulators/test_regulators.py b/tests/readers/opendss/Regulators/test_regulators.py index bd0748d7..471c918f 100644 --- a/tests/readers/opendss/Regulators/test_regulators.py +++ b/tests/readers/opendss/Regulators/test_regulators.py @@ -41,7 +41,7 @@ def test_regulators(): assert m["vreg2_a"].feeder_name == "sourcebus_src" # assert m["vreg2_a"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_a"].loadloss == 0.01 # loadloss or noloadloss? - assert m["vreg2_a"].phase_shift == None + assert m["vreg2_a"].phase_shift == 0 # assert m["vreg2_a"].is_substation == 0 # Not implemented for now # assert m["vreg2_a"].normhkva == None # 11000.0 # assert m["vreg2_a"].install_type == None # Not implemented for now @@ -106,7 +106,7 @@ def test_regulators(): assert m["regulator_vreg2_a"].to_element == "190-8593" assert m["regulator_vreg2_a"].pt_phase == "A" assert m["regulator_vreg2_a"].reactances == [0.1] - assert m["regulator_vreg2_a"].phase_shift == None + assert m["regulator_vreg2_a"].phase_shift == 0 # assert m["regulator_vreg2_a"].ltc == None # Not implemented for now # assert m["regulator_vreg2_a"].positions == None # [] # Not implemented for now # assert m["regulator_vreg2_a"].substation_name == None # '' # Not implemented for now @@ -114,11 +114,48 @@ def test_regulators(): # assert m["regulator_vreg2_a"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_a"].setpoint == None + assert m["regulator_vreg2_a"].windings[0].connection_type == "Y" + assert m["regulator_vreg2_a"].windings[1].connection_type == "Y" + + assert m["regulator_vreg2_a"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["regulator_vreg2_a"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["regulator_vreg2_a"].windings[0].emergency_power == None # 15000000.0 + # assert m["regulator_vreg2_a"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regulator_vreg2_a"].windings[0].resistance == None # 0.005 + # assert m["regulator_vreg2_a"].windings[1].resistance == None # 0.005 + + assert m["regulator_vreg2_a"].windings[0].voltage_type == None + assert m["regulator_vreg2_a"].windings[1].voltage_type == None + + assert m["regulator_vreg2_a"].windings[0].voltage_limit == None + assert m["regulator_vreg2_a"].windings[1].voltage_limit == None + + assert m["regulator_vreg2_a"].windings[0].reverse_resistance == None + assert m["regulator_vreg2_a"].windings[1].reverse_resistance == None + + # assert m["regulator_vreg2_a"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["regulator_vreg2_a"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["regulator_vreg2_a"].windings[0].phase_windings[0].phase == "A" + + assert m["regulator_vreg2_a"].windings[1].phase_windings[0].phase == "A" + + # assert m["regulator_vreg2_a"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_a"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_a"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["regulator_vreg2_a"].windings[1].phase_windings[0].compensator_x == None # 0.0 + assert m["vreg2_b"].name == "vreg2_b" assert m["vreg2_b"].feeder_name == "sourcebus_src" # assert m["vreg2_b"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_b"].loadloss == 0.01 # loadloss or noloadloss? - assert m["vreg2_b"].phase_shift == None + assert m["vreg2_b"].phase_shift == 0 # assert m["vreg2_b"].is_substation == 0 # Not implemented for now # assert m["vreg2_b"].normhkva == None # 11000.0 # assert m["vreg2_b"].install_type == None # Not implemented for now @@ -183,7 +220,7 @@ def test_regulators(): assert m["regulator_vreg2_b"].to_element == "190-8593" assert m["regulator_vreg2_b"].pt_phase == "B" assert m["regulator_vreg2_b"].reactances == [0.1] - assert m["regulator_vreg2_b"].phase_shift == None + assert m["regulator_vreg2_b"].phase_shift == 0 # assert m["regulator_vreg2_b"].ltc == None # Not implemented for now # assert m["regulator_vreg2_b"].positions == None # [] # Not implemented for now # assert m["regulator_vreg2_b"].substation_name == None # '' # Not implemented for now @@ -191,11 +228,48 @@ def test_regulators(): # assert m["regulator_vreg2_b"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_b"].setpoint == None + assert m["regulator_vreg2_b"].windings[0].connection_type == "Y" + assert m["regulator_vreg2_b"].windings[1].connection_type == "Y" + + assert m["regulator_vreg2_b"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["regulator_vreg2_b"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["regulator_vreg2_b"].windings[0].emergency_power == None # 15000000.0 + # assert m["regulator_vreg2_b"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regulator_vreg2_b"].windings[0].resistance == None # 0.005 + # assert m["regulator_vreg2_b"].windings[1].resistance == None # 0.005 + + assert m["regulator_vreg2_b"].windings[0].voltage_type == None + assert m["regulator_vreg2_b"].windings[1].voltage_type == None + + assert m["regulator_vreg2_b"].windings[0].voltage_limit == None + assert m["regulator_vreg2_b"].windings[1].voltage_limit == None + + assert m["regulator_vreg2_b"].windings[0].reverse_resistance == None + assert m["regulator_vreg2_b"].windings[1].reverse_resistance == None + + # assert m["regulator_vreg2_b"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["regulator_vreg2_b"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["regulator_vreg2_b"].windings[0].phase_windings[0].phase == "B" + + assert m["regulator_vreg2_b"].windings[1].phase_windings[0].phase == "B" + + # assert m["regulator_vreg2_b"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_b"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_b"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["regulator_vreg2_b"].windings[1].phase_windings[0].compensator_x == None # 0.0s + assert m["vreg2_c"].name == "vreg2_c" assert m["vreg2_c"].feeder_name == "sourcebus_src" # assert m["vreg2_c"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["vreg2_c"].loadloss == 0.01 # loadloss or noloadloss? - assert m["vreg2_c"].phase_shift == None + assert m["vreg2_c"].phase_shift == 0 # assert m["vreg2_c"].is_substation == 0 # Not implemented for now # assert m["vreg2_c"].normhkva == None # 11000.0 # assert m["vreg2_c"].install_type == None # Not implemented for now @@ -260,7 +334,7 @@ def test_regulators(): assert m["regulator_vreg2_c"].to_element == "190-8593" assert m["regulator_vreg2_c"].pt_phase == "C" assert m["regulator_vreg2_c"].reactances == [0.1] - assert m["regulator_vreg2_c"].phase_shift == None + assert m["regulator_vreg2_c"].phase_shift == 0 # assert m["regulator_vreg2_c"].ltc == None # Not implemented for now # assert m["regulator_vreg2_c"].positions == None # [] # Not implemented for now # assert m["regulator_vreg2_c"].substation_name == None # '' # Not implemented for now @@ -268,6 +342,43 @@ def test_regulators(): # assert m["regulator_vreg2_c"].is_substation == 0 # Not implemented for now assert m["regulator_vreg2_c"].setpoint == None + assert m["regulator_vreg2_c"].windings[0].connection_type == "Y" + assert m["regulator_vreg2_c"].windings[1].connection_type == "Y" + + assert m["regulator_vreg2_c"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["regulator_vreg2_c"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["regulator_vreg2_c"].windings[0].emergency_power == None # 15000000.0 + # assert m["regulator_vreg2_c"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regulator_vreg2_c"].windings[0].resistance == None # 0.005 + # assert m["regulator_vreg2_c"].windings[1].resistance == None # 0.005 + + assert m["regulator_vreg2_c"].windings[0].voltage_type == None + assert m["regulator_vreg2_c"].windings[1].voltage_type == None + + assert m["regulator_vreg2_c"].windings[0].voltage_limit == None + assert m["regulator_vreg2_c"].windings[1].voltage_limit == None + + assert m["regulator_vreg2_c"].windings[0].reverse_resistance == None + assert m["regulator_vreg2_c"].windings[1].reverse_resistance == None + + # assert m["regulator_vreg2_c"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["regulator_vreg2_c"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["regulator_vreg2_c"].windings[0].phase_windings[0].phase == "C" + + assert m["regulator_vreg2_c"].windings[1].phase_windings[0].phase == "C" + + # assert m["regulator_vreg2_c"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_c"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_vreg2_c"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["regulator_vreg2_c"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # Regulator No. 2 from IEEE 8500 test case assert m["regxfmr_b18865"].name == "regxfmr_b18865" assert ( @@ -279,7 +390,7 @@ def test_regulators(): assert m["regxfmr_b18865"].feeder_name == "sourcebus_src" # assert m["regxfmr_b18865"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["regxfmr_b18865"].loadloss == None # 0.4 - assert m["regxfmr_b18865"].phase_shift == None + assert m["regxfmr_b18865"].phase_shift == 0 # assert m["regxfmr_b18865"].is_substation == 0 # Not implemented for now # assert m["regxfmr_b18865"].normhkva == None # 11000.0 # assert m["regxfmr_b18865"].install_type == None # Not implemented for now @@ -344,7 +455,7 @@ def test_regulators(): assert m["regulator_regxfmr_b18865_ctrl"].to_element == "b18865reg" assert m["regulator_regxfmr_b18865_ctrl"].pt_phase == "C" assert m["regulator_regxfmr_b18865_ctrl"].reactances == [0.01] - assert m["regulator_regxfmr_b18865_ctrl"].phase_shift == None + assert m["regulator_regxfmr_b18865_ctrl"].phase_shift == 0 # assert m["regulator_regxfmr_b18865_ctrl"].ltc == None # Not implemented for now # assert m["regulator_regxfmr_b18865_ctrl"].positions == None # [] # Not implemented for now # assert m["regulator_regxfmr_b18865_ctrl"].substation_name == None # '' # Not implemented for now @@ -352,6 +463,43 @@ def test_regulators(): # assert m["regulator_regxfmr_b18865_ctrl"].is_substation == 0 # Not implemented for now assert m["regulator_regxfmr_b18865_ctrl"].setpoint == None + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].connection_type == "Y" + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].connection_type == "Y" + + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].rated_power == 10000 * 10 ** 3 + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].rated_power == 10000 * 10 ** 3 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[0].emergency_power == None # 15000000.0 + # assert m["regulator_regxfmr_b18865_ctrl"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[0].resistance == None # 0.2 + # assert m["regulator_regxfmr_b18865_ctrl"].windings[1].resistance == None # 0.2 + + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].voltage_type == None + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].voltage_type == None + + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].voltage_limit == None + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].voltage_limit == None + + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].reverse_resistance == None + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].reverse_resistance == None + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[0].phase_windings[0].tap_position == None # 1.0 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[1].phase_windings[0].tap_position == None # 1.0 + + assert m["regulator_regxfmr_b18865_ctrl"].windings[0].phase_windings[0].phase == "C" + + assert m["regulator_regxfmr_b18865_ctrl"].windings[1].phase_windings[0].phase == "C" + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[0].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[1].phase_windings[0].compensator_r == None # 0.0 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[0].phase_windings[0].compensator_x == None # 0.0 + + # assert m["regulator_regxfmr_b18865_ctrl"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # Substation regulator from SMART-DS P4U region assert m["sb5_p4uhs0_4_trans_439"].name == "sb5_p4uhs0_4_trans_439" assert ( @@ -363,7 +511,7 @@ def test_regulators(): assert m["sb5_p4uhs0_4_trans_439"].feeder_name == "sourcebus_src" # assert m["sb5_p4uhs0_4_trans_439"].noload_loss == None # 0.0 #loadloss or noloadloss? # assert m["sb5_p4uhs0_4_trans_439"].loadloss == None # 0.9616652 ?? taken from XHL Value - assert m["sb5_p4uhs0_4_trans_439"].phase_shift == None + assert m["sb5_p4uhs0_4_trans_439"].phase_shift == -30 # assert m["sb5_p4uhs0_4_trans_439"].is_substation == 0 # Not implemented for now # assert m["sb5_p4uhs0_4_trans_439"].normhkva == None # 8800.0 # assert m["sb5_p4uhs0_4_trans_439"].install_type == None # Not implemented for now @@ -453,7 +601,7 @@ def test_regulators(): assert m["regulator_sb5_p4uhs0_4_reg_439"].reactances == [ pytest.approx(0.9616652224137047) ] - assert m["regulator_sb5_p4uhs0_4_reg_439"].phase_shift == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].phase_shift == -30 # assert m["regulator_sb5_p4uhs0_4_reg_439"].ltc == None # Not implemented for now # assert m["regulator_sb5_p4uhs0_4_reg_439"].positions == None # [] # Not implemented for now # assert m["regulator_sb5_p4uhs0_4_reg_439"].substation_name == None # '' # Not implemented for now @@ -461,22 +609,91 @@ def test_regulators(): # assert m["regulator_sb5_p4uhs0_4_reg_439"].is_substation == 0 # Not implemented for now assert m["regulator_sb5_p4uhs0_4_reg_439"].setpoint == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].connection_type == "D" + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].connection_type == "Y" + + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].rated_power == 8000 * 10 ** 3 + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].rated_power == 8000 * 10 ** 3 + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].emergency_power == None # 12000000.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].emergency_power == None # 12000000.0 + + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].resistance == pytest.approx( + 0.4808326112068522 + ) + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].resistance == pytest.approx( + 0.4808326112068522 + ) + + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].voltage_type == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].voltage_type == None + + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].voltage_limit == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].voltage_limit == None + + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].reverse_resistance == None + assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].reverse_resistance == None + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[0].phase == "A" + ) + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[1].phase == "B" + ) + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[2].phase == "C" + ) + + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[0].phase == "A" + ) + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[1].phase == "B" + ) + assert ( + m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[2].phase == "C" + ) + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[0].compensator_r == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[1].compensator_r == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[2].compensator_r == None # 0.0 + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[0].compensator_r == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[1].compensator_r == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[2].compensator_r == None # 0.0 + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[0].compensator_x == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[1].compensator_x == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[0].phase_windings[2].compensator_x == None # 0.0 + + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[1].compensator_x == None # 0.0 + # assert m["regulator_sb5_p4uhs0_4_reg_439"].windings[1].phase_windings[2].compensator_x == None # 0.0 + # Rural regulator from SMART-DS rural region assert m["trans_reg_creduladortension"].name == "trans_reg_creduladortension" assert ( len(m["trans_reg_creduladortension"].windings) == 2 ) # Transformer trans_reg_creduladortension should have 2 Windings assert ( - m["trans_reg_creduladortension"].windings[0].nominal_voltage == 124700 * 10 ** 3 + m["trans_reg_creduladortension"].windings[0].nominal_voltage == 12.47 * 10 ** 3 ) assert ( - m["trans_reg_creduladortension"].windings[1].nominal_voltage == 124700 * 10 ** 3 + m["trans_reg_creduladortension"].windings[1].nominal_voltage == 12.47 * 10 ** 3 ) assert m["trans_reg_creduladortension"].feeder_name == "sourcebus_src" # assert m["trans_reg_creduladortension"].noload_loss == 0.0 # 0.0 #loadloss or noloadloss? # assert m["trans_reg_creduladortension"].loadloss == None # 0.4 - assert m["trans_reg_creduladortension"].phase_shift == None + assert m["trans_reg_creduladortension"].phase_shift == 0 # assert m["trans_reg_creduladortension"].is_substation == 0 # Not implemented for now # assert m["trans_reg_creduladortension"].normhkva == None # 11000.0 # assert m["trans_reg_creduladortension"].install_type == None # Not implemented for now @@ -562,7 +779,7 @@ def test_regulators(): assert m["regulator_reg_creguladortension"].to_element == "rdt222" assert m["regulator_reg_creguladortension"].pt_phase == "A" # assert m["regulator_reg_creguladortension"].reactances == None - assert m["regulator_reg_creguladortension"].phase_shift == None + assert m["regulator_reg_creguladortension"].phase_shift == 0 # assert m["regulator_reg_creguladortension"].ltc == None # Not implemented for now # assert m["regulator_reg_creguladortension"].positions == None # [] # Not implemented for now # assert m["regulator_reg_creguladortension"].substation_name == None # '' # Not implemented for now @@ -570,6 +787,75 @@ def test_regulators(): # assert m["regulator_reg_creguladortension"].is_substation == 0 # Not implemented for now assert m["regulator_reg_creguladortension"].setpoint == None + assert m["regulator_reg_creguladortension"].windings[0].connection_type == "Y" + assert m["regulator_reg_creguladortension"].windings[1].connection_type == "Y" + + assert ( + m["regulator_reg_creguladortension"].windings[0].rated_power == 10000 * 10 ** 3 + ) + assert ( + m["regulator_reg_creguladortension"].windings[1].rated_power == 10000 * 10 ** 3 + ) + + # assert m["regulator_reg_creguladortension"].windings[0].emergency_power == None # 15000000.0 + # assert m["regulator_reg_creguladortension"].windings[1].emergency_power == None # 15000000.0 + + # assert m["regulator_reg_creguladortension"].windings[0].resistance == None # 0.2 + # assert m["regulator_reg_creguladortension"].windings[1].resistance == None # 0.2 + + assert m["regulator_reg_creguladortension"].windings[0].voltage_type == None + assert m["regulator_reg_creguladortension"].windings[1].voltage_type == None + + assert m["regulator_reg_creguladortension"].windings[0].voltage_limit == None + assert m["regulator_reg_creguladortension"].windings[1].voltage_limit == None + + assert m["regulator_reg_creguladortension"].windings[0].reverse_resistance == None + assert m["regulator_reg_creguladortension"].windings[1].reverse_resistance == None + + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert ( + m["regulator_reg_creguladortension"].windings[0].phase_windings[0].phase == "A" + ) + assert ( + m["regulator_reg_creguladortension"].windings[0].phase_windings[1].phase == "B" + ) + assert ( + m["regulator_reg_creguladortension"].windings[0].phase_windings[2].phase == "C" + ) + + assert ( + m["regulator_reg_creguladortension"].windings[1].phase_windings[0].phase == "A" + ) + assert ( + m["regulator_reg_creguladortension"].windings[1].phase_windings[1].phase == "B" + ) + assert ( + m["regulator_reg_creguladortension"].windings[1].phase_windings[2].phase == "C" + ) + + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[0].compensator_r == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[1].compensator_r == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[2].compensator_r == None # 0.0 + + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[0].compensator_r == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[1].compensator_r == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[2].compensator_r == None # 0.0 + + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[0].compensator_x == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[1].compensator_x == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[0].phase_windings[2].compensator_x == None # 0.0 + + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[0].compensator_x == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[1].compensator_x == None # 0.0 + # assert m["regulator_reg_creguladortension"].windings[1].phase_windings[2].compensator_x == None # 0.0 + # Regulator from IEEE 13 node feeder assert m["reg1"].name == "reg1" assert len(m["reg1"].windings) == 2 # Transformer reg1 should have 2 Windings @@ -579,7 +865,7 @@ def test_regulators(): assert m["reg1"].feeder_name == "sourcebus_src" # assert m["reg1"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg1"].loadloss == 0.01 - assert m["reg1"].phase_shift == None + assert m["reg1"].phase_shift == 0 # assert m["reg1"].is_substation == 0 # Not implemented for now # assert m["reg1"].normhkva == None # 1832.6 # assert m["reg1"].install_type == None # Not implemented for now @@ -645,7 +931,7 @@ def test_regulators(): assert m["regulator_reg1"].to_element == "rg60" assert m["regulator_reg1"].pt_phase == "A" assert m["regulator_reg1"].reactances == [0.01] - assert m["regulator_reg1"].phase_shift == None + assert m["regulator_reg1"].phase_shift == 0 # assert m["regulator_reg1"].ltc == None # Not implemented for now # assert m["regulator_reg1"].positions == None # [] # Not implemented for now # assert m["regulator_reg1"].substation_name == None # '' # Not implemented for now @@ -653,6 +939,44 @@ def test_regulators(): # assert m["regulator_reg1"].is_substation == 0 # Not implemented for now assert m["regulator_reg1"].setpoint == None + assert m["regulator_reg1"].windings[0].connection_type == "Y" + assert m["regulator_reg1"].windings[1].connection_type == "Y" + + assert m["regulator_reg1"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["regulator_reg1"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["regulator_reg1"].windings[0].emergency_power == None # 2499000.0 + # assert m["regulator_reg1"].windings[1].emergency_power == None # 2499000.0 + + # assert m["regulator_reg1"].windings[0].resistance == None # 0.005 + # assert m["regulator_reg1"].windings[1].resistance == None # 0.005 + + assert m["regulator_reg1"].windings[0].voltage_type == None + assert m["regulator_reg1"].windings[1].voltage_type == None + + assert m["regulator_reg1"].windings[0].voltage_limit == None + assert m["regulator_reg1"].windings[1].voltage_limit == None + + assert m["regulator_reg1"].windings[0].reverse_resistance == None + assert m["regulator_reg1"].windings[1].reverse_resistance == None + + # assert m["regulator_reg1"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["regulator_reg1"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg1"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg1"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["regulator_reg1"].windings[0].phase_windings[0].phase == "A" + + assert m["regulator_reg1"].windings[1].phase_windings[0].phase == "A" + + assert m["regulator_reg1"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg1"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg1"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg1"].windings[1].phase_windings[0].compensator_x == float(9) + assert m["reg2"].name == "reg2" assert len(m["reg2"].windings) == 2 # Transformer reg2 should have 2 Windings assert m["reg2"].windings[0].nominal_voltage == 2.4 * 10 ** 3 @@ -661,7 +985,7 @@ def test_regulators(): assert m["reg2"].feeder_name == "sourcebus_src" # assert m["reg2"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg2"].loadloss == 0.01 - assert m["reg2"].phase_shift == None + assert m["reg2"].phase_shift == 0 # assert m["reg2"].is_substation == 0 # Not implemented for now # assert m["reg2"].normhkva == None # 1832.6 # assert m["reg2"].install_type == None # Not implemented for now @@ -727,7 +1051,7 @@ def test_regulators(): assert m["regulator_reg2"].to_element == "rg60" assert m["regulator_reg2"].pt_phase == "B" assert m["regulator_reg2"].reactances == [0.01] - assert m["regulator_reg2"].phase_shift == None + assert m["regulator_reg2"].phase_shift == 0 # assert m["regulator_reg2"].ltc == None # Not implemented for now # assert m["regulator_reg2"].positions == None # [] # Not implemented for now # assert m["regulator_reg2"].substation_name == None # '' # Not implemented for now @@ -735,6 +1059,44 @@ def test_regulators(): # assert m["regulator_reg2"].is_substation == 0 # Not implemented for now assert m["regulator_reg2"].setpoint == None + assert m["regulator_reg2"].windings[0].connection_type == "Y" + assert m["regulator_reg2"].windings[1].connection_type == "Y" + + assert m["regulator_reg2"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["regulator_reg2"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["regulator_reg2"].windings[0].emergency_power == None # 2499000.0 + # assert m["regulator_reg2"].windings[1].emergency_power == None # 2499000.0 + + # assert m["regulator_reg2"].windings[0].resistance == None # 0.005 + # assert m["regulator_reg2"].windings[1].resistance == None # 0.005 + + assert m["regulator_reg2"].windings[0].voltage_type == None + assert m["regulator_reg2"].windings[1].voltage_type == None + + assert m["regulator_reg2"].windings[0].voltage_limit == None + assert m["regulator_reg2"].windings[1].voltage_limit == None + + assert m["regulator_reg2"].windings[0].reverse_resistance == None + assert m["regulator_reg2"].windings[1].reverse_resistance == None + + # assert m["regulator_reg2"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg2"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg2"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["regulator_reg2"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg2"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg2"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["regulator_reg2"].windings[0].phase_windings[0].phase == "B" + + assert m["regulator_reg2"].windings[1].phase_windings[0].phase == "B" + + assert m["regulator_reg2"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg2"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg2"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg2"].windings[1].phase_windings[0].compensator_x == float(9) + assert m["reg3"].name == "reg3" assert len(m["reg3"].windings) == 2 # Transformer reg3 should have 2 Windings assert m["reg3"].windings[0].nominal_voltage == 2.4 * 10 ** 3 @@ -743,7 +1105,7 @@ def test_regulators(): assert m["reg3"].feeder_name == "sourcebus_src" # assert m["reg3"].noload_loss == None # 0.0 #loadloss or noloadloss? assert m["reg3"].loadloss == 0.01 - assert m["reg3"].phase_shift == None + assert m["reg3"].phase_shift == 0 # assert m["reg3"].is_substation == 0 # Not implemented for now # assert m["reg3"].normhkva == None # 1832.6 # assert m["reg3"].install_type == None # Not implemented for now @@ -809,10 +1171,48 @@ def test_regulators(): assert m["regulator_reg3"].to_element == "rg60" assert m["regulator_reg3"].pt_phase == "C" assert m["regulator_reg3"].reactances == [0.01] - assert m["regulator_reg3"].phase_shift == None + assert m["regulator_reg3"].phase_shift == 0 # assert m["regulator_reg3"].ltc == None # Not implemented for now # assert m["regulator_reg3"].positions == None # [] # Not implemented for now # assert m["regulator_reg3"].substation_name == None # '' # Not implemented for now assert m["regulator_reg3"].feeder_name == "sourcebus_src" # assert m["regulator_reg3"].is_substation == 0 # Not implemented for now assert m["regulator_reg3"].setpoint == None + + assert m["regulator_reg3"].windings[0].connection_type == "Y" + assert m["regulator_reg3"].windings[1].connection_type == "Y" + + assert m["regulator_reg3"].windings[0].rated_power == 1666 * 10 ** 3 + assert m["regulator_reg3"].windings[1].rated_power == 1666 * 10 ** 3 + + # assert m["regulator_reg3"].windings[0].emergency_power == None # 2499000.0 + # assert m["regulator_reg3"].windings[1].emergency_power == None # 2499000.0 + + # assert m["regulator_reg3"].windings[0].resistance == None # 0.005 + # assert m["regulator_reg3"].windings[1].resistance == None # 0.005 + + assert m["regulator_reg3"].windings[0].voltage_type == None + assert m["regulator_reg3"].windings[1].voltage_type == None + + assert m["regulator_reg3"].windings[0].voltage_limit == None + assert m["regulator_reg3"].windings[1].voltage_limit == None + + assert m["regulator_reg3"].windings[0].reverse_resistance == None + assert m["regulator_reg3"].windings[1].reverse_resistance == None + + # assert m["regulator_reg3"].windings[0].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg3"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg3"].windings[1].phase_windings[2].tap_position == None # 1.0 + + # assert m["regulator_reg3"].windings[1].phase_windings[0].tap_position == None # 1.0 + # assert m["regulator_reg3"].windings[1].phase_windings[1].tap_position == None # 1.0 + # assert m["regulator_reg3"].windings[1].phase_windings[2].tap_position == None # 1.0 + + assert m["regulator_reg3"].windings[0].phase_windings[0].phase == "C" + + assert m["regulator_reg3"].windings[1].phase_windings[0].phase == "C" + + assert m["regulator_reg3"].windings[0].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg3"].windings[1].phase_windings[0].compensator_r == float(3) + assert m["regulator_reg3"].windings[0].phase_windings[0].compensator_x == float(9) + assert m["regulator_reg3"].windings[1].phase_windings[0].compensator_x == float(9)