-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Rainwater Harvesting Calculator (#1413)
- Loading branch information
Showing
6 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# <p align="center">Rainwater Harvesting Calculator</p> | ||
|
||
## Description :- | ||
|
||
The Rainwater Harvesting Calculator is a web-based application that calculates the average annual rainwater that the harvesting tank can store (in liters) based on inputs fields such as:- | ||
- height of the roof (in metres) | ||
- width of the roof (in metres) | ||
- Average annual rainfall (in mm) in the region | ||
- Harvesting system efficiency (high , low ,medium) | ||
- Storage capacity of tank (in litres). | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Working :- | ||
|
||
- The working is based on below formulas :- | ||
1) area = length * width | ||
2) totalRainwater = area * (rainfall / 1000) * efficiency * 1000 | ||
|
||
## Screenshots :- | ||
|
||
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/14010ac5-5c23-44c8-bdbb-45281df4bd73) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>Rainwater Harvesting Calculator</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Rainwater Harvesting Calculator</h1> | ||
<form id="rainwater-form"> | ||
<label for="length">Length of the roof (in meters):</label> | ||
<input type="number" id="length" required> | ||
|
||
<label for="width">Width of the roof (in meters):</label> | ||
<input type="number" id="width" required> | ||
|
||
<label for="rainfall">Average annual rainfall (in mm):</label> | ||
<input type="number" id="rainfall" required> | ||
|
||
<label for="efficiency">Harvesting system efficiency:</label> | ||
<select id="efficiency" required> | ||
<option value="0.75">Low</option> | ||
<option value="0.83">Medium</option> | ||
<option value="0.90">High</option> | ||
</select> | ||
|
||
<label for="capacity">Storage capacity of tank (in litres):</label> | ||
<input type="number" id="capacity" required> | ||
|
||
<button type="button" onclick="calculateRainwater()">Calculate</button> | ||
</form> | ||
<div id="result" style="display: none;"> | ||
<h2>Total Rainwater Collected Annually:</h2> | ||
<p id="total-water"></p> | ||
</div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function calculateRainwater() { | ||
// Get the input values | ||
const length = parseFloat(document.getElementById('length').value); | ||
const width = parseFloat(document.getElementById('width').value); | ||
const rainfall = parseFloat(document.getElementById('rainfall').value); | ||
const efficiency = parseFloat(document.getElementById('efficiency').value); | ||
const capacity = parseFloat(document.getElementById('capacity').value); | ||
|
||
// Calculate the roof area | ||
const area = length * width; | ||
|
||
// Calculate the total rainwater collected annually | ||
const totalRainwater = area * (rainfall / 1000) * efficiency * 1000; | ||
|
||
// Display the result | ||
const resultElement = document.getElementById('total-water'); | ||
resultElement.textContent = `${totalRainwater.toFixed(2)} litres`; | ||
|
||
// Show the result container | ||
document.getElementById('result').style.display = 'block'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
body { | ||
background-image: url(./assets/background.jpg); | ||
background-size: cover; | ||
font-family: Arial, sans-serif; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
background-color: rgba(255, 255, 255, 0.8); | ||
padding: 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | ||
text-align: center; | ||
width: 300px; | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
font-size: 1.5em; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
label { | ||
margin-top: 10px; | ||
color: #333; | ||
text-align: left; | ||
} | ||
|
||
input, | ||
select { | ||
margin-top: 5px; | ||
padding: 8px; | ||
border-radius: 5px; | ||
border: 1px solid #333; | ||
font-size: 0.9em; | ||
text-align: center; | ||
} | ||
|
||
button { | ||
margin-top: 20px; | ||
padding: 10px; | ||
background-color: #007BFF; | ||
color: white; | ||
border: none; | ||
border-radius: 5px; | ||
font-size: 1em; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
color: #333; | ||
} | ||
|
||
#total-water { | ||
font-size: 1.5em; | ||
font-weight: bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters