diff --git a/supervisor/session/facility.lua b/supervisor/session/facility.lua index af3e98b..3245ac0 100644 --- a/supervisor/session/facility.lua +++ b/supervisor/session/facility.lua @@ -524,7 +524,7 @@ function facility.new(num_reactors, cooling_conf) ready = false elseif (self.mode_set == PROCESS.GEN_RATE) and (self.gen_rate_target <= 0) then ready = false - elseif (self.mode_set == PROCESS.BURN_RATE) and (self.burn_target <= 0.1) then + elseif (self.mode_set == PROCESS.BURN_RATE) and (self.burn_target < 0.1) then ready = false end diff --git a/supervisor/session/plc.lua b/supervisor/session/plc.lua index bf9037e..3cf6468 100644 --- a/supervisor/session/plc.lua +++ b/supervisor/session/plc.lua @@ -731,7 +731,6 @@ function plc.new_session(id, for_reactor, in_queue, out_queue) if self.auto_cmd_token > 0 then if self.auto_lock then _send(RPLC_TYPES.AUTO_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate, self.auto_cmd_token }) - log.debug("retried auto burn rate?") else -- would have been an auto command, but disengaged, so stop retrying self.acks.burn_rate = true diff --git a/supervisor/session/unit.lua b/supervisor/session/unit.lua index aa0c5b7..ca2d640 100644 --- a/supervisor/session/unit.lua +++ b/supervisor/session/unit.lua @@ -26,6 +26,7 @@ local IO = rsio.IO local FLOW_STABILITY_DELAY_MS = 15000 local DT_KEYS = { + ReactorBurnR = "RBR", ReactorTemp = "RTP", ReactorFuel = "RFL", ReactorWaste = "RWS", @@ -86,7 +87,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) status_text = { "UNKNOWN", "awaiting connection..." }, -- logic for alarms had_reactor = false, - start_ms = 0, + last_rate_change_ms = 0, plc_cache = { active = false, ok = false, @@ -245,6 +246,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) local last_update_s = plc_db.last_status_update / 1000.0 + _compute_dt(DT_KEYS.ReactorBurnR, plc_db.mek_status.act_burn_rate, last_update_s) _compute_dt(DT_KEYS.ReactorTemp, plc_db.mek_status.temp, last_update_s) _compute_dt(DT_KEYS.ReactorFuel, plc_db.mek_status.fuel, last_update_s) _compute_dt(DT_KEYS.ReactorWaste, plc_db.mek_status.waste, last_update_s) @@ -409,7 +411,7 @@ function unit.new(for_reactor, num_boilers, num_turbines) ---@return boolean complete function public.a_ramp_complete() if self.plc_i ~= nil then - return self.plc_i.is_ramp_complete() + return self.plc_i.is_ramp_complete() or (self.plc_i.get_status().act_burn_rate == 0 and self.db.control.br10 == 0) else return true end end diff --git a/supervisor/session/unitlogic.lua b/supervisor/session/unitlogic.lua index 4354fde..8043a4b 100644 --- a/supervisor/session/unitlogic.lua +++ b/supervisor/session/unitlogic.lua @@ -54,11 +54,9 @@ function logic.update_annunciator(self) self.db.control.lim_br10 = math.floor(plc_db.mek_struct.max_burn * 10) end - -- record reactor start time (some alarms are delayed during reactor heatup) - if self.start_ms == 0 and plc_db.mek_status.status then - self.start_ms = util.time_ms() - elseif not plc_db.mek_status.status then - self.start_ms = 0 + -- some alarms wait until the burn rate has stabilized, so keep track of that + if math.abs(_get_dt(DT_KEYS.ReactorBurnR)) > 0 then + self.last_rate_change_ms = util.time_ms() end -- record reactor stats @@ -237,8 +235,8 @@ function logic.update_annunciator(self) self.db.annunciator.TurbineOnline[session.get_device_idx()] = true end - -- check for boil rate mismatch (either between reactor and turbine or boiler and turbine) - self.db.annunciator.BoilRateMismatch = math.abs(total_boil_rate - total_input_rate) > 4 + -- check for boil rate mismatch (> 4% error) either between reactor and turbine or boiler and turbine + self.db.annunciator.BoilRateMismatch = math.abs(total_boil_rate - total_input_rate) > (0.04 * total_boil_rate) -- check for steam feed mismatch and max return rate local sfmismatch = math.abs(total_flow_rate - total_input_rate) > 10 @@ -436,7 +434,7 @@ function logic.update_alarms(self) -- annunciator indicators for these states may not indicate a real issue when: -- > flow is ramping up right after reactor start -- > flow is ramping down after reactor shutdown - if (util.time_ms() - self.start_ms > self.defs.FLOW_STABILITY_DELAY_MS) and plc_cache.active then + if ((util.time_ms() - self.last_rate_change_ms) > self.defs.FLOW_STABILITY_DELAY_MS) and plc_cache.active then rcs_trans = rcs_trans or annunc.BoilRateMismatch or annunc.CoolantFeedMismatch or annunc.SteamFeedMismatch end @@ -517,7 +515,7 @@ function logic.update_status_text(self) self.status_text[2] = "insufficient fuel input rate" elseif self.db.annunciator.WasteLineOcclusion then self.status_text[2] = "insufficient waste output rate" - elseif (util.time_ms() - self.start_ms) <= self.defs.FLOW_STABILITY_DELAY_MS then + elseif (util.time_ms() - self.last_rate_change_ms) <= self.defs.FLOW_STABILITY_DELAY_MS then if self.num_turbines > 1 then self.status_text[2] = "turbines spinning up" else diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 2a1eb32..8b2e4e8 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -14,7 +14,7 @@ local svsessions = require("supervisor.session.svsessions") local config = require("supervisor.config") local supervisor = require("supervisor.supervisor") -local SUPERVISOR_VERSION = "beta-v0.9.12" +local SUPERVISOR_VERSION = "beta-v0.9.13" local print = util.print local println = util.println