Skip to main content

Electrolyser Production Rate Control in Rule Engine

What We Control?

We want to set production rate to 60% in the evening. We want to automate this.

Objective of Automation

Decrease electrolyser power demand in the evening to avoid overload.

Requirements

At least one electrolyser is needed.

Rule

local electrolysers = {
'D4416F63D6F029A6D88855F157E01CB9',
'4D6DC302EA88E381A56C15A450F3EDFA',
}

function main()
if time.is_now_between('17:00', '19:00', TIMEZONE) then
set_production_rate_low(electrolysers)
else
set_production_rate_high(electrolysers)
end
end

function set_production_rate_low(els)
for _, id in pairs(els) do
local el = enapter.device(id)
if el then
enapter.log("Setting 60% production rate for electrolyser: " .. el.id)
el.commands.execute("set_production_rate", { value = 60 })
else
enapter.log("Electrolyser `" .. id .. "` not found", "error")
end
end
end

function set_production_rate_high(els)
for _, id in pairs(els) do
local el = enapter.device(id)
if el then
enapter.log("Setting 100% production rate for electrolyser: " .. el.id)
el.commands.execute("set_production_rate", { value = 100 })
else
enapter.log("Electrolyser `" .. id .. "` not found", "error")
end
end
end

main()
Hardware diversity is welcome. Integrate any device into a unified energy network.
© 2024 Enapter
Developer toolkit
DocumentationReference