Nueva tarifa de la luz. Powerwall: Es rentable instalar una bateria? en una instalación solar? Sin instalación Solar? Parte 2
Nueva tarifa de la luz. Powerwall: Es rentable instalar una batería? en una instalación solar? Sin instalación Solar? Parte 2
En el capítulo seguimos profundizando en la simulación de una batería en una instalación eléctrica. Además ahora lo hacemos para la nueva factura que entrará en vigor en breve y tanto para instalaciones solares con balance neto, como sin balance neto, como en instalaciones sin paneles solares.
A continuación el panel de Grafana Instalaciones Solares:
{ "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "gnetId": null, "graphTooltip": 0, "id": 25, "links": [], "panels": [ { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 14, "w": 12, "x": 0, "y": 0 }, "hiddenSeries": false, "id": 2, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "7.4.2", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [ { "alias": "porcentajebateria", "yaxis": 2 }, { "alias": "porecentajebateria10kwh", "yaxis": 2 } ], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Punta" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Valle" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "E", "resultFormat": "time_series", "select": [ [ { "params": [ "net_delivery_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_lineaDistribuidora", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "F", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Panel Title", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": true }, { "format": "short", "label": null, "logBase": 1, "max": "102", "min": "0", "show": true } ], "yaxis": { "align": false, "alignLevel": null } }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 0 }, "id": 8, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Imp VALLE", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Valle\", 1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "IMP LLANO", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_solar_bateria10kwh", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Llano\", 1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Imp PUNTA", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Punta\", 1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter ", "rawQuery": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "ORIGINAL IMPORTADA", "type": "stat" }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 4 }, "id": 5, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Valle", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Valle\",1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Llano", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "energia_total", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Llano\",1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter", "rawQuery": true, "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "iota_excedente" ], "type": "field" }, { "params": [], "type": "integral" } ] ], "tags": [] }, { "alias": "Punta", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Punta\",1h) FROM \"battery_iota_lineaDistribuidora\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "ORIGINAL EXCEDENTE", "type": "stat" }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 8 }, "id": 9, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Imp VALLE", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Valle\", 1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "IMP LLANO", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_solar_bateria10kwh", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Llano\", 1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Imp PUNTA", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Punta\", 1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "BATTERY 10KWH IMPORTADA", "type": "stat" }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 12 }, "id": 10, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Valle", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Valle\",1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Llano", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "energia_total", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Llano\",1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter", "rawQuery": true, "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "iota_excedente" ], "type": "field" }, { "params": [], "type": "integral" } ] ], "tags": [] }, { "alias": "Punta", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_delivery_Punta\",1h) FROM \"battery_iota_lineaDistribuidora_battery_10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "BATTERY 10KWH EXCEDENTE", "type": "stat" } ], "refresh": false, "schemaVersion": 27, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "2020-07-27T22:00:00.000Z", "to": "2020-07-30T21:59:59.000Z" }, "timepicker": {}, "timezone": "", "title": "Rentabilidad Bateria", "uid": "V2iNr2-Gz", "version": 15 }
A continuación el panel de Grafana para Instalaciones sin Paneles Solares:
{ "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "gnetId": null, "graphTooltip": 0, "id": 26, "links": [], "panels": [ { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 14, "w": 12, "x": 0, "y": 0 }, "hiddenSeries": false, "id": 2, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "7.4.2", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [ { "alias": "porcentajebateria", "yaxis": 2 }, { "alias": "porecentajebateria10kwh", "yaxis": 2 } ], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "net-original", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_consumoCasa", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"value\") FROM \"battery_iota_consumoCasa\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "net - battery", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_consumoCasa_bat10kwh", "orderByTime": "ASC", "policy": "default", "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "net" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "porcentajebateria", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_consumoCasa_bat10kwh", "orderByTime": "ASC", "policy": "default", "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "level_percentage" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "discharge power", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_iota_consumoCasa_bat10kwh", "orderByTime": "ASC", "policy": "default", "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "discharge_power" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Panel Title", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": true }, { "format": "short", "label": null, "logBase": 1, "max": "102", "min": "0", "show": true } ], "yaxis": { "align": false, "alignLevel": null } }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 0 }, "id": 8, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Imp VALLE", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Valle\", 1h) FROM \"battery_iota_consumoCasa\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "IMP LLANO", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_solar_bateria10kwh", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Llano\", 1h) FROM \"battery_iota_consumoCasa\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Imp PUNTA", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Punta\", 1h) FROM \"battery_iota_consumoCasa\" WHERE $timeFilter ", "rawQuery": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "ORIGINAL IMPORTADA", "type": "stat" }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 4 }, "id": 9, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Imp VALLE", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Valle\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "IMP LLANO", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_solar_bateria10kwh", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Llano\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Imp PUNTA", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Punta\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh\" WHERE $timeFilter ", "rawQuery": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "BATTERY 10KWH IMPORTADA", "type": "stat" }, { "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {}, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null } ] }, "unit": "watth" }, "overrides": [] }, "gridPos": { "h": 4, "w": 9, "x": 12, "y": 8 }, "id": 10, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "text": {}, "textMode": "auto" }, "pluginVersion": "7.4.2", "targets": [ { "alias": "Imp VALLE", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Valle\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh_50_llano\" WHERE $timeFilter ", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "IMP LLANO", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_solar_bateria10kwh", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Llano\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh_50_llano\" WHERE $timeFilter ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "net_usage_Llano" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "alias": "Imp PUNTA", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "battery_NO_solar_bateria10kwh_llano50P", "orderByTime": "ASC", "policy": "default", "query": "SELECT integral(\"net_usage_Punta\", 1h) FROM \"battery_iota_consumoCasa_bat10kwh_50_llano\" WHERE $timeFilter ", "rawQuery": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] }, { "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "hide": false, "measurement": "batt", "orderByTime": "ASC", "policy": "default", "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "value" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [] } ], "timeFrom": null, "timeShift": null, "title": "BATTERY 10KWH IMPORTADA 80% en LLANO", "type": "stat" } ], "refresh": false, "schemaVersion": 27, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "2020-07-27T22:00:00.000Z", "to": "2020-07-30T21:59:59.000Z" }, "timepicker": {}, "timezone": "", "title": "Rentabilidad Bateria SIN PANEL", "uid": "V2iNr2-Gzwww", "version": 4 }
y el script python ‘simula_bateria.py’:
#!/usr/bin/env python3 # by Luis Gonzalez https://domotica.solar from influxdb import InfluxDBClient import datetime import time import re import pytz import aux_functions #CONFIGURE DATABASE ACCESS influx_client = InfluxDBClient('influxdb.local', 8086, 'USUARIO', 'PASSWORD', 'casaluis') def main(): #in UTC=0 starttime = '2020-01-01 00:00:00' endtime = '2020-12-31 23:59:59' ##baterry configuration battery = { "level": 0, "level_percentage": 0, "net_usage": 0, "net_delivery": 0, "min": 0,#MINIMO "max": 0, #CAPACIDAD WATTS "label": "_iota_lineaDistribuidora", "efficiency": 0.9, "power_sample_rate": 3600, #power samples per hour "influx_meassurement": "iota_lineaDistribuidora", "max_distributor_power": 4000, # distributor power_line maximun power "max_charge_power": 4000, # battery max charge rate "max_discharge_power": 4000, # battery max discharge rate } cache_size=10000; # mode=> # 0 auto, # 1 charge periods = [ { "start": 0, "end": 6, "mode": 1, "limit": 100, # battery percentage modes 1 and 2 "label":"Valle" }, { "start": 6, "end": 8, "mode": 0, "limit": 0, "label":"Llano" }, { "start": 8, "end": 12, "mode": 0, "limit": 0, "label":"Punta" }, { "start": 12, "end": 16, "mode": 0, "limit": 0, "label":"Llano" }, { "start": 16, "end": 20, "mode": 0, "limit": 0, "label":"Punta" }, { "start": 20, "end": 22, "mode": 0, "limit": 0, "label":"Llano" }, { "start": 22, "end": 24, "mode": 1, "limit": 100, # battery percentage modes 1 and 2 "label":"Valle" }, ] aux_functions.general(battery,influx_client,periods,starttime,endtime,cache_size) #print(tramo) if __name__ == "__main__": main()
El script de Python ‘aux_functions.py’:
#!/usr/bin/env python3 # by Luis Gonzalez https://domotica.solar import re import datetime import time def influx(measurements): try: influx_client.write_points(measurements) except Exception as e: print('Failed to write to influxdb: ', e) def charge_battery(battery, power_line, upto,from_net): #upto battery percentage upper limit, #from_net charge from net if(battery['max']==0): if(power_line<0): battery['net_usage'] = 0 battery['net_delivery'] = -power_line else: battery['net_usage'] = power_line battery['net_delivery'] = 0 battery['level']=0 battery['charge_power']=0 battery['discharge_power']=0 battery['net'] = power_line else: if(from_net==1): max_watt_avail=battery['max_distributor_power']-power_line elif(power_line<0): max_watt_avail=-1*power_line else: max_watt_avail=0 if(battery['max_charge_power']<max_watt_avail): new_power_line=battery['max_charge_power'] exc_power_line=max_watt_avail-battery['max_charge_power'] else: new_power_line=max_watt_avail exc_power_line=0 if (battery['level'] + (new_power_line / battery['power_sample_rate']) > (battery['max']*upto/100)): #not enough space on battery, delivering to net battery['charge_power'] = 0 power_line=new_power_line+exc_power_line if(power_line<0): battery['net_usage'] = 0 battery['net_delivery'] = power_line else: battery['net_usage'] = power_line battery['net_delivery'] = 0 battery['net'] = power_line battery['charge_power']=0 else: #enough space on battery, charging battery battery['level'] = battery['level'] + new_power_line / battery['power_sample_rate'] battery['charge_power'] = new_power_line if(power_line+new_power_line<0): # too much panel energy battery['net_usage'] = 0 battery['net_delivery'] = (power_line+new_power_line)*-1 battery['net'] = power_line+new_power_line else: battery['net_usage'] = power_line+new_power_line battery['net_delivery'] = 0 battery['net'] = power_line+new_power_line battery['discharge_power']=0 def discharge_battery(battery, power_line, upto): exc_power_line=0 if(battery['max_discharge_power']<power_line): new_power_line=battery['max_discharge_power'] exc_power_line=power_line-battery['max_discharge_power'] else: new_power_line=power_line if (battery['level'] * battery['power_sample_rate']) - (new_power_line / battery['efficiency']) < ((battery['max']*upto/100) * battery['power_sample_rate']): #not enough battery, getting power from net remaining_battery = battery['level'] - (battery['max']*upto/100) #battery['level'] = battery['max']*upto/100 power_line=exc_power_line + (new_power_line - (remaining_battery * battery['efficiency'] * battery['power_sample_rate'])) battery['discharge_power']=0 battery['net_usage'] = power_line battery['net_delivery'] = 0 battery['net'] = power_line #print("NO HAY CAPACIDAD") else: # enough battery. Getting power only from battery battery['level'] = battery['level'] - (new_power_line / battery['efficiency'] / battery['power_sample_rate']) battery['discharge_power']=new_power_line #print("HAY CAPACIDAD") battery['net_usage'] = exc_power_line battery['net_delivery'] = 0 battery['net'] = exc_power_line battery['charge_power']=0 def battery_management(battery, power_line,mode, upto): if (mode==0): #automatic mode if power_line > 0: discharge_battery(battery, power_line, 0) else: #reverse power_line charge_battery(battery, power_line, 100,0) elif (mode==1): charge_battery(battery, power_line, upto,1) elif (mode==2): # discharge mode if power_line > 0: discharge_battery(battery, power_line, upto) else: #reverse power_line charge_battery(battery, power_line, 100,0) if (battery['max']==0): battery['level_percentage']=0 else: battery['level_percentage']=battery['level']/battery['max']*100 return battery def general(battery,influx_client,periods,starttime,endtime,cache_size): measurements = [] #delete serie if exists result = influx_client.query('delete from "battery' + battery['label'] + '"') query = "select * from " + battery['influx_meassurement'] + " where time >= '" + format(starttime) + "' and time < '" + format(endtime) + "' order by time;"; print(query) result = influx_client.query(query) points = result.get_points() points2 = result.get_points() #aux function calculate percentage done points_size=len(list(points2)) #obtain diferents labels from periods j=0 different_periods=[] while j<len(periods): if periods[j]['label'] not in different_periods: different_periods.append(periods[j]['label']) j+=1 for x in different_periods: print(x) i=0 progress=0 for point in points: progress+=1 jobdone=progress/points_size*100 for key in ['value']: # full timestamp with milliseconds match = re.match(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z", point['time']) if match: fecha=datetime.datetime.strptime(point['time'], "%Y-%m-%dT%H:%M:%S.%fZ") # timestamp missing milliseconds match = re.match(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z", point['time']) if match: fecha=datetime.datetime.strptime(point['time'], "%Y-%m-%dT%H:%M:%SZ") #hora=point['time'].hour #print(fecha.hour) # check actual period j=0 while j<len(periods): if(periods[j]['start']<periods[j]['end']): if fecha.hour>=periods[j]['start'] and fecha.hour<periods[j]['end']: # period OK period=periods[j]['label'] period_int=j j=len(periods) else: if fecha.hour>=periods[j]['start'] or fecha.hour<periods[j]['end']: period=periods[j]['label'] period_int=j j=len(periods) j+=1 battery_management(battery,point['value'],periods[period_int]['mode'],periods[period_int]['limit']) # knowing the period fill the data #first fill fields={} for x in different_periods: fields["net_usage_" + x]=float(0) fields["net_delivery_" + x]=float(0) fields['net_usage_' + period]=float(battery['net_usage']) fields['net_delivery_' + period]=float(battery['net_delivery']) fields["net_usage"]=float(battery['net_usage']) fields["net_delivery"]=float(battery['net_delivery']) fields["level_percentage"]=float(battery['level_percentage']) battery['net']=battery['net_usage']-battery['net_delivery'] fields["net"]=float(battery['net']) fields["tramo"]=period fields['charge_power']=float(battery['charge_power']) fields['discharge_power']=float(battery['discharge_power']) i+=1 battery['net']=battery['net_usage']-battery['net_delivery'] if i==cache_size: print("Punto=>" + format(point['time']) + " " + format(point['value']) + "W Period=" + format(period) + " Percentage=" + '{:04.1f}%'.format(jobdone)) i=0 measurements.append({ "measurement": "battery" + battery['label'], "time": point['time'], "fields": fields, }) if len(measurements) > cache_size: influx_client.write_points(measurements) print(".") measurements = [] influx_client.write_points(measurements)
y por último los dos ficheros excel:
Aquí tenéis la lista de los componentes necesarios para montar tu propia instalación:
¡También te pueden interesar estos otros vídeos!
Instala el software en la raspberry
Una introducción a NodeRed
Deja tu comentario
Debe iniciar sesión para escribir un comentario.