paulscherrerinstitute / pcaspy

Portable Channel Access Server in Python
BSD 3-Clause "New" or "Revised" License
32 stars 24 forks source link

Dynamic PV creation #87

Open zkuplj opened 1 year ago

zkuplj commented 1 year ago

Hi all,

I am working on an application, where I would need to create a PV dynamically inside the server (by itself or triggered from the outside).

I am aware of the dynamic_pv.py example which creates a new PV at "$ caget" command, but I would like to know if there is a function or an example that allows me to dynamically create a PV on the server? That is, after the server is started, I would like to create additional PVs when desired. The PV would ideally be of a similar structure as if the function SimpleServer.createPV() created it. I would then use "caget" and "caput" to modify its value from outside or I would modify the PV value from inside the server.

mennodoor commented 1 year ago

Hi zkuplj,

it may not be exactly what you are looking for, but a little more than the dynamic PV example:

https://github.com/mennodoor/epics-relay

Cheers menno

xiaoqiangwang commented 1 year ago

The connection between SimpleServer.createPV created PVs and Driver class is only established once when in Driver.init. This limited can be overcome.

But it still would not be as dynamic as @mennodoor's implementation does. There the PVs are created on demand, not proactively by the server.

zkuplj commented 1 year ago

Thank you, this is really helpful! I think with a bit of modification, @mennodoor's implementation can do approximately what I need.