supervisor debug log messages and #427 fix

This commit is contained in:
Mikayla Fischler 2024-02-21 12:58:49 -05:00
parent 910509d764
commit 96691d773a
4 changed files with 18 additions and 15 deletions

View File

@ -337,7 +337,7 @@ function facility.new(num_reactors, cooling_conf)
if state_changed then
self.saturated = false
log.debug("FAC: state changed from " .. PROCESS_NAMES[self.last_mode + 1] .. " to " .. PROCESS_NAMES[self.mode + 1])
log.debug(util.c("FAC: state changed from ", PROCESS_NAMES[self.last_mode + 1], " to ", PROCESS_NAMES[self.mode + 1]))
if (self.last_mode == PROCESS.INACTIVE) or (self.last_mode == PROCESS.GEN_RATE_FAULT_IDLE) then
self.start_fail = START_STATUS.OK
@ -375,6 +375,8 @@ function facility.new(num_reactors, cooling_conf)
end
end
log.debug(util.c("FAC: computed a max combined burn rate of ", self.max_burn_combined, "mB/t"))
if blade_count == nil then
-- no units
log.warning("FAC: cannot start process control with 0 units assigned")
@ -436,7 +438,7 @@ function facility.new(num_reactors, cooling_conf)
self.saturated = true
self.status_text = { "MONITORED MODE", "running reactors at limit" }
log.info(util.c("FAC: MAX_BURN process mode started"))
log.info("FAC: MAX_BURN process mode started")
end
_allocate_burn_rate(self.max_burn_combined, true)
@ -445,7 +447,7 @@ function facility.new(num_reactors, cooling_conf)
if state_changed then
self.time_start = now
self.status_text = { "BURN RATE MODE", "running" }
log.info(util.c("FAC: BURN_RATE process mode started"))
log.info("FAC: BURN_RATE process mode started")
end
local unallocated = _allocate_burn_rate(self.burn_target, true)
@ -459,7 +461,7 @@ function facility.new(num_reactors, cooling_conf)
self.accumulator = 0
self.status_text = { "CHARGE MODE", "running control loop" }
log.info(util.c("FAC: CHARGE mode starting PID control"))
log.info("FAC: CHARGE mode starting PID control")
elseif self.last_update ~= charge_update then
-- convert to kFE to make constants not microscopic
local error = util.round((self.charge_setpoint - avg_charge) / 1000) / 1000
@ -614,7 +616,7 @@ function facility.new(num_reactors, cooling_conf)
astatus.matrix_fill = (db.tanks.energy_fill >= ALARM_LIMS.CHARGE_HIGH) or (astatus.matrix_fill and db.tanks.energy_fill > ALARM_LIMS.CHARGE_RE_ENABLE)
if was_fill and not astatus.matrix_fill then
log.info("FAC: charge state of induction matrix entered acceptable range <= " .. (ALARM_LIMS.CHARGE_RE_ENABLE * 100) .. "%")
log.info(util.c("FAC: charge state of induction matrix entered acceptable range <= ", ALARM_LIMS.CHARGE_RE_ENABLE * 100, "%"))
end
-- check for critical unit alarms

View File

@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.2.7"
local SUPERVISOR_VERSION = "v1.2.8"
local println = util.println
local println_ts = util.println_ts

View File

@ -199,9 +199,8 @@ function supervisor.comms(_version, nic, fp_ok)
-- pass the packet onto the session handler
session.in_queue.push_packet(packet)
else
-- unknown session, force a re-link
log.debug("PLC_ESTABLISH: no session but not an establish, forcing relink")
_send_establish(packet.scada_frame, ESTABLISH_ACK.DENY)
-- any other packet should be session related, discard it
log.debug("discarding RPLC packet without a known session")
end
elseif protocol == PROTOCOL.SCADA_MGMT then
---@cast packet mgmt_frame

View File

@ -564,6 +564,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
function public.auto_engage()
self.auto_engaged = true
if self.plc_i ~= nil then
log.debug(util.c("UNIT ", self.r_id, ": engaged auto control"))
self.plc_i.auto_lock(true)
end
end
@ -572,6 +573,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
function public.auto_disengage()
self.auto_engaged = false
if self.plc_i ~= nil then
log.debug(util.c("UNIT ", self.r_id, ": disengaged auto control"))
self.plc_i.auto_lock(false)
self.db.control.br100 = 0
end
@ -582,12 +584,12 @@ function unit.new(reactor_id, num_boilers, num_turbines)
---@nodiscard
---@return integer lim_br100
function public.auto_get_effective_limit()
if (not self.db.control.ready) or self.db.control.degraded or self.plc_cache.rps_trip then
self.db.control.br100 = 0
local ctrl = self.db.control
if (not ctrl.ready) or ctrl.degraded or self.plc_cache.rps_trip then
log.debug(util.c("UNIT ", self.r_id, ": effective limit is zero! ready[", ctrl.ready, "] degraded[", ctrl.degraded, "] rps_trip[", self.plc_cache.rps_trip, "]"))
ctrl.br100 = 0
return 0
else
return self.db.control.lim_br100
end
else return ctrl.lim_br100 end
end
-- set the automatic burn rate based on the last set burn rate in 100ths
@ -595,8 +597,8 @@ function unit.new(reactor_id, num_boilers, num_turbines)
function public.auto_commit_br100(ramp)
if self.auto_engaged then
if self.plc_i ~= nil then
log.debug(util.c("UNIT ", self.r_id, ": commit br100 of ", self.db.control.br100, " with ramp set to ", ramp))
self.plc_i.auto_set_burn(self.db.control.br100 / 100, ramp)
if ramp then self.ramp_target_br100 = self.db.control.br100 end
end
end