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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: race condition with calcout & CA input links?
From: "Konrad, Martin" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Tue, 10 Sep 2013 15:57:02 +0000
Hi,
I ran into the following problem: I have a PV (called DMOV) that makes a
1-0-1 transition which in some cases can be very fast (simulated by a
seq record for testing). I'd like to reset another PV (called
doneMovingGate_) to 1 when the 0-1 transition happens.

Here is how I tried to implement that (cf. screenshot of the VDCT screen):

1. Using a calcout record that has its input CP-linked to DMOV. => The
calcout record processes twice for each 1-0-1 transition but it doesn't
reset doneMovingGate_. I guess this happens because for some reason it
reads 1 all the time.

2. To make sure I use the calcout record correctly I increased the
length of the 0 state to 0.1 seconds. => Everything works as expected
(doneMovingGate_2 is reset to 1).

3. I put everything into the same lock set by using a FLNK + NPP instead
of a CP link. => Everything works as expected (doneMovingGate_3 is reset
to 1).

Now my question is: Why does the calcout record miss the 0 while my
camonitor (which also connects via Channel Access) gets the 1-0-1
transition reliably? As far as I can see from biRecord.c
db_post_events() is issued right before the forward links are processed.
So if it works with forward links (case #3 from above) why doesn't it
with a CP link (case #1)? Is this some sort of a race condition?

Any help is greatly appreciated

Martin

P.S.: $ uname -a
Linux konrad-linuxlap 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22
20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
record(seq, mk:seq) {
  field(DOL1, "0")
  field(LNK1, "mk:DMOV PP MS")
  field(DOL2, "1")
  field(LNK2, "mk:DMOV PP MS")
}

record(bi, mk:DMOV) {
  field(ZNAM, "zero")
  field(ONAM, "one")
}

record(calcout, mk:doneMovingCloseGate_) {
  field(CALC, "A")
  field(INPA, "mk:DMOV CP MS")
  field(OUT, "mk:doneMovingGate_ PP MS")
  field(OOPT, "Transition To Non-zero")
  field(DOPT, "Use OCAL")
  field(OCAL, "1")
}

record(bo, mk:doneMovingGate_) {
}
record(seq, mk:seq2) {
  field(DOL1, "0")
  field(LNK1, "mk:DMOV2 PP MS")
  field(DLY2, "0.1")
  field(DOL2, "1")
  field(LNK2, "mk:DMOV2 PP MS")
}

record(bi, mk:DMOV2) {
  field(ZNAM, "zero")
  field(ONAM, "one")
}

record(calcout, mk:doneMovingCloseGate_2) {
  field(CALC, "A")
  field(INPA, "mk:DMOV2 CP MS")
  field(OUT, "mk:doneMovingGate_2 PP MS")
  field(OOPT, "Transition To Non-zero")
  field(DOPT, "Use OCAL")
  field(OCAL, "1")
}

record(bo, mk:doneMovingGate_2) {
}
record(seq, mk:seq3) {
  field(DOL1, "0")
  field(LNK1, "mk:DMOV3 PP MS")
  field(DOL2, "1")
  field(LNK2, "mk:DMOV3 PP MS")
}

record(bi, mk:DMOV3) {
  field(FLNK, "mk:doneMovingCloseGate_3")
  field(ZNAM, "zero")
  field(ONAM, "one")
}

record(calcout, mk:doneMovingCloseGate_3) {
  field(CALC, "A")
  field(INPA, "mk:DMOV3 NPP MS")
  field(OUT, "mk:doneMovingGate_3 PP MS")
  field(OOPT, "Transition To Non-zero")
  field(DOPT, "Use OCAL")
  field(OCAL, "1")
}

record(bo, mk:doneMovingGate_3) {
}

Attachment: screenshot VDCT.png
Description: screenshot VDCT.png


Replies:
Re: race condition with calcout & CA input links? Andrew Johnson

Navigate by Date:
Prev: RE: Use element of waveform as input to ai record Emmanuel Mayssat
Next: Re: motor record: soft motor & DMOV Konrad, Martin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Use element of waveform as input to ai record Emmanuel Mayssat
Next: Re: race condition with calcout & CA input links? Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·