def _calc_sc(net): _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) _calc_ybus(ppci) try: _calc_zbus(ppci) except Exception as e: _clean_up(net, res=False) raise (e) _calc_rx(net, ppci) _add_kappa_to_ppc(net, ppci) _calc_ikss(net, ppci) if net["_options"]["ip"]: _calc_ip(net, ppci) if net["_options"]["ith"]: _calc_ith(net, ppci) if net._options["branch_results"]: _calc_branch_currents(net, ppci) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") if net["_options"]["return_all_currents"]: _extract_results(net, ppc, ppc_0=None) else: _extract_results(net, ppc, ppc_0=None) _clean_up(net)
def _calc_sc(net): # t0 = time.perf_counter() _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) # t1 = time.perf_counter() _calc_ybus(ppci) # t2 = time.perf_counter() try: _calc_zbus(ppci) except Exception as e: _clean_up(net, res=False) raise(e) _calc_rx(net, ppci) # t3 = time.perf_counter() _add_kappa_to_ppc(net, ppci) # t4 = time.perf_counter() _calc_ikss(net, ppci) if net["_options"]["ip"]: _calc_ip(net, ppci) if net["_options"]["ith"]: _calc_ith(net, ppci) if net._options["branch_results"]: _calc_branch_currents(net, ppci) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc, ppc_0=None) _clean_up(net)
def _calc_sc(net): # t0 = time.perf_counter() _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) # t1 = time.perf_counter() _calc_ybus(ppci) # t2 = time.perf_counter() _calc_zbus(ppci) _calc_rx(net, ppci) # t3 = time.perf_counter() _add_kappa_to_ppc(net, ppci) # t4 = time.perf_counter() _calc_ikss(net, ppci) if net["_options"]["ip"]: _calc_ip(net, ppci) if net["_options"]["ith"]: _calc_ith(net, ppci) if net._options["branch_results"]: _calc_branch_currents(net, ppci) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc) _clean_up(net) # t5 = time.perf_counter() # net._et = {"sum": t5-t0, "model": t1-t0, "ybus": t2-t1, "zbus": t3-t2, "kappa": t4-t3, # "currents": t5-t4}
def _calc_sc(net, bus): _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) _calc_ybus(ppci) if net["_options"]["inverse_y"]: _calc_zbus(net, ppci) else: # Factorization Ybus once ppci["internal"]["ybus_fact"] = factorized(ppci["internal"]["Ybus"]) _calc_rx(net, ppci, bus) # kappa required inverse of Zbus, which is optimized if net["_options"]["kappa"]: _add_kappa_to_ppc(net, ppci) _calc_ikss(net, ppci, bus) if net["_options"]["ip"]: _calc_ip(net, ppci) if net["_options"]["ith"]: _calc_ith(net, ppci) if net._options["branch_results"]: _calc_branch_currents(net, ppci, bus) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc, ppc_0=None, bus=bus) _clean_up(net) if "ybus_fact" in ppci["internal"]: # Delete factorization object ppci["internal"].pop("ybus_fact")
def _calc_sc(net): # net["_is_elements"] = _select_is_elements(net) _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) _calc_equiv_sc_impedance(net, ppci) _add_kappa_to_ppc(net, ppci) _calc_ikss(net, ppci) _calc_ip(ppci) _calc_ith(net, ppci) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc) _clean_up(net)
def _calc_sc_single(net, bus): _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) _calc_ybus(ppci) try: _calc_zbus(ppci) except Exception as e: _clean_up(net, res=False) raise (e) _calc_rx(net, ppci) _calc_ikss(net, ppci) _calc_single_bus_sc(net, ppci, bus) ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_single_results(net, ppc) _clean_up(net)
def _calc_current(net, ppci_orig, bus): # Select required ppci bus ppci_bus = _get_is_ppci_bus(net, bus) # update ppci non_ps_gen_ppci_bus, non_ps_gen_ppci, ps_gen_bus_ppci_dict =\ _create_k_updated_ppci(net, ppci_orig, ppci_bus=ppci_bus) # For each ps_gen_bus one unique ppci is required ps_gen_ppci_bus = list(ps_gen_bus_ppci_dict.keys()) for calc_bus in ps_gen_ppci_bus + [non_ps_gen_ppci_bus]: if isinstance(calc_bus, np.ndarray): # Use ppci for general bus this_ppci, this_ppci_bus = non_ps_gen_ppci, calc_bus else: # Use specific ps_gen_bus ppci this_ppci, this_ppci_bus = ps_gen_bus_ppci_dict[ calc_bus], np.array([calc_bus]) _calc_ybus(this_ppci) if net["_options"]["inverse_y"]: _calc_zbus(net, this_ppci) else: # Factorization Ybus once this_ppci["internal"]["ybus_fact"] = factorized( this_ppci["internal"]["Ybus"]) _calc_rx(net, this_ppci, this_ppci_bus) _calc_ikss(net, this_ppci, this_ppci_bus) _add_kappa_to_ppc(net, this_ppci) if net["_options"]["ip"]: _calc_ip(net, this_ppci) if net["_options"]["ith"]: _calc_ith(net, this_ppci) if net._options["branch_results"]: _calc_branch_currents(net, this_ppci, this_ppci_bus) _copy_result_to_ppci_orig(ppci_orig, this_ppci, this_ppci_bus, calc_options=net._options)
def _calc_sc_single(net, bus): _add_auxiliary_elements(net) ppc, ppci = _pd2ppc(net) _calc_ybus(ppci) if net["_options"]["inverse_y"]: _calc_zbus(net, ppci) _calc_rx(net, ppci, bus=None) _calc_ikss(net, ppci, bus=None) _calc_single_bus_sc(net, ppci, bus) else: # Factorization Ybus once ppci["internal"]["ybus_fact"] = factorized(ppci["internal"]["Ybus"]) _calc_rx(net, ppci, bus) _calc_ikss(net, ppci, bus) _calc_single_bus_sc_no_y_inv(net, ppci, bus) # Delete factorization object ppci["internal"].pop("ybus_fact") ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_single_results(net, ppc) _clean_up(net)