mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
parent
3bb95eb441
commit
fc7b83a18a
26
rtu/dev/envd_rtu.lua
Normal file
26
rtu/dev/envd_rtu.lua
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
local rtu = require("rtu.rtu")
|
||||||
|
|
||||||
|
local envd_rtu = {}
|
||||||
|
|
||||||
|
-- create new environment detector device
|
||||||
|
---@param envd table
|
||||||
|
function envd_rtu.new(envd)
|
||||||
|
local unit = rtu.init_unit()
|
||||||
|
|
||||||
|
-- discrete inputs --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- coils --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- input registers --
|
||||||
|
unit.connect_input_reg(envd.getRadiation)
|
||||||
|
unit.connect_input_reg(envd.getRadiationRaw)
|
||||||
|
|
||||||
|
-- holding registers --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
return unit.interface()
|
||||||
|
end
|
||||||
|
|
||||||
|
return envd_rtu
|
37
rtu/dev/sna_rtu.lua
Normal file
37
rtu/dev/sna_rtu.lua
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
local rtu = require("rtu.rtu")
|
||||||
|
|
||||||
|
local sna_rtu = {}
|
||||||
|
|
||||||
|
-- create new solar neutron activator (sna) device
|
||||||
|
---@param sna table
|
||||||
|
function sna_rtu.new(sna)
|
||||||
|
local unit = rtu.init_unit()
|
||||||
|
|
||||||
|
-- discrete inputs --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- coils --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- input registers --
|
||||||
|
-- build properties
|
||||||
|
unit.connect_input_reg(sna.getInputCapacity)
|
||||||
|
unit.connect_input_reg(sna.getOutputCapacity)
|
||||||
|
-- current state
|
||||||
|
unit.connect_input_reg(sna.getProductionRate)
|
||||||
|
unit.connect_input_reg(sna.getPeakProductionRate)
|
||||||
|
-- tanks
|
||||||
|
unit.connect_input_reg(sna.getInput)
|
||||||
|
unit.connect_input_reg(sna.getInputNeeded)
|
||||||
|
unit.connect_input_reg(sna.getInputFilledPercentage)
|
||||||
|
unit.connect_input_reg(sna.getOutput)
|
||||||
|
unit.connect_input_reg(sna.getOutputNeeded)
|
||||||
|
unit.connect_input_reg(sna.getOutputFilledPercentage)
|
||||||
|
|
||||||
|
-- holding registers --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
return unit.interface()
|
||||||
|
end
|
||||||
|
|
||||||
|
return sna_rtu
|
47
rtu/dev/sps_rtu.lua
Normal file
47
rtu/dev/sps_rtu.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
local rtu = require("rtu.rtu")
|
||||||
|
|
||||||
|
local sps_rtu = {}
|
||||||
|
|
||||||
|
-- create new super-critical phase shifter (sps) device
|
||||||
|
---@param sps table
|
||||||
|
function sps_rtu.new(sps)
|
||||||
|
local unit = rtu.init_unit()
|
||||||
|
|
||||||
|
-- discrete inputs --
|
||||||
|
unit.connect_di(sps.isFormed)
|
||||||
|
|
||||||
|
-- coils --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- input registers --
|
||||||
|
-- multiblock properties
|
||||||
|
unit.connect_input_reg(sps.getLength)
|
||||||
|
unit.connect_input_reg(sps.getWidth)
|
||||||
|
unit.connect_input_reg(sps.getHeight)
|
||||||
|
unit.connect_input_reg(sps.getMinPos)
|
||||||
|
unit.connect_input_reg(sps.getMaxPos)
|
||||||
|
-- build properties
|
||||||
|
unit.connect_input_reg(sps.getCoils)
|
||||||
|
unit.connect_input_reg(sps.getInputCapacity)
|
||||||
|
unit.connect_input_reg(sps.getOutputCapacity)
|
||||||
|
unit.connect_input_reg(sps.getMaxEnergy)
|
||||||
|
-- current state
|
||||||
|
unit.connect_input_reg(sps.getProcessRate)
|
||||||
|
-- tanks
|
||||||
|
unit.connect_input_reg(sps.getInput)
|
||||||
|
unit.connect_input_reg(sps.getInputNeeded)
|
||||||
|
unit.connect_input_reg(sps.getInputFilledPercentage)
|
||||||
|
unit.connect_input_reg(sps.getOutput)
|
||||||
|
unit.connect_input_reg(sps.getOutputNeeded)
|
||||||
|
unit.connect_input_reg(sps.getOutputFilledPercentage)
|
||||||
|
unit.connect_input_reg(sps.getEnergy)
|
||||||
|
unit.connect_input_reg(sps.getEnergyNeeded)
|
||||||
|
unit.connect_input_reg(sps.getEnergyFilledPercentage)
|
||||||
|
|
||||||
|
-- holding registers --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
return unit.interface()
|
||||||
|
end
|
||||||
|
|
||||||
|
return sps_rtu
|
@ -56,7 +56,10 @@ local RTU_UNIT_TYPES = {
|
|||||||
TURBINE = 3, -- turbine
|
TURBINE = 3, -- turbine
|
||||||
TURBINE_VALVE = 4, -- turbine, mekanism 10.1+
|
TURBINE_VALVE = 4, -- turbine, mekanism 10.1+
|
||||||
EMACHINE = 5, -- energy machine
|
EMACHINE = 5, -- energy machine
|
||||||
IMATRIX = 6 -- induction matrix
|
IMATRIX = 6, -- induction matrix
|
||||||
|
SPS = 7, -- SPS
|
||||||
|
SNA = 8, -- SNA
|
||||||
|
ENV_DETECTOR = 9 -- environment detector
|
||||||
}
|
}
|
||||||
|
|
||||||
comms.PROTOCOLS = PROTOCOLS
|
comms.PROTOCOLS = PROTOCOLS
|
||||||
|
@ -41,7 +41,10 @@ types.rtu_t = {
|
|||||||
turbine = "turbine",
|
turbine = "turbine",
|
||||||
turbine_valve = "turbine_valve",
|
turbine_valve = "turbine_valve",
|
||||||
energy_machine = "emachine",
|
energy_machine = "emachine",
|
||||||
induction_matrix = "induction_matrix"
|
induction_matrix = "induction_matrix",
|
||||||
|
sps = "sps",
|
||||||
|
sna = "sna",
|
||||||
|
env_detector = "environment_detector"
|
||||||
}
|
}
|
||||||
|
|
||||||
---@alias rps_status_t string
|
---@alias rps_status_t string
|
||||||
|
@ -101,6 +101,11 @@ function rtu.new_session(id, in_queue, out_queue, advertisement)
|
|||||||
unit = svrs_emachine.new(self.id, i, unit_advert, self.out_q)
|
unit = svrs_emachine.new(self.id, i, unit_advert, self.out_q)
|
||||||
elseif u_type == RTU_UNIT_TYPES.IMATRIX then
|
elseif u_type == RTU_UNIT_TYPES.IMATRIX then
|
||||||
-- @todo Mekanism 10.1+
|
-- @todo Mekanism 10.1+
|
||||||
|
elseif u_type == RTU_UNIT_TYPES.SPS then
|
||||||
|
-- @todo Mekanism 10.1+
|
||||||
|
elseif u_type == RTU_UNIT_TYPES.SNA then
|
||||||
|
-- @todo Mekanism 10.1+
|
||||||
|
elseif u_type == RTU_UNIT_TYPES.ENV_DETECTOR then
|
||||||
else
|
else
|
||||||
log.error(log_header .. "bad advertisement: encountered unsupported RTU type")
|
log.error(log_header .. "bad advertisement: encountered unsupported RTU type")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user