when i tried to runpf matpower 33 bus program, it shows this problem
10 次查看(过去 30 天)
显示 更早的评论
Error using loadcase (line 199)
loadcase: syntax error or undefined data matrix(ices) in the file
Undefined function 'feval_w_path' for input arguments of type 'char'.
Error in runpf (line 101)
mpc = loadcase(casedata);
0 个评论
回答(2 个)
Namnendra
2024-7-23,11:36
Hi Fausta,
The error you're encountering indicates that there is a problem with the syntax or content of the case file you're trying to load in MATPOWER, a power system simulation package in MATLAB. The `loadcase` function is used to load the case data, and it seems like there's a syntax error or an undefined variable in your case file.
Here's a step-by-step guide to troubleshoot and resolve this issue:
Steps to Troubleshoot and Resolve the Error
1. Check the Case File Syntax:
- Ensure that the case file (e.g., `case33.m`) follows the correct MATPOWER case file format.
- The case file should define a MATLAB struct with fields such as `mpc.version`, `mpc.baseMVA`, `mpc.bus`, `mpc.gen`, `mpc.branch`, etc.
2. Verify Variable Definitions:
- Check that all required matrices (`bus`, `gen`, `branch`, etc.) are defined and populated correctly.
- Ensure there are no syntax errors or undefined variables in the case file.
3. MATPOWER Path Configuration:
- Ensure that MATPOWER is correctly installed and its path is added to MATLAB's search path.
- You can add the MATPOWER path using the `addpath` function:
addpath('path_to_matpower');
4. Example Case File:
- Compare your case file with an example case file provided by MATPOWER (e.g., `case9.m`) to ensure the structure and syntax are correct.
- Here is an example structure of a MATPOWER case file:
function mpc = case33
%CASE33 Power flow data for 33 bus distribution system.
%% MATPOWER Case Format : Version 2
mpc.version = '2';
%%----- Power Flow Data -----%%
%% system MVA base
mpc.baseMVA = 1;
%% bus data
% bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
mpc.bus = [
1 1 0.0 0.0 0.0 0.0 1 1.00 0.0 12.66 1 1.05 0.95;
2 1 0.1 0.06 0.0 0.0 1 1.00 0.0 12.66 1 1.05 0.95;
% more bus data...
];
%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 0.0 0.0 10.0 -10.0 1.00 1.0 1 10.0 -10.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0;
% more generator data...
];
%% branch data
% fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax
mpc.branch = [
1 2 0.0922 0.0470 0.0 100.0 100.0 100.0 0.0 0.0 1 -360.0 360.0;
% more branch data...
];
%%----- OPF Data -----%%
%% generator cost data
% 1 startup shutdown n x1 y1 ... xn yn
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [
2 0.0 0.0 3 0.0 20.0 0.0;
% more cost data...
];
end
5. Run the Power Flow Analysis:
- Once the case file is correctly formatted and saved, you can run the power flow analysis using the `runpf` function:
mpc = loadcase('case33');
results = runpf(mpc);
I hope the above information helps.
Thank you.
0 个评论
Walter Roberson
2024-7-23,17:07
You appear to have a corrupted version of matpower .
feval_w_path is defined for at least MATPOWER 5, MATPOWER 6, MATPOWER 7, and MATPOWER 8
It is possible that your version of MATPOWER has the function but that somehow the function is not on the MATLAB path.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!