Power percentage increase

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Power percentage increase

Post by jacobsentertainment »

Hi all,

I would like to increase my power supply to my heat storage with an percentage (with an selector switch I think) depending on this given percentage I want to increase the power to my heating elements in the boilers.

So during the first couple of months of the year I would like to add more power from the grid as my solar-panels are giving less power then during the summer, and adding an percentage of power from the grid is cheaper then heating on gas.

currently I use a simple script that I managed to get together and working, but I can't figure out how to add an percentage to it.
Maybe there is even a better way to compile this script, so if you have some tips and help, that would be appreciated

Code: Select all

return {
        on = {
         devices = { 311
        },
		timer = { 'every 10 minutes'
		},
    },
    
    	logging = {
        level = domoticz.LOG_INFO,
        marker = "Boiler verwarming"
    },
        execute = function(domoticz, devices)
            local Inverter = domoticz.devices(166) --277 = actuall inverter. Shelly3EM =166
                local Kwh = Inverter.actualWatt
            local Boiler_tempL = domoticz.devices(248) -- gem temp boiler links
	            local Temp_BL = Boiler_tempL.temperature
            local Boiler_tempR = domoticz.devices(249) -- gem temp boiler rechts
	            local Temp_BR = Boiler_tempR.temperature
            local Boiler_tempT = domoticz.devices(250) -- gem temp boiler totaal
	            local Temp_BT = Boiler_tempT.temperature
            local Boostselector = domoticz.devices(311) --(boiler verwarming)
            
            local Boil1 = domoticz.devices(219) --2000watt links
            local Boil2 = domoticz.devices(220) --2000watt links
            local Boil3 = domoticz.devices(221) --1500watt links
            local Boil4 = domoticz.devices(222) --1500watt links
            
            local Boil5 = domoticz.devices(223) --1500watt rechts
            local Boil6 = domoticz.devices(224) --1500watt rechts
            local Boil7 = domoticz.devices(225) --2000watt rechts
            local Boil8 = domoticz.devices(226) --2000watt rechts
            
          
            if Temp_BT >= 85 or Temp_BR >= 85 or Kwh <= 750 and Boostselector.state == 'Off' then 
                Boil1.switchOff()
                Boil2.switchOff()  
                Boil3.switchOff()
                Boil4.switchOff()
                Boil5.switchOff()
                Boil6.switchOff()
                Boil7.switchOff()
                Boil8.switchOff()
            elseif (Kwh >= 500 and Kwh <= 1000) and Temp_BT <= 85 then --1 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 1000 and Kwh <= 1500) and Temp_BT <= 85 then --2 
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 1500 and Kwh <= 2000) and Temp_BT <= 85 then --3 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 2000 and Kwh <= 3000) and Temp_BT <= 85 then --4 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 3000 and Kwh <= 3500) and Temp_BT <= 85 then --5 
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()   
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
            elseif (Kwh >= 3500 and Kwh <= 4000) and Temp_BT <= 85 then --6 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 4000 and Kwh <= 5000) and Temp_BT <= 85 then --7 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
            elseif (Kwh >= 5000 and Kwh <= 6000) and Temp_BT <= 85 then --8
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
            elseif (Kwh >= 6000 and Kwh <= 6500) and Temp_BT <= 85 then --9
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 6500 and Kwh <= 7000) and Temp_BT <= 85 then --10
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 7000 and Kwh <= 7500) and Temp_BT <= 85 then --11
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOn().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 7500 and Kwh <= 8000) and Temp_BT <= 85 then --12
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOn().checkFirst()
            elseif (Kwh >= 8000 and Kwh <= 8500) and Temp_BT <= 85 then --13
                Boil1.switchOn().checkFirst()
                Boil2.switchOn().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOn().checkFirst()
            elseif (Kwh >= 8500 and Kwh <= 9000) and Temp_BT <= 85 then --14
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 9000 and Kwh <= 10000) and Temp_BT <= 85 then --15
                Boil1.switchOn().checkFirst()
                Boil2.switchOn().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
            elseif (Kwh >= 10000 and Kwh <= 12000) and Temp_BT <= 85 then --16
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
        end
 --************************************************************************************
            if Boostselector.state == 'Boost 30' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            elseif Boostselector.state == 'Boost 60' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            elseif Boostselector.state == 'Boost 60' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            end
            
end
}
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Power percentage increase

Post by waltervl »

If you use a selector switch you can use to level number.
Example:
Level 10: 20%
Level 20: 50%
Level 30: 100%

