mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#27 induction matrix RTU split into two RTUs, supporting pre and post Mekansim 10.1
This commit is contained in:
parent
c76200b0e3
commit
e2f7318922
33
rtu/dev/energymachine_rtu.lua
Normal file
33
rtu/dev/energymachine_rtu.lua
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
-- #REQUIRES rtu.lua
|
||||||
|
|
||||||
|
function new(machine)
|
||||||
|
local self = {
|
||||||
|
rtu = rtu.rtu_init(),
|
||||||
|
machine = machine
|
||||||
|
}
|
||||||
|
|
||||||
|
local rtu_interface = function ()
|
||||||
|
return self.rtu
|
||||||
|
end
|
||||||
|
|
||||||
|
-- discrete inputs --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- coils --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
-- input registers --
|
||||||
|
-- build properties
|
||||||
|
self.rtu.connect_input_reg(self.machine.getTotalMaxEnergy)
|
||||||
|
-- containers
|
||||||
|
self.rtu.connect_input_reg(self.machine.getTotalEnergy)
|
||||||
|
self.rtu.connect_input_reg(self.machine.getTotalEnergyNeeded)
|
||||||
|
self.rtu.connect_input_reg(self.machine.getTotalEnergyFilledPercentage)
|
||||||
|
|
||||||
|
-- holding registers --
|
||||||
|
-- none
|
||||||
|
|
||||||
|
return {
|
||||||
|
rtu_interface = rtu_interface
|
||||||
|
}
|
||||||
|
end
|
@ -17,12 +17,21 @@ function new(imatrix)
|
|||||||
-- none
|
-- none
|
||||||
|
|
||||||
-- input registers --
|
-- input registers --
|
||||||
|
-- @todo check these on Mekanism 10.1+
|
||||||
-- build properties
|
-- build properties
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getTransferCap)
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getInstalledCells)
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getInstalledProviders)
|
||||||
self.rtu.connect_input_reg(self.imatrix.getTotalMaxEnergy)
|
self.rtu.connect_input_reg(self.imatrix.getTotalMaxEnergy)
|
||||||
-- containers
|
-- containers
|
||||||
self.rtu.connect_input_reg(self.imatrix.getTotalEnergy)
|
self.rtu.connect_input_reg(self.imatrix.getTotalEnergy)
|
||||||
self.rtu.connect_input_reg(self.imatrix.getTotalEnergyNeeded)
|
self.rtu.connect_input_reg(self.imatrix.getTotalEnergyNeeded)
|
||||||
self.rtu.connect_input_reg(self.imatrix.getTotalEnergyFilledPercentage)
|
self.rtu.connect_input_reg(self.imatrix.getTotalEnergyFilledPercentage)
|
||||||
|
-- additional fields? check these on 10.1
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getInputItem)
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getOutputItem)
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getLastInput)
|
||||||
|
self.rtu.connect_input_reg(self.imatrix.getLastOutput)
|
||||||
|
|
||||||
-- holding registers --
|
-- holding registers --
|
||||||
-- none
|
-- none
|
||||||
|
@ -20,7 +20,7 @@ os.loadAPI("dev/boiler_rtu.lua")
|
|||||||
os.loadAPI("dev/imatrix_rtu.lua")
|
os.loadAPI("dev/imatrix_rtu.lua")
|
||||||
os.loadAPI("dev/turbine_rtu.lua")
|
os.loadAPI("dev/turbine_rtu.lua")
|
||||||
|
|
||||||
local RTU_VERSION = "alpha-v0.4.11"
|
local RTU_VERSION = "alpha-v0.4.12"
|
||||||
|
|
||||||
local rtu_t = types.rtu_t
|
local rtu_t = types.rtu_t
|
||||||
|
|
||||||
@ -178,7 +178,11 @@ for i = 1, #rtu_devices do
|
|||||||
rtu_type = rtu_t.turbine
|
rtu_type = rtu_t.turbine
|
||||||
rtu_iface = turbine_rtu.new(device)
|
rtu_iface = turbine_rtu.new(device)
|
||||||
elseif type == "mekanismMachine" then
|
elseif type == "mekanismMachine" then
|
||||||
-- assumed to be an induction matrix multiblock
|
-- assumed to be an induction matrix multiblock, pre Mekanism 10.1
|
||||||
|
rtu_type = rtu_t.energy_machine
|
||||||
|
rtu_iface = energymachine_rtu.new(device)
|
||||||
|
elseif type == "inductionMatrix" then
|
||||||
|
-- induction matrix multiblock, post Mekanism 10.1
|
||||||
rtu_type = rtu_t.induction_matrix
|
rtu_type = rtu_t.induction_matrix
|
||||||
rtu_iface = imatrix_rtu.new(device)
|
rtu_iface = imatrix_rtu.new(device)
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user