Skip to content

Commit 3246bc2

Browse files
committed
Add RFC 6 (Acquisition) to the spec
1 parent 6be53ca commit 3246bc2

File tree

5 files changed

+178
-7
lines changed

5 files changed

+178
-7
lines changed

protocol/specification/accessibles.rst

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Basic parameters
4848
Present, if the module's main value is to be changeable remotely, i.e. it
4949
is at least a `Writable`.
5050

51+
52+
Basic commands
53+
~~~~~~~~~~~~~~
54+
5155
.. command:: stop
5256

5357
Mandatory command on a drivable. When a module's target is changed (or, if
@@ -58,6 +62,8 @@ Basic parameters
5862
parameter to a value close to the present one. Then it SHOULD act as if
5963
this value had been the initial target.
6064

65+
On an `AcquisitionController`, stops the data acquisition if running.
66+
6167
.. command:: go
6268

6369
Optional command for starting an action. If the `go` command is present,
@@ -69,13 +75,22 @@ Basic parameters
6975
usually leads to a ``BUSY`` state. Changing any parameter, which has an
7076
impact on measured values, should be executed immediately.
7177

78+
On an `AcquisitionController`, starts the data acquisition if not running.
79+
7280
.. command:: hold
7381

74-
Optional command on a drivable. Stay more or less where you are, cease
82+
Optional command on a `Drivable`. Stay more or less where you are, cease
7583
movement, be ready to continue soon, target value is kept. Continuation can
7684
be triggered with `go`, or if not present, by putting the target parameter
7785
to its present value.
7886

87+
On an `AcquisitionController`, pauses the data acquisition if running.
88+
89+
.. command:: prepare
90+
91+
On an `AcquisitionController`, prepares for the following data acquisition
92+
so that a `go` can be executed immediately.
93+
7994
.. command:: shutdown
8095

8196
Optional command for shutting down the hardware. When this command is sent,
@@ -380,3 +395,28 @@ Communication
380395
:ref:`string <string>`, or any other datatype suitable to the protocol of the device.
381396
The `communicate` command is meant to be used in modules with the
382397
`Communicator` interface class.
398+
399+
400+
Data acquisition
401+
~~~~~~~~~~~~~~~~
402+
403+
.. parameter:: goal
404+
405+
In an `AcquisitionChannel`, this optional parameter is is the `value` that,
406+
when reached, stops the data acquisition.
407+
408+
It is useful to combine this with a ``goal_enable`` parameter that can be
409+
used to make the channel insensitive to a goal value.
410+
411+
.. parameter:: roi
412+
413+
In an `AcquisitionChannel` that yields a matrix, this optional parameter can
414+
be present to restrict the returned data to a subset of the data originally
415+
acquired by the hardware.
416+
417+
.. command:: get_data
418+
419+
In an `AcquisitionChannel` that yields a matrix, if this command is present,
420+
it is used to retrieve the full matrix data. The `value` parameter then
421+
returns a reduced form of the data instead, which is suitable for sending in
422+
frequent `update` events, while the return value of `get_data` can be large.

protocol/specification/changes.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ loss of functionality.
5050

5151
- The :ref:`matrix <matrix>` data type has been specified for datainfo.
5252

53-
.. TODO
54-
55-
- The `AcquisitionController`, `AcquisitionChannel` and `Acquisition` interface
56-
classes have been specified (:ref:`rfc-006`).
53+
- The `AcquisitionController`, `AcquisitionChannel` and `Acquisition` interface
54+
classes have been specified (:ref:`rfc-006`).
5755

5856
- The UDP discovery protocol has been specified (:ref:`rfc-005`).
5957

protocol/specification/classes.rst

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,128 @@ Base classes
5757
indicate a ``BUSY`` state for a longer lasting operations.
5858

5959

