Compare commits

...

17 Commits

Author SHA1 Message Date
Mikayla
f7766d8cba Merge pull request #334 from MikaylaFischler/devel
2023.08.27 Release
2023-08-27 14:02:43 -04:00
Mikayla Fischler
37f8b85924 #333 always set emergency coolant state 2023-08-27 13:42:25 -04:00
Mikayla Fischler
2ed28cf74d #324 fixed alarm sounder lag 2023-08-26 19:01:22 -04:00
Mikayla Fischler
17698b7fb4 #332 fixed turbine production rate on coordinator UI 2023-08-26 12:22:47 -04:00
Mikayla Fischler
386a33ffd8 #298 consistent log tags 2023-08-26 11:54:58 -04:00
Mikayla Fischler
b7d4468cea #327 close connections on timeout 2023-08-25 21:42:35 -04:00
Mikayla Fischler
8b0a5d529e #330 close coordinator comms on error exit 2023-08-25 21:02:24 -04:00
Mikayla Fischler
d18a93f7d2 #326 added commas to dynamic tank fill 2023-08-25 20:53:28 -04:00
Mikayla Fischler
89d1087b1c updated flow monitor to say boiler when 1, boilers when 2 2023-08-25 20:49:38 -04:00
Mikayla Fischler
d9e48f5cac #325 fixed coordinator unit overview height calcs 2023-08-25 20:02:59 -04:00
Mikayla
56377ef595 Merge pull request #322 from MikaylaFischler/devel
2023.08.22 Hotfix 2
2023-08-22 21:49:32 -04:00
Mikayla Fischler
95c300e450 #321 fixed boiler flow indicators on flow monitor 2023-08-22 21:46:34 -04:00
Mikayla
2985898b7e Merge pull request #320 from MikaylaFischler/devel
2023.08.22 Hotfix
2023-08-22 20:05:53 -04:00
Mikayla Fischler
57d50e6745 #319 updated installer version 2023-08-22 19:56:47 -04:00
Mikayla Fischler
3dc1a06969 #319 fixed installer bug on fresh install 2023-08-22 19:55:34 -04:00
Mikayla Fischler
fcba935240 updated readme with new installer 2023-08-22 19:13:34 -04:00
Mikayla Fischler
9b32bb4675 deleted legacy install manifest for v1.0 installer 2023-08-22 19:06:36 -04:00
19 changed files with 50 additions and 47 deletions

View File

@@ -43,7 +43,7 @@ v10.1+ is required due the complete support of CC:Tweaked added in Mekanism v10.
You can install this on a ComputerCraft computer using either: You can install this on a ComputerCraft computer using either:
* `wget https://raw.githubusercontent.com/MikaylaFischler/cc-mek-scada/main/ccmsi.lua` * `wget https://raw.githubusercontent.com/MikaylaFischler/cc-mek-scada/main/ccmsi.lua`
* `pastebin get RGasyTM4 ccmsi.lua` * `pastebin get sqUN6VUb ccmsi.lua`
## [SCADA](https://en.wikipedia.org/wiki/SCADA) ## [SCADA](https://en.wikipedia.org/wiki/SCADA)
> Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery. > Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery.

View File

@@ -18,7 +18,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local function println(message) print(tostring(message)) end local function println(message) print(tostring(message)) end
local function print(message) term.write(tostring(message)) end local function print(message) term.write(tostring(message)) end
local CCMSI_VERSION = "v1.9" local CCMSI_VERSION = "v1.9a"
local install_dir = "/.install-cache" local install_dir = "/.install-cache"
local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/"
@@ -315,7 +315,6 @@ elseif mode == "install" or mode == "update" then
end end
end end
lmnf.versions.installer = CCMSI_VERSION
if manifest.versions.installer ~= CCMSI_VERSION then if manifest.versions.installer ~= CCMSI_VERSION then
if not update_installer then yellow();println("A newer version of the installer is available, it is recommended to update to it.");white() end if not update_installer then yellow();println("A newer version of the installer is available, it is recommended to update to it.");white() end
if update_installer or ask_y_n("Would you like to update now") then if update_installer or ask_y_n("Would you like to update now") then

