Skip to content

Commit abd8ad6

Browse files
committed
Restructure the spec to three main parts:
- Structure - Protocol - Semantics
1 parent 8dfc1af commit abd8ad6

22 files changed

+808
-938
lines changed
Lines changed: 11 additions & 263 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,17 @@
1-
.. _modules:
1+
Parameters and Commands
2+
=======================
23

3-
Modules
4-
=======
5-
6-
Definition: Module
7-
A named logical component of an abstract view of the equipment.
8-
9-
We intentionally avoid the term "device", which might be misleading, as
10-
"device" is often used for an entire apparatus, like a cryomagnet or
11-
humidity cell. In the context of SECoP, an apparatus in general is composed
12-
of several modules. For example different temperature sensors in one
13-
apparatus are to be seen as different modules.
14-
15-
Most modules should correspond to one independently measurable physical
16-
quantity and use one of the interface classes `Readable`, `Writable` or
17-
`Drivable`. However, more specialized modules like `Communicator` can be
18-
implemented where appropriate.
19-
20-
A SEC node controls a set of named modules. Modules are fully specified by the
21-
descriptive data, see :ref:`module-description`.
22-
23-
.. _accessibles:
4+
A typical module has several accessibles associated with it. An accessible is
5+
addressed by the combination of module and accessible name. There are two basic
6+
types of accessibles: parameters and commands.
247

25-
Accessibles
26-
-----------
8+
Module names have to be unique within an SEC node, accessible names have to be
9+
unique within a module. Module and accessible names should be in English
10+
(incl. acronyms), using only ASCII letters and digits and some additional
11+
characters (see :ref:`naming`). The maximum name length is 63 characters.
2712

28-
A typical module has several accessibles associated with it. An accessible is
29-
addressed by the combination of module and accessible name. Module names have
30-
to be unique within an SEC node, accessible names have to be unique within a
31-
module. There are two basic types of accessibles: parameters and commands.
32-
33-
Module and accessible names should be in English (incl. acronyms), using only
34-
ASCII letters and digits and some additional characters (see :doc:`messages`).
35-
The maximum name length is 63 characters.
36-
37-
Definition: Parameter
38-
A piece of data associated with a module, typically in one of three
39-
categories:
40-
41-
- physical or hardware defined, e.g. `value` or `pid`
42-
- informational, e.g. `status`
43-
- controlling the operation of the module, e.g. `pollinterval`
44-
45-
The main parameter of a module is its value. Writable parameters may
46-
influence the measurement (like PIDs). Additional parameters may give more
47-
information about its state (running, target reached), or details about its
48-
functioning (heater power) for diagnostics purposes. Parameters with a
49-
predefined meaning are listed in the standard, they must always be used in
50-
the same way. Custom parameters are defined by the implementation of the
51-
SEC node and their name must start with an underscore. The ECS can use
52-
unknown parameters only in a generic way, as their meaning is not known.
53-
54-
Definition: Command
55-
Commands are provided to initiate specified actions of the module.
56-
They should generate an appropriate reply immediately after that action is
57-
initiated, i.e. should not wait until some other state is reached.
58-
59-
However, if the command triggers side-effects, they MUST be communicated
60-
before the reply is sent. Commands may use an possibly structured argument
61-
and may return a possibly structured result. Commands with a predefined
62-
meaning are listed in the standard, they must always be used in the same
63-
way. Custom commands are defined by the implementation of the SEC node, the
64-
ECS can use them only in a general way, as their meaning is not known.
65-
66-
The following section describes the currently predefined accessibles, this list
67-
will be extended continuously.
13+
The following section describes the currently predefined parameters and
14+
commands. This list will be extended continuously in new SECoP versions.
6815

6916

