diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2018-03-27 21:28:21 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2018-03-27 21:28:21 +0000 |
commit | d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c (patch) | |
tree | faac99f51f182bb8c0a03e95e393d421ac9ddf42 /node.d/fronius.node.js | |
parent | New upstream version 1.9.0+dfsg (diff) | |
download | netdata-84f225be3d8749cf2e685d5bd4b79fe7f6e3ba04.tar.xz netdata-84f225be3d8749cf2e685d5bd4b79fe7f6e3ba04.zip |
New upstream version 1.10.0+dfsgupstream/1.10.0+dfsg
Diffstat (limited to 'node.d/fronius.node.js')
-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 7aa2c13b..fc49e5d3 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 (power <= 0) solarConsumption = 0; + else if (load >= power) solarConsumption = 100; + 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)) ] ); }, |