View File

@@ -42,8 +42,8 @@ local function _api_handle_outq(session)
-- max 100ms spent processing queue -- max 100ms spent processing queue
if util.time() - handle_start > 100 then if util.time() - handle_start > 100 then
log.warning("[API] out queue handler exceeded 100ms queue process limit") log.warning("API: out queue handler exceeded 100ms queue process limit")
log.warning(util.c("[API] offending session: ", session)) log.warning(util.c("API: offending session: ", session))
break break
end end
end end
@@ -63,7 +63,7 @@ local function _shutdown(session)
end end
end end
log.debug(util.c("[API] closed session ", session)) log.debug(util.c("API: closed session ", session))
end end
-- PUBLIC FUNCTIONS -- -- PUBLIC FUNCTIONS --
@@ -114,7 +114,7 @@ function apisessions.establish_session(source_addr, version)
setmetatable(pkt_s, mt) setmetatable(pkt_s, mt)
iocontrol.fp_pkt_connected(id, version, source_addr) iocontrol.fp_pkt_connected(id, version, source_addr)
log.debug(util.c("[API] established new session: ", pkt_s)) log.debug(util.c("API: established new session: ", pkt_s))
self.next_id = id + 1 self.next_id = id + 1
@@ -130,7 +130,7 @@ function apisessions.check_all_watchdogs(timer_event)
if session.open then if session.open then
local triggered = session.instance.check_wd(timer_event) local triggered = session.instance.check_wd(timer_event)
if triggered then if triggered then
log.debug(util.c("[API] watchdog closing session ", session, "...")) log.debug(util.c("API: watchdog closing session ", session, "..."))
_shutdown(session) _shutdown(session)
end end
end end
@@ -156,7 +156,7 @@ function apisessions.free_all_closed()
---@param session pkt_session_struct ---@param session pkt_session_struct
local on_delete = function (session) local on_delete = function (session)
log.debug(util.c("[API] free'ing closed session ", session)) log.debug(util.c("API: free'ing closed session ", session))
end end
util.filter_table(self.sessions, f, on_delete) util.filter_table(self.sessions, f, on_delete)

View File

@@ -51,7 +51,7 @@ function sounder.set(states)
-- re-compute output if needed, then play audio if available -- re-compute output if needed, then play audio if available
if alarm_ctl.stream.is_recompute_needed() then alarm_ctl.stream.compute_buffer() end if alarm_ctl.stream.is_recompute_needed() then alarm_ctl.stream.compute_buffer() end
if alarm_ctl.stream.has_next_block() then play() else sounder.stop() end if alarm_ctl.stream.any_active() then play() else sounder.stop() end
end end
-- stop all audio and clear output buffer -- stop all audio and clear output buffer

View File

@@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder")
local apisessions = require("coordinator.session.apisessions") local apisessions = require("coordinator.session.apisessions")
local COORDINATOR_VERSION = "v1.0.1" local COORDINATOR_VERSION = "v1.0.9"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts
@@ -394,6 +394,9 @@ local function main()
if link_failed then println_ts("failed to connect to supervisor") end if link_failed then println_ts("failed to connect to supervisor") end
if not ui_ok then println_ts("main UI creation failed") end if not ui_ok then println_ts("main UI creation failed") end
-- close on error exit (such as UI error)
if coord_comms.is_linked() then coord_comms.close() end
println_ts("exited") println_ts("exited")
log.info("exited") log.info("exited")
end end

View File

