Skip to content
Browse files

Fixed Micro objective function

  • Loading branch information...
1 parent 1de11e4 commit e7c248106d9560e32cc6ccb1d2715ade462e645e Narasimha Prasad committed Mar 1, 2012
Showing with 132 additions and 12 deletions.
  1. +3 −2 ITHS.m
  2. +4 −4 boundary.m
  3. +42 −0 main.m
  4. +8 −5 micro.m
  5. +73 −0 pwr.m
  6. +2 −1 uwflo.m
View
5 ITHS.m
@@ -7,7 +7,7 @@
MCR=0.99;
PARMI=0;
PARM=1;
-MAXITER=100000;
+MAXITER=100;
%--------------------END OF INITIALIZATION----------------------------------
MAXT=1;
%%
@@ -18,7 +18,8 @@
for trial=1:MAXT
for hms=1:1
for popu=1:1
- i=0;
+ i=1;
+ HM(1,1:N)=umin+50;
while( i < MS(hms))
i=i+1;
%FOR RANDOMLY GENERATING THE N variables
View
8 boundary.m
@@ -12,10 +12,10 @@
k = 1;
for i =1:2:2*j
- lb(1,i) = xlb(k);
- lb(1,i+1) = ylb(k);
- ub(1,i) = xub(k);
- ub(1,i+1) = yub(k);
+ lb(1,i) = ylb(k);
+ lb(1,i+1) = xlb(k);
+ ub(1,i) = yub(k);
+ ub(1,i+1) = xub(k);
k = k+1;
end
View
42 main.m
@@ -0,0 +1,42 @@
+close all
+clear
+clc
+
+
+
+global Dj
+global alpha
+global a
+global U0
+global Aj
+global theta
+% global newpower
+global f1
+
+grid = load('Gradycasebgrid','grid');
+k = 1;
+M = numel(grid.grid);
+coord = gridnumber(grid.grid);
+Y = coord(:,1);
+X = coord(:,2);
+[lmicro umicro] = boundary(X,Y);
+U0=12;
+Dj = 40;
+Aj = pi*Dj^2/4;
+alpha = 0.09436;
+a = 0.326795;
+
+for theta = 0.628:0.628:10*0.628
+ [f1(k,1),f(k,1)] = pwr(grid.grid);
+ t(k,1) = theta;
+ k = k+1;
+end
+
+%%
+theta = 1*0.628;
+[D D1 D2 D3 D4] = ITHS(2*M,lmicro,umicro,@micro);
+[xmicro ymicro] = microlayout(D3,M);
+NewPower = (1-D4)/D4;
+delnp = f1(5)-NewPower;
+znew = [xmicro' ymicro'];
+% znew = sortrows(znew,[2,1]);
View
13 micro.m
@@ -6,10 +6,12 @@
global alpha
global U0
global micro
-global newpower
+% global newpower
+global theta
+global f1
%% Variables
-theta = 0; %Angle of wind
+% theta = 3.14; %Angle of wind
N = numel(wf)/2; % Number of turbines
M = zeros(N,N);
power = zeros(1,N);
@@ -24,7 +26,7 @@
end
-micro = sortrows(micro,[2 1]);
+% micro = sortrows(micro,[2 1]);
Yi = micro(:,1);
Xi = micro(:,2);
x = cos(theta)*Xi - sin(theta)*Yi;
@@ -73,10 +75,11 @@
%% Objective function
- newpower = sum(power);
+ delta = (sum(power)-f1(1));
+ newpower = f1(1) + delta;
mov = abs(micro - windfarm);
xmov = sum(mov(:,1));
ymov = sum(mov(:,2));
summov = xmov + ymov;
- f = summov/(newpower)^2;
+ f = 1/(newpower);
end
View
73 pwr.m
@@ -0,0 +1,73 @@
+function [f,f1] = pwr(wf)
+
+%% Global variables initialisation
+global windfarm
+global Dj
+% global cost
+global alpha
+global U0
+global theta
+
+
+%% Variables
+% theta = 3.14; %Angle of wind
+C = numel(wf);
+cost = C*((2/3)+((1/3)*exp((-0.00174)*(C^2))));
+N = numel(wf); % Number of turbines
+M = zeros(N,N);
+chk = zeros(N-1,N);
+power = zeros(1,N);
+
+%% Wind Farm co-ordinate
+coord = gridnumber(wf); %grid co-ordinates of turbines
+Yi = coord(:,1);
+Xi = coord(:,2);
+x = cos(theta)*Xi - sin(theta)*Yi;
+y = sin(theta)*Xi + cos(theta)*Yi;
+windfarm = [x y];
+
+%% Wake matrix
+for i = 1:1:N-1
+ for j = i+1:1:N
+deltax = x(i) - x(j);
+deltay = y(i) - y(j); %#ok<*IJCL>
+
+if abs(deltax) < 199 && abs(deltay) < 199 == 1
+ chk(i,j) = 1; %Grid Check
+else
+ chk(i,j) = 0;
+end
+
+Dwake = Dj + 2*alpha* deltax;
+
+if (deltax > 0 && abs(deltay)-Dj/2 < Dwake/2)
+ M(i,j) = 1; %Wake Matrix
+ M(j,i) = -1; %Wake Matrix
+else
+ M(i,j) = 0;
+end
+ end
+end
+
+%% Power Generation calculation
+for l = 1:1:N
+ r = find(M(:,l)>0);
+ s = find(chk(:,l)>0, 1);
+ if isempty(s) == 0
+ U = 0;
+ else
+ if isempty(r) == 1
+ U = U0;
+ else
+ U = calcvel(r,l);
+ end
+ end
+
+ power(l) = 0.3*(U^3);
+end
+
+%% Objective function
+ totalpower = sum(power);
+ f1 = cost/totalpower;
+ f = totalpower;
+end
View
3 uwflo.m
@@ -8,7 +8,7 @@
global U0
%% Variables
-theta= 0; %Angle of wind
+theta = 0; %Angle of wind
N = numel(wf); % Number of turbines
M = zeros(N,N);
chk = zeros(N-1,N);
@@ -65,4 +65,5 @@
%% Objective function
totalpower = sum(power);
f = cost/totalpower;
+
end

0 comments on commit e7c2481

Please sign in to comment.
Something went wrong with that request. Please try again.