EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Multiple layers of DB templates?
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Mon, 4 Apr 2016 16:31:05 -0500
Hi Martin,

On 04/04/2016 01:43 PM, Konrad, Martin wrote:
> I need to create an EPICS database for a soft IOC with 60 identical 
> devices. Each of these devices has a set of records that are identical 
> for multiple inputs. Having the DRY pattern in mind, I was wondering if 
> I could somehow use two levels of DB templates. Here is what I have in mind:

Bruce's suggestions here for running MSI twice are sensible, I'll try to
answer your other questions...

> It seems like dbLoadTemplate doesn't support the "substitute" keyword. I 
> found a BNF definition of the substitution file format in chapter 6.12.1 
> of the Application Developer's Guide [1]. Unfortunately I did not find a 
> definition like this for DB files/templates. Can you please help me out 
> here?

Section 6.12 of the 3.15 AppDevGuide documents the substitution syntax
supported by the dbLoadTemplate() command, which is also supported by
the MSI tool. The BNF that you found there does not mention the keyword
"substitute" that you're trying to use though, so your results above are
as I would expect. The 'substitute' keyword /is/ supported in the
template file syntax understood by MSI though, as documented in
  http://www.aps.anl.gov/epics/base/R3-15/3-docs/msi.html
but dbLoadTemplate() doesn't claim to understand this syntax.

The IOC's dbLoadTemplate() command must generate a valid IOC database as
summarized in section 6.2, although it would normally only contain the
parts documented in 6.3.6 (comments), 6.4.2 (includes, which would be
unusual but should be legal here), 6.4.10 (breaktables) and 6.4.11
(record instances and aliases).

> I am aware that I could use 60 dbLoadTemplate lines instead (that would 
> clutter IOC boot output, though). I could also pull in both mydevice.db 
> and myinput.db from the substitutions file directly - but for that I 
> need to add N lines referring to myinput.db in the substitution file for 
> each line referring to mydevice.db (assuming a device with N inputs). Is 
> there a nicer way to do this?

You can use any text-processing tools you like to generate .db files; we
have IOCs here at the APS that use Perl scripts to generate
.substitutions and/or .template files, and they may even run the output
through MSI before loading them into the IOC. You would of course have
to write your own build rules to support running other tools.

You might also want to look at the hierarchical templates implemented in
VisualDCT (N.B. not the Grouping feature, that's very different).
Engineers who are used to laying out schematics usually appreciate the
visual aspects of design that VisualDCT provides for databases. You do
have to manually flatten any hierarchical design into a single .db file
before you can load it into the IOC though as we haven't implemented the
hierarchy expansion inside the IOC (yet). There are other tech-talk
readers with much more experience of VisualDCT that I have, so ask again
for advice about using that.

> P.S.: BTW: Is there a difference between a DB file and a template? Are 
> their file names supposed to have different suffix (".template" vs. ".db"?

The IOC doesn't look at extensions at all, so you can use any name you
like in startup script commands. However the EPICS build rules can run
MSI two different ways to generate a .db file depending on whether you
have a .substitutions or a .template file for it to start from. The MSI
manual I linked above describes the difference between those two file
formats.

The build system's MSI rules always generate .db files; it might be
worth looking at these (in base/configure/RULES.Db) if you want to try
and understand them better [I didn't write them; Janet who did retired
last year].

HTH,

- Andrew

-- 
There are only two hard problems in distributed systems:
  2. Exactly-once delivery
  1. Guaranteed order of messages
  2. Exactly-once delivery
 -- Mathias Verraes

References:
Multiple layers of DB templates? Konrad, Martin

Navigate by Date:
Prev: Re: Multiple layers of DB templates? Bruce Hill
Next: set baud rate not work 梁雅翔
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Multiple layers of DB templates? Bruce Hill
Next: Re: Multiple layers of DB templates? Konrad, Martin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·