Commit cff9f3bd by wzc-a

增加注释

parent 753197a5
......@@ -45,6 +45,8 @@ fn newtonpf(Ybus, Sbus, V0, ref, pv, pq, mpopt) {
V = V0;
Va = angle(V);
Vm = abs(V);
// set up indexing for updating V
nb = length(V);
npv = length(pv);
npq = length(pq);
......@@ -52,16 +54,19 @@ fn newtonpf(Ybus, Sbus, V0, ref, pv, pq, mpopt) {
j3 = j2; j4 = j2 + npq; // j3:j4 - V angle of pq buses
j5 = j4; j6 = j4 + npq; // j5:j6 - V mag of pq buses
pv_pq_i = horzcat(pv, pq);
// evaluate F(x0)
mis = V .* conj(Ybus * V) - Sbus;
F = vertcat(real(get_multi(mis, pv_pq_i))', imag(get_multi(mis, pq))');
// check tolerance
normF = norm_max(F);
// do Newton iterations
while ~~converged && i < max_it {
// update iteration counter
i = i + 1;
// evaluate Jacobian
// evaluate Jacobian 因迭代中V变化,因此jac需要从dSbus_dV重新计算
jac = dSbus_dV(Ybus, V, 0);
dSbus_dVa = slice(jac, [0], [0,nb]);
dSbus_dVm = slice(jac, [0], [nb,2*nb]);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论