mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
parent
2f99aaeedb
commit
adbf1f2f78
@ -70,9 +70,9 @@ function databus.tx_link_state(state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- transmit reactor enable state across the bus
|
-- transmit reactor enable state across the bus
|
||||||
---@param active boolean reactor active
|
---@param active boolean|nil reactor active
|
||||||
function databus.tx_reactor_state(active)
|
function databus.tx_reactor_state(active)
|
||||||
databus.ps.publish("reactor_active", active)
|
databus.ps.publish("reactor_active", active == true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit RPS data across the bus
|
-- transmit RPS data across the bus
|
||||||
|
@ -469,13 +469,22 @@ function plc.rps_init(reactor, is_formed)
|
|||||||
self.tripped = false
|
self.tripped = false
|
||||||
self.trip_cause = RPS_TRIP_CAUSE.OK
|
self.trip_cause = RPS_TRIP_CAUSE.OK
|
||||||
|
|
||||||
for i = 1, #self.state do
|
for i = 1, #self.state do self.state[i] = false end
|
||||||
self.state[i] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
if not quiet then log.info("RPS: reset") end
|
if not quiet then log.info("RPS: reset") end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- partial RPS reset that only clears fault and sys_fail
|
||||||
|
function public.reset_formed()
|
||||||
|
self.tripped = false
|
||||||
|
self.trip_cause = RPS_TRIP_CAUSE.OK
|
||||||
|
|
||||||
|
self.state[state_keys.fault] = false
|
||||||
|
self.state[state_keys.sys_fail] = false
|
||||||
|
|
||||||
|
log.info("RPS: partial reset on formed")
|
||||||
|
end
|
||||||
|
|
||||||
-- reset the automatic and timeout trip flags, then clear trip if that was the trip cause
|
-- reset the automatic and timeout trip flags, then clear trip if that was the trip cause
|
||||||
function public.auto_reset()
|
function public.auto_reset()
|
||||||
self.state[state_keys.automatic] = false
|
self.state[state_keys.automatic] = false
|
||||||
|
@ -18,7 +18,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.6.12"
|
local R_PLC_VERSION = "v1.6.13"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -125,9 +125,8 @@ function threads.thread__main(smem, init)
|
|||||||
plc_comms.reconnect_reactor(plc_dev.reactor)
|
plc_comms.reconnect_reactor(plc_dev.reactor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reset RPS for newly connected reactor
|
-- partial reset of RPS, specific to becoming formed
|
||||||
-- without this, is_formed will be out of date and cause it to think its no longer formed again
|
rps.reset_formed()
|
||||||
rps.reset()
|
|
||||||
else
|
else
|
||||||
-- fully lost the reactor now :(
|
-- fully lost the reactor now :(
|
||||||
println_ts("reactor lost (failed reconnect)!")
|
println_ts("reactor lost (failed reconnect)!")
|
||||||
@ -231,9 +230,8 @@ function threads.thread__main(smem, init)
|
|||||||
plc_comms.reconnect_reactor(plc_dev.reactor)
|
plc_comms.reconnect_reactor(plc_dev.reactor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reset RPS for newly connected reactor
|
-- partial reset of RPS, specific to becoming formed
|
||||||
-- without this, is_formed will be out of date and cause it to think its no longer formed again
|
rps.reset_formed()
|
||||||
rps.reset()
|
|
||||||
end
|
end
|
||||||
elseif networked and type == "modem" then
|
elseif networked and type == "modem" then
|
||||||
-- note, check init_ok first since nic will be nil if it is false
|
-- note, check init_ok first since nic will be nil if it is false
|
||||||
|
@ -155,7 +155,7 @@ local function peri_init(iface)
|
|||||||
|
|
||||||
self.fault_counts[key] = self.fault_counts[key] + 1
|
self.fault_counts[key] = self.fault_counts[key] + 1
|
||||||
|
|
||||||
return (function () return ACCESS_FAULT end)
|
return (function () return UNDEFINED_FIELD end)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ function ppm.log_mounts()
|
|||||||
log.info(util.c("PPM: had found a ", mount.type, " (", iface, ")"))
|
log.info(util.c("PPM: had found a ", mount.type, " (", iface, ")"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if #ppm_sys.mounts == 0 then
|
if util.table_len(ppm_sys.mounts) == 0 then
|
||||||
log.warning("PPM: no devices had been found")
|
log.warning("PPM: no devices had been found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ local t_pack = table.pack
|
|||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
-- scada-common version
|
-- scada-common version
|
||||||
util.version = "1.1.17"
|
util.version = "1.1.18"
|
||||||
|
|
||||||
util.TICK_TIME_S = 0.05
|
util.TICK_TIME_S = 0.05
|
||||||
util.TICK_TIME_MS = 50
|
util.TICK_TIME_MS = 50
|
||||||
@ -284,11 +284,13 @@ function util.cancel_timer(timer) os.cancelTimer(timer) end
|
|||||||
|
|
||||||
--#region PARALLELIZATION
|
--#region PARALLELIZATION
|
||||||
|
|
||||||
-- protected sleep call so we still are in charge of catching termination
|
-- protected sleep call so we still are in charge of catching termination<br>
|
||||||
---@param t integer seconds
|
-- returns the result of pcall
|
||||||
|
---@param t number seconds
|
||||||
|
---@return boolean success, any result, any ...
|
||||||
--- EVENT_CONSUMER: this function consumes events
|
--- EVENT_CONSUMER: this function consumes events
|
||||||
---@diagnostic disable-next-line: undefined-field
|
---@diagnostic disable-next-line: undefined-field
|
||||||
function util.psleep(t) pcall(os.sleep, t) end
|
function util.psleep(t) return pcall(os.sleep, t) end
|
||||||
|
|
||||||
-- no-op to provide a brief pause (1 tick) to yield<br>
|
-- no-op to provide a brief pause (1 tick) to yield<br>
|
||||||
--- EVENT_CONSUMER: this function consumes events
|
--- EVENT_CONSUMER: this function consumes events
|
||||||
|
Loading…
Reference in New Issue
Block a user