except ImportError: UnsupportedPythonError = Exception try: from julia import Main julia_installed = True except (ImportError, RuntimeError, UnsupportedPythonError) as e: julia_installed = False print(e) try: import pandaplan.core.pplog as logging except ImportError: import logging logger = logging.getLogger(__name__) # test data from :https://github.com/lanl-ansi/PowerModels.jl/blob/master/test/data/matpower/case5_clm.m def case5_pm_matfile_I(): mpc = { "branch": array([ [ 1, 2, 0.00281, 0.0281, 0.00712, 400.0, 0.0, 0.0, 0.0, 0.0, 1, -30.0, 30.0 ], [ 1, 4, 0.00304, 0.0304, 0.00658, 426, 0.0, 0.0, 0.0, 0.0, 1, -30.0, 30.0 ],
# -*- coding: utf-8 -*- # Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. from pandapower.timeseries.data_source import DataSource try: import pandaplan.core.pplog as pplog except ImportError: import logging as pplog logger = pplog.getLogger(__name__) class DFData(DataSource): """ Hold a pandas.DataFrame as the data source, that uses index column as time step. Take care that the data is numeric and all the time steps are present. Please note: The columns should be integers for scalar accessing! INPUT: **df** - A pandas DataFrame which holds the time series data OPTIONAL: **multi** (bool, False) - If True casts columns and indexes to integers. This might be necessary if you read your data from csv. """
import argparse import os from multiprocessing import cpu_count import pytest import pandapower as pp try: import pandaplan.core.pplog as logging except ImportError: import logging test_dir = os.path.abspath(os.path.join(pp.pp_dir, "test")) logger = logging.getLogger() def remove_logger(): for handler in logger.handlers: logger.removeHandler(handler) logger.setLevel(logging.CRITICAL) def _get_cpus(): # returns of a string of all available CPUs - 1 or 1 if you only have one CPU return str(cpu_count() - 1) if cpu_count() > 1 else str(1) def run_all_tests(parallel=False, n_cpu=None): """ function executing all tests
import os import tkinter as tk from pandapower.auxiliary import ADict try: import pandaplan.core.pplog as logging except ImportError: import logging logger = logging.getLogger("PowerFactory Converter") def cancel(input_panel): logger.debug('received a cancel request from the user') input_panel.destroy() logger.debug('destroyed input panel, will attempt exit()') for h in logger.handlers: logger.removeHandler(h) exit() def calc_test(app, **kwargs): logger.info('TESTING') def browse_dst_test(input_panel, entry_path_dst): logger.info('BROWSE DESTINATION') entry_path_dst.delete(0, tk.END) entry_path_dst.insert(tk.END, 'HELLO') def conf_var_graphics(app, opt_grf, var_graphics):
import pandapower.control as ct import pandapower.networks as networks import pandapower as pp from pandapower.control.run_control import get_controller_order from pandapower.control.basic_controller import Controller from pandapower.control.controller.trafo_control import TrafoController from pandapower.control.controller.trafo.ContinuousTapControl import ContinuousTapControl from pandapower.timeseries.output_writer import OutputWriter from pandapower.timeseries.run_time_series import run_timeseries try: import pandaplan.core.pplog as pplog except: import logging as pplog logger = pplog.getLogger(__name__) ctrl_logger = pplog.getLogger("hp.control.control_handler") logger.setLevel(pplog.CRITICAL) class DummyController(Controller): def __init__(self, net, in_service=True, level=0, order=0, drop_same_existing_ctrl=False, matching_params=None): if matching_params is None: matching_params = {'level': level, 'order': order} super().__init__(net, in_service=in_service, level=level, order=order, drop_same_existing_ctrl=drop_same_existing_ctrl, matching_params=matching_params) self.applied = False def initialize_control(self, net):