Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Calculating status with invalid/non-existant inputs
From: "Andrew Starritt" <andy.starritt@synchrotron.vic.gov.au>
To: <tech-talk@aps.anl.gov>
Date: Tue, 23 Oct 2007 12:47:43 +1000
Title: Calculating status with invalid/non-existant inputs

Hi all,
  To enable/disable some functionality, I sometimes do something like:

# Evaluates to 1 (true) if all condtions good otherwise 0 (false)
#
record (calc, "GOOD_TO_GO") {
   field (INPA, "PV1")
   field (INPB, "PV2")
   field (CALC, "(A=1)&&(B>=25):?1:0")
}

But what if PV1 or PV2 are invalid/undefined. Next I tried:

record (calc, "GOOD_TO_GO") {
   field (INPA, "PV1")
   field (INPB, "PV2")
   field (INPC, "PV1.SEVR")
   field (INPD, "PV2.SEVR")
   # Note: INVALID_ALARM state value is 3.
   field (CALC, "(C#3)&&(D#3)&&(A=1)&&(B>=25):?1:0")
}

This works fine of PV1 and PV2 hosted on the same IOC as GOOD_TO_GO, but if
hosted on another IOC which is currently not available, the calc record is itself invalid.

3rd attemp.

record (ai, PV1_ALIAS") {
   field (INP, "PV1")
}

record (calc, "GOOD_TO_GO") {
   field (INPA, "PV1_ALIAS")
   field (INPB, "PV2")
   field (INPC, "PV1_ALIAS.SEVR")
   field (INPD, "PV2.SEVR")
   field (CALC, "(C#3)&&(D#3)&&(A=1)&&(B>=25):?1:0")
}


This helps. Even if the IOC hosting PV1 is down, PV1_ALIAS still exists
(albeit in an invalid state) and GOOD_TO_GO can evaluate successfully.
But if the IOC hosting PV1 is up and running, then PV1_ALIAS is not invalid
even when PV1 itself is invalid. I suppose I could create an alias process
varaible for PV1.SEVR as well, but that seems to be getting very messy.

record (ai, PV1_ALIAS") {
   field (INP, "PV1")
}

record (ai, PV1_SEVR_ALIAS") {
   field (INP, "PV1.SEVR")
}

record (calc, "GOOD_TO_GO") {
   field (INPA, "PV1_ALIAS")
   field (INPB, "PV2")
   field (INPC, "PV1_ALIAS.SEVR")
   field (INPD, "PV2.SEVR")
   field (INPE, "PV1_SEVR_ALIAS")
   field (INPF, "PV1_SEVR_ALIAS.SEVR")
   field (CALC, "(C#3)&&(D#3)&&(E#3)&&(F#3)&&(A=1)&&(B>=25):?1:0")
}

 
Is there a simpler more elagant way do do this?


Regards
Andrew Starritt
_______________________________________
Senior Systems Engineer - Software Specialist
Australian Synchrotron Project
800 Blackburn Road, Clayton, Victoria 3168
Tel: +61 3 8540 4164
Fax: +61 3 8540 4200


Replies:
Re: Calculating status with invalid/non-existant inputs Tim Mooney
Re: Calculating status with invalid/non-existant inputs Emmanuel Mayssat

Navigate by Date:
Prev: New release of asyn and other modules Mark Rivers
Next: RE: Initial Value Andrew Starritt
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: New release of asyn and other modules Mark Rivers
Next: Re: Calculating status with invalid/non-existant inputs Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·