mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-10-04 17:04:53 +02:00
add stats page
This commit is contained in:
parent
c23d4bd404
commit
fca7661ad8
12 changed files with 767 additions and 6 deletions
41
js/lcm_stats.js
Normal file
41
js/lcm_stats.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
fetch('./js/stats.json')
|
||||
.then(response => response.json())
|
||||
.then(stats => {
|
||||
|
||||
// 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('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)
|
||||
|
||||
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)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erreur lors du chargement du fichier stats.json:', error);
|
||||
});
|
||||
|
||||
function compute_annual_consumption_gwh(irve_monthly_consumption_gwh, france_twh) {
|
||||
return irve_monthly_consumption_gwh * 12 * france_twh;
|
||||
}
|
||||
|
||||
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, " ");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue