2022-05-12 19:36:27 +00:00
|
|
|
local rtu = require("rtu.rtu")
|
2022-01-25 19:51:33 +00:00
|
|
|
|
2022-05-04 17:37:01 +00:00
|
|
|
local turbine_rtu = {}
|
|
|
|
|
2022-05-12 19:36:27 +00:00
|
|
|
-- create new turbine (mek 10.0) device
|
|
|
|
---@param turbine table
|
2022-05-04 17:37:01 +00:00
|
|
|
turbine_rtu.new = function (turbine)
|
2022-01-25 19:51:33 +00:00
|
|
|
local self = {
|
2022-05-04 17:37:01 +00:00
|
|
|
rtu = rtu.init_unit(),
|
2022-01-25 19:51:33 +00:00
|
|
|
turbine = turbine
|
|
|
|
}
|
|
|
|
|
|
|
|
-- discrete inputs --
|
|
|
|
-- none
|
|
|
|
|
|
|
|
-- coils --
|
|
|
|
-- none
|
|
|
|
|
|
|
|
-- input registers --
|
|
|
|
-- build properties
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getBlades)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getCoils)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getVents)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getDispersers)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getCondensers)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getSteamCapacity)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getMaxFlowRate)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getMaxProduction)
|
2022-05-13 13:39:28 +00:00
|
|
|
self.rtu.connect_input_reg(self.turbine.getMaxWaterOutput)
|
2022-01-25 19:51:33 +00:00
|
|
|
-- current state
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getFlowRate)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getProductionRate)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getLastSteamInputRate)
|
2022-05-13 13:39:28 +00:00
|
|
|
self.rtu.connect_input_reg(self.turbine.getDumpingMode)
|
2022-01-25 19:51:33 +00:00
|
|
|
-- tanks
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getSteam)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getSteamNeeded)
|
|
|
|
self.rtu.connect_input_reg(self.turbine.getSteamFilledPercentage)
|
|
|
|
|
|
|
|
-- holding registers --
|
|
|
|
-- none
|
|
|
|
|
2022-05-12 19:36:27 +00:00
|
|
|
return self.rtu.interface()
|
2022-01-25 19:51:33 +00:00
|
|
|
end
|
2022-05-04 17:37:01 +00:00
|
|
|
|
|
|
|
return turbine_rtu
|