diff --git a/scada-common/constants.lua b/scada-common/constants.lua index c10722d..902e187 100644 --- a/scada-common/constants.lua +++ b/scada-common/constants.lua @@ -34,6 +34,7 @@ annunc.ReactorTempHigh = 1000 -- temp > 1000K annunc.ReactorHighDeltaT = 50 -- rate > 50K/s annunc.FuelLevelLow = 0.05 -- fill <= 5% annunc.WasteLevelHigh = 0.85 -- fill >= 85% +annunc.WaterLevelLow = 0.4 -- fill < 40% annunc.SteamFeedMismatch = 10 -- ±10mB difference between total coolant flow and total steam input rate annunc.RadiationWarning = 0.00001 -- 10 uSv/h diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 01f2fee..6123014 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.2" +local SUPERVISOR_VERSION = "v0.13.3" local print = util.print local println = util.println diff --git a/supervisor/unit.lua b/supervisor/unit.lua index ffecfb3..4d7f4e2 100644 --- a/supervisor/unit.lua +++ b/supervisor/unit.lua @@ -144,7 +144,7 @@ function unit.new(reactor_id, num_boilers, num_turbines) ReactorDamage = { state = AISTATE.INACTIVE, trip_time = 0, hold_time = 0, id = ALARM.ReactorDamage, tier = PRIO.EMERGENCY }, -- reactor >1200K ReactorOverTemp = { state = AISTATE.INACTIVE, trip_time = 0, hold_time = 0, id = ALARM.ReactorOverTemp, tier = PRIO.URGENT }, - -- reactor >1150K + -- reactor >=1150K ReactorHighTemp = { state = AISTATE.INACTIVE, trip_time = 0, hold_time = 1, id = ALARM.ReactorHighTemp, tier = PRIO.TIMELY }, -- waste = 100% ReactorWasteLeak = { state = AISTATE.INACTIVE, trip_time = 0, hold_time = 0, id = ALARM.ReactorWasteLeak, tier = PRIO.EMERGENCY }, diff --git a/supervisor/unitlogic.lua b/supervisor/unitlogic.lua index 81d6a17..823c581 100644 --- a/supervisor/unitlogic.lua +++ b/supervisor/unitlogic.lua @@ -185,6 +185,7 @@ function logic.update_annunciator(self) for i = 1, #self.boilers do local session = self.boilers[i] ---@type unit_session local boiler = session.get_db() ---@type boilerv_session_db + local idx = session.get_device_idx() self.db.annunciator.RCSFault = self.db.annunciator.RCSFault or (not boiler.formed) or session.is_faulted() @@ -197,10 +198,11 @@ function logic.update_annunciator(self) (boiler.tanks.last_update > 0) total_boil_rate = total_boil_rate + boiler.state.boil_rate - boiler_steam_dt_sum = _get_dt(DT_KEYS.BoilerSteam .. self.boilers[i].get_device_idx()) - boiler_water_dt_sum = _get_dt(DT_KEYS.BoilerWater .. self.boilers[i].get_device_idx()) + boiler_steam_dt_sum = _get_dt(DT_KEYS.BoilerSteam .. idx) + boiler_water_dt_sum = _get_dt(DT_KEYS.BoilerWater .. idx) - self.db.annunciator.BoilerOnline[session.get_device_idx()] = true + self.db.annunciator.BoilerOnline[idx] = true + self.db.annunciator.WaterLevelLow[idx] = boiler.tanks.water_fill < ANNUNC_LIMS.WaterLevelLow end -- check heating rate low @@ -452,7 +454,7 @@ function logic.update_alarms(self) -- Containment Radiation local rad_alarm = false for i = 1, #self.envd do - rad_alarm = self.envd[i].get_db().radiation_raw > ALARM_LIMS.HIGH_RADIATION + rad_alarm = self.envd[i].get_db().radiation_raw >= ALARM_LIMS.HIGH_RADIATION break end _update_alarm_state(self, rad_alarm, self.alarms.ContainmentRadiation) @@ -569,7 +571,7 @@ function logic.update_status_text(self) if is_active(self.alarms.ContainmentBreach) then -- boom? or was boom disabled if self.plc_i ~= nil and self.plc_i.get_rps().force_dis then - self.status_text = { "REACTOR FORCE DISABLED", "meltdown would have occured" } + self.status_text = { "REACTOR FORCE DISABLED", "meltdown would have occurred" } else self.status_text = { "CORE MELTDOWN", "reactor destroyed" } end @@ -594,10 +596,6 @@ function logic.update_status_text(self) end elseif is_active(self.alarms.ContainmentRadiation) then self.status_text = { "RADIATION DETECTED", "radiation levels above normal" } - -- elseif is_active(self.alarms.RPSTransient) then - -- RPS status handled when checking reactor status - elseif is_active(self.alarms.RCSTransient) then - self.status_text = { "RCS TRANSIENT", "check coolant system" } elseif is_active(self.alarms.ReactorOverTemp) then self.status_text = { "CORE OVER TEMP", "reactor core temperature >=1200K" } elseif is_active(self.alarms.ReactorWasteLeak) then @@ -607,7 +605,11 @@ function logic.update_status_text(self) elseif is_active(self.alarms.ReactorHighWaste) then self.status_text = { "WASTE LEVEL HIGH", "waste accumulating in reactor" } elseif is_active(self.alarms.TurbineTrip) then - self.status_text = { "TURBINE TRIP", "turbine stall occured" } + self.status_text = { "TURBINE TRIP", "turbine stall occurred" } + elseif is_active(self.alarms.RCSTransient) then + self.status_text = { "RCS TRANSIENT", "check coolant system" } + -- elseif is_active(self.alarms.RPSTransient) then + -- RPS status handled when checking reactor status elseif self.emcool_opened then self.status_text = { "EMERGENCY COOLANT OPENED", "reset RPS to close valve" } -- connection dependent states @@ -635,7 +637,7 @@ function logic.update_status_text(self) if plc_db.rps_trip_cause == "ok" then -- hmm... elseif plc_db.rps_trip_cause == "dmg_crit" then - cause = "core damage critical" + cause = "core damage high" elseif plc_db.rps_trip_cause == "high_temp" then cause = "core temperature high" elseif plc_db.rps_trip_cause == "no_coolant" then @@ -694,18 +696,18 @@ function logic.handle_redstone(self) -- reactor controls if self.plc_s ~= nil then if (not self.plc_cache.rps_status.manual) and self.io_ctl.digital_read(IO.R_SCRAM) then - -- reactor SCRAM requested but not yet done; perform it + -- reactor SCRAM requested but not yet done; perform it self.plc_s.in_queue.push_command(PLC_S_CMDS.SCRAM) end if self.plc_cache.rps_trip and self.io_ctl.digital_read(IO.R_RESET) then - -- reactor RPS reset requested but not yet done; perform it + -- reactor RPS reset requested but not yet done; perform it self.plc_s.in_queue.push_command(PLC_S_CMDS.RPS_RESET) end if (not self.auto_engaged) and (not self.plc_cache.active) and (not self.plc_cache.rps_trip) and self.io_ctl.digital_read(IO.R_ACTIVE) then - -- reactor enable requested and allowable, but not yet done; perform it + -- reactor enable requested and allowable, but not yet done; perform it self.plc_s.in_queue.push_command(PLC_S_CMDS.ENABLE) end end