epics-containers / ibek

IOC Builder for EPICS and Kubernetes
https://epics-containers.github.io/ibek
Apache License 2.0
10 stars 4 forks source link

the following yaml does not generate PVs for motorsim #199

Closed amichelotti closed 3 months ago

amichelotti commented 3 months ago

Hi try running the ioc with the following ibek descriptions:

ioc_name: yag-screens
description: Yag Screens Simulated 

entities:

  - type: motorSim.simMotorController
    controllerName: SCN01CTRL
    P: LEL-DIA-SCN
    numAxes: 6

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "01:MOT01:"
    DESC: "Axis"
    ADDR: 0
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "02:MOT01:"
    ADDR: 1
    DESC: "Axis"
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "03:MOT01:"
    ADDR: 2
    DESC: "Axis"
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "04:MOT01:"
    DESC: "Axis"
    ADDR: 3
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "05:MOT01:"
    DESC: "Axis"
    ADDR: 4
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: motorSim.simMotorAxis
    controller: SCN01CTRL
    M: "06:MOT01:"
    DESC: "Axis"
    ADDR: 5
    DLLM: -20000
    DHLM: 20000
    home: 20000
    start: 20000
    DIR: Neg

  - type: ADSimDetector.simDetector
    PORT: SCN01CAM
    P: LEL-DIA-SCN01
    R: ":CAM01:"
  - type: ADSimDetector.simDetector
    PORT: SCN02CAM
    P: LEL-DIA-SCN02
    R: ":CAM01:"
  - type: ADSimDetector.simDetector
    PORT: SCN03CAM
    P: LEL-DIA-SCN03
    R: ":CAM01:"
  - type: ADSimDetector.simDetector
    PORT: SCN04CAM
    P: LEL-DIA-SCN04
    R: ":CAM01:"
  - type: ADSimDetector.simDetector
    PORT: SCN05CAM
    P: LEL-DIA-SCN05
    R: ":CAM01:"
  - type: ADSimDetector.simDetector
    PORT: SCN06CAM
    P: LEL-DIA-SCN06
    R: ":CAM01:"

Motors PV are not created (just cams). If I comment cams the PV are partially created. Where am I wrong?

gilesknap commented 3 months ago

Hi @amichelotti You did not show your values.yaml which says which generic IOC you are using. I assume you have selected ioc-adsimdetector.

At present there is a Generic IOC for simdetectors and another for simmotors. So therefore you cannot mix the two entity types in a single IOC instance.

This is intentional.

In kubernetes it makes sense to have fine grained IOC instances and let the cluster manage the many small services that this implies. That way when you take a single camera offline you can stop the one IOC that talks to it and not get errors that you would if you had one ioc managing all of your cameras.

You can choose to ignore that and instantiate many cameras in a single IOC.

But you cannot also instantiate motors in that IOC.

If you really needed motors and cameras in one IOC then you could build your own generic IOC that adds the support for both devices. But if you continue down that route you would need a new Generic IOC per combination of devices you want. This creates an overhead of managing many images.

An important part of the Generic IOC concept is that we can use it to build an image only occasionally - once for each class of device we have. We then deploy many IOC instances that use that image - one per physical device instance.

I hope this makes sense. Do you think this model can work for your facility?

gilesknap commented 3 months ago

One thing that confuses me is why you did not get errors deploying that yaml. In theory the ioc-adsimdetector GIOC should not accept the motorSim.simMotorAxis entities. Can you share your beamline repo for me to look at please?

amichelotti commented 3 months ago

Hello Giles, yes it makes sense to me. However I'm prototyping and testing so to speedup my development cycles I've built a "big" container with many supports in it. This is the repo https://baltig.infn.it/epics-containers/infn-epics-ioc.git. I tested it just running: docker run -it -v .:/epics/ioc/config baltig.infn.it:4567/epics-containers/infn-epics-ioc:1.0 in the directory where I have the ioc.yaml. Thanks for your support!

gilesknap commented 3 months ago

OK that makes sense!

In that case I would assume there is an issue in the support.yaml for motorsim that you are using. Unlike on github, I can't follow the ibek-support submodule to see what you have.

At the moment I've just pushed up the next set of breaking changes and am updating the docs to match. I intend for this to be the last set of breaking changes for a good while as I now have all of the framework ready to build my first complete beamline. See https://epics-containers.github.io/3.4.0b1/explanations/changes.html :-)

The best way for me to look at your ioc would be to fork it and apply the latest changes, then look into your issue (using the latest ibek-support because that has breaking changes from the ibek CLI)

Then I would pull request a working version back to you.

Not sure how to do that with your internal git server - please advise.

amichelotti commented 3 months ago

Hi Giles, my ibek-support should be accessible freely on github https://github.com/amichelotti/ibek-support/tree/main. I saw that I was behind so I aligned to yours, but now the build of my 'big' image is broken because:

48.82 Usage: ibek support [OPTIONS] COMMAND [ARGS]...
48.82 Try 'ibek support --help' for help.
48.82 
48.82 Error: No such command 'add-runtime-packages'.

by adding >>> RUN ADCore/install.sh R3-13

Probably ibek 1.7.1 is not enough to be aligned with latest changes.

gilesknap commented 3 months ago

That is why I wanted to do the updates for you. I've updated the ibek API so ibek-support is broken unless you update to ibek 2.0.1.

gilesknap commented 3 months ago

We have moved to using copier templates for making Generic IOCs and beamline repos. That way it becomes much easier to adopt updates to the framework in a controlled fashion.

Trouble is I'm just doing the docs for that now!

They should be ready by the end of today and I'll drop you a link on how to update your GIOC.

amichelotti commented 3 months ago

Thanks!, I updated ibek-support and ioc-template to ibek version 2.0.1. And the problem disappeared. I saw the interface of motorsim is updated. Is there any place where I can see some use/examples of these supports and also the interesting pvi tool?

gilesknap commented 3 months ago

That is good to hear. There were a few other breaking changes in the latest updates but you have dodged them for now!

I'll send you the link to how to get fully updated once I have completed it hopefully today.

There are a few modules using PVI at present ADAravis ADCore and pmac. It would be easy to add motorSim. However, making use of the auto-generated screens that it creates is not documented yet. I want to get on with making a containerised beamline next but after that will come back to doing more docs.

If engineering screens are important to you let me know and I'll do you a rough draft.

gilesknap commented 3 months ago

@amichelotti as promised here is some documentation on how to update your repos to the latest framework (the specific heading is for early adopters whose repos don't yet use 'copier')

https://epics-containers.github.io/main/how-to/copier_update.html#when-update-fails