#118 type cleanup
This commit is contained in:
parent
424097973d
commit
82ea35168b
@ -287,7 +287,7 @@ local function init(parent, id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local t1_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
local t1_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
||||||
t_ps[1].subscribe("SteamDumpOpen", function (val) t1_sdo.update(val + 1) end)
|
t_ps[1].subscribe("SteamDumpOpen", t1_sdo.update)
|
||||||
|
|
||||||
TextBox{parent=rcs_tags,text="T1",width=2,height=1,fg_bg=bw_fg_bg}
|
TextBox{parent=rcs_tags,text="T1",width=2,height=1,fg_bg=bw_fg_bg}
|
||||||
local t1_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
local t1_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
||||||
@ -300,7 +300,7 @@ local function init(parent, id)
|
|||||||
if unit.num_turbines > 1 then
|
if unit.num_turbines > 1 then
|
||||||
TextBox{parent=rcs_tags,text="T2",width=2,height=1,fg_bg=bw_fg_bg}
|
TextBox{parent=rcs_tags,text="T2",width=2,height=1,fg_bg=bw_fg_bg}
|
||||||
local t2_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
local t2_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
||||||
t_ps[2].subscribe("SteamDumpOpen", function (val) t2_sdo.update(val + 1) end)
|
t_ps[2].subscribe("SteamDumpOpen", t2_sdo.update)
|
||||||
|
|
||||||
TextBox{parent=rcs_tags,text="T2",width=2,height=1,fg_bg=bw_fg_bg}
|
TextBox{parent=rcs_tags,text="T2",width=2,height=1,fg_bg=bw_fg_bg}
|
||||||
local t2_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
local t2_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
||||||
@ -314,7 +314,7 @@ local function init(parent, id)
|
|||||||
if unit.num_turbines > 2 then
|
if unit.num_turbines > 2 then
|
||||||
TextBox{parent=rcs_tags,text="T3",width=2,height=1,fg_bg=bw_fg_bg}
|
TextBox{parent=rcs_tags,text="T3",width=2,height=1,fg_bg=bw_fg_bg}
|
||||||
local t3_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
local t3_sdo = TriIndicatorLight{parent=rcs_annunc,label="Steam Relief Valve Open",c1=colors.gray,c2=colors.yellow,c3=colors.red}
|
||||||
t_ps[3].subscribe("SteamDumpOpen", function (val) t3_sdo.update(val + 1) end)
|
t_ps[3].subscribe("SteamDumpOpen", t3_sdo.update)
|
||||||
|
|
||||||
TextBox{parent=rcs_tags,text="T3",width=2,height=1,fg_bg=bw_fg_bg}
|
TextBox{parent=rcs_tags,text="T3",width=2,height=1,fg_bg=bw_fg_bg}
|
||||||
local t3_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
local t3_tos = IndicatorLight{parent=rcs_annunc,label="Turbine Over Speed",colors=cpair(colors.red,colors.gray)}
|
||||||
|
|||||||
@ -114,21 +114,21 @@ end
|
|||||||
|
|
||||||
---@enum TRI_FAIL
|
---@enum TRI_FAIL
|
||||||
types.TRI_FAIL = {
|
types.TRI_FAIL = {
|
||||||
OK = 0,
|
OK = 1,
|
||||||
PARTIAL = 1,
|
PARTIAL = 2,
|
||||||
FULL = 2
|
FULL = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
---@enum PROCESS
|
---@enum PROCESS
|
||||||
types.PROCESS = {
|
types.PROCESS = {
|
||||||
INACTIVE = 0,
|
INACTIVE = 1,
|
||||||
MAX_BURN = 1,
|
MAX_BURN = 2,
|
||||||
BURN_RATE = 2,
|
BURN_RATE = 3,
|
||||||
CHARGE = 3,
|
CHARGE = 4,
|
||||||
GEN_RATE = 4,
|
GEN_RATE = 5,
|
||||||
MATRIX_FAULT_IDLE = 5,
|
MATRIX_FAULT_IDLE = 6,
|
||||||
SYSTEM_ALARM_IDLE = 6,
|
SYSTEM_ALARM_IDLE = 7,
|
||||||
GEN_RATE_FAULT_IDLE = 7
|
GEN_RATE_FAULT_IDLE = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
types.PROCESS_NAMES = {
|
types.PROCESS_NAMES = {
|
||||||
@ -150,6 +150,13 @@ types.WASTE_MODE = {
|
|||||||
ANTI_MATTER = 4
|
ANTI_MATTER = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
types.WASTE_MODE_NAMES = {
|
||||||
|
"AUTO",
|
||||||
|
"PLUTONIUM",
|
||||||
|
"POLONIUM",
|
||||||
|
"ANTI_MATTER"
|
||||||
|
}
|
||||||
|
|
||||||
---@enum ALARM
|
---@enum ALARM
|
||||||
types.ALARM = {
|
types.ALARM = {
|
||||||
ContainmentBreach = 1,
|
ContainmentBreach = 1,
|
||||||
@ -183,10 +190,10 @@ types.ALARM_NAMES = {
|
|||||||
|
|
||||||
---@enum ALARM_PRIORITY
|
---@enum ALARM_PRIORITY
|
||||||
types.ALARM_PRIORITY = {
|
types.ALARM_PRIORITY = {
|
||||||
CRITICAL = 0,
|
CRITICAL = 1,
|
||||||
EMERGENCY = 1,
|
EMERGENCY = 2,
|
||||||
URGENT = 2,
|
URGENT = 3,
|
||||||
TIMELY = 3
|
TIMELY = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
types.ALARM_PRIORITY_NAMES = {
|
types.ALARM_PRIORITY_NAMES = {
|
||||||
@ -198,10 +205,17 @@ types.ALARM_PRIORITY_NAMES = {
|
|||||||
|
|
||||||
---@enum ALARM_STATE
|
---@enum ALARM_STATE
|
||||||
types.ALARM_STATE = {
|
types.ALARM_STATE = {
|
||||||
INACTIVE = 0,
|
INACTIVE = 1,
|
||||||
TRIPPED = 1,
|
TRIPPED = 2,
|
||||||
ACKED = 2,
|
ACKED = 3,
|
||||||
RING_BACK = 3
|
RING_BACK = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
types.ALARM_STATE_NAMES = {
|
||||||
|
"INACTIVE",
|
||||||
|
"TRIPPED",
|
||||||
|
"ACKED",
|
||||||
|
"RING_BACK"
|
||||||
}
|
}
|
||||||
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|||||||
@ -293,7 +293,7 @@ function facility.new(num_reactors, cooling_conf)
|
|||||||
if state_changed then
|
if state_changed then
|
||||||
self.saturated = false
|
self.saturated = false
|
||||||
|
|
||||||
log.debug("FAC: state changed from " .. PROCESS_NAMES[self.last_mode + 1] .. " to " .. PROCESS_NAMES[self.mode + 1])
|
log.debug("FAC: state changed from " .. PROCESS_NAMES[self.last_mode] .. " to " .. PROCESS_NAMES[self.mode])
|
||||||
|
|
||||||
if (self.last_mode == PROCESS.INACTIVE) or (self.last_mode == PROCESS.GEN_RATE_FAULT_IDLE) then
|
if (self.last_mode == PROCESS.INACTIVE) or (self.last_mode == PROCESS.GEN_RATE_FAULT_IDLE) then
|
||||||
self.start_fail = START_STATUS.OK
|
self.start_fail = START_STATUS.OK
|
||||||
|
|||||||
@ -41,14 +41,14 @@ local DT_KEYS = {
|
|||||||
TurbinePower = "TPR"
|
TurbinePower = "TPR"
|
||||||
}
|
}
|
||||||
|
|
||||||
---@alias ALARM_INT_STATE integer
|
---@enum ALARM_INT_STATE
|
||||||
local AISTATE = {
|
local AISTATE = {
|
||||||
INACTIVE = 0,
|
INACTIVE = 1,
|
||||||
TRIPPING = 1,
|
TRIPPING = 2,
|
||||||
TRIPPED = 2,
|
TRIPPED = 3,
|
||||||
ACKED = 3,
|
ACKED = 4,
|
||||||
RING_BACK = 4,
|
RING_BACK = 5,
|
||||||
RING_BACK_TRIPPING = 5
|
RING_BACK_TRIPPING = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
unit.FLOW_STABILITY_DELAY_MS = FLOW_STABILITY_DELAY_MS
|
unit.FLOW_STABILITY_DELAY_MS = FLOW_STABILITY_DELAY_MS
|
||||||
|
|||||||
@ -15,7 +15,7 @@ local IO = rsio.IO
|
|||||||
|
|
||||||
local PLC_S_CMDS = plc.PLC_S_CMDS
|
local PLC_S_CMDS = plc.PLC_S_CMDS
|
||||||
|
|
||||||
local aistate_string = {
|
local AISTATE_NAMES = {
|
||||||
"INACTIVE",
|
"INACTIVE",
|
||||||
"TRIPPING",
|
"TRIPPING",
|
||||||
"TRIPPED",
|
"TRIPPED",
|
||||||
@ -368,7 +368,7 @@ local function _update_alarm_state(self, tripped, alarm)
|
|||||||
alarm.state = AISTATE.TRIPPED
|
alarm.state = AISTATE.TRIPPED
|
||||||
self.db.alarm_states[alarm.id] = ALARM_STATE.TRIPPED
|
self.db.alarm_states[alarm.id] = ALARM_STATE.TRIPPED
|
||||||
log.info(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): TRIPPED [PRIORITY ",
|
log.info(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): TRIPPED [PRIORITY ",
|
||||||
types.ALARM_PRIORITY_NAMES[alarm.tier + 1],"]"))
|
types.ALARM_PRIORITY_NAMES[alarm.tier],"]"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
alarm.trip_time = util.time_ms()
|
alarm.trip_time = util.time_ms()
|
||||||
@ -382,7 +382,7 @@ local function _update_alarm_state(self, tripped, alarm)
|
|||||||
alarm.state = AISTATE.TRIPPED
|
alarm.state = AISTATE.TRIPPED
|
||||||
self.db.alarm_states[alarm.id] = ALARM_STATE.TRIPPED
|
self.db.alarm_states[alarm.id] = ALARM_STATE.TRIPPED
|
||||||
log.info(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): TRIPPED [PRIORITY ",
|
log.info(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): TRIPPED [PRIORITY ",
|
||||||
types.ALARM_PRIORITY_NAMES[alarm.tier + 1],"]"))
|
types.ALARM_PRIORITY_NAMES[alarm.tier],"]"))
|
||||||
end
|
end
|
||||||
elseif int_state == AISTATE.RING_BACK_TRIPPING then
|
elseif int_state == AISTATE.RING_BACK_TRIPPING then
|
||||||
alarm.trip_time = 0
|
alarm.trip_time = 0
|
||||||
@ -431,7 +431,7 @@ local function _update_alarm_state(self, tripped, alarm)
|
|||||||
|
|
||||||
-- check for state change
|
-- check for state change
|
||||||
if alarm.state ~= int_state then
|
if alarm.state ~= int_state then
|
||||||
local change_str = util.c(aistate_string[int_state + 1], " -> ", aistate_string[alarm.state + 1])
|
local change_str = util.c(AISTATE_NAMES[int_state], " -> ", AISTATE_NAMES[alarm.state])
|
||||||
log.debug(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): ", change_str))
|
log.debug(util.c("UNIT ", self.r_id, " ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], "): ", change_str))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -531,7 +531,7 @@ function logic.update_auto_safety(public, self)
|
|||||||
if alarm.tier <= PRIO.URGENT and (alarm.state == AISTATE.TRIPPED or alarm.state == AISTATE.ACKED) then
|
if alarm.tier <= PRIO.URGENT and (alarm.state == AISTATE.TRIPPED or alarm.state == AISTATE.ACKED) then
|
||||||
if not self.auto_was_alarmed then
|
if not self.auto_was_alarmed then
|
||||||
log.info(util.c("UNIT ", self.r_id, " AUTO SCRAM due to ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], ") [PRIORITY ",
|
log.info(util.c("UNIT ", self.r_id, " AUTO SCRAM due to ALARM ", alarm.id, " (", types.ALARM_NAMES[alarm.id], ") [PRIORITY ",
|
||||||
types.ALARM_PRIORITY_NAMES[alarm.tier + 1],"]"))
|
types.ALARM_PRIORITY_NAMES[alarm.tier],"]"))
|
||||||
end
|
end
|
||||||
|
|
||||||
alarmed = true
|
alarmed = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user