Building EPICS Databases


Note on Macro Substitution during EPICS database generation

Unresolved Macros During Database Building
Batch Mode
Interactive Mode
Schematic Checks

Tdct can build EPICS databases both in interactive and in batch mode.

Note on Macro Substitution during EPICS database generation

Macro substitution is governed by the configuration option immediate_macro_use.
This option was implemented to give users more control over macro substitution on symbol instance properties during database building.
By default this option is set to true. This retains the traditional tdct behaviour which was implemented for backward compatibility with Capfast use at Gemini.
It is recommended to set this option to false to avoid unexpected side-effects.

If the option is set to true  and  a macro value is redefined on a symbol instance, the redefined value of the macro is immediately used for resolution of further symbol instance properties.
If the option is set to false and a  macro value is redefined on a symbol instance,  the redefined value of the macro is not used for resolution of other symbol instance properties.
In both cases the redefined macro value is used in resolving macros in the daughter schematic of the symbol instance.

Example:
An EPICS database is built flattening a hierarchy of schematics.
At the top level the macro M2 is assigned a value 'PUMP1' and during processing a schematic tdct encounters a symbol instance which defines three properties:
M1 $(M2):ON
M2 PUMP2
M3 $(M2):OFF

The second property redefines the value of M2.
When the daughter schematic is processed the macros have the following values:

case a:  [options] immediate_macro_use  false
M1 PUMP1:ON
M2 PUMP2
M3 PUMP1:OFF

case b:  [options] immediate_macro_use  true
In this case, the macro values depend on the sequence of the properties in the symbol file which depends on how the symbol was designed.
Note that this is not necessarily the order in which the properties are shown on the symbol.
If the macro sequence in the symbol file is M1 M2 M3:
M1 PUMP1:ON
M2 PUMP2
M3 PUMP2:OFF
If the macro sequence in the symbol file is M1 M3 M2:
M1 PUMP1:ON
M2 PUMP2
M3 PUMP1:OFF
If the macro sequence in the symbol file is M2 M1 M3:
M1 PUMP2:ON
M2 PUMP2
M3 PUMP2:OFF

Unresolved Macros During Database Building

If tdct encounters unresolved macros during database building, warning messages are generated.

If unresolved macros are used in recursive macro definitions, such as "top = $(top)xxxxx", the resulting database may not be what you expect.

There are two ways of resolving this:

Batch Mode

The following command line switches can be used for running tdct in "no graphics" mode.
In this mode tdct  functions either as an EPICS database builder only or as a schematic converter from Capfast compatibility mode to dbd mode..

-s <schematic name>
If this switch is specified, Tdct runs without graphics and builds the schematic into an EPICS runtime database.

-m <macro string>
This switch is only useful, if -s was specified. The macro string is parsed and the macro name-value-pairs specified are used in the database build process.

-cfg <configuration file path>
 Loads configuration file from <configuration file path> instead from tdct.cfg in the user's home directory.

-db <data base path>
This switch is only useful, if -s was specified. The generated data base is written to <data base path>.

-dbd <dbd file path>

 Specifies the dbd file to be used.

-from <input file path>

 Specifies the path of the input directory for batch conversion of schematics from Capfast compatibility mode to Dbd mode.

-i <schematic file path>
 Specifies a schematic for immediate loading.

-start <dbd file path>

 Specifies the startup directory..

-todbd <output file path>

 Specifies the output file path for batch conversion of schematics from Capfast compatibility mode to Dbd mode.

-z <button no>

 If button_no = 2, the left mouse button drags the select rectangle and the middle mouse button drags the zoom rectangle.


Interactive Mode

The following menu items from the Menu >> Database menu are available. Depending on whether an EPICS database or a database template are built, tdct uses different approaches to macro substitutions.

Build current canvas

The current canvas schematic is used to build an EPICS database. If during the database build macros are encountered which cannot be resolved, the macro definition is replaced with an empty string and a warning is raised.

Build current canvas with macros

The current canvas schematic is used to build an EPICS database. Tdct prompts the user to supply macros. If during the database build macros are encountered which cannot be resolved, the macro definition is replaced with an empty string and a warning is raised.

Build current canvas as template

The current canvas schematic is used to build an EPICS database template. If during the database build macros are encountered which cannot be resolved, the macro definition is retained. If a macro definition contains an =  (equal sign), no substitutions are made, i.e. the macro definition is retained.

Build multiple

Tdct presents a file open dialog, where multiple schematics can be selected. Each schematic is build into an EPICS database.

Build all

Tdct builds all schematics of the current directory into EPICS databases. One schematic must be opened to define the current directory.


Schematic Checks

During database building, tdct checks the schematic hierarchy for duplicate records and for record links which have wire-connections to other record links. When errors are found, they are reported, but the database is built nevertheless.

Link fields which target another link field via a wire are set to constant 0.