@@ -31,8 +31,8 @@ local function new_view(root, x, y, ps)
local flow_rate = DataIndicator{parent=turbine,x=5,y=4,lu_colors=lu_col,label="",unit="mB/t",format="%10.0f",value=0,commas=true,width=16,fg_bg=text_fg_bg} local flow_rate = DataIndicator{parent=turbine,x=5,y=4,lu_colors=lu_col,label="",unit="mB/t",format="%10.0f",value=0,commas=true,width=16,fg_bg=text_fg_bg}
status.register(ps, "computed_status", status.update) status.register(ps, "computed_status", status.update)
prod_rate.register(ps, "steam_input_rate", function (val) prod_rate.update(util.joules_to_fe(val)) end) prod_rate.register(ps, "prod_rate", function (val) prod_rate.update(util.joules_to_fe(val)) end)
flow_rate.register(ps, "flow_rate", flow_rate.update) flow_rate.register(ps, "steam_input_rate", flow_rate.update)
local steam = VerticalBar{parent=turbine,x=2,y=1,fg_bg=cpair(colors.white,colors.gray),height=4,width=1} local steam = VerticalBar{parent=turbine,x=2,y=1,fg_bg=cpair(colors.white,colors.gray),height=4,width=1}
local energy = VerticalBar{parent=turbine,x=3,y=1,fg_bg=cpair(colors.green,colors.gray),height=4,width=1} local energy = VerticalBar{parent=turbine,x=3,y=1,fg_bg=cpair(colors.green,colors.gray),height=4,width=1}

View File

@@ -104,15 +104,15 @@ local function make(parent, x, y, wide, unit)
PipeNetwork{parent=root,x=20,y=1,pipes=rc_pipes,bg=colors.lightGray} PipeNetwork{parent=root,x=20,y=1,pipes=rc_pipes,bg=colors.lightGray}
if unit.num_boilers > 0 then if unit.num_boilers > 0 then
local cc_rate = DataIndicator{parent=root,x=_wide(25,22),y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg} local cc_rate = DataIndicator{parent=root,x=_wide(25,22),y=3,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg}
local hc_rate = DataIndicator{parent=root,x=_wide(25,22),y=3,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg} local hc_rate = DataIndicator{parent=root,x=_wide(25,22),y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg}
cc_rate.register(unit.unit_ps, "boil_sum", cc_rate.update) cc_rate.register(unit.unit_ps, "boiler_boil_sum", function (sum) cc_rate.update(sum * 10) end)
hc_rate.register(unit.unit_ps, "heating_rate", hc_rate.update) hc_rate.register(unit.unit_ps, "heating_rate", hc_rate.update)
local boiler = Rectangle{parent=root,x=_wide(47,40),y=1,border=border(1, colors.gray, true),width=19,height=5,fg_bg=wh_gray} local boiler = Rectangle{parent=root,x=_wide(47,40),y=1,border=border(1, colors.gray, true),width=19,height=5,fg_bg=wh_gray}
TextBox{parent=boiler,y=1,text="THERMO-ELECTRIC",alignment=TEXT_ALIGN.CENTER,height=1} TextBox{parent=boiler,y=1,text="THERMO-ELECTRIC",alignment=TEXT_ALIGN.CENTER,height=1}
TextBox{parent=boiler,y=3,text="BOILERS",alignment=TEXT_ALIGN.CENTER,height=1} TextBox{parent=boiler,y=3,text=util.trinary(unit.num_boilers>1,"BOILERS","BOILER"),alignment=TEXT_ALIGN.CENTER,height=1}
TextBox{parent=root,x=_wide(47,40),y=2,text="\x1b \x80 \x1a",width=1,height=3,fg_bg=lg_gray} TextBox{parent=root,x=_wide(47,40),y=2,text="\x1b \x80 \x1a",width=1,height=3,fg_bg=lg_gray}
TextBox{parent=root,x=_wide(65,58),y=2,text="\x1b \x80 \x1a",width=1,height=3,fg_bg=lg_gray} TextBox{parent=root,x=_wide(65,58),y=2,text="\x1b \x80 \x1a",width=1,height=3,fg_bg=lg_gray}
@@ -120,7 +120,7 @@ local function make(parent, x, y, wide, unit)
local st_rate = DataIndicator{parent=root,x=_wide(71,61),y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg} local st_rate = DataIndicator{parent=root,x=_wide(71,61),y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg}
wt_rate.register(unit.unit_ps, "turbine_flow_sum", wt_rate.update) wt_rate.register(unit.unit_ps, "turbine_flow_sum", wt_rate.update)
st_rate.register(unit.unit_ps, "boil_sum", st_rate.update) st_rate.register(unit.unit_ps, "boiler_boil_sum", st_rate.update)
else else
local wt_rate = DataIndicator{parent=root,x=28,y=3,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg} local wt_rate = DataIndicator{parent=root,x=28,y=3,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg}
local st_rate = DataIndicator{parent=root,x=28,y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg} local st_rate = DataIndicator{parent=root,x=28,y=5,lu_colors=lu_c,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=bw_fg_bg}

