Power-line load monitoring using LogicMachine Reactor #
Task #
How to make a cost-effective power-line current monitor solution based on LogicMachine Reactor?
Connect current sensor with analog output to Reactor’s Analog input #
We recommend Veris Industries H923 split-core current sensor which provides a 0-10V output signal which is proportional to the current flow.
Or there are even more cost-effective 0-5V solutions available from YHCD (~EUR 4/pcs).
Add Analog input object in Reactor tab of LogicMachine #
Adjust the Multiplier parameter of the analog input based on maximum voltage to current ratio.
Example: if the clamp outputs 10V at 30A the multiplier must be set to 3.
The measurement is automatically seen in the Reactor and Objects tab.
Calculating the average #
Event script #
Attach this script to the current value object.
key = 'current'
value = event.getvalue()
storage.exec('rpush', key, value)
Scheduled script #
This script will calculate an average over accumulated values and send the average value to 1/1/1.
Average value can be used to create a more accurate trend log.
key = 'current'
values = storage.exec('lrange', key, 0, -1)
if type(values) == 'table' and #values > 0 then
sum = 0
for _, value in ipairs(values) do
sum = sum + tonumber(value) or 0
end
-- remove read entries from the list
storage.exec('ltrim', key, #values, -1)
avg = sum / #values
log(avg)
end
For multiple current clamps use a different storage key in both scripts.