-
Notifications
You must be signed in to change notification settings - Fork 97
DctPerspective
= DCT Perspective = '''Purpose: Database Creation Tool for EPICS-Databases'''
'''Prerequisites:''' This is not an introduction to EPICS but to the DCT perspective of the Control System Studio, therefore some experience with EPICS-based systems is necessary.BR
Usually during the creation of EPICS-Databases a lot of redundant information has to be entered. The DCT perspective offers an editor and three views to aid in this task. A DCT-source file (this is an xml-file with the ending .css-dct) contains information about so-called '''prototypes''', '''instances''' and '''records'''. The '''records''' are parameterized versions of EPICS records. The '''instances''' are used to create an EPICS-Database file, the '''prototypes''' are used to allow for easy construction of the instances. Prototypes are a means for structuring the system by grouping sets of parameters. Prototypes may be nested which gives you a lot of flexibility at hand. Based on the prototypes, instances are created. Instances represent EPICS-records. They are created by binding values to the parameters of the prototypes. Well, now we are about to try it ...BR
PageOutline(2-3, A brief introduction for using the DCT erspective follows, inline)
== At first open the DCT perspective == Image(010 - Open DCT Perspective.png)BR
After some work, the DCT perspective will look like this (reset the perspective if it does not show up with these views):BR
Image(015 - Newly Opened DCT Perspective.png)BR
Most likely you will not have a DCT-source file at hand, so we will have to create one from scratch.BR
== Install the sample project == To set up your working environment, you should install the sample projects. They will be used as the location for your own results and contain a DCT file as fallback where the result of this tutorial is provided.BR
Image(020 - Install Sample Projects.png)BR
== The DCT file == Now we are going to build the DCT file. Create a new fileBR
Image(030 - Create New DCT File.png)BR
name it MyDCT.css-dct and store it in the sample project folder.BR
Image(040 - Name And Save New DCT File.png)BR
To provide the DCT with the metadata for the current EPICS version, you have to tell the DCT file which '''database definition file''' it shall use. Pick the '''test.dbd''' file:BR
Image(045 - Select DBD File.png)BR
This step must not be forgotten. You will not be able to create any kind of item other than a folder, if you omit this step.BR
== Creating items == In general you work from the outline view, using the context menu with the mouse.BR
Image(050 - Creating Items In Outline View.png)BR
There are four kinds of items you may create: '''Folders''', '''Prototypes''', '''Instances''' and '''Records'''.BR
Folders are the usual means for organizing your items, there is nothing special about them. For a larger system you may want to create folders to separate Prototypes and Instances, so let us start this way for this demo too.BR
Image(055 - Creating Folders.png)BR
== Creating a prototype == In the prototype folder, you create a prototype using the context menu. In the editor several form fields grouped in sections will show up. You should enter a telling name in the Name field (in the Common Settings section), this will be used for identifying your prototype inside DCT. For the time being, nothing will be entered in the Properties section, so it may be left collapsed.BR
The Parameter section makes up the essential section. Here you enter the names of the parameters which you may later give values to to create instances. Sounds complicated? Not at all. We are going to create a simple generator for a sawtooth function. The following parameters will come in handy:BR
- '''dispMin, dispMax''' give the bounds of the display
- '''lolo, hihi''' give the bounds of the major alarm zone
- '''lo, hi''' give the bounds of the minor alarm zone
- '''minVal, maxVal''' give the bounds of the value of the sawtooth function
- '''name''' is what you might expect
- '''increment''' defines the step for the sawtooth function Now enter the parameter names, using the button with the plus sign at the bottom left.BR
Image(060 - Entering Properties For Sawtooth Prototype.png)BR
How will it fit together? We just defined a prototype containing several parameter names. We are just about to define a record which will make use of the parameters. Later on we will create instances (resulting in EPICS records) by giving values to the parameters. This way the same prototype is used for the creation of several EPICS records.BR
== Adding a record to the prototype == Ok, let us go. Add a record for the prototype using the context menu of the outline view. You have to chose the type of the record. Select a calc record type.BR
Image(065 - Creating Record For Sawtooth Prototyp.png)BR
Now we have to define the calc record based on the parameters. Most important are the Name and the Epics Name, the latter being based on a parameter. Enter them like shown hereBR
Image(067 - Entering EPICSName Into Prototype Record.png)BR
Now you may enter the other fields. First define the DESC field, let us give it the Epics Name too. You will notice the autocompletion after entering the $-sign.BR
Image(070 - Autocompletion For Properties.png)BR
Please enter the following values to the appropriate fields (for the calculation part) as shown hereBR
Image(075 - Entering Calculation For SawCalc Record.png)BR
and for the alarm parameters as shown hereBR
Image(080 - Entering Alarm Parameters For SawCalc Record.png)BR
You end up with a fully specified prototype which you may use to create instances.
== Creating an instance == Add an instance to the Instance folderBR
Image(090 - Creating Instance Of SawCalc.png)BR
You will be asked which prototype your instance will be based onBR
Image(100 - Selecting Prototype For Instance Of SawCalc.png)BR
Select the only one which is currently available. The unbound parameters of the prototype are shown in the Parameter Values section of the editor. BR
Image(105 - Showing Unbound Parameters For SawCalc Instance.png)BR
You have to bind values to the parameters (tab key proceedes to the next value field) like this:BR
Image(110 - Entering Parameters For SawCalc Instance.png)BR
Don’t forget to give a name to the instance, this will show up in the outline view. BR
== Creating a second instance == Now we will make use of the prototype by creating a similar instance. Select Copy in the outline view.BR
Image(120 - Copying SawCalc0 Instance.png)BR
and paste the instance alongside the existing instance.BR
Image(130 - Pasting Instance Of SawCalc Into Instances Folder.png)BR
Whoops. An error is shown:BR
Image(140 - Outline After Pasting Instance.png)BR
You will find help an explanation in the problem viewBR
Image(145 - Problems After Pasting Instance.png)BR
Quite right, there may not be two EPICS records with the same name. We are going to correct this, thereby providing different parameter values and a different name as well.BR
Image(150 - Entering Different Parameter Values For Second Instance.png)BR
Now everything looks ok. In the Instance View (bottom right) you can see, which instances rely on the selected prototype. This is great for a reasonably sized system.BR
Image(160 - Showing Instances Of Prototype Sawtooth.png)BR
== Creating the EPICS database == Finally we are going to create the EPICS database file. Simply select the Preview DB file tab at the bottom of the editor pane. Skim through the EPICS database and save it using the Save To File-button.BR
Image(170 - Exporting DB File For SoftIOC.png)BR
Usually the extension .db is used for EPICS database files so we will give the result the name !'''AlarmDemo.db'''. This name is expected in the EPICS configuration.BR
Image(175 - Save DB File.png)BR
== Running the Soft-IOC == This database can be run in a so-called SoftIOC (this is supported only under Windows). Copy SoftIOC.zip from the Sample Project Folder to some other place (e.g. C:\SoftIOC) and unzip it. Now copy !'''AlarmDemo.db''' into the demo folder. Then start the SoftIOC with the '''RunSoftIOC.bat''' command. To stop it, simply type exit at its prompt.BR
== Finally watching the IOC work == Now you can take a look at the two sawtooth generators. Select the CSS Standard perspective and start two Probe Views (the second one will open when you press the control key too) and an EPICS PV Hierarchy, all from the CSS-Diagnostic Tools menu. The EPICS-Names are well known to you (SawCalc0/1 resp.). You may need to arrange the views properly to achieve the following layout:BR
Image(200 - Standard Perspective With Two Instances.png)BR
Watching the generators do their work will hopefully be a reward for all your activities.BR