# Solar Analysis

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM56sVnwRsQuFEA0u6%2FSolar.png?alt=media\&token=cf4e68e9-2af4-466b-958e-cb5d3f5f23cf)

```d
cp=Point.Origin();
rd=3;
a1=Line.ByStartPointDirectionLength(Point.ByCoordinates(rd,0,0),Vector.ZAxis(),rd);
a2=Arc.ByCenterPointStartPointEndPoint(cp,Point.ByCoordinates(0,0,rd),Point.ByCoordinates(rd,0,0));
asrf=Surface.ByRevolve(a2,cp,Vector.ZAxis(),0,360);

//Solar Study
solarstudy=SolarAnalysis.Analyze(Weather.ByLatitudeLongitude
(12.9716,77.5946),asrf,[],
TimeStudy.FromStartTimeToEndTime(DSCore.DateTime.
FromString("April 30, 2016 9:00 AM"),DSCore.DateTime.
FromString("April 29, 2017 6:00 PM"),false),0.125,0);
cumulative=List.Flatten(solarstudy["Cumulative"],1);
average=List.Flatten(solarstudy["Average"],1);
peak=List.Flatten(solarstudy["Peak"],1);
calculationpoints=List.Flatten(solarstudy["Calculation Points"],1);

cumPt=List.SortByKey(Flatten(calculationpoints),Flatten(cumulative))["sorted list"];
avgPt=List.SortByKey(Flatten(calculationpoints),Flatten(average))["sorted list"];
pekPt=List.SortByKey(Flatten(calculationpoints),Flatten(peak))["sorted list"];

//Colors
Color.ByARGB(255,[0,0,255],[0,255,0],[255,0,0]);
0..2;
0..1..#List.Count(cumPt);

//Angles
cumPhi=(Vector.XAxis()).AngleWithVector(((List.LastItem(cumPt)).Project(Plane.XZ(),Vector.YAxis())).AsVector());
cumThe=(Vector.XAxis()).AngleWithVector(((List.LastItem(cumPt)).Project(Plane.XY(),Vector.ByCoordinates(0,0,-1))).AsVector());

avgPhi=(Vector.XAxis()).AngleWithVector(((List.LastItem(avgPt)).Project(Plane.XZ(),Vector.YAxis())).AsVector());
avgThe=(Vector.XAxis()).AngleWithVector(((List.LastItem(avgPt)).Project(Plane.XY(),Vector.ByCoordinates(0,0,-1))).AsVector());

pekPhi=(Vector.XAxis()).AngleWithVector(((List.LastItem(pekPt)).Project(Plane.XZ(),Vector.YAxis())).AsVector());
pekThe=(Vector.XAxis()).AngleWithVector(((List.LastItem(pekPt)).Project(Plane.XY(),Vector.ByCoordinates(0,0,-1))).AsVector());
```

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM5GeQn-dGGq6uM6iE%2FSolar-1.jpg?alt=media\&token=f4d2f69a-ad3b-421b-a867-5f6a882dc284)

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM5K7xCxt-YpdPluFI%2FSolar-02.jpg?alt=media\&token=6dce3d28-e848-4bd4-b312-f342dca6a5a5)

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM5MlYgQK_Kajs3bRJ%2FSolar-03.jpg?alt=media\&token=619c5d44-fb5e-4473-ae38-66a576e29fbf)

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM5PDrKcBZg9dHhygV%2FSolar-04.jpg?alt=media\&token=0f59f95d-4982-4cc0-a100-4cd7fc872811)

![](https://1430428134-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ld8QK19sjP1I9rhLouo%2F-LhM4xg4g_mV0LJLjGoh%2F-LhM5S6uu50KGa1aCfHK%2FSolar-05.jpg?alt=media\&token=ce45c61f-3bd3-410d-b928-ee2d2fbfba0f)
