#188 refactored RPS dmg_high to high_dmg

This commit is contained in:
Mikayla Fischler 2023-03-04 22:32:13 -05:00
parent 83dc1064f7
commit 9eddab2c23
12 changed files with 27 additions and 27 deletions

View File

@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol")
local renderer = require("coordinator.renderer")
local sounder = require("coordinator.sounder")
local COORDINATOR_VERSION = "v0.11.13"
local COORDINATOR_VERSION = "v0.12.0"
local print = util.print
local println = util.println

View File

@ -221,7 +221,7 @@ local function init(parent, id)
local rps_sfl = IndicatorLight{parent=rps_annunc,label="System Failure",colors=cpair(colors.orange,colors.gray),flash=true,period=period.BLINK_500_MS}
u_ps.subscribe("rps_tripped", rps_trp.update)
u_ps.subscribe("dmg_high", rps_dmg.update)
u_ps.subscribe("high_dmg", rps_dmg.update)
u_ps.subscribe("ex_hcool", rps_exh.update)
u_ps.subscribe("ex_waste", rps_exw.update)
u_ps.subscribe("high_temp", rps_tmp.update)

View File

@ -1 +1 @@
{"versions": {"installer": "v0.9m", "bootloader": "0.2", "comms": "1.4.0", "reactor-plc": "v0.12.5", "rtu": "v0.12.6", "supervisor": "v0.13.14", "coordinator": "v0.11.13", "pocket": "alpha-v0.0.0"}, "files": {"system": ["initenv.lua", "startup.lua"], "common": ["scada-common/crypto.lua", "scada-common/ppm.lua", "scada-common/comms.lua", "scada-common/psil.lua", "scada-common/tcallbackdsp.lua", "scada-common/rsio.lua", "scada-common/constants.lua", "scada-common/mqueue.lua", "scada-common/crash.lua", "scada-common/log.lua", "scada-common/types.lua", "scada-common/util.lua"], "graphics": ["graphics/element.lua", "graphics/flasher.lua", "graphics/core.lua", "graphics/elements/textbox.lua", "graphics/elements/displaybox.lua", "graphics/elements/pipenet.lua", "graphics/elements/rectangle.lua", "graphics/elements/div.lua", "graphics/elements/tiling.lua", "graphics/elements/colormap.lua", "graphics/elements/indicators/alight.lua", "graphics/elements/indicators/icon.lua", "graphics/elements/indicators/power.lua", "graphics/elements/indicators/rad.lua", "graphics/elements/indicators/state.lua", "graphics/elements/indicators/light.lua", "graphics/elements/indicators/vbar.lua", "graphics/elements/indicators/coremap.lua", "graphics/elements/indicators/data.lua", "graphics/elements/indicators/hbar.lua", "graphics/elements/indicators/trilight.lua", "graphics/elements/controls/switch_button.lua", "graphics/elements/controls/spinbox_numeric.lua", "graphics/elements/controls/hazard_button.lua", "graphics/elements/controls/push_button.lua", "graphics/elements/controls/radio_button.lua", "graphics/elements/controls/multi_button.lua", "graphics/elements/animations/waiting.lua"], "lockbox": ["lockbox/init.lua", "lockbox/LICENSE", "lockbox/kdf/pbkdf2.lua", "lockbox/util/bit.lua", "lockbox/util/array.lua", "lockbox/util/stream.lua", "lockbox/util/queue.lua", "lockbox/digest/sha2_224.lua", "lockbox/digest/sha1.lua", "lockbox/digest/sha2_256.lua", "lockbox/cipher/aes128.lua", "lockbox/cipher/aes256.lua", "lockbox/cipher/aes192.lua", "lockbox/cipher/mode/ofb.lua", "lockbox/cipher/mode/cbc.lua", "lockbox/cipher/mode/ctr.lua", "lockbox/cipher/mode/cfb.lua", "lockbox/mac/hmac.lua", "lockbox/padding/ansix923.lua", "lockbox/padding/pkcs7.lua", "lockbox/padding/zero.lua", "lockbox/padding/isoiec7816.lua"], "reactor-plc": ["reactor-plc/threads.lua", "reactor-plc/plc.lua", "reactor-plc/config.lua", "reactor-plc/startup.lua"], "rtu": ["rtu/threads.lua", "rtu/rtu.lua", "rtu/modbus.lua", "rtu/config.lua", "rtu/startup.lua", "rtu/dev/sps_rtu.lua", "rtu/dev/envd_rtu.lua", "rtu/dev/boilerv_rtu.lua", "rtu/dev/redstone_rtu.lua", "rtu/dev/sna_rtu.lua", "rtu/dev/imatrix_rtu.lua", "rtu/dev/turbinev_rtu.lua"], "supervisor": ["supervisor/supervisor.lua", "supervisor/unit.lua", "supervisor/config.lua", "supervisor/startup.lua", "supervisor/unitlogic.lua", "supervisor/facility.lua", "supervisor/session/coordinator.lua", "supervisor/session/svqtypes.lua", "supervisor/session/svsessions.lua", "supervisor/session/rtu.lua", "supervisor/session/plc.lua", "supervisor/session/rsctl.lua", "supervisor/session/rtu/boilerv.lua", "supervisor/session/rtu/txnctrl.lua", "supervisor/session/rtu/unit_session.lua", "supervisor/session/rtu/turbinev.lua", "supervisor/session/rtu/envd.lua", "supervisor/session/rtu/imatrix.lua", "supervisor/session/rtu/sps.lua", "supervisor/session/rtu/qtypes.lua", "supervisor/session/rtu/sna.lua", "supervisor/session/rtu/redstone.lua"], "coordinator": ["coordinator/coordinator.lua", "coordinator/renderer.lua", "coordinator/iocontrol.lua", "coordinator/sounder.lua", "coordinator/config.lua", "coordinator/startup.lua", "coordinator/apisessions.lua", "coordinator/process.lua", "coordinator/ui/dialog.lua", "coordinator/ui/style.lua", "coordinator/ui/layout/main_view.lua", "coordinator/ui/layout/unit_view.lua", "coordinator/ui/components/reactor.lua", "coordinator/ui/components/processctl.lua", "coordinator/ui/components/unit_overview.lua", "coordinator/ui/components/boiler.lua", "coordinator/ui/components/unit_detail.lua", "coordinator/ui/components/imatrix.lua", "coordinator/ui/components/unit_waiting.lua", "coordinator/ui/components/turbine.lua"], "pocket": ["pocket/config.lua", "pocket/startup.lua"]}, "depends": {"reactor-plc": ["system", "common"], "rtu": ["system", "common"], "supervisor": ["system", "common"], "coordinator": ["system", "common", "graphics"], "pocket": ["system", "common", "graphics"]}, "sizes": {"manifest": 4650, "system": 1982, "common": 91083, "graphics": 99858, "lockbox": 100797, "reactor-plc": 75536, "rtu": 83729, "supervisor": 274492, "coordinator": 179967, "pocket": 335}}
{"versions": {"installer": "v0.9m", "bootloader": "0.2", "comms": "1.4.0", "reactor-plc": "v1.0.0", "rtu": "v0.13.0", "supervisor": "v0.14.0", "coordinator": "v0.12.0", "pocket": "alpha-v0.0.0"}, "files": {"system": ["initenv.lua", "startup.lua"], "common": ["scada-common/crypto.lua", "scada-common/ppm.lua", "scada-common/comms.lua", "scada-common/psil.lua", "scada-common/tcallbackdsp.lua", "scada-common/rsio.lua", "scada-common/constants.lua", "scada-common/mqueue.lua", "scada-common/crash.lua", "scada-common/log.lua", "scada-common/types.lua", "scada-common/util.lua"], "graphics": ["graphics/element.lua", "graphics/flasher.lua", "graphics/core.lua", "graphics/elements/textbox.lua", "graphics/elements/displaybox.lua", "graphics/elements/pipenet.lua", "graphics/elements/rectangle.lua", "graphics/elements/div.lua", "graphics/elements/tiling.lua", "graphics/elements/colormap.lua", "graphics/elements/indicators/alight.lua", "graphics/elements/indicators/icon.lua", "graphics/elements/indicators/power.lua", "graphics/elements/indicators/rad.lua", "graphics/elements/indicators/state.lua", "graphics/elements/indicators/light.lua", "graphics/elements/indicators/vbar.lua", "graphics/elements/indicators/coremap.lua", "graphics/elements/indicators/data.lua", "graphics/elements/indicators/hbar.lua", "graphics/elements/indicators/trilight.lua", "graphics/elements/controls/switch_button.lua", "graphics/elements/controls/spinbox_numeric.lua", "graphics/elements/controls/hazard_button.lua", "graphics/elements/controls/push_button.lua", "graphics/elements/controls/radio_button.lua", "graphics/elements/controls/multi_button.lua", "graphics/elements/animations/waiting.lua"], "lockbox": ["lockbox/init.lua", "lockbox/LICENSE", "lockbox/kdf/pbkdf2.lua", "lockbox/util/bit.lua", "lockbox/util/array.lua", "lockbox/util/stream.lua", "lockbox/util/queue.lua", "lockbox/digest/sha2_224.lua", "lockbox/digest/sha1.lua", "lockbox/digest/sha2_256.lua", "lockbox/cipher/aes128.lua", "lockbox/cipher/aes256.lua", "lockbox/cipher/aes192.lua", "lockbox/cipher/mode/ofb.lua", "lockbox/cipher/mode/cbc.lua", "lockbox/cipher/mode/ctr.lua", "lockbox/cipher/mode/cfb.lua", "lockbox/mac/hmac.lua", "lockbox/padding/ansix923.lua", "lockbox/padding/pkcs7.lua", "lockbox/padding/zero.lua", "lockbox/padding/isoiec7816.lua"], "reactor-plc": ["reactor-plc/threads.lua", "reactor-plc/plc.lua", "reactor-plc/config.lua", "reactor-plc/startup.lua"], "rtu": ["rtu/threads.lua", "rtu/rtu.lua", "rtu/modbus.lua", "rtu/config.lua", "rtu/startup.lua", "rtu/dev/sps_rtu.lua", "rtu/dev/envd_rtu.lua", "rtu/dev/boilerv_rtu.lua", "rtu/dev/redstone_rtu.lua", "rtu/dev/sna_rtu.lua", "rtu/dev/imatrix_rtu.lua", "rtu/dev/turbinev_rtu.lua"], "supervisor": ["supervisor/supervisor.lua", "supervisor/unit.lua", "supervisor/config.lua", "supervisor/startup.lua", "supervisor/unitlogic.lua", "supervisor/facility.lua", "supervisor/session/coordinator.lua", "supervisor/session/svqtypes.lua", "supervisor/session/svsessions.lua", "supervisor/session/rtu.lua", "supervisor/session/plc.lua", "supervisor/session/rsctl.lua", "supervisor/session/rtu/boilerv.lua", "supervisor/session/rtu/txnctrl.lua", "supervisor/session/rtu/unit_session.lua", "supervisor/session/rtu/turbinev.lua", "supervisor/session/rtu/envd.lua", "supervisor/session/rtu/imatrix.lua", "supervisor/session/rtu/sps.lua", "supervisor/session/rtu/qtypes.lua", "supervisor/session/rtu/sna.lua", "supervisor/session/rtu/redstone.lua"], "coordinator": ["coordinator/coordinator.lua", "coordinator/renderer.lua", "coordinator/iocontrol.lua", "coordinator/sounder.lua", "coordinator/config.lua", "coordinator/startup.lua", "coordinator/apisessions.lua", "coordinator/process.lua", "coordinator/ui/dialog.lua", "coordinator/ui/style.lua", "coordinator/ui/layout/main_view.lua", "coordinator/ui/layout/unit_view.lua", "coordinator/ui/components/reactor.lua", "coordinator/ui/components/processctl.lua", "coordinator/ui/components/unit_overview.lua", "coordinator/ui/components/boiler.lua", "coordinator/ui/components/unit_detail.lua", "coordinator/ui/components/imatrix.lua", "coordinator/ui/components/unit_waiting.lua", "coordinator/ui/components/turbine.lua"], "pocket": ["pocket/config.lua", "pocket/startup.lua"]}, "depends": {"reactor-plc": ["system", "common"], "rtu": ["system", "common"], "supervisor": ["system", "common"], "coordinator": ["system", "common", "graphics"], "pocket": ["system", "common", "graphics"]}, "sizes": {"manifest": 4647, "system": 1982, "common": 91083, "graphics": 99858, "lockbox": 100797, "reactor-plc": 75529, "rtu": 83729, "supervisor": 274491, "coordinator": 179966, "pocket": 335}}

