mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-06-20 01:34:43 +02:00
add stats page
This commit is contained in:
parent
fca7661ad8
commit
8c6dbae3e6
5 changed files with 108 additions and 8 deletions
|
@ -1,34 +1,71 @@
|
|||
|
||||
// source https://www.edf.fr/groupe-edf/comprendre/electricite-au-quotidien/usages/consommation-electricite-en-chiffres
|
||||
const france_twh = 460
|
||||
// source baromètre avere
|
||||
const irve_monthly_consumption_gwh = 69
|
||||
|
||||
|
||||
// info vue je ne sais plus où pour l'avere
|
||||
const stations_avere = 40000
|
||||
|
||||
|
||||
fetch('./js/stats.json')
|
||||
.then(response => response.json())
|
||||
.then(stats => {
|
||||
|
||||
annual_consumption_gwh = compute_annual_consumption_gwh(irve_monthly_consumption_gwh, france_twh)
|
||||
|
||||
// import * as stats from './stats.json' assert { type: 'json' };
|
||||
|
||||
console.log(stats);
|
||||
|
||||
document.getElementById('countStationsOSM').textContent = formatSpaceSeparator(stats.countStationsOSM);
|
||||
document.getElementById('countStationsOpenData').textContent = formatSpaceSeparator(stats.countStationsOpenData);
|
||||
document.getElementById('countStationsAVERE').textContent = formatSpaceSeparator(40000);
|
||||
document.getElementById('countStationsOpenData').textContent = formatSpaceSeparator(stats.count_unique_id_station_itinerance);
|
||||
document.getElementById('countStationsAVERE').textContent = formatSpaceSeparator(stations_avere);
|
||||
document.getElementById('countPointsDeChargeAVERE').textContent = formatSpaceSeparator(stats.countStationsAVERE);
|
||||
document.getElementById('countPointsDeChargeOSM').textContent = formatSpaceSeparator(stats.countPointsDeChargeOSM);
|
||||
document.getElementById('countPointsDeChargeOpenData').textContent = formatSpaceSeparator(stats.countPointsDeChargeOpenData);
|
||||
document.getElementById('dateGeneration').textContent = stats.dateGeneration;
|
||||
|
||||
france_twh = 500
|
||||
irve_monthly_consumption_gwh = 69
|
||||
|
||||
annual_consumption_gwh = compute_annual_consumption_gwh(irve_monthly_consumption_gwh, france_twh)
|
||||
proportion_annual_consumption_gwh = compute_proportion_annual_consumption_gwh(annual_consumption_gwh, stats.countStationsAVERE)
|
||||
|
||||
stats.proportion_annual_consumption_gwh = proportion_annual_consumption_gwh;
|
||||
|
||||
console.log('estimation de la consommation annuelle des stations de recharge en France', annual_consumption_gwh, 'GWh sur ', france_twh * 1000, 'GWh')
|
||||
console.log('proportion de la consommation annuelle par borne', proportion_annual_consumption_gwh)
|
||||
|
||||
// document.addEventListener('DOMContentLoaded', () => {
|
||||
makeComparaisonAnalyse(stats);
|
||||
// });
|
||||
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erreur lors du chargement du fichier stats.json:', error);
|
||||
});
|
||||
|
||||
|
||||
function makeComparaisonAnalyse(stats) {
|
||||
|
||||
annual_consumption_gwh = compute_annual_consumption_gwh(irve_monthly_consumption_gwh, france_twh)
|
||||
|
||||
let analyse = document.getElementById('analyse_comparaison');
|
||||
if (analyse) {
|
||||
|
||||
analyse.textContent = 'La consommation annuelle des stations de recharge en France est de ' + formatSpaceSeparator(annual_consumption_gwh) + 'GWh sur ' + formatSpaceSeparator(france_twh * 1000) + 'GWh. Soit ' + formatSpaceSeparator(stats.proportion_annual_consumption_gwh) + '% de la consommation annuelle en électricité de la France.';
|
||||
|
||||
let manqueOSM = stations_avere - stats.countStationsOSM;
|
||||
let pourcentageManquant = ((manqueOSM / stations_avere) * 100).toFixed(1);
|
||||
|
||||
// let manquePointsDeChargeOSM = stats.countStationsOpenData - stats.countPointsDeChargeOSM;
|
||||
// let pourcentagePointsDeChargeManquant = ((manquePointsDeChargeOSM / stats.countStationsOpenData) * 100).toFixed(1);
|
||||
// analyse.innerHTML += `<br/> Il manque ${formatSpaceSeparator(manquePointsDeChargeOSM)} points de charge dans OSM par rapport aux données de l'OpenData, soit ${pourcentagePointsDeChargeManquant}% des points de charge.`;
|
||||
analyse.innerHTML += `<br/> Il manque ${formatSpaceSeparator(manqueOSM)} stations dans OSM par rapport aux données de l'AVERE, soit ${pourcentageManquant}% des stations et de points de charge.`;
|
||||
}
|
||||
}
|
||||
function compute_annual_consumption_gwh(irve_monthly_consumption_gwh, france_twh) {
|
||||
return irve_monthly_consumption_gwh * 12 * france_twh;
|
||||
return irve_monthly_consumption_gwh * 12;
|
||||
}
|
||||
|
||||
function compute_proportion_annual_consumption_gwh(annual_consumption_gwh, countStationsAVERE) {
|
||||
|
@ -38,4 +75,4 @@ function compute_proportion_annual_consumption_gwh(annual_consumption_gwh, count
|
|||
|
||||
function formatSpaceSeparator(number) {
|
||||
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue