def _extract_single_results(net, ppc): reset_results(net, suffix="_sc") _get_single_bus_results(net, ppc) net["_options"]["ac"] = True net["_options"]["trafo_loading"] = "current" bus_lookup_aranged = _get_aranged_lookup(net) bus_pq = np.zeros(shape=(len(net["bus"].index), 2), dtype=np.float) _get_branch_results(net, ppc, bus_lookup_aranged, bus_pq, suffix="_sc")
def _extract_single_results(net, ppc): for element in ["line", "trafo"]: net["res_%s_sc"%element] = pd.DataFrame(np.nan, index=net[element].index, columns=net["_empty_res_%s"%element].columns, dtype='float') _get_single_bus_results(net, ppc) net["_options"]["ac"] = True net["_options"]["trafo_loading"] = "current" bus_lookup_aranged = _get_aranged_lookup(net) bus_pq = np.zeros(shape=(len(net["bus"].index), 2), dtype=np.float) _get_branch_results(net, ppc, bus_lookup_aranged, bus_pq, suffix="_sc")
def _get_bus_p_q_results_from_ppc(self, net, ppc, net_bus_idx, ppc_bus_idx): """ reads p, q results from ppc to net. Note: This function returns wrong vales if shunts, xwards and wards are in net @param net: @param ppc: @return: """ # read bus_pq array which contains p and q values for each bus in net bus_pq = np.zeros(shape=(len(net["bus"].index), 2), dtype=float) bus_pq[net_bus_idx, 0] = ppc["bus"][ppc_bus_idx, PD] * 1e3 bus_pq[net_bus_idx, 1] = ppc["bus"][ppc_bus_idx, QD] * 1e3 bus_lookup_aranged = _get_aranged_lookup(net) _get_gen_results(net, ppc, bus_lookup_aranged, bus_pq) _get_bus_results(net, ppc, bus_pq) net["res_bus"].index = net["bus"].index