This is the first of a series of libraries and components that I am planning to publish.
Today I would like to bring your attention to
https://github.com/Araneidae/epicsdbbuilder . This is a tool designed to make it easy to build complex EPICS databases from Python scripts. For example, this script:
from epicsdbbuilder import *
InitialiseDbd('/dls_sw/epics/R3.14.12.3/base/')
SetTemplateRecordNames()
a = records.ao('TEST')
c = records.calc('CALC', CALC = 'A+B', SCAN = '1 second', INPA = a.VAL)
c.INPB = c
WriteRecords('output.db')
generates the following epics .db file:
# This file was automatically generated on Mon 02 Mar 2015 12:57:13 GMT.
#
# *** Please do not edit this file: edit the source file instead. ***
#
#% macro, DEVICE, Device name
record(calc, "$(DEVICE):CALC")
{
field(CALC, "A+B")
field(INPA, "$(DEVICE):TEST.VAL")
field(INPB, "$(DEVICE):CALC")
field(SCAN, "1 second")
}
record(ao, "$(DEVICE):TEST")
{
}
This library has been extracted and simplified from the Diamond IOC builder,
https://github.com/Araneidae/iocbuilder , also
http://controls.diamond.ac.uk/downloads/python/iocbuilder . We use this library to assemble numerous complex IOCs from support modules, but alas there are a lot of Diamond specific dependencies
hard-wired into that module which we’ve not managed to abstract, so I know there’s been little if any external takeup of this library.
EPICS Db Builder is new, and the documentation will be rough, but the underlying framework (IOC builder) has been in use at Diamond for at least eight years now!
I would welcome any comments, particularly any problems with the documentation or suggestions for improvement.
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom