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_1ph(net): """ calculation method for single phase to ground short-circuit currents """ _add_auxiliary_elements(net) # pos. seq bus impedance 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) # zero seq bus impedance ppc_0, ppci_0 = _pd2ppc_zero(net) _calc_ybus(ppci_0) try: _calc_zbus(ppci_0) except Exception as e: _clean_up(net, res=False) raise (e) _calc_rx(net, ppci_0) _calc_ikss_1ph(net, ppci, ppci_0) if net._options["branch_results"]: _calc_branch_currents(net, ppci) ppc_0 = _copy_results_ppci_to_ppc(ppci_0, ppc_0, "sc") ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc, ppc_0) _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_1ph(net, bus): """ calculation method for single phase to ground short-circuit currents """ _add_auxiliary_elements(net) # pos. seq bus impedance ppc, ppci = _pd2ppc(net) _calc_ybus(ppci) # zero seq bus impedance ppc_0, ppci_0 = _pd2ppc_zero(net) _calc_ybus(ppci_0) if net["_options"]["inverse_y"]: _calc_zbus(net, ppci) _calc_zbus(net, ppci_0) else: # Factorization Ybus once ppci["internal"]["ybus_fact"] = factorized(ppci["internal"]["Ybus"]) ppci_0["internal"]["ybus_fact"] = factorized( ppci_0["internal"]["Ybus"]) _calc_rx(net, ppci, bus=bus) _add_kappa_to_ppc(net, ppci) _calc_rx(net, ppci_0, bus=bus) _calc_ikss_1ph(net, ppci, ppci_0, bus=bus) if net._options["branch_results"]: _calc_branch_currents(net, ppci, bus=bus) ppc_0 = _copy_results_ppci_to_ppc(ppci_0, ppc_0, "sc") ppc = _copy_results_ppci_to_ppc(ppci, ppc, "sc") _extract_results(net, ppc, ppc_0, bus=bus) _clean_up(net)
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_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)