Hello,
we driveID (or two IDs in the case of dual undulators) with a
monochromator using the sscan record combined with the busy record.
The point is, that if the busy record is rised upon an activation of
an sscan positioner, the sscan is blocked until 'somebody' resets the
busy record. This 'somebody' could be a calcout record like:
record(calcout,"$(P):alldone"){
field(SCAN,"Passive")
field(INPA,"$(P)withID1:STATUS CP NMS")
field(INPB,"$(P)withID2:STATUS CP NMS")
field(INPC,"$(PGM):dmov CP NMS")
field(CALC,"A=1&&B=1&&C=1")
field(OCAL,"0")
field(OOPT,"Transition To Non-zero")
field(DOPT,"Use OCAL")
# <--- here the busy is reset
field(OUT,"$(P):busy PP")
}
and if you put the $(P)-E:GO transform record below as a positioner in
you sscan
# select here what to un synchronously
record(mbbo,"$(P)-E:OPT"){
field(ZRST,"PGM")
field(ONST,"PGM+ID1")
field(TWST,"PGM+ID2")
field(THST,"PGM+ID1+ID2")
field(DOL,"0")
field(PINI,"YES")
}
record(transform,"$(P)-E:GO") {
field(PREC,"3")
field(CLCA,"a")
field(CLCB,"1")
field(CLCC,"a")
field(OUTA,"$(P):energy PP")
# set the busy record to 'busy'
field(OUTB,"$(P):busy PP")
field(OUTC,"$(P)-E:GOPGM PP")
}
# this is the monochromator +ID1 + ID2 energy PV
record(ai,"$(P):energy")
{
field(PREC,"3")
}
record(seq,"$(P)-E:GOPGM"){
field(SELM, "All")
field(DOL1,"$(P):energy")
field(LNK1,"$(PGM):energy PP")
field(DO2,"1")
field(LNK2,"$(PGM):setE.PROC")
field(DO3,"1")
field(LNK3,"$(P)-E:GOID1.PROC")
}
record(calcout,"$(P)-E:GOID1") {
field(INPA,"$(P):energy")
# <-- use INPC if there is an energy shift between the
mono and ID1
field(INPC,"0")
field(INPB,"$(P)-E:OPT")
field(CALC,"B=1||B=3?1:0")
field(OOPT,"When Non-zero")
field(DOPT,"Use OCAL")
field(OCAL,"A+C")
field(OUT,"$(BML)-ID1:ENERGY PP")
field(FLNK,"$(P)-E:GOID2")
record(calcout,"$(P)-E:GOID2") {
field(INPA,"$(P):energy")
# <-- if INPC if there is an energy shift between the
mono and ID2
field(INPC,"0")
field(INPB,"$(P)-E:OPT")
field(CALC,"B=2||B=3?1:0")
field(OOPT,"When Non-zero")
field(DOPT,"Use OCAL")
field(OCAL,"A+C")
field(OUT,"$(BML)-ID2:ENERGY PP")
}
###################################################
# checking up the ID1/ID2 status for $(P)alldone
# considering the E-OPT: i.e whether the ID1/ID2 is
# scanned allong with the mono or not
###################################################
record(calc,"$(P)withID1:STATUS") {
field(SCAN,"Passive")
field(INPA,"$(BML)-ID1:STATUS CP NMS")
field(INPB,"$(P)-E:OPT CP NMS")
# +-+--------- 0 means ID1 done
field(CALC,"B=1||B=3?(A=0?1:0):1")
}
record(calc,"$(P)withID2:STATUS") {
field(SCAN,"Passive")
field(INPA,"$(BML)-ID2:STATUS CP NMS")
field(INPB,"$(P)-E:OPT CP NMS")
# +-+--------- 0 means ID2 done
field(CALC,"B=2||B=3?(A=0?1:0):1")
}
####################################################
and if you handle separately the "done" state of the monochromator,
ID1, ID2, you get a general template based solution to synchronous scans.
Cheers
_____
Swiss / / [email protected]
_/_/_/ _/ _/_/_/ /____ Experimental Division
_/ _/ _/ Source / Paul Scherrer Institute
_/_/ _/ _/_/ ____/ CH-5232 Villigen-PSI
_/_/Light _/ / Tel: ++41 56 310 5131
_/_/_/_/_/_/_/ _/_/_/___/ Fax: ++41 56 310 3151