mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#27 mekanism 10.1+ RTU support
This commit is contained in:
parent
8b7ef47aad
commit
1cb5a0789e
56
rtu/dev/boilerv_rtu.lua
Normal file
56
rtu/dev/boilerv_rtu.lua
Normal file
@ -0,0 +1,56 @@
|
||||
-- #REQUIRES rtu.lua
|
||||
|
||||
function new(boiler)
|
||||
local self = {
|
||||
rtu = rtu.rtu_init(),
|
||||
boiler = boiler
|
||||
}
|
||||
|
||||
local rtu_interface = function ()
|
||||
return self.rtu
|
||||
end
|
||||
|
||||
-- discrete inputs --
|
||||
-- none
|
||||
|
||||
-- coils --
|
||||
-- none
|
||||
|
||||
-- input registers --
|
||||
-- multiblock properties
|
||||
self.rtu.connect_input_reg(self.boiler.isFormed)
|
||||
self.rtu.connect_input_reg(self.boiler.getLength)
|
||||
self.rtu.connect_input_reg(self.boiler.getWidth)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeight)
|
||||
-- build properties
|
||||
self.rtu.connect_input_reg(self.boiler.getBoilCapacity)
|
||||
self.rtu.connect_input_reg(self.boiler.getSteamCapacity)
|
||||
self.rtu.connect_input_reg(self.boiler.getWaterCapacity)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeatedCoolantCapacity)
|
||||
self.rtu.connect_input_reg(self.boiler.getCooledCoolantCapacity)
|
||||
self.rtu.connect_input_reg(self.boiler.getSuperheaters)
|
||||
self.rtu.connect_input_reg(self.boiler.getMaxBoilRate)
|
||||
-- current state
|
||||
self.rtu.connect_input_reg(self.boiler.getTemperature)
|
||||
self.rtu.connect_input_reg(self.boiler.getBoilRate)
|
||||
-- tanks
|
||||
self.rtu.connect_input_reg(self.boiler.getSteam)
|
||||
self.rtu.connect_input_reg(self.boiler.getSteamNeeded)
|
||||
self.rtu.connect_input_reg(self.boiler.getSteamFilledPercentage)
|
||||
self.rtu.connect_input_reg(self.boiler.getWater)
|
||||
self.rtu.connect_input_reg(self.boiler.getWaterNeeded)
|
||||
self.rtu.connect_input_reg(self.boiler.getWaterFilledPercentage)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeatedCoolant)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeatedCoolantNeeded)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeatedCoolantFilledPercentage)
|
||||
self.rtu.connect_input_reg(self.boiler.getCooledCoolant)
|
||||
self.rtu.connect_input_reg(self.boiler.getCooledCoolantNeeded)
|
||||
self.rtu.connect_input_reg(self.boiler.getCooledCoolantFilledPercentage)
|
||||
|
||||
-- holding registers --
|
||||
-- none
|
||||
|
||||
return {
|
||||
rtu_interface = rtu_interface
|
||||
}
|
||||
end
|
@ -17,19 +17,21 @@ function new(imatrix)
|
||||
-- none
|
||||
|
||||
-- input registers --
|
||||
-- @todo check these on Mekanism 10.1+
|
||||
-- multiblock properties
|
||||
self.rtu.connect_input_reg(self.boiler.isFormed)
|
||||
self.rtu.connect_input_reg(self.boiler.getLength)
|
||||
self.rtu.connect_input_reg(self.boiler.getWidth)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeight)
|
||||
-- build properties
|
||||
self.rtu.connect_input_reg(self.imatrix.getMaxEnergy)
|
||||
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.getEnergy)
|
||||
self.rtu.connect_input_reg(self.imatrix.getEnergyNeeded)
|
||||
self.rtu.connect_input_reg(self.imatrix.getEnergyFilledPercentage)
|
||||
-- I/O rates
|
||||
self.rtu.connect_input_reg(self.imatrix.getLastInput)
|
||||
self.rtu.connect_input_reg(self.imatrix.getLastOutput)
|
||||
|
||||
|
55
rtu/dev/turbinev_rtu.lua
Normal file
55
rtu/dev/turbinev_rtu.lua
Normal file
@ -0,0 +1,55 @@
|
||||
-- #REQUIRES rtu.lua
|
||||
|
||||
function new(turbine)
|
||||
local self = {
|
||||
rtu = rtu.rtu_init(),
|
||||
turbine = turbine
|
||||
}
|
||||
|
||||
local rtu_interface = function ()
|
||||
return self.rtu
|
||||
end
|
||||
|
||||
-- discrete inputs --
|
||||
-- none
|
||||
|
||||
-- coils --
|
||||
self.rtu.connect_coil(function () self.turbine.incrementDumpingMode() end), function () end)
|
||||
self.rtu.connect_coil(function () self.turbine.decrementDumpingMode() end), function () end)
|
||||
|
||||
-- input registers --
|
||||
-- multiblock properties
|
||||
self.rtu.connect_input_reg(self.boiler.isFormed)
|
||||
self.rtu.connect_input_reg(self.boiler.getLength)
|
||||
self.rtu.connect_input_reg(self.boiler.getWidth)
|
||||
self.rtu.connect_input_reg(self.boiler.getHeight)
|
||||
-- build properties
|
||||
self.rtu.connect_input_reg(self.turbine.getBlades)
|
||||
self.rtu.connect_input_reg(self.turbine.getCoils)
|
||||
self.rtu.connect_input_reg(self.turbine.getVents)
|
||||
self.rtu.connect_input_reg(self.turbine.getDispersers)
|
||||
self.rtu.connect_input_reg(self.turbine.getCondensers)
|
||||
self.rtu.connect_input_reg(self.turbine.getDumpingMode)
|
||||
self.rtu.connect_input_reg(self.turbine.getSteamCapacity)
|
||||
self.rtu.connect_input_reg(self.turbine.getMaxFlowRate)
|
||||
self.rtu.connect_input_reg(self.turbine.getMaxWaterOutput)
|
||||
self.rtu.connect_input_reg(self.turbine.getMaxProduction)
|
||||
-- current state
|
||||
self.rtu.connect_input_reg(self.turbine.getFlowRate)
|
||||
self.rtu.connect_input_reg(self.turbine.getProductionRate)
|
||||
self.rtu.connect_input_reg(self.turbine.getLastSteamInputRate)
|
||||
-- tanks/containers
|
||||
self.rtu.connect_input_reg(self.turbine.getSteam)
|
||||
self.rtu.connect_input_reg(self.turbine.getSteamNeeded)
|
||||
self.rtu.connect_input_reg(self.turbine.getSteamFilledPercentage)
|
||||
self.rtu.connect_input_reg(self.turbine.getEnergy)
|
||||
self.rtu.connect_input_reg(self.turbine.getEnergyNeeded)
|
||||
self.rtu.connect_input_reg(self.turbine.getEnergyFilledPercentage)
|
||||
|
||||
-- holding registers --
|
||||
self.rtu.conenct_holding_reg(self.turbine.setDumpingMode, self.turbine.getDumpingMode)
|
||||
|
||||
return {
|
||||
rtu_interface = rtu_interface
|
||||
}
|
||||
end
|
@ -17,10 +17,13 @@ os.loadAPI("threads.lua")
|
||||
|
||||
os.loadAPI("dev/redstone_rtu.lua")
|
||||
os.loadAPI("dev/boiler_rtu.lua")
|
||||
os.loadAPI("dev/boilerv_rtu.lua")
|
||||
os.loadAPI("dev/energymachine_rtu.lua")
|
||||
os.loadAPI("dev/imatrix_rtu.lua")
|
||||
os.loadAPI("dev/turbine_rtu.lua")
|
||||
os.loadAPI("dev/turbinev_rtu.lua")
|
||||
|
||||
local RTU_VERSION = "alpha-v0.4.13"
|
||||
local RTU_VERSION = "alpha-v0.5.0"
|
||||
|
||||
local rtu_t = types.rtu_t
|
||||
|
||||
@ -173,16 +176,25 @@ for i = 1, #rtu_devices do
|
||||
-- boiler multiblock
|
||||
rtu_type = rtu_t.boiler
|
||||
rtu_iface = boiler_rtu.new(device)
|
||||
elseif type == "boilerValve" then
|
||||
-- boiler multiblock (10.1+)
|
||||
rtu_type = rtu_t.boiler_valve
|
||||
rtu_iface = boilerv_rtu.new(device)
|
||||
elseif type == "turbine" then
|
||||
-- turbine multiblock
|
||||
rtu_type = rtu_t.turbine
|
||||
rtu_iface = turbine_rtu.new(device)
|
||||
elseif type == "turbineValve" then
|
||||
-- turbine multiblock (10.1+)
|
||||
rtu_type = rtu_t.turbine_valve
|
||||
rtu_iface = turbinev_rtu.new(device)
|
||||
elseif type == "mekanismMachine" then
|
||||
-- assumed to be an induction matrix multiblock, pre Mekanism 10.1
|
||||
-- also works with energy cubes
|
||||
rtu_type = rtu_t.energy_machine
|
||||
rtu_iface = energymachine_rtu.new(device)
|
||||
elseif type == "inductionMatrix" then
|
||||
-- induction matrix multiblock, post Mekanism 10.1
|
||||
elseif type == "inductionPort" then
|
||||
-- induction matrix multiblock (10.1+)
|
||||
rtu_type = rtu_t.induction_matrix
|
||||
rtu_iface = imatrix_rtu.new(device)
|
||||
else
|
||||
|
@ -3,9 +3,11 @@
|
||||
rtu_t = {
|
||||
redstone = "redstone",
|
||||
boiler = "boiler",
|
||||
boiler_valve = "boiler_valve",
|
||||
turbine = "turbine",
|
||||
turbine_valve = "turbine_valve",
|
||||
energy_machine = "emachine",
|
||||
induction_matrix = "imatrix"
|
||||
induction_matrix = "induction_matrix"
|
||||
}
|
||||
|
||||
iss_status_t = {
|
||||
|
Loading…
Reference in New Issue
Block a user