#136 send rps trip cause with status, moved rps is_tripped to rps status from main status, increased plc status send rate to 2 Hz
This commit is contained in:
@@ -315,6 +315,7 @@ function plc.rps_init(reactor, is_formed)
|
||||
status = rps_status_t.automatic
|
||||
else
|
||||
self.tripped = false
|
||||
self.trip_cause = rps_status_t.ok
|
||||
end
|
||||
|
||||
-- if a new trip occured...
|
||||
@@ -339,7 +340,10 @@ function plc.rps_init(reactor, is_formed)
|
||||
end
|
||||
|
||||
function public.status() return self.state end
|
||||
|
||||
function public.is_tripped() return self.tripped end
|
||||
function public.get_trip_cause() return self.trip_cause end
|
||||
|
||||
function public.is_active() return self.reactor_enabled end
|
||||
function public.is_formed() return self.formed end
|
||||
function public.is_force_disabled() return self.force_disabled end
|
||||
@@ -623,7 +627,6 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co
|
||||
local sys_status = {
|
||||
util.time(), -- timestamp
|
||||
(not self.scrammed), -- requested control state
|
||||
rps.is_tripped(), -- rps_tripped
|
||||
no_reactor, -- no reactor peripheral connected
|
||||
formed, -- reactor formed
|
||||
heating_rate, -- heating rate
|
||||
@@ -641,7 +644,7 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co
|
||||
-- send reactor protection system status
|
||||
function public.send_rps_status()
|
||||
if self.linked then
|
||||
_send(RPLC_TYPES.RPS_STATUS, rps.status())
|
||||
_send(RPLC_TYPES.RPS_STATUS, { rps.is_tripped(), rps.get_trip_cause(), table.unpack(rps.status()) })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ local config = require("reactor-plc.config")
|
||||
local plc = require("reactor-plc.plc")
|
||||
local threads = require("reactor-plc.threads")
|
||||
|
||||
local R_PLC_VERSION = "beta-v0.9.8"
|
||||
local R_PLC_VERSION = "beta-v0.9.9"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
||||
@@ -10,7 +10,7 @@ local println = util.println
|
||||
local print_ts = util.print_ts
|
||||
local println_ts = util.println_ts
|
||||
|
||||
local MAIN_CLOCK = 1 -- (1Hz, 20 ticks)
|
||||
local MAIN_CLOCK = 0.5 -- (2Hz, 10 ticks)
|
||||
local RPS_SLEEP = 250 -- (250ms, 5 ticks)
|
||||
local COMMS_SLEEP = 150 -- (150ms, 3 ticks)
|
||||
local SP_CTRL_SLEEP = 250 -- (250ms, 5 ticks)
|
||||
@@ -37,9 +37,9 @@ function threads.thread__main(smem, init)
|
||||
function public.exec()
|
||||
log.debug("main thread init, clock inactive")
|
||||
|
||||
-- send status updates at 1Hz (every 20 server ticks) (every loop tick)
|
||||
-- send link requests at 0.5Hz (every 40 server ticks) (every 4 loop ticks)
|
||||
local LINK_TICKS = 4
|
||||
-- send status updates at 2Hz (every 10 server ticks) (every loop tick)
|
||||
-- send link requests at 0.5Hz (every 40 server ticks) (every 8 loop ticks)
|
||||
local LINK_TICKS = 8
|
||||
local ticks_to_update = 0
|
||||
local loop_clock = util.new_clock(MAIN_CLOCK)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user