View File

@ -36,7 +36,7 @@ local PCALL_START_MSG = "pcall: Reactor is already active."
---@param is_formed boolean
function plc.rps_init(reactor, is_formed)
local state_keys = {
dmg_high = 1,
high_dmg = 1,
high_temp = 2,
low_coolant = 3,
ex_waste = 4,
@ -105,13 +105,13 @@ function plc.rps_init(reactor, is_formed)
end
-- check for high damage
local function _damage_high()
local function _high_damage()
local damage_percent = reactor.getDamagePercent()
if damage_percent == ppm.ACCESS_FAULT then
-- lost the peripheral or terminated, handled later
_set_fault()
elseif not self.state[state_keys.dmg_high] then
self.state[state_keys.dmg_high] = damage_percent >= RPS_LIMITS.MAX_DAMAGE_PERCENT
elseif not self.state[state_keys.high_dmg] then
self.state[state_keys.high_dmg] = damage_percent >= RPS_LIMITS.MAX_DAMAGE_PERCENT
end
end
@ -273,7 +273,7 @@ function plc.rps_init(reactor, is_formed)
parallel.waitForAll(
_is_formed,
_is_force_disabled,
_damage_high,
_high_damage,
_high_temp,
_low_coolant,
_excess_waste,
@ -294,9 +294,9 @@ function plc.rps_init(reactor, is_formed)
elseif self.state[state_keys.force_disabled] then
log.warning("RPS: reactor was force disabled")
status = RPS_TRIP_CAUSE.FORCE_DISABLED
elseif self.state[state_keys.dmg_high] then
log.warning("RPS: damage level high")
status = RPS_TRIP_CAUSE.DMG_HIGH
elseif self.state[state_keys.high_dmg] then
log.warning("RPS: high damage")
status = RPS_TRIP_CAUSE.HIGH_DMG
elseif self.state[state_keys.high_temp] then
log.warning("RPS: high temperature")
status = RPS_TRIP_CAUSE.HIGH_TEMP

View File

@ -14,7 +14,7 @@ local config = require("reactor-plc.config")
local plc = require("reactor-plc.plc")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v0.12.5"
local R_PLC_VERSION = "v1.0.0"
local print = util.print
local println = util.println

View File

@ -25,7 +25,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
local sps_rtu = require("rtu.dev.sps_rtu")
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
local RTU_VERSION = "v0.12.6"
local RTU_VERSION = "v0.13.0"
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE

View File

@ -65,7 +65,7 @@ local IO_PORT = {
R_AUTO_CTRL = 13, -- active high, if the reactor burn rate is automatic
R_SCRAMMED = 14, -- active high, if the reactor is scrammed
R_AUTO_SCRAM = 15, -- active high, if the reactor was automatically scrammed
R_DMG_HIGH = 16, -- active high, if the reactor damage is high
R_HIGH_DMG = 16, -- active high, if the reactor damage is high
R_HIGH_TEMP = 17, -- active high, if the reactor is at a high temperature
R_LOW_COOLANT = 18, -- active high, if the reactor has very low coolant
R_EXCESS_HC = 19, -- active high, if the reactor has excess heated coolant
@ -108,7 +108,7 @@ function rsio.to_string(port)
"R_AUTO_CTRL",
"R_SCRAMMED",
"R_AUTO_SCRAM",
"R_DMG_HIGH",
"R_HIGH_DMG",
"R_HIGH_TEMP",
"R_LOW_COOLANT",
"R_EXCESS_HC",
@ -171,7 +171,7 @@ local RS_DIO_MAP = {
{ _in = _I_ACTIVE_HIGH, _out = _O_ACTIVE_HIGH, mode = IO_DIR.OUT },
-- R_AUTO_SCRAM
{ _in = _I_ACTIVE_HIGH, _out = _O_ACTIVE_HIGH, mode = IO_DIR.OUT },
-- R_DMG_HIGH
-- R_HIGH_DMG
{ _in = _I_ACTIVE_HIGH, _out = _O_ACTIVE_HIGH, mode = IO_DIR.OUT },
-- R_HIGH_TEMP
{ _in = _I_ACTIVE_HIGH, _out = _O_ACTIVE_HIGH, mode = IO_DIR.OUT },
@ -215,7 +215,7 @@ function rsio.get_io_mode(port)
IO_MODE.DIGITAL_OUT, -- R_AUTO_CTRL
IO_MODE.DIGITAL_OUT, -- R_SCRAMMED
IO_MODE.DIGITAL_OUT, -- R_AUTO_SCRAM
IO_MODE.DIGITAL_OUT, -- R_DMG_HIGH
IO_MODE.DIGITAL_OUT, -- R_HIGH_DMG
IO_MODE.DIGITAL_OUT, -- R_HIGH_TEMP
IO_MODE.DIGITAL_OUT, -- R_LOW_COOLANT
IO_MODE.DIGITAL_OUT, -- R_EXCESS_HC

View File

@ -273,7 +273,7 @@ types.FLUID = {
---@alias rps_trip_cause
---| "ok"
---| "dmg_high"
---| "high_dmg"
---| "high_temp"
---| "low_coolant"
---| "ex_waste"
@ -288,7 +288,7 @@ types.FLUID = {
types.RPS_TRIP_CAUSE = {
OK = "ok",
DMG_HIGH = "dmg_high",
HIGH_DMG = "high_dmg",
HIGH_TEMP = "high_temp",
LOW_COOLANT = "low_coolant",
EX_WASTE = "ex_waste",

View File

@ -102,7 +102,7 @@ function plc.new_session(id, reactor_id, in_queue, out_queue, timeout)
rps_trip_cause = "ok", ---@type rps_trip_cause
---@class rps_status
rps_status = {
dmg_high = false,
high_dmg = false,
high_temp = false,
low_cool = false,
ex_waste = false,
@ -169,7 +169,7 @@ function plc.new_session(id, reactor_id, in_queue, out_queue, timeout)
local function _copy_rps_status(rps_status)
self.sDB.rps_tripped = rps_status[1]
self.sDB.rps_trip_cause = rps_status[2]
self.sDB.rps_status.dmg_high = rps_status[3]
self.sDB.rps_status.high_dmg = rps_status[3]
self.sDB.rps_status.high_temp = rps_status[4]
self.sDB.rps_status.low_cool = rps_status[5]
self.sDB.rps_status.ex_waste = rps_status[6]

View File

@ -14,7 +14,7 @@ local svsessions = require("supervisor.session.svsessions")
local config = require("supervisor.config")
local supervisor = require("supervisor.supervisor")
local SUPERVISOR_VERSION = "v0.13.14"
local SUPERVISOR_VERSION = "v0.14.0"
local print = util.print
local println = util.println

View File

@ -96,7 +96,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
last_rate_change_ms = 0,
---@type rps_status
last_rps_trips = {
dmg_high = false,
high_dmg = false,
high_temp = false,
low_cool = false,
ex_waste = false,
@ -115,7 +115,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
rps_trip = false,
---@type rps_status
rps_status = {
dmg_high = false,
high_dmg = false,
high_temp = false,
low_cool = false,
ex_waste = false,

View File

@ -474,7 +474,7 @@ function logic.update_alarms(self)
_update_alarm_state(self, plc_cache.damage >= 100, self.alarms.CriticalDamage)
-- Reactor Damage
local rps_dmg_90 = plc_cache.rps_status.dmg_high and not self.last_rps_trips.dmg_high
local rps_dmg_90 = plc_cache.rps_status.high_dmg and not self.last_rps_trips.high_dmg
_update_alarm_state(self, (plc_cache.damage > 0) or rps_dmg_90, self.alarms.ReactorDamage)
-- Over-Temperature
@ -676,7 +676,7 @@ function logic.update_status_text(self)
if plc_db.rps_trip_cause == RPS_TRIP_CAUSE.OK then
-- hmm...
elseif plc_db.rps_trip_cause == RPS_TRIP_CAUSE.DMG_HIGH then
elseif plc_db.rps_trip_cause == RPS_TRIP_CAUSE.HIGH_DMG then
cause = "core damage high"
elseif plc_db.rps_trip_cause == RPS_TRIP_CAUSE.HIGH_TEMP then
cause = "core temperature high"
@ -772,7 +772,7 @@ function logic.handle_redstone(self)
self.io_ctl.digital_write(IO.R_AUTO_CTRL, self.auto_engaged)
self.io_ctl.digital_write(IO.R_SCRAMMED, self.plc_cache.rps_trip)
self.io_ctl.digital_write(IO.R_AUTO_SCRAM, self.plc_cache.rps_status.automatic)
self.io_ctl.digital_write(IO.R_DMG_HIGH, self.plc_cache.rps_status.dmg_high)
self.io_ctl.digital_write(IO.R_HIGH_DMG, self.plc_cache.rps_status.high_dmg)
self.io_ctl.digital_write(IO.R_HIGH_TEMP, self.plc_cache.rps_status.high_temp)
self.io_ctl.digital_write(IO.R_LOW_COOLANT, self.plc_cache.rps_status.low_cool)
self.io_ctl.digital_write(IO.R_EXCESS_HC, self.plc_cache.rps_status.ex_hcool)