jakenl / domoticz_solarbattery

LUA script to control a simulated battery for storage and consumption of (self-) generated energy
6 stars 1 forks source link

difference between "lost solar energy" delivered and pulled ... #3

Closed Eddie-BS closed 3 years ago

Eddie-BS commented 3 years ago

Hi,

today I noticed my virtual battery went full and the surplus was counted as "lost solar energy" ... So far so good, but a couple of days a go I needed more energy than my battery had so I pulled from the grid ... This is also counted as "lost solar energy" ...

I think these should not be counted together ... pulling from the grid will cost money pushing to the grid CAN bring a return .... (in some places it is not allowd to push to the grid ...) OK, that is still "lost" solar energy but won't increase the bill from the electricity company

Is it possible to handle them differently ? perhaps mark this as enhancement request ?

Screenshot 2021-04-09 at 19 46 26
jakenl commented 3 years ago

Yes, I have been thinking about handling it differently and I had the idea to change this 'lost energy' meter into a virtual P1 meter as well, suppling the 'full battery' energy to usage1 and empty battery to usage2. It will still count up the values.

2nd idea I have is to store the full battery energy in usage1, but use usage2 for lost energy from the limited 'solar battery inverter'. By doing so, it is visual what the losses are, caused by a small battery inverter. Downside is that at the end of the day the inverter losses can be both in consumption and production, but that usage1 and 2 are added up for the totals. Return1 could be used for empty battery losses (retun2 could be used for inverter losses in the consumption direction). In that case it would be:

Eddie-BS commented 3 years ago

Using a virtual P1 meter will have its benefits, the reporting will seperate the values and add the costs to it. losses due to a "small" inverter could be made visible in an other graph ?

jakenl commented 3 years ago

Using a virtual P1 meter will have its benefits, the reporting will seperate the values and add the costs to it. losses due to a "small" inverter could be made visible in an other graph ?

After thinking this through, yes, it is better to give 'inverter losses' it's own device. It could be done with 1 P1 meter, but using the 'return' for displaying inverter losses is not very self explaining. Fine for using it as developer (since he knows what and why), but not for a now public script.

When losses due to full and empty battery are split, it has to be combined with the additional 'lost inverter energy'. device. Currently this 'lost inverter energy' is also counted as lost energy, but has nothing to do with a full/empty battery. My conclusion is now, that as soon as lost energy is split, the device name should be 'Lost battery energy' and the new device 'Lost inverter energy'

jakenl commented 3 years ago

Well, I got it working. Both a P1-meter for lost energy due to battery size and due to inverter size. Battery:

Inverter:

For now I have this setup running in parallel to the existing 'Lost Energy' device. I will let it go tomorrow, since the solar battery is empty and I can't check on energy production.

Eddie-BS commented 3 years ago

Sounds like a nice enhancement, waiting for the code to test ;-) battery is empty here to ...

jakenl commented 3 years ago

Code is available and explanation is in the wiki

Eddie-BS commented 3 years ago

Hi Jake,

tnx for your effort. it is a bit unclear what exactly needs to be changed in the setup ...

--version 0.2   13-04-2021: BREAKING CHANGE:    -- 'Lost Energy' 'Electric + Instant + Counter' device need to be replaced by a 'P1-meter' device
                                                -- New 'P1-meter' device needs to be added to trace losses in limited battery inverter

--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
    local batteryUsage_name = 'Virtual Solar Battery Usage'         -- (2) Virtual 'P1-meter' device name for monitoring storage in and consumption from the solar battery
    local lostEnergy_name    = 'Lost Solar Energy'                  -- (3) Virtual 'Electric Instant + Counter' device name for the 'Lost Solar Energy'
    local lostBattery_name = 'Lost Solar Battery Energy'            -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Energy'
    local lostInverter_name = 'Lost Solar Battery Inverter Energy'  -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Inverter Energy'

In the version line you mention that the old device (3) needs to be replaced by a p1 device, in the code there still is the old device but there are 2 more devices with the number (3) ? does this (3) mean that there needs to be 1 device or should it read (3) (4) (5) and do I need 3 different devices ? Or should just the latest device be (4) and the 1st (3) shoud be removed ?

jakenl commented 3 years ago

Hi Jake,

tnx for your effort. it is a bit unclear what exactly needs to be changed in the setup ...