7017
Basic Parameters
@@ -432,202 +379,3 @@ Communication
432379
:ref:`string <string>`, or any other datatype suitable to the protocol of the device.
433380
The `communicate` command is meant to be used in modules with the
434381
`Communicator` interface class.
435-
436-
437-
.. _properties:
438-
439-
Properties
440-
----------
441-
442-
Definition: Properties
443-
The static information about parameters, modules and SEC nodes is
444-
constructed from properties with predefined names and meanings.
445-
446-
For a list of pre-defined properties see :ref:`descriptive-data`.
447-
448-
449-
.. _prop-data-report:
450-
451-
Data report
452-
-----------
453-
454-
A JSON array with the value of a parameter as its first element, and a JSON
455-
object containing the Qualifiers_ for this value as its second element.
456-
457-
See also: :ref:`the syntax <data-report>`.
458-
459-
.. note:: Future revisions may add additional elements. These are to be ignored
460-
for implementations of the current specification.
461-
462-
463-
.. _prop-error-report:
464-
465-
Error report
466-
------------
467-
468-
An error report is used in an :ref:`error-reply` indicating that the requested
469-
action could not be performed as request or that other problems occurred. The
470-
error report is a JSON array containing the name of one of the :ref:`Error
471-
classes <error-classes>`, a human readable string and as a third element a
472-
JSON-object containing extra error information, which may include the timestamp
473-
(as key "t") and possible additional implementation specific information about
474-
the error (stack dump etc.).
475-
476-
See also :ref:`the syntax <error-report>`.
477-
478-
479-
Structure report
480-
----------------
481-
482-
The structure report is a structured JSON construct describing the structure of
483-
the SEC node. This includes the SEC node properties, the modules, their
484-
module-properties and accessibles and the properties of the accessibles. For
485-
details see :ref:`descriptive-data`.
486-
487-
488-
.. _value:
489-
490-
Value
491-
-----
492-
493-
Values are transferred as a JSON value.
494-
495-
.. admonition:: Programming Hint
496-
497-
Some JSON libraries do not allow all JSON values in their (de-)serialization
498-
functions. Whether or not a JSON value is a valid JSON text, is
499-
controversial, see this `stackoverflow issue
500-
<https://stackoverflow.com/questions/19569221>`_ and :rfc:`8259`.
501-
502-
(clarification: a *JSON document* is either a *JSON object* or a *JSON
503-
array*, a *JSON value* is any of a *JSON object*, *JSON array*, *JSON
504-
number* or *JSON string*.)
505-
506-
If an implementation uses a library which can not (de-)serialize all JSON
507-
values, the implementation can add square brackets around a JSON value,
508-
decode it and take the first element of the result. When encoding, the
509-
reverse action might be used as a workaround. See also :RFC:`7493`.
510-
511-
512-
.. _qualifiers:
513-
514-
Qualifiers
515-
----------
516-
517-
Qualifiers optionally augment the value in a reply from the SEC node, and
518-
present variable information about that parameter. They are collected as named
519-
values in a JSON object.
520-
521-
Currently 2 qualifiers are defined:
522-
523-
.. describe:: "t"
524-
525-
The timestamp when the parameter has changed or was verified/measured (when
526-
no timestamp is given, the ECS may use the arrival time of the update
527-
message as the timestamp). It SHOULD be given, if the SEC node has a
528-
synchronized time. The format is that of a UNIX time stamp, i.e. seconds
529-
since 1970-01-01T00:00:00+00:00Z, represented as a number, in general a
530-
floating point when the resolution is better than 1 second.
531-
532-
.. note:: To check if a SEC node supports time stamping, a `ping` request
533-
can be sent.
534-
535-
.. describe:: "e"
536-
537-
The uncertainty of the quantity. MUST be in the same units as the value.
538-
So far the interpretation of "e" is not fixed (sigma vs. RMS difference
539-
vs. other possibilities).
540-
541-
Other qualifiers might be added later to the standard. If an unknown element is
542-
encountered, it is to be ignored.
543-
544-
545-
.. _interface-classes:
546-
547-
Interface Classes
548-
-----------------
549-
550-
Interface classes let the ECS determine the functionality of a module from its
551-
class or classes.
552-
553-
The standard contains a list of classes, and a specification of the
554-
functionality for each of them. The list might be extended over time. Already
555-
specified base classes may be extended in later releases of the specification,
556-
but earlier definitions will stay intact, i.e. no removals or redefinitions will
557-
occur.
558-
559-
The module class is in fact a list of classes (highest level class first) and is
560-
stored in the module-property `interface_classes`. The ECS chooses the first
561-
class from the list which is known to it. The last one in the list must be one
562-
of the base classes listed below.
563-
564-
.. admonition:: Remark
565-
566-
The list may also be empty, indicating that the module in question does not
567-
even conform to the Readable class.
568-
569-
570-
Base classes
571-
~~~~~~~~~~~~
572-
573-
.. baseclass:: Communicator
574-
575-
The main purpose of the module is communication. It may have none of the
576-
predefined parameters of the other classes.
577-
578-
The `communicate` command should be used mainly for debugging reasons, or
579-
as a workaround for using hardware functionalities not implemented in the
580-
SEC node.
581-
582-
.. baseclass:: Readable
583-
584-
The main purpose is to represent readable values (i.e. from a Sensor).
585-
It has at least a `value` and a `status` parameter.
586-
587-
.. baseclass:: Writable
588-
589-
The main purpose is to represent fast settable values (i.e. a switch).
590-
It must have a `target` parameter in addition to what a `Readable` has.
591-
It does not have a `stop` command. A module which needs time to reach
592-
the target but cannot be stopped has also to be represented as a `Writable`,
593-
with a `BUSY` item (code 300...389) in the status enum.
594-
595-
.. baseclass:: Drivable
596-
597-
The main purpose is to represent slow settable values (i.e. a temperature or
598-
a motorized needle valve). It must have a `stop` command in addition to
599-
what a `Writable` has. Note that in case the `stop` command has no
600-
effect, a `Writable` SHOULD be used. Also, the `status` parameter will
601-
indicate a BUSY state for a longer lasting operations.
602-
603-
604-
.. _features:
605-
606-
Features
607-
~~~~~~~~
608-
609-
Features allow the ECS to detect if a SECoP module supports a certain
610-
functionality. A feature typically needs some predefined accessibles and/or
611-
module properties to be present. However, it is not only a list of mandatory or
612-
optional accessibles, but indicates to the ECS that it may handle this
613-
functionality in a specific way.
614-
615-
.. feature:: HasOffset
616-
617-
This feature indicates that the `value` and `target` parameters of a
618-
module represent raw values, which need to be corrected by an offset. A
619-
module with the feature `HasOffset` must have a parameter `offset`,
620-
which indicates to all clients that the transmitted raw values for the
621-
parameters `value` and `target` are to be converted to corrected values
622-
(at the client side) by the following formulas:
623-
624-
For reading the parameters `value` and `target`:
625-
626-
| corrected value (client) = value (transmitted) + offset
627-
| corrected target (client) = target (transmitted) + offset
628-
629-
For changing the parameter `target`:
630-
631-
| target (transmitted) = corrected target (client) - offset
632-
633-
Mandatory parameter: `offset`
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Additional Topics
2+
=================
3+
4+
.. toctree::
5+
6+
security
7+
future

