diff options
author | Chris <github.account@chrigel.net> | 2018-01-28 15:27:27 +0100 |
---|---|---|
committer | Chris <github.account@chrigel.net> | 2018-01-28 15:27:27 +0100 |
commit | b2ed2dc802cf9fd153d1449b0f57af53b05fd5e0 (patch) | |
tree | 7877ef78f171ce3951be606831aa70e1b550faf8 /node.d | |
parent | 43c2c846d0e3bab46827ca4397e29fb75a4e30b1 (diff) |
Add new dimension: solar_consumption, which is a percentage calculated from load.
Diffstat (limited to 'node.d')
-rw-r--r-- | node.d/fronius.node.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/node.d/fronius.node.js b/node.d/fronius.node.js index 7aa2c13b71..bb83099cdf 100644 --- a/node.d/fronius.node.js +++ b/node.d/fronius.node.js @@ -24,6 +24,7 @@ var fronius = { consumptionLoadId: "p_load", autonomyId: "rel_autonomy", consumptionSelfId: "rel_selfconsumption", + solarConsumptionId: "solar_consumption", energyTodayId: "e_day", energyYearId: "e_year", @@ -101,6 +102,7 @@ var fronius = { var dim = {}; dim[fronius.autonomyId] = this.createBasicDimension(fronius.autonomyId, "autonomy", 1); dim[fronius.consumptionSelfId] = this.createBasicDimension(fronius.consumptionSelfId, "self_consumption", 1); + dim[fronius.solarConsumptionId] = this.createBasicDimension(fronius.solarConsumptionId, "solar_consumption", 1); chart = { id: id, // the unique id of the chart @@ -255,10 +257,17 @@ var fronius = { parseAutonomyChart: function (service, site) { var selfConsumption = site.rel_SelfConsumption; + var solarConsumption = 0; + var load = Math.abs(site.P_Load); + var power= Math.max(site.P_PV, 0); + if (load >= power) solarConsumption = 100; + else if (power <= 0) solarConsumption = 0; + else solarConsumption = 100 / power * load; return this.getChart(this.getSiteAutonomyChart(service, "autonomy"), [ this.getDimension(this.autonomyId, Math.round(site.rel_Autonomy)), - this.getDimension(this.consumptionSelfId, Math.round(selfConsumption === null ? 100 : selfConsumption)) + this.getDimension(this.consumptionSelfId, Math.round(selfConsumption === null ? 100 : selfConsumption)), + this.getDimension(this.solarConsumptionId, Math.round(solarConsumption)) ] ); }, |