From fbb992ff122648065b5f9db2b36679f8659a26e3 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 25 Feb 2023 14:11:40 -0500 Subject: [PATCH] #173 dump excess steam on opening emergency coolant --- coordinator/startup.lua | 2 +- coordinator/ui/components/unit_detail.lua | 2 +- install_manifest.json | 10 +++--- rtu/dev/turbinev_rtu.lua | 2 +- rtu/startup.lua | 2 +- supervisor/startup.lua | 2 +- supervisor/unit.lua | 2 +- supervisor/unitlogic.lua | 38 +++++++++++++++++++---- 8 files changed, 43 insertions(+), 17 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index e378c73..75e0bb5 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol") local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") -local COORDINATOR_VERSION = "v0.11.3" +local COORDINATOR_VERSION = "v0.11.4" local print = util.print local println = util.println diff --git a/coordinator/ui/components/unit_detail.lua b/coordinator/ui/components/unit_detail.lua index a16d0d0..d1babd1 100644 --- a/coordinator/ui/components/unit_detail.lua +++ b/coordinator/ui/components/unit_detail.lua @@ -238,7 +238,7 @@ local function init(parent, id) local rcs_tags = Div{parent=rcs,width=2,height=14,x=29,y=9} local c_flt = IndicatorLight{parent=rcs_annunc,label="RCS Hardware Fault",colors=cpair(colors.yellow,colors.gray)} - local c_emg = TriIndicatorLight{parent=rcs_annunc,label="Emergency Coolant",c1=colors.gray,c2=colors.white,c3=colors.yellow} + local c_emg = TriIndicatorLight{parent=rcs_annunc,label="Emergency Coolant",c1=colors.gray,c2=colors.white,c3=colors.green} local c_cfm = IndicatorLight{parent=rcs_annunc,label="Coolant Feed Mismatch",colors=cpair(colors.yellow,colors.gray)} local c_brm = IndicatorLight{parent=rcs_annunc,label="Boil Rate Mismatch",colors=cpair(colors.yellow,colors.gray)} local c_sfm = IndicatorLight{parent=rcs_annunc,label="Steam Feed Mismatch",colors=cpair(colors.yellow,colors.gray)} diff --git a/install_manifest.json b/install_manifest.json index ad1b53c..0db383e 100644 --- a/install_manifest.json +++ b/install_manifest.json @@ -3,9 +3,9 @@ "bootloader": "0.2", "comms": "1.4.0", "reactor-plc": "v0.12.1", - "rtu": "v0.12.1", - "supervisor": "v0.13.1", - "coordinator": "v0.11.3", + "rtu": "v0.12.2", + "supervisor": "v0.13.2", + "coordinator": "v0.11.4", "pocket": "alpha-v0.0.0" }, "files": { @@ -183,8 +183,8 @@ "lockbox": 100797, "reactor-plc": 75545, "rtu": 83090, - "supervisor": 269955, - "coordinator": 179370, + "supervisor": 271106, + "coordinator": 179369, "pocket": 335 } } \ No newline at end of file diff --git a/rtu/dev/turbinev_rtu.lua b/rtu/dev/turbinev_rtu.lua index eba310c..89b3ae0 100644 --- a/rtu/dev/turbinev_rtu.lua +++ b/rtu/dev/turbinev_rtu.lua @@ -47,7 +47,7 @@ function turbinev_rtu.new(turbine) unit.connect_input_reg(turbine.getEnergyFilledPercentage) -- holding registers -- - unit.connect_holding_reg(turbine.setDumpingMode, turbine.getDumpingMode) + unit.connect_holding_reg(turbine.getDumpingMode, turbine.setDumpingMode) return unit.interface() end diff --git a/rtu/startup.lua b/rtu/startup.lua index aff3a22..ef7a2df 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -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.1" +local RTU_VERSION = "v0.12.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 0682994..01f2fee 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -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.1" +local SUPERVISOR_VERSION = "v0.13.2" local print = util.print local println = util.println diff --git a/supervisor/unit.lua b/supervisor/unit.lua index c3f9482..ffecfb3 100644 --- a/supervisor/unit.lua +++ b/supervisor/unit.lua @@ -523,7 +523,7 @@ function unit.new(reactor_id, num_boilers, num_turbines) ---@nodiscard ---@return integer lim_br100 function public.a_get_effective_limit() - if not self.db.control.ready or self.db.control.degraded or self.plc_cache.rps_trip then + if (not self.db.control.ready) or self.db.control.degraded or self.plc_cache.rps_trip then self.db.control.br100 = 0 return 0 else diff --git a/supervisor/unitlogic.lua b/supervisor/unitlogic.lua index 3a55c82..81d6a17 100644 --- a/supervisor/unitlogic.lua +++ b/supervisor/unitlogic.lua @@ -1,16 +1,20 @@ -local const = require("scada-common.constants") -local log = require("scada-common.log") -local rsio = require("scada-common.rsio") -local types = require("scada-common.types") -local util = require("scada-common.util") +local const = require("scada-common.constants") +local log = require("scada-common.log") +local rsio = require("scada-common.rsio") +local types = require("scada-common.types") +local util = require("scada-common.util") -local plc = require("supervisor.session.plc") +local plc = require("supervisor.session.plc") + +local qtypes = require("supervisor.session.rtu.qtypes") local TRI_FAIL = types.TRI_FAIL local DUMPING_MODE = types.DUMPING_MODE local PRIO = types.ALARM_PRIORITY local ALARM_STATE = types.ALARM_STATE +local TBV_RTU_S_DATA = qtypes.TBV_RTU_S_DATA + local IO = rsio.IO local PLC_S_CMDS = plc.PLC_S_CMDS @@ -754,16 +758,38 @@ function logic.handle_redstone(self) -- if auto control is engaged, alarm check will SCRAM on reactor over temp so that's covered self.valves.emer_cool.close() + -- set turbines to not dump steam + for i = 1, #self.turbines do + local session = self.turbines[i] ---@type unit_session + local turbine = session.get_db() ---@type turbinev_session_db + + if turbine.state.dumping_mode ~= DUMPING_MODE.IDLE then + session.get_cmd_queue().push_data(TBV_RTU_S_DATA.SET_DUMP_MODE, DUMPING_MODE.IDLE) + end + end + if self.db.annunciator.EmergencyCoolant > 1 and self.emcool_opened then log.info(util.c("UNIT ", self.r_id, " emergency coolant valve closed")) + log.info(util.c("UNIT ", self.r_id, " turbines set to not dump steam")) end self.emcool_opened = false elseif enable_emer_cool or self.emcool_opened then self.valves.emer_cool.open() + -- set turbines to dump excess steam + for i = 1, #self.turbines do + local session = self.turbines[i] ---@type unit_session + local turbine = session.get_db() ---@type turbinev_session_db + + if turbine.state.dumping_mode ~= DUMPING_MODE.DUMPING_EXCESS then + session.get_cmd_queue().push_data(TBV_RTU_S_DATA.SET_DUMP_MODE, DUMPING_MODE.DUMPING_EXCESS) + end + end + if self.db.annunciator.EmergencyCoolant > 1 and not self.emcool_opened then log.info(util.c("UNIT ", self.r_id, " emergency coolant valve opened")) + log.info(util.c("UNIT ", self.r_id, " turbines set to dump excess steam")) end self.emcool_opened = true