Optimize solar array. How can I make it for a yearly base?

2 views (last 30 days)
I need to optimize a solar array. How can I make it for a yearly base? I can't create a general program. I made one but it didn't get my actual result
clc;
clear all;
day=input('\n day=');
%insert the sequence of the day in the month, from 1 to 31
x=input('\n month=');%insert the corresponding number of the month, from 1 to 12
hour=input('\n hour=');%insert the hour in the 24 hoursystem(e.g.13 for 1 p.m)
min=input('minute=');%insert the minute,from 0 to 59
N=input('\n number of days in given month=');
L=input('local latitude in deg=');
Az=input('surface azimuth angle in deg=');%the values above is local and independent.
Hg=input('monthly mean daily global radiation on horizontal surface=');
HD=input('monthly mean daily diffuse radiation on horizontal surface=');
%%calculate of declination angle
x1=(360/365)*(284+n);
d=(23.45*sind(x1));%see equ(1)
fprintf('\n declination angle:%d',d);
%%calculation of houe angle
x2=hour+(min/60)-12;
h=x2*15;%see equ(2)
fprintf('\nhour angle:%d',h);
%%calculation of sun set hour angle
Hs=acosd(-tand(L)*tand(d));%sunset hour angle in degrees
fprintf('\n sunsethour angle:%d',Hs);
%%calculation of extra teristrial radiation
io=1373*(1+0.033*cosd(360*n)/365.25);
Ho=((N/pi)*(86400*io*cosd(L))*cosd(d)*(sind(Hs)-(Hs*cosd(Hs))));
fprintf('\n extra teristrial radiation:%d',Ho);
%%calculation of ground reflection beam radiation
HR=Hg*Ro*(1-cosd(Bt))/2;
fprintf('\n\n ground reflection beam radiation:%d',HR);
%%calculation of diffused beam radiation
Rd=((HB/Ho)*Rb)+(1-(HB/Ho))*((1+cosd(Bt))/2)*(1+(sqrt(HB/Hg)*sind(Bt/2^3)));
fprintf('\n\n rd:%d',Rd);
HD=Rd*HD;
fprintf('\n\n sky diffuse radiation:%d',HD);
%%calculation of total radiation on tilted surface
HT=HB+HR+HD;
fprintf('\n\n total radiation tilt surface:%d',HT);
clc;
clearall;
di=input('\n day sequence from month1=');%insert thesequence of the dayinthemonth,from1to31
D2=input('\n day sequence from month2=');%insert thesequence of the dayinthemonth,from32to60
D3=input('\n day sequence from month3=');%insert thesequence of the dayinthemonth,from335to365
L=input('local latitude in deg=10.82');
Az=input('surface azimuth angle in deg=36.79');%the values above is local and independent.
%%calculation of average declinatiion angle
D1=23.45*sind(284+D1)*(360/365);
fprintf('\n declination for month1:%d',D1);
D2=23.45*sind(284+D2)*(360/365);
fprintf('\n declination for month2:%d',D2);
D3=23.45*sind(284+D3)*(360/365);
fprintf('\n declination for month3:%d',D3);
D=(D1+D2+D3)/3;
fprintf('\n average seasonal declination angle:%d',D);
cday=input('\n day=');%insert the sequence of the dayin the month,from 1 to 31
x=input('\n month=');%insert the corresponding number of themonth,from1to12
hour=input('\n hour=');% insert the hour in the 24 hoursystem (e.g. 13 for 1 p.m.)
min=input('minute=');%insert the minute ,from 0 to 59
Hg=input('monthly mean daily global radiation onhorizontal surface=');
HD=input('monthly mean daily diffuse radiation onhorizontal surface=');
Ro=0.2;
%%calculation of day sequence
m=[0 31 59 90 120 151 181 212 243 273 304 334];
N=m(x)+day;%this step evaluate the day sequence number of the year
fprintf('\nday number:%d',N);
%%calculation of hour angle
x2=hour+(min/60)-12;
h=x2*15;%see equ(2)
fprintf('\nhour angle:%d',h);
%%calculation of altitude angle
a=asind(sin(L)*sind(D)+cosd(L)*cosd(h));%see equ(3)
fprintf('\n altitude angle:%d',a);
%%calculation of zenith angle
Zs=90-a;
fprintf('\n solar zenith angle:%d',Zs);
%%calculation of seasonal tilt angle
Bt=atand(((sind(L)*cosd(D)*cosd(Az)*cosd(h))-(cosd(L)*sind(D)*cosd(Az))+(cosd(D)*sind(h)))/cosd(Zs));
fprintf('\n average seasonal tilt angle:%d',Bt);
%%calculation of sun set hour angle
Hs=acosd(-tand(L)*tand(D));
fprintf('\n sunsethour angle:%d',Hs);
hs1=acos(-tand(L)*tand(D));%sunset hour angle in
radians
fprintf('\n sunsethour angle:%d',hs1);
%%calculation of direct beam radiation
Rb=((cosd(L-Bt)*cosd(D)*sind(Hs))+(hs1*sind(LBt)*sind(D)))/((cosd(L)*cosd(D)*sind(Hs))+(hs1*sind(L)*sind(D)));
Rb=abs(Rb);
fprintf('\n\n rb:%d',Rb);
HB=(Hg-HD)*Rb;%direct beam radiation
fprintf('\n\n direct beam radiation:%d',HB);
%%calculation of ground reflection beam radiation
HR=Hg*Ro*(1-cosd(Bt))/2;
fprintf('\n\n ground reflection beam radiation:%d',HR);
%%calculation of diffused beam radiation
Rd=(1+cosd(Bt))/2;
fprintf('\n\n rd:%d',Rd);
HD=Rd*HD;
fprintf('\n\n sky diffuse radiation:%d',HD);
%%calculation of total radiation on tilted surface
HT=HB+HR+HD;
fprintf('\n\n total radiation tilt surface:%d',HT);
ELSE if(ch==3)
clearall;
clc;
day=input('\n Day=');%insert the sequence of the day in
the month,from 1 to 31
x=input('\n Month=');%insert the corresponding number
of the month,from 1 to 12
hour=input('\n Hour=');%insert the hour in the 24 hour system(e.g.13 for 1 p.m.)
min=input('minute=');%insert the minute from 0 to 59
L=input('\n local latitude in deg=');
Hg=input('monthly mean daily global radiation onhorizontal surface=');
Hd=input('monthly mean daily diffuse radiation onhorizontal surface=');
Ro=0.2;
%%calculation of day sequence
m=[0 31 59 90 120 151 181 212 243 273 304 334];
N=m(x)+day;%this step evaluate the day sequence number in the year
fprintf('\nday number:%d',N);
%%calculate of declination angle
x1=(360/365)*(284+N);
D=(23.45*sind(x1));%see equ(1)
fprintf('\n declination angle:%d',D);
%%calculation of hour angle
x2=hour+(min/60)-12;
h=x2*15;%see equ(2)
fprintf('\nhour angle:%d',h);
%%calculation of altitude angle
a=asind(sin(L)*sind(D)+cosd(L)*cosd(D)*cosd(h));%see equ(3)
fprintf('\n altitude angle:%d',a);
%%calculation of zenith angle
Zs=90-a;
fprintf('\n solar zenith angle:%d',Zs);
%%calculation of seasonal tilt angle
Bt=atand(((sind(L)*cosd(D)*cosd(Az)*cosd(h))-(cosd(L)*sind(D)*cosd(Az))+(cosd(D)*sind(Az)*sind(h)))/cosd(Zs));
fprintf('\n average seasonal tilt angle:%d',Bt);
%%calculation of sun set hour angle
Hs=acosd(-tand(L)*tand(D));
fprintf('\n sunsethour angle:%d',Hs);
hs1=acos(-tand(L)*tand(D));%sunset hour angle in
radians
fprintf('\n sunsethour angle:%d',hs1);
%%calculation of direct beam radiation
Rb=((cosd(L-Bt)*cosd(D)*sind(Hs))+(hs1*sind(LBt)*sind(D)))/((cosd(L)*cosd(D)*sind(Hs))+(hs1*sind(L)*sind(D)));
Rb=abs(Rb);
fprintf('\n\n rb:%d',RB);
HB=(Hg-Hd)*RB;%direct beam radiation
fprintf('\n\n direct beam radiation:%d',HB);
%%calculation of ground reflection beam radiation
HR=Hg*Ro*(1-cosd(Bt))/2;
fprintf('\n\n ground reflection beam radiation:%d',HR);
%%calculation of diffused beam radiation
Rd=(1+cosd(Bt))/2;
fprintf('\n\n Rd:%d',Rd);
HD=Rd*HD;
fprintf('\n\n sky diffuse radiation:%d',HD);
%%calculation of total radiation on tilted surface
HT=HB+HR+HD;
fprintf('\n\n total radiation tilt surface:%d',HT);
%%calculate annual optimum angle
%optimum tilt = latitude angle in degree*Multiplication factor+Additional degrees

Answers (0)

Categories

Find more on Condensed Matter & Materials Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!