Commit 9ba4ce81 by dongshufeng

refactor:add more file

parent 1f10d76a
#include ../data/case14.txt
#include ../lib/idx_gen.txt
#include ../lib/idx_bus.txt
#include ../lib/idx_brch.txt
#include ../lib/make_y_bus.txt
#include ../lib/dsbus_dv.txt
#include ../lib/make_jac.txt
#include ../lib/make_sdzip.txt
Ybus = make_y_bus(baseMVA, bus, branch);
return make_sdzip(baseMVA, bus, 1);
\ No newline at end of file
//MAKESBUS Builds the vector of complex bus power injections.
// SBUS = MAKESBUS(BASEMVA, BUS, GEN)
// SBUS = MAKESBUS(BASEMVA, BUS, GEN, MPOPT, VM)
// SBUS = MAKESBUS(BASEMVA, BUS, GEN, MPOPT, VM, SG)
// returns the vector of complex bus power injections, that is, generation
// minus load. Power is expressed in per unit. If the MPOPT and VM arguments
// are present it evaluates any ZIP loads based on the provided voltage
// magnitude vector. If VM is empty, it assumes nominal voltage. If SG is
// provided, it is a complex ng x 1 vector of generator power injections in
// p.u., and overrides the PG and QG columns in GEN, using GEN only for
// connectivity information.
//
// [SBUS, DSBUS_DVM] = MAKESBUS(BASEMVA, BUS, GEN, MPOPT, VM)
// With two output arguments, it computes the partial derivative of the
// bus injections with respect to voltage magnitude, leaving the first
// return value SBUS empty. If VM is empty, it assumes no voltage dependence
// and returns a sparse zero matrix.
//
// See also MAKEYBUS.
// MATPOWER
// Copyright (c) 1996-2016, 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.
// define named indices into bus, gen matrices
fn make_sbus(baseMVA, bus, gen, mpopt, Vm, Sg) {
nb = size(bus, 1);
}
\ No newline at end of file
//MAKESDZIP Builds vectors of nominal complex bus power demands for ZIP loads.
// SD = MAKESDZIP(BASEMVA, BUS, MPOPT) returns a struct with three fields,
// each an nb x 1 vectors. The fields 'z', 'i' and 'p' correspond to the
// nominal p.u. complex power (at 1 p.u. voltage magnitude) of the constant
// impedance, constant current, and constant power portions, respectively of
// the ZIP load model.
//
// Example:
// Sd = makeSdzip(baseMVA, bus, mpopt);
// MATPOWER
// Copyright (c) 2015-2016, Power Systems Engineering Research Center (PSERC)
// by Shrirang Abhyankar
// and 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 make_sdzip(baseMVA, bus, mpopt) {
pw = [1, 0, 0];
qw = [1, 0, 0];
pd = slice(bus, [0], [PD-1,PD]);
qd = slice(bus, [0], [QD-1,QD]);
z = (pd * get(pw,2) + c(0,1) * qd * get(qw,2)) / baseMVA;
i = (pd * get(pw,1) + c(0,1) * qd * get(qw,1)) / baseMVA;
p = (pd * get(pw,0) + c(0,1) * qd * get(qw,0)) / baseMVA;
return p;
}
\ No newline at end of file
...@@ -35,5 +35,14 @@ ...@@ -35,5 +35,14 @@
// See https://matpower.org for more info. // See https://matpower.org for more info.
fn newtonpf(Ybus, Sbus, V0, ref, pv, pq, mpopt) { fn newtonpf(Ybus, Sbus, V0, ref, pv, pq, mpopt) {
// options
tol = get(mpopt, 0);
max_it = get(mpopt, 1);
// initialize
converged = 0;
i = 0;
V = V0;
Va = angle(V);
Vm = abs(V);
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论