
Customised Wrapper for p4p for ISIS EPICS Collaboration Meeting
"Explore the development of a customised wrapper for p4p tailored for the ISIS EPICS Collaboration meeting in April 2025. This wrapper provides enhanced functionality and flexibility for Python-based interface to EPICS, catering to the needs of the accelerator, including control limits, forward links, and more."
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Development of a customised wrapper for p4p for ISIS EPICS Collaboration meeting April 2025 Ajit Kurup 9th April 2025
Introduction p4p provides a python-based interface to EPICS. Framework structure. Logic needs to be implemented. Customisation for ISIS (accelerator). Provides common higher-level functionality (for ISIS) not provided by p4p out-of-the-box. Python-based PVA servers that include alarm logic. Applying control limits. Forward-links. Calc record like functionality. Automatically integrate services, e.g. channel finder, IOC stats. Flexibility to allow doing things in a way that can support having two control systems (Vsystem and EPICS) running in parallel! Page2 2 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
p4p_for_isis p4p SharedPV Server Handler ChannelFinder/ pyRecCaster p4p_for_isis ISISHandler ISISServer ISISPV IOC Stats Unconventional IOC! PVA Server process variables Page3 3 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
ISISPV Inherits from p4p s SharedPV class. Convenience methods and attributes to easily access PV related objects, e.g. the handler. on_server_start methods. Called by the server after it has started. Allows for arbitrary initialisation. Useful for working out which dependent PVs are local to the server. ISISPV.post() vs Context.put() Page4 4 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
ISISServer Inherits from p4p s Server class. Dictionary of ISISPV objects with their PV name as the key. start method Adds PVs to the StaticProvider and then creates a Server object. Loops over all PVs on the server and calls any initialisation methods that have been added. stop method Closes PVs, removes them from the StaticProvider and then stops the server. Page5 5 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
Handlers p4p Different handler classes for the supported NT types. Defines default set of rules. Handler p4p_for_isis ISISHandler Init (on client first connection), post, put methods BaseRulesHandler Ordered dictionary of rules. NTScalarArray RulesHandler NTScalarRules Handler NTEnumRules Handler Ordered dictionary of rules to process after the PV has been updated. Primarily for forward links and calc rules. Page6 6 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
Rules Classes that define the logic to be used in the handler. Each class can define methods for init, post and put operations. Classes already implemented: Read-only Timestamps Alarm logic Control limits Forward links Calc Page7 7 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
pvrecipe Easier way to create PVs Holds the information to create an ISISPV object. Allows reuse of the recipe to create multiple PVs. Different pvrecipes to support NTScalar, NTScalarArray and NTEnum types. Methods to set different parts of the PV structure: control, display, alarm limits. Defines default values, e.g. for alarm limits. Methods to add specific rules to the handler. Page8 8 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
pvrecipe ISISPV NTScalarRules Handler NTScalarArray RulesHandler ISISPV object pvrecipe PVA Server NTEnumRules Handler process variables PV data ReadOnly Rule CalcRule Page9 9 Page EPICS Collaboration meeting 9th April 2025 Ajit Kurup
YAML parser No-coding way to create pva servers. non-expert-user way to create a PVA server. Uses YAML mark up, which is neat and easy to read and edit. Widely used and supported in python. Specify all parameters needed to create PVs. Equivalent to an IOC db file. Gives us the option to convert Vsystem db records automatically and generate the YAML needed to start a PVA server. Vsystem database files. Information is also available in a couchdb database. Could include Vsystem configuration data that is not compatible with normal EPICS PVs. Page10 Page 10 EPICS Collaboration meeting 9th April 2025 Ajit Kurup
YAML parser DEV:RW:DOUBLE1: DEV:RW:DOUBLEARR1: description: "A double array" type: "DOUBLE" initial: [3,4,5,17.5,7,8] control: low: 1 high: 20 description: "An example double PV with units" type: "DOUBLE" initial: 5.0 display: units: 'v DEV:RW:DOUBLE3: DEV:RW:DOUBLEARR2: description: "A double array using the default value 0 which is outside the control range" type: "DOUBLE" array_size: 6 control: low: 1 high: 20 description: "A different default value for the PV" type: "DOUBLE" initial: 17.5 control: low: 1 high: 20 valueAlarm: low_warning: 2 DEV:RW:DOUBLE6: description: "A PV with display limits configured but no precision etc" type: "DOUBLE" initial: 6.0 display: low: -1.0 high: 1.0 high_alarm: 9 DEV:RO:DOUBLE4: description: "A read-only double" type: "DOUBLE" display: units: "Bq" format: "EXPONENTIAL" precision: 3 initial: 17.5 read_only: True Page11 Page 11 EPICS Collaboration meeting 9th April 2025 Ajit Kurup
YAML parser DEV:RW:DOUBLECALC: DEV:RW:INT3: description: "A PV with a calc and display limits configured but no precision etc" description: "An example integer PV with multiple forward links" type: "DOUBLE" type: "INTEGER" initial: 6.0 initial: 0 display: forward_links: ["DEV:RW:INT1", "DEV:RW:DOUBLECALC"] low: -1.0 DEV:RW:INT4: high: 1.0 description: "An example integer PV with multiple forward links" calc: calc_str: "pv[0]+2.12*pv[1]" type: "INTEGER" variables: ["DEV:RW:INT3", "DEV:RW:INT4"] initial: 0 forward_links: ["DEV:RW:INT1", "DEV:RW:DOUBLECALC"] DEV:RW:INT: description: "An example int PV with limits" DEV:RO:INT: type: "INTEGER" description: "An example int PV with limits" initial: 3 type: "INTEGER" initial: 3 DEV:RW:INT1: # read_only: True description: "An example integer PV" control: type: "INTEGER" low: 1 initial: 0 high: 10 valueAlarm: DEV:RW:INT2: description: "An example integer PV with a forward link" DEV:RW:STRING1: type: "INTEGER" description: "An example string PV" initial: 0 type: "STRING" forward_links: "DEV:RW:DOUBLECALC" initial: 5.0 Page12 Page 12 EPICS Collaboration meeting 9th April 2025 Ajit Kurup
Summary and plans p4p_for_isis has been developed to allow the creation of pva servers that provide functionality like a traditional IOC. Provides common functionality. Ensures consistency. Reduces coding for users. Automatically ties in services that we want to use for all pva servers. Close to having a first version that we can deploy in anger. Minor updates to the functionality. Stress testing. Page13 Page 13 EPICS Collaboration meeting 9th April 2025 Ajit Kurup