Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Solar Power Saving Calculator #1195

Merged
merged 8 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Calculators/Solar-Power-Saving-Calculator/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# <p align="center">Solar Power Saving Calculator</p>

## Description :-

A Solar Power Savings Calculator helps users estimate the potential savings from installing solar panels on their property. This tool considers various factors such as local solar insolation (sunlight exposure), electricity consumption, current electricity rates, and the cost of solar installation to provide an estimate of both short-term and long-term financial benefits.

## Tech Stacks :-

- HTML
- CSS
- JavaScript

## Screenshots :-


66 changes: 66 additions & 0 deletions Calculators/Solar-Power-Saving-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Solar Power Savings Calculator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Solar Power Savings Calculator</h1>
<form id="solarForm">
<div class="form-group">
<label for="state">State:</label>
<select id="state" onchange="updateStateData()" required>
<option value="">Select a state</option>
<option value="maharashtra">Maharashtra</option>
<option value="karnataka">Karnataka</option>
<option value="rajasthan">Rajasthan</option>
<option value="tamilnadu">Tamil Nadu</option>
<option value="gujarat">Gujarat</option>
<!-- Add more states as needed -->
</select>
</div>
<div class="form-group">
<label for="roofArea">Roof Area (sq ft):</label>
<input type="number" id="roofArea" required>
</div>
<div class="form-group">
<label for="roofOrientation">Roof Orientation:</label>
<input type="text" id="roofOrientation" placeholder="e.g., south-facing, 30-degree tilt" required>
</div>
<div class="form-group">
<label for="electricityConsumption">Electricity Consumption (kWh per month):</label>
<input type="number" id="electricityConsumption" required>
</div>
<div class="form-group">
<label for="systemSize">Solar System Size (kW):</label>
<input type="number" id="systemSize" required>
</div>
<div class="form-group">
<label for="installationCost">Installation Cost (₹):</label>
<input type="number" id="installationCost" required>
</div>
<div class="form-group">
<label for="incentives">Incentives and Rebates (₹):</label>
<input type="number" id="incentives" required>
</div>
<div class="form-group">
<label for="financingOptions">Financing Options:</label>
<input type="text" id="financingOptions" placeholder="e.g., Loan with 5% interest rate" required>
</div>
<button type="button" onclick="calculateSavings()">Calculate</button>
</form>

<div class="results" id="results">
<h2>Results</h2>
<p id="annualEnergyProduction"></p>
<p id="annualSavings"></p>
<p id="paybackPeriod"></p>
<p id="lifetimeSavings"></p>
<p id="environmentalImpact"></p>
</div>

<script src="script.js"></script>
</body>
</html>
59 changes: 59 additions & 0 deletions Calculators/Solar-Power-Saving-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const stateData = {
maharashtra: { avgSunHours: 5.5, electricityRate: 8, co2Reduction: 0.85, installationCost: 100000, incentives: 20000 },
karnataka: { avgSunHours: 5.8, electricityRate: 7.5, co2Reduction: 0.82, installationCost: 95000, incentives: 15000 },
rajasthan: { avgSunHours: 6.0, electricityRate: 7, co2Reduction: 0.88, installationCost: 90000, incentives: 18000 },
tamilnadu: { avgSunHours: 5.6, electricityRate: 8.2, co2Reduction: 0.83, installationCost: 110000, incentives: 22000 },
gujarat: { avgSunHours: 5.9, electricityRate: 7.8, co2Reduction: 0.86, installationCost: 105000, incentives: 21000 },
// Add more states as needed
};

function updateStateData() {
const state = document.getElementById('state').value;
if (stateData[state]) {
document.getElementById('installationCost').value = stateData[state].installationCost;
document.getElementById('incentives').value = stateData[state].incentives;
} else {
document.getElementById('installationCost').value = '';
document.getElementById('incentives').value = '';
}
}

function calculateSavings() {
const state = document.getElementById('state').value;
const roofArea = parseFloat(document.getElementById('roofArea').value);
const roofOrientation = document.getElementById('roofOrientation').value;
const electricityConsumption = parseFloat(document.getElementById('electricityConsumption').value);
const systemSize = parseFloat(document.getElementById('systemSize').value);
const installationCost = parseFloat(document.getElementById('installationCost').value);
const incentives = parseFloat(document.getElementById('incentives').value);
const financingOptions = document.getElementById('financingOptions').value;

const avgSunHoursPerDay = stateData[state].avgSunHours;
const electricityRate = stateData[state].electricityRate;
const co2ReductionPerKWh = stateData[state].co2Reduction;

const systemEfficiency = 0.75; // Efficiency of the solar system

// Annual energy production calculation
const annualEnergyProduction = systemSize * avgSunHoursPerDay * 365 * systemEfficiency;

// Annual savings calculation
const annualSavings = annualEnergyProduction * electricityRate;

// Payback period calculation
const netInstallationCost = installationCost - incentives;
const paybackPeriod = netInstallationCost / annualSavings;

// Lifetime savings calculation
const lifetimeSavings = annualSavings * 25; // Assuming a 25-year lifespan

// Environmental impact calculation
const annualCo2Reduction = annualEnergyProduction * co2ReductionPerKWh;

// Display results
document.getElementById('annualEnergyProduction').innerText = `Annual Energy Production: ${annualEnergyProduction.toFixed(2)} kWh`;
document.getElementById('annualSavings').innerText = `Annual Savings: ₹${annualSavings.toFixed(2)}`;
document.getElementById('paybackPeriod').innerText = `Payback Period: ${paybackPeriod.toFixed(2)} years`;
document.getElementById('lifetimeSavings').innerText = `Total Lifetime Savings: ₹${lifetimeSavings.toFixed(2)}`;
document.getElementById('environmentalImpact').innerText = `Environmental Impact: ${annualCo2Reduction.toFixed(2)} kg CO2 avoided annually`;
}
54 changes: 54 additions & 0 deletions Calculators/Solar-Power-Saving-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
body {
font-family: Arial, sans-serif;
margin: 20px;
background: slateblue;
}

h1 {
text-align: center;
}

form {
max-width: 600px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
background-color: #f9f9f9;
}

.form-group {
margin-bottom: 15px;
}

label {
display: block;
margin-bottom: 5px;
}

input[type="text"], input[type="number"], select {
width: 100%;
padding: 8px;
box-sizing: border-box;
}

button {
padding: 10px 20px;
background-color: slateblue;
color: white;
border: none;
cursor: pointer;
}

.results {
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
background-color: #f9f9f9;
}

.results p {
margin: 5px 0;
}