Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sparrowzz
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
sgool
sparrowzz
Commits
79f1c450
Commit
79f1c450
authored
Aug 24, 2025
by
Lian-runzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pfsoln函数修改
parent
9bfae4ba
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
134 行增加
和
22 行删除
+134
-22
rspower/examples/test_pfsoln.txt
+58
-4
rspower/examples/test_test.txt
+50
-0
rspower/examples/test_total_load.txt
+10
-10
rspower/lib/pfsoln.txt
+14
-6
rspower/lib/total_load.txt
+2
-2
没有找到文件。
rspower/examples/test_pfsoln.txt
查看文件 @
79f1c450
...
...
@@ -11,6 +11,7 @@
#include ../lib/newtonpf.txt
#include ../lib/runpf.txt
#include ../lib/pfsoln.txt
#include ../lib/total_load.txt
info("Running power flow on case14...");
...
...
@@ -27,7 +28,60 @@ bus_type = slice(bus, [0], [BUS_TYPE-1,BUS_TYPE]);
ref = find(bus_type == REF) + 1;
pv = find(bus_type == PV) + 1;
pq = find(bus_type == PQ) + 1;
mpopt = 12;
bus_output = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq, mpopt);
//bus_output = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq, []);
//branch_output = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq, []);
gen_output = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq, []);
return bus_output;
\ No newline at end of file
//bus结果
/*assert_relative_eq(bus_output, [
[c(1,0), c(3,0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0600,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(2,0), c(2,0), c(21.7,0.0), c(12.7,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0450,0.0), c(-4.9826,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(3,0), c(2,0), c(94.2,0.0), c(19.0,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0100,0.0), c(-12.7251,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(4,0), c(1,0), c(47.8,0.0), c(-3.9,-0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0177,0.0), c(-10.3129,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(5,0), c(1,0), c(7.6,0.0), c(1.6,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0195,0.0), c(-8.7739,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(6,0), c(2,0), c(11.2,0.0), c(7.5,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0700,0.0), c(-14.2209,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(7,0), c(1,0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0615,0.0), c(-13.3596,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(8,0), c(2,0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0900,0.0), c(-13.3596,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(9,0), c(1,0), c(29.5,0.0), c(16.6,0.0), c(0.0,0.0), c(19.0,0.0), c(1.0,0.0), c(1.0559,0.0), c(-14.9385,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(10,0), c(1,0), c(9.0,0.0), c(5.8,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0510,0.0), c(-15.0973,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(11,0), c(1,0), c(3.5,0.0), c(1.8,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0569,0.0), c(-14.7906,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(12,0), c(1,0), c(6.1,0.0), c(1.6,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0552,0.0), c(-15.0756,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(13,0), c(1,0), c(13.5,0.0), c(5.8,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0504,0.0), c(-15.1563,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)],
[c(14,0), c(1,0), c(14.9,0.0), c(5.0,0.0), c(0.0,0.0), c(0.0,0.0), c(1.0,0.0), c(1.0355,0.0), c(-16.0336,0.0), c(0.0,0.0), c(1.0,0.0), c(1.06,0.0), c(0.94,0.0)]
],4);*/
//gen结果
/*assert_relative_eq(gen_output, [
[c(1.0,0.0), c(232.3933,0.0), c(-16.5493,0.0), c(10.0,0.0), c(0.0,0.0), c(1.0600,0.0), c(100.0,0.0), c(1.0,0.0), c(332.4,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0)],
[c(2.0,0.0), c(40.0,0.0), c(43.5571,0.0), c(50.0,0.0), c(-40.0,-0.0), c(1.0450,0.0), c(100.0,0.0), c(1.0,0.0), c(140.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0)],
[c(3.0,0.0), c(0.0,0.0), c(25.0753,0.0), c(40.0,0.0), c(0.0,0.0), c(1.0100,0.0), c(100.0,0.0), c(1.0,0.0), c(100.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0)],
[c(6.0,0.0), c(0.0,0.0), c(12.7309,0.0), c(24.0,0.0), c(-6.0,-0.0), c(1.0700,0.0), c(100.0,0.0), c(1.0,0.0), c(100.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0)],
[c(8.0,0.0), c(0.0,0.0), c(17.6235,0.0), c(24.0,0.0), c(-6.0,-0.0), c(1.0900,0.0), c(100.0,0.0), c(1.0,0.0), c(100.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0), c(0.0,0.0)]
],4);*/
//branch结果
/*assert_relative_eq(branch_output, [
[c(1.0, 0.0), c(2.0, 0.0), c(0.0194, 0.0), c(0.0592, 0.0), c(0.0528, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(156.8829, 0.0), c(-20.4043, 0.0), c(-152.5853, 0.0), c(27.6762, 0.0)],
[c(1.0, 0.0), c(5.0, 0.0), c(0.0540, 0.0), c(0.2230, 0.0), c(0.0492, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(75.5104, 0.0), c(3.8550, 0.0), c(-72.7475, 0.0), c(2.2294, 0.0)],
[c(2.0, 0.0), c(3.0, 0.0), c(0.0470, 0.0), c(0.1980, 0.0), c(0.0438, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(73.2376, 0.0), c(3.5602, 0.0), c(-70.9143, 0.0), c(1.6022, 0.0)],
[c(2.0, 0.0), c(4.0, 0.0), c(0.0581, 0.0), c(0.1763, 0.0), c(0.0340, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(56.1315, 0.0), c(-1.5504, 0.0), c(-54.4548, 0.0), c(3.0207, 0.0)],
[c(2.0, 0.0), c(5.0, 0.0), c(0.0570, 0.0), c(0.1739, 0.0), c(0.0346, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(41.5162, 0.0), c(1.1710, 0.0), c(-40.6125, 0.0), c(-2.09903, 0.0)],
[c(3.0, 0.0), c(4.0, 0.0), c(0.0670, 0.0), c(0.1710, 0.0), c(0.0128, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(-23.2857, 0.0), c(4.4731, 0.0), c(23.6591, 0.0), c(-4.8357, 0.0)],
[c(4.0, 0.0), c(5.0, 0.0), c(0.0134, 0.0), c(0.0421, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(-61.1582, 0.0), c(15.8236, 0.0), c(61.6727, 0.0), c(-14.2010, 0.0)],
[c(4.0, 0.0), c(7.0, 0.0), c(0.0000, 0.0), c(0.2091, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.9780, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(28.0742, 0.0), c(-9.6811, 0.0), c(-28.0742, 0.0), c(11.3843, 0.0)],
[c(4.0, 0.0), c(9.0, 0.0), c(0.0000, 0.0), c(0.5562, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.9690, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(16.0798, 0.0), c(-0.4276, 0.0), c(-16.0798, 0.0), c(1.7323, 0.0)],
[c(5.0, 0.0), c(6.0, 0.0), c(0.0000, 0.0), c(0.2520, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.9320, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(44.0873, 0.0), c(12.4707, 0.0), c(-44.0873, 0.0), c(-8.04955, 0.0)],
[c(6.0, 0.0), c(11.0, 0.0), c(0.0950, 0.0), c(0.1989, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(7.3533, 0.0), c(3.5605, 0.0), c(-7.2979, 0.0), c(-3.4445, 0.0)],
[c(6.0, 0.0), c(12.0, 0.0), c(0.1229, 0.0), c(0.2558, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(7.7861, 0.0), c(2.5034, 0.0), c(-7.7143, 0.0), c(-2.3540, 0.0)],
[c(6.0, 0.0), c(13.0, 0.0), c(0.0662, 0.0), c(0.1303, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(17.7480, 0.0), c(7.2166, 0.0), c(-17.5359, 0.0), c(-6.79892, 0.0)],
[c(7.0, 0.0), c(8.0, 0.0), c(0.0000, 0.0), c(0.1762, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(-5.7036e-11, 0.0), c(-17.1630, 0.0), c(5.7036e-11, 0.0), c(17.6235, 0.0)],
[c(7.0, 0.0), c(9.0, 0.0), c(0.0000, 0.0), c(0.1100, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(28.0742, 0.0), c(5.7787, 0.0), c(-28.0742, 0.0), c(-4.9766, 0.0)],
[c(9.0, 0.0), c(10.0, 0.0), c(0.0318, 0.0), c(0.0845, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(5.2276, 0.0), c(4.2191, 0.0), c(-5.2147, 0.0), c(-4.1849, 0.0)],
[c(9.0, 0.0), c(14.0, 0.0), c(0.1271, 0.0), c(0.2704, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(9.4264, 0.0), c(3.6100, 0.0), c(-9.3102, 0.0), c(-3.3629, 0.0)],
[c(10.0, 0.0), c(11.0, 0.0), c(0.0821, 0.0), c(0.1921, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(-3.7853, 0.0), c(-1.6151, 0.0), c(3.7979, 0.0), c(1.6445, 0.0)],
[c(12.0, 0.0), c(13.0, 0.0), c(0.2209, 0.0), c(0.1999, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(1.6143, 0.0), c(0.7540, 0.0), c(-1.6080, 0.0), c(-0.7483, 0.0)],
[c(13.0, 0.0), c(14.0, 0.0), c(0.1709, 0.0), c(0.3480, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0), c(1.0, 0.0), c(-360.0, -0.0), c(360.0, 0.0), c(5.6439, 0.0), c(1.7472, 0.0), c(-5.5898, 0.0), c(-1.6371, 0.0)]
],4);*/
return gen_output;
\ No newline at end of file
rspower/examples/test_test.txt
0 → 100644
查看文件 @
79f1c450
#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/make_y_bus_Yf.txt
#include ../lib/make_y_bus_Yt.txt
#include ../lib/dsbus_dv.txt
#include ../lib/make_sdzip.txt
#include ../lib/make_sbus.txt
#include ../lib/newtonpf.txt
#include ../lib/runpf.txt
#include ../lib/pfsoln.txt
#include ../lib/total_load.txt
/*info("Running power flow on case14...");
for i in 0..5 {
V = runpf();
}
info("Run power flow on case14 end");*/
V = [
[c(1.06, 0.0)],
[c(1.0410510878563968, -0.09076140409343753)],
[c(0.9851925222806562, -0.22247627748206936)],
[c(1.0012301294030048, -0.18218725103727978)],
[c(1.0075836018455215, -0.1555114004249211)],
[c(1.0372104967857152, -0.26285810879166427)],
[c(1.0327936828708408, -0.24527724412925403)],
[c(1.0605034385798873, -0.25185800912465656)],
[c(1.0202443799343512, -0.27220066837791956)],
[c(1.0147098467803461, -0.2737382122352938)],
[c(1.0218861177448701, -0.2698150316344123)],
[c(1.0188727210261328, -0.2744472303583861)],
[c(1.0138455467690366, -0.27462511105715226)],
[c(0.9952474931854945, -0.28601520251885126)]
];
bus = assign(bus, abs(V), [0], [VM-1, VM] );
bus = assign(bus, angle(V) * 180 / pi, [0], [VA-1, VA] );
on_temp = find(slice(gen, [0], [GEN_STATUS-1, GEN_STATUS]) > 0);
index_gbus_type = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on_temp) - 1;
on = find(get_multi(slice(bus, [0], [BUS_TYPE-1, BUS_TYPE]), index_gbus_type) != PQ)';
off = find(slice(gen, [0], [GEN_STATUS-1, GEN_STATUS]) <= 0)';
gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on)';
Pd_Qd = total_load(select(bus, gbus-1), [], 1, [], [], []);
return Pd_Qd;
\ No newline at end of file
rspower/examples/test_total_load.txt
查看文件 @
79f1c450
...
...
@@ -10,15 +10,15 @@
on_temp = find(slice(gen, [0], [GEN_STATUS-1, GEN_STATUS]) > 0);
index_gbus_type = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on_temp) - 1;
on = find(get_multi(slice(bus, [0], [BUS_TYPE-1, BUS_TYPE]), index_gbus_type) != PQ)';
gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on)'
- 1
;
Pd
= total_load(select(bus, gbus
), [], 1, [], [], []);
gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on)';
Pd
_Qd = total_load(select(bus, gbus-1
), [], 1, [], [], []);
assert_relative_eq(Pd, [
[c(0,0)],
[c(21.7,0)],
[c(94.2,0)],
[c(11.2,0)],
[c(0,0)]
assert_relative_eq(Pd
_Qd
, [
[c(0,0)
, c(0,0)
],
[c(21.7,0)
, c(12.7,0)
],
[c(94.2,0)
, c(19.0,0)
],
[c(11.2,0)
, c(7.5,0)
],
[c(0,0)
, c(0,0)
]
]);
return Pd;
\ No newline at end of file
return Pd_Qd;
\ No newline at end of file
rspower/lib/pfsoln.txt
查看文件 @
79f1c450
...
...
@@ -5,7 +5,8 @@
// #include ../lib/idx_gen.txt
// #include ../lib/idx_bus.txt
// #include ../lib/idx_brch.txt
// #include total_load.txt
// #include ../lib/total_load.txt
// #include ../lib/make_sdzip.txt
fn pfsoln(baseMVA, bus0, gen0, branch0, Ybus, Yf, Yt, V, ref, pv, pq, mpopt){
...
...
@@ -34,8 +35,10 @@ fn pfsoln(baseMVA, bus0, gen0, branch0, Ybus, Yf, Yt, V, ref, pv, pq, mpopt){
gen_QG = set(slice(gen, [0], [QG-1, QG]), off, zeros(length(off), 1)); // zero out off-line Qg(离线发电机QG=0)
gen = assign(gen, gen_QG, [0], [QG-1, QG] );
// don't touch the ones at PQ buses
[Pd_gbus, Qd_gbus] = total_load(bus(gbus, :), [], 'bus', [], mpopt); //total_load()函数现在没有,要另外开发(gbus索引注意是否-1)
gen_QG = set(slice(gen, [0], [QG-1, QG]), on, imag(Sbus) * baseMVA + Qd_gbus); // inj Q + local Qd
Pd_gbus = total_load(select(bus, gbus-1), [], 1, [], [], []);
//Pd_gbus = slice(total_load(select(bus, gbus-1), [], 1, [], [], mpopt), [0], [0,1]);
//Qd_gbus = slice(total_load(bus(gbus-1, :), [], 1, [], [], mpopt), [0], [1,2]);
/*gen_QG = set(slice(gen, [0], [QG-1, QG]), on, imag(Sbus) * baseMVA + Qd_gbus); // inj Q + local Qd
gen = assign(gen, gen_QG, [0], [QG-1, QG] );
// ... at this point any buses with more than one generator will have
...
...
@@ -94,7 +97,8 @@ fn pfsoln(baseMVA, bus0, gen0, branch0, Ybus, Yf, Yt, V, ref, pv, pq, mpopt){
// update Pg for slack gen(s)
for k in 1..length(ref){
refgen = find(gbus == get_multi(get_multi(ref, [k-1]), 0) ); // which is(are) the reference gen(s)?
Pd_refk = total_load(bus(ref(k-1), :), [], 'bus', [], mpopt); //total_load()函数现在没有,要另外开发
//Pd_refk = slice(total_load(select(bus, get_multi(ref, [k-1] )), [], 1, [], [], mpopt), [0], [0,1]);
Pd_refk = [[c(0,0)]];
gen_PG = set(slice(gen, [0], [PG-1, PG]), get_multi(on, [get_multi(refgen,0)]), real(get_multi(Sbus, [get_multi(refgen,0)])) * baseMVA + Pd_refk );
gen = assign(gen, gen_PG, [0], [PG-1, PG] );
...
...
@@ -123,8 +127,11 @@ fn pfsoln(baseMVA, bus0, gen0, branch0, Ybus, Yf, Yt, V, ref, pv, pq, mpopt){
branch = horzcat(branch, branch_PT);
branch_QT = zeros(size(branch,0), 1);
branch_QT = set(branch_QT, br, imag(St));
branch = horzcat(branch, branch_QT);
branch = horzcat(branch, branch_QT);
*/
//return bus, gen, branch;
return bus;
//return bus;
return Pd_gbus;
//return branch;
}
\ No newline at end of file
rspower/lib/total_load.txt
查看文件 @
79f1c450
...
...
@@ -180,6 +180,5 @@ fn total_load(bus, gen, load_zone, opt_type, opt_nominal, mpopt){
}
}
//return Pd, Qd;
return Pd;
return horzcat(Pd,Qd);
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论