From 2e4106a642a4fe1e7cab8ba6f9570c544ad85523 Mon Sep 17 00:00:00 2001 From: Olivier Corradi Date: Wed, 15 Feb 2017 10:35:23 +0100 Subject: [PATCH] Update CZ capacities and added storage capacity, fixing #372 --- README.md | 2 +- web/app/configs/capacities.json | 16 +++++++++------- web/app/countrytable.js | 12 ++++++++---- web/app/main.js | 4 +++- web/app/tooltip.js | 6 +++--- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 84c895efc3..c45801815b 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Each country has a GHG mass flow that depends on neighboring countries. In order - Other: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) - Belgium: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) - Bulgaria: [wikipedia.org](https://en.wikipedia.org/wiki/Energy_in_Bulgaria) -- Czech Republic: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) +- Czech Republic: ERU 2015 Yearly Report on the Operation of the Czech Electricity Grid - Denmark - Solar: [wikipedia.org](https://en.wikipedia.org/wiki/Solar_power_in_Denmark) - Wind: [wikipedia.org](https://en.wikipedia.org/wiki/Wind_power_in_Denmark#Capacities_and_production) diff --git a/web/app/configs/capacities.json b/web/app/configs/capacities.json index 8f585346a4..751d8366b2 100644 --- a/web/app/configs/capacities.json +++ b/web/app/configs/capacities.json @@ -37,14 +37,16 @@ }, "CZ": { "capacity": { - "biomass": 350, - "coal": 9914, - "gas": 1226, - "hydro": 2253, - "nuclear": 4040, + "biomass": 495, + "coal": 10244, + "gas": 2223.2, + "geothermal": 0, + "hydro": 1087.5, + "hydro storage": 1171.5, + "nuclear": 4290, "oil": 0, - "solar": 2067, - "wind": 277 + "solar": 2074.9, + "wind": 280.6 } }, "DE": { diff --git a/web/app/countrytable.js b/web/app/countrytable.js index 43480537d2..8dc2366d92 100644 --- a/web/app/countrytable.js +++ b/web/app/countrytable.js @@ -132,7 +132,10 @@ CountryTable.prototype.render = function(ignoreTransitions) { selection.select('rect.capacity') .transition() .duration(ignoreTransitions ? 0 : this.TRANSITION_DURATION) - .attr('x', that.LABEL_MAX_WIDTH + that.powerScale(0)) + .attr('x', function(d) { + var value = (!d.isStorage) ? d.capacity : -1 * d.capacity; + return that.LABEL_MAX_WIDTH + ((value == undefined || !isFinite(value)) ? that.powerScale(0) : that.powerScale(Math.min(0, value))); + }) .attr('width', function (d) { return d.capacity !== undefined ? (that.powerScale(d.capacity) - that.powerScale(0)) : 0; }) @@ -390,7 +393,7 @@ CountryTable.prototype.data = function(arg) { 0; var production = !d.isStorage ? (that._data.production || {})[d.mode] : undefined; var storage = d.isStorage ? (that._data.storage || {})[d.mode.replace(' storage', '')] : undefined; - var capacity = !d.isStorage ? (that._data.capacity || {})[d.mode] : undefined; + var capacity = (that._data.capacity || {})[d.mode]; return { production: production, storage: storage, @@ -407,8 +410,9 @@ CountryTable.prototype.data = function(arg) { this.powerScale .domain(this._powerScaleDomain || [ Math.min( - -this._data.maxExport || 0, - -this._data.maxStorage || 0), + -this._data.maxStorageCapacity || 0, + -this._data.maxStorage || 0, + -this._data.maxExport || 0), Math.max( this._data.maxCapacity || 0, this._data.maxProduction || 0, diff --git a/web/app/main.js b/web/app/main.js index 60346ca13d..c1ec8b3398 100644 --- a/web/app/main.js +++ b/web/app/main.js @@ -296,7 +296,6 @@ var countries = CountryTopos.addCountryTopos({}); d3.entries(zones).forEach(function(d) { var zone = countries[d.key]; d3.entries(d.value).forEach(function(o) { zone[o.key] = o.value; }); - zone.maxCapacity = d3.max(d3.values(zone.capacity)); // Add translation zone.shortname = lang.zoneShortName[d.key]; }); @@ -305,6 +304,9 @@ d3.entries(capacities).forEach(function(d) { var zone = countries[d.key]; zone.capacity = d.value.capacity; zone.maxCapacity = d3.max(d3.values(zone.capacity)); + zone.maxStorageCapacity = d3.max(d3.entries(zone.capacity), function(d) { + return (d.key.indexOf('storage') != -1) ? d.value : 0; + }); }); // Add id to each zone d3.entries(countries).forEach(function(d) { diff --git a/web/app/tooltip.js b/web/app/tooltip.js index 302b16bf21..0cec105986 100644 --- a/web/app/tooltip.js +++ b/web/app/tooltip.js @@ -86,15 +86,15 @@ exports.setupCountryTable = function (countryTable, countries, co2Colorbar, co2c .style('background-color', co2intensity ? co2color(co2intensity) : 'gray'); tooltip.select('.emission-intensity') .text(Math.round(co2intensity) || '?'); - var capacityFactor = Math.round(d.production / d.capacity * 100) || '?'; + var value = d.isStorage ? d.storage : d.production; + var capacityFactor = Math.round(value / d.capacity * 100) || '?'; tooltip.select('#capacity-factor').text(capacityFactor + ' %'); tooltip.select('#capacity-factor-detail').text( - (formatPower(d.production) || '?') + ' ' + + (formatPower(value) || '?') + ' ' + ' / ' + (formatPower(d.capacity) || '?')); var totalConsumption = getConsumption(country); var totalPositive = country.totalProduction + country.totalImport; - var value = d.isStorage ? d.storage : d.production; var domain = d.isStorage ? totalPositive : totalPositive; var domainName = d.isStorage ?