Error: File: ObjFunc.m Line: 32 Column: 11

Dear All
while I am running the below program:
function [Fitness,overloads] = ObjFunc(Population,branch,bus)
% clear all
% clc
% Population = [5.0000 0.9928];
%%Constant in the equation
mpc=loadcase('casemod30');
mpc.branch = branch;
mpc.bus=bus;
Fitness = zeros(1,1);
R=2*2;
wl=0.1 ; % Weighting Factors
y1=0; % Initialize Sub-objectives in to zeros
%%Step 1: Define Case Study
define_constants;
%%Step 2: Modify the Branches based on the Randomly Chosen Location and
%%Rating
[mpc.branch] = ModifyBranch(Population,mpc.branch,mpc.bus);
%%Step 3: Run the Power Flow
r = runpf(mpc);
%%Step 4: Calculate the line flow and the Overload
MVAflow_f = sqrt(r.branch(:, PF).^2 + r.branch(:, QF).^2);
MVAflow_t = sqrt(r.branch(:, PT).^2 + r.branch(:, QT).^2);
MVAflow_max = max([MVAflow_f MVAflow_t], [], 2);
overloads = max(MVAflow_max - r.branch(:, RATE_A), 0);
y1 = wl*sum((overloads/RATE_A).^R);
%%Step 5: Calculate Voltage
nb = size(mpc.bus(:,1)); %Number of Buses in the System
VP = mpc.bus(:,VM);
Vmref= ones(nb,1); % Reference Voltage**
R=2*2;
y2=0; wm=1 ;
for i=1:nb
if VP(i,1) > 1.05 || VP(i,1) < 0.95 %Under/Over Voltage
y2=y2+(wm*((Vmref(i,1)-VP(i,1))./Vmref(i,1)).^R);
else
y2=y2+0; % Normal voltage
end
end
Fitness= y1+y2;
I got the error
??? Error: File: ObjFunc.m Line: 32 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.
line 32 as below
Vmref= ones(nb,1);
some time also got warning input argument must be scalar

1 Kommentar

Walter Roberson
Walter Roberson am 16 Nov. 2015
The line before that makes use of VM which there is no obvious definition of. Possibly it is defined in define_constants and possibly there is an error in define_constants

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Gefragt:

am 16 Nov. 2015

Kommentiert:

am 16 Nov. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by