def _get_single_bus_results(net, ppc): _set_buses_out_of_service(ppc) bus_idx = _get_bus_idx(net) case = net._options["case"] c = ppc["bus"][bus_idx, C_MIN] if case == "min" else ppc["bus"][bus_idx, C_MAX] net["res_bus"]["vm_pu"] = np.nan net["res_bus_sc"]["vm_pu"] = c - ppc["bus"][bus_idx, VM] net["res_bus_sc"]["va_degree"] = ppc["bus"][bus_idx, VA]
def get_batch_bus_results(net, vm, va): # convert ppci bus results to net.res_bus results # we need va, vm with out of service elements # create matrix of proper size bus_shape_ppc = net["_ppc"]["bus"].shape[0] bus_idx = _get_bus_idx(net) # (n_ts, n_bus in ppc) vm_full = empty((vm.shape[0], bus_shape_ppc)) va_full = empty((va.shape[0], bus_shape_ppc)) vm_full.fill(nan) va_full.fill(nan) # and fill it vm_full[:, :vm.shape[1]] = vm.values va_full[:, :va.shape[1]] = va.values return vm_full[:, bus_idx], va_full[:, bus_idx]