View File

@@ -34,7 +34,7 @@ local function make(parent, x, y, unit)
if num_boilers == 0 and num_turbines == 1 then if num_boilers == 0 and num_turbines == 1 then
height = 9 height = 9
elseif num_boilers == 1 and num_turbines <= 2 then elseif num_boilers <= 1 and num_turbines <= 2 then
height = 17 height = 17
end end

View File

@@ -297,7 +297,7 @@ local function init(main)
TextBox{parent=tank_box,x=2,y=3,text="Fill",height=1,width=10,fg_bg=style.label} TextBox{parent=tank_box,x=2,y=3,text="Fill",height=1,width=10,fg_bg=style.label}
local tank_pcnt = DataIndicator{parent=tank_box,x=10,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_col} local tank_pcnt = DataIndicator{parent=tank_box,x=10,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_col}
local tank_amnt = DataIndicator{parent=tank_box,x=2,label="",format="%13d",value=0,unit="mB",lu_colors=lu_col,width=16,fg_bg=bw_fg_bg} local tank_amnt = DataIndicator{parent=tank_box,x=2,label="",format="%13d",value=0,commas=true,unit="mB",lu_colors=lu_col,width=16,fg_bg=bw_fg_bg}
TextBox{parent=tank_box,x=2,y=6,text="Water Level",height=1,width=11,fg_bg=style.label} TextBox{parent=tank_box,x=2,y=6,text="Water Level",height=1,width=11,fg_bg=style.label}
local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(colors.blue,colors.gray),height=1,width=16} local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(colors.blue,colors.gray),height=1,width=16}

File diff suppressed because one or more lines are too long

View File

@@ -19,7 +19,7 @@ local plc = require("reactor-plc.plc")
local renderer = require("reactor-plc.renderer") local renderer = require("reactor-plc.renderer")
local threads = require("reactor-plc.threads") local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v1.5.6" local R_PLC_VERSION = "v1.5.7"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts

View File

@@ -154,8 +154,8 @@ function threads.thread__main(smem, init)
smem.q.mq_comms_rx.push_packet(packet) smem.q.mq_comms_rx.push_packet(packet)
end end
elseif event == "timer" and networked and plc_state.init_ok and conn_watchdog.is_timer(param1) then elseif event == "timer" and networked and plc_state.init_ok and conn_watchdog.is_timer(param1) then
-- haven't heard from server recently? shutdown reactor -- haven't heard from server recently? close connection and shutdown reactor
plc_comms.unlink() plc_comms.close()
smem.q.mq_rps.push_command(MQ__RPS_CMD.TRIP_TIMEOUT) smem.q.mq_rps.push_command(MQ__RPS_CMD.TRIP_TIMEOUT)
elseif event == "timer" then elseif event == "timer" then
-- notify timer callback dispatcher if no other timer case claimed this event -- notify timer callback dispatcher if no other timer case claimed this event

View File

@@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
local sps_rtu = require("rtu.dev.sps_rtu") local sps_rtu = require("rtu.dev.sps_rtu")
local turbinev_rtu = require("rtu.dev.turbinev_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu")
local RTU_VERSION = "v1.6.0" local RTU_VERSION = "v1.6.2"
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE

View File

