EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Tips for doing conditional logic in EPICS records
From: "Davis, Mark via Tech-talk" <tech-talk at aps.anl.gov>
To: Mark Rivers <rivers at cars.uchicago.edu>, John Priller <priller at nscl.msu.edu>, Mark Davis <davism50 at msu.edu>
Cc: tech-talk <tech-talk at aps.anl.gov>
Date: Tue, 28 Apr 2020 11:26:09 -0400
Hi All,

Mark was quite correct:  I didn't look at my example closely enough before sending it.

Thanks to everyone who responded with some tips on this subject.  I will followup on in a bit with some more specific questions (and examples of the approach I am using and an alternative one that, as Mark said, I believe will work using a single transform record).

Thanks,
Mark



On 4/27/2020 11:59 AM, Mark Rivers wrote:
Hi Mark,


I think you can do what you want with a single transform record.  I was trying to see how to do that when I realized I don't understand your logic.


I the first line in your for loop you conditionally set flag=1.  However,  the only place you use the flag in the loop is in line 2 which will not be executed if flag was set in line 1.  Then flag is unconditionally set back to 0 in line 4.   I don't understand how etting flag=1 in line 1 do anything useful?  I'm probably missing something.


Mark



________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Mark Davis via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, April 27, 2020 10:05 AM
To: tech-talk at aps.anl.gov; John Priller
Subject: Tips for doing conditional logic in EPICS records

Hi all,

I am looking for some tips on the best way to implement logic such as
the following using EPICS records:


flag = 1;
for (each new set of readings)  {
      if (readbackA == fixedVal1)   flag = 1;  else
      if (flag == 1)  setVal = readbackB;  else
      if (readBackC == fixedVal2)  setVal = readbackD;
      flag = 0;
}


For the initial setting I figured simply a record that includes the
initial value in the VAL field (and PINI set to "Yes"?).

The for "loop" would be simply an FLNK in the record (or last in a
sequence of records) that gets the new readings, triggering the
processing of the the record that handles the 1st if condition (in this
case, I have one record that gets them all at once).

At that point how to best to proceed is not obvious to me, and there are
probably  lots of possibilities (A sequence of calcout or scalcout
records?  Maybe a transform record?)

Suggestions?

--
Mark Davis
NSCL/FRIB Control Systems Software Engineer
davism50 at msu.edu


References:
Tips for doing conditional logic in EPICS records Mark Davis via Tech-talk
Re: Tips for doing conditional logic in EPICS records Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: Stream Device Format "%d" has data type signed which is not supported by RECORD Peter Milne via Tech-talk
Next: StreamDevice question Mark Davis via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Tips for doing conditional logic in EPICS records Mark Rivers via Tech-talk
Next: Re: Tips for doing conditional logic in EPICS records Mooney, Tim M. via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 28 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·