mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#151 improved RCS alarm behavior
This commit is contained in:
parent
c77993d3a0
commit
1100051585
@ -524,7 +524,7 @@ function facility.new(num_reactors, cooling_conf)
|
|||||||
ready = false
|
ready = false
|
||||||
elseif (self.mode_set == PROCESS.GEN_RATE) and (self.gen_rate_target <= 0) then
|
elseif (self.mode_set == PROCESS.GEN_RATE) and (self.gen_rate_target <= 0) then
|
||||||
ready = false
|
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
|
ready = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -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_cmd_token > 0 then
|
||||||
if self.auto_lock then
|
if self.auto_lock then
|
||||||
_send(RPLC_TYPES.AUTO_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate, self.auto_cmd_token })
|
_send(RPLC_TYPES.AUTO_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate, self.auto_cmd_token })
|
||||||
log.debug("retried auto burn rate?")
|
|
||||||
else
|
else
|
||||||
-- would have been an auto command, but disengaged, so stop retrying
|
-- would have been an auto command, but disengaged, so stop retrying
|
||||||
self.acks.burn_rate = true
|
self.acks.burn_rate = true
|
||||||
|
@ -26,6 +26,7 @@ local IO = rsio.IO
|
|||||||
local FLOW_STABILITY_DELAY_MS = 15000
|
local FLOW_STABILITY_DELAY_MS = 15000
|
||||||
|
|
||||||
local DT_KEYS = {
|
local DT_KEYS = {
|
||||||
|
ReactorBurnR = "RBR",
|
||||||
ReactorTemp = "RTP",
|
ReactorTemp = "RTP",
|
||||||
ReactorFuel = "RFL",
|
ReactorFuel = "RFL",
|
||||||
ReactorWaste = "RWS",
|
ReactorWaste = "RWS",
|
||||||
@ -86,7 +87,7 @@ function unit.new(for_reactor, num_boilers, num_turbines)
|
|||||||
status_text = { "UNKNOWN", "awaiting connection..." },
|
status_text = { "UNKNOWN", "awaiting connection..." },
|
||||||
-- logic for alarms
|
-- logic for alarms
|
||||||
had_reactor = false,
|
had_reactor = false,
|
||||||
start_ms = 0,
|
last_rate_change_ms = 0,
|
||||||
plc_cache = {
|
plc_cache = {
|
||||||
active = false,
|
active = false,
|
||||||
ok = 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
|
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.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.ReactorFuel, plc_db.mek_status.fuel, last_update_s)
|
||||||
_compute_dt(DT_KEYS.ReactorWaste, plc_db.mek_status.waste, 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
|
---@return boolean complete
|
||||||
function public.a_ramp_complete()
|
function public.a_ramp_complete()
|
||||||
if self.plc_i ~= nil then
|
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
|
else return true end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,11 +54,9 @@ function logic.update_annunciator(self)
|
|||||||
self.db.control.lim_br10 = math.floor(plc_db.mek_struct.max_burn * 10)
|
self.db.control.lim_br10 = math.floor(plc_db.mek_struct.max_burn * 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- record reactor start time (some alarms are delayed during reactor heatup)
|
-- some alarms wait until the burn rate has stabilized, so keep track of that
|
||||||
if self.start_ms == 0 and plc_db.mek_status.status then
|
if math.abs(_get_dt(DT_KEYS.ReactorBurnR)) > 0 then
|
||||||
self.start_ms = util.time_ms()
|
self.last_rate_change_ms = util.time_ms()
|
||||||
elseif not plc_db.mek_status.status then
|
|
||||||
self.start_ms = 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- record reactor stats
|
-- record reactor stats
|
||||||
@ -237,8 +235,8 @@ function logic.update_annunciator(self)
|
|||||||
self.db.annunciator.TurbineOnline[session.get_device_idx()] = true
|
self.db.annunciator.TurbineOnline[session.get_device_idx()] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for boil rate mismatch (either between reactor and turbine or boiler and turbine)
|
-- 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) > 4
|
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
|
-- check for steam feed mismatch and max return rate
|
||||||
local sfmismatch = math.abs(total_flow_rate - total_input_rate) > 10
|
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:
|
-- annunciator indicators for these states may not indicate a real issue when:
|
||||||
-- > flow is ramping up right after reactor start
|
-- > flow is ramping up right after reactor start
|
||||||
-- > flow is ramping down after reactor shutdown
|
-- > 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
|
rcs_trans = rcs_trans or annunc.BoilRateMismatch or annunc.CoolantFeedMismatch or annunc.SteamFeedMismatch
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -517,7 +515,7 @@ function logic.update_status_text(self)
|
|||||||
self.status_text[2] = "insufficient fuel input rate"
|
self.status_text[2] = "insufficient fuel input rate"
|
||||||
elseif self.db.annunciator.WasteLineOcclusion then
|
elseif self.db.annunciator.WasteLineOcclusion then
|
||||||
self.status_text[2] = "insufficient waste output rate"
|
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
|
if self.num_turbines > 1 then
|
||||||
self.status_text[2] = "turbines spinning up"
|
self.status_text[2] = "turbines spinning up"
|
||||||
else
|
else
|
||||||
|
@ -14,7 +14,7 @@ local svsessions = require("supervisor.session.svsessions")
|
|||||||
local config = require("supervisor.config")
|
local config = require("supervisor.config")
|
||||||
local supervisor = require("supervisor.supervisor")
|
local supervisor = require("supervisor.supervisor")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "beta-v0.9.12"
|
local SUPERVISOR_VERSION = "beta-v0.9.13"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
Loading…
x
Reference in New Issue
Block a user