--version 0.2 13-04-2021: BREAKING CHANGE:    -- 'Lost Energy' 'Electric + Instant + Counter' device need to be replaced by a 'P1-meter' device
                                              -- New 'P1-meter' device needs to be added to trace losses in limited battery inverter

--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
  local batteryUsage_name = 'Virtual Solar Battery Usage'         -- (2) Virtual 'P1-meter' device name for monitoring storage in and consumption from the solar battery
  local lostEnergy_name    = 'Lost Solar Energy'                  -- (3) Virtual 'Electric Instant + Counter' device name for the 'Lost Solar Energy'
  local lostBattery_name = 'Lost Solar Battery Energy'            -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Energy'
  local lostInverter_name = 'Lost Solar Battery Inverter Energy'  -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Inverter Energy'

In the version line you mention that the old device (3) needs to be replaced by a p1 device, in the code there still is the old device but there are 2 more devices with the number (3) ? does this (3) mean that there needs to be 1 device or should it read (3) (4) (5) and do I need 3 different devices ? Or should just the latest device be (4) and the 1st (3) shoud be removed ?

my bad, it was a little late and I forgot to properly clean this up. Further down the code I intentionally did not remove references to 'LostEnergy' yet, but just excluded it with the '--'. This to keep a better oversight over what changed.

The 'Electric Instant + Counter' is no longer needed and the other 2 P1-devices should be 3 and 4. I will update the code and disable reference to the previous 'Lost Energy' device. I will remove these references later on.

Eddie-BS commented 3 years ago

Hmm,

I just removed the “lost Solar Energy” device because it was not updated and that produces this error ...

2021-04-14 12:11:51.727 Error: dzVents: Error: (3.1.7) Hey solar battery: necessary device Lost Solar Energy doesnt exist. Script will end. Please add the device to Domoticz

On 14 Apr 2021, at 12:11, jakenl @.***> wrote:

Hi Jake,

tnx for your effort. it is a bit unclear what exactly needs to be changed in the setup ...

--version 0.2 13-04-2021: BREAKING CHANGE: -- 'Lost Energy' 'Electric + Instant + Counter' device need to be replaced by a 'P1-meter' device -- New 'P1-meter' device needs to be added to trace losses in limited battery inverter

--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 local batteryUsage_name = 'Virtual Solar Battery Usage' -- (2) Virtual 'P1-meter' device name for monitoring storage in and consumption from the solar battery local lostEnergy_name = 'Lost Solar Energy' -- (3) Virtual 'Electric Instant + Counter' device name for the 'Lost Solar Energy' local lostBattery_name = 'Lost Solar Battery Energy' -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Energy' local lostInverter_name = 'Lost Solar Battery Inverter Energy' -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Inverter Energy'

In the version line you mention that the old device (3) needs to be replaced by a p1 device, in the code there still is the old device but there are 2 more devices with the number (3) ? does this (3) mean that there needs to be 1 device or should it read (3) (4) (5) and do I need 3 different devices ? Or should just the latest device be (4) and the 1st (3) shoud be removed ?

my bad, it was a little late and I forgot to properly clean this up. Further down the code I intentionally did not remove references to 'LostEnergy' yet, but just excluded it with the '--'. This to keep a better oversight over what changed.

The 'Electric Instant + Counter' is no longer needed and the other 2 P1-devices should be 3 and 4. I will update the code and disable reference to the previous 'Lost Energy' device. I will remove these references later on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jakenl commented 3 years ago

Yes, I excluded that in the 0.2a update

14 apr. 2021 12:13:31 Eddie-BS @.***>:

Hmm,

I just removed the “lost Solar Energy” device because it was not updated and that produces this error ...

2021-04-14 12:11:51.727 Error: dzVents: Error: (3.1.7) Hey solar battery: necessary device Lost Solar Energy doesnt exist. Script will end. Please add the device to Domoticz

On 14 Apr 2021, at 12:11, jakenl @.***> wrote:

Hi Jake,

tnx for your effort. it is a bit unclear what exactly needs to be changed in the setup ...

--version 0.2 13-04-2021: BREAKING CHANGE: -- 'Lost Energy' 'Electric + Instant + Counter' device need to be replaced by a 'P1-meter' device -- New 'P1-meter' device needs to be added to trace losses in limited battery inverter

