2022-05-12 19:36:27 +00:00
|
|
|
local rtu = require("rtu.rtu")
|
2022-05-04 15:23:45 +00:00
|
|
|
|
2022-05-04 17:37:01 +00:00
|
|
|
local boilerv_rtu = {}
|
|
|
|
|
2023-07-11 21:27:03 +00:00
|
|
|
-- create new boiler device
|
2023-02-22 04:50:43 +00:00
|
|
|
---@nodiscard
|
2022-05-12 19:36:27 +00:00
|
|
|
---@param boiler table
|
2023-04-06 16:52:25 +00:00
|
|
|
---@return rtu_device interface, boolean faulted
|
2022-05-31 18:54:55 +00:00
|
|
|
function boilerv_rtu.new(boiler)
|
2024-03-09 18:24:06 +00:00
|
|
|
local unit = rtu.init_unit(boiler)
|
2022-05-04 15:23:45 +00:00
|
|
|
|
|
|
|
-- discrete inputs --
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_di("isFormed")
|
2022-05-04 15:23:45 +00:00
|
|
|
|
|
|
|
-- coils --
|
|
|
|
-- none
|
|
|
|
|
|
|
|
-- input registers --
|
|
|
|
-- multiblock properties
|
2024-03-23 04:26:58 +00:00
|
|
|
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")
|
2022-05-04 15:23:45 +00:00
|
|
|
-- build properties
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getBoilCapacity")
|
|
|
|
unit.connect_input_reg("getSteamCapacity")
|
|
|
|
unit.connect_input_reg("getWaterCapacity")
|
|
|
|
unit.connect_input_reg("getHeatedCoolantCapacity")
|
|
|
|
unit.connect_input_reg("getCooledCoolantCapacity")
|
|
|
|
unit.connect_input_reg("getSuperheaters")
|
|
|
|
unit.connect_input_reg("getMaxBoilRate")
|
2022-05-04 15:23:45 +00:00
|
|
|
-- current state
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getTemperature")
|
|
|
|
unit.connect_input_reg("getBoilRate")
|
|
|
|
unit.connect_input_reg("getEnvironmentalLoss")
|
2022-05-04 15:23:45 +00:00
|
|
|
-- tanks
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getSteam")
|
|
|
|
unit.connect_input_reg("getSteamNeeded")
|
|
|
|
unit.connect_input_reg("getSteamFilledPercentage")
|
|
|
|
unit.connect_input_reg("getWater")
|
|
|
|
unit.connect_input_reg("getWaterNeeded")
|
|
|
|
unit.connect_input_reg("getWaterFilledPercentage")
|
|
|
|
unit.connect_input_reg("getHeatedCoolant")
|
|
|
|
unit.connect_input_reg("getHeatedCoolantNeeded")
|
|
|
|
unit.connect_input_reg("getHeatedCoolantFilledPercentage")
|
|
|
|
unit.connect_input_reg("getCooledCoolant")
|
|
|
|
unit.connect_input_reg("getCooledCoolantNeeded")
|
|
|
|
unit.connect_input_reg("getCooledCoolantFilledPercentage")
|
2022-05-04 15:23:45 +00:00
|
|
|
|
|
|
|
-- holding registers --
|
|
|
|
-- none
|
|
|
|
|
2024-03-23 04:26:58 +00:00
|
|
|
return unit.interface(), false
|
2022-05-04 15:23:45 +00:00
|
|
|
end
|
2022-05-04 17:37:01 +00:00
|
|
|
|
|
|
|
return boilerv_rtu
|