46 adding catalogs section in the pyaml configuration file#192
46 adding catalogs section in the pyaml configuration file#192
Conversation
|
As previoulsy discussed, it would be nice, in order to minimize impact, and allow evolution of BPM model that you restore the DeviceAccess ref in the model and change: if catalog.has_reference(name + "/tilt"):
return catalog.get_one(name + "/tilt")to if catalog.has_reference(name + "/" + self._cfg.tilt):
return catalog.get_one(name + "/" + self._cfg.tilt)and same for positions and offsets. And i expect possible individual position and offset, so |
Do you mean having x_offset and y_offset, x_pos and y_pos, and so on? |
|
I've created the draft pull request, it will be easier to discuss here than under a commit. |
|
Yes but as string so we can use the catalog. |
…ction-in-the-pyaml-configuration-file
|
Thanks x_pos: str | None = None
y_pos: str | None = None |
Since the existence of available_axes: list[str] = ["x", "y"]
x_pos: str = "x_pos"
x_pos: str = "x_pos" |
|
If you configure only x_pos the you have only x, no need of an extra flag. |
|
No, I just want to make the file shorter and more readable. |
|
It would look like: devices:
- type: pyaml.bpm.bpm
name: BPM_C01-01
model:
type: pyaml.bpm.bpm_tiltoffset_model
- type: pyaml.bpm.bpm
name: BPM_C01-02
model:
type: pyaml.bpm.bpm_simple_model
available_axes: [x] |
|
For me this is counter intuitive because i don't know what to put in the catalog. Honestly I really would prefer to have a simple string in the the x_pos attribute that directly refers to the catalog even independently of the name of the PyAML top level object. |
|
As you wish then |
|
At this end i would like to be able to do: - type: pyaml.bpm.bpm
name: BPM_C21-09
model:
type: pyaml.bpm.bpm_simple_model
x_pos: srdiag/bpm/c21-09/SA_HPosition
y_pos: srdiag/bpm/c21-09/SA_VPosition
x_offset: srdiag/bpm/c21-09/HOffset
y_offset: srdiag/bpm/c21-09/VOffsetand later: - type: pyaml.bpm.bpm
name: BPM_C21-09
model:
type: pyaml.bpm.bpm_simple_model
x_pos: srdiag/bpm/c21-09/SA_HPosition
y_pos: srdiag/bpm/c21-09/SA_VPosition
x_offset: srdiag/bpm/c21-09/HOffset
y_offset: srdiag/bpm/c21-09/VOffset
incoherency: srdiag/bpm/c21-09/Incoherencyor - type: pyaml.bpm.bpm
name: BPM_C21-09
model:
type: pyaml.bpm.bpm_button_model
va: srdiag/bpm/c21-09/SA_VA
vb: srdiag/bpm/c21-09/SA_VB
vc: srdiag/bpm/c21-09/SA_VC
vd: srdiag/bpm/c21-09/SA_DC
K: [1.001,0.9956,1.019287,1.0021]Then |
|
Actually, this can already work. We can develop a specific Tango catalog that builds the |
|
You can even go further and have the control system register itself in the catalog. Such a catalog could then check the Tango database to see whether a device exists, fetch its units, and so on. In that case, you would not even need to list the devices anymore. |
…ction-in-the-pyaml-configuration-file
This is not really the goal, you have still in your catalog all the configuration of your underlying device which can be Epics or Tango. I recall that, for instance, the type is needed with pyaml-cs-oa. For the time being pyaml-cs-oa assumes that all control system variables are Float64 or Float64 array. We don't have this issue with native Tango backend (this is why attach_array() and attach() have the same implementation in native Tango backend). Last but not least for a RW variable, in Epics you have 2 underlying PV. For x_pos, i expect a random string that will refer to one RO Tango attribute or Epics PV. I like the idea of this Catalog. You have just a simple string for your device config at the Element (or Model) level. |
|
If it's ok for you I continue with the rest of pyaml. |
|
You already rewrote and tested the examples ? |
def get_offset_devices(
self, name: str, catalog: Catalog
) -> list[DeviceAccess | None]:I don't understand why the name is needed there ? |
|
Rougly speking, i expect:
def get_pos_devices(self, name: str, catalog: Catalog) -> list[DeviceAccess | None]:becomes as before (except that it will returns str): def get_pos_devices(self) -> list[str| None]:The creation of And This PR should only address BPM with working examples. |
Because the model does not know the name of the BPM. |
Yes. It was not so much work, I scripted the modifications for |
|
I have introduced the possibility of creating a sub-catalog from the main catalog in order to work with a smaller subset and avoid conflicts when using a pattern to retrieve elements. |
|
@JeanLucPons I believe I have covered all your requirements. I’ll let you check when you’re back. |
- type: pyaml.bpm.bpm
name: BPM_C05-01
model:
type: pyaml.bpm.bpm_simple_model
x_pos: x_pos
y_pos: y_pos
- type: pyaml.bpm.bpm
name: BPM_C05-02
model:
type: pyaml.bpm.bpm_simple_model
x_pos: x_pos
y_pos: y_posHow this can work ? |
|
It expects the following entries to be present in the catalog:
Otherwise, a |
|
If you agree with the principle, I will work on examples and so on. This PR is still a draft. |
|
@JeanLucPons, thinking about what you wanted to do: - type: pyaml.bpm.bpm
name: BPM_C21-09
model:
type: pyaml.bpm.bpm_button_model
va: srdiag/bpm/c21-09/SA_VA
vb: srdiag/bpm/c21-09/SA_VB
vc: srdiag/bpm/c21-09/SA_VC
vd: srdiag/bpm/c21-09/SA_DC
K: [1.001, 0.9956, 1.019287, 1.0021]I need to modify this; otherwise, it will look for entries like Nevertheless, I have added the possibility to retrieve a sub-catalog by filtering with a pattern. This way, you can request all entries starting with |
Yes this is what I want and it has been discussed like that, no ? - type: pyaml.bpm.bpm
name: BPM_C21-09
model:
type: pyaml.bpm.bpm_button_model
va: srdiag/bpm/c21-09/SA_VA
vb: srdiag/bpm/c21-09/SA_VB
vc: srdiag/bpm/c21-09/SA_VC
vd: srdiag/bpm/c21-09/SA_DC
K: [1.001, 0.9956, 1.019287, 1.0021]`Yes I would like to have this and that the catalog entry is |
No, it was not. Since the very first discussion, I proposed that the model should handle the key it needs. You asked to move it to the control system, which I did. Now, do you prefer using a single unique key with no key building performed by any system? I’m fine with that, but I would like this to be clearly expressed. |
|
Sorry for misunderstanding. The user should be free to use what he wants for reference and, as you proposed, you can build your own syntax and implements a custom catalog as the catalog follows the PyAML configuration standard. It could be useful, for a specific control system, to overpass all the DeviceAccess configuration and do it dynamically using Tango DB. Such a custom catalog can be implemented the Tango backend. |
|
It is done. |
…ction-in-the-pyaml-configuration-file
|
It fails with BPM aggregator. for b in bpms:
devs = self.attach_array(b.model.get_pos_devices())
devH = devs[0]I'm investigating, i observed a strange issue. |
|
I added unit test for BPM aggregators |
positions_device = self._catalog.get_one(b.model.get_positions_device())
devs = self.attach_array([positions_device, positions_device])It is unclear for me, get_positions_device() should be get_position_devices() and return an array of x and y pos device that can be different (and None when not defined). |
|
I’ve implemented a quick fix here, but things are still unclear to me.
Initially, I was thinking of letting the |
|
Rougly speaking you can do something like: dx = self._catalog.get_one(b.model.get_x_pos_device())
dy = self._catalog.get_one(b.model.get_y_pos_device())
devs = self.attach_array([dx, dy])dx can be equal to dy when you have an attribute that returns the 2 orbits (H&V) as in the BESSY2 example. |
|
ok. |
…the same value instead.
|
Ok, I made the changes. |
Description
All references to the control system are moved to a catalog section.
Related Issue
Features/issues described there are:
Changes to existing functionality
Describe the changes that had to be made to an existing functionality (if they were made)
Testing
The following tests (compatible with pytest) were added:
Verify that your checklist complies with the project