Hello,
Im trying to create a 3 phase energy meter for my waterheater using actual resistance of the heating elements, P1-port data, and a 'klikaanklikuit'
AWMT-230 transmitter.
The AWMT-230 is connected over 1 of the resistors of the boiler and sends a inverted signal to my RFXcom tranceiver.
(so when the boiler kicks in it transmits 'off' and when boiler is ready it transmits 'on'. i use a blocky to invert to real state in dummy switch)
You could take the time the boiler was active and multiply this by the rated power to give the used power.
But there is a catch:
Here in the Netherlands the mains is rated at 230v per Phase. So Ohms law gives us (voltage x voltage)/resistance=power and this gives the rated
power of the boiler.
Example: a 2000w boiler has a internal resistance of 26,45 ohm, Ohm law: power=(230v x 230v)/ 26,45 ohm is 2000w
All nice if this was true but the mains fluctuates by law max. 10% so the mains voltage range is between 207v and 253v!!
So for the example boiler the real power can be as low as (207v x 207v)/26,45ohm is 1620w and as high as (253v x 253v)/26,45ohm is 2420w!
For today i got this from the log of phase 1:
The former is no bueno to use...
My solution: i want to use the values from the P1-port of my housemeter to calculate the used power.
My boiler is 3 phase star-wired so the individual resistors have 230v over them.
I measured the 3 individual resistors from the boiler: 1st phase = 27.8 ohm 2nd phase = 27.9 ohm 3nd phase = 29.9 ohm
From the P1-port of my housemeter i collect 'Net - Voltage L1' 'Net - Voltage L2' 'Net - Voltage L3' every 10 seconds
A dummy counter 'Boiler usage' set to 'compute' is created to count the power.
Power measuring for 3 phase boiler Topic is solved
Moderator: leecollings
- RonkA
- Posts: 95
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2023.2
- Location: Harlingen
- Contact:
Power measuring for 3 phase boiler
Last edited by RonkA on Friday 17 June 2022 13:20, edited 3 times in total.
SolarEdge ModbusTCP - Open Weather Map - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
- RonkA
- Posts: 95
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2023.2
- Location: Harlingen
- Contact:
Re: Power measuring for 3 phase boiler
This is how far i got with making a script:
This gives a log output like:
2022-06-15 12:01:51.162 Status: LUA: Voltage fase 1 = 238.200 Voltage fase 2 = 237.000 Voltage fase 2 = 239.000
2022-06-15 12:01:51.162 Status: LUA: power_L1 = 2040.9798561151 power_L2 = 2013.2258064516 power_L3 = 1910.4013377926
2022-06-15 12:01:51.162 Status: LUA: total power = 5964.6070003594 total power rounded = 5964
And this is where i need some support, the script has to trigger if the boiler is heating(AWMT-230 states 'off') AND THEN update wattage when one of the voltages is changing.
Code: Select all
commandArray = {}
debug = true
-- Update these lines before use
trigger = "Boiler boven inverteerd" -- name of the meter to trigger the dummy meter update.
fase_1_voltage = "Net - Voltage L1" -- name of smart meter device
fase_2_voltage = "Net - Voltage L2" -- name of smart meter device
fase_3_voltage = "Net - Voltage L3" -- name of smart meter device
resistor_1 = 27.8 -- Ohm value of resistor
resistor_2 = 27.9 -- Ohm value of resistor
resistor_3 = 29.9 -- Ohm value of resistor
dummymeter0 = "Boiler boven - Verbruik" -- name of virtual sensor
dummymeter_id0 = 133 -- ID of virtual sensor
-- loop
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName == trigger) then
fase1 = otherdevices_svalues[fase_1_voltage] -- Voltage fase 1
fase2 = otherdevices_svalues[fase_2_voltage] -- Voltage fase 2
fase3 = otherdevices_svalues[fase_3_voltage] -- Voltage fase 3
power_L1 = (fase1 * fase1) / resistor_1 -- power used fase 1
power_L2 = (fase2 * fase2) / resistor_2 -- power used fase 2
power_L3 = (fase3 * fase3) / resistor_3 -- power used fase 3
power_total = power_L1 + power_L2 + power_L3 -- totaal power used
power_total_a = math.floor(power_total) -- remove value after comma
--end
if (debug) then
print('Voltage fase 1 = ' .. fase1 .. ' Voltage fase 2 = ' .. fase2 .. ' Voltage fase 2 = ' .. fase3)
print('power_L1 = ' .. power_L1 .. ' power_L2 = ' .. power_L2 .. ' power_L3 = ' .. power_L3)
print('total power = ' .. power_total .. ' total power rounded = ' .. power_total_a)
end
-- Populate commandArray with update command
commandArray[1] = {['UpdateDevice'] = dummymeter_id0 .. "|0|" .. power_total_a .. ";" .. (power_total_a/1000)}
end
end
return commandArray
2022-06-15 12:01:51.162 Status: LUA: Voltage fase 1 = 238.200 Voltage fase 2 = 237.000 Voltage fase 2 = 239.000
2022-06-15 12:01:51.162 Status: LUA: power_L1 = 2040.9798561151 power_L2 = 2013.2258064516 power_L3 = 1910.4013377926
2022-06-15 12:01:51.162 Status: LUA: total power = 5964.6070003594 total power rounded = 5964
And this is where i need some support, the script has to trigger if the boiler is heating(AWMT-230 states 'off') AND THEN update wattage when one of the voltages is changing.
SolarEdge ModbusTCP - Open Weather Map - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
- RonkA
- Posts: 95
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2023.2
- Location: Harlingen
- Contact:
Re: Power measuring for 3 phase boiler
Anybody???
SolarEdge ModbusTCP - Open Weather Map - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
- boum
- Posts: 130
- Joined: Friday 18 January 2019 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: France
- Contact:
Re: Power measuring for 3 phase boiler
I'm more of a dzVents user but in classic lua, this would be something like:
(not tested at all, not even for syntax)
Note sure about the "trigger" device. Also I used early exit with return rather than having several if depths.
(not tested at all, not even for syntax)
Code: Select all
commandArray = {}
local debug = true
-- Update these lines before use
local trigger = "Boiler boven inverteerd" -- name of the meter to trigger the dummy meter update.
local fase_1_voltage = "Net - Voltage L1" -- name of smart meter device
local fase_2_voltage = "Net - Voltage L2" -- name of smart meter device
local fase_3_voltage = "Net - Voltage L3" -- name of smart meter device
local resistor_1 = 27.8 -- Ohm value of resistor
local resistor_2 = 27.9 -- Ohm value of resistor
local resistor_3 = 29.9 -- Ohm value of resistor
local dummymeter0 = "Boiler boven - Verbruik" -- name of virtual sensor
local dummymeter_id0 = 133 -- ID of virtual sensor
local fase1Changed = devicechanged[fase_1_voltage]
local fase2Changed = devicechanged[fase_2_voltage]
local fase3Changed = devicechanged[fase_3_voltage]
if not (fase1Changed or fase2Changed or fase3Changed) then
-- not one of the interesting devices
return commandArray
end
if debug then
if fase1Changed then print('Phase ' .. fase_1_voltage .. ' changed to ' .. fase1Changed) end
if fase2Changed then print('Phase ' .. fase_2_voltage .. ' changed to ' .. fase2Changed) end
if fase3Changed then print('Phase ' .. fase_3_voltage .. ' changed to ' .. fase3Changed) end
end
-- just return if AWMT-230 is activated
if otherdevices[trigger] == 'On' then
if debug then
print('skipping power update because state of ' .. trigger .. ' is ' .. otherdevices[trigger])
end
return commandArray
end
-- loop
local fase1 = otherdevices_svalues[fase_1_voltage] -- Voltage fase 1
local fase2 = otherdevices_svalues[fase_2_voltage] -- Voltage fase 2
localfase3 = otherdevices_svalues[fase_3_voltage] -- Voltage fase 3
local power_L1 = (fase1 * fase1) / resistor_1 -- power used fase 1
local power_L2 = (fase2 * fase2) / resistor_2 -- power used fase 2
local power_L3 = (fase3 * fase3) / resistor_3 -- power used fase 3
local power_total = power_L1 + power_L2 + power_L3 -- totaal power used
local power_total_a = math.floor(power_total) -- remove value after comma
if (debug) then
print('Voltage fase 1 = ' .. fase1 .. ' Voltage fase 2 = ' .. fase2 .. ' Voltage fase 2 = ' .. fase3)
print('power_L1 = ' .. power_L1 .. ' power_L2 = ' .. power_L2 .. ' power_L3 = ' .. power_L3)
print('total power = ' .. power_total .. ' total power rounded = ' .. power_total_a)
end
-- Populate commandArray with update command
commandArray[1] = {['UpdateDevice'] = dummymeter_id0 .. "|0|" .. power_total_a .. ";" .. (power_total_a/1000)}
return commandArray
- RonkA
- Posts: 95
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2023.2
- Location: Harlingen
- Contact:
Re: Power measuring for 3 phase boiler
Merci!!
I will test this shortly.
----
----
The code works ok for the first time. If the trigger == off then the device is updated correct, if the triger goes back to 'on' the last value stays on and gets counted in the total.
I've modified this in the code and now its looking great!!
to:
I will test this shortly.
----
Code: Select all
localfase3 = otherdevices_svalues[fase_3_voltage] (missing space)
localfase 3 = otherdevices_svalues[fase_3_voltage]
The code works ok for the first time. If the trigger == off then the device is updated correct, if the triger goes back to 'on' the last value stays on and gets counted in the total.
I've modified this in the code and now its looking great!!
Code: Select all
-- just return if AWMT-230 is activated
if otherdevices[trigger] == 'On' then
if debug then
print('skipping power update because state of ' .. trigger .. ' is ' .. otherdevices[trigger])
end
return commandArray
end
Code: Select all
-- just return if AWMT-230 is activated
if otherdevices[trigger] == 'On' then
if debug then
print('skipping power update because state of ' .. trigger .. ' is ' .. otherdevices[trigger])
end
power_total_a = 0
commandArray[1] = {['UpdateDevice'] = dummymeter_id0 .. "|0|" .. power_total_a .. ";" .. (power_total_a/1000)}
return commandArray
end
SolarEdge ModbusTCP - Open Weather Map - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
- RonkA
- Posts: 95
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2023.2
- Location: Harlingen
- Contact:
Re: Power measuring for 3 phase boiler
Still going strong, this is the code right now:
Code: Select all
commandArray = {}
local debug = false
-- My boiler nominal power is 5.568 Watt at 230 Volt.
-- Update these lines before use
local trigger = "Boiler boven inverteerd" -- name of the meter to trigger the dummy meter update.
local fase_1_voltage = "Net - Voltage L1" -- name of smart meter device
local fase_2_voltage = "Net - Voltage L2" -- name of smart meter device
local fase_3_voltage = "Net - Voltage L3" -- name of smart meter device
local resistor_1 = 27.8 -- Ohm value of resistor
local resistor_2 = 27.9 -- Ohm value of resistor
local resistor_3 = 29.9 -- Ohm value of resistor
local dummymeter0 = "Boiler boven - Verbruik" -- name of virtual sensor
local dummymeter_id0 = 133 -- ID of virtual sensor
local fase1Changed = devicechanged[fase_1_voltage]
local fase2Changed = devicechanged[fase_2_voltage]
local fase3Changed = devicechanged[fase_3_voltage]
if not (fase1Changed or fase2Changed or fase3Changed) then
-- not one of the interesting devices
return commandArray
end
if debug then
if fase1Changed then print('Phase ' .. fase_1_voltage .. ' changed to ' .. fase1Changed) end
if fase2Changed then print('Phase ' .. fase_2_voltage .. ' changed to ' .. fase2Changed) end
if fase3Changed then print('Phase ' .. fase_3_voltage .. ' changed to ' .. fase3Changed) end
end
-- My triggerdevice sends 'Off' when boiler is activated. 'On' updates 0 Watt to virtual sensor.
if otherdevices[trigger] == 'On' then
if debug then
print('skipping power update because state of ' .. trigger .. ' is ' .. otherdevices[trigger])
end
local power_total_a = 0
commandArray[1] = {['UpdateDevice'] = dummymeter_id0 .. "|0|" .. power_total_a .. ";" .. (power_total_a/1000)}
return commandArray
end
-- loop
local fase1 = otherdevices_svalues[fase_1_voltage] -- Voltage fase 1
local fase2 = otherdevices_svalues[fase_2_voltage] -- Voltage fase 2
local fase3 = otherdevices_svalues[fase_3_voltage] -- Voltage fase 3
local power_L1 = (fase1 * fase1) / resistor_1 -- power used fase 1
local power_L2 = (fase2 * fase2) / resistor_2 -- power used fase 2
local power_L3 = (fase3 * fase3) / resistor_3 -- power used fase 3
local power_total = power_L1 + power_L2 + power_L3 -- totaal power used
local power_total_a = math.floor(power_total) -- remove value after comma
if (debug) then
print('Voltage fase 1 = ' .. fase1 .. ' Voltage fase 2 = ' .. fase2 .. ' Voltage fase 2 = ' .. fase3)
print('power_L1 = ' .. power_L1 .. ' power_L2 = ' .. power_L2 .. ' power_L3 = ' .. power_L3)
print('total power = ' .. power_total .. ' total power rounded = ' .. power_total_a)
end
-- Populate commandArray with update command
commandArray[1] = {['UpdateDevice'] = dummymeter_id0 .. "|0|" .. power_total_a .. ";" .. (power_total/1000)}
return commandArray
SolarEdge ModbusTCP - Open Weather Map - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
Who is online
Users browsing this forum: No registered users and 1 guest