The Solar Altitude Angle (also known as elevation angle) is the angle between the horizon and the center of the Sun's disk. It's a crucial factor in many applications, including solar energy, architecture, and astronomy. The altitude angle changes throughout the day and the year due to the Earth's rotation and its orbit around the Sun.
The Formula
The solar altitude angle ($\alpha$) can be calculated using the following formula, derived from spherical trigonometry:
Note that this formula assumes that the hour angle (H) is measured from solar noon. Solar noon, when the Sun is highest in the sky, corresponds to an hour angle of 0 degrees. For every hour away from solar noon, the hour angle increases by 15 degrees (360 degrees / 24 hours).
Key Inputs Explained:
Observer Latitude (L): This is your location's position north or south of the equator, measured in degrees. Values range from -90° (South Pole) to +90° (North Pole).
Solar Declination Angle (δ): This angle represents the tilt of the Earth's axis relative to the Sun. It varies throughout the year, reaching its maximum positive value (about +23.45°) around the summer solstice and its maximum negative value (about -23.45°) around the winter solstice. It is 0° during the equinoxes.
Hour Angle (H): This angle measures how far the Sun has moved across the sky from its highest point (solar noon). It's 0° at solar noon, 15° one hour after noon, 30° two hours after noon, and so on. It's negative for hours before solar noon.
Use Cases:
Solar Panel Efficiency: Knowing the solar altitude angle helps determine the optimal angle for mounting solar panels to capture the maximum amount of sunlight throughout the day and year.
Building Design: Architects use this to design buildings with overhangs or features that block high summer sun while allowing low winter sun to enter for passive heating.
Astronomy: It's fundamental for tracking celestial objects and understanding their position in the sky.
Agriculture: Understanding sun exposure is vital for crop growth.
Example Calculation:
Let's calculate the solar altitude angle for a location in the Northern Hemisphere during summer:
So, at 2 PM on the summer solstice at 40° N latitude, the Sun would be approximately 59.55 degrees above the horizon.
function calculateSolarAltitudeAngle() {
var latInput = document.getElementById("latitude");
var declinationInput = document.getElementById("solarDeclination");
var hourInput = document.getElementById("hourAngle");
var resultDiv = document.getElementById("result");
var latitude = parseFloat(latInput.value);
var solarDeclination = parseFloat(declinationInput.value);
var hourAngle = parseFloat(hourInput.value);
// Clear previous results or errors
resultDiv.innerHTML = ";
// Input validation
if (isNaN(latitude) || latitude 90) {
resultDiv.innerHTML = "Please enter a valid latitude between -90 and 90 degrees.";
return;
}
if (isNaN(solarDeclination) || solarDeclination 23.45) {
// While declination can theoretically be outside this range for extreme hypothetical scenarios,
// for typical Earth-based calculations, this range is standard.
// We'll allow it but warn if significantly out of expected bounds.
if (solarDeclination 45) {
resultDiv.innerHTML = "Solar declination is typically between -23.45° and +23.45°. Please check your input.";
return;
}
}
if (isNaN(hourAngle)) {
resultDiv.innerHTML = "Please enter a valid hour angle.";
return;
}
// Convert degrees to radians for Math functions
var latRad = latitude * Math.PI / 180;
var declinationRad = solarDeclination * Math.PI / 180;
var hourRad = hourAngle * Math.PI / 180;
// Calculate the cosine of the hour angle
var cosHour = Math.cos(hourRad);
// Calculate the terms for the arcsin function
var term1 = Math.sin(latRad) * Math.sin(declinationRad);
var term2 = Math.cos(latRad) * Math.cos(declinationRad) * cosHour;
// Calculate the argument for arcsin
var asinArg = term1 + term2;
// Ensure the argument is within the valid range [-1, 1] for arcsin
if (asinArg > 1) {
asinArg = 1;
} else if (asinArg < -1) {
asinArg = -1;
}
// Calculate the solar altitude angle in radians
var altitudeRad = Math.asin(asinArg);
// Convert the result back to degrees
var altitudeDeg = altitudeRad * 180 / Math.PI;
// Display the result, handling cases where the sun is below the horizon
if (altitudeDeg < 0) {
resultDiv.innerHTML = "Solar Altitude Angle: " + altitudeDeg.toFixed(2) + "° (Below Horizon)";
} else {
resultDiv.innerHTML = "Solar Altitude Angle: " + altitudeDeg.toFixed(2) + "°";
}
}