Calculating Daylight hours by latitude is essential for properly sizing a battery box and solar panel. There are several other factors that play significant roles in calculating power needed, however, it was difficult to find a simple formula for calculating daylight hours by latitude. The c# code is provided by SCADACore.

Here are several wikipedia pages available (http://en.wikipedia.org/wiki/Day_length), an additional page linked by wikipedia provides in depth calculations (http://herbert.gandraxa.com/length_of_day.xml)

A formula provided by a user of Mathforum.org provides the simplest formula for calculating day length (http://mathforum.org/library/drmath/view/56478.html).

 D = daylength
L = latitude
J = day of the year
   P = asin[.39795*cos(.2163108 + 2*atan{.9671396*tan[.00860(J-186)]})]
                         / sin(0.8333*pi/180) + sin(L*pi/180)*sin(P) \
   D = 24 - (24/pi)*acos{  -----------------------------------------  }
                         \_          cos(L*pi/180)*cos(P)           _/

The corresponding C# code is as follows:

public double CalculateHoursOfSunlightInDay(double latitude, int day)
{
double P = Math.Asin(.39795 * Math.Cos(.2163108 + 2 * Math.Atan(.9671396 * (Math.Tan(0.00860 * (day – 186))))));

double numerator = Math.Sin(0.8333 * Math.PI / 180) + Math.Sin(latitude * Math.PI / 180) * Math.Sin(P);
double denominator = Math.Cos(latitude * Math.PI / 180) * Math.Cos(P);

double hoursInDay = 24;

double dayLength = 24 – ((hoursInDay / Math.PI) * Math.Acos(numerator / denominator));

return dayLength;
}

With this calculation users can retrieve the data number of hours for a specific latitude.

SCADACore provides the Solar Panel Sizing field application to help field users properly size their SCADA solar battery boxes for specific climates. The following calculator from http://astro.unl.edu/ is useful in determining the number of daylight hours based on your location.

Please Install Flash To View This Application.
See Our Solar Power Monitoring Solutions