Skip to content

Commit

Permalink
Update CZ capacities and added storage capacity, fixing #372
Browse files Browse the repository at this point in the history
  • Loading branch information
corradio committed Feb 15, 2017
1 parent 2cca9c8 commit 2e4106a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 9 additions & 7 deletions web/app/configs/capacities.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 8 additions & 4 deletions web/app/countrytable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion web/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions web/app/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down

0 comments on commit 2e4106a

Please sign in to comment.