⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop.m

📁 This is inportent program for energy sector engineers. This matlab code is based on Newton Rapshion
💻 M
字号:
clc
clear all
int=50;
nrlfppg
% sum=0;
% for i=1:nbus
% sum=sum+Ql(i,1);
% end
% sum=floor(sum*baseMVA*1000/150)+1;

%--------------------------------------------------Population Generation------------------------------------------
popu=zeros(int,nbus); 
    for i= 1:int
%         k=1;
%         while k<=5
% %             j= floor(rand(1)*nbus);
%           if j==0
%              continue             
%           end
%           k=k+1;
        j=randperm(nbus);    
        for k=1:5
          l=j(1,k);
          capa=floor(rand(1)*8)*150;
          while capa==0
             capa=floor(rand(1)*8)*150;
          end
          popu(i,l)=capa;
        end
    end
    popu=popu';
  
    for j= 1:int
        Qin=(((popu(:,j))./(1000)));
        newton;
        
%         a(j)=t;
%         b(j)=sum;
    end
    
% %--------------------------------------------------------------------------------------------------------------------

%---------------------------------------------------Mutation-----------------------------------------------------------

S=.1;
mamu=zeros(nbus,int);

for k=1:int
    
    j=randperm(int);
    while j(1,1)==k || j(1,2)==k
    j=randperm(int);
   
    end
    a= j(1,1);
    b= j(1,2);    
    for i=1:nbus
    mamu(i,k)= popu(i,k) + S*(popu(i,a)-popu(i,b));
   
        while mamu(i,k)>1200 || mamu(i,k)<0
            
            j=randperm(int);
            while j(1,1)==k || j(1,2)==k
                j=randperm(int);
            end
            a= j(1,1);
            b= j(1,2);
            for i=1:nbus
                mamu(i,k)= popu(i,k) + S*(popu(i,a)-popu(i,b));
                
            end
        end

    end
    
end
mamu
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -