-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds support for configuring commands and channels using YAML #1034
base: xml_yaml_conversion
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff.
A first review pass, a first batch of comments and improvement suggestions.
docs/source/dev/commands_channels.md
Outdated
| property | purpose | default | | ||
|-----------|-----------------------------------|---------------------| | ||
| attribute | tango attribute name | MXCuBE channel name | | ||
| poll | polling periodicity, milliseconds | polling is disabled | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| poll | polling periodicity, milliseconds | polling is disabled | | |
| polling_period | polling periodicity, milliseconds | polling is disabled | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to polling_period
docs/source/dev/commands_channels.md
Outdated
|
||
The mxcubecore provides a hardware object-level abstraction | ||
for communicating using various flavors of control system protocols. | ||
A hardware object can utilize instances of `Command` and `Channel` objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the documentation for the actual classes, please.
(I always forget how to do it, look up the Myst doc: https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html).
Also isn't it mxcubecore.CommandContainer.ChannelObject
and mxcubecore.CommandContainer.CommandObject
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's mxcubecore.CommandContainer.ChannelObject
and mxcubecore.CommandContainer.ChannelObject
. Added links to API docs for these objects.
docs/source/dev/commands_channels.md
Outdated
for communicating using various flavors of control system protocols. | ||
A hardware object can utilize instances of `Command` and `Channel` objects. | ||
These objects provide a uniform API for accessing a specific control system. | ||
Mxcubecore provides support for using protocols such as _tango_, _EPICS_, _exporter_ and more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links, links, links! Documentation should have lots of links. Typically the first occurrence of every term should have a link to its definition.
Mxcubecore provides support for using protocols such as _tango_, _EPICS_, _exporter_ and more. | |
Mxcubecore provides support for using protocols such as [_tango_](https://pytango.readthedocs.io/), _EPICS_, _exporter_ and more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.epics-controls.org/en/latest/ for the official EPICS docs (that is being reworked now as far as I know, but at least it's not the APS website from the 80's anymore 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added links to Tango and EPICS web sites.
docs/source/dev/commands_channels.md
Outdated
The general format for specifying `Command` and `Channel` objects is as follows: | ||
|
||
```yaml | ||
class: MegaCommunicator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep consistent with the rest of the example:
class: MegaCommunicator | |
class: <hardware-object-class> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
docs/source/dev/commands_channels.md
Outdated
The format for specifying _tango_ `Command` and `Channel` objects is as follows: | ||
|
||
```yaml | ||
class: TangoCommunicator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class: TangoCommunicator | |
class: <hardware-object-class> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
mxcubecore/model/protocols/epics.py
Outdated
""" | ||
an EPICS channel configuration | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
an EPICS channel configuration | |
""" | |
"""EPICS channel configuration.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reluctantly changed!
mxcubecore/model/protocols/epics.py
Outdated
""" | ||
Models the `epics` section of YAML hardware configuration file. | ||
Provides an API to read configured EPICS channels. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
Models the `epics` section of YAML hardware configuration file. | |
Provides an API to read configured EPICS channels. | |
""" | |
"""Models for the `epics` section of YAML hardware configuration file. | |
Provides an API to read configured EPICS channels. | |
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stupid google!
mxcubecore/model/protocols/tango.py
Outdated
""" | ||
get all tango devices specified in this section | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
get all tango devices specified in this section | |
""" | |
"""Get all Tango devices specified in this section.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | ||
add the Command and Channel objects configured in the specified protocol section | ||
|
||
parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the sections are case-sensitive.
parameters: | |
Parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/source/dev/commands_channels.md
Outdated
```yaml | ||
class: EpicsCommunicator | ||
epics: | ||
"FOO:B:x1.": | ||
channels: | ||
State: | ||
suffix: stat | ||
Vol: | ||
``` | ||
|
||
We have an `FOO:B:x1.` prefix specified, with two `Channel` objects `State` and `Vol`. | ||
`State` will use `FOO:B:x1.stat` PV name, specified by section's prefix and the `suffix` configuration property. | ||
`Vol` will use `FOO:B:x1.Vol` PV name, specified by section's prefix and channels MXCuBE name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I think this might be a bit problematic, because the modeling of PV is usually $(PREFIX):$(DEVICE).$(PROPERTY)
, so one record - or PV - ( $(PREFIX):$(DEVICE)
) will have multiple properties, for example an analog out has, .DESC (description), .VAL (value), .ASLO (slope).
But in this case that you're modelling it is way more likely that this will be separated into multiple PVs, so you'd likely have:
class: EpicsCommunicator
epics:
"FOO:B:":
channels:
State:
suffix: pv_1.STAT
Vol:
suffix: volume.VAL
In the end I think the code will handle just fine if you're just appending, but the prefix is only the part before teh last colon (in most naming conventions of EPICS that I've seen)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I am understanding you correctly, but would #1023 (comment) answer your question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's pretty much it.
It's just the non-obvious separation between PV/record and properties in EPICS that is a bit weird for modelling, but the simple concatenation should handle all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elmjag I think it is worth modifying the epics example to show a more complex and complete example, that shows how to combine all those things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this example make things more clear?
class: EpicsCommunicator
epics:
"FOO:B:":
channels:
State:
suffix: pv_1.STAT
Vol:
suffix: volume.VAL
Freq:
Regarding Freq
channel, I want to include an example channel, without the optional config property suffix
.
This way, it's possible to link to generated API documentation for CommandContainer and ChannelObject classes. Without this change, sphix refuses to create a link for CommandContainer and ChannelObject classes, from other section of the documentation.
a7bf566
to
617b67a
Compare
Adds a section the describes how to configure hardware object's commands and channels using YAML configuration files. Documents the format for Tango, exporter and EPICS protocols.
Adds support for 'tango', 'exporter' and 'epics' sections to YAML configuration files. These section are used to configure Command and Channel objects for hardware objects.
617b67a
to
138f62e
Compare
Adds support for configuring commands and channels using YAML. Currently it's possible to configure
Tango
,exporter
andEPICS
commands and channels.This implements roughly the format discussed in: #1023
The actual format implement is documented here: https://mxcubecore--1034.org.readthedocs.build/en/1034/dev/commands_channels.html
This is still work in progress. Still on the todo list:
I would like to get some feedback, before spending more time on this.