Replies: 13 comments 29 replies
-
|
I do not see in this scheme how to handle magnet model that does not have a 1 to 1 relationship. |
Beta Was this translation helpful? Give feedback.
-
|
We expect unique name in PyAML, so may be ? control-system-catalog:
type: pyaml.common.catalog
refs:
- reference: mySeriesOfMagnets
devices:
- type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch1/current
unit: A
- reference: QF1E-C04
devices:
- type: tango.pyaml.attribute
attribute: srmag/vps-qf1/c04-e/current
unit: A
- reference: SH1A-C01 # Reference refers to PyAML elements
devices:
- type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch1/strength
unit: rad
- type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch2/strength
unit: rad
- type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch3/strength
unit: m-1 |
Beta Was this translation helpful? Give feedback.
-
|
One advantage of the idea I propose is that if you don’t want to use the control system, you just have to delete the section (or the reference to the file it points to). |
Beta Was this translation helpful? Give feedback.
-
|
It seems OK to me. |
Beta Was this translation helpful? Give feedback.
-
|
May be: control-system-catalog:
type: pyaml.configuration.catalog # instead of common
refs: |
Beta Was this translation helpful? Give feedback.
-
|
I would like to have the opinion of others on this subject. @TeresiaOlsson, @gubaidulinvadim for instance ? |
Beta Was this translation helpful? Give feedback.
-
|
Additionally, we should be able to retrieve string values from the control system for metadata and potential future checks (machine mode, etc.) |
Beta Was this translation helpful? Give feedback.
-
|
For this implementation please start with only one single object (BPM for instance) otherwise the code review will be almost impossible. |
Beta Was this translation helpful? Give feedback.
-
|
I need to think a bit about this. For us pyAML is primarily an interface to the control system and in second hand an interface to a simulator so for us we might rather want to be able to skip the parts about the simulator when it's not needed. But I guess that is doable in a similar way as you suggest to separate out the information connected to the control system? |
Beta Was this translation helpful? Give feedback.
-
|
What does this mean for when objects for devices should be created? If there is a catalog I imagine that users don't only want to read the info in there but also change it after the config has been loaded. We do that sometimes in MML when we need to temporarily change a value and don't want to make a permanent change to the config. How would a change in the catalog be propagated everywhere? I had before the suggestion that devices shouldn't be created directly when loading the config but only when the user needs them to allow dynamically changing the config. But that would still make the device static after it has been created. Now I'm thinking that if there is a catalog, maybe an option is that a device is always reading from there and doesn't contain any data itself? So if you change the config of a device you are actually changing the data in the catalog? I would say the AcceleratorObject in MML works like that to always keep a single source of truth. To me it looks like the catalog you suggest is pretty much the MML AO except that the AO also contains the values for the simulator and the arrays. It is a catalog of all device related data. |
Beta Was this translation helpful? Give feedback.
-
|
@gupichon I think your proposal is solid. It would be good to have a draft PR with just an example for a simple (BPM) or a more complex object (combined function magnet) just like @JeanLucPons suggested. |
Beta Was this translation helpful? Give feedback.
-
|
I agree. - type: pyaml.bpm.bpm
name: BPM_C01-01
model:
type: pyaml.bpm.bpm_tiltoffset_model
x_pos:
type: tango.pyaml.attribute_read_only
attribute: srdiag/bpm/c01-01/SA_HPosition
unit: mm
y_pos:
type: tango.pyaml.attribute_read_only
attribute: srdiag/bpm/c01-01/SA_VPosition
unit: mmSoemthing like: ? control-system-catalog:
type: pyaml.common.catalog
refs:
- reference: BPM_C01-01
x_pos_devices:
type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch1/current
unit: mm
y_pos_devices:
type: tango.pyaml.attribute
attribute: srmag/ps-corr-sh1/c01-a-ch1/current
unit: mmWhen offset and tilt are there ? |
Beta Was this translation helpful? Give feedback.
-
|
I think to something like this to get the catalog config in the BPM model module. PYAMLCLASS = "BPMSimpleModel"
class CatalogModel(BaseModel):
"""
Configuration model for BPM devices
Parameters
----------
reference: str
Name of the BPM element
x_pos : DeviceAccess
Horizontal position device
y_pos : DeviceAccess
Vertical position device
"""
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
reference: str
x_pos: DeviceAccess
y_pos: DeviceAccess
class ConfigModel(BaseModel):
"""
Configuration model for BPM simple model
x_pos_index : int, optional
Index in the array when specified, otherwise scalar
value is expected
y_pos_index : int, optional
Index in the array when specified, otherwise scalar
value is expected
"""
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
x_pos_index: int | None = None
y_pos_index: int | None = None |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Introducing a Value Catalog in pyAML
As discussed during the workshop, I would like to propose a new concept in pyAML: a catalog of values.
Motivation
Today, control-system references (Tango attributes, strings, metadata, etc.) are spread across device and model definitions. This makes configurations harder to read, maintain, and reuse.
The proposed value catalog addresses this by centralizing and formalizing how such values are defined and accessed.
Objectives
The main goals of this proposal are:
Proposed Configuration Structure
With this approach, device and model definitions remain focused on physics and behavior, while all control-system bindings are moved to dedicated catalogs.
A possible configuration would look like this:
Control-System Catalog
All control-system bindings are moved into a dedicated catalog:
User-Defined Data Catalog
The same mechanism can also be used for global values that are not tied to a specific pyaml model:
Key Properties of the Catalog
All catalog entries are identified by a key (
reference).Any value can be retrieved anywhere in pyAML using:
Catalog entries are first-class objects and can be:
Open Design Questions
This proposal raises important points that need further discussion:
In other words, how do we clearly define which values a model expects and how it resolves them from the catalog?
Beta Was this translation helpful? Give feedback.
All reactions