each time take two value from GA in range put that value as x(1) and x(2) in P and after that value check the answer of Q which we want minimum value
    1 view (last 30 days)
  
       Show older comments
    
unction [p,q]=fitfunda1(x)    %for this we give two values of x(1) and x(2)
  sys= xlsread('IEEEE1.xlsx');    %this is excel file
  p=sys(x(2),7)=sys(x(2),7)-x(1);  %this x1 and x2 value taken from ga instruction
this x(1) ans x(2) value taken from ga instruction
frombus = sys(:,1)';             % From bus number...actually call branch number
tobus = sys(:,3)' ;             % To bus number...
buses=max(tobus) ;                 % no. of buses...
branch =max(frombus) ;               % no. of branches...
BIBC= zeros(branch,(buses-1));
BIBC(1,1)=1;
BCBV=zeros((buses-1),branch);
BCBV(1,1)=sys(1,4)+1i*sys(1,5);
for r=2:branch
    g=sys(r,2);
  BIBC(:,r)=BIBC(:,g-1);
  r=sys(r,1);
  s=sys(r,3);
  BIBC(r,s-1)=1;
end
for q=2:(buses-1)
    g1=sys(q,2);
  BCBV(q,:)=BCBV(g1-1,:);
  r1=sys(q,1);
  s1=sys(q,3);
  BCBV(r1,s1-1)=sys(r1,4)+1i*sys(r1,5);
end
DLF=BCBV*BIBC;
v0=(12660+1i*0).*ones(branch,1);
P=sys(:,6)*1000;
Q=sys(:,7)*1000;
v=v0;
for k=1:20
I=-conj((P+1i*Q)./v);
delta_v=DLF*I;
v=v0+delta_v;
end
v_pu=[1+1i*0;v./12660];
voltage_perUNIT=abs(v_pu)';
vpu=voltage_perUNIT'
branchcu=abs(BIBC*I)
   for r=1:branch
  powerloss=branchcu(r)^2*sys(r,4);
   t1(r)=powerloss;
   end
   lossnet1=t1;
   total_powerloss=sum(t1)
*q=branchcu(r)^2*sys(r,4);*
check this q value want to minimum value is target
this is ga instruction file
fitfcn=@fitfunda1;  %fitness function file taken from myfitness 
nvars=2;            % three variables in equation
lb=round([200 1]);  %lower boundry for variables
ub=round([1000 33]);  %upper boundry for variables
IntCon = 1;
ConstraintFunction=@constrain_1;    %constraint taken from simple_constraint file
[x,fval,exitflag,output,population,total] =ga(fitfcn,nvars,[],[],[],[],lb,ub,constrain_1);
actually i want two value from GA in range put that value as x(1) and x(2) in P and after that value check the answer of Q which we want minimum value
0 Comments
Answers (0)
See Also
Categories
				Find more on Genetic Algorithm in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!