--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 local batteryUsage_name = 'Virtual Solar Battery Usage' -- (2) Virtual 'P1-meter' device name for monitoring storage in and consumption from the solar battery local lostEnergy_name = 'Lost Solar Energy' -- (3) Virtual 'Electric Instant + Counter' device name for the 'Lost Solar Energy' local lostBattery_name = 'Lost Solar Battery Energy' -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Energy' local lostInverter_name = 'Lost Solar Battery Inverter Energy' -- (3) Virtual 'P1-meter' device name for the 'Lost Solar Battery Inverter Energy'

In the version line you mention that the old device (3) needs to be replaced by a p1 device, in the code there still is the old device but there are 2 more devices with the number (3) ? does this (3) mean that there needs to be 1 device or should it read (3) (4) (5) and do I need 3 different devices ? Or should just the latest device be (4) and the 1st (3) shoud be removed ?

my bad, it was a little late and I forgot to properly clean this up. Further down the code I intentionally did not remove references to 'LostEnergy' yet, but just excluded it with the '--'. This to keep a better oversight over what changed.

The 'Electric Instant + Counter' is no longer needed and the other 2 P1-devices should be 3 and 4. I will update the code and disable reference to the previous 'Lost Energy' device. I will remove these references later on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/jakenl/domoticz_solarbattery/issues/3#issuecomment-819404132], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AD2QPGXXYN67QCLGT4CKXKTTIVTENANCNFSM42VNGSDA]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAArSURBVHic7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAA+DFFIAAEctgHwAAAAAElFTkSuQmCC###24x24:true###][Tracking afbeelding][https://github.com/notifications/beacon/AD2QPGQYKJZ7NUCFI4IU43LTIVTENA5CNFSM42VNGSDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGDLR2ZA.gif]

Eddie-BS commented 3 years ago

I had to restart domoticz after re-enabling that device to get rid of the error

On 14 Apr 2021, at 12:24, jakenl @.***> wrote:

Yes, I excluded that in the 0.2a update

14 apr. 2021 12:13:31 Eddie-BS @.***>:

Hmm,

I just removed the “lost Solar Energy” device because it was not updated and that produces this error ...

2021-04-14 12:11:51.727 Error: dzVents: Error: (3.1.7) Hey solar battery: necessary device Lost Solar Energy doesnt exist. Script will end. Please add the device to Domoticz

jakenl commented 3 years ago

Did the new code work out for you today?

Eddie-BS commented 3 years ago

Hi Jake,

besides a non-functioning “Lost Solar Energy” graph, which still seems to be needed by the script, everything went fine … around 13:30 my virtual 8kWh battery was full and after that I pushed almost 14kWh to the grid …

looks fine for me

On 14 Apr 2021, at 22:37, jakenl @.***> wrote:

Did the new code work out for you today?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jakenl commented 3 years ago

Do you use the latest version of the script? The one committed on 14-04? This one has no reference to the old 'lost energy'. Please download that script again and (temporarily) rename the Lost Energy to  'lost energy old'

15 apr. 2021 07:47:41 Eddie-BS @.***>:

Hi Jake,

besides a non-functioning “Lost Solar Energy” graph, which still seems to be needed by the script, everything went fine … around 13:30 my virtual 8kWh battery was full and after that I pushed almost 14kWh to the grid …

looks fine for me

On 14 Apr 2021, at 22:37, jakenl @.***> wrote:

Did the new code work out for you today?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/jakenl/domoticz_solarbattery/issues/3#issuecomment-820132563], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AD2QPGXRU4BAZJS33YZAXHTTIZ4XTANCNFSM42VNGSDA]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAArSURBVHic7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAA+DFFIAAEctgHwAAAAAElFTkSuQmCC###24x24:true###][Tracking afbeelding][https://github.com/notifications/beacon/AD2QPGWZFMB4OSLYQVNM63LTIZ4XTA5CNFSM42VNGSDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGDRDVUY.gif]

Eddie-BS commented 3 years ago

In the mean time I am running 0.2a ...

Screenshot 2021-04-15 at 18 36 10

looks fine to me !

jakenl commented 3 years ago

Is this version running OK for you? Please consider closing this issue.

Eddie-BS commented 3 years ago

yes, this one works fine, tnx !