Code: Select all

If  domoticz.devices('your selector switch').level == 20 then
   -- do actions for 50%

From documentation:
.level: Number. For dimmers and other ‘Set Level..%’ devices this holds the level like selector switches.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

Basically I get the wattage from "local Kwh = Inverter.actualWatt" How do I add this to this line ?
Something like

Code: Select all

        execute = function(domoticz, devices)
            local Inverter = domoticz.devices(166) --277 = actuall inverter. Shelly3EM =166
                local Kwh = Inverter.actualWatt + percentage value
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Power percentage increase

Post by waltervl »

I do not understand.....
Please describe the logic you want to implement. So if device x gives value Y I want to do action AA
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

I want to multiply the value of device 166 with the % factor I give in an selector.

"local Kwh = Inverter.actualWatt x selectorswitch"
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Power percentage increase

Post by waltervl »

Code: Select all

If  domoticz.devices('your selector switch').level == 20 then
   local Kwh = Inverter.actualWatt*0.5
   
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

Is there a way to use the value or status of this selector, so I can make the line like

Code: Select all

local Kwh = Inverter.actualWatt*'my selector switch' 
If I look at the selector status, this is already 30%
status.png
status.png (26.99 KiB) Viewed 911 times
If I try to

Code: Select all

local Kwh = Inverter.actualWatt*'my selector switch'.value 
Then the error is "nil value"
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Power percentage increase

Post by waltervl »

you can use the level of the selector
Level 0 : 0%
Level 10: 10%
Level 20: 20%
Level 30: 30%
etc

Max number of levels is 30
You can then use something like below. Depends of 50% means multiply with 0.5 or 1.5

Code: Select all

local Kwh = Inverter.actualWatt*(100/domoticz.devices('your selector switch').level)
or
local Kwh = Inverter.actualWatt*(1+(100/domoticz.devices('your selector switch').level))
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

I never tought of the ".level" but ok, now the log is saying Nil

Code: Select all

 2023-04-21 15:15:00.384 Error: dzVents: Error: (3.1.8) Boiler verwarming: nil
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Power percentage increase

Post by waltervl »

Without further context it will be difficult to help you here... ;)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

I have no errors at the moment but it's not working either.... I'm going to have a go at it during the weekend while I'm now at work doing it in between :o
User avatar
RonkA
Posts: 128
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: Power percentage increase

Post by RonkA »

The Value of 'Kwh' is in watt per hour i hope :lol:.

IMHO your goal is to in essence 'add virtual solarpannels', that are powered by mains, to the equation when the yield of your solarpannels is less in the wintertime?
If so you want to add a percentage to your yield like:

Code: Select all

 local Level = 120 -- percentage of used power to calculate
 local KwhInverter = Inverter.actualWatt
 local Kwh = KwhInverter * (Level/100)
Increasing is done.. but its not a pretty fix, no sun, no heat. full sun, extra heat with expenses.
An other way is to add a value to 'Kwh' forcing the if-statement to start at another state:
Example Kwh + 1200 invokes the start at state 3..
Increasing is done, but at a cost of always using mains.. Maybe use timer to limit the use of the increase?

Or am i missing the point of wat you want to achieve?
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

RonkA wrote: Friday 21 April 2023 18:12 IMHO your goal is to in essence 'add virtual solarpannels', that are powered by mains, to the equation when the yield of your solarpannels is less in the wintertime?
That's correct! During the wintertime I want to add some extra power in to my heating system as electricity is cheaper then gas, I have 2M³ heat storage that I can heat up during the day with my solar system. But as the solar power is increasing I want to change the value that I add from the grid.
Now I can use a selector switch to change the percentage I add from the grid.
Next step might be creating a script that checks the period of the year, average lux and temperature to control the % (I think that will take me some time to figure out :lol: )

For now it seems I got a working script without issues and correct values.
Kwh_n is the actual value of the inverter, than changed the formula to:

Code: Select all

local Kwh = Kwh_n*(1+(factor/100))
Full script that seem to work:

Code: Select all

