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  2020  <20212022  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  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Infinite FLNK loop
From: "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov>
To: "Daykin, Evan" <daykin at frib.msu.edu>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Mon, 6 Dec 2021 22:00:36 +0000
Hi Evan,

Presumably you have something else (GUI, script or some other process) that might write to any of A, B or C and you want that to trigger the other two outputs as well, no matter which one started. I think you’ll need to add some extra records to do that. I don’t have time to code golf this so there might be a shorter way to do it, but I would try this:
  • Rename A, B and C to Aout, Bout, Cout and remove their FLNK settings.
  • Create new ao records A, B and C which have DTYP="Soft Channel” and copy their EGU, EGUL and EGUF fields from the originals (you might need to set DRHV/DRVL and/or some others to match as well, these are what the external process will now write to).
  • The OUT field of A points to Aout and its FLNK points to a new fanout record Afwd which has LNK0 pointing to Bout and LNK1 pointing to Cout.
  • Similarly B.OUT points to new fanout Bfwd with Bfwd.LNK0 pointing to Cout and Bfwd.LNK1  pointing to Aout.
  • Repeat with C.OUT → new fanout Cfwd, Cfwd.LNK0 → Aout and Cfwd.LNK1 → Bout.
Note that it’s not really the lockset which breaks the infinite loop in original (the above records should all appear in the same lockset too), it’s the PACT field of the record that was first written to, and the fact that  forward linking through a DB link is implemented as a recursive call which is made before PACT gets cleared.

HTH,

- Andrew


On Dec 6, 2021, at 2:43 PM, Daykin, Evan via Tech-talk <tech-talk at aps.anl.gov> wrote:

Hi Tech Talk,
 
I have a set of three records on my IOC which asynchronously send outputs to a hardware device, call them “A, B and C”. When one of these three processes, the other two should also process.
 
My normal idiom is as follows:
 
record(ao, "A")
{
  …
  field(FLNK, "B")
}
 
record(ao, "B")
{
  …
  field(FLNK, "C")
}
 
record(ao, "C")
{
  …
  field(FLNK, "A")
}
 
Which always works fine if the records are Soft Channels, since all three are in the same lock set and the loop is smart enough to terminate. In my case where all three go to (slow) hardware, this continues infinitely. I see here (https://epics.anl.gov/tech-talk/2006/msg00216.php)  that this was known behavior in 2006, but I’d like to see if there are any alternatives or workarounds in the following 15 or so years.
 
Thank you,
Evan
 
Evan Daykin
Controls Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824, USA
Tel. 517-908-7678
<image001.jpg>

-- 
Complexity comes for free, simplicity you have to work for.


References:
Infinite FLNK loop Daykin, Evan via Tech-talk

Navigate by Date:
Prev: Trying to use elauncher: _main_ thread failed Crisp, Daniel via Tech-talk
Next: Re: Trying to use elauncher: _main_ thread failed Johnson, Andrew N. 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  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Infinite FLNK loop Daykin, Evan via Tech-talk
Next: Trying to use elauncher: _main_ thread failed Crisp, Daniel 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  2020  <20212022  2023  2024 
ANJ, 06 Dec 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·