diff --git a/supervisor/startup.lua b/supervisor/startup.lua index ad7a5e2..5ea8f6a 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.4.2" +local SUPERVISOR_VERSION = "v1.4.3" local println = util.println local println_ts = util.println_ts diff --git a/supervisor/unit.lua b/supervisor/unit.lua index bf3e8b1..0fd5f28 100644 --- a/supervisor/unit.lua +++ b/supervisor/unit.lua @@ -264,7 +264,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle) table.insert(self.db.annunciator.TurbineOverSpeed, false) table.insert(self.db.annunciator.GeneratorTrip, false) table.insert(self.db.annunciator.TurbineTrip, false) - table.insert(self.turbine_stability_data, { time_state = 0, time_tanks = 0, rotation = 1 }) + table.insert(self.turbine_stability_data, { time_state = 0, time_tanks = 0, rotation = 1, input_rate = 0 }) end -- PRIVATE FUNCTIONS -- diff --git a/supervisor/unitlogic.lua b/supervisor/unitlogic.lua index 20b00ff..b1e1fc8 100644 --- a/supervisor/unitlogic.lua +++ b/supervisor/unitlogic.lua @@ -84,7 +84,7 @@ function logic.update_annunciator(self) self.turbine_flow_stable = false for t = 1, self.num_turbines do - self.turbine_stability_data[t] = { time_state = 0, time_tanks = 0, rotation = 1 } + self.turbine_stability_data[t] = { time_state = 0, time_tanks = 0, rotation = 1, input_rate = 0 } end end @@ -317,7 +317,7 @@ function logic.update_annunciator(self) local last = self.turbine_stability_data[i] - if (not self.turbine_flow_stable) and (turbine.state.steam_input_rate > 0) then + if not self.turbine_flow_stable then local rotation = util.turbine_rotation(turbine) local rotation_stable = false @@ -351,13 +351,18 @@ function logic.update_annunciator(self) end turbines_stable = turbines_stable and (rotation_stable or flow_stable) - else + elseif math.abs(turbine.state.steam_input_rate - last.input_rate) > 1 then + -- reset to unstable to re-check last.time_state = 0 last.time_tanks = 0 last.rotation = 1 turbines_stable = false + + log.debug(util.c("UNIT ", self.r_id, ": turbine ", idx, " reset stability (new rate ", turbine.state.steam_input_rate, " != ", last.input_rate," mB/t)")) end + + last.input_rate = turbine.state.steam_input_rate end self.turbine_flow_stable = self.turbine_flow_stable or turbines_stable