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 d8e1f919..95eb4187 100644 --- a/ditto/readers/gridlabd/read.py +++ b/ditto/readers/gridlabd/read.py @@ -524,12 +524,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" @@ -653,7 +653,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"] @@ -677,6 +677,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": @@ -915,7 +925,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 @@ -953,7 +963,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. @@ -1346,8 +1356,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) @@ -2185,12 +2327,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 3c7119e9..33661fb1 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -1235,6 +1235,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 @@ -1253,8 +1254,6 @@ def parse_lines(self, model): ) ) pass - else: - this_line_wireData = None # If we have valid WireData if this_line_wireData is not None: @@ -1561,6 +1560,34 @@ 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)) @@ -1712,6 +1739,33 @@ def parse_regulators(self, model): # Total number of windings N_windings = int(trans["windings"]) + 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 trans["conns"][0].lower() == "delta" + and trans["conns"][1].lower() == "delta" + ): + api_regulator.phase_shift = 0 + + 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 trans["conns"][0].lower() == "delta" + and trans["conns"][1].lower() == "wye" + ): + api_regulator.phase_shift = -30 # Initialize the list of Windings api_regulator.windings = [Winding(model) for _ in range(N_windings)] @@ -1725,6 +1779,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): @@ -1799,6 +1860,10 @@ 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"]) # compensator_r if "R" in data: diff --git a/ditto/writers/ephasor/write.py b/ditto/writers/ephasor/write.py index f300c487..e410e726 100644 --- a/ditto/writers/ephasor/write.py +++ b/ditto/writers/ephasor/write.py @@ -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,6 +731,7 @@ 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: self.logger.error( @@ -922,15 +925,23 @@ def bus(self): else: obj_dict["Voltage (V)"].append(node.nominal_voltage) obj_dict["Type"].append("PV") #No generators so all nodes are PV buses - 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: + + 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 = {} 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"], + } +} 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 00000000..6f9110b8 Binary files /dev/null and b/docs/OpenDSS/Default_values.xlsx differ 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/Capacitors/test_capacitor_connectivity.dss b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.dss index e564a398..c1e99456 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 @@ -14,6 +14,40 @@ 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 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 +~ type=volt ON=120.5 OFF=125 PTphase=2 PTratio=60 + +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 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 +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 new file mode 100644 index 00000000..5df1e04f --- /dev/null +++ b/tests/readers/opendss/Capacitors/test_capacitor_connectivity.py @@ -0,0 +1,655 @@ +# -*- 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() + + # 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 + 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 # Not implemented for now + # assert m["cap1"].reactance is None # 0.0 + # assert m["cap1"].reactance0 is None # Not implemented for now + assert m["cap1"].susceptance is None + # assert m["cap1"].susceptance0 is None # Not implemented for now + assert m["cap1"].conductance 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"].measuring_element is None + # assert m["cap1"].substation_name == '' # Not implemented for now + assert m["cap1"].feeder_name == "sourcebus_src" + # 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 [ + 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] + + # 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 + 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 # Not implemented for now + # assert m["b4909-1"].reactance is None # 0.0 + # 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 # Not implemented for now + assert m["b4909-1"].conductance 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 == '' # Not implemented for now + assert m["b4909-1"].feeder_name == "sourcebus_src" + # 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"] + ) + 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] + + 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 + # 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 + 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 # Not implemented for now + assert m["oh_b4904"].faultrate == 0.1 + # 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 # 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" + 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) + assert w.emergency_ampacity == float(871) + 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 # 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 # 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 + ) # 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"].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 + 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 == "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] + + 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 + # 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" + 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 # Not implemented for now + assert m["oh_b18944"].faultrate == 0.1 + # 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 # 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" + 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) + 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 # 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 # 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 + + 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"].name == "capbank0a" + 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 # Not implemented for now + # assert m["capbank0a"].reactance is None # 0.0 + # assert m["capbank0a"].reactance0 is None # Not implemented for now + assert m["capbank0a"].susceptance is None + # assert m["capbank0a"].susceptance0 is None # Not implemented for now + assert m["capbank0a"].conductance 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 # '' # Not implemented for now + assert m["capbank0a"].feeder_name == "sourcebus_src" + # 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 + 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"].name == "capbank0b" + 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 # Not implemented for now + # assert m["capbank0b"].reactance is None # 0.0 + # assert m["capbank0b"].reactance0 is None # Not implemented for now + assert m["capbank0b"].susceptance is None + # assert m["capbank0b"].susceptance0 is None # Not implemented for now + assert m["capbank0b"].conductance 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 == '' # Not implemented for now + assert m["capbank0b"].feeder_name == "sourcebus_src" + # 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 + 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"].name == "capbank0c" + 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 # Not implemented for now + # assert m["capbank0c"].reactance is None # 0.0 + # assert m["capbank0c"].reactance0 is None # Not implemented for now + assert m["capbank0c"].susceptance is None + # assert m["capbank0c"].susceptance0 is None # Not implemented for now + assert m["capbank0c"].conductance 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 == '' + assert m["capbank0c"].feeder_name == "sourcebus_src" + # 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 + 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"].name == "capbank3" + 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 # Not implemented for now + # assert m["capbank3"].reactance is None # 0.0 + # assert m["capbank3"].reactance0 is None # Not implemented for now + assert m["capbank3"].susceptance is None + # assert m["capbank3"].susceptance0 is None # Not implemented for now + assert m["capbank3"].conductance 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 == '' # Not implemented for now + assert m["capbank3"].feeder_name == "sourcebus_src" + # 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"] + ) + 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"].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 # Not implemented for now + # assert m["capbank3-1"].reactance is None # 0.0 + # 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 # Not implemented for now + assert m["capbank3-1"].conductance 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 == '' # Not implemented for now + assert m["capbank3-1"].feeder_name == "sourcebus_src" + # 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"] + ) + 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/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..8fa216b8 --- /dev/null +++ b/tests/readers/opendss/Concentric/test_concentric.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- + +""" +test_concentric.py +---------------------------------- + +Tests for checking the concenctric properties +""" +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_concentric(): + from ditto.store import Store + from ditto.readers.opendss.read import Reader + + 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 new file mode 100644 index 00000000..84866d90 --- /dev/null +++ b/tests/readers/opendss/Lines/test_concentricneutral.dss @@ -0,0 +1,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 new file mode 100644 index 00000000..4572b21c --- /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 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 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 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 EmergAmps=4000 +New Fuse.Fuse_4 monitoredobj=Line.line4 enabled=True + +Set Voltagebases=[12.47] +Calcvoltagebases +Solve 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 new file mode 100644 index 00000000..7afcb92d --- /dev/null +++ b/tests/readers/opendss/Lines/test_line_connectivity.py @@ -0,0 +1,344 @@ +# -*- coding: utf-8 -*- + +""" +test_line_connectivity.py +---------------------------------- + +Tests for checking the line connectivity. +""" +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_line_connectivity(): + 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_line_connectivity.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) + + # 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"]) + 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 == 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"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line1"].is_recloser is None + assert m["line1"].is_breaker is None + assert m["line1"].nameclass == "" + + 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_open 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 + + # 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"]) + 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"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line2"].is_recloser is None + assert m["line2"].is_breaker is None + assert m["line2"].nameclass == "" + + 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_open 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 + + # 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", "B"]) + 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"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line3"].is_recloser is None + assert m["line3"].is_breaker is None + assert m["line3"].nameclass == "" + + 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_open 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 + + # 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"]) + 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"].faultrate == json_data["OpenDSS"]["faultrate"] + assert m["line4"].impedance_matrix == [[(0.058 + 0.1206j)]] + assert m["line4"].capacitance_matrix == [[(3.4 + 0j)]] + assert m["line4"].feeder_name == "sourcebus_src" + assert m["line4"].is_recloser is None + assert m["line4"].is_breaker is None + assert m["line4"].nameclass == "" + + 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_open 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 + + # 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", "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(1500 * 0.3048) # units = ft + assert m["line5"].from_element == "bus1" + assert m["line5"].to_element == "bus5" + assert m["line5"].is_fuse is None + assert m["line5"].is_switch is None + assert m["line5"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line5"].is_recloser is None + assert m["line5"].is_breaker is None + assert m["line5"].nameclass == "" + + 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_open 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 + + # 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(["B", "C"]) + 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"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line6"].is_recloser is None + assert m["line6"].is_breaker is None + assert m["line6"].nameclass == "" + + 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_open 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 + + # Line7 should raise some error in DiTTo since it only supports 1, 2, 3, and 0. + assert len(m["line7"].wires) == 2 + # Phases of the different wires + 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" + 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"].faultrate == json_data["OpenDSS"]["faultrate"] + 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"].feeder_name == "sourcebus_src" + assert m["line7"].is_recloser is None + assert m["line7"].is_breaker is None + assert m["line7"].nameclass == "" + + 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_open 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 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 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..00d40d93 --- /dev/null +++ b/tests/readers/opendss/Lines/test_line_length.py @@ -0,0 +1,655 @@ +# -*- 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 +import json + +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 + from ditto.readers.json.read import Reader as json_reader + + m = Store() + r = Reader(master_file=os.path.join(current_directory, "test_line_length.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) + + # 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_linecodes.dss b/tests/readers/opendss/Lines/test_linecodes.dss new file mode 100644 index 00000000..aa3c9f04 --- /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.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] +Calcvoltagebases +Solve 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..4cf37436 100644 --- a/tests/readers/opendss/Lines/test_linegeometries.dss +++ b/tests/readers/opendss/Lines/test_linegeometries.dss @@ -2,20 +2,33 @@ Clear New Circuit.test_circuit -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 +Redirect test_wiredata.dss +Redirect test_concentricneutral.dss +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.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= geometry_2 +~ 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..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) @@ -68,3 +68,29 @@ 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 == "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_nstrand == 13 diff --git a/tests/readers/opendss/Lines/test_switches.dss b/tests/readers/opendss/Lines/test_switches.dss new file mode 100644 index 00000000..78edf325 --- /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 EmergAmps=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 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 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 Units=km Length=0.001 bus1=node1.1 bus2=node6.1 switch=y enabled=y phases=1 Normamps=3000 EmergAmps=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 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 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 +Solve 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 new file mode 100644 index 00000000..0b520096 --- /dev/null +++ b/tests/readers/opendss/Lines/test_wiredata.dss @@ -0,0 +1,3 @@ +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.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/Loads/test_loads.py b/tests/readers/opendss/Loads/test_loads.py new file mode 100644 index 00000000..60be1e5f --- /dev/null +++ b/tests/readers/opendss/Loads/test_loads.py @@ -0,0 +1,132 @@ +# -*- 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_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 # Not implemented for now + assert m["load_zipv"].feeder_name == "src_src" + + # 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" + 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 + # 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 + + +""" + # 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/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 new file mode 100644 index 00000000..c5e414df --- /dev/null +++ b/tests/readers/opendss/Nodes/test_nodes.dss @@ -0,0 +1,17 @@ +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 new file mode 100644 index 00000000..5522a292 --- /dev/null +++ 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_nodes(): + 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 new file mode 100644 index 00000000..5b400087 --- /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 phases=3 + + diff --git a/tests/readers/opendss/Powersource/test_powersource.py b/tests/readers/opendss/Powersource/test_powersource.py new file mode 100644 index 00000000..b7db3263 --- /dev/null +++ b/tests/readers/opendss/Powersource/test_powersource.py @@ -0,0 +1,51 @@ +# -*- 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"].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 + # 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 # To be deprecated + assert m["Vsource.source"].connecting_element == "st_mat" + + # 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 new file mode 100644 index 00000000..7b2fe7bd --- /dev/null +++ b/tests/readers/opendss/Regulators/test_regulators.dss @@ -0,0 +1,49 @@ +Clear + +New circuit.test_regulators basekv=115 pu=1.01 bus1=sourcebus + +! 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 +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 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 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.6 vlimit=12.6 CTPrim=0.2 TapNum=2 + + +! 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 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 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 +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 new file mode 100644 index 00000000..471c918f --- /dev/null +++ b/tests/readers/opendss/Regulators/test_regulators.py @@ -0,0 +1,1218 @@ +# -*- 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 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 + + 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 == 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 + 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 # [] # Not implemented for now + assert m["vreg2_a"].is_center_tap == 0 + # 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" + + 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"].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 + # 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 == 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 + assert m["regulator_vreg2_a"].feeder_name == "sourcebus_src" + # 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 == 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 + 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 # [] # Not implemented for now + assert m["vreg2_b"].is_center_tap == 0 + # 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" + + 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"].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 + # 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 == 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 + assert m["regulator_vreg2_b"].feeder_name == "sourcebus_src" + # 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 == 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 + 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 # [] # Not implemented for now + assert m["vreg2_c"].is_center_tap == 0 + # 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" + + 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"].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 + # 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 == 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 + assert m["regulator_vreg2_c"].feeder_name == "sourcebus_src" + # 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 ( + 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 == 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 + 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 # [] # Not implemented for now + assert m["regxfmr_b18865"].is_center_tap == 0 + # 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" + + 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"].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 + 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 == 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 + assert m["regulator_regxfmr_b18865_ctrl"].feeder_name == "sourcebus_src" + # 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 ( + 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 == -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 + 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 # [] # 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 # '' # 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" + + 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"].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 + # 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 == -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 + assert m["regulator_sb5_p4uhs0_4_reg_439"].feeder_name == "sourcebus_src" + # 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 == 12.47 * 10 ** 3 + ) + assert ( + 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 == 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 + 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 # [] # Not implemented for now + assert m["trans_reg_creduladortension"].is_center_tap == 0 + # 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" + + 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"].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 + # 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 == 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 + assert m["regulator_reg_creguladortension"].feeder_name == "sourcebus_src" + # 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 + 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 == 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 + assert m["reg1"].from_element == "650" + assert m["reg1"].to_element == "rg60" + assert m["reg1"].reactances == [0.01] + # assert m["reg1"].positions == None # [] # Not implemented for now + assert m["reg1"].is_center_tap == 0 + # 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" + + 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"].name == "regulator_reg1" + 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 == 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 + assert m["regulator_reg1"].feeder_name == "sourcebus_src" + # 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 + 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 == 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 + assert m["reg2"].from_element == "650" + assert m["reg2"].to_element == "rg60" + assert m["reg2"].reactances == [0.01] + # assert m["reg2"].positions == None # [] # Not implemented for now + assert m["reg2"].is_center_tap == 0 + # 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" + + 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"].name == "regulator_reg2" + 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 == 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 + assert m["regulator_reg2"].feeder_name == "sourcebus_src" + # 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 + 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 == 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 + assert m["reg3"].from_element == "650" + assert m["reg3"].to_element == "rg60" + assert m["reg3"].reactances == [0.01] + # assert m["reg3"].positions == None # [] # Not implemented for now + assert m["reg3"].is_center_tap == 0 + # 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" + + 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"].name == "regulator_reg3" + 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 == 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) diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.dss b/tests/readers/opendss/Transformers/test_transformer_kv.dss index d0a70fbc..3e43cb15 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.dss +++ b/tests/readers/opendss/Transformers/test_transformer_kv.dss @@ -2,16 +2,80 @@ 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 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 + +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 + +! 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_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_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 + -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 diff --git a/tests/readers/opendss/Transformers/test_transformer_kv.py b/tests/readers/opendss/Transformers/test_transformer_kv.py index f1c1918d..daf04b29 100644 --- a/tests/readers/opendss/Transformers/test_transformer_kv.py +++ b/tests/readers/opendss/Transformers/test_transformer_kv.py @@ -25,20 +25,1313 @@ def test_transformer_kv(): 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 + assert m["substation"].feeder_name == "sourcebus_src" + # 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 # Not implemented for now + # assert m["substation"].normhkva == None # 5500.0 + # 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 # [] # Not implemented for now + assert m["substation"].is_center_tap == 0 + # 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" + + 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 # 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 # Not implemented for now + # assert m["reg1"].normhkva == None # 1832.6 + # 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 # [] # Not implemented for now + assert m["reg1"].is_center_tap == 0 + # 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 + + 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 # 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 # Not implemented for now + # assert m["xfm1"].normhkva == None # 550.0 + # 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 # [] # Not implemented for now + assert m["xfm1"].is_center_tap == 0 + # 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" + + 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 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 + + 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 # Not implemented for now + # assert m["t1"].normhkva == None # 6600.0 + # 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 # [] # Not implemented for now + assert m["t1"].is_center_tap == 0 + # 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" + + 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 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 + 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 # 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 + 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 # [] # 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 # '' # 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" + + 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 m["tr(r:p4udt27-p4udt27lv)"].name == "tr(r:p4udt27-p4udt27lv)" + 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 # Not implemented for now + # assert m["tr(r:p4udt27-p4udt27lv)"].normhkva == 82.5 + # 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 # [] # Not implemented for now + assert m["tr(r:p4udt27-p4udt27lv)"].is_center_tap == 0 + # 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" + + 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 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 + 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 # Not implemented for now + # assert m["tr(r:p4udt27-p4udt27lv)_1"].normhkva == 82.5 + # 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 # [] # 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 # '' # 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" + + 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 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 + 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 # Not implemented for now + # assert m["tr(r:p4udt27-p4udt27lv)_2"].normhkva == 82.5 + # 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 # [] # 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 # '' # 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" + + 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 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 + 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 # Not implemented for now + # assert m["tr(r:p4udt27-p4udt27lv)_3"].normhkva == 82.5 + # 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 # [] # 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 # '' # 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" + + 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 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 + 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 # Not implemented for now + assert m["tr(r:p4udt25-p4udt25lv)"].normhkva == 27.5 + # 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 # [] # Not implemented for now + assert m["tr(r:p4udt25-p4udt25lv)"].is_center_tap == 1 + # 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" + 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 m["t21396254a"].name == "t21396254a" + 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 # Not implemented for now + # assert m["t21396254a"].normhkva == None # 16.5 + # 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 # [] # Not implemented for now + assert m["t21396254a"].is_center_tap == 1 + # 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 + # 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 m["feeder_rega"].name == "feeder_rega" + 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 # Not implemented for now + # assert m["feeder_rega"].normhkva == None # 30250.0 + # 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 # [] # Not implemented for now + assert m["feeder_rega"].is_center_tap == 0 + # 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 + + 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 m["b13659-1c"].name == "b13659-1c" + 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 # Not implemented for now + assert m["b13659-1c"].normhkva == 15 + # 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 # [] # Not implemented for now + assert m["b13659-1c"].is_center_tap == 0 + # 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" + + 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 + + # 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 + 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 # Not implemented for now + assert m["b4551-1a"].normhkva == 15 + # 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 # [] # Not implemented for now + assert m["b4551-1a"].is_center_tap == 0 + # 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 + + 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 m["5865228330a-1abc"].name == "5865228330a-1abc" + 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 # Not implemented for now + assert m["5865228330a-1abc"].normhkva == 2000.01 + # 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 # [] # Not implemented for now + assert m["5865228330a-1abc"].is_center_tap == 0 + # 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 + + 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 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 + + 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 # Not implemented for now + # assert m["t1_1"].normhkva == None # 6600.0 + # 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 # [] # Not implemented for now + assert m["t1_1"].is_center_tap == 0 + # 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" + + 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 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 + + 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 # Not implemented for now + # assert m["t1_2"].normhkva == None # 6600.0 + # 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 # [] # Not implemented for now + assert m["t1_2"].is_center_tap == 0 + # 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" + + 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 - # TODO: Three windings, center-taps and so on... + assert m["t1_2"].windings[1].phase_windings[0].compensator_x == None diff --git a/tests/readers/opendss/read.md b/tests/readers/opendss/read.md new file mode 100644 index 00000000..a9bc3f56 --- /dev/null +++ b/tests/readers/opendss/read.md @@ -0,0 +1,245 @@ +# To see whether an attribute is tested or not + +## Line +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| nominal_voltage | yes | +| line_type | yes | +| length | yes | +| from_element | yes | +| to_element | yes | +| is_fuse | yes | +| is_switch | yes | +| is_banked | no | # Not now +| 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 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 +| is_network_protector| no | # Not now + + +## Wire +| Attribute | Tested | +| :------------------:|:-------:| +| phase | yes | +| nameclass | yes | +| X | yes | +| Y | yes | +| diameter | yes | +| gmr | yes | +| ampacity | yes | +| emergency_ampacity | yes | +| resistance | yes | +| insulation_thickness| no | # Needs to be implemented +| is_fuse | no | # needs to be deprecated +| is_switch | no | # needs to be deprecated +| 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_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 | +| :------------------:|:-------:| +| name | yes | +| nominal_voltage | yes | +| connection_type | yes | +| delay | yes | +| mode | yes | +| 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 | # Create issue +| pt_phase | yes | +| 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 | # Not implemented + +## Phase Capacitor +| Attribute | Tested | +| :------------------:|:-------:| +| phase | yes | +| 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 | yes | +| 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 | # 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 | # Needs to be implemented , raise issue +| nominal_voltage | yes | +| voltage_limit | no | # Tarek to create a test case with a voltage regulator included, raise issue +| resistance | yes | +| reverse_resistance | no | # Needs to be implemented , raise issue +| phase_windings | yes | +| rated_power | yes | +| emergency_power | yes | + + +## Phase Winding +| Attribute | Tested | +| :------------------:|:-------:| +| tap_position | no | # Tarek looks into this +| phase | yes | +| compensator_r | yes | +| compensator_x | yes | + +## Regulator +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| delay | yes | +| highstep | yes | +| lowstep | no | # needs to be implemented ( equal to highstep), raise an issue +| pt_ratio | yes | +| 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 | # Tarek to create a test case with a voltage regulator included, raise issue +| from_element | yes | +| to_element | yes | +|connected_transformer| yes | +| pt_phase | yes | +| reactances | yes | +| 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 | #Needs to be implemented, Raise an issue, read it from vreg +| is_substation | no |# Not needed + +## Load +| Attribute | Tested | +| :------------------:|:-------:| +| name | yes | +| connection_type | no | # Tarek to create an example +| nominal_voltage | yes | +| vmin | yes | +| vmax | yes | +| phase_loads | yes | +| positions | no | # Not now +| timeseries | no | # Test later +| connecting_element | yes | +| 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 | # 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 | yes | +| p | yes | +| q | yes | +| model | yes | +| use_zip | yes | +| drop | no | # Not tested +| ppercentcurrent | yes | +| qpercentcurrent | yes | +| ppercentpower | yes | +| qpercentpower | yes | +| ppercentimpedance | yes | +| qpercentimpedance | yes | + +## PowerSource +| Attribute | Tested | +| :------------------:|:-------:| +| 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 | 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