60+
Acqusition base classes
61+
~~~~~~~~~~~~~~~~~~~~~~~
62+
63+
These base classes are meant to support devices used for data acquisition. This
64+
hardware can range in complexity from devices that simply provide values after
65+
some acquisition time, to multi-channel detector setups common in large scale
66+
facilities.
67+
68+
This is conceptually different simple `Readable`\s, where reading a value is
69+
assumed to be always available, without noticeably waiting time. In contrast,
70+
an acqusition cycle represented by these modules can take a while to complete,
71+
maybe providing intermediate values, and deliver a final value once finished,
72+
until the next acquisition cycle is started.
73+
74+
The following terms are relevant here:
75+
76+
- "acquisition": a complete data acquisition system consisting of one
77+
AcquisitionController module and optionally some AcquisitionChannel modules.
78+
79+
- "acquisition cycle": a single cycle of data acquisition, started by the
80+
controller's `go` command.
81+
82+
- "channel": a part of the data acquisition system representing a measured
83+
quantity. An acquisition can acquire data for one or more channels at the
84+
same time.
85+
86+
See also :secop-rfc:`006-acquisition`.
87+
88+
.. baseclass:: AcquisitionController
89+
90+
A module that controls a data acquisition process that consists of one or
91+
more channels. It must have a `status` that is either ``IDLE``, ``BUSY``
92+
while the acquisition is acquiring, or ``PREPARED`` state after ``prepare``
93+
is called or data acquisition is paused by `hold`.
94+
95+
Descriptive data `~mod.interface_classes`: ``["AcquisitionController"]``.
96+
97+
It must have a `go` command to start the data acquisition. It is a no-op if
98+
already busy. Data acquisition runs until one of the channels' active
99+
presets is hit or `stop` is called explicitly. Runs the `prepare` sequence
100+
first if module is not already prepared.
101+
102+
Optional commands:
103+
104+
- `prepare`: prepares a data acquisition so that triggering with `go` is
105+
immediate. No-op if already prepared. Cannot be called when busy.
106+
- `hold`: pauses a data acquisition. No-op if not busy. Subsequent
107+
`go` continues the acquisition without clearing currently acquired data.
108+
- `stop`: stops a data acquisition. No-op if not busy. Subsequent `go`
109+
starts a new acquisition with clearing currently acquired data.
110+
111+
An acquisition controller furthermore must have a `~mod.acquisition_channels`
112+
property specifying the channel modules belonging to this controller. The
113+
names of the channel modules are represented as the values of the JSON
114+
object. The role of the channels are represented by the keys and can be
115+
used as such by an ECS.
116+
117+
The key "t" is predefined as a time channel, which basically ends
118+
acquisition when the time indicated by the `goal` parameter of the channel
119+
module is reached.
120+
121+
Example module property of a controller module "controller"::
122+
123+
{"t": "timechannel", "monitor": "monitor_channel"}
124+
125+
The 3 modules "controller", "timechannel" and "monitor_channel" all belong
126+
together.
127+
128+
.. baseclass:: AcquisitionChannel
129+
130+
A module that represents one component of a data acqusition. Multiple
131+
channels can be combined within a controller.
132+
133+
Descriptive data `~mod.interface_classes`: ``["AcquisitionChannel",
134+
"Readable"]``.
135+
136+
It must have a `value` parameter which is interpreted as in `Readable`. If
137+
the hardware allows, this parameter should be readable during the
138+
acquisition and return the current intermediate state. Outside of a data
139+
acquisition, the value MUST stay unchanged and represent the result of the
140+
latest cycle.
141+
142+
It also must have a standard `status` parameter that is ``BUSY`` while the
143+
channel is acquiring.
144+
145+
Optionally, it can have a `goal` parameter. It is a `value` that, when
146+
reached, stops the data acquisition. Depending on the nature of the
147+
acqusition cycle being performed, it may or may not be useful to configure
148+
the acqusition with a `goal`. It can for example represent time for timer
149+
channels, or a certain number of events for event counter channels, or a
150+
desired statistical significance for a channel that represents the
151+
measurement uncertainty. For acquisitions that are configured with several
152+
parameters whose value is unrelated to the main `value` parameter, it is
153+
better to use custom parameters instead.
154+
155+
Furthermore, it can have a ``goal_enable`` parameter. If false, the goal is
156+
ignored and the acquisition does not stop due to this channel. If `goal` is
157+
present but not ``goal_enable``, the goal is always active.
158+
159+
**Optional extension for channels that have "matrix" like values**
160+
161+
- `roi`, an optional parameter: a list containing a ``(min, max)`` tuple
162+
per dimension, to specify a sub-slice of matrix data to consider in
163+
`value` and return in `get_data`.
164+
- `get_data`, an optional command: returns the channel's data, with a
165+
:ref:`matrix <matrix>` data type.
166+
167+
The `value` parameter only contains a useful "reduced" form of the data,
168+
for example, the sum of all events in the matrix, or the average of all
169+
intensity values in a spectrum. If `roi` exists, only the selected
170+
sub-slice of matrix data is considered for this reduction.
171+
172+
.. baseclass:: Acquisition
173+
174+
Combines both AcquisitionController and AcquisitionChannel accessibles into
175+
one interface, for simple devices where only one channel is needed.
176+
177+
Does not have the `~mod.acquisition_channels` property.
178+
179+
Descriptive data `~mod.interface_classes`: ``["Acquisition", "Readable"]``.
180+
181+
60182
.. _features:
61183

62184
Features

protocol/specification/descriptive.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ Optional module properties
351351
Example: ``"secop_psi.ppms.Field"``
352352

353353

354+
Acquisition properties
355+
~~~~~~~~~~~~~~~~~~~~~~
356+
357+
.. mod-property:: acquisition_channels
358+
359+
On an `AcquisitionController`, this specifies the channel modules belonging
360+
to this controller. The names of the channel modules are represented as the
361+
values of the JSON object. The role of the channels are represented by the
362+
keys and can be used as such by an ECS.
363+
364+
354365
.. _accessible-description:
355366

356367
Parameter and command description

protocol/specification/structure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ basic functionality, split into **Interface classes** and **Features**.
4040

4141
Most modules should correspond to one independently measurable physical
4242
quantity and use one of the interface classes `Readable`, `Writable` or
43-
`Drivable`. However, more specialized modules like `Communicator` can be
44-
implemented where appropriate.
43+
`Drivable`. However, more specialized modules like `Communicator` or
44+
`Acquisition` can be implemented where appropriate.
4545

4646
A SEC node controls a set of named modules. Modules are fully specified by
4747
the descriptive data, see :ref:`module-description`.

0 commit comments

Comments
 (0)