Stefan Heim wrote:
Hi,
sorry for the following lengthy expose to a problem regarding completion
notification.
I have several positioners (multiple axes devices) controlled via several
get/set pairs of ai/ao records per axis with a StreamDevice device support
(DTYP=streams).
Sometimes, the underlying "hardware" protocol offers only a set method without
completion notification for a given axis. The StreamDevice protocol file
section then has s.th. like
setX {
out "AxisAbs 1 %f";
in "AxisAbs 1 movement_started";
}
Here the device emits the "AxisAbs 1 movement_started" as mere confirmation of
the control order. There is no further reply indicating completion of the
positioning operation.
While moving, the position can be monitored in an event based manner, i.e.
a .SCAN="I/O Intr" ai record
| record (ai, "$(IOCNAME):stage:$(AXIS)")
| {
| field (SCAN, "I/O Intr")
| field (DTYP, "stream")
| field (INP, "@protocol_file.proto get$(AXIS) PORT")
| }
based on a protocol
getX {
@init {
out "registerVC 2 IOC:stage:X Joe";
in "Joe Crds %f %*f %*f %*f %*f %*f %*f ";
}
in "Joe Crds %f %*f %*f %*f %*f %*f %*f ";
}
Here, the device's capability to do registration based position monitoring is
gluelessly linked with EPICS' monitor concept. The out command issued during
init causes the device to send position update messages ("Joe Crds ...") as
if you posted a monitor on one (or several) EPICS process variable(s).
The six floats thrown away in the "in" part of this protocol ("%*f") are
typically read by a further set of (six) .SCAN="I/O Intr" ai records,
offering completely seperated control information and linear rescaling of the
raw values by means of the respective .ASLO and .AOFF fields. With the
same .ASLo/.AOFF rescaling applied to the corresponding ao record of a given
axis, this rescaling is transparent to the user/client.
In addition, there is a state variable ("ready") available with the same
subscription based event notification mechanism,
| record (bi, "$(IOCNAME):stage:ready")
| {
| field (SCAN, "I/O Intr")
| field (DTYP, "stream")
| field (INP, "@protocol_file.proto getReady PORT")
| field (ZNAM, "not ready")
| field (ONAM, "ready")
| }
with protocol
getReady {
@init {
out "registerVC 32 IOC:stage:ready Joe";
in "Joe %{not ready|ready}";
}
in "Joe %{not ready|ready}";
}
Now if I want to use the sscan record to operate on these positioners, it
expects them to do be capable of ca_put_callback()-based completion
notification. However, e.g. travelling from 0.0 to 10.0 takes ~13 s
| sheim@txm1:~$ camonitor TXM1CL:micos:ready TXM1CL:micos:ZCOARSE &
| [1] 7781
! TXM1CL:micos:ready 2007-08-31 02:09:33.733498 ready
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:11.154559 0 LOLO MAJOR
| sheim@txm1:~$ caput -c TXM1CL:micos:setZCOARSE 10
| Old : TXM1CL:micos:setZCOARSE 0
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.735909 0.022526
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.757608 0.039484
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.779335 0.061448
! TXM1CL:micos:ready 2007-08-31 02:09:44.800247 not ready
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.803464 0.087914
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.828070 0.120282
| New : TXM1CL:micos:setZCOARSE 10
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.849671 0.164518
| sheim@txm1:~$
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.870746 0.205295
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.891945 0.251714
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.914267 0.303483
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:44.935013 0.36009
| [...]
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:45.658592 4.99687
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:45.680585 5.21379
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:45.703397 5.42912
| [...]
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:46.587214 9.98588
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:46.609446 9.99538
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:46.631317 9.99971
! TXM1CL:micos:ZCOARSE 2007-08-31 02:09:46.653736 10
! TXM1CL:micos:ready 2007-08-31 02:09:47.107716 ready
but the caput -c above returns "immediately". Furtermore, the device is
possibly late to give out the "not ready" notification (cf. trace above), but
guarantees to fire "ready" only after (all) movements finished.
While I read the slides on completion notification in Scans.ppt and tried to
understand the busy record, I still wonder what might be the best approach to
the problem. Essentially, I need a way to use StreamDevice based devices not
offering a synchronous setPosition command as positioners with the sscan
record.
Any clues?
-Stefan
The busy record is the simplest mechanism I know of for getting a database
like this to behave correctly when written to by a ca_put_callback() -- which
is what the sscan record does when it needs to be notified that something has
finished. (You could write custom device support that would prevent the record
from declaring itself done (i.e., executing its forward link) until the motion
is complete, but this would put the record into a situation it doesn't have code
to handle.)
To implement a busy-record based solution, the record that the sscan record
writes to, to start the device moving, must forward link to a record that
writes '1', using a "PP" link, to a busy record's VAL field. The record that
detects that the motion is finished must cause the busy record's VAL field to
be set back to '0'. (Normally, it doesn't matter what link type is used to
reset the busy record, but "CA" is the safest, because it handles the
exceptional case in which the motion completes immediately.)
--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab.
- References:
- sscan record and StreamDevice positioners Stefan Heim
- Navigate by Date:
- Prev:
sscan record and StreamDevice positioners Stefan Heim
- Next:
Current State of Wago support ? Bill Nolan
- 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
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
sscan record and StreamDevice positioners Stefan Heim
- Next:
Current State of Wago support ? Bill Nolan
- 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
2021
2022
2023
2024
|