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
7dc61ff4
Commit
7dc61ff4
authored
Sep 25, 2025
by
dongshufeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: string should be `content`
parent
7aadb192
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
64 行增加
和
46 行删除
+64
-46
rspower/bench/pf_case141.txt
+51
-15
rspower/bench/pf_case145.txt
+3
-4
rspower/examples/test_ext2int.txt
+0
-3
rspower/examples/test_make_jac.txt
+0
-2
rspower/examples/test_make_sbus.txt
+0
-2
rspower/examples/test_make_sdzip.txt
+0
-3
rspower/examples/test_make_ybus.txt
+0
-3
rspower/examples/test_pfsoln.txt
+4
-3
rspower/examples/test_runpf.txt
+3
-5
rspower/examples/test_total_load.txt
+0
-3
rspower/examples/test_total_load2.txt
+2
-2
rspower/lib/make_sbus.txt
+1
-1
没有找到文件。
rspower/bench/pf_case141.txt
查看文件 @
7dc61ff4
...
@@ -2,34 +2,70 @@
...
@@ -2,34 +2,70 @@
#include ../lib/idx_gen.txt
#include ../lib/idx_gen.txt
#include ../lib/idx_bus.txt
#include ../lib/idx_bus.txt
#include ../lib/idx_brch.txt
#include ../lib/idx_brch.txt
#include ../lib/make_y_bus.txt
#include ../lib/dsbus_dv.txt
#include ../lib/dsbus_dv.txt
#include ../lib/make_sdzip.txt
#include ../lib/make_sdzip.txt
#include ../lib/make_sbus.txt
#include ../lib/make_sbus.txt
#include ../lib/make_y_bus.txt
#include ../lib/make_jac.txt
#include ../lib/newtonpf.txt
#include ../lib/newtonpf.txt
#include ../lib/runpf.txt
#include ../lib/runpf.txt
// ----------------- test make sbus ---------------
info(
"Running make_sbus on case141 2000 times..."
);
info(
`Running make_sbus on case141 2000 times...`
);
for i in 0..2000 {
for i in 0..2000 {
make_sbus(baseMVA, bus, gen);
make_sbus(baseMVA, bus, gen);
}
}
info(
"Run make_sbus case141 end"
);
info(
`Run make_sbus case141 end`
);
// ----------------- test make_y_bus ---------------
info(
"Running make_y_bus on case141 2000 times..."
);
info(
`Running make_y_bus on case141 2000 times...`
);
for i in 0..2000 {
for i in 0..2000 {
make_y_bus(baseMVA, bus, branch);
make_y_bus(baseMVA, bus, branch);
}
}
info(
"Run make_y_bus case141 end"
);
info(
`Run make_y_bus case141 end`
);
// ----------------- test make_jac ---------------
info(
"Running make_jac on case141 2000 times..."
);
info(
`Running make_jac on case141 10000 times...`
);
for i in 0..
2
000 {
for i in 0..
10
000 {
make_jac(baseMVA, bus, branch, gen, 1);
make_jac(baseMVA, bus, branch, gen, 1);
}
}
info("Run make_jac case141 end");
info(`Run make_jac case141 end`);
// ----------------- test prepare ---------------
info(`Running prepare on case141 2000 times...`);
for i in 0..2000 {
nb = size(bus, 0);
ng = size(gen, 0);
g_i = slice(gen, [0], [GEN_BUS-1,GEN_BUS]) - 1; // generator bus indices
Cg = full(sparse(g_i, range(0, ng), slice(gen, [0], [GEN_STATUS-1,GEN_STATUS]) > 0, nb, ng)); // gen connection matrix
// element i, j is 1 if, generator j at bus i is ON
bus_gen_status = Cg * ones(ng, 1); // number of generators at each bus that are ON
// form index lists for slack, PV, and PQ buses
bus_type = slice(bus, [0], [BUS_TYPE-1,BUS_TYPE]); // bus type column
ref = find(bus_type == REF && bus_gen_status); // reference bus index
pv = find(bus_type == PV && bus_gen_status); // PV bus indices
pq = find(bus_type == PQ || ~~bus_gen_status); // PQ bus indices
// generator info
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) - 1; // what buses are they at?
info("Running 2000 times power flow case141...");
// initial state
//V0 = ones(nb, 1); // flat start
V0 = slice(bus, [0], [VM-1,VM]) .* exp(c(0,1) * pi/180 * slice(bus, [0], [VA-1,VA]));
vcb = set(ones(size(V0)), pq, zeros(size(pq))); // create mask of voltage-controlled buses
k = find(get_multi(vcb, gbus)); // in-service gens at v-c buses
gbus_index = get_multi(gbus, k); // indices of in-service generators at v-c buses
on_k = get_multi(on, k);
gen_vg = get_multi(slice(gen, [0], [VG-1,VG]), on_k);
gbus_k = get_multi(gbus, k);
voltage_g = get_multi(V0, gbus_k);
V_init = set(V0, gbus_k, gen_vg ./ abs(voltage_g) .* voltage_g);
// build admittance matrices
Ybus = make_y_bus(baseMVA, bus, branch);
}
info(`Run prepare case141 end`);
// ----------------- test runpf ---------------
info(`Running 2000 times power flow case141...`);
for i in 0..2000 {
for i in 0..2000 {
r = runpf();
r = runpf();
}
}
info("Run power flow on case141 end");
info(`Run power flow on case141 end`);
return r;
\ No newline at end of file
\ No newline at end of file
rspower/bench/pf_case145.txt
查看文件 @
7dc61ff4
...
@@ -9,9 +9,8 @@
...
@@ -9,9 +9,8 @@
#include ../lib/newtonpf.txt
#include ../lib/newtonpf.txt
#include ../lib/runpf.txt
#include ../lib/runpf.txt
info(
"Running 2000 times power flow case145..."
);
info(
`Running 2000 times power flow case145...`
);
for i in 0..2000 {
for i in 0..2000 {
r = runpf();
r = runpf();
}
}
info("Run power flow on case145 end");
info(`Run power flow on case145 end`);
return r;
\ No newline at end of file
\ No newline at end of file
rspower/examples/test_ext2int.txt
查看文件 @
7dc61ff4
...
@@ -22,5 +22,3 @@ assert_relative_eq(i2e, [
...
@@ -22,5 +22,3 @@ assert_relative_eq(i2e, [
[13],
[13],
[14]
[14]
]);
]);
return i2e;
\ No newline at end of file
rspower/examples/test_make_jac.txt
查看文件 @
7dc61ff4
...
@@ -42,5 +42,3 @@ assert_relative_eq(jac, [
...
@@ -42,5 +42,3 @@ assert_relative_eq(jac, [
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(3.5937,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(2.7611,0), c(-7.5528,0), c(1.1980,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.3536,0), c(0,0), c(0,0), c(15.4657,0), c(0,0), c(-2.3605,0), c(11.1439,0), c(-2.4488,0) ],
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(3.5937,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(2.7611,0), c(-7.5528,0), c(1.1980,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.3536,0), c(0,0), c(0,0), c(15.4657,0), c(0,0), c(-2.3605,0), c(11.1439,0), c(-2.4488,0) ],
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(1.6212,0), c(0,0), c(0,0), c(0,0), c(1.2754,0), c(-2.8966,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.1092,0), c(-4.6646,0), c(0,0), c(0,0), c(-2.3799,0), c(5.4915,0) ]
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(1.6212,0), c(0,0), c(0,0), c(0,0), c(1.2754,0), c(-2.8966,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.1092,0), c(-4.6646,0), c(0,0), c(0,0), c(-2.3799,0), c(5.4915,0) ]
],4);
],4);
return jac;
rspower/examples/test_make_sbus.txt
查看文件 @
7dc61ff4
...
@@ -22,4 +22,3 @@ assert_relative_eq(r, [
...
@@ -22,4 +22,3 @@ assert_relative_eq(r, [
[c(-0.135,-0.058)],
[c(-0.135,-0.058)],
[c(-0.149,-0.050)]
[c(-0.149,-0.050)]
]);
]);
return r;
\ No newline at end of file
rspower/examples/test_make_sdzip.txt
查看文件 @
7dc61ff4
...
@@ -21,5 +21,3 @@ assert_relative_eq(sdzip, [
...
@@ -21,5 +21,3 @@ assert_relative_eq(sdzip, [
[c(0,0), c(0,0), c(0.1350,0.0580)],
[c(0,0), c(0,0), c(0.1350,0.0580)],
[c(0,0), c(0,0), c(0.1490,0.0500)]
[c(0,0), c(0,0), c(0.1490,0.0500)]
],4);
],4);
return sdzip;
\ No newline at end of file
rspower/examples/test_make_ybus.txt
查看文件 @
7dc61ff4
...
@@ -22,5 +22,3 @@ assert_relative_eq(ybus, [
...
@@ -22,5 +22,3 @@ assert_relative_eq(ybus, [
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.0989,6.1028), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-2.4890,2.2520), c(6.7249,-10.6697), c(-1.1370,2.3150) ],
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-3.0989,6.1028), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-2.4890,2.2520), c(6.7249,-10.6697), c(-1.1370,2.3150) ],
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-1.4240,3.0291), c(0,0), c(0,0), c(0,0), c(-1.1370,2.3150), c(2.5610,-5.3440) ]
[c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(0,0), c(-1.4240,3.0291), c(0,0), c(0,0), c(0,0), c(-1.1370,2.3150), c(2.5610,-5.3440) ]
],4);
],4);
return ybus;
\ No newline at end of file
rspower/examples/test_pfsoln.txt
查看文件 @
7dc61ff4
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
#include ../lib/total_load.txt
#include ../lib/total_load.txt
info(
"Running power flow on case14..."
);
info(
`Running power flow on case14...`
);
for i in 0..5 {
for i in 0..5 {
r = runpf();
r = runpf();
}
}
info(
"Run power flow on case14 end"
);
info(
`Run power flow on case14 end`
);
Ybus = make_y_bus(baseMVA, bus, branch);
Ybus = make_y_bus(baseMVA, bus, branch);
Yf = make_y_bus_Yf(baseMVA, bus, branch);
Yf = make_y_bus_Yf(baseMVA, bus, branch);
...
@@ -84,6 +84,6 @@ assert_relative_eq(bus_output, [
...
@@ -84,6 +84,6 @@ assert_relative_eq(bus_output, [
],4);*/
],4);*/
return bus_output;
//
return bus_output;
//return gen_output;
//return gen_output;
//return branch_output;
//return branch_output;
\ No newline at end of file
rspower/examples/test_runpf.txt
查看文件 @
7dc61ff4
...
@@ -9,11 +9,11 @@
...
@@ -9,11 +9,11 @@
#include ../lib/newtonpf.txt
#include ../lib/newtonpf.txt
#include ../lib/runpf.txt
#include ../lib/runpf.txt
info(
"Running power flow on case14..."
);
info(
`Running power flow on case14...`
);
for i in 0..100 {
for i in 0..100 {
r = runpf();
r = runpf();
}
}
info(
"Run power flow on case14 end"
);
info(
`Run power flow on case14 end`
);
assert_relative_eq(r, [
assert_relative_eq(r, [
[c(1.0600,0)],
[c(1.0600,0)],
...
@@ -31,5 +31,3 @@ assert_relative_eq(r, [
...
@@ -31,5 +31,3 @@ assert_relative_eq(r, [
[c(1.0138,-0.2746)],
[c(1.0138,-0.2746)],
[c(0.9952,-0.2860)]
[c(0.9952,-0.2860)]
],4);
],4);
\ No newline at end of file
return r;
\ No newline at end of file
rspower/examples/test_total_load.txt
查看文件 @
7dc61ff4
...
@@ -20,5 +20,3 @@ assert_relative_eq(Pd_Qd, [
...
@@ -20,5 +20,3 @@ assert_relative_eq(Pd_Qd, [
[c(11.2,0), c(7.5,0)],
[c(11.2,0), c(7.5,0)],
[c(0,0), c(0,0)]
[c(0,0), c(0,0)]
]);
]);
return Pd_Qd;
\ No newline at end of file
rspower/examples/test_total_load2.txt
查看文件 @
7dc61ff4
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
#include ../lib/pfsoln.txt
#include ../lib/pfsoln.txt
#include ../lib/total_load.txt
#include ../lib/total_load.txt
info(
"Running power flow on case14..."
);
info(
`Running power flow on case14...`
);
V = runpf();
V = runpf();
info(
"Run power flow on case14 end"
);
info(
`Run power flow on case14 end`
);
bus = assign(bus, abs(V), [0], [VM-1, VM] );
bus = assign(bus, abs(V), [0], [VM-1, VM] );
bus = assign(bus, angle(V) * 180 / pi, [0], [VA-1, VA] );
bus = assign(bus, angle(V) * 180 / pi, [0], [VA-1, VA] );
...
...
rspower/lib/make_sbus.txt
查看文件 @
7dc61ff4
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
fn make_sbus(baseMVA, bus, gen) {
fn make_sbus(baseMVA, bus, gen) {
nb = size(bus, 0);
nb = size(bus, 0);
Sd = make_sdzip(baseMVA, bus,
mpopt
);
Sd = make_sdzip(baseMVA, bus,
[]
);
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) - 1; // what buses are they at?
gbus = get_multi(slice(gen, [0], [GEN_BUS-1, GEN_BUS]), on) - 1; // what buses are they at?
ngon = size(on, 0);
ngon = size(on, 0);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论