Optimize your solar energy output by finding the ideal tilt angle for your panels.
Solar Panel Tilt Calculator
Enter latitude in degrees (e.g., 34.05 for Los Angeles). Northern Hemisphere positive, Southern Hemisphere negative.
January
February
March
April
May
June
July
August
September
October
November
December
Select the month for which you want to optimize the tilt angle.
True South
True North
True East
True West
Select the direction your solar panels face. 'True South' is optimal for Northern Hemisphere, 'True North' for Southern.
Your Results
Optimal Tilt Angle:
Solar Declination:
Average Angle of Incidence:
Key Assumptions
Annual Energy Production by Tilt Angle
Chart shows estimated relative energy production at different tilt angles throughout the year.
Tilt Angle Optimization Data
Monthly Energy Production vs. Tilt Angle
Month
Optimal Tilt (Degrees)
Estimated Relative Production (%)
Solar Declination (Degrees)
What is Solar Panel Tilt Angle Optimization?
Optimizing the solar panel tilt angle refers to the process of determining the ideal angle at which to position your solar panels relative to the horizon to maximize the amount of sunlight they capture throughout the year, or during specific seasons. Solar panels are most efficient when sunlight strikes their surface perpendicularly. Since the sun's position in the sky changes daily and seasonally due to the Earth's axial tilt, a fixed-tilt solar panel system will not always be perfectly aligned with the sun. By adjusting the tilt angle, you can significantly improve the energy yield from your solar photovoltaic (PV) or solar thermal systems.
Who should use a solar panel tilt calculator?
Homeowners and businesses installing new solar panels who want to maximize their electricity generation.
Existing solar system owners looking to improve performance, perhaps by adjusting their panels seasonally.
Solar installers and designers who need to provide accurate performance estimates to clients.
Renewable energy enthusiasts and students learning about solar energy principles.
Common Misconceptions about Solar Panel Tilt:
"Steeper is always better": While steeper angles are good for winter sun, they can be detrimental in summer. The optimal angle is a balance.
"One angle fits all": The ideal tilt angle depends heavily on latitude, seasonal energy needs, and even panel orientation (due to the sun's path).
"Seasonal adjustments are too complex": While manual seasonal adjustments require effort, a good calculator can simplify determining the best angles for different periods. Many modern systems offer automated tracking.
"Tilt doesn't matter as much as panel quality": While panel efficiency is crucial, optimizing tilt can increase energy output by 5-15% or more annually, a significant gain.
Solar Panel Tilt Angle Formula and Mathematical Explanation
The core principle behind optimizing solar panel tilt is to position the panel to be as perpendicular as possible to the sun's rays. The sun's apparent position in the sky is influenced by two main factors: the Earth's rotation (daily cycle) and the Earth's orbit around the sun combined with its axial tilt (seasonal cycle). The solar panel tilt angle is typically optimized based on:
Latitude (L): Your location's position north or south of the equator.
Solar Declination (δ): The angle between the sun's rays and the plane of the Earth's equator. It varies from approximately +23.45° in summer to -23.45° in winter.
Hour Angle (ω): The angular displacement of the sun east or west of the local meridian. This is for tracking the sun's position throughout the day, but for fixed tilt optimization, we often consider average daily or monthly positions.
Panel Orientation: The azimuth angle (direction the panel faces).
For a fixed-tilt system aiming for year-round optimal performance, a common rule of thumb is to set the tilt angle equal to the latitude. However, to maximize energy production during specific seasons, adjustments are made.
Simplified Formula for Optimal Tilt (Year-Round):
Optimal Tilt Angle (β) ≈ Latitude (L)
This provides a good average, but is not ideal for maximizing seasonal output.
Formula for Optimal Tilt (Seasonal Optimization):
To maximize energy capture during a specific month or season, the ideal tilt angle (β) aims to make the panel's angle perpendicular to the sun's rays at solar noon.
β ≈ |Latitude (L) – Solar Declination (δ)|
Where:
β (Beta): The solar panel tilt angle from the horizontal (in degrees).
L (Latitude): Your location's latitude in degrees. Positive for Northern Hemisphere, negative for Southern.
δ (Delta): The solar declination angle for the specific day or average for the month (in degrees).
Calculating Solar Declination (δ):
A common approximation for solar declination (δ) on day 'n' of the year (where n=1 is January 1st) is:
Note: The 'n + 284' offset ensures correct phase alignment with the seasons.
Angle of Incidence Calculation:
The angle of incidence (θ) is the angle between the sun's rays and the normal (perpendicular line) to the solar panel surface. Lower angles of incidence mean more direct sunlight.
A_panel is Panel Azimuth Angle (0° for South-facing in NH, North-facing in SH)
For simplicity in this calculator, we often focus on the solar noon angle of incidence, where the solar azimuth angle is 0.
Table of Variables:
Solar Panel Tilt Calculation Variables
Variable
Meaning
Unit
Typical Range
Latitude (L)
Angular distance north or south of the equator
Degrees
-90° to +90°
Solar Declination (δ)
Angle between sun's rays and Earth's equatorial plane
Degrees
-23.45° to +23.45°
Tilt Angle (β)
Angle of the panel from the horizontal
Degrees
0° to 90°
Panel Orientation (Azimuth)
Direction the panel faces (0°=South/North, 90°=East, -90°=West)
Degrees
-180° to +180°
Angle of Incidence (θ)
Angle between sun's rays and panel normal
Degrees
0° to 90° (lower is better)
Day of Year (n)
Sequential day number from Jan 1st
Integer
1 to 365
Practical Examples (Real-World Use Cases)
Example 1: Maximizing Winter Energy for a Homeowner in Chicago
Location: Chicago, Illinois, USA
Latitude (L): Approximately 41.88° N
Target Month: January (Winter)
Panel Orientation: True South
Inputs for Calculator:
Latitude: 41.88
Month: January (1)
Panel Orientation: True South
Calculator Output (Estimated):
Optimal Tilt Angle: ~55-60°
Solar Declination (Jan avg): ~ -20°
Estimated Relative Production Increase: ~15-20% compared to latitude tilt.
Interpretation: For Chicago in January, a steeper tilt angle than the latitude (~42°) is needed to capture the lower winter sun more directly. This maximizes electricity generation during the month with the least sunlight and potentially highest heating demand.
Example 2: Year-Round Optimization for a Commercial Installation in Sydney
Location: Sydney, Australia
Latitude (L): Approximately -33.87° S
Target: Year-round average performance
Panel Orientation: True North (optimal for Southern Hemisphere)
Inputs for Calculator:
Latitude: -33.87
Month: Choose July (mid-winter in SH) or average across months (calculator provides monthly view). Let's use July for calculation.
Panel Orientation: True North
Calculator Output (Estimated for July):
Optimal Tilt Angle: ~35-40° (adjusting for latitude and solar declination)
Solar Declination (July avg): ~ +18°
Estimated Relative Production Increase: ~10-15% compared to flat tilt.
Interpretation: For Sydney, the optimal tilt is influenced by the southern latitude. While a latitude-based tilt (~34°) is a good starting point for year-round performance, calculating for specific months like July (winter) shows a slightly higher optimal angle to catch the lower sun. The calculator helps visualize this monthly variation. For year-round optimization, often the latitude tilt is chosen for simplicity, or a slightly lower angle if summer sun is prioritized.
How to Use This Solar Panel Tilt Calculator
Our Solar Panel Tilt Calculator is designed to be intuitive and provide actionable insights for optimizing your solar energy system. Follow these simple steps:
Enter Your Latitude: Locate your property on a map and find its latitude. Input this value in degrees. Remember, positive values are for the Northern Hemisphere, and negative values are for the Southern Hemisphere.
Select the Month: Choose the month for which you want to optimize the tilt angle. This is crucial because the sun's position changes significantly throughout the year. Selecting a winter month will suggest a steeper angle, while a summer month will suggest a shallower angle.
Choose Panel Orientation: Specify the direction your solar panels face (azimuth). For the Northern Hemisphere, "True South" is generally best. For the Southern Hemisphere, "True North" is optimal. East and West orientations are also options but will produce less energy overall.
Calculate: Click the "Calculate Optimal Tilt" button.
How to Read the Results:
Optimal Tilt Angle: This is the primary result – the angle in degrees from the horizontal that your panels should be set to maximize solar absorption for the selected month and location.
Intermediate Values:
Solar Declination: Shows the sun's angle relative to the Earth's equator for that month.
Average Angle of Incidence: A measure of how directly sunlight hits the panel surface. Lower is better.
Main Highlighted Result: The "Optimal Tilt Angle" is prominently displayed, often as the main takeaway.
Formula Explanation: A brief overview of the calculation method used is provided for transparency.
Assumptions: Lists key factors considered, such as perfect panel orientation and clear sky conditions.
Decision-Making Guidance:
Fixed vs. Seasonal Tilt: If your system allows for manual adjustments, use the calculator to determine the best angle for the current season. Adjusting twice a year (e.g., spring/autumn) is common.
Year-Round Compromise: If seasonal adjustments aren't feasible, setting the tilt angle equal to your latitude often provides the best overall annual energy production.
Compare Monthly Values: Use the monthly options to understand the seasonal variations and choose a compromise angle if needed.
Impact on Installation: Discuss these optimal angles with your solar installer to ensure the mounting system can accommodate the desired angles.
Key Factors That Affect Solar Panel Tilt Results
While the latitude and month are primary inputs, several other factors influence the true optimal tilt angle and overall solar energy production:
Latitude: This is the most significant factor. Locations closer to the equator have a more direct sun path year-round, requiring less extreme tilt angles. Polar regions require much steeper angles, especially in winter.
Seasonal Energy Needs: Do you need more power in winter (for heating) or summer (for air conditioning)? Optimizing for winter requires a steeper tilt; optimizing for summer requires a shallower tilt. Our calculator helps by letting you select the month.
Panel Orientation (Azimuth): Panels facing true south (in the Northern Hemisphere) or true north (in the Southern Hemisphere) receive the most direct sunlight throughout the day. East-facing panels peak in the morning, and west-facing panels peak in the afternoon. The calculator accounts for this, though South/North orientation yields the highest overall production. An imperfect azimuth angle significantly impacts output.
Shading and Obstructions: Trees, buildings, or other obstructions can cast shadows on panels, drastically reducing their output. The ideal tilt angle should also consider avoiding shade, especially during peak sun hours. This calculator assumes no shading.
Weather Patterns and Cloud Cover: Regions with frequent cloud cover might benefit from tilt angles that perform better under diffuse light conditions, though direct sunlight optimization is still primary. Seasonal cloud patterns can influence the best compromise angle.
Local Climate and Snowfall: In snowy regions, a steeper tilt angle (e.g., >40-45°) helps snow slide off the panels more easily, preventing prolonged periods of reduced or zero energy production during winter months.
Fixed vs. Tracking Systems: This calculator primarily addresses fixed-tilt systems. Solar trackers automatically adjust the panel's orientation and tilt throughout the day and year to follow the sun, achieving significantly higher energy yields (up to 25-40% more) but at a higher cost and complexity.
Installation Constraints: Roof pitch, available space, and structural limitations might prevent achieving the mathematically optimal tilt angle. A practical compromise is often necessary.
Frequently Asked Questions (FAQ)
What is the difference between solar panel tilt and azimuth?
Tilt is the angle of the panel relative to the horizontal ground (0° is flat, 90° is vertical). Azimuth is the compass direction the panel faces (0° is typically South in the Northern Hemisphere, 180° North in the Southern Hemisphere; 90° is East, 270° West). Both are critical for maximizing solar energy capture.
Is it worth adjusting my solar panels seasonally?
For fixed-mount systems, seasonal adjustments can increase annual energy yield by 5-15%. If you can easily adjust the tilt (e.g., ground mounts or certain roof mounts), it can be beneficial, especially if you have distinct seasonal energy needs.
What is the 'best' tilt angle for year-round performance?
A common rule of thumb for year-round performance is to set the tilt angle equal to your location's latitude. However, optimizing based on the monthly calculator results and choosing a compromise angle (often slightly steeper than latitude for winter bias) can yield slightly better results.
Do I need to worry about tilt angle in the Southern Hemisphere?
Yes, the principles are the same, but the optimal orientation shifts. In the Southern Hemisphere, panels should ideally face True North, and the tilt angle calculations adjust accordingly based on the negative latitude value.
How does tilt angle affect solar thermal (water heating) panels?
The principles are similar, but solar thermal panels often benefit from slightly steeper angles than PV panels, especially in colder climates, to aid in drainage and reduce snow accumulation, while still capturing maximum solar radiation.
Can I use the calculator if my latitude is 0 (on the equator)?
Yes. If your latitude is 0, the optimal tilt angle will closely follow the solar declination angle, changing significantly between summer (+23.45°) and winter (-23.45°). You'll likely want to adjust seasonally or find a compromise angle near flat.
What is solar declination and why is it important?
Solar declination is the angle between the sun's rays and the Earth's equatorial plane. It varies throughout the year due to the Earth's axial tilt, causing the sun's path across the sky to be higher in summer and lower in winter. It's crucial for calculating the sun's angle relative to your panel's tilt.
Does roof pitch automatically set my solar panel tilt?
Often, yes. If your panels are mounted flush with a sloped roof, their tilt angle is determined by the roof's pitch. You might need mounting hardware (rails, tilt legs) to adjust the angle away from the roof pitch if optimal performance is critical and feasible.
How does the calculator estimate energy production?
The chart and table show *relative* energy production. They are based on models that estimate the angle of incidence of solar radiation on the panel surface at different tilt angles and times of year. Higher relative production percentages indicate more direct sunlight capture compared to other angles for that location and time. It doesn't predict absolute kWh without knowing system size and local solar irradiance data.
Analyze the financial implications of installing solar panels, including upfront costs, incentives, and long-term savings.
// — Global Variables —
var chartInstance = null; // To hold the chart object
// — Helper Functions —
function getDayOfYear(month, day) {
var daysInMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var dayOfYear = 0;
for (var i = 1; i 180
else if (panelOrientationDegrees === 180) gamma_std_deg = 0; // North -> 0
else if (panelOrientationDegrees === 90) gamma_std_deg = 270; // East -> 270
else if (panelOrientationDegrees === 270) gamma_std_deg = 90; // West -> 90
else gamma_std_deg = 180; // Default South
var gamma_std_rad = gamma_std_deg * (Math.PI / 180);
var panel_alt_rad = (90 – tiltAngle) * (Math.PI / 180);
var panel_az_rad = gamma_std_rad;
// Panel Normal vector components:
// Px = cos(panel_alt_rad) * sin(panel_az_rad)
// Py = cos(panel_alt_rad) * cos(panel_az_rad)
// Pz = sin(panel_alt_rad)
// Calculate solar position more accurately for noon
var solar_altitude_deg = 90 – Math.abs(latitude – solarDeclination);
var solar_altitude_rad = solar_altitude_deg * (Math.PI / 180);
var solar_azimuth_std_rad = 0; // Assume solar noon aligns with geographic North/South for simplicity (0 or 180 degrees std azimuth)
// If using true solar noon, this needs calculation. Let's assume 0 for standard azimuth calculation.
// Recalculating cos(theta) using simplified terms for noon (omega=0) and panel azimuth relative to South (gamma).
// gamma = panelOrientationDegrees (0=S, 180=N, 90=E, 270=W)
// phi = latitude, delta = declination, beta = tilt
var lat_rad = latitude * (Math.PI / 180);
var tilt_rad = tiltAngle * (Math.PI / 180);
var decl_rad = solarDeclination * (Math.PI / 180);
var panel_az_south_rad; // Azimuth angle relative to South (0=S, positive=W, negative=E)
if (panelOrientationDegrees === 0) panel_az_south_rad = 0; // South
else if (panelOrientationDegrees === 180) panel_az_south_rad = Math.PI; // North
else if (panelOrientationDegrees === 90) panel_az_south_rad = -Math.PI / 2; // East
else if (panelOrientationDegrees === 270) panel_az_south_rad = Math.PI / 2; // West
else panel_az_south_rad = 0; // Default
// Using the formula from ASHRAE Handbook – Fundamentals
// cos(theta) = sin(delta)*sin(phi)*cos(beta) + cos(delta)*cos(phi)*cos(omega)*cos(beta) + cos(delta)*sin(phi)*sin(beta)*cos(omega)*cos(gamma) + cos(delta)*sin(beta)*sin(omega)*sin(gamma)
// For solar noon, omega = 0, cos(omega) = 1, sin(omega) = 0
// cos(theta) = sin(delta)*sin(phi)*cos(beta) + cos(delta)*cos(phi)*cos(beta) + cos(delta)*sin(phi)*sin(beta)*cos(gamma)
// NO, the standard formula is:
// cos(theta) = cos(beta) * cos(ZA) + sin(beta) * sin(ZA) * cos(Azi_sun – Azi_panel)
// Let's use the simplified optimal tilt calculation: β ≈ |L – δ| and calculate AOI based on that.
// For noon, the angle of the sun relative to the horizon (altitude) is 90 – |L – δ|.
// The angle of incidence (θ) on a panel tilted at β degrees, facing South (in NH), is:
// cos(θ) = cos(β) * cos(ZA_noon) + sin(β) * sin(ZA_noon) * cos(Azi_sun – Azi_panel)
// At noon, Azi_sun = 0 (if using South as 0). Panel Azimuth is 0 (South). cos(0)=1.
// cos(θ) = cos(β) * cos(ZA_noon) + sin(β) * sin(ZA_noon)
// If panel faces North (in SH), Azi_sun = 180, Azi_panel = 180. cos(180-180)=cos(0)=1. Same result.
// If panel faces East, Azi_sun = 0, Azi_panel = 90. cos(0-90)=cos(-90)=0.
// If panel faces West, Azi_sun = 0, Azi_panel = -90. cos(0-(-90))=cos(90)=0.
// This is getting complicated. Let's stick to the basic optimal tilt calculation |L – delta|
// and use a simplified AOI for demonstration.
// The most direct calculation for the AVERAGE angle of incidence over the day is complex.
// For fixed tilt, we often use the angle at solar noon.
// ZA at noon = | L – delta |
// Angle of Incidence = | beta – ZA_noon | — This is incorrect. It's angle between sun vector and panel normal.
// Let's use a simplified angle for demonstration: angle relative to perpendicular to horizontal.
// Sun's angle from vertical at noon = | L – delta |
// Panel's angle from vertical = 90 – beta
// Assume panel faces South. Sun is South.
// Angle of Incidence = | (90 – beta) – (90 – |L – delta|) | = | |L – delta| – beta | — STILL WRONG.
// Corrected approach: Angle of Incidence (theta)
// At solar noon (omega = 0):
// Sun Zenith Angle (ZA) = acos( sin(phi)sin(delta) + cos(phi)cos(delta) )
// Panel Normal Zenith Angle = beta (if facing South)
// Angle of Incidence = acos( cos(beta)*cos(ZA) + sin(beta)*sin(ZA)*cos(Azi_sun – Azi_panel) )
// At solar noon, Azi_sun = 0 (if North=0, East=90, South=180, West=270)
// Convert panelOrientationDegrees (0=S, 180=N, 90=E, 270=W) to standard azimuth (Azi_panel_std)
var Azi_panel_std_rad;
if (panelOrientationDegrees === 0) Azi_panel_std_rad = Math.PI; // South
else if (panelOrientationDegrees === 180) Azi_panel_std_rad = 0; // North
else if (panelOrientationDegrees === 90) Azi_panel_std_rad = Math.PI / 2; // East
else if (panelOrientationDegrees === 270) Azi_panel_std_rad = 3 * Math.PI / 2; // West
else Azi_panel_std_rad = Math.PI; // Default South
// Let's use the formula from Wikipedia (Solar energy) Angle of incidence section.
// cos(theta) = sin(delta)sin(phi)cos(beta) – cos(delta)cos(phi)sin(beta)cos(gamma) + cos(delta)cos(phi)cos(omega)cos(beta) + cos(delta)sin(phi)sin(beta)cos(omega)cos(gamma) + cos(delta)sin(beta)sin(omega)sin(gamma)
// At solar noon, omega = 0.
// cos(theta) = sin(delta)sin(phi)cos(beta) – cos(delta)cos(phi)sin(beta)cos(gamma) + cos(delta)cos(phi)cos(beta)
// Here gamma is the azimuth of the surface relative to the equator (0=E, 90=N, 180=W, 270=S).
// Let's convert our panelOrientationDegrees (0=S, 180=N, 90=E, 270=W) to this gamma convention.
// 0=S -> gamma = 270
// 180=N -> gamma = 90
// 90=E -> gamma = 0
// 270=W -> gamma = 180
var gamma_eq_rad;
if (panelOrientationDegrees === 0) gamma_eq_rad = 3 * Math.PI / 2; // South
else if (panelOrientationDegrees === 180) gamma_eq_rad = Math.PI / 2; // North
else if (panelOrientationDegrees === 90) gamma_eq_rad = 0; // East
else if (panelOrientationDegrees === 270) gamma_eq_rad = Math.PI; // West
else gamma_eq_rad = 3 * Math.PI / 2; // Default South
var cos_theta = Math.sin(decl_rad) * Math.sin(lat_rad) * Math.cos(tilt_rad) +
Math.cos(decl_rad) * Math.cos(lat_rad) * Math.cos(tilt_rad) +
Math.cos(decl_rad) * Math.sin(lat_rad) * Math.sin(tilt_rad) * Math.cos(gamma_eq_rad);
if (cos_theta > 1) cos_theta = 1;
if (cos_theta 90 degrees. Let's bound it.
// We are estimating relative gain compared to a reference.
// Let's assume the reference is a fixed tilt at latitude.
// A better approach might be to compare the calculated AOI to the AOI of the latitude-based tilt.
// Simplified: assume production is proportional to cos(AOI), capped at 0.
// Normalize this based on some reference.
// For this calculator, let's just use a simple inverse relationship for demonstration.
// A higher AOI means less efficient. A lower AOI means more efficient.
// We can map AOI to a relative production percentage.
// Let's scale it so that 0 degrees AOI is 100% and 90 degrees AOI is maybe 50%? (Very rough)
// Or, let's assume the 'optimal' tilt calculated yields ~100% relative production for that month.
// And compare other tilts to that.
// For the chart and table, let's calculate AOI for a range of tilts and find the max.
// Then normalize the production based on that max.
// Placeholder for now: return a value based on AOI
// Lower AOI should give higher percentage.
var ao_rad = angleOfIncidence * (Math.PI / 180);
var efficiency = Math.max(0, Math.cos(ao_rad)); // Cosine response of efficiency
// This represents instantaneous efficiency. Need to integrate over time or use average.
// For simplicity, let's just use a scale:
return Math.max(0, 100 * (1 – angleOfIncidence / 90)); // Simple linear scaling: 100% at 0 deg, 0% at 90 deg.
}
// — Main Calculation Function —
function calculateTilt() {
// Clear previous errors
document.getElementById("latitude-error").style.display = "none";
document.getElementById("month-error").style.display = "none";
document.getElementById("orientation-error").style.display = "none";
// Get input values
var latitudeInput = document.getElementById("latitude");
var monthSelect = document.getElementById("month");
var panelOrientationSelect = document.getElementById("panelOrientation");
var latitude = parseFloat(latitudeInput.value);
var month = parseInt(monthSelect.value);
var panelOrientation = panelOrientationSelect.value;
// — Input Validation —
var isValid = true;
if (isNaN(latitude)) {
document.getElementById("latitude-error").textContent = "Please enter a valid number for latitude.";
document.getElementById("latitude-error").style.display = "block";
isValid = false;
} else if (latitude 90) {
document.getElementById("latitude-error").textContent = "Latitude must be between -90 and 90 degrees.";
document.getElementById("latitude-error").style.display = "block";
isValid = false;
}
if (isNaN(month) || month 12) {
document.getElementById("month-error").textContent = "Please select a valid month.";
document.getElementById("month-error").style.display = "block";
isValid = false;
}
if (!panelOrientation) {
document.getElementById("orientation-error").textContent = "Please select a panel orientation.";
document.getElementById("orientation-error").style.display = "block";
isValid = false;
}
if (!isValid) {
document.getElementById("results-section").style.display = "none";
return;
}
// — Calculations —
var dayOfYear = getDayOfYear(month, 15); // Use middle of the month for declination
var solarDeclination = calculateSolarDeclination(dayOfYear);
var panelOrientationDegrees = normalizeOrientation(panelOrientation); // Degrees relative to South
// Calculate optimal tilt angle using the formula: Tilt ≈ |Latitude – Solar Declination|
var optimalTilt = Math.abs(latitude – solarDeclination);
// Ensure tilt is within reasonable bounds (0-90 degrees)
optimalTilt = Math.max(0, Math.min(90, optimalTilt));
// Calculate average angle of incidence at solar noon for the calculated optimal tilt
var avgAngleOfIncidence = calculateAngleOfIncidence(latitude, optimalTilt, solarDeclination, panelOrientationDegrees);
// Calculate relative production for the optimal tilt
// We assume the optimal tilt gives the highest relative production for that month.
// Let's calculate for a few other tilts to show comparison.
var tiltsToTest = [0, 15, 30, 45, 60, 75, 90];
var productionData = [];
var maxProduction = 0;
var bestTiltForMaxProd = 0;
for (var i = 0; i maxProduction) {
maxProduction = currentRelativeProduction;
bestTiltForMaxProd = currentTilt;
}
}
// Adjust optimalTilt to be the one that yields max production in our test range if it's close
// Or simply use the calculated optimalTilt and normalize based on its production
var optimalTiltAoI = calculateAngleOfIncidence(latitude, optimalTilt, solarDeclination, panelOrientationDegrees);
var optimalTiltProduction = estimateRelativeProduction(optimalTiltAoI);
// Normalize all production values based on the highest value found in the test range
var normalizedProductionData = [];
for(var i = 0; i < productionData.length; i++) {
var normalizedProd = (productionData[i].production / maxProduction) * 100;
normalizedProductionData.push({
tilt: productionData[i].tilt,
production: normalizedProd,
aoi: productionData[i].aoi
});
}
// — Display Results —
document.getElementById("optimal-tilt").textContent = optimalTilt.toFixed(1) + "°";
document.getElementById("solar-declination").textContent = solarDeclination.toFixed(1) + "°";
document.getElementById("angle-of-incidence").textContent = avgAngleOfIncidence.toFixed(1) + "°";
// Highlight the main result
var mainResultElement = document.getElementById("main-result");
mainResultElement.textContent = optimalTilt.toFixed(1) + "°";
mainResultElement.style.display = "block"; // Make sure it's visible
// Display intermediate results
document.getElementById("intermediate-results").style.display = "block";
// Update formula explanation
var formulaText = "Optimal Tilt Angle (β) ≈ |Latitude (L) – Solar Declination (δ)|. This aims to make the panel perpendicular to the sun at solar noon.";
document.getElementById("formula-explanation").textContent = formulaText;
// Update assumptions
var assumptionsList = document.getElementById("assumptions-list");
assumptionsList.innerHTML = ""; // Clear previous assumptions
assumptionsList.innerHTML += "