protocol/specification/classes.rst

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.. _interface-classes:
2+
3+
Interface Classes
4+
=================
5+
6+
Interface classes let the ECS determine the functionality of a module from its
7+
class or classes.
8+
9+
The standard contains a list of classes, and a specification of the
10+
functionality for each of them. The list might be extended over time. Already
11+
specified base classes may be extended in later releases of the specification,
12+
but earlier definitions will stay intact, i.e. no removals or redefinitions will
13+
occur.
14+
15+
The module class is in fact a list of classes (highest level class first) and is
16+
stored in the module-property `interface_classes`. The ECS chooses the first
17+
class from the list which is known to it. The last one in the list must be one
18+
of the base classes listed below.
19+
20+
.. admonition:: Remark
21+
22+
The list may also be empty, indicating that the module in question does not
23+
even conform to the Readable class.
24+
25+
26+
Base Classes
27+
------------
28+
29+
.. baseclass:: Communicator
30+
31+
The main purpose of the module is communication. It may have none of the
32+
predefined parameters of the other classes.
33+
34+
The `communicate` command should be used mainly for debugging reasons, or
35+
as a workaround for using hardware functionalities not implemented in the
36+
SEC node.
37+
38+
.. baseclass:: Readable
39+
40+
The main purpose is to represent readable values (i.e. from a Sensor).
41+
It has at least a `value` and a `status` parameter.
42+
43+
.. baseclass:: Writable
44+
45+
The main purpose is to represent fast settable values (i.e. a switch).
46+
It must have a `target` parameter in addition to what a `Readable` has.
47+
It does not have a `stop` command. A module which needs time to reach
48+
the target but cannot be stopped has also to be represented as a `Writable`,
49+
with a `BUSY` item (code 300...389) in the status enum.
50+
51+
.. baseclass:: Drivable
52+
53+
The main purpose is to represent slow settable values (i.e. a temperature or
54+
a motorized needle valve). It must have a `stop` command in addition to
55+
what a `Writable` has. Note that in case the `stop` command has no
56+
effect, a `Writable` SHOULD be used. Also, the `status` parameter will
57+
indicate a BUSY state for a longer lasting operations.
58+
59+
60+
.. _features:
61+
62+
Features
63+
--------
64+
65+
Features allow the ECS to detect if a SECoP module supports a certain
66+
functionality. A feature typically needs some predefined parameters, commands
67+
and/or module properties to be present. However, it is not only a list of
68+
mandatory or optional elements, but also indicates to the ECS that it may handle
69+
this functionality in a specific way.
70+
71+
.. feature:: HasOffset
72+
73+
This feature indicates that the `value` and `target` parameters of a
74+
module represent raw values, which need to be corrected by an offset. A
75+
module with the feature `HasOffset` must have a parameter `offset`,
76+
which indicates to all clients that the transmitted raw values for the
77+
parameters `value` and `target` are to be converted to corrected values
78+
(at the client side) by the following formulas:
79+
80+
For reading the parameters `value` and `target`:
81+
82+
| corrected value (client) = value (transmitted) + offset
83+
| corrected target (client) = target (transmitted) + offset
84+
85+
For changing the parameter `target`:
86+
87+
| target (transmitted) = corrected target (client) - offset
88+
89+
Mandatory parameter: `offset`

0 commit comments

Comments
 (0)