mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
local rtu = require("rtu")
|
|
|
|
local imatrix_rtu = {}
|
|
|
|
imatrix_rtu.new = function (imatrix)
|
|
local self = {
|
|
rtu = rtu.init_unit(),
|
|
imatrix = imatrix
|
|
}
|
|
|
|
local rtu_interface = function ()
|
|
return self.rtu
|
|
end
|
|
|
|
-- discrete inputs --
|
|
-- none
|
|
|
|
-- coils --
|
|
-- none
|
|
|
|
-- input registers --
|
|
-- multiblock properties
|
|
self.rtu.connect_input_reg(self.boiler.isFormed)
|
|
self.rtu.connect_input_reg(self.boiler.getLength)
|
|
self.rtu.connect_input_reg(self.boiler.getWidth)
|
|
self.rtu.connect_input_reg(self.boiler.getHeight)
|
|
-- build properties
|
|
self.rtu.connect_input_reg(self.imatrix.getMaxEnergy)
|
|
self.rtu.connect_input_reg(self.imatrix.getTransferCap)
|
|
self.rtu.connect_input_reg(self.imatrix.getInstalledCells)
|
|
self.rtu.connect_input_reg(self.imatrix.getInstalledProviders)
|
|
-- containers
|
|
self.rtu.connect_input_reg(self.imatrix.getEnergy)
|
|
self.rtu.connect_input_reg(self.imatrix.getEnergyNeeded)
|
|
self.rtu.connect_input_reg(self.imatrix.getEnergyFilledPercentage)
|
|
-- I/O rates
|
|
self.rtu.connect_input_reg(self.imatrix.getLastInput)
|
|
self.rtu.connect_input_reg(self.imatrix.getLastOutput)
|
|
|
|
-- holding registers --
|
|
-- none
|
|
|
|
return {
|
|
rtu_interface = rtu_interface
|
|
}
|
|
end
|
|
|
|
return imatrix_rtu
|