#519 fixed issue with turbine stability evaluation

This commit is contained in:
Mikayla Fischler 2024-08-11 19:58:29 -04:00
parent bcc55628cf
commit 196e0b1daf
3 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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 --

View File

@ -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