LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Moderator: leecollings
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Thanks, I will look at it.
Perhaps you are right. It is a bit of over kill every 10 sec for the purpose of the script. I am running on a Rpi 2. First I have to take some time to see how thing work out.
Perhaps you are right. It is a bit of over kill every 10 sec for the purpose of the script. I am running on a Rpi 2. First I have to take some time to see how thing work out.
Greetings McMelloW
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Until your panels start producing, you should only see the 'lost energy' device increasing in value (if you enabled the setting empty_battery to 1 only).
For a headstart you could cheat the battery charge by manipulating the uservariable TotalEnergy, by simply ADDING (for instance) 4000 to the total value mentioned there. The script will think the next minute that you delivered this amount back to the grid (new P1 value - old P1 value = +/- -4000Wh = virtual battery charge)
For a headstart you could cheat the battery charge by manipulating the uservariable TotalEnergy, by simply ADDING (for instance) 4000 to the total value mentioned there. The script will think the next minute that you delivered this amount back to the grid (new P1 value - old P1 value = +/- -4000Wh = virtual battery charge)
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
I did the headstart suggestion last night. The figures are more realistic now. When you wrote this script, did you made a kind of flow chart or just started out of the blue with an idea in your head.jake wrote: ↑Friday 02 March 2018 23:26 Until your panels start producing, you should only see the 'lost energy' device increasing in value (if you enabled the setting empty_battery to 1 only).
For a headstart you could cheat the battery charge by manipulating the uservariable TotalEnergy, by simply ADDING (for instance) 4000 to the total value mentioned there. The script will think the next minute that you delivered this amount back to the grid (new P1 value - old P1 value = +/- -4000Wh = virtual battery charge)
Greetings McMelloW
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
I have to confess that I started with just the idea in my head, after a discussion with a colleague about the subject. Programming is not my profession and I see it all the time that a simple idea becomes complex quite quickly, because at the start it is hard to see all inputs and disturbing factors.McMelloW wrote:I did the headstart suggestion last night. The figures are more realistic now. When you wrote this script, did you made a kind of flow chart or just started out of the blue with an idea in your head.jake wrote: ↑Friday 02 March 2018 23:26 Until your panels start producing, you should only see the 'lost energy' device increasing in value (if you enabled the setting empty_battery to 1 only).
For a headstart you could cheat the battery charge by manipulating the uservariable TotalEnergy, by simply ADDING (for instance) 4000 to the total value mentioned there. The script will think the next minute that you delivered this amount back to the grid (new P1 value - old P1 value = +/- -4000Wh = virtual battery charge)
However, with the print commands and the commentary in each section of the script, I have tried to visualize the steps that were necessary. The print commands acted as checks for me to see whether things were turning out as expected.
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Getting the idea of it, after some time. The script is running OK and without errors. I only had to change the device names/idx and create the user variables to make it run. Done a great job.jake wrote: ↑Saturday 03 March 2018 12:20 I have to confess that I started with just the idea in my head, after a discussion with a colleague about the subject. Programming is not my profession and I see it all the time that a simple idea becomes complex quite quickly, because at the start it is hard to see all inputs and disturbing factors.
However, with the print commands and the commentary in each section of the script, I have tried to visualize the steps that were necessary. The print commands acted as checks for me to see whether things were turning out as expected.
Only had some very odd figures in the Lost Solar Energy.
Code: Select all
2018-03-03 18:00:00 18446744073709552000
Greetings McMelloW
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Nice.
If there is a lower value on a counter that is only supposed to go up, it shows these weird numbers. I therefore check in the script before adding a new number.
If there is a lower value on a counter that is only supposed to go up, it shows these weird numbers. I therefore check in the script before adding a new number.
-
- Posts: 80
- Joined: Saturday 19 March 2016 21:12
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Can somebody tell me where to find the option to add RFXMeter. This option is not available in my setup?
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Create a dummy hardware (do nothing) On this new dummy hardware press the blue button an create a Counter (without incremental)
That's all. Read the manual on domoticz.com It is all there
Last edited by McMelloW on Sunday 04 March 2018 14:51, edited 2 times in total.
Greetings McMelloW
-
- Posts: 80
- Joined: Saturday 19 March 2016 21:12
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Your lua-script is translated to dzVents 2.4 At this moment it is running quit OK. I will compare the output for some days and see what happens.
Code: Select all
--dzVents script Solar_Battery - Created and run in Domoticz events
--Time based Script to simulate a battery to store harvested solar energy at times it is not consumed directly by the appliances in the house/office/factory
--3 Devices will be calculated:
-- (1): Virtual solar battery
-- (2): Energy counter to see how much energy is consumed from the solar battery. Are you using your battery capacity every day,
-- not only for charging, but also for emptying. At big energy consumption, the battery can be used 'multiple' times in a day,
-- when the energy harvesting < temporary big energy consumption
-- (3): Energy counter to see how much energy is lost with the given battery capacity. This is measured both for a full battery while still
-- harvesting energy as for an empty battery while there is energy consumption (optional, see settings variable)
--Manually create and/or define below (newly created virtual) devices and 'User Variables' by user given names
local P1data = 33 -- Electra, P1 Smart Meter device
-- To be created virtual devices in the hardware section of Domoticz:
local idxvsb = 79 -- (1) Custom Sensor name for the 'Virtual Solar Battery'
local idxsbu = 80 -- (2) RFXMeter counter name for the 'Solar Battery Usage'
local idxlse = 81 -- (3) RFXMeter counter name for the 'Lost Solar Energy'
-- User Variables:
local battery = 'SolarBatCap' -- User Variable name for the 'Solar Battery Capacity'. Type 'String'. Value in Wh (5kWh battery = '5000')
local tot_elec = 'Total_Elec' -- User Variable to store the total sum of P1 electricity meter. Type 'String'. Value initially must be '0'
--[[ Settings variable for the 'Lost Solar Energy' meter to include/exclude energy consumption while the battery is already empty:
1 = Include (in other words, with either more solar panels to fill the battery or a bigger battery capacity,
energy consumption from the grid could have been avoided)
0 = Exclude (in other words, the meter shows in the monthly graph exactly how big the battery should have been
to catch all generated solar energy)
]]--
local empty_bat = 1
-- Define variables, used in this script. Don't change!!!
local bat_cap
local new_elec
local old_elec
local elec_cons
local old_bat_value
local new_bat_value
local bat_usage
local old_bat_usage
local new_bat_usage
local lost_energy
local old_lost_energy
local new_lost_energy
local ScriptVersion = '0.0.7'
return {
logging = {
-- level = domoticz.LOG_DEBUG, -- Uncomment this line to override the dzVents global logging setting
marker = 'VSB '.. ScriptVersion
},
on = {
timer = { 'every minute' }
},
execute = function(domoticz, triggerItem)
if (triggerItem.isTimer) then
bat_cap = tonumber(domoticz.variables(battery).value)
-- Get values from device P1Data of the Smart Meter
local SMdata = domoticz.devices(P1data).rawData
-- Get P1 Smart Meter values
new_elec = tonumber(SMdata[1] + SMdata[2]) - (SMdata[3] + SMdata[4])
domoticz.log(SMdata, domoticz.LOG_DEBUG)
old_elec = tonumber(domoticz.variables(tot_elec).value)
domoticz.log('new electricity = '.. new_elec, domoticz.LOG_DEBUG)
-- Check the energy consumption since last update.
-- A positive number means electricity usage, na negative number means electricity generated
elec_cons = (new_elec - old_elec)
domoticz.log('Electrity Consumption = '.. elec_cons, domoticz.LOG_DEBUG)
domoticz.variables(tot_elec).set(new_elec)
-- Get the last value from the Virtual Solar Battery
local vsb = domoticz.devices(idxvsb).rawData
old_bat_value = tonumber(vsb[1] * 1000)
-- Calculate the new battery value by subtracting the electricity consumption from the previous battery value.
-- When consumption is positive, therefore it dischargess the battery.
-- If the energy consumption is negative, it means that the battery will be charged.
new_bat_value = (old_bat_value - elec_cons)
-- Check for battery limits > 0 or <= then battery capacity
if new_bat_value <= 0 then
new_bat_value = 0
domoticz.log('Battery is empty, energy taken fromn grid', domoticz.LOG_DEBUG)
elseif new_bat_value > bat_cap then
new_bat_value = bat_cap
domoticz.log('Battery is completly charged.', domoticz.LOG_DEBUG)
elseif new_bat_value < bat_cap then
domoticz.log('New battery level = '.. (new_bat_value / 1000), domoticz.LOG_DEBUG)
end
domoticz.devices(idxvsb).updateCustomSensor(new_bat_value / 1000)
-----------------------------------
-- Virtual Solar Battery Use
-----------------------------------
-- Count the energy used from the battery (meaning that the electricity consumption must be a positve number
if elec_cons > 0 then
bat_usage = (old_bat_value - new_bat_value)
else
bat_usage = 0
end
-- Download the previous value of the solar battery energy usage in Wh
local sbu = domoticz.devices(idxsbu).rawData
old_bat_usage = tonumber(sbu[1])
domoticz.log('Old Solar Battery Usage = '.. old_bat_usage, domoticz.LOG_DEBUG)
-- Calculate the new value for the solar battery energy usage in Wh
new_bat_usage = (old_bat_usage + bat_usage)
if new_bat_usage >= old_bat_usage then
domoticz.devices(idxsbu).updateCounter(new_bat_usage)
domoticz.log('New Solar Battery Usage = '.. new_bat_usage, domoticz.LOG_DEBUG)
else
domoticz.log('Something went wrong, the new Solar Battery Usage value is smaller than the previous value', domoticz.LOG_DEBUG)
end
-----------------------------------
-- Virtual Lost Solar Energy calculation
-----------------------------------
-- Energy value above the battery capacity and at empty battery is 'lost'
-- and needs to be measured to know what capacity should have been chosen
-- Download the previous value of the virtual lost energy sensor
local lse = domoticz.devices(idxlse).rawData
old_lost_energy = tonumber(lse[1])
domoticz.log('Old Lost Solar Energy = '.. old_lost_energy, domoticz.LOG_DEBUG)
-- Calculate how much energy is lost after the battery reached it's maximum capacity
lost_energy = old_bat_value - elec_cons - bat_cap
if lost_energy > 0 then -- meaning a negative electricity_consumption, meaning energy generated while battery was at max. capacity
-- Calculate the new value for the virtual lost energy sensor
new_lost_energy = (old_lost_energy + lost_energy)
elseif (old_bat_value - elec_cons) < 0 and empty_bat == 1 then --meaning that there is energy consumption while battery is empty
--Calculate the new value for the virtual lost energy sensor
new_lost_energy = (old_lost_energy - (old_bat_value - elec_cons))
-- battery value would have been negative, therefore subtracted ( minus x minus = plus) to come to a total lost_energy
else
new_lost_energy = old_lost_energy
end
--Virtual counter new value must be higher than the old value to prevent errors in the virtual counter calculation
if new_lost_energy >= old_lost_energy then
domoticz.devices(idxlse).updateCounter(new_lost_energy)
domoticz.log('New Lost Solar Energy = '.. new_lost_energy, domoticz.LOG_DEBUG)
else
domoticz.log('Something went wrong, the new Lost Solar Energy value of is smaller than the previous value', domoticz.LOG_DEBUG)
end
end -- triggerItem
end -- execute
}
Last edited by McMelloW on Monday 05 March 2018 16:06, edited 1 time in total.
Greetings McMelloW
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Thanks for starting the dzVents version.
There are improvements to be made, but it is a good start. I will look into it in the next days.
2 things that attracted my attention: I had thought to remain using the battery capacity variable to enable easy adaptation through the domoticz GUI, but for the electricity meter a dzVents variable.
For checking device data, it is better to use the dzVents way of handling them. Easier to understand and manipulate.
There are improvements to be made, but it is a good start. I will look into it in the next days.
2 things that attracted my attention: I had thought to remain using the battery capacity variable to enable easy adaptation through the domoticz GUI, but for the electricity meter a dzVents variable.
For checking device data, it is better to use the dzVents way of handling them. Easier to understand and manipulate.
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
If you mean by "the electricity meter" the variable "TotalElectricity" I don't know how to keep a value outside a dzVents script. The user variable works OK en it is easy to read and to update domoticz.variables(var_name)jake wrote: ↑Sunday 04 March 2018 20:49 Thanks for starting the dzVents version.
There are improvements to be made, but it is a good start. I will look into it in the next days.
2 things that attracted my attention: I had thought to remain using the battery capacity variable to enable easy adaptation through the domoticz GUI, but for the electricity meter a dzVents variable.
I am lua a beginner, but not in script programming. dzVents is much more readable and easier. Although you have to learn and understand the way of thinking with in dzVentFor checking device data, it is better to use the dzVents way of handling them. Easier to understand and manipulate.
Greetings McMelloW
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Discovered some errors in yesterdays script (04-03-2018) Placed the new code in the posting of yesterday
Greetings McMelloW
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
With a little dzVent script, all 6 meter values of the P1 Smart Meter are showed on different devices and the Virtual Solar Baterry as well.
Here is the dzVents script how the values are parsed from the P1 Smart Meter device. In due time I will combine this script with the Virtual Solar Battery script and run it all in one.
As always, comments and improvements are welcome
Here is the dzVents script how the values are parsed from the P1 Smart Meter device. In due time I will combine this script with the Virtual Solar Battery script and run it all in one.
Code: Select all
--[[ dzVents script to Parse P1 Smart Meter Electricity value into seperated Meter Readings.
]]-- Creat the following virtual devices for your environment. Get the 'Idx' or 'Name' of the Device tab.
local P1data = 33 -- Electra, P1 Smart Meter device
local idxu1 = 42 -- Meter Usage low, Virtual device, counter incremental
local idxu2 = 43 -- Meter Usage High, Virtual device, counter incremental
local idxr1 = 44 -- Meter Return Low, Virtual device, counter incremental
local idxr2 = 45 -- Meter Return High, Virtual device, counter incremental
local idxcons = 74 -- Meter Actual Usage, Virtual device, counter incremental
local idxprod = 75 -- Meter Actual Production, Virtual device, counter incremental
local ScriptVersion = '0.1.7'
return {
logging = {
level = domoticz.LOG_DEBUG, -- Uncomment this line to override the dzVents global logging setting
marker = 'SME '.. ScriptVersion
},
on = {
timer = { 'every minute' }
},
execute = function(domoticz, triggerItem)
if (triggerItem.isTimer) then
-- Get values from device P1Data of the Smart Meter
local SMdata = domoticz.devices(P1data).rawData
-- Update the device and Debug meassages with the accessory values from table SMdata
domoticz.devices(idxu1).updateCounter(SMdata[1])
domoticz.log('Gebruik laag = '.. SMdata[1], domoticz.LOG_DEBUG)
domoticz.devices(idxu2).updateCounter(SMdata[2])
domoticz.log('Gebruik hoog = '.. SMdata[2], domoticz.LOG_DEBUG)
domoticz.devices(idxr1).updateCounter(SMdata[3])
domoticz.log('Levering laag = '.. SMdata[3], domoticz.LOG_DEBUG)
domoticz.devices(idxr2).updateCounter(SMdata[4])
domoticz.log('Levering hoog = '.. SMdata[4], domoticz.LOG_DEBUG)
domoticz.devices(idxcons).updateCounter(SMdata[5])
domoticz.log('Actuele Gebruik = '.. SMdata[5], domoticz.LOG_DEBUG)
domoticz.devices(idxprod).updateCounter(SMdata[6])
domoticz.log('Actuele Levering = '.. SMdata[6], domoticz.LOG_DEBUG)
end -- triggerItem
end -- execute
}
Greetings McMelloW
-
- Posts: 70
- Joined: Monday 06 February 2017 12:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.9700
- Location: Azores
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Awesome idea :O
I dont have a P1 meter, but have 3 solar panels and a SDM120 MODBUS that gives me negative values when im sending energy to the grid.
Can you make a version of your script where it gets the information from the SDM120 dummy device (that has positive and negative values) and sends only the positive values to another Virtual Energy counter (that would be the "Used Energy") and another Virtual Energy counter that would receive the negative values convert them to positive and would be the "Wasted Energy".
That way one could better understand how to use 100% of the generated energy.
I think it would be an simpler version of your script, been trying to figure out how to adapt it to my needs, but programming isnt my strong suit :/
I dont have a P1 meter, but have 3 solar panels and a SDM120 MODBUS that gives me negative values when im sending energy to the grid.
Can you make a version of your script where it gets the information from the SDM120 dummy device (that has positive and negative values) and sends only the positive values to another Virtual Energy counter (that would be the "Used Energy") and another Virtual Energy counter that would receive the negative values convert them to positive and would be the "Wasted Energy".
That way one could better understand how to use 100% of the generated energy.
I think it would be an simpler version of your script, been trying to figure out how to adapt it to my needs, but programming isnt my strong suit :/
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
Thanks for your interest in the script. I assume your dummy counter is a 'power' meter? An energy meter can only add up, as far as I know. Therefore it wouldn't allow negative values.gajotnt wrote:Awesome idea :O
I dont have a P1 meter, but have 3 solar panels and a SDM120 MODBUS that gives me negative values when im sending energy to the grid.
Can you make a version of your script where it gets the information from the SDM120 dummy device (that has positive and negative values) and sends only the positive values to another Virtual Energy counter (that would be the "Used Energy") and another Virtual Energy counter that would receive the negative values convert them to positive and would be the "Wasted Energy".
That way one could better understand how to use 100% of the generated energy.
I think it would be an simpler version of your script, been trying to figure out how to adapt it to my needs, but programming isnt my strong suit :/
The principle of the script is based on energy, because that is what is stored in a battery.
-
- Posts: 70
- Joined: Monday 06 February 2017 12:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.9700
- Location: Azores
- Contact:
Re: LUA – Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
It is a dummy usage meter (kWh)
Maybe you can take a look at this post were I explain what im looking for and have a partial working code:
viewtopic.php?f=61&t=24142#p186211
Maybe you can take a look at this post were I explain what im looking for and have a partial working code:
viewtopic.php?f=61&t=24142#p186211
-
- Posts: 107
- Joined: Friday 21 September 2018 15:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
hi, thanks for the script.McMelloW wrote: ↑Thursday 08 March 2018 10:54 With a little dzVent script, all 6 meter values of the P1 Smart Meter are showed on different devices and the Virtual Solar Baterry as well.
Here is the dzVents script how the values are parsed from the P1 Smart Meter device. In due time I will combine this script with the Virtual Solar Battery script and run it all in one.
i have a photovoltaic and i'm interested on evaluate adding solar battery, so i'm very interested on it!!
my system of monitoring production and consumption is working since 4 year but is a little different, like the picture: i have this meter to see
consumption of the house (value indipendent from the photovoltaic production)
production of the photovoltaic
enery taken from the grid = calcolated as: ( consumption - production ) and reported only if value is > 0
energy give back to the grid = calcolated as: (production - consumption) and reported only if the value is > 0
energy self cunsumption = calcolated = production and reported only if (production-consumption) return vale > 0
is it possible to modify the script to monitoring a virtual battery and so calcolate a correct dimension of that one?
thanks
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
You've done most of the splitting of energy usage and generation already. All you need to do is using this part of the script where you start adding up the returned energy to the grid in an additional electricity virtual device and cap that at you chosen battery capacity.megamarco83 wrote: ↑Wednesday 28 November 2018 12:25is it possible to modify the script to monitoring a virtual battery and so calculate a correct dimension of that one?McMelloW wrote: ↑Thursday 08 March 2018 10:54 With a little dzVent script, all 6 meter values of the P1 Smart Meter are showed on different devices and the Virtual Solar Baterry as well.
Here is the dzVents script how the values are parsed from the P1 Smart Meter device. In due time I will combine this script with the Virtual Solar Battery script and run it all in one.
thanks
-
- Posts: 107
- Joined: Friday 21 September 2018 15:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Virtual Solar Battery: simulate the presence of a battery for storing harvested solar energy
hi jake and thanks for answering, i'm a newbie so if you can help me, i need to be a little bit addressedjake wrote: ↑Wednesday 28 November 2018 22:27
You've done most of the splitting of energy usage and generation already. All you need to do is using this part of the script where you start adding up the returned energy to the grid in an additional electricity virtual device and cap that at you chosen battery capacity.
you are referring to your script lua, or for Dzvents ?
if i look at your lua script i see:
Local electricity_meter = 'Electricity' -- Existing P1 Electricity device name in 'Utility'
but here what i have to select from my configuration?
i have in my configuration already a counter "immissioni" (with live value and cumulated today value) that is related to energy returned to the grid (that could be only 0=no energy back to grid, or >0 if enery go back to grif, NEVER < 0)
if i take energy from the grid, i have another counter "prelievi" (with live value and cumulated today value) and if is =0 -> no asking energy to grid ; >0 asking energy to grid ; could never be <0
then i have the production
the consumption (real value of consumption without consindering the energy that i produce)
the self consumption (the amount of energy that i produce and use)
so how i have to change your script with my configuration?
thanks so much for help me!
Who is online
Users browsing this forum: No registered users and 1 guest