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: CA output links not working with PINI=YES?
From: "Mooney, Tim M. via Tech-talk" <tech-talk at aps.anl.gov>
To: "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov>, "Benjamin Franksen" <benjamin.franksen at helmholtz-berlin.de>
Date: Thu, 5 Mar 2020 19:28:25 +0000
I had a similar problem, and solved it by using a scan task to trigger processing of the record whose operation could not work until channel access was up.  (EPICS starts scan tasks after channel access.)  Here's a code fragment from the table_soft.vdb database in the synApps optics module:
initLastMotor processes once, after channel access is up, and then sets its SCAN field to "Passive"

---snip---
# Strategy: We need to find out when all motors have finished executing a move
# that we started.  To do this without a race condition, we set a gate PV to
# "open", write to motors, and then have the last motor written to set the gate
# PV to "closed" when it finishes.  But we don't know which motor will be the
# last motor written to, because the table record can work with fewer than six
# motors, and we don't know which motors don't actually exist.
# $(P)$(Q):lastMotor figures this out at init time.

# Evidently, $(P)$(Q):lastMotor's PINI==RUNNING field isn't getting
# $(P)$(Q):closeGate.INPA initialized.  This seems bulletproof.
record(scalcout, "$(P)$(Q):initLastMotor") {
#field(TPRO, "1")
field(SCAN, "10 second")
# Note that this must be a CA link so it can read a link field
field(INAA, "$(P)$(Q):closeGate.INPA CA")
field(CALC, "aa==''")
field(OOPT, "When Zero")
field(DOPT, "Use OCAL")
field(OCAL, "'Passive'")
field(OUT, "$(P)$(Q):initLastMotor.SCAN CA")
field(FLNK, "$(P)$(Q):lastMotor")
}

# Find the last motor that will be written to.  (Ignore motors that
# don't actually exist.)  Write that motor's .DMOV PV
record(scalcout, "$(P)$(Q):lastMotor") {
  field(CALC, "(f?ff:e?ee:d?dd:c?cc:b?bb:aa)[0,' ']+' CP'")
  field(INPA, "$(P)$(Q):dmov.INAV CA")
  field(INPB, "$(P)$(Q):dmov.INBV CA")
  field(INPC, "$(P)$(Q):dmov.INCV CA")
  field(INPD, "$(P)$(Q):dmov.INDV CA")
  field(INPE, "$(P)$(Q):dmov.INEV CA")
  field(INPF, "$(P)$(Q):dmov.INFV CA")
  field(INAA, "$(P)$(Q):dmov.INPA CA")
  field(INBB, "$(P)$(Q):dmov.INPB CA")
  field(INCC, "$(P)$(Q):dmov.INPC CA")
  field(INDD, "$(P)$(Q):dmov.INPD CA")
  field(INEE, "$(P)$(Q):dmov.INPE CA")
  field(INFF, "$(P)$(Q):dmov.INPF CA")
  field(PINI, "RUNNING")
  field(OUT, "$(P)$(Q):closeGate.INPA CA")
}
---snip---

Tim Mooney (mooney at anl.gov) (630)252-5417
Beamline Controls Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Johnson, Andrew N. via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, March 5, 2020 12:58 PM
To: Benjamin Franksen <benjamin.franksen at helmholtz-berlin.de>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: CA output links not working with PINI=YES?
 
Hi Ben,

On Mar 5, 2020, at 12:16 PM, Benjamin Franksen via Tech-talk <tech-talk at aps.anl.gov> wrote:

What we want to do here is write a string to an input link field once at
init time. Link fields can be written to only via CA, which is why we
have to use a CA link.

Do you have to wait until after iocInit to set the value of that input link field? If you could do it beforehand you could load a separate .db file that just sets the link field of that record. You can also use the IOC’s ‘dbpf’ command to write to a link field in your startup script, and the length of that string isn’t limited to 40 characters any more.

Christoph’s original example doesn’t show him writing to a link field, and I’m still a little confused exactly what you’re trying to do. Given the actual complexity of what you’re trying to do (as against the apparent simplicity that you’re wanting) I suspect using a sequence program might be simpler, but more detail of the actual problem might allow us to find a simpler solution.

- Andrew

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


References:
CA output links not working with PINI=YES? Christoph Schroeder via Tech-talk
Re: CA output links not working with PINI=YES? J. Lewis Muir via Tech-talk
Re: CA output links not working with PINI=YES? Christoph Schroeder via Tech-talk
Re: CA output links not working with PINI=YES? J. Lewis Muir via Tech-talk
Re: CA output links not working with PINI=YES? Ralph Lange via Tech-talk
Re: CA output links not working with PINI=YES? Benjamin Franksen via Tech-talk
Re: CA output links not working with PINI=YES? Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: CA output links not working with PINI=YES? Johnson, Andrew N. via Tech-talk
Next: Re: Real-time IOC and systemd Benjamin Franksen 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: CA output links not working with PINI=YES? Johnson, Andrew N. via Tech-talk
Next: Re: CA output links not working with PINI=YES? Benjamin Franksen 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, 05 Mar 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·