@@ -73,7 +73,7 @@ function threads.thread__main(smem)
-- re-compute output if needed, then play audio if available -- re-compute output if needed, then play audio if available
if sounder.stream.is_recompute_needed() then if sounder.stream.is_recompute_needed() then
sounder.stream.compute_buffer() sounder.stream.compute_buffer()
if sounder.stream.has_next_block() then sounder.play() else sounder.stop() end if sounder.stream.any_active() then sounder.play() else sounder.stop() end
end end
end end
@@ -93,8 +93,8 @@ function threads.thread__main(smem)
smem.q.mq_comms.push_packet(packet) smem.q.mq_comms.push_packet(packet)
end end
elseif event == "timer" and conn_watchdog.is_timer(param1) then elseif event == "timer" and conn_watchdog.is_timer(param1) then
-- haven't heard from server recently? unlink -- haven't heard from server recently? close connection
rtu_comms.unlink(rtu_state) rtu_comms.close(rtu_state)
elseif event == "timer" then elseif event == "timer" then
-- notify timer callback dispatcher if no other timer case claimed this event -- notify timer callback dispatcher if no other timer case claimed this event
tcd.handle(param1) tcd.handle(param1)

View File

@@ -296,6 +296,9 @@ function audio.new_stream()
end end
end end
-- check if any alarms are active
function public.any_active() return self.any_active end
-- check if the next audio block has data -- check if the next audio block has data
function public.has_next_block() return #self.quad_buffer[self.next_block] > 0 end function public.has_next_block() return #self.quad_buffer[self.next_block] > 0 end

View File

@@ -8,7 +8,7 @@ local cc_strings = require("cc.strings")
local util = {} local util = {}
-- scada-common version -- scada-common version
util.version = "1.0.1" util.version = "1.0.2"
-- ENVIRONMENT CONSTANTS -- -- ENVIRONMENT CONSTANTS --

View File

@@ -81,7 +81,7 @@ local function _sv_handle_outq(session)
elseif cmd.key == SV_Q_DATA.SET_BURN and type(cmd.val) == "table" and #cmd.val == 2 then elseif cmd.key == SV_Q_DATA.SET_BURN and type(cmd.val) == "table" and #cmd.val == 2 then
plc_s.in_queue.push_data(PLC_S_DATA.BURN_RATE, cmd.val[2]) plc_s.in_queue.push_data(PLC_S_DATA.BURN_RATE, cmd.val[2])
else else
log.debug(util.c("[SVS] unknown PLC SV queue command ", cmd.key)) log.debug(util.c("SVS: unknown PLC SV queue command ", cmd.key))
end end
end end
else else
@@ -104,8 +104,8 @@ local function _sv_handle_outq(session)
-- max 100ms spent processing queue -- max 100ms spent processing queue
if util.time() - handle_start > 100 then if util.time() - handle_start > 100 then
log.debug("[SVS] supervisor out queue handler exceeded 100ms queue process limit") log.debug("SVS: supervisor out queue handler exceeded 100ms queue process limit")
log.debug(util.c("[SVS] offending session: ", session)) log.debug(util.c("SVS: offending session: ", session))
break break
end end
end end
@@ -139,7 +139,7 @@ local function _shutdown(session)
end end
end end
log.debug(util.c("[SVS] closed session ", session)) log.debug(util.c("SVS: closed session ", session))
end end
-- close connections -- close connections
@@ -160,7 +160,7 @@ local function _check_watchdogs(sessions, timer_event)
if session.open then if session.open then
local triggered = session.instance.check_wd(timer_event) local triggered = session.instance.check_wd(timer_event)
if triggered then if triggered then
log.debug(util.c("[SVS] watchdog closing session ", session, "...")) log.debug(util.c("SVS: watchdog closing session ", session, "..."))
_shutdown(session) _shutdown(session)
end end
end end
@@ -174,7 +174,7 @@ local function _free_closed(sessions)
---@param session sv_session_structs ---@param session sv_session_structs
local on_delete = function (session) local on_delete = function (session)
log.debug(util.c("[SVS] free'ing closed session ", session)) log.debug(util.c("SVS: free'ing closed session ", session))
end end
util.filter_table(sessions, f, on_delete) util.filter_table(sessions, f, on_delete)
@@ -312,7 +312,7 @@ function svsessions.establish_plc_session(source_addr, for_reactor, version)
setmetatable(plc_s, mt) setmetatable(plc_s, mt)
databus.tx_plc_connected(for_reactor, version, source_addr) databus.tx_plc_connected(for_reactor, version, source_addr)
log.debug(util.c("[SVS] established new session: ", plc_s)) log.debug(util.c("SVS: established new session: ", plc_s))
self.next_ids.plc = id + 1 self.next_ids.plc = id + 1
@@ -357,7 +357,7 @@ function svsessions.establish_rtu_session(source_addr, advertisement, version)
setmetatable(rtu_s, mt) setmetatable(rtu_s, mt)
databus.tx_rtu_connected(id, version, source_addr) databus.tx_rtu_connected(id, version, source_addr)
log.debug(util.c("[SVS] established new session: ", rtu_s)) log.debug(util.c("SVS: established new session: ", rtu_s))
self.next_ids.rtu = id + 1 self.next_ids.rtu = id + 1
@@ -398,7 +398,7 @@ function svsessions.establish_crd_session(source_addr, version)
setmetatable(crd_s, mt) setmetatable(crd_s, mt)
databus.tx_crd_connected(version, source_addr) databus.tx_crd_connected(version, source_addr)
log.debug(util.c("[SVS] established new session: ", crd_s)) log.debug(util.c("SVS: established new session: ", crd_s))
self.next_ids.crd = id + 1 self.next_ids.crd = id + 1
@@ -442,7 +442,7 @@ function svsessions.establish_pdg_session(source_addr, version)
setmetatable(pdg_s, mt) setmetatable(pdg_s, mt)
databus.tx_pdg_connected(id, version, source_addr) databus.tx_pdg_connected(id, version, source_addr)
log.debug(util.c("[SVS] established new session: ", pdg_s)) log.debug(util.c("SVS: established new session: ", pdg_s))
self.next_ids.pdg = id + 1 self.next_ids.pdg = id + 1

