#27 induction matrix RTU split into two RTUs, supporting pre and post Mekansim 10.1

This commit is contained in:
Mikayla Fischler 2022-05-03 10:45:35 -04:00
parent c76200b0e3
commit e2f7318922
3 changed files with 48 additions and 2 deletions

View 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

View File

@ -17,12 +17,21 @@ function new(imatrix)
-- none
-- input registers --
-- @todo check these on Mekanism 10.1+
-- 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)
-- containers
self.rtu.connect_input_reg(self.imatrix.getTotalEnergy)
self.rtu.connect_input_reg(self.imatrix.getTotalEnergyNeeded)
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 --
-- none

View File

@ -20,7 +20,7 @@ os.loadAPI("dev/boiler_rtu.lua")
os.loadAPI("dev/imatrix_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
@ -178,7 +178,11 @@ for i = 1, #rtu_devices do
rtu_type = rtu_t.turbine
rtu_iface = turbine_rtu.new(device)
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_iface = imatrix_rtu.new(device)
else