When I try to run program it shows "Unrecognized function or variable 'loadcase'."

9 views (last 30 days)
I'm trying to run a program for OPTIMAL POWER TRANSMISSION USING FACTS
But When run the program it shows "Unrecognized function or variable 'loadcase'."mpc = loadcase('case_ieee30');
CODE
clc;
tic
global Lb Ub Q1 result
fprintf('\nReal Power Loss Minimization\n');
mpc = loadcase('case_ieee30');
NB=length(mpc.bus(:, PD));
NL=length(mpc.branch(:, 1));
NG=length(mpc.gen(:,1));
fprintf('\nLoad Flow Analysis Using Newton Raphson Method\n');
opt = mpoption('VERBOSE',0,'OUT_ALL', 0);
results=runpf(mpc,opt);
PL=sum(results.branch(:, PF)+ results.branch(:, PT));
fprintf('\nReal power loss %9.4f MW\n',PL);
fprintf('\nLoss Minimization Using Flower Polination Algorithm\n');
% Dimension of the search variables
Dim=12; popsize=50; N_iter=200;
Lb=[50 20 15 10 10 12 0.95 0.95 0.95 0.95 0.95 0.95];
Ub=[200 80 50 35 30 40 1.1 1.1 1.1 1.1 1.1 1.1];
[result MinCost] =FPA(Dim,popsize,N_iter,Lb,Ub);
for i=1:NG
mpc.gen(i,2)=result(i);
end
for i=1:NG
mpc.gen(i,6)=result(i+NG);
end
opt = mpoption('VERBOSE',0,'OUT_ALL', 0);
results=runpf(mpc,opt);
Pg1 = results.gen(:, PG);
PL=sum(results.branch(:, PF)+ results.branch(:, PT));
Q1 = abs(results.branch(:, QT));
OC=PL*0.06*1000*8760;
fprintf('\n*************** Result for minimum loss without FACTS***************\n');
fprintf('\nReal power loss %9.4f MW\n',PL);
fprintf('\nOperating Cost %9.4f $\n',OC);
plot(1:length(MinCost),MinCost,'b');
xlabel('Iteration');
ylabel('Operating Cost in $');
fprintf('\nLoss Minimization with FACTS Using Flower Polination Algorithm\n');
% Dimension of the search variables
Dim=16; popsize=50; N_iter=200;
Lb=[50 20 15 10 10 12 0.95 0.95 0.95 0.95 0.95 0.95 1 1 0 0];
Ub=[200 80 50 35 30 40 1.1 1.1 1.1 1.1 1.1 1.1 41 30 0.6 100];
[result1 MinCost] =FPA_facts(Dim,popsize,N_iter,Lb,Ub);
for i=1:NG
mpc.gen(i,2)=result(i);
end
for i=1:NG
mpc.gen(i,6)=result(i+NG);
end
mpc.branch(round(result1(13)),4)=mpc.branch(round(result1(13)),4);
result1(15)*mpc.branch(round(result1(13)),4);
mpc.bus(round(result1(14)),6)=mpc.bus(round(result1(14)),6)+result1(16);
opt = mpoption('VERBOSE',0,'OUT_ALL', 0);
results=runpf(mpc,opt);
Pg1 = results.gen(:, PG);
PL=sum(results.branch(:, PF)+ results.branch(:, PT));
Q2 = abs(results.branch(:, QT));
S1=Q1(round(result1(13)))-Q2(round(result1(13)));
S2=0;
for i=1:NL
if round(result1(14))==mpc.branch(i,1)
S2=S2+Q1(i)-Q2(i);
end
end
Ctcsc=(0.0015*S1^2-0.7130*S1+153.75);
Csvc=(0.0003*S2^2-0.3051*S2+127.38);
OC=PL*0.06*1000*8760+Ctcsc+Csvc;
fprintf('\n*************** Result for minimum loss with FACTS***************\n');
fprintf('\nGenerator Real power \n');
mpc.gen(:, 2)
fprintf('\nGenerator Bus Voltage\n');
mpc.gen(:, 6)
fprintf('\nReal power loss %9.4f\n',PL);
fprintf('\nOperating Cost %9.4f\n',OC);
fprintf('\nTCSC location %d\n',round(result1(13)));
fprintf('\nTCSC rating (Xtcsc) %9.4f\n',mpc.branch(round(result1(13)),4)*result1(15));
fprintf('\nSVC location %d\n',round(result1(14)));
fprintf('\nSVC rating (bsvc) %9.4f\n',result1(16));
figure(2)
plot(1:length(MinCost),MinCost,'b');
xlabel('Iteration');
ylabel('Operating Cost in $');
I Dont know how to debug this problem. Please Do Help me. I have inserted the busbar data in xlsx file

Answers (2)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi on 21 Dec 2020
Hi Ashwin,
"loadcase" doesn't appear to be a MATLAB functionality. On line# 5, MATLAB isn't able to catch the definition of "loadcase" and thus throws the error that you reported.
If your intention is to read data from the Excel file that you shared, consider using the readtable function in MATLAB.
Hope this helps!

venkateswara mallireddy
venkateswara mallireddy on 15 Jul 2022
SOME FUNCTIONS ARE NOT WORKING IN PREVIOUS VERSIONS OF MATLAB THATS Y ITS SHOWING ERROR
WHICH VERSION u r using pls contact me 8919483814

Community Treasure Hunt

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

Start Hunting!

Translated by