2022-05-12 19:36:27 +00:00
|
|
|
local rtu = require("rtu.rtu")
|
2022-05-03 14:45:35 +00:00
|
|
|
|
2022-05-04 17:37:01 +00:00
|
|
|
local energymachine_rtu = {}
|
|
|
|
|
2022-05-12 19:36:27 +00:00
|
|
|
-- create new energy machine device
|
|
|
|
---@param machine table
|
2022-05-31 18:54:55 +00:00
|
|
|
function energymachine_rtu.new(machine)
|
|
|
|
local unit = rtu.init_unit()
|
2022-05-03 14:45:35 +00:00
|
|
|
|
|
|
|
-- discrete inputs --
|
|
|
|
-- none
|
|
|
|
|
|
|
|
-- coils --
|
|
|
|
-- none
|
|
|
|
|
|
|
|
-- input registers --
|
|
|
|
-- build properties
|
2022-05-31 18:54:55 +00:00
|
|
|
unit.connect_input_reg(machine.getTotalMaxEnergy)
|
2022-05-03 14:45:35 +00:00
|
|
|
-- containers
|
2022-05-31 18:54:55 +00:00
|
|
|
unit.connect_input_reg(machine.getTotalEnergy)
|
|
|
|
unit.connect_input_reg(machine.getTotalEnergyNeeded)
|
|
|
|
unit.connect_input_reg(machine.getTotalEnergyFilledPercentage)
|
2022-05-03 14:45:35 +00:00
|
|
|
|
|
|
|
-- holding registers --
|
|
|
|
-- none
|
|
|
|
|
2022-05-31 18:54:55 +00:00
|
|
|
return unit.interface()
|
2022-05-03 14:45:35 +00:00
|
|
|
end
|
2022-05-04 17:37:01 +00:00
|
|
|
|
|
|
|
return energymachine_rtu
|