Page 1 of 1

dz calculate time heating devices are on

Posted: Thursday 03 December 2020 8:47
by WimNL
Hello all,

I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature. That is working perfect. Now I want to calculate how long the heating was per.room was on per month and what it was costing. I have also P1 for gas monitoring. In the log file i.can see how long a device was on, but I really don't know how to extract the time out of it. Spend already hours on reading and testing.... I know I have to create dummy devices, but that is not the problem...

The devices I'm using are:
P1 gas idx 306
vloerpomp voorhuis relais-2 204 idx 238
vloerpomp achterhuis relais-3 204 idx 239
vloerpomp zijschuur relais-4 204 idx 240
radiator app boven idx 312

I hope someone can help on the way💪

Re: dz calculate time heating devices are on

Posted: Thursday 03 December 2020 8:59
by waaren
WimNL wrote: ↑Thursday 03 December 2020 8:47 I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature. That is working perfect. Now I want to calculate how long the heating was per.room was on per month and what it was costing. I have also P1 for gas monitoring. In the log file i.can see how long a device was on, but I really don't know how to extract the time out of it. Spend already hours on reading and testing....
Do you mean the cost per room (you would need to know how much gas is used per room) or the total cost of the gas usage from the P1 meter?
Can you share the Lua script you use now? Maybe your new requirement can be integrated if you code this functionality in a dzVents script.

Re: dz calculate time heating devices are on

Posted: Thursday 03 December 2020 9:27
by WimNL
waaren wrote: ↑Thursday 03 December 2020 8:59 Do you mean the cost per room (you would need to know how much gas is used per room) or the total cost of the gas usage from the P1 meter?
Can you share the Lua script you use now? Maybe your new requirement can be integrated if you code this functionality in a dzVents script.
I want to know the cost per room. It would be possible to install water meters, but that would cost a lot and than I have to change a lot of heating pipes. I thought: extract the gas usage from the P1 and split it by the time the rooms were using heat.
So that means something like this (I think): Gas / (vloerpomp voorhuis relais-2 204 idx 238 +
vloerpomp achterhuis relais-3 204 idx 239 + vloerpomp zijschuur relais-4 204 idx 240 + radiator app boven idx 312) = dummy 1
Dummy 2 = dummy 1 * vloerpomp voorhuis relais-2 204 idx 238 * gas cost > cost per month for room 'voorhuis'
Dummy 3 = dummy 1 * vloerpomp achterhuis relais-3 204 idx 239 * gas cost > cost per month for room 'achterhuis'
etc...
Or I do I make a mistake in the way I approach it??

Lua script voorhuis (the other rooms have the same scripts, but with there own names (idx) and files:

Code: Select all

-- Domoticz passes information to scripts through a number of global tables
--
-- https://www.iot4.eu/wiki

local heating_probe = 'voorhuis 203' 
local thermostat_setpoint = 'thermo voorhuis virtueel'
local heating_unit1 = 'vloerpomp voorhuis relais-2 204'
local heating_unit2 = 'CV brander relais-1 204'

-- Use when a combined sensor (e.g. temperature and humidity) is used
-- Replace in "otherdevices[heating_probe]" to "otherdevices[heating_probe]" by "temp_only" (in the 2nd "if" and in the "elseif".
-- Remove the -- in the next two lines: 

local naartekst = (tostring (otherdevices[heating_probe]))
local temp_only = (string.sub(naartekst,1,4)) -- the digits (1,4) do point out what characters of the string are needed.


local hysteresis = 0.1

commandArray = {}


-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
    if (deviceName== thermostat_setpoint ) then

        if tonumber(deviceValue) < tonumber(temp_only-hysteresis) then
        
            if (otherdevices[heating_unit1] == "On") then
            --    commandArray['SendNotification']='verwarming voorhuis is uit'
                commandArray[heating_unit1]='Off'
                print("verwarming voorhuis is uit")
            end
            
        elseif tonumber(deviceValue) > tonumber(temp_only+hysteresis) then
            if (otherdevices[heating_unit1] == "Off") then
                commandArray[heating_unit1]='On'
            --    commandArray['SendNotification']='verwarming voorhuis is aan'
                print("verwarming voorhuis is aan")
            end
        end
    end
end

-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do

end

return commandArray
Sorry: it took some time: had to start the laptop; was not possible to do it on the phone ;)

Domoticz is now on Version: 2020.2 (build 12716)

Re: dz calculate time heating devices are on

Posted: Thursday 03 December 2020 9:41
by waaren
WimNL wrote: ↑Thursday 03 December 2020 9:27 I want to know the cost per room.
Nice project. Send you a PM.

Re: dz calculate time heating devices are on

Posted: Friday 12 March 2021 21:01
by DeVille70
WimNL wrote: ↑Thursday 03 December 2020 8:47 I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature.
Would you mind sharing the script, please?

Re: dz calculate time heating devices are on

Posted: Tuesday 20 April 2021 10:12
by Waterman052
I need to know if exist an practical formula to calculate the heating time of a steel part put on the specific heat exchange between detail and heating equipment.mygiftcardsite conductivity of the plate, dT =temperature gradient, dx =thickness of the plate.

mygiftcardsite