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
7ea4b1ca
Commit
7ea4b1ca
authored
Sep 15, 2025
by
wzc-a
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试runpf
parent
d827662c
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
13 行删除
+14
-13
rspower/data/convert_m_file.m
+1
-1
rspower/examples/compare_results.m
+13
-12
没有找到文件。
rspower/data/convert_m_file.m
查看文件 @
7ea4b1ca
function
convert_m_file
3
(
input_file
,
output_file
)
function
convert_m_file
(
input_file
,
output_file
)
% input_file: 输入.m文件路径(例如 'case14.m')
% input_file: 输入.m文件路径(例如 'case14.m')
% output_file:输出.txt文件路径(例如 'case14_mems.txt')
% output_file:输出.txt文件路径(例如 'case14_mems.txt')
% 将matpower矩阵格式转换为mems支持的脚本矩阵格式
% 将matpower矩阵格式转换为mems支持的脚本矩阵格式
...
...
rspower/examples/compare_results.m
查看文件 @
7ea4b1ca
...
@@ -3,7 +3,7 @@ function compare_results(case_name)
...
@@ -3,7 +3,7 @@ function compare_results(case_name)
% case_name: 算例名称,如 'case14', 'case30', 'case57' 等
% case_name: 算例名称,如 'case14', 'case30', 'case57' 等
if
nargin
<
1
if
nargin
<
1
case_name
=
'case14
1
'
;
% 默认使用 case14
case_name
=
'case14
5
'
;
% 默认使用 case14
end
end
fprintf
(
'==============开始为算例 %s 执行测试...==============\n'
,
case_name
);
fprintf
(
'==============开始为算例 %s 执行测试...==============\n'
,
case_name
);
...
@@ -20,17 +20,17 @@ function compare_results(case_name)
...
@@ -20,17 +20,17 @@ function compare_results(case_name)
% 比较的field_name和使用matpower计算函数
% 比较的field_name和使用matpower计算函数
field_names
=
{
field_names
=
{
'ybus'
%
'ybus'
'jac'
%
'jac'
'sdzip'
%
'sdzip'
'sbus'
%
'sbus'
'runpf'
'runpf'
};
};
cal_makers
=
{
cal_makers
=
{
@
cal_makeybus
%
@cal_makeybus
@
cal_makejac
%
@cal_makejac
@
cal_makesdzip
%
@cal_makesdzip
@
cal_makesbus
%
@cal_makesbus
@
cal_runpf
@
cal_runpf
};
};
...
@@ -111,8 +111,9 @@ end
...
@@ -111,8 +111,9 @@ end
function
pfv
=
cal_runpf
(
case_name
)
function
pfv
=
cal_runpf
(
case_name
)
mpc
=
loadcase
(
case_name
);
mpc
=
loadcase
(
case_name
);
for
i
=
1
:
100
mpopt
=
mpoption
(
'exp.use_legacy_core'
,
1
,
'out.all'
,
0
','
verbose
'
,
0
);
r
=
runpf
(
mpc
,
mpoption
(
'OUT_ALL'
,
0
','
VERBOSE
'
,
0
));
for
i
=
1
:
2000
r
=
runpf
(
mpc
,
mpopt
);
end
end
bus
=
r
.
bus
;
bus
=
r
.
bus
;
pfv
=
bus
(:,
8
)
.*
exp
(
1
j
*
pi
/
180
*
bus
(:,
9
));
pfv
=
bus
(:,
8
)
.*
exp
(
1
j
*
pi
/
180
*
bus
(:,
9
));
...
@@ -159,7 +160,7 @@ function compare_matrices(matrix1, matrix2, matrix_name)
...
@@ -159,7 +160,7 @@ function compare_matrices(matrix1, matrix2, matrix_name)
fprintf
(
' 最大相对误差: %.2e\n'
,
relative_error
);
fprintf
(
' 最大相对误差: %.2e\n'
,
relative_error
);
% 判断是否相等(使用容差)
% 判断是否相等(使用容差)
tolerance
=
1e-
10
;
tolerance
=
1e-
6
;
if
max_error
<
tolerance
if
max_error
<
tolerance
fprintf
(
' ✅ 矩阵相等 (容差: %.0e)\n'
,
tolerance
);
fprintf
(
' ✅ 矩阵相等 (容差: %.0e)\n'
,
tolerance
);
else
else
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论