ChimeraTK-ControlSystemAdapter-DoocsAdapter
01.12.01
|
The ChimeraTK-ControlSystemAdapter-DoocsAdapter implements the ChimeraTK Control System Adapter for DOOCS.
Prerequisites:
To integrate the application into DOOCS, it has to be linked against the ChimeraTK-ControlSystemAdapter-DoocsAdapter library. Simply use the add_dependency()
cmake macro coming with the ChimeraTK project template, then add ${ChimeraTK-ControlSystemAdapter-DoocsAdapter_LINK_FLAGS}
to the CMAKE_LINK_FLAGS
and ${ChimeraTK-ControlSystemAdapter-DoocsAdapter_LIBRARIES}
to the libraries your executable links against. It is not necessary to change the include path.
In addition, several configuration files have to be provided to your executable at runtime.
Firstly, all DOOCS servers require the usual DOOCS servername.conf
file. A simple example for this file is this:
Replace the RPC number with the number corresponding to your application. You should also change the uid/gid numbers and the name of the server location according to your needs. Finally, you need to have entries for all locations your server should provide. Since the location is a concept which is introduced by DOOCS, the application does not directly define them. Hence, you need to provide a second configuration file which defines how the variable household provided by your application should be mapped to the DOOCS structure.
All locations have the same eq_fct_type
10. As DOOCS will add the properties inside the locations automatically, you do not have to specify them here.
Missing locations will also be added automatically by the adapter, so it is perfectly fine to just have the server location in the config file. Deflaut eq_fct_type
is 10, but you can set a new code
corresponding to eq_fct_type
, see Specify eq_fct_code
in the mapping file.
The mapping of the application variable household on to the DOOCS structure is done with a XML file. The file has to be called applicationName-DoocsVariableConfig.xml
(replace applicationName
with the name of your application).
If this file is omitted, all variables will be exported to DOOCS, with the highest hierarchy level becoming the location name, and the other levels being converted into a dot-separated property name (i.e. /Module2/SubModule3/property7 becomes DOOCS property //Module2/SubModule3.property7).
An example for the mapping file is:
Each location is specified with a location
tag.The location
tag must have one XML attribute:
name
: Specifies the name of the locationIt is possible to specify the eq_fct_code
which must match eq_fct_type
in the configuration file, see Specify eq_fct_code
in the mapping file.
code
: Optional, specifies eq_fct_code
Properties can be specified in each location with the property tag, or in case of special properties like a D_spectrum
with the respective tag. A list of special properties is found in the next section. Each property
tag has the following attributes:
source
: Mandatory, specify the name of the process variablename
: Optional, specify the property name. If omitted, the name is derived from the source name by replacing slashes with dots.As a shortcut, the import
tag can be used to map a large number of properties with a single command. The tag doesn't take any sub-tags but should contain a directory name of process variables, which is to be mapped recursively. If the import
tag is specified inside a location tag, the specified process variable directory is mapped into this location. The import
tag can also appear in the root tag, in which case the first hierarchy level will become the location name. Note that the import will only map variables which have not been mapped before by explicit mapping or other import
tags. This is useful to map a big bulk of automatic mapping variables after picking the special cases, which needs to be mapped individually.
The import
tag can take optionally one attribute:
directory
: Add a prefix to the property names, which is separated with a dot from the rest of the property name.An example with many different automatic mappings is here:
There are a number of configuration parameters which can be set on different scopes to control the exact behaviour of the DOOCS properties. All of the following XML tags can appear either directly in the root tag, or in a location tag, or in a property tag (or any tag for a special property, see Secion Special DOOCS properties).
has_history
: Can be set to false or true (default) If set to true, the properties will have a history, if the property type supports this.is_writeable
: If set to false, the property will be forced to be read-only, even if the process variable is writeable.macro_pulse_number_source
: Name of process variable which contains the macro pusle number which should be attached to the properties.data_matching
: Possible values are none
, exact
. This is relevant when macro pulse number source is given. The default is exact
, which means the server discards data coming in so late that it's version number is overtaken by that of the macro pulse number.persist
: Controls behaviour of DOOCS persistency files. This is only important for writable arrays with more than MAX_CONF_LENGTH entries (usually 20). Possible values are true
(the default) - always save the array, where long arrays are saved in separate files below hist/
while short arrays go into the server config file; false
- do not save the array; auto
- default DOOCS behaviour, only arrays with up to 20 entries are saved, in server config file.DOOCS properties can be published via ZeroMQ so that clients can be notified about updates in real time. To enable this one simply has to specifiy the publish_ZMQ
tag as shown in the following example:
If the macro_pulse_number_source
tag has been used, the macro pulse number will be added to the ZeroMQ header.
If the automatically derived data type of the DOOCS property is not fitting, it is possible to override it using the type
attribute on the property
and D_array tags. type
can be one of
For an example, see above in Section DOOCS adapter mapping file.
Instead of letting the DOOCS adapter automatically decide which DOOCS data type to use, it is possible to specify a particular type. This needs to be done whenever a special DOOCS property type should be used.
The D_spectrum
tag takes the following arguments through sub-tags:
start
: The x-axis start as a fixed numberincrement
: The x-axis increment between two samples as a fixed numberstartSource
: Name of process variable which should be used as x-axis startincrementSource
: Name of process variable which should be used as x-axis incrementnumberOfBuffers
: Create a buffered D_spectrum with a short-term history (so clients can read consistent data across multiple D_spectrum). Requires a configured macro_pulse_number_source.The D_spectrum
tag takes the following arguments through sub-tags:
unit
: A description of the respective axis. The axis is chosen with the axis
property which can either be x
or y
. It can also contain a "start" and an "end" for the initial display parameters as well as "logarithmic" for switching the scale accordingly. For an example of this see D_xyFor an example, see above in Section DOOCS adapter mapping file.
The D_array
tag takes the following arguments through XML attributes of the D_array tag:
type
: Override the data type. Can be one of:For an example, see above in Section DOOCS adapter mapping file.
The D_xy
tag takes the following arguments through properties:
x_source
: Name of process variable which should be used for x-axis valuesy_source
: Name of process variable which should be used for y-axis valuesname
: Name of the mapped property The D_xy
tag takes the following arguments through sub-tags:description
: A description for the XY plotunit
: A description of the respective axis. The axis is chosen with the axis
property which can either be x
or y
The D_ifff
tag takes the following arguments through attributes:
i1_source
: Name of process variable which should be used for first integer valuesf1_source
, f2_source
, f3_source
: Name of process variables which should be used for float valuesname
: Name of the mapped property The four mapped variables must provide data-consistent updates, unless data_matching="none"
is specified.The D_iiii
tag takes the following arguments through attributes:
source
: Name of process variable which should be used for first integer values.name
: Name of the mapped propertyThe D_imagec
(c for compact image) tag takes the following arguments through attributes:
source
: Name of process variable which contains the data as array of unsigned char. Data consists of an image header defined as ChimeraTK::ImgHeader followed by the encoded pixel values.description
: Used as comment for the image, in the meta data.If data_matching="exact"
is set, the provided macropulse number is set as event id in the meta data.
The special tag set_error
is allowed only once per location. XML attributes:
statusCodeSource
: Path to the process variable which should be used for reading error/status codes.DoocsAdapter will automatically look for an associated variable with error/status messages, and if present, read both consistently. Errors indicated via the status variable will be published via DOOCS set_error function (of the location), which sets the properties ERROR, ERROR.STR, STS.ERROR, STS.NEWERROR, and also logs into LOG, LOG.LAST, LOG_HTML and LOG_HTML.LAST. Compare DOOCS documentation for error properties and propagation to the overall error counting per server, SVR.ERROR_COUNT.
It is possible to specify the eq_fct_code
which must match eq_fct_type
in the configuration file with code
in the <location> tag of the mapping file.
If eq_fct_type
is set in the configuration file, code
must have the same number in the mapping file. If the location in the configuration file is missing, you can set your own new code
in the mapping file. But if no code is set, the default code is 10. You can set code
multiple times, but code
must always be consistent. The code
must be integer and > 1, since 1 is reserved for server.
An example configuration file and mapping file with the code specified:
The location DOUBLE
has already the code
10 specified in the configuration file. If you set the code
in the mapping file, it must have 10 as well.
The location CREATED
will be created new with the default code
of 10.
The location NEW
will be created new with code
of 12.
The location FLOAT
is only specifed in the configuration file but will be also created with code
11.