Skip to content

Commit

Permalink
timingApp: simplify Network-Mon machinery.
Browse files Browse the repository at this point in the history
The 2s delay and 1Hz scan rate for Alive-Mon (via cmd_conf_get), coupled
with variable timing on busy machines, can lead to spurious 0 values in
Network-Mon. Using the alarm in cmd_conf_get instead, which will be set
when there is a timeout, provides a much more reliable check.

Also stop using devstat, since its use is only to allow the check based
on Alive-Mon to work when the device hasn't received any configuration.
  • Loading branch information
ericonr committed Sep 18, 2023
1 parent 5e1cc89 commit 42cdb9d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 90 deletions.
39 changes: 8 additions & 31 deletions timingApp/src/sncEVGSetup.stt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ int download;
assign download to "{P}{R}Download-Cmd.VAL";
monitor download;

int statdev;
assign statdev to "{P}{R}DevStatus-Mon";
monitor statdev;

int past_alive = -1;
int alive;
assign alive to "{P}{R}Alive-Mon";
monitor alive;
int cmd_conf_get;
assign cmd_conf_get to "{P}{R}cmd_conf_get";
monitor cmd_conf_get;
evflag cmd_conf_get_event;
sync cmd_conf_get cmd_conf_get_event;

int funsel;
assign funsel to "{P}{R}DevFun-Sel.VAL";
Expand Down Expand Up @@ -269,29 +266,9 @@ ss networkStatus {

state networkCheck {

when (delay(2.0)) {

if (funselRBV == 0) {
past_alive = -1;
network = 0;
pvPut(network,SYNC);
}
else if (statdev == 0) {
past_alive = -1;
network = 1;
pvPut(network,SYNC);
}
else if (alive > past_alive) {
past_alive = alive;
network = 1;
pvPut(network,SYNC);
}
else {
past_alive = alive;
network = 0;
pvPut(network,SYNC);
}

when (efTestAndClear(cmd_conf_get_event)) {
network = !(pvStatus(cmd_conf_get) || funselRBV == 0);
pvPut(network,SYNC);
} state networkCheck
}
}
35 changes: 8 additions & 27 deletions timingApp/src/sncEVRESetup.stt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ int statdev;
assign statdev to "{P}{R}DevStatus-Mon";
monitor statdev;

int past_alive = -1;
int alive;
assign alive to "{P}{R}Alive-Mon";
monitor alive;
int cmd_conf_get;
assign cmd_conf_get to "{P}{R}cmd_conf_get";
monitor cmd_conf_get;
evflag cmd_conf_get_event;
sync cmd_conf_get cmd_conf_get_event;

int funsel;
assign funsel to "";
Expand Down Expand Up @@ -150,29 +151,9 @@ ss networkStatus {

state networkCheck {

when (delay(2.0)) {

if (funselRBV == 0) {
past_alive = -1;
network = 0;
pvPut(network,SYNC);
}
else if (statdev == 0) {
past_alive = -1;
network = 1;
pvPut(network,SYNC);
}
else if (alive > past_alive) {
past_alive = alive;
network = 1;
pvPut(network,SYNC);
}
else {
past_alive = alive;
network = 0;
pvPut(network,SYNC);
}

when (efTestAndClear(cmd_conf_get_event)) {
network = !(pvStatus(cmd_conf_get) || funselRBV == 0);
pvPut(network,SYNC);
} state networkCheck
}
}
40 changes: 8 additions & 32 deletions timingApp/src/sncFOUTSetup.stt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ int statdev;
assign statdev to "{P}{R}DevStatus-Mon";
monitor statdev;

int past_alive = -1;
int alive;
assign alive to "{P}{R}Alive-Mon";
monitor alive;
int cmd_conf_get;
assign cmd_conf_get to "{P}{R}cmd_conf_get";
monitor cmd_conf_get;
evflag cmd_conf_get_event;
sync cmd_conf_get cmd_conf_get_event;

int funselRBV;
assign funselRBV to "{P}{R}DevFun-Sts.RVAL";
Expand Down Expand Up @@ -105,34 +106,9 @@ ss networkStatus {

state networkCheck {

when (delay(2.0)) {

%{/* Check main status PVs */}%

if (funselRBV == 0) {

past_alive = -1;
network = 0;
pvPut(network,SYNC);
}
else if (statdev == 0) {

past_alive = -1;
network = 1;
pvPut(network,SYNC);
}
else if (alive > past_alive) {

past_alive = alive;
network = 1;
pvPut(network,SYNC);
}
else {
past_alive = alive;
network = 0;
pvPut(network,SYNC);
}

when (efTestAndClear(cmd_conf_get_event)) {
network = !(pvStatus(cmd_conf_get) || funselRBV == 0);
pvPut(network,SYNC);
} state networkCheck
}
}

0 comments on commit 42cdb9d

Please sign in to comment.