From e6e766cd9ebf97e030acb13e2e2e4d74ddf25e3b Mon Sep 17 00:00:00 2001 From: jakenl <16058266+jakenl@users.noreply.github.com> Date: Sat, 10 Apr 2021 11:09:27 +0200 Subject: [PATCH] Update SimSolarBattery.lua Lost energy calculation resulted in a negative value, instead of a positive value. --- SimSolarBattery.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimSolarBattery.lua b/SimSolarBattery.lua index fd919a7..6841bea 100644 --- a/SimSolarBattery.lua +++ b/SimSolarBattery.lua @@ -3,7 +3,7 @@ --version 0.1.2 05-04-2021: changed a check for latest data storage from seconds to milliseconds to accommodate meters that update every second --version 0.1.3 05-04-2021: Added a check to avoid big deviations in calculation when inverter power level is small while having -- also a small script interval. Added more debug logging ---version 0.1.4a 09-04-2021: Description text fix + little preparation for future release +--version 0.1.4b 10-04-2021: Description text fix + little preparation for future release --To be created virtual devices in the hardware section of Domoticz: local solarBattery_name = 'Virtual Solar Battery' -- (1) Virtual 'Custom Sensor' device name for the 'Virtual Solar Battery'. Change axis label to kWh @@ -238,7 +238,7 @@ return { domoticz.log('Energy balance = '..energyBalance..' Wh (negative = consumption)',domoticz.LOG_DEBUG) if energyBalance > maxBbatteryInverterEnergy then - inverterLostEnergy = maxBbatteryInverterEnergy - energyBalance + inverterLostEnergy = energyBalance - maxBbatteryInverterEnergy domoticz.log('Positive energybalance above max inverter capacity. inverterLostEnergy = '.. energyBalance ..' - ' ..maxBbatteryInverterEnergy .. ' = ' .. inverterLostEnergy, domoticz.LOG_DEBUG) energyBalance = maxBbatteryInverterEnergy batteryProdWatt = battery_inverter_power.value