EPICSDB Manual
EPICSDB and related classes are for creating EPICS database
with a SAD script. It assumes the following:
- EPICS 3.13 is used.
- Application directory is already created (e.g. ExampleApp).
The merit of EPICSDB is that EPICS database can be created with
SAD script, and the demerit is that it is not graphical.
Usage:
edb = EPICSDB[apptopdir,appname]
Where:
- apptopdir is a EPICS application top directory
(e.g. "~/epics_r313"). "~" at the top of this string is replaced with
your home directory. "~username" is not supported.
- appname is a EPICS application name (e.g. "Example").
Description:
EPICSDB create an EPICSDB object. It read a database definition (dbd)
file appname//"App.dbd". The search path is
apptopdir//"/dbd",
apptopdir//appname//"App/src" and $EPICS/base/dbd.
You can create an EPICS record only when
the definition of the record is in the dbd file.
Methods:
ReadDatabaseDefinition[s]
Reads additional dbd file. The search path is the same as the case of the
object creation.
Returns a EPICSRecordType object whose name
is rtn.
WriteRecord[s]
Writes created records in the directory apptopdir//appname//"App/Db".
The file name is s//".db". When s is omitted, the file
name is appname//".db".
The field value is written only when it is different from the default
of the record. Then even if you specify "Passive" for "SCAN" field,
it would not appear in the resulting output.
ForwardLink[l]
Connects the EPICSRecord objects in the
list l by forward link. The SCAN field of the downstream records
is set to "Passive".
print[]
Prints the current contents of the database.
Example:
edb = EPICSDB["~/epics_r313","Example"];
Description:
Instances of EPICSRecordType can be obtained by
GetRecordType method of
EPICSDB.
Methods:
Creates a record object. The record name is rn. The field value
can be specified with fvl, which is a list of {fieldname, value}.
When the field value should be one of predefined values, only the first
part necessary to uniquely identify it is sufficient and case insensitive.
For example, you can specify "1 sec" for "1 second" or "pass" for "Passive"
as the value of "SCAN" field.
SetDefaultFieldValue[fn,fv,rn]
Sets default field value for records that will be created.
If rn is not Null, this is applied only those records with
the name that matches rn.
The rules set with this method is applied in the order of their
apperance and the first value whith matched rn wins.
For example, in the case:
ert@SetDefaultFieldValue["SCAN","Passive","*Passive"];
ert@SetDefaultFieldValue["SCAN","1 sec"];
the record of the name "ERPassive" would be a passive record and the
record of the name "ER1sec" would be scanned with a period of 1 sedond.
If the order of these two lines are reversed, "SCAN" field of all the
records would be "1 second".
SelectByName[s]
Returns EPICSRecord objects whose name matches
s.
Description:
Instances of EPICSRecord can be obtained by
CreateRecord method of
EPICSRecordType.
Methods:
PutField[fn,fv]
Sets the value of the field fn to fv.
Name[]
Returns its name.
edb = EPICSDB["~/epics_r313","example"];
! creating EPICSRecordType objects
rtai = edb@GetRecordType["ai"];
rtao = edb@GetRecordType["ao"];
rtcal = edb@GetRecordType["calc"];
! setting default values
rtai@SetDefaultFieldValue["SCAN","1 sec"];
! creating records
air = rtai@CreateRecord["airec",
{{"DTYP","Camac"},
{"INP","#B0 C10 N1 A4 F0 @0x0fff"}}];
calr = rtcal@CreateRecord["calrec",
{{"SCAN", "1 sec"},
{"INPA", air@Name[]},
{"CALC", "A**2"}}];
aor = rtao@CreateRecord["aorec",
{{"DOL", calr@Name[]},
{"DTYP", "Camac"},
{"OUT", "#B0 C2 N2 A1 F16 @0x0fff"},
{"OMSL","closed_loop"}}];
edb@print[];
! making forward links
edb@ForwardLink[{air,calr,aor}];
edb@print[];
! writing results
edb@WriteRecord[];
Send feedback to:
Samo Stanic
.