cc-mek-scada/rtu/dev/energymachine_rtu.lua

40 lines
876 B
Lua
Raw Normal View History

2022-05-12 19:36:27 +00:00
local rtu = require("rtu.rtu")
local energymachine_rtu = {}
2022-05-12 19:36:27 +00:00
-- create new energy machine device
---@param machine table
energymachine_rtu.new = function (machine)
local self = {
rtu = rtu.init_unit(),
machine = machine
}
2022-05-12 19:36:27 +00:00
---@class rtu_device
local public = {}
-- get the RTU interface
public.rtu_interface = function () return self.rtu end
-- discrete inputs --
-- none
-- coils --
-- none
-- input registers --
-- build properties
self.rtu.connect_input_reg(self.machine.getTotalMaxEnergy)
-- containers
self.rtu.connect_input_reg(self.machine.getTotalEnergy)
self.rtu.connect_input_reg(self.machine.getTotalEnergyNeeded)
self.rtu.connect_input_reg(self.machine.getTotalEnergyFilledPercentage)
-- holding registers --
-- none
2022-05-12 19:36:27 +00:00
return public
end
return energymachine_rtu