You are on page 1of 3

#include"iostream.

h"
#include"conio.h"
#include"stdio.h"
#include"math.h"

int main()
{
double a1=0,b1=0,c1=0;
double temp=0, d1=0;
double yp=0,xp=0,mp=0,Cp=0;
double Xe1=0,Ye1=0,Xe2=0,mg=0,Cg=0;
double xe1=0,xe2=0,a=0,b=0,xqm=0,yqm=0,mqm=0,cqm=0,aqm=0,bqm=0,Iq=0,Iqy=0;
double nc=0,nf=0,i=0,cqm1=0,aqm1 =0,bqm1 = 0,Yn =0,deln =0,Rn =0,beta = 0,bn = 0
,qn=0,n=0,decl=0;
double xdn=0,ydn=0,mdn=0,Cd=0;
double decls=0,xds=0,yds=0,mds=0,Cds=0,S=0;

cout<<"\n Enter yp value";


cin>>yp;
//******************************************************************************
**********
yp = 1.43287; //y-ordinate of point Pn (main factor to change the size)
xp = 2*yp; //y-coordinate of point Pn
mp = 1/(2*xp); //slope of point Pn
Cp = yp-mp*pow(xp,2); //y-intercept of point Pn
//YP = mp*x^2 + Cp; general equation of parabola
//disp(['Yp = ' num2str(mp) ' * x^2 ' num2str(+ Cp) ]);
cout<<"\nYp = "<<mp<<"*x^2+ ("<<Cp<<")";

Xe1 = 1.32387*yp/1.43287; //x-coordinate of point E1


Ye1 = .30578*yp/1.43287; //y-coordinate of point E2
Xe2 = 4.06387*yp/1.43287; //x-coordinate of point E2
mg = 0.94; //slope of the cutting section of the reflector frame
Cg = Ye1-mg*Xe1; //y-intercept of the cutting section of the reflector frame
//Yg = mg * x + Cg; //equation of the cutting section of the reflector frame
//disp(['Yg = ' num2str(mg) ' * x ' num2str(+ Cg) ]);
cout<<"\nYg = "<<mg<<"*x+ ("<<Cg<<")";
//******************************************************************************
**********
a1=mg/(2*mp);
b1=(Cp-Cg)/mp;
c1=pow(a1,2)-b1;
xe1 = a1+pow(c1,0.5);
a1=0,b1=0,c1=0;
a1=mg/(2*mp);
b1=(Cp-Cg)/mp;
c1=pow(a1,2)-b1;
xe2 = a1-pow(c1,0.5);
a1=0,b1=0,c1=0;
a1=mg/(2*mp);
b1=(Cp-Cg)/mp;
c1=pow(a1,2)-b1;
a = pow(c1,0.5); //semi-minor axis of the ellipse
b = a/cos(43.23); //semi-major axis of the ellipse
xqm = (Xe1+Xe2)/2; //x-cordinate of the middle crossbar
yqm = mg*xqm+Cg; //y-coordinate of the middle crossbar
mqm = -1.06377; //slope of the middle crossbar
cqm = yqm-xqm*mqm; //y-intercept of the middle crossbar
a1=0,b1=0,c1=0;
a1=mqm/(2*mp);
b1=(Cp-cqm)/mp;
c1=pow(a1,2)-b1;
aqm = pow(c1,0.5); //semi- minor axis of the middle crossbar
bqm = aqm/0.6849; //semi- major axis of the middle crossbar
Iq = 0.48; //distance between consecutive crossbars
Iqy = Iq/0.6849;
//******************************************************************************
**********

nc = b/0.48; //no. of crossbars required


nf = floor(nc);
for (i=-nf;i<=nf;i++)
{
cqm1 = cqm + i * Iqy; //y-intercept of ith crossbar
a1=0,b1=0,c1=0;
a1=mqm/(2*mp);
b1=(Cp-cqm)/mp;
c1=pow(a1,2)-b1;
aqm1 = pow(c1,0.5); //semi minor axis of ith crossbar
bqm1 = aqm1/.6849; //semi major axis of ith crossbar
a1=0,b1=0,c1=0;
a1=pow(b,2);
temp=i*Iq;
b1=pow(temp,2);
c1=a1-b1;
Yn = cos(43.23)*pow(c1,0.5);
a1=0,b1=0,c1=0;
a1=pow(aqm1,2);
b1=pow(Yn,2);
c1=a1-b1;
d1=pow(c1,0.5);
deln = (aqm1-d1)/cos(46.77); //reflector depth for ith crossbar
a1=0,b1=0,c1=0, d1=0;
a1=pow(deln,2);
b1=pow(Yn,2);
Rn = (a1+b1)/(2*deln); //radius of nth crossbar
beta = 180/3.14*asin(Yn/Rn); //angle of ith crossbar
bn = 2*Rn*beta*3.14/180; //half crossbar of ith crossbar
//disp(['Q' num2str(i) '= ' num2str(mqm) ' * x ' num2str(cqm1) ]);
cout<<"\n"<<"Q"<<i<<" = "<<mqm<<"*x ("<<cqm1<<")";
}
cout<<"qn ="<<mqm<<"*x+ "<<cqm;
cout<<"\n Enter no of day of the year value";
cin>>n;
//n = 110;no. of day of the year
decl = 180/3.14*(0.006918-0.399912*cos(2*3.14/365*(n-1)) + 0.070257*sin(2*3.14/3
65*(n-1))-0.006758*cos(2*(2*3.14/365*(n-1))) + 0.000907*sin(2*(2*3.14/365*(n-1))
)-0.002697*cos(3*(2*3.14/365*(n-1))) + 0.00148*sin(3*(2*3.14/365*(n-1)))); //sol
ar declination on nth day of the year

//******************************************************************************
**********
//For northern hemisphere
xdn = (2.69338*yp/1.43287)*cos(decl)-(1.26569*yp/1.43287-1.43287)*sin(decl); //x
-coordinate for the seasonal equation
ydn = 2.69338* sin(decl)+(1.26569-1.43287)*cos(decl)+1.43287; //y-coordinate for
the seasonal equation
mdn = tan(43.223+ decl/2)/(2*xdn); //solpe of seasonal equation
Cd =ydn-(mdn)*pow(xdn,2); //y-intercept on nth day of the equation
//disp(['Yn = ' num2str(mdn) ' * x ' num2str(+ Cd) ]);
cout<<"\n"<<"Yn = "<<mdn<<"*x +("<<Cd<<")";
//******************************************************************************
**********
//For southern hemisphere
decls = -decl;
xds = (2.69338*yp/1.43287)*cos(decls)-(1.26569*yp/1.43287-1.43287)*sin(decls); /
/x-coordinate for the seasonal equation
yds = 2.69338* sin(decls)+(1.26569-1.43287)*cos(decls)+1.43287; //y-coordinate f
or the seasonal equation
mds = tan(43.223+ decls/2)/(2*xds); //slope of seasonal equation
Cds = yds-(mds)*pow(xds,2); //Y-intercept on nth day of the equation
cout<<"\n"<<"Ys = "<<mds<<"*x + ("<<Cds<<")";
cout<<"\n"<<"Yg = "<<mg<<"*x + ("<<Cg<<")";
cout<<"\n"<<"Yp = "<<mp<<"*x + ("<<Cp<<")";
//disp(['Ys = ' num2str(mds) ' * x ' num2str(+ Cds) ]);
//disp(['Yg = ' num2str(mg) ' * x ' num2str( Cg) ])
//disp(['Yg = ' num2str(mp) ' * x ' num2str( Cp) ])
S = pow(yp,2)*3.94; //surface area of the Scheffler reflector
cout<<"\nCollector Area ="<<S;
getch ();
}

You might also like