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

45 lines
1.2 KiB
Lua
Raw Normal View History

2022-05-12 19:36:27 +00:00
local rtu = require("rtu.rtu")
local imatrix_rtu = {}
2022-05-12 19:36:27 +00:00
-- create new induction matrix (mek 10.1+) device
2023-02-22 04:50:43 +00:00
---@nodiscard
2022-05-12 19:36:27 +00:00
---@param imatrix table
---@return rtu_device interface, boolean faulted
function imatrix_rtu.new(imatrix)
local unit = rtu.init_unit(imatrix)
-- discrete inputs --
unit.connect_di("isFormed")
-- coils --
-- none
-- input registers --
2022-05-04 15:23:45 +00:00
-- multiblock properties
unit.connect_input_reg("getLength")
unit.connect_input_reg("getWidth")
unit.connect_input_reg("getHeight")
unit.connect_input_reg("getMinPos")
unit.connect_input_reg("getMaxPos")
-- build properties
unit.connect_input_reg("getMaxEnergy")
unit.connect_input_reg("getTransferCap")
unit.connect_input_reg("getInstalledCells")
unit.connect_input_reg("getInstalledProviders")
2022-05-04 15:23:45 +00:00
-- I/O rates
unit.connect_input_reg("getLastInput")
unit.connect_input_reg("getLastOutput")
2022-06-04 21:45:52 +00:00
-- tanks
unit.connect_input_reg("getEnergy")
unit.connect_input_reg("getEnergyNeeded")
unit.connect_input_reg("getEnergyFilledPercentage")
-- holding registers --
-- none
return unit.interface(), false
end
return imatrix_rtu