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: Multiple layers of DB templates?
From: "Konrad, Martin" <[email protected]>
To: EPICS Tech Talk <[email protected]>
Date: Mon, 4 Apr 2016 18:43:41 +0000
Hi all,
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:

st.cmd:
dbLoadTemplate("myproject.substitutions")

myproject.substitutions:
global { SYS=...,SUBSYS=... }
file mydevice.db {
   pattern { ... }
   { ... }
   { ... }
}

mydevice.db:
<some records here>
substitute "INPUT=1"
include "myinput.db"
substitute "INPUT=2"
include "myinput.db"

myinput.db:
<a couple of records needed for each input>

A manual run of MSI tool on mydevice.db handles both the "substitute" 
and the "include" keyword correctly but by default macro expansion is 
done at dbLoadTemplate time. This however results in

Error: syntax error
  at or before "substitute" in file "mydevice.db" line 16

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?

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?

Thanks a lot,

Martin

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"?

[1] http://www.aps.anl.gov/epics/base/R3-15/3-docs/AppDevGuide.pdf

-- 
Martin Konrad
Control System Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: [email protected]


Replies:
Re: Multiple layers of DB templates? Bruce Hill
Re: Multiple layers of DB templates? Andrew Johnson

Navigate by Date:
Prev: RE: FFT and waveform Gofron, Kazimierz
Next: Re: Cross Compiling EPICS base for Xilinx Zynq, Petalinux- Recipe Steve Shoaf
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: Trouble using ULONG in edm Zhang, Dehong
Next: Re: Multiple layers of DB templates? Bruce Hill
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 ·