コード例 #1
0
    def report_different_voltage_levels_connected(self):
        from pandapower.toolbox import get_connected_buses_at_element

        if "different_voltage_levels_connected" in self.diag_results:

            # message header
            if self.compact_report:
                logger.warning("different_voltage_levels_connected:")

            else:
                logger.warning(
                    "Checking for connections of different voltage levels...")
            logger.warning("")

            # message body
            diag_result = self.diag_results[
                "different_voltage_levels_connected"]
            element_counter = 0
            for key in diag_result:
                element_counter += len(diag_result[key])
                if key == "lines":
                    element_type = "line"
                elif key == "switches":
                    element_type = "switch"
                if self.compact_report:
                    logger.warning("%s:" % (key))
                for element in diag_result[key]:
                    buses = list(
                        get_connected_buses_at_element(self.net, element,
                                                       key[0]))
                    if self.compact_report:
                        logger.warning("%s %s: buses %s" %
                                       (element_type, element, buses))
                    else:
                        logger.warning(
                            "%s %s connects bus %s: %s (vn_kv = %s) "
                            "and bus %s: %s (vn_kv = %s)" %
                            (element_type, element, buses[0],
                             self.net.bus.name.at[buses[0]],
                             self.net.bus.vn_kv.at[buses[0]], buses[1],
                             self.net.bus.name.at[buses[1]],
                             self.net.bus.vn_kv.at[buses[1]]))
                        # message summary
            if not self.compact_report:
                logger.warning("")
                logger.warning(
                    "SUMMARY: %s element(s) that connect different voltage "
                    "levels found." % (element_counter))
        elif "different_voltage_levels_connected" in self.diag_errors:
            logger.warning(
                "Check for connection of different voltage levels failed due to the following error:"
            )
            logger.warning(
                self.diag_errors["different_voltage_levels_connected"])
        else:
            logger.info(
                "PASSED: No connection of different voltage levels found")
コード例 #2
0
    def report_different_voltage_levels_connected(self):

        if "different_voltage_levels_connected" in self.diag_results:

            # message header
            if self.compact_report:
                logger.warning("different_voltage_levels_connected:")

            else:
                logger.warning(
                    "Checking for connections of different voltage levels...")
            logger.warning("")

            # message body
            diag_result = self.diag_results[
                "different_voltage_levels_connected"]
            if diag_result == "check skipped":
                logger.warning(
                    "check skipped due to possible bus index errors (see bus index check)"
                )
            else:
                element_counter = 0
                for key in diag_result:
                    element_counter += len(diag_result[key])
                    if self.compact_report:
                        logger.warning("%s:" % (key))
                    for element in diag_result[key]:
                        if key == "lines":
                            element_type = "line"
                        elif key == "switches":
                            element_type = "switch"
                        buses = list(
                            get_connected_buses_at_element(
                                self.net, element, key[0]))
                        if self.compact_report:
                            logger.warning("%s %s: buses %s" %
                                           (element_type, element, buses))
                        else:
                            logger.warning(
                                "%s %s connects bus %s: %s (vn_kv = %s) "
                                "and bus %s: %s (vn_kv = %s)" %
                                (element_type, element, buses[0],
                                 self.net.bus.name.at[buses[0]],
                                 self.net.bus.vn_kv.at[buses[0]], buses[1],
                                 self.net.bus.name.at[buses[1]],
                                 self.net.bus.vn_kv.at[buses[1]]))
                            # message summary
                if not self.compact_report:
                    logger.warning("")
                    logger.warning(
                        "SUMMARY: %s element(s) that connect different voltage "
                        "levels found." % (element_counter))
        else:
            logger.info("PASSED: No problematic switches found")