View File

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

View File

@@ -793,12 +793,10 @@ function logic.handle_redstone(self)
local enable_emer_cool = self.plc_cache.rps_status.low_cool or local enable_emer_cool = self.plc_cache.rps_status.low_cool or
(self.auto_engaged and self.db.annunciator.CoolantLevelLow and is_active(self.alarms.ReactorOverTemp)) (self.auto_engaged and self.db.annunciator.CoolantLevelLow and is_active(self.alarms.ReactorOverTemp))
-- don't turn off emergency coolant on sufficient coolant level since it might drop again
-- turn off once system is OK again
-- if auto control is engaged, alarm check will SCRAM on reactor over temp so that's covered
if not self.plc_cache.rps_trip then if not self.plc_cache.rps_trip then
-- can't turn off on sufficient coolant level since it might drop again
-- turn off once system is OK again
-- 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 -- set turbines to not dump steam
for i = 1, #self.turbines do for i = 1, #self.turbines do
local session = self.turbines[i] ---@type unit_session local session = self.turbines[i] ---@type unit_session
@@ -816,8 +814,6 @@ function logic.handle_redstone(self)
self.emcool_opened = false self.emcool_opened = false
elseif enable_emer_cool or self.emcool_opened then elseif enable_emer_cool or self.emcool_opened then
self.valves.emer_cool.open()
-- set turbines to dump excess steam -- set turbines to dump excess steam
for i = 1, #self.turbines do for i = 1, #self.turbines do
local session = self.turbines[i] ---@type unit_session local session = self.turbines[i] ---@type unit_session
@@ -845,6 +841,9 @@ function logic.handle_redstone(self)
self.emcool_opened = true self.emcool_opened = true
end end
-- set valve state always
if self.emcool_opened then self.valves.emer_cool.open() else self.valves.emer_cool.close() end
end end
return logic return logic