return {
        on = {
         devices = { 311
        },
		timer = { 
		    --'every minute' , 
		    'every 10 minutes',
		},
    },
    
    	logging = {
        level = domoticz.LOG_DEBUG,
        marker = "Boiler verwarming"
    },
        execute = function(domoticz, devices)
            local Inverter = domoticz.devices(166) --277 = actuall inverter. Shelly3EM =166
                --local Kwh = Inverter.actualWatt*(1+(100/domoticz.devices(360).level))
                local Kwh_n = Inverter.actualWatt --*(100/domoticz.devices(360).level)
            local Boiler_tempL = domoticz.devices(248) -- gem temp boiler links
	            local Temp_BL = Boiler_tempL.temperature
            local Boiler_tempR = domoticz.devices(249) -- gem temp boiler rechts
	            local Temp_BR = Boiler_tempR.temperature
            local Boiler_tempT = domoticz.devices(250) -- gem temp boiler totaal
	            local Temp_BT = Boiler_tempT.temperature
            local Boostselector = domoticz.devices(311) --(boiler verwarming)
            local factor = domoticz.devices(360).level
            
            
            local Boil1 = domoticz.devices(219) --2000watt links
            local Boil2 = domoticz.devices(220) --2000watt links
            local Boil3 = domoticz.devices(221) --1500watt links
            local Boil4 = domoticz.devices(222) --1500watt links
            
            local Boil5 = domoticz.devices(223) --1500watt rechts
            local Boil6 = domoticz.devices(224) --1500watt rechts
            local Boil7 = domoticz.devices(225) --2000watt rechts
            local Boil8 = domoticz.devices(226) --2000watt rechts
            
            local Kwh = Kwh_n*(1+(factor/100))
            
          
            if Temp_BT >= 85 or Temp_BR >= 85 or Kwh <= 1500 and Boostselector.state == 'Off' then 
                Boil1.switchOff()
                Boil2.switchOff()  
                Boil3.switchOff()
                Boil4.switchOff()
                Boil5.switchOff()
                Boil6.switchOff()
                Boil7.switchOff()
                Boil8.switchOff()
                domoticz.log('##Boilers worden niet verwarmd'..Kwh..'')
            elseif (Kwh >= 1500 and Kwh <= 2000) and Temp_BT <= 85 then --1 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 1,5Kw'..Kwh..'')
            elseif (Kwh >= 2000 and Kwh <= 3000) and Temp_BT <= 85 then --2 
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 2Kw'..Kwh..'')
            elseif (Kwh >= 3000 and Kwh <= 3500) and Temp_BT <= 85 then --3 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 3Kw'..Kwh..'')
            elseif (Kwh >= 3500 and Kwh <= 4000) and Temp_BT <= 85 then --4 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 3,5Kw'..Kwh..'')
            elseif (Kwh >= 4000 and Kwh <= 4500) and Temp_BT <= 85 then --5 
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()   
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 4Kw'..Kwh..'')
            elseif (Kwh >= 4500 and Kwh <= 5000) and Temp_BT <= 85 then --6 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 4,5Kw'..Kwh..'')
            elseif (Kwh >= 5000 and Kwh <= 5500) and Temp_BT <= 85 then --7 
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 5Kw'..Kwh..'')
            elseif (Kwh >= 5500 and Kwh <= 6000) and Temp_BT <= 85 then --8
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 5,5Kw'..Kwh..'')
            elseif (Kwh >= 6000 and Kwh <= 6500) and Temp_BT <= 85 then --9
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 6Kw'..Kwh..'')
            elseif (Kwh >= 6500 and Kwh <= 7000) and Temp_BT <= 85 then --10
                Boil1.switchOff().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 6,5Kw'..Kwh..'')
            elseif (Kwh >= 7000 and Kwh <= 7500) and Temp_BT <= 85 then --11
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOn().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 7Kw'..Kwh..'')
            elseif (Kwh >= 7500 and Kwh <= 8000) and Temp_BT <= 85 then --12
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 7,5Kw'..Kwh..'')
            elseif (Kwh >= 8000 and Kwh <= 8500) and Temp_BT <= 85 then --13
                Boil1.switchOn().checkFirst()
                Boil2.switchOn().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOff().checkFirst()
                Boil5.switchOff().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 8Kw'..Kwh..'')
            elseif (Kwh >= 8500 and Kwh <= 9000) and Temp_BT <= 85 then --14
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 8,5Kw'..Kwh..'')
            elseif (Kwh >= 9000 and Kwh <= 10000) and Temp_BT <= 85 then --15
                Boil1.switchOn().checkFirst()
                Boil2.switchOn().checkFirst()  
                Boil3.switchOff().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOff().checkFirst()
                Boil7.switchOn().checkFirst()
                Boil8.switchOff().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 9Kw'..Kwh..'')
            elseif (Kwh >= 10000 and Kwh <= 12000) and Temp_BT <= 85 then --16
                Boil1.switchOff().checkFirst()
                Boil2.switchOn().checkFirst() 
                Boil3.switchOn().checkFirst()
                Boil4.switchOn().checkFirst()
                Boil5.switchOn().checkFirst()
                Boil6.switchOn().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst()
                domoticz.log('##Boilers worden verwarmd met 10Kw'..Kwh..'')
                
            else
				domoticz.log(item, domoticz.LOG_ERROR)
				--domoticz.log(item, domoticz.LOG_DEBUG)
			--end 
        end
 --************************************************************************************
            if Boostselector.state == 'Boost 30' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            elseif Boostselector.state == 'Boost 60' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            elseif Boostselector.state == 'Boost 60' and Kwh <= 750 then
                Boil1.switchOn().checkFirst()
                Boil2.switchOff().checkFirst()  
                Boil3.switchOn().checkFirst().afterSec(4)
                Boil4.switchOff().checkFirst()
                Boil5.switchOn().checkFirst().afterSec(7)
                Boil6.switchOff().checkFirst()
                Boil7.switchOff().checkFirst()
                Boil8.switchOn().checkFirst().afterSec(10)
            end
        
end
}
Thanks for the support!
User avatar
RonkA
Posts: 128
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: Power percentage increase

Post by RonkA »

jacobsentertainment wrote: Saturday 22 April 2023 10:02 Next step might be creating a script that checks the period of the year, average lux and temperature to control the % (I think that will take me some time to figure out :lol: )
I had a crack at it for my own 6820Wp solar array for the fun: :D

Januari 2021 yield is about 200 kWh, the highest yield is on june at 1100 kWh, december is more or less equal to january, the path of the yields per months seems sinusoid so using mathematics get a sinewave like equasion:

Yield = B* sin(C * (Month - D)) + A
Solar Percentage = (Yield / Highest Yield) * 100%

Solar Percentage: self explanatory
Yield: the solar yield in kilowatt-hours (kWh)
Highest Yield: value of june ==> 1100 kWh
Month: number from 1 to 12
A: the average yield over the year ==> 650 kWh (average yield is the midpoint between the minimum and maximum yield)
B: the amplitude of the curve (the maximum deviation from the average yield) ==> (1100 - 650) / 2 = 225 kWh (amplitude is half of the peak-to-peak range)
C: the frequency of the curve (the number of cycles per year) ==> 2π / 12 = π / 6 (frequency is 2π divided by the number of months in a year)
D: the phase shift of the curve (the month when the curve reaches its maximum value) ==> 5 (phase shift is the month of maximum yield)

Solar Percentage = ((225 * sin(π/6 * (Month - 5)) + 650) / 1100) * 100%

So for my setup the equation comes to:
1: January: 200 kWh ==> 18.2%
2: February: 303 kWh ==> 27.5%
3: March: 476 kWh ==> 49.3%
4: April: 650 kWh ==> 55.5%
5: May: 825 kWh ==> 69.1%
6: June: 1100 kWh ==> 100%
7: July: 975 kWh ==> 88.6%
8: August: 800 kWh ==> 64.5%
9: September: 526 kWh ==> 42.5%
10: October: 350 kWh ==> 30.5%
11: November: 276 kWh ==> 22.7%
12: December: 200 kWh ==> 18.2%

This is not at all exactly accurate but its something in the ballpark of the reality of the total yield in 2021 and gives reasonable trend for the future...

Now the task to use this equation in dzVents.. thats sadly out of my league.. :(
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Power percentage increase

Post by jacobsentertainment »

I didn't want to go that deep in to the mathematical equations, I rather keep it simple as the weather is not predictable.
I think the only weather influence I'm going to use is the temperature as this has influence on my temperature need. My panels are operational from September last year so I have verry little data to compare.
User avatar
RonkA
Posts: 128
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: Power percentage increase

Post by RonkA »

Ok, what i stated is not a weather prediction but a seasonal prediction that is coarse enough not to be disturbed by rapid changes in weather..
For your chosen route; keep in mind that to heat 2000 liter of water by 10 degrees wil take 4 hour and 11 minutes to do using all your 14kW heating power without factoring in thermal loss (and his is significant!).

Using the current outside temperature wil always going to be late if youre not using some sort of predictive equation..
To use 'lux' is not a good idea because this is normally used for visible light, solarpannels use all light, not only the visible spectrum.
Your solarpannels wil tell you exactly how much solar is produced so extra calculations using solar irradiance measurements are unnecessary imho.

Anyhoe.. I wish for all of us lots of light in the future.. 8-)
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest