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

Better emissions comparisons #564

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@ git push clever-dashboard fix-unit:master
Config on CleverCloud:
```sh
APP_FOLDER="dashboard"
CC_PIP_REQUIREMENTS_FILE="requirements-new.txt"
CC_PIP_REQUIREMENTS_FILE="../requirements/requirements-carbonboard.txt"
CC_PYTHON_MODULE="carbon_board_API:server"
CC_PYTHON_VERSION="3.8"
CC_PYTHON_VERSION="3.11"
CODECARBON_API_URL="https://api.codecarbon.io"
PORT="8000"
```
Expand Down
20 changes: 15 additions & 5 deletions dashboard/layout/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,28 @@ def update_Charts(start_date, end_date, project):
duration = 0
else:
energyConsumed = df_project["energy_consumed"]
emission = df_project["emissions"]
duration = df_project["duration"]
emission = df_project["emissions"] # In Kg.eqCO2
duration = df_project["duration"] # In seconds

# Cards
# --------------------------------------------------------------
houseHold = str(round(100 * emission / 160.58, 2)) + " %"
# The average U.S. household consumes about 10,500 kilowatthours (kWh) of electricity per year
# 10 500 / 52 = 202 kWh per week
# USA "carbon_intensity": 0.368102 KgCO2.eq / kWh
us_household_weekly_emissions = 202 * 0.368102 # 74 KgCO2.eq
# American household weekly energy consumption
houseHold = str(round(100 * emission / us_household_weekly_emissions, 2)) + " %"
# Average emissions of a european car : 130 gCO2.eq / km
car_emissions_KgCo2_per_km = 130 / 1000
car = str(
round(
emission / 0.409,
emission / car_emissions_KgCo2_per_km,
)
)
time_in_minutes = emission * (1 / 0.097) / 60
# Average TV consumption : 100 W
# Average carbon intensity : 0.475 KgCO2.eq/KWh
tv_CO2_emissions_per_minute = 100 / 1000 * 0.475 / 60
time_in_minutes = emission / tv_CO2_emissions_per_minute
tvTime = f"{time_in_minutes:.0f} min"
if time_in_minutes >= 60:
time_in_hours = time_in_minutes / 60
Expand Down
2 changes: 1 addition & 1 deletion dashboard/layout/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def get_car_equivalent(self):
id="car",
),
html.P(
"miles driven",
"Km driven",
className="card-title",
),
]
Expand Down
Loading