def __init__(self, Sbus=None, voltage=None, Sbranch=None, Ibranch=None, loading=None, losses=None, error=None, converged=None, Qpv=None): """ Constructor :param Sbus: Bus power injections :param voltage: Bus voltages :param Sbranch: Branch power flow :param Ibranch: Branch current flow :param loading: Branch loading :param losses: Branch losses :param error: error :param converged: converged? :param Qpv: Reactive power at the PV nodes """ # initialize the PowerFlowResults.__init__(self, Sbus=Sbus, voltage=voltage, Sbranch=Sbranch, Ibranch=Ibranch, loading=loading, losses=losses, error=error, converged=converged, Qpv=Qpv)
def power_flow_worker(variation: int, nbus, nbr, n_tr, bus_names, branch_names, transformer_names, bus_types, calculation_inputs: List[SnapshotData], options: PowerFlowOptions, dP, return_dict): """ Run asynchronous power flow :param variation: variation id :param nbus: number of buses :param nbr: number of branches :param n_tr: :param bus_names: :param branch_names: :param transformer_names: :param bus_types: :param calculation_inputs: list of CalculationInputs' instances :param options: PowerFlowOptions instance :param dP: delta of active power (array of values of size nbus) :param return_dict: dictionary to return values :return: Nothing because it is a worker, the return is done via the return_dict variable """ # create new results pf_results = PowerFlowResults(n=nbus, m=nbr, n_tr=n_tr, n_hvdc=0, bus_names=bus_names, branch_names=branch_names, transformer_names=transformer_names, hvdc_names=(), bus_types=bus_types) logger = Logger() # simulate each island and merge the results for i, calculation_input in enumerate(calculation_inputs): if len(calculation_input.vd) > 0: # run circuit power flow res = single_island_pf(circuit=calculation_input, Vbus=calculation_input.Vbus, Sbus=calculation_input.Sbus - dP[calculation_input.original_bus_idx], Ibus=calculation_input.Ibus, branch_rates=calculation_input.branch_rates, options=options, logger=Logger()) # merge the results from this island pf_results.apply_from_island( results=res, b_idx=calculation_input.original_bus_idx, br_idx=calculation_input.original_branch_idx, tr_idx=calculation_input.original_tr_idx) else: logger.add_info('No slack nodes in the island', str(i)) return_dict[variation] = (pf_results, logger)
def __init__(self, n, m, n_tr, bus_names, branch_names, transformer_names, bus_types): """ :param n: :param m: :param n_tr: :param bus_names: :param branch_names: :param transformer_names: :param bus_types: """ # initialize the PowerFlowResults.__init__(self, n=n, m=m, n_tr=n_tr, n_hvdc=0, bus_names=bus_names, branch_names=branch_names, transformer_names=transformer_names, hvdc_names=(), bus_types=bus_types)
def power_flow_worker(variation: int, nbus, nbr, calculation_inputs: List[CalculationInputs], options: PowerFlowOptions, dP, return_dict): """ Run asynchronous power flow :param variation: variation id :param nbus: number of buses :param nbr: number of branches :param calculation_inputs: list of CalculationInputs' instances :param options: PowerFlowOptions instance :param dP: delta of active power (array of values of size nbus) :param return_dict: dictionary to return values :return: Nothing because it is a worker, the return is done via the return_dict variable """ # create new results pf_results = PowerFlowResults() pf_results.initialize(nbus, nbr) logger = Logger() # simulate each island and merge the results for i, calculation_input in enumerate(calculation_inputs): if len(calculation_input.ref) > 0: # run circuit power flow res = single_island_pf(circuit=calculation_input, Vbus=calculation_input.Vbus, Sbus=calculation_input.Sbus - dP[calculation_input.original_bus_idx], Ibus=calculation_input.Ibus, branch_rates=calculation_input.branch_rates, options=options, logger=Logger()) bus_original_idx = calculation_input.original_bus_idx branch_original_idx = calculation_input.original_branch_idx # merge the results from this island pf_results.apply_from_island(res, bus_original_idx, branch_original_idx) else: logger.append('There are no slack nodes in the island ' + str(i)) return_dict[variation] = (pf_results, logger)