Calculate cartesian angle from Sun's Azimuth and Elevation

97 Views Asked by At

I'm trying to program a one-axis N-S solar tracker for my Photovoltaic Array.

The array tilts only on the y-axis, so in order to get the optimum angle independent from the season I need to calculate the angle that the sun position would project into an x-z plane. In that case the angle of the vector (0,0)(x,z).

enter image description here

const x = radius * Math.cos(elevation) * Math.sin(azimuth);
const y = radius * Math.cos(elevation) * Math.cos(azimuth);
const z = radius * Math.sin(elevation);

I've tried to apply the above formulas to convert the sun's position to cartesian coordinates, and it should plot the Sun travel as a curve, but as you can see it is failing.

enter image description here

If that worked, I would need to get the Q angle. Can someone help me?

1

There are 1 best solutions below

0
On BEST ANSWER

So the solution was so simple as to feed the Azimuth and Elevation angles in radians. I was feeding them in degrees. (DOH)