diff --git a/coordinator/iocontrol.lua b/coordinator/iocontrol.lua index 6feaf5a..2d99905 100644 --- a/coordinator/iocontrol.lua +++ b/coordinator/iocontrol.lua @@ -139,10 +139,9 @@ function iocontrol.update_statuses(statuses) unit.reactor_data.last_status_update = gen_status[1] unit.reactor_data.control_state = gen_status[2] - unit.reactor_data.overridden = gen_status[3] - unit.reactor_data.degraded = gen_status[4] - unit.reactor_data.rps_tripped = gen_status[5] - unit.reactor_data.rps_trip_cause = gen_status[6] + unit.reactor_data.rps_tripped = gen_status[3] + unit.reactor_data.rps_trip_cause = gen_status[4] + unit.reactor_data.degraded = gen_status[5] unit.reactor_data.rps_status = rps_status ---@type rps_status unit.reactor_data.mek_status = mek_status ---@type mek_status diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index 691525f..5983c8a 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -531,7 +531,7 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co local sys_status = { util.time(), -- timestamp (not self.scrammed), -- requested control state - rps.is_tripped(), -- overridden + rps.is_tripped(), -- rps_tripped degraded, -- degraded self.reactor.getHeatingRate(), -- heating rate mek_data -- mekanism status data diff --git a/supervisor/session/plc.lua b/supervisor/session/plc.lua index ffc851b..d682fdb 100644 --- a/supervisor/session/plc.lua +++ b/supervisor/session/plc.lua @@ -86,7 +86,6 @@ function plc.new_session(id, for_reactor, in_queue, out_queue) sDB = { last_status_update = 0, control_state = false, - overridden = false, degraded = false, rps_tripped = false, rps_trip_cause = "ok", ---@type rps_trip_cause @@ -282,11 +281,9 @@ function plc.new_session(id, for_reactor, in_queue, out_queue) if pkt.length >= 5 then self.sDB.last_status_update = pkt.data[1] self.sDB.control_state = pkt.data[2] - self.sDB.overridden = pkt.data[3] + self.sDB.rps_tripped = pkt.data[3] self.sDB.degraded = pkt.data[4] self.sDB.mek_status.heating_rate = pkt.data[5] - ---@todo rps_tripped is redundant with overridden, rename overridden to rps_tripped globally - self.sDB.rps_tripped = pkt.data[4] -- attempt to read mek_data table if pkt.data[6] ~= nil then @@ -357,8 +354,7 @@ function plc.new_session(id, for_reactor, in_queue, out_queue) end elseif pkt.type == RPLC_TYPES.RPS_ALARM then -- RPS alarm - self.sDB.overridden = true - if pkt.length == 8 then + if pkt.length == 10 then self.sDB.rps_tripped = true self.sDB.rps_trip_cause = pkt.data[1] local status = pcall(_copy_rps_status, { table.unpack(pkt.data, 2, #pkt.length) }) @@ -447,10 +443,9 @@ function plc.new_session(id, for_reactor, in_queue, out_queue) return { self.sDB.last_status_update, self.sDB.control_state, - self.sDB.overridden, - self.sDB.degraded, self.sDB.rps_tripped, - self.sDB.rps_trip_cause + self.sDB.rps_trip_cause, + self.sDB.degraded } end diff --git a/supervisor/session/unit.lua b/supervisor/session/unit.lua index 88c512b..6cd3a5a 100644 --- a/supervisor/session/unit.lua +++ b/supervisor/session/unit.lua @@ -125,7 +125,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) if self.plc_s ~= nil then local plc_db = self.plc_i.get_db() - -- @todo Meknaism 10.1+ will change fuel/waste to need _amnt + ---@todo Mekanism 10.1+ will change fuel/waste to need _amnt _compute_dt(DT_KEYS.ReactorTemp, plc_db.mek_status.temp) _compute_dt(DT_KEYS.ReactorFuel, plc_db.mek_status.fuel) _compute_dt(DT_KEYS.ReactorWaste, plc_db.mek_status.waste) @@ -137,7 +137,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) local boiler = self.boilers[i] ---@type unit_session local db = boiler.get_db() ---@type boiler_session_db - -- @todo Meknaism 10.1+ will change water/steam to need .amount + ---@todo Mekanism 10.1+ will change water/steam to need .amount _compute_dt(DT_KEYS.BoilerWater .. boiler.get_device_idx(), db.tanks.water) _compute_dt(DT_KEYS.BoilerSteam .. boiler.get_device_idx(), db.tanks.steam) _compute_dt(DT_KEYS.BoilerCCool .. boiler.get_device_idx(), db.tanks.ccool.amount) @@ -149,7 +149,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) local db = turbine.get_db() ---@type turbine_session_db _compute_dt(DT_KEYS.TurbineSteam .. turbine.get_device_idx(), db.tanks.steam) - -- @todo Mekanism 10.1+ needed + ---@todo Mekanism 10.1+ needed -- _compute_dt(DT_KEYS.TurbinePower .. turbine.get_device_idx(), db.?) end end @@ -176,16 +176,16 @@ function unit.new(for_reactor, num_boilers, num_turbines) end -- update other annunciator fields - self.db.annunciator.ReactorSCRAM = plc_db.overridden + self.db.annunciator.ReactorSCRAM = plc_db.rps_tripped self.db.annunciator.ManualReactorSCRAM = plc_db.rps_trip_cause == types.rps_status_t.manual self.db.annunciator.RCPTrip = plc_db.rps_tripped and (plc_db.rps_status.ex_hcool or plc_db.rps_status.no_cool) self.db.annunciator.RCSFlowLow = plc_db.mek_status.ccool_fill < 0.75 or plc_db.mek_status.hcool_fill > 0.25 self.db.annunciator.ReactorTempHigh = plc_db.mek_status.temp > 1000 self.db.annunciator.ReactorHighDeltaT = _get_dt(DT_KEYS.ReactorTemp) > 100 self.db.annunciator.FuelInputRateLow = _get_dt(DT_KEYS.ReactorFuel) < 0.0 or plc_db.mek_status.fuel_fill <= 0.01 - -- @todo this is catagorized as not urgent, but the >= 0.99 is extremely urgent, revist this (RPS will kick in though) + ---@todo this is catagorized as not urgent, but the >= 0.99 is extremely urgent, revist this (RPS will kick in though) self.db.annunciator.WasteLineOcclusion = _get_dt(DT_KEYS.ReactorWaste) > 0.0 or plc_db.mek_status.waste_fill >= 0.99 - -- @todo this is dependent on setup, i.e. how much coolant is buffered and the turbine setup + ---@todo this is dependent on setup, i.e. how much coolant is buffered and the turbine setup self.db.annunciator.HighStartupRate = not plc_db.control_state and plc_db.mek_status.burn_rate > 40 end