def create_device(self, model, node1, node2, Devices): device = Line(model) device.name = node2.replace("node_", "") device.from_element = node1 device.to_element = node2 device.is_fuse = True device.is_switch = False device.is_banked = False device.is_breaker = False device.is_recloser = False device.is_substation = False device.is_sectionalizer = False device.length = 1 # device.feeder_name = ( "" if not isinstance(self.nxGraph[node1][node2]["feeder"], str) else self.nxGraph[node1][node2]["feeder"]) device.substation_name = ( "" if not isinstance(self.nxGraph[node1][node2]["substation"], str) else self.nxGraph[node1][node2]["substation"]) phases = self.nxGraph[node1][node2]["phases"] phase_list = self.phase_2_index[phases] for phase, phase_index in zip(phases, phase_list): device_type = self.nxGraph[node1][node2]["equipment"][phase_index] device_data = Devices[Devices["Equipment Identifier"] == device_type] phase_device = Wire(model) phase_device.nameclass = device_type.replace(" ", "_") phase_device.phase = phase phase_device.is_open = bool( self.nxGraph[node1][node2]["isClosed"][phase_index]) # TODO: Fix enabled property for device phase_device.is_switch = True phase_device.is_fuse = False phase_device.is_recloser = False phase_device.is_breaker = False phase_device.ampacity = float( device_data["Current Rating"].iloc[0]) phase_device.fuse_limit = float( device_data["Max Asymmetrical Fault"].iloc[0]) device.wires.append(phase_device) for node_name in [node1, node2]: if "x" in self.nxGraph.node[node_name]: node_pos = Position(model) node_pos.long = float(self.nxGraph.node[node_name]["x"]) node_pos.lat = float(self.nxGraph.node[node_name]["y"]) device.positions.append(node_pos)
def create_device(self, model, node1, node2, Devices): device = Line(model) device.name = node2.replace('node_', '') device.from_element = node1 device.to_element = node2 device.is_fuse = True device.is_switch = False device.is_banked = False device.is_breaker = False device.is_recloser = False device.is_substation = False device.is_sectionalizer = False device.length = 1 # device.feeder_name = '' if not isinstance(self.nxGraph[node1][node2]['feeder'], str) else \ self.nxGraph[node1][node2]['feeder'] device.substation_name = '' if not isinstance(self.nxGraph[node1][node2]['substation'], str) else \ self.nxGraph[node1][node2]['substation'] phases = self.nxGraph[node1][node2]['phases'] phase_list = self.phase_2_index[phases] for phase, phase_index in zip(phases, phase_list): device_type = self.nxGraph[node1][node2]['equipment'][phase_index] device_data = Devices[Devices['Equipment Identifier'] == device_type] phase_device = Wire(model) phase_device.nameclass = device_type.replace(' ', '_') phase_device.phase = phase phase_device.is_open = bool( self.nxGraph[node1][node2]['isClosed'][phase_index]) # TODO: Fix enabled property for device phase_device.is_switch = True phase_device.is_fuse = False phase_device.is_recloser = False phase_device.is_breaker = False phase_device.ampacity = float( device_data['Current Rating'].iloc[0]) phase_device.fuse_limit = float( device_data['Max Asymmetrical Fault'].iloc[0]) device.wires.append(phase_device) for node_name in [node1, node2]: if 'x' in self.nxGraph.node[node_name]: node_pos = Position(model) node_pos.long = float(self.nxGraph.node[node_name]['x']) node_pos.lat = float(self.nxGraph.node[node_name]['y']) device.positions.append(node_pos)
def create_switch(self, model, node1, node2): switch = Line(model) switch.name = node2.replace("node_", "") switch.from_element = node1 switch.to_element = node2 switch.is_fuse = False switch.is_switch = True switch.is_banked = False switch.is_breaker = False switch.is_recloser = False switch.is_substation = False switch.is_sectionalizer = False switch.length = 1 # switch.feeder_name = ("" if isinstance( self.nxGraph[node1][node2]["feeder"], float) else self.nxGraph[node1][node2]["feeder"]) switch.substation_name = ("" if isinstance( self.nxGraph[node1][node2]["substation"], float) else self.nxGraph[node1][node2]["substation"]) phases = self.nxGraph[node1][node2]["phases"] phase_list = self.phase_2_index[phases] for phase, phase_index in zip(phases, phase_list): phase_sw = Wire(model) phase_sw.phase = phase phase_sw.is_open = (True if self.nxGraph[node1][node2]["state"] == "O" else False) # TODO: Fix enabled property for switch phase_sw.is_switch = True phase_sw.is_fuse = False phase_sw.is_recloser = False phase_sw.is_breaker = False switch.wires.append(phase_sw) for node_name in [node1, node2]: if "x" in self.nxGraph.node[node_name]: node_pos = Position(model) node_pos.long = float(self.nxGraph.node[node_name]["x"]) node_pos.lat = float(self.nxGraph.node[node_name]["y"]) switch.positions.append(node_pos)
def create_switch(self, model, node1, node2): switch = Line(model) switch.name = node2.replace('node_', '') switch.from_element = node1 switch.to_element = node2 switch.is_fuse = False switch.is_switch = True switch.is_banked = False switch.is_breaker = False switch.is_recloser = False switch.is_substation = False switch.is_sectionalizer = False switch.length = 1 # switch.feeder_name = '' if isinstance(self.nxGraph[node1][node2]['feeder'], float) else \ self.nxGraph[node1][node2]['feeder'] switch.substation_name = '' if isinstance(self.nxGraph[node1][node2]['substation'], float) else \ self.nxGraph[node1][node2]['substation'] phases = self.nxGraph[node1][node2]['phases'] phase_list = self.phase_2_index[phases] for phase, phase_index in zip(phases, phase_list): phase_sw = Wire(model) phase_sw.phase = phase phase_sw.is_open = True if self.nxGraph[node1][node2][ 'state'] == 'O' else False #TODO: Fix enabled property for switch phase_sw.is_switch = True phase_sw.is_fuse = False phase_sw.is_recloser = False phase_sw.is_breaker = False switch.wires.append(phase_sw) for node_name in [node1, node2]: if 'x' in self.nxGraph.node[node_name]: node_pos = Position(model) node_pos.long = float(self.nxGraph.node[node_name]['x']) node_pos.lat = float(self.nxGraph.node[node_name]['y']) switch.positions.append(node_pos)