Skip to content

Feature: Templates in configuration #443

Description

@kparasch

Description, motivation and use case
I thought harder after the community meeting to try and find a way to simplify configuration. Typically when writing the configuration files, they include devices with highly repeatable config. A "template" could be used to drastically reduce the number of lines in the configuration files.

@TeresiaOlsson @simoneliuzzo @gubaidulinvadim @GamelinAl @gupichon @JeanLucPons
I would very much like your opinion.

Proposed solution
A template in the configuration file can be used to repeat devices.

Example
The idea would be to have something like this in the configuration file:

- class: pyaml.configuration.template.Template
  template: |
    class: pyaml.magnet.hcorrector.HCorrector
    name: %template_parameter%
    model:
      class: pyaml.magnet.linear_model.LinearMagnetModel
      unit: rad
      hardware_unit: str
      calibration_factor: 1.0
      powerconverter: MAGNET/%template_parameter%/B1L
  string_to_replace: "%template_parameter%"
  parameter_list:
    - PKDK_WL_108
    - PKDK_WL_93
    - PKDK_WL_79
    - PKDK_WL_64
- class: pyaml.magnet.hcorrector.HCorrector
  name: ANOTHER
  model:
    class: pyaml.magnet.linear_model.LinearMagnetModel
    unit: rad
    hardware_unit: str
    calibration_factor: 1.0
    powerconverter: MAGNET/ANOTHER/B1L

then this could be expanded when building the storage ring.

Additional context
I have opened a draft PR #442 where I tried to implement something like this. It is definitely not perfect and there are a lot of edge cases that may cause problems.

Checklist

  • I've assigned this issue to a project
  • I've @-mentioned relevant people

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions