def _classify_branch(from_bus, to_bus, line_id): if isinstance(from_bus, component_busdetails.BusDetails): if from_bus.base_voltage > 100: if from_bus.name[:3] == 'MF.' and to_bus.name[:3] == 'MF.': return component.Cable else: from_bus = from_bus.number to_bus = to_bus.number else: return component.Line if MonsterPssPy.busdat(from_bus, 'KV')[1] > 100.0: length = MonsterPssPy.brndat(from_bus, to_bus, line_id, 'LENGTH') charging = MonsterPssPy.brndat(from_bus, to_bus, line_id, 'CHARG') from_bus_name = MonsterPssPy.notona(from_bus) to_bus_name = MonsterPssPy.notona(to_bus) if from_bus_name[:3] == 'MF.' and to_bus_name[:3] == 'MF.': return component.Cable if length > 0.0: normed_charging = charging / length else: normed_charging = 0.0 tol = 0.005 if normed_charging > tol: return component.Cable else: return component.Line else: return component.Line
def get_msl_components(sid, bus_dict, line_dict): msl_parents = dict() msl_children = dict() flag = IncludeStatus.NotAddStepAndNotInService.value for from_bus, to_bus, identificator in MonsterPssPy.find_multisections(sid, flag=flag): try: MonsterPssPy.inimsl(from_bus, to_bus, identificator) msl_lines = [] line = component.Line( from_bus=bus_dict[from_bus].from_bus, to_bus=bus_dict[to_bus].from_bus, identificator=identificator.strip(), length=0, rate_a=-1, msl_lines=msl_lines ) msl_parents[line.get_sorted_short_tuple()] = line while True: try: ibus, jbus, ickt = MonsterPssPy.nxtmsl() from_bus = bus_dict[ibus].from_bus to_bus = bus_dict[jbus].from_bus component_func = _classify_branch(from_bus, to_bus, ickt) elem_rate_a = MonsterPssPy.brndat( ibus=ibus, jbus=jbus, ickt=ickt, string=RATE_NAME) elem_length = MonsterPssPy.brndat( ibus=ibus, jbus=jbus, ickt=ickt, string='LENGTH') rx = MonsterPssPy.brndt2( ibus=ibus, jbus=jbus, ickt=ickt, string='RX') line = component_func( from_bus=from_bus, to_bus=to_bus, identificator=ickt.strip(), length=elem_length, rate_a=elem_rate_a, rx=rx, msl_component=True ) msl_lines.append(line) msl_children[line.get_sorted_short_tuple()] = line except PsseNxtMslException: break except PsseIniMslException: pass return msl_parents, msl_children
def set_rate(self, file_path): self._rate[file_path] = MonsterPssPy.brndat(*self.get_busnumbers(True), string=RATE_NAME)