Commit abd37ed1 by dongshufeng

refactor:little change

parent 3a8c6ebc
...@@ -8,7 +8,10 @@ fn make_jac(baseMVA, bus, branch, gen) { ...@@ -8,7 +8,10 @@ fn make_jac(baseMVA, bus, branch, gen) {
// make sure we use generator setpoint voltage for PV and slack buses // make sure we use generator setpoint voltage for PV and slack buses
on = find(slice(gen, [0], [GEN_STATUS-1, GEN_STATUS]) > 0); // which generators are on? on = find(slice(gen, [0], [GEN_STATUS-1, GEN_STATUS]) > 0); // which generators are on?
gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on); // what buses are they at? gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on); // what buses are they at?
bus_type = slice(bus, [0], [BUS_TYPE-1,BUS_TYPE]);
gbus_type = get_multi(bus_type, gbus);
k = find(gbus_type == PV || gbus_type == REF);
r = dSbus_dV(Ybus, V, 0.); r = dSbus_dV(Ybus, V, 0.);
return r; return gbus_type;
} }
\ No newline at end of file
//NEWTONPF Solves power flow using full Newton's method (power/polar)
// [V, CONVERGED, I] = NEWTONPF(YBUS, SBUS, V0, REF, PV, PQ, MPOPT)
//
// Solves for bus voltages using a full Newton-Raphson method, using nodal
// power balance equations and polar coordinate representation of
// voltages, given the following inputs:
// YBUS - full system admittance matrix (for all buses)
// SBUS - handle to function that returns the complex bus power
// injection vector (for all buses), given the bus voltage
// magnitude vector (for all buses)
// V0 - initial vector of complex bus voltages
// REF - bus index of reference bus (voltage ang reference & gen slack)
// PV - vector of bus indices for PV buses
// PQ - vector of bus indices for PQ buses
// MPOPT - (optional) MATPOWER option struct, used to set the
// termination tolerance, maximum number of iterations, and
// output options (see MPOPTION for details).
//
// The bus voltage vector contains the set point for generator
// (including ref bus) buses, and the reference angle of the swing
// bus, as well as an initial guess for remaining magnitudes and
// angles.
//
// Returns the final complex voltages, a flag which indicates whether it
// converged or not, and the number of iterations performed.
//
// See also RUNPF, NEWTONPF_S_CART, NEWTONPF_I_POLAR, NEWTONPF_I_CART.
// MATPOWER
// Copyright (c) 1996-2019, Power Systems Engineering Research Center (PSERC)
// by Ray Zimmerman, PSERC Cornell
//
// This file is part of MATPOWER.
// Covered by the 3-clause BSD License (see LICENSE file for details).
// See https://matpower.org for more info.
fn newtonpf(Ybus, Sbus, V0, ref, pv, pq, mpopt) {
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论