This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timestamp.db
51 lines (42 loc) · 1.5 KB
/
timestamp.db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# file: timestamp.db
# see: https://github.com/APS-USAXS/ipython-usaxs/issues/385
# purpose: Database to get ISO8601-formatted timestamp PV
# for the start time of a detector.
# Generalized to watch a PV for some transition
# that can be measured with a CALC.
# RESULT: $(P)$(D)timestamp
# MACRO meaning
# A source PV to be watched (no field!)
# CALC calculation to be used
# P IOC prefix to use: $(P)$(D)
# D database instance prefix to use: $(P)$(D)
# OOPT When to write output (see calcout .OOPT field)
# Use of the .TSEL fields propagates the source PV's time stamp
# EXAMPLE
#
# Watch an area detector and record when it STARTS to acquire an image.
# It is suggested to run this in a screen session.
#
# softIoc \
# -m A=9idFLY2:cam1:Acquire,CALC="A>0.5",P=9idFLY2:,D=acquire_started:,OOPT="Transition To Non-zero" \
# -d timestamp.db
record(calcout, "$(P)$(D)_calc") {
field(DESC, "watches $(A)")
#field(TSEL, "$(A).TIME")
field(INPA, "$(A)")
field(CALC, "$(CALC)") # such as "A>0.5"
field(SCAN, ".1 second")
field(OUT, "$(P)$(D)_buffer PP")
field(OOPT, "$(OOPT)") # such as "Transition To Non-zero"
}
record(ao, "$(P)$(D)_buffer") {
field(TSEL, "$(P)$(D)_calc.TIME")
field(FLNK, "$(P)$(D)timestamp")
}
record(stringin, "$(P)$(D)timestamp") {
field(DESC, "$(A) timestamp")
field(DTYP, "Soft Timestamp")
field(INP, "@%Y-%m-%d %H:%M:%S.%03f")
field(SCAN, "Passive")
field(TSEL, "$(P)$(D)_buffer.TIME")
}