2022-06-04 14:49:36 +00:00
|
|
|
local rtu = require("rtu.rtu")
|
|
|
|
|
|
|
|
local sps_rtu = {}
|
|
|
|
|
2023-02-22 04:50:43 +00:00
|
|
|
-- create new super-critical phase shifter (SPS) device
|
|
|
|
---@nodiscard
|
2022-06-04 14:49:36 +00:00
|
|
|
---@param sps table
|
2023-04-06 16:52:25 +00:00
|
|
|
---@return rtu_device interface, boolean faulted
|
2022-06-04 14:49:36 +00:00
|
|
|
function sps_rtu.new(sps)
|
2024-03-09 18:24:06 +00:00
|
|
|
local unit = rtu.init_unit(sps)
|
2022-06-04 14:49:36 +00:00
|
|
|
|
|
|
|
-- discrete inputs --
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_di("isFormed")
|
2022-06-04 14:49:36 +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-06-04 14:49:36 +00:00
|
|
|
-- build properties
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getCoils")
|
|
|
|
unit.connect_input_reg("getInputCapacity")
|
|
|
|
unit.connect_input_reg("getOutputCapacity")
|
|
|
|
unit.connect_input_reg("getMaxEnergy")
|
2022-06-04 14:49:36 +00:00
|
|
|
-- current state
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getProcessRate")
|
2022-06-04 14:49:36 +00:00
|
|
|
-- tanks
|
2024-03-23 04:26:58 +00:00
|
|
|
unit.connect_input_reg("getInput")
|
|
|
|
unit.connect_input_reg("getInputNeeded")
|
|
|
|
unit.connect_input_reg("getInputFilledPercentage")
|
|
|
|
unit.connect_input_reg("getOutput")
|
|
|
|
unit.connect_input_reg("getOutputNeeded")
|
|
|
|
unit.connect_input_reg("getOutputFilledPercentage")
|
|
|
|
unit.connect_input_reg("getEnergy")
|
|
|
|
unit.connect_input_reg("getEnergyNeeded")
|
|
|
|
unit.connect_input_reg("getEnergyFilledPercentage")
|
2022-06-04 14:49:36 +00:00
|
|
|
|
|
|
|
-- holding registers --
|
|
|
|
-- none
|
|
|
|
|
2024-03-23 04:26:58 +00:00
|
|
|
return unit.interface(), false
|
2022-06-04 14:49:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return sps_rtu
|