2025-05-02 12:09:40 +02:00
// 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
2025-05-02 11:29:40 +02:00
fetch ( './js/stats.json' )
. then ( response => response . json ( ) )
. then ( stats => {
2025-05-02 12:09:40 +02:00
annual _consumption _gwh = compute _annual _consumption _gwh ( irve _monthly _consumption _gwh , france _twh )
2025-05-02 11:29:40 +02:00
// import * as stats from './stats.json' assert { type: 'json' };
console . log ( stats ) ;
document . getElementById ( 'countStationsOSM' ) . textContent = formatSpaceSeparator ( stats . countStationsOSM ) ;
2025-05-02 12:09:40 +02:00
document . getElementById ( 'countStationsOpenData' ) . textContent = formatSpaceSeparator ( stats . count _unique _id _station _itinerance ) ;
document . getElementById ( 'countStationsAVERE' ) . textContent = formatSpaceSeparator ( stations _avere ) ;
2025-05-02 11:29:40 +02:00
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 ;
proportion _annual _consumption _gwh = compute _proportion _annual _consumption _gwh ( annual _consumption _gwh , stats . countStationsAVERE )
2025-05-02 12:09:40 +02:00
stats . proportion _annual _consumption _gwh = proportion _annual _consumption _gwh ;
2025-05-02 11:29:40 +02:00
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 )
2025-05-02 12:09:40 +02:00
// document.addEventListener('DOMContentLoaded', () => {
makeComparaisonAnalyse ( stats ) ;
// });
2025-05-02 11:29:40 +02:00
} )
. catch ( error => {
console . error ( 'Erreur lors du chargement du fichier stats.json:' , error ) ;
} ) ;
2025-05-02 12:09:40 +02:00
function makeComparaisonAnalyse ( stats ) {
annual _consumption _gwh = compute _annual _consumption _gwh ( irve _monthly _consumption _gwh , france _twh )
let analyse = document . getElementById ( 'analyse_comparaison' ) ;
if ( analyse ) {
2025-05-02 12:36:54 +02:00
2025-05-02 12:09:40 +02:00
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.`;
2025-05-02 12:36:54 +02:00
analyse . innerHTML += ` <br/> Il manque ${ formatSpaceSeparator ( manqueOSM ) } stations dans OSM par rapport aux données de l'AVERE, soit ${ pourcentageManquant } % des stations. La route est longue mais la voie est libre. ` ;
// 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.';
2025-05-02 12:09:40 +02:00
}
}
2025-05-02 11:29:40 +02:00
function compute _annual _consumption _gwh ( irve _monthly _consumption _gwh , france _twh ) {
2025-05-02 12:09:40 +02:00
return irve _monthly _consumption _gwh * 12 ;
2025-05-02 11:29:40 +02:00
}
function compute _proportion _annual _consumption _gwh ( annual _consumption _gwh , countStationsAVERE ) {
return ( annual _consumption _gwh / countStationsAVERE ) . toFixed ( 2 ) ;
}
function formatSpaceSeparator ( number ) {
return number . toString ( ) . replace ( /\B(?=(\d{3})+(?!\d))/g , " " ) ;
2025-05-02 12:09:40 +02:00
}