7 PROGRAMMER'S GUIDE
This chapter is intended to help programmers, who already have a working startup tool prototype and intend to complete its implementation by adding instrument specific features.
It is assumed here that the stoo module and the instrument software have already been properly installed and environment variables are properly defined. See chapter 9 for more information on this subject.
7.1 DEBUGGING FACILITIES
7.1.1 Log Levels
The startup/shutdown scripts log their actions to stdout or to a logging window. The logging window is used by default when no arguments are passed to the xxinsStart or xxinsStop scripts. If arguments are used, then logs are sent to stdout, unless the option -log is specified as the first script argument.
The log messages are more detailed if a higher log level is used. The log level of the startup/shutdown scripts is set as follows:
7.1.2 TCL Errors
If xxinsStart and xxinsStop detect an error, an error message is reported. To report the complete TCL error information, use option -debug, e.g.
7.1.3 Internal Object List
The debug option -objList gives a quick overview of the instrument software as seen by the startup tool. The xxinsStart and xxinsStop scripts configure themselves according to the supplied instrument configuration. They build an internal tree of TCL objects that can be listed with option -objList:
E.g. the output in case of UVES is as follows:
Object `CONFIG INS' allows to read the config. file, object `STARTUP INS' implements the main code to start/stop the instrument software. The rest of the objects describe the instrument software, in terms of applications (OS, TCS, ICS, DCS), processes and panels.
7.1.4 Internal Object Variables
When the startup tool is configured, some processes and panels may not start/stop as expected. The list of object variables of individual objects can be listed with the -objShow debug option. Please note that this option lists all public variables of an object and is supplied for detailed debugging. An understanding of all variables assumes having a deep understanding of the startup tool implementation and is beyond the scope of this manual.
E.g. the configuration of the UVES process uvoExpCtrl_BLUE is:
E.g, variable -execCmd specifies how the process is started: `uvoExpCtrl blue'.
Note that the usage of the variables depends of the implementation, in particular:
· DCS applications are started with the startup scripts supplied by the DCS software. The process objects are only used to verify if the processes are running after the startup, therefore e.g. variable -execCmd is not used.
7.2 INSTRUMENT SPECIFIC STARTUP CODE
If the startup tool customization done with the configuration files is not sufficient, then the startup and shutdown procedures of the individual applications can be modified replacing the corresponding standard classes with instrument specific code. It is recommended to place this code in a TCL script called xxinsStoo. Please see files stoo/test/stooTclfileExample.tcl and stoo/test/stooTestSpecialICSs.tcl for examples. The latter file describes how to use supplied code for STRAP and RTC.
Note that modification of startup and shutdown procedures should be avoided and only used as the last option.
7.2.1 Registering File xxinsStoo
The main source for script xxinsStoo is usually file xxinsStoo.tcl, i.e. add to the xxins Makefile the following lines:
Script xxinsStoo has to be registered in the xxmcfgINS.cfg file. This is done, adding the following keyword:
7.2.2 The Global Array stooType
The startup tool implementation uses a global array to register all TCL classes that may be overloaded (or replaced). The array contains the following entries:
Array Index Description Default Value STARTUP Startup object that reads the config. files and starts/stops the applications and panels.This class has to be overloaded, if you wish to make adjustments to the internal instrument representation (see section 7.2.3). stooINS INSTRUMENT Container of the internal instrument representation. This class normally does not need to be modified. stooINSTRUMENT OS OS Application. Overload this class, if you have an instrument specific OS (see section 7.5.1). stooOS TCS TCS Application. This class does not start/stop TCS. It only verifies that the TCS env. variables are properly set. This class normally does not need to be modified. stooINS_TCS ICS, ICS2, ... ICS Applications. Overload one or more of these classes if you have an instrument specific ICS(s), e.g. STRAP or RTC. (see section 7.5.1). stooICS DCS_<type> DCS Application. Register this class, if you have a detector of type <type> not supported by the startup tool (see section 7.5.1). stooDCS_ACEstooDCS_FIERAstooDCS_IRACE MIDAS MIDAS Application. This class starts pco and inmidas. The standard configuration creates a MIDAS object. If your instrument does not use MIDAS, then this object can be deleted (see section 7.3.4). stooMIDAS BOB BOB panel. This class normally does not need to be modified. stooBOB ALARM ALARM panel. This class starts the RtapASDisplay panel. Replace this class, if you have an instrument specific alarm panel (see section 7.4.2). stooALARM UIF_CLASS User defined uifClass for startup panel.See stooTestUSERCLASS.cfg ,stooTclfileExample.tcl and stooTestStartup_uifClass.tcl for examples No default7.2.3 Example: Overloading Class STARTUP
To e.g. overload the STARTUP class, register the instrument specific class in the stooType array and supply the corresponding implementation. Add the following lines to the xxinsStoo.tcl file:
Note that the new class should normally inherit from the class registered as default value in the stooType array (see table above, i.e. in case of the STARTUP class, from stooINS). OS, ICS and DCS classes may inherit from class stooAPPLICATION.
7.2.4 Example: Using Specific startup code for STRAP and RTC
STRAP and RTC packages provide their own specific startup code in modules strapiws and macrtcws respectively that should be used. See file stoo/test/stooTestSpecialICSs.tcl for information how to incorporate this code into your application.
7.3 ADJUSTING THE INSTRUMENT CONFIGURATION
The standard startup procedure may need small adjustments, that are not available via the configuration keywords, but that may be applied changing the internal instrument description. This section describes some typical situations.
7.3.1 Adding a Single Process
To add a single process to a standard ICS or OS, proceed as follows:
1. Create class xxinsICS (resp. xxinsOS, similar as described in section 7.2.3 above) and inherit from the standard class stooICS (resp. stooOS).
set obj [stooPROCESS $this.$procname \
-execCmd "xxiMyProcess [<options>]" \
-desc "[Desc] MyProcess Description"]
A stooPROCESS object is created (see the stooPROCESS man page for details) [lines 1-6] and added to the application [line 7].
7.3.2 Setting an Option of an Application, Panel or Process
If an instrument needs to set a specific option (or variable) not available via the configuration file, then this option can be set as follows (e.g. to pass an argument to the xxiControl process):
The xxiControl object is searched with the LookupName method inside the complete object tree [line 1]. The option -execCmd is set [line 2].
7.3.3 Changing the Startup Order of an Application or Panel
Script xxinsStart starts all applications bottom-up, i.e. starting with the last application displayed with debug option -objList (see section 7.1.3). This makes sure that applications needed by upper layers of the software are already running, when they are started (e.g. ICS, DCSs are started before OS). Panels are started from top to bottom, i.e. the first panel started is usually BOB. Instrument specific panels (created with e.g. START.PANELi.*) are normally appended at the bottom of the tree. If a particular instrument needs to start an application or panel in a different order, then the application or panel has to be moved within the internal instrument description.
For example, to have panel `START.PANEL1.NAME SENSORS' be started first, proceed as follows:
The panel is searched with the LookupName method inside the complete object tree [line 1]. The panel's parent is retrieved [line 2]. The parent is told to move the panel to the beginning (index 0) of it's object list [line 3].
7.3.4 Removing a Process or Panel
If a specific process or panel is not available and does not need to be started/stopped, then it can be removed from the internal instrument description.
For example, to remove panel xxopanStatus, proceed as follows:
The xxopanStatus object is searched with the LookupName method inside the complete object tree [line 1]. The parent of the panel is retrieved [line 2]. The panel is removed from the parent's list [line 3] and deleted [line 4].
7.4 INSTRUMENT SPECIFIC PANELS
The standard startup tool assumes that the instrument has a certain list of panels (see section 2.3.3). These panels can either be replaced or new panels can be added as described below.
7.4.1 Adding New Panels
Additional panels can be registered with the START.PANELi.* keywords (see section 6.14).
For example, to register a new panel SENSORS, register the following keywords in the configuration file:
7.4.2 Modifying/Replacing an Existing Panel
To replace an existing panel with an instrument specific one, make sure to register the corresponding name in keyword START.PANELi.NAME. The startup tool will remove the standard panel and replace it with the new one.
For example, to replace the ALARM panel with an instrument specific one, add the following keywords to the configuration file:
7.5 INSTRUMENT SPECIFIC APPLICATIONS
The standard behavior provided for OS, DCS and ICS are tailored to start/stop the software provided by the VLT Common Software: BOSS, ACE DCS, FIERA DCS and Base ICS. If an instrument does not use these software packages, then they probably have to supply their own startup classes to start/stop their applications. The XXXX Template Instrument supplies class samples for an instrument specific OS and ICS. Other application types can be implemented in a similar fashion.
7.5.1 Starting/Stopping an Instrument Specific OS or ICS
The startup tool gives the possibility of incorporating multiple ICSs in a single instrument. This includes ICSs based on STRAP and RTC. Each of them can be different and can have its own code supplied in the common tcl file specified with the keyword START.CON.TCLFILE. For back compatibility reasons the corresponding global array stooType has the element stooType(ICS) that corresponds to the first ICS (note no index in ICS) and then stooType(ICSi) for corresponding ICSi (i>1). Important note: If the startup class of the first ICS (i.e. stooType(ICS)) is overloaded with a specific code, all other ICSs with the default behavior (i.e. the ones without their own specific code) will be overloaded with the same class. Therefore, if stooType(ICS) is overloaded and you want e.g. ICS2 still to use the class stooICS, stooType(ICS2) must be explicitly defined, i.e. "set stooType(ICS2) stooICS", in the supplied tcl file.
File stoo/test/stooTclfileExample.tcl contains two sample classes: one for OS, another for ICS. These samples may be copied to file nninsStoo.tcl (if not already there) renaming all `xx' to `nn'. Make these classes known to the startup tool adding the following lines to the beginning of the nninsStoo.tcl file (see section 7.2.2):
These instrument specific classes may either inherit from their direct parent (stooOS, resp. stooICS) or from class stooAPPLICATION, according to what standard behavior you wish to maintain. The classes should overload one or more of the methods provided by an stooAPPLICATION: Config, Start, Stop, IsActive, IsStopped and Standby (see 10.3.1 for details).
The first loads the keywords from the configuration file needed to start the application (if any). The second part registers the processes and panels owned by the application. OS should have at least a main process (xxoControl) and panels OS_CONTROL and OS_STATUS. See the ctooPROCESS and ctooPANEL man pages for details of how to configure these objects.
· The default behaviour of method Start is to start all processes owned by the application (registered with method Config). The method can be overloaded if additional tasks need to be done, like e.g. sending a DEBUG command to OS to set it's logging level.
· Method Standby should set OS in state Standby. The method supplied by stooOS sends a STANDBY command to the first process owned by the application (i.e. the first process registered in method Config), the Standby method supplied by stooAPPLICATION does nothing.
As stooAPPLICATION inherits from classes stooBASE and stooLOG, the methods provided by these classes to e.g. read/write the OLDB and provide logs can be used by the instrument specific class. Class stooPROCESS provides methods to send messages to the process.
When script xxinsStart starts OS, it will first call the OS methods Config, then Start (to start OS) and finally method Standby (to place OS in state Standby). Script xxinsStop calls method Config, Standby and Stop. The panels are started/stopped by default, if their default variable is set.
The ICS class shows an alternative way to start an application: If the instrument specific application already supplies a startup script, then this script can be called from xxinsICS::Start. This method is shown in the xxinsICS example (method Config anyway registers the ICS processes, to use the standard Stop method to stop the ICS processes).
7.6 INTERFACES
7.6.1 Human Interfaces
The human interface is mainly described in the User's Guide (chapter 4). It consists of the standard startup panel and scripts xxinsStart and xxinsStop. It is suggested to provide several desktop root menu entries as described in section 4.1.
7.6.2 Hardware Interfaces
7.6.3 Software Interfaces
Quadralay Corporation http://www.webworks.com Voice: (512) 719-3399 Fax: (512) 719-3606 sales@webworks.com |