TCL User's Guide
TCL User's Guide
TABLE OF CONTENTS
Chapter 1 - Introduction
1.1 1.2 1.3 General Information................................................................................................. 1-1 Manual Organization ............................................................................................... 1-2 Related Documentation............................................................................................ 1-2
Report Services And History Services Interface ................................................... 2-13 Peripheral I/O Interface ......................................................................................... 2-13 Digital Device Control........................................................................................... 2-13 Unit Message (Unitmsg) Display Interface ........................................................... 2-13 Mailbox Function................................................................................................... 2-14 Include Function ................................................................................................... 2-14 Implementing User Calculation FCMs Through TCL........................................... 2-14 Miscellaneous Functions........................................................................................ 2-14 Data Base Configuration Requirements................................................................. 2-15 Program/Recipe Development Platforms .............................................................. 2-15
CONTENTS (continued)
2.19.1 2.19.2 2.20 2.20.1 2.20.2 2.20.3 2.20.4 2.20.5 2.20.6 2.20.7 TCL and Recipe Editors........................................................................ 2-15 Compiling and Linking ......................................................................... 2-16 Download/Remove Function................................................................ 2-17 Debugging ............................................................................................. 2-17 Program Control Through Unit Detail and Sequence Detail Displays . 2-18 Recipe Manipulation ............................................................................. 2-18 Unit Message Display ........................................................................... 2-18 Display, Logging, and Recording of TCL Messages ........................... 2-18 Sequential Function Chart (SFC) Display Functions............................ 2-18 2.20.7.1 2.20.7.2 2.20.7.3 STEP_ACTIVITY Function........................................... 2-19 STEP_CONDITION Function ....................................... 2-19 STEP_TRANSITION Function ..................................... 2-19
TCL Keywords ......................................................................................................... 4-3 Data Types................................................................................................................ 4-3 4.4.1 4.4.2 4.4.3 4.4.4 Real Data ................................................................................................. 4-3 Integer Data ............................................................................................. 4-4 String Data .............................................................................................. 4-4 State Descriptors ..................................................................................... 4-4 Arithmetic Operators............................................................................... 4-5 Relational Operators................................................................................ 4-5 Logical Operators.................................................................................... 4-6
4.5
ii
CONTENTS (continued)
4.5.4 4.5.5 4.6 4.6.1 Order Of Computations .......................................................................... 4-6 Mixed Mode Expressions ....................................................................... 4-7 Mathematical Functions.......................................................................... 4-8 4.6.1.1 4.6.1.2 4.6.2 4.6.3 ABS (Absolute) Function................................................. 4-8 ROUND Function ............................................................ 4-8
Trigonometric Functions......................................................................... 4-8 Bit Manipulation Functions .................................................................... 4-8 4.6.3.1 4.6.3.2 BIT ONES COMPLEMENT Function ........................... 4-8 BIT SHIFT Function ........................................................ 4-8 LEN Function................................................................. 4-10 MID Function................................................................. 4-10 ORD Function ................................................................ 4-10 CHR Function ................................................................ 4-10 ASTOI Function............................................................. 4-10 ASTOR Function ........................................................... 4-10 ITOAS Function ............................................................. 4-10 RTOAS Function............................................................ 4-10 DATE Function .............................................................. 4-11 TIME Function............................................................... 4-11
4.6.4
String Manipulation Functions ............................................................. 4-10 4.6.4.1 4.6.4.2 4.6.4.3 4.6.4.4 4.6.4.5 4.6.4.6 4.6.4.7 4.6.4.8
4.6.5
Program Header And Parameter Lists ................................................................... 4-11 External Programs.................................................................................................. 4-12 Constants................................................................................................................ 4-14 Variables................................................................................................................. 4-15 4.10.1 Local Variables ..................................................................................... 4-15 4.10.1.1 4.10.1.2 4.10.2 4.10.3 4.10.4 4.10.5 4.10.2.1 Simple Variables ............................................................ 4-15 Arrays............................................................................. 4-16 Declaring Data Base Parameters.................................... 4-17
Data Base Parameters ........................................................................... 4-17 Recipe Parameters................................................................................. 4-20 Unit Variables ....................................................................................... 4-22 4.10.4.1 4.10.5.1 4.10.5.2 4.10.5.3 Unit Array Variables ...................................................... 4-22 Declaring a VARTAG..................................................... 4-23 Declaring Unit Relative VARTAGS ............................... 4-24 Using a VARTAG Reference.......................................... 4-24 Variable Tags - VARTAGS.................................................................... 4-23
iii
CONTENTS (continued)
4.10.5.4 4.10.6 4.10.6.1 4.10.6.2 4.10.7 4.11 4.12 Using a VARTAG as a String in a Message Statement... 4-25 Fetch Statement .............................................................. 4-25 SET Statement ................................................................ 4-26 Fetch and Set ......................................................................................... 4-25
Units ....................................................................................................................... 4-29 Subroutines............................................................................................................. 4-29 4.12.1 4.12.2 Internal Subroutines ............................................................................. 4-29 External Subroutines ............................................................................. 4-31 BEGIN/END Structure.......................................................................... 4-32 STEP/ENDSTEP Structure ................................................................... 4-33 Compound Statements .......................................................................... 4-33 Conditional Statements ......................................................................... 4-34 4.13.4.1 4.13.4.2 4.13.5 4.13.5.1 4.13.5.2 4.13.5.3 4.13.5.4 IFTHENELSE ........................................................ 4-34 CASE Statement............................................................. 4-35 FORDOWNTO (TO)DO Statement ....................... 4-36 REPEATUNTIL Statement ........................................ 4-37 WHILEDO Statement ................................................ 4-37 GOTO Statement ............................................................ 4-37
4.13
4.14
Serial I/O Statements.............................................................................................. 4-38 4.14.1 4.14.2 4.14.3 4.14.4 OPEN Statement ................................................................................... 4-38 CLOSE Statement ................................................................................. 4-39 INPUT Statement .................................................................................. 4-39 OUTPUT Statement .............................................................................. 4-40
4.15 4.16
Disk I/O Statements ............................................................................................... 4-41 Program Control Statements .................................................................................. 4-43 4.16.1 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 LOAD Statement................................................................................... 4-43 REMOVE Statement ............................................................................. 4-44 CHECK Statement ................................................................................ 4-44 ACTIVATE Statement ........................................................................... 4-45 ABORT Statement ................................................................................ 4-45 PAUSE Statement.................................................................................. 4-46 RESUME Statement.............................................................................. 4-47 EVENT, SETEVENT, ACTION, ENDEVENT, CLEAREVENT Statements .................................................................. 4-47 ABNORMAL Statement....................................................................... 4-49
iv
CONTENTS (continued)
4.16.10 4.16.11 4.17 4.17.1 4.17.2 4.17.3 4.17.4 ABNORMSUBR Statement ................................................................. 4-50 CRITICAL and NONCRITICAL Statements....................................... 4-51 STARTBATCHENDBATCH Structure............................................. 4-52 REPORT Statement .............................................................................. 4-53 TRENDONTRENDOFF Statements ................................................ 4-53 RECORD Statement ............................................................................. 4-54 4.17.4.1 4.17.4.2 4.17.4.3 4.17.4.4 4.18 4.19 4.18.1 4.19.1 4.19.2 4.19.3 4.20 4.21 4.22 4.23 4.24 RECORD Statement for Reports ................................... 4-54 RECORD Statement for History.................................... 4-55 RECORD Statement for Recipes ................................... 4-56 RECORDER Statement ................................................. 4-56
TCL Mailbox Interface .......................................................................................... 4-57 SEND and RECEIVE Statements......................................................... 4-57 MESG Statement .................................................................................. 4-58 REPLY Statement ................................................................................. 4-58 UNIT_ALARM Statement ................................................................... 4-59 Unit Message (Unitmsg) Display Interface ........................................................... 4-58
Comments .............................................................................................................. 4-60 Wait Statement ....................................................................................................... 4-60 Include Statement .................................................................................................. 4-60 Updateon And Updateoff Statements .................................................................... 4-61 UCALs - User Calculation Routines For CCF ...................................................... 4-61 4.24.1 4.24.2 4.24.3 Features Common to Synchronous and Asynchronous UCALs........... 4-62 Synchronous UCALs ............................................................................ 4-62 Asynchronous UCALs.......................................................................... 4-64 STEP_ACTIVITY ................................................................................ 4-66 STEP_CONDITION............................................................................. 4-67 STEP_TRANSITION, ACTION .......................................................... 4-68
4.25
Sequential Function Chart (SFC) Display Statements........................................... 4-66 4.25.1 4.25.2 4.25.3
4.26
_TCLACCESS....................................................................................................... 4-70
CONTENTS (continued)
5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.2.10 5.2.11 5.2.12 5.2.13 5.2.14 5.2.15 5.3 Recipe Catalog Display........................................................................... 5-3 CREATEHow to Create a New Recipe ............................................... 5-5 EDITHow to Use the Recipe Editor.................................................... 5-6 5.2.3.1 Editing Recipe Items ........................................................ 5-9 EDITHow to Use the Source Editor.................................................... 5-9 COMPILHow to Compile a Recipe Created with the Source Editor 5-11 EDITHow to Modify a Recipe .......................................................... 5-12 REMOVE SOURCEHow to Change a Recipe from the Source Editor Format to the Recipe Editor Format............................... 5-12 DE-COMPILHow to Change a Recipe from the Recipe Editor Format to the Source Editor Format............................... 5-12 COPYHow to Make a Copy of a Recipe and Store it Under a Different Name...................................................................................... 5-13 XFER (SAVE)How to Make Backup Copies of Recipes to Other Disk Devices ............................................................................... 5-13 XFER (RESTORE)How to Load (Restore) Backup Copies ............. 5-14 DELETEHow to Delete a Recipe...................................................... 5-15 PRINTHow to Print a Hard Copy of a Recipe .................................. 5-15 DIR LISTHow to Print a List of the Recipes .................................... 5-15 EXITHow to Exit from the Recipe Software .................................... 5-16
How to Transfer TCL Recipes from an IBM PC or VAX Computer ..................... 5-16
CREATEHow to Create a New Program or Include File.................... 6-4 EDITHow to Access the TCL Editor .................................................. 6-5 COMPILHow to Compile a Program.................................................. 6-5 LINKHow to Link a Program ............................................................. 6-6 XFER (SAVE)How to Make Backup Copies of Programs and Include Files to Other Disk Devices ....................................................... 6-7 XFER (RESTORE)How to Load (Restore) Backup Copies ............... 6-8 DELETEHow to Delete a Program or Include File ............................ 6-9 COPYHow to Copy a Program and Store it Under a Different Name 6-9 PRINTHow to Print a Hard Copy of a Program or Include File....... 6-10 NEW PRINTRHow to Select a Different Printer.............................. 6-10
vi
CONTENTS (continued)
6.2.12 6.2.13 DIR LISTHow to Print a List of the Items on the Catalog ............... 6-10 EXIT ..................................................................................................... 6-10
INDEX
vii
ILLUSTRATIONS
Figure 2-1. Figure 2-2. Figure 2-3. Figure 3-1. Figure 3-2. Figure 3-3. Figure 3-4. Figure 3-5. Figure 4-1. Figure 5-1. Figure 5-2. Figure 5-3. Figure 5-4. Figure 5-5. Figure 5-6. Figure 5-7. Figure 5-8. Figure 5-9. Figure 6-1. Figure 6-2. Figure 6-3. Figure 6-4. Figure 6-5. Figure 6-6. Example, Symmetrical Units ........................................................................ 2-2 Example, Recipe Display.............................................................................. 2-4 State Transitions............................................................................................ 2-6 Unit Relative Names Templet ....................................................................... 3-2 TCL Runtime Templet .................................................................................. 3-5 TCL Mailbox Templet .................................................................................. 3-6 Unit Master Templet ..................................................................................... 3-9 Unit Master Templet, List View.................................................................. 3-10 Historical Data on a Current Trend Graph.................................................. 4-28 Recipe Catalog Display ................................................................................ 5-3 Second Level of Softkeys ob Recipe Catalog Display ................................. 5-5 CREATE Softkey Set for Recipe Catalog Display ....................................... 5-5 Recipe Editor Display................................................................................... 5-7 ADD Softkey Set .......................................................................................... 5-7 COMPIL Softkey Set.................................................................................. 5-11 XFER KEYS Softkey Set ........................................................................... 5-13 Disk Keys.................................................................................................... 5-14 LOAD Softkeys........................................................................................... 5-14 TCL Catalog Display .................................................................................... 6-3 Second Level of Softkeys on TCL Catalog Display ..................................... 6-4 COMPIL Softkeys ........................................................................................ 6-5 XFER Softkeys ............................................................................................. 6-7 Disk Softkeys ................................................................................................ 6-8 LOAD Softkeys............................................................................................. 6-8
viii
TABLES
Table 4-1. Table 4-2. Table 4-3. Table 4-4. Table 4-5. Table 4-6. Table 4-7. Table 4-8. Table 5-1. Table A-1. Table A-2. Table A-3. Table A-4. TCL Functions.............................................................................................. 4-9 Program Control Parameters ...................................................................... 4-20 Recipe Parameters ...................................................................................... 4-21 FILESYS_INCL File.................................................................................. 4-41 Abnormal Conditions ................................................................................. 4-49 Fatal Abnormal 4 Conditions .................................................................... 4-50 _TCLACCESS Commands ....................................................................... 4-71 _TCL_ACC_INCL.TCL File Contents ..................................................... 4-73 Recipe Example............................................................................................ 5-1 ASCII Control Code to Ordinal Number Conversion Table ........................A-1 ASCII Character to Ordinal Number Conversion Table ..............................A-2 Abnormal Conditions ...................................................................................A-3 Program Control Parameters ........................................................................A-3
ix
Chapter 1 Introduction
TCL programs can run on Multibus-based subsystems, control modules in either 6000-series or SC Controller subsystems, or Advant Stations equipped with the Real Time Accelerator Board for on-line functions. TCL applications can run independent of, or in conjunction with Configurable Control Functions (CCF) and Taylor Ladder Logic (TLL). NOTE In this book, a subsystem or control module is often referred to as a node (for example TCL development node or TCL runtime node). There are two platforms for TCL program and recipe development: a multibus-based TCL development node (data processor) in conjunction with a console subsystem an Advant Station running AdvaBuild TCL Builder software
The Multibus-based TCL development node supports all aspects of TCL development including compiling and linking. The Advant Station may support compiling and linking if it is connected as a subsystem on the Advant OCS Distributed Communications Network (DCN). If the Advant Station is off line (not connected on the DCN), TCL sequence files developed on the Advant Station will have to be transferred via a serial interface to an on-line TCL development node in order to compile and link the TCL sequences. NOTE The Multibus-based TCL Editor and Recipe Editor are not supported on the Advant Station platform. If you want to use the Advant Station for TCL development, you must use the AdvaBuild TCL Builder.
1-1
1-2
2.1 General
TCL is modeled after Pascal and has some functional elements that are similar to those found in Pascal such as compound statements, IFTHENELSE statements, and so on. There are also many functional elements unique to TCL. These unique elements are designed to facilitate software development for process control in the Advant OCS environment. This section provides an introduction to the unique functional elements of TCL. It also provides an introduction to data base configuration requirements, development support and runtime support for TCL.
2-1
2-2
Program hierarchy is as follows: schedules are the top level, followed by procedures and then operations. A TCL program can invoke the execution of another TCL program through an external program call. When an external program call is used, the calling program must be higher in the TCL program hierarchy than the program that it calls. Thus a schedule can call procedures and operations, and procedures can call operations. The external program call is one of a number of methods for invoking the execution of a TCL program. The relation of program hierarchy to external program calls is described briefly in the following paragraph. This and other methods for invoking program execution are described in greater detail later in this section. The hierarchy of schedules, procedures and operations is designed to accommodate the logical organization of a plant manufacturing cycle. For instance, consider a manufacturing cycle where the cycle is subdivided into the following phases: fill, mix, heat, drain and rinse. Each phase is controlled by a separate TCL operation. The entire manufacturing cycle is controlled by operations alone; however, manual intervention is required to transfer control from one operation to the next. A procedure imposes a first level of supervisory control over the process by directing the transfer of control from one operation to the next without manual intervention. A schedule imposes a second level of supervisory control by directing the transfer of control from one procedure to the next to allow many manufacturing cycles to run without manual intervention. Batch 300 can be used to provide the levels of supervisory control imposed by schedules and procedures.
2.5 Recipes
Recipes provide the means to store data for TCL programs. For instance, a TCL recipe holds various setpoint values, high/low limits and other data required for one or more TCL programs that control a specific product manufacturing cycle. A second manufacturing cycle may use the same programs with a different recipe. A unit can be loaded with one recipe at a time. The recipe data is accessible by all TCL programs running on the unit.
2-3
A recipe is made up of items. Each item in a recipe has the following data associated with it: value, engineering units, item ID, high limit and low limit, and descriptor, Figure 2-2.
2-4
Every unit has a Unit Master Templet associated with it as described in Chapter 3, Data Base Templets for TCL. This templet provides the means to specify the name of a TCL supervisory program that can handle downloading and activating of other TCL programs for the unit at initialization time. Programs and recipes may be removed from the CCF loop, Advant OCS device and/or unit to which they were downloaded when they are no longer required. The Remove function can also be invoked by a console operator through the Unit Detail Display, or by another TCL program via the REMOVE statement.
These parameters and the TCL statements for manipulating them are described in the following sections.
2.7.1 State
There are three possible TCL program states: inactive, active and paused. Allowed state transitions are shown in Figure 2-3. When the TCL program is downloaded, the initial state is inactive. A program that is inactive is not processed until its state is changed to active. All the programs that are active on a given Advant OCS device are executed on a timesharing basis according to their priority level, status and mode. Activation of TCL programs and parallel processing are described further as separate subjects later in this section. An active program becomes inactive when the END statement marking the end of a TCL program is executed. A program is aborted prior to its end through the ABORT statement.
2-5
An active program can also be paused through execution of the PAUSE statement. When paused, program execution is temporarily suspended. A paused program is resumed through execution of the RESUME statement.
Abort
Inactive
Pause
Figure 2-3. State Transitions
2.7.2 Status
The status of a TCL program is normal or abnormal. When the status is normal, the program executes according to the other dynamic parameters. Normal is the default status when the program is downloaded. The status changes from normal to abnormal when any one of 16 possible abnormal conditions occurs There are eight predefined abnormal conditions. The remaining eight are user-defined. A user-defined abnormal condition is established by implementing logic to detect the abnormal condition and then associating an ABNORMAL statement with the logic. For example: EVENT CONDITION NO.. 7 SETEVENT ($CV101.MEASURE < LOWLIMIT); ACTION (ABNORM (7), CHARGE, UNIT1); ENDEVENT In this case, when the measured value for tag CV101 becomes less than the value defined by LOWLIMIT, the status of the program named CHARGE running on UNIT1 is changed to abnormal condition 7. Predefined abnormal conditions do not require detection logic. The system automatically monitors for these abnormal conditions.
2-6
Control is passed to a specific subroutine when a normal-to-abnormal status transition occurs. This is done by associating a subroutine with a specific abnormal condition through an ABNORMSUBR statement. When the transition to abnormal occurs, control is passed to the specified subroutine. For example, in ABNORMSUBR (ABNORM(1), SHUTDOWN (HOUR)); the SHUTDOWN subroutine is associated with abnormal condition 1. When abnormal condition 1 occurs, the program invokes the SHUTDOWN subroutine and passes an integer parameter called hour to the subroutine. If no association is made between a subroutine and an abnormal condition, the program is placed in the paused state when the abnormal condition occurs. A discussion of the Abnormal statement and a table of abnormal conditions is provided in Section 4.16, Program Control Statements.
2.7.3 Mode
Mode establishes the method for stepwise execution of an active program. The possible program modes are: Auto, Semiauto and Manual. In auto, the program executes one step after another automatically without manual intervention. In manual, the program pauses after each step and waits for an operator command (via Sequence Detail Display) to execute the next step. While in manual, the program pauses at designated breakpoints set up by the Sequence Debug Display (see Section 2.20.2, Debugging). In semi-auto, steps are skipped and/or repeated through operator intervention on the Sequence Detail Display. Mode is manipulated from the Sequence Detail Display, or by direct reference to the mode parameter in a TCL program.
2-7
This structure is bounded by the EVENT and ENDEVENT statements. Within the structure is a SETEVENT statement and one or more ACTION statements. The SETEVENT statement specifies the condition under which the state transitions occur. Up to two conditions can be coupled with a Boolean operator. The ACTION statement(s) define the transitions and related parameters such as priority, program name and unit name. For example: EVENT RESTART SETEVENT ($CV101.STAT = #OPEN OR $CV201.STAT = #OPEN); ACTION (ABORT, SEQUENCEA, UNIT1); ACTION (ACTIVE (4), SEQUENCEB, UNIT1); ENDEVENT; This event aborts SEQUENCEA on UNIT1 and activates SEQUENCEB at priority level 4 on UNIT1 when the following condition is met: CV101.STAT or CV201.STAT is open. An event is armed when the ENDEVENT statement is executed. This means the system looks for the condition(s) specified by the SETEVENT statement and executes the state transitions specified by the ACTION statement(s) when the conditions are met. The event remains armed until a CLEAREVENT statement is executed, even when the program where it is defined is aborted. For example: CLEAREVENT (RESTART); Timer State, status and mode transitions are manipulated through timing functions in TCL programs. Timing functions in the form of a one-shot timer, cyclical timer, or time-of-day timer are associated with an EVENT as follows. For example: HOUR:= TIME(3) IF (HOUR = 12) THEN EVENT RESTART SETEVENT ($CV101.STAT = #OPEN OR $CV201.STAT = #OPEN); ACTION (ABORT, SEQUENCEA, UNIT1); ACTION (ACTIVE (4), SEQUENCEB, UNIT1); ENDEVENT;
2-8
Taylor Control Language Users Guide Section 2.8.2 External Program Calls
Operator command from the console via the Unit Detail or Sequence Detail Display Execution of a UCAL FCM in the CCF Software
To associate a TCL program with a specific CCF loop, the program must be downloaded to the loop via the LOAD statement in another TCL program. Priority is established for each program on an individual basis when the program is activated by one of the aforementioned methods. Programs that are activated by CCF (interrupting digital input loops or UCAL FCMs) always run at priority level 0. Programs that are activated from the console always run at priority level 1. Abnormal subroutines are also given a priority level based on the abnormal condition that activates them. The number of TCL programs that are active on an Advant OCS device at one time is userdefined on the TCL Runtime Templet associated with that device. Parallel programs execute on a timesharing basis according to their priority as described in the following paragraphs. When All Programs Have Same Priority Level When a number of TCL programs with the same priority are activated for a particular device, one program is processed at a time. The first program is allowed to execute a slice of code until it is interrupted by the Runtime Executive Interpreter. At this time, the Runtime Executive Interpreter transfers control to the next program. This program executes a slice of code and then is interrupted as described above. All the programs are executed slice by slice in a cyclical fashion, and in this manner are executed virtually concurrently. When Programs Are Prioritized When a number of TCL programs are activated for a particular device and some are given a higher priority than others, the program with the highest priority is executed first. When the Runtime Executive Interpreter interrupts the program, control is passed to another program having equal priority. If no other program has equal priority, control is given back to the original program and it is allowed to execute to completion unless paused by some means such as a WAIT statement. Then control is given to the program with the next highest priority.
2-9
When an external program is invoked by an external program call, execution of the calling program is suspended while the external program executes. When the external program is finished, control is returned to the calling program and its execution resumes at the point where it was suspended. If the external program aborts, the calling program must also be aborted. Parameters are passed from the calling program to the external program by value only. This means that the parameter retains its original value in the calling program, and any new value that the parameter takes on in the external program cannot be passed back to the calling program. An example of an external program declaration and external program call is shown below. In this example, two external programs (COOK and STRIP) are declared and invoked in a schedule program called MONDAYS. The external programs are both procedures and both have a parameter list that contains two string parameters (x and y). When an external program is invoked, the two string parameters are passed two literal string values (BATCHn and RECIPEn) by the schedule program. For example: SCHED MONDAYS; EXTPROC COOK (x, y: STRING); EXTPROC STRIP (x, y: STRING); BEGIN STEP COOK B WITH REC1 COOK (BATCH1, RECIPE1); ENDSTEP STEP COOK B WITH REC2 COOK (BATCH2, RECIPE2); ENDSTEP STEP STRIP B WITH REC9 STRIP (BATCH3, RECIPE9); ENDSTEP END.
2-10
Parameters accessible by TCL programs include: Loop and Function Class Module (FCM) parameters Control block parameters TCL and Batch 300 recipe parameters Unit variables Unit array variables
2-11
2-12
Taylor Control Language Users Guide Section 2.10 Report Services And History Services Interface
2-13
2-14
Taylor Control Language Users Guide Section 2.18 Data Base Configuration Requirements
REPEATUNTIL WHILEDO GOTO Subroutines Local variables (including arrays) and constants Arithmetic, relational and Boolean operators Mathematical, trigonometric, string, date, and time functions
These templets must be configured in the system data base. Detailed information regarding these templets is provided in Chapter 3, Data Base Templets for TCL.
2-15
in a source file. The editor includes processing functions such as insert text, delete text, search and replace, cut and paste, and so on.
When TCL development is done via an Advant Station, you can schedule files for compilation and linking either remotely (if the Advant Station is off-line and not equipped with a Real-time Accelerator Board), or locally (if the Advant Station is on-line and equipped with a Real-time Accelerator Board). This functionality is described in 3BUR000206R0001 TCL Builder Users Guide.
2-16
2.20.2 Debugging
The Sequence Debug Display provides the means to locate and correct runtime errors in TCL programs while the program is executing. The program statements are presented in source statement format on the Sequence Debug Display, which includes the following debug tools. Statement Trace Statement Trace tracks the chronological order of the last 12 statements executed. This function can be enabled or disabled at any time. When Statement Trace is complete, the trace history, which shows the chronological order of the executed statements, is called to an overlay on the Sequence Debug Display for viewing and analysis. Breakpoints Breakpoints allow the testing of program logic by providing manual control over program execution. When a program has Breakpoints set up, it executes statements until a statement with a Breakpoint is encountered. The program pauses on this statement until commanded to resume execution by a console operator. The program also pauses on each STEP boundary as defined by a STEP/ENDSTEP structure. Breakpoints are set up at the source code level during the testing phase via the Sequence Debug Display, which shows the program source code and allows for the addition and deletion of Breakpoints. A program can have as many as five Breakpoints set at the same time. It is possible to disable or enable the recognition of breakpoints without disturbing any previously set Breakpoints. Variable Trace with I/O Lockout Variable Trace is used to display/modify TCL local variables and to inhibit process I/O during debugging of a program. Because of the inhibiting capability, a new program is debugged at the same time the system is controlling the process. Up to four of the loops or process devices referenced by the program can be isolated from actual field value changes with I/O lockout. In addition, input values of the loops or process devices can be set manually in order to control the program logic. The facility is disabled or enabled without disturbing the list of items that are locked.
2-17
2.20.3 Program Control Through Unit Detail and Sequence Detail Displays
The dynamic program control parameters that are stored in the control block (state, status, and mode) are manipulated by an operator using the Unit and Sequence Detail Displays. Manipulation of these parameters provides the means to activate, abort and pause programs; to transfer control to an abnormal subroutine in the event of an abnormal condition; and to control the stepwise execution of the program. These parameters can also be manipulated through the execution of TCL statements as described in Chapter 4, TCL Language Specifications.
The entries that must be made to the Configuration Area Templets to allow these messages to be routed to their destinations are described in instruction book B100, System Configurator Users Guide (when using the Multibus-based database configuration platform), or AdvaBuild Engineering Methods (when using the Advant Station-based configuration platform). In addition, if the correct conditions exist, changes made to data base variables by TCL programs are logged as CCF Event Messages. This feature is described in detail in Section 4.23, Updateon And Updateoff Statements.
2-18
Taylor Control Language Users Guide Section 2.20.7 Sequential Function Chart (SFC) Display Functions
The STEP_ACTIVITY, STEP_CONDITION, and STEP_TRANSITION structures in TCL provide the means for the TCL programmer to convey information regarding the status of actions and state transitions to the system operator via the SFC display during runtime. NOTE While SFC functionality is currently available in TCL (that is, the related statements can be used in and will be executed in TCL programs), the SFC display may not be available yet.
2-19
Three-Segment Processing You can design sequences for three-segment processing: prior to arming a STEP_TRANSITION while the STEP_TRANSITION is armed after the STEP_TRANSITION is triggered, but before the next step is entered.
Branching Multiple STEP_TRANSITIONS can be armed at once within a given step. Each STEP_TRANSITION can specify a separate path for the program to take (via GOTO statement).
2-20
3.1 Overview
The nodes (subsystems or control modules) where TCL development and runtime functions occur require the following templets configured in the Advant OCS database. (Templets are referred to as data base objects when configuring with AdvaBuild Structure Builder.) The templets for TCL program development are: TCL Development templet This templet establishes TCL development functionality in the node it is assigned to. At least one TCL development node is required for TCL development. U_REL_NAMES (Unit Relative Names) templet This templet establishes the unit symmetrical names structure for the system. This templet is needed if TCL and/or the Display Builder use unit symmetry. The templets for TCL program execution are: TCL Runtime templet One of these templets is required for each node that executes TCL programs. Unit Master templet This templet establishes a unit where programs can be specified to execute. There can be multiple units. Each requires a separate Unit Master Templet. TCL Mailbox templet This templet establishes a mailbox for communication between programs. There can be multiple mailboxes These templets are only needed if the TCL programs use the mailbox feature. This section describes the contents of these templets. Instructions for accessing and configuring these and other data base templets are provided in the System Configurator Users Guide (for Multibus-based configurator) and AdvaBuild Basic Functions Users Guide for Advant Stationbased configurator.
3-1
Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL
Figure 3-1. Unit Relative Names Templet Now, one TCL program can be run on any of the three units. When a TCL statement references a rinsevalve, it uses the unit relative name RINSEVALVE instead of the actual tag names. When the program is run on UNIT1, the system knows that RINSEVALVE refers to loop RV100. When the program is run on UNIT2, the system knows that RINSEVALVE refers to RV200, and so on.
3-2
Taylor Control Language Users Guide Section 3.4 TCL Runtime Templet
Rules for making the three entries required for each line in the edit window are: Unit Identifier The unit identifier is the name of a specific unit (for example, UNIT1, UNIT2, etc.). The unit identifier must be entered exactly as it is defined in the TEMPLET NAME field on the Unit Master Templet for that unit. Unit-Relative Name The unit-relative name is the generic name given to one element that is common to symmetrical units. The unit-relative name can be up to 12 characters with the first character being a letter. Actual Tag Name The actual tag name is the tag assigned to the loop via the TEMPLET NAME field of the Loop Definition Templet (continuous loops) or the Device Loops Templet. Export to Devices (EXPORT) This field is only used if you are using multiple configurators and if items in other configurator domains reference this unit. The entry to this field is a string of numbers listing the higher order bits of the configurator data processors to receive the export data. For example, the entry EXPORT TO DEVICES: 125B specifies the data is to go to configurators at addresses 11, 21, 51, and B1. The templet information goes into the EXPORT SOURCE field when you select the ACCEPT SAVE softkey. A description of the Export feature is provided in instruction book B100, System Configurator Users Guide, and AdvaBuild Engineering Methods.
3-3
Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL
Max # of Active Seq This field is used to specify the maximum number of TCL programs that can be in the active or paused state for the node that this templet is associated with. Max # of Simu Events This field is used to reserve memory space for events that are set by user programmable methods for this node. To find the entry, calculate the following two numbers, and ENTER THE LARGER OF THE TWO NUMBERS. Maximum Number of Local EVENT/ENDEVENT Structures is the maximum number of EVENT/ENDEVENT structures that can be in the armed state for all TCL programs that are loaded on the node or subnode (controller). Armed refers to the condition where an EVENT statement has executed and the actions specified in the ACTION statement(s) is executed whenever the conditions in the SETEVENT statements are satisfied. An EVENT/ENDEVENT structure remains in the armed state until the CLEAREVENT statement is executed. Maximum Number of Event Conditions Set by any User Programmable Source on Local Data Base Variables is the maximum number of event conditions on variables in this node that can be set by any TCL or VAX program from this or any other node. When you count the conditions, remember that a SETEVENT statement that uses an expression containing two data base variables sets event conditions on both variables. Remember that the entry should be the larger of the two numbers, that is, if the number of local EVENT/ENDEVENT structures is 4, and the number of local event conditions set by programmable sources is 15, enter 15. Max # of Actions This field is used to specify the maximum number of actions that occur in armed EVENT/ENDEVENT structures (i.e., the maximum number of actions that have the potential to be executed as a result of all armed EVENT/ENDEVENT structures). Max # of Abnorm Cond This field is used to specify the maximum number of associations that can exist between abnormal conditions and ABNORMSUBR statements in all the TCL programs that are active or paused for the device. Each unique condition that is used in an ABNORMSUBR statement in a TCL program counts as one association. Thus, one TCL program can have up to 16 such associations (total number of possible abnormal conditions). The maximum number of associations for a device is determined by adding up the total number of links for each program. Thus, if one TCL program running on a device has 16 associations and a second TCL program running on the same device has 14 such associations, the total number is 30. Max # of Parameters This field is used to specify the maximum number of parameters that can be passed via ABNORMSUBR statements in all active and paused TCL programs for the device.
3-4
Taylor Control Language Users Guide Section 3.4 TCL Runtime Templet
External Data Rate This field specifies the rate at which TCL accesses data from loops that are outside of this node. The default is 1 second. Any value from 0.5 to 4.0 seconds can be entered. Larger entries result in less load on the processor. If a value greater than 4.0 seconds is entered, a diagnostic message is issued and TCL runtime uses 4.0 seconds. Concurrent Ext Subrs This field is used to specify the maximum number of external subroutines that can execute simultaneously in the device, that is, without waiting for another external subroutine to finish. The entry is an integer from 0 to 8. Maximum Ext Subr Stack This field reserves a portion of memory as a stack to be used by external subroutines. The entry is an integer number of bytes. The default is 350. You can find a subroutines size in its compiler summary in its listing file.
3-5
Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL
3-6
Taylor Control Language Users Guide Section 3.6 Unit Master Templet
3-7
Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL
exactly as it is defined in the TEMPLET NAME field on the Report Builder Templet for the node where the Reports package runs. Integer Var Name, Real Var Name, String Var Name These fields are used to define names for global variables for all TCL programs running on the unit. Variable names can have up to 12 characters with the first character being a letter. These names cannot be keywords. They must be declared as unit variables in the programs that use them. They cannot be declared as variables in other TCL programs running on the unit. Device (Template) Names and Relative Device Names (RECDEVNAME) These fields are two columns in an edit window. All nodes that are part of the unit must be listed in the DEVICE (TEMPLATE) NAME column. The RELATIVE DEVICE NAME (RECDEVNAME) column allows you to associate a relative name with a node that is used for symmetrical units. Entry rules for these two columns are as follows: Device Name This column is used to list names of the Advant OCS nodes that are included in this unit. The names must be entered on the Unit Master Templet as they appear on the respective GENERIC DPSS and CONTROLLER Templets. Relative Device Name This column can be used to assign unit relative names to the Advant OCS nodes that are common to symmetrical units. Entries are only needed for those nodes that are to have unit relative names. A generic program can make reference to the relative node names and be applied to multiple units that are symmetrical. For instance, consider that two symmetrical units have common temperature controllers (CNTL_1 and CNTL _2). These controllers are assigned a common reference name such as TEMP_CNTL on their respective Unit Master Templets. Then a TCL program is developed using the reference name instead of the specific node names. Export to Devices (EXPORT) This field is only used if you are using multiple configurators and if items in other configurator domains reference this unit. The entry to this field is a string of numbers listing the higher order bits of the configurator data processors to receive the export data. For example, the entry EXPORT TO DEVICES: 125B specifies the data is to go to configurators at addresses 11, 21, 51, and B1. The templet information goes into the EXPORT SOURCE field when you select the ACCEPT SAVE softkey.
3-8
Taylor Control Language Users Guide Section 3.6 Unit Master Templet
3-9
Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL
3-10
4.1 Conventions
This section describes the functional characteristics and syntax for the various components of a TCL program including constants, variables, operators, functions, commands and statements. Information in this section is arranged according to function. For example, information for all TCL statements for the Report Services interface is under the heading REPORT SERVICES INTERFACE. To find information on a specific TCL keyword such as REPORT, RECORD, STARTBATCH or TRENDON, consult the index. Statement formats are given to show the correct syntax. Statement formats in this book use the following conventions: Boldface Type indicates a required element. Italic Type indicates an optional element. CAPITAL LETTERS indicate elements to be entered exactly as shown. It is best to always use capitals for TCL keywords as capitals are valid for all keywords. Some keywords are not accepted in lowercase. Examples in this book of statements, functions, etc., are shown in CAPITAL LETTERS. Specific rules must be followed when using the names of data base items in TCL programs: When using a user configurable item such as a tag, an FCM name, a unit name, a unit relative name, or a unit variable, use capitals and lowercase letters in the same manner as was used when the item was configured. That is, if an item was configured with lowercase letters, use lowercase letters for it in the program. Use capitals for parameter mnemonics and for state labels for discrete variables. For example, the loop state parameter, LP_STATE, must always be in capitals and so must its two possible states, OFF and ON.
Lowercase letters indicate that the programmer must substitute a legal value or expression in place of the lowercase element. All punctuation such as commas, parentheses, semicolons, periods, etc., must be included where shown.
4-1
4.2.3 Format
TCL is a free format language. This means that indentation and spacing may be used at the programmer's discretion. In addition, non-executable comments can be placed in the declaration and/or executable part of a TCL program for documentation purposes. The following are examples of complete TCL programs. Both programs are functionally equivalent; however, the second example makes use of indentation and comments for readability and self-documenting purposes. Example 1: PROC HEATER; BEGIN STEP LOAD PWRUP LOAD (SEQUENCE, PWRUP); WAIT (15); ENDSTEP STEP LOADING ESD LOAD (SEQUENCE, ESD); WAIT (15); ENDSTEP STEP WAIT AND START PWRUP WAIT (30); ACTIVATE (PWRUP,3); ENDSTEP END.
4-2
Example 2: PROC HEATER; /*This program loads all required*/ /*sequences and activates the first sequence*/ BEGIN STEP LOADING PWRUP LOAD (SEQUENCE, PWRUP); WAIT (15); ENDSTEP /* */ STEP LOADING ESD LOAD (SEQUENCE, ESD); WAIT (15); ENDSTEP /* */ STEP WAIT AND START PWRUP WAIT (30); ACTIVATE (PWRUP,3); ENDSTEP END.
4-3
4.5 Operators
TCL provides three types of operators for use in expressions: arithmetic, relational, and logical. Arithmetic expressions yield either real (floating point) or integer values; relational and logical expressions yield a Boolean result; that is, the result is true (non- zero) or false (zero).
4-4
In an arithmetic operation, a value is generated via computations applied to constants or variables in the expression. If an error occurs during evaluation (for example, divide by zero), a runtime error message is posted and the largest integer or floating-point number is returned.
A relational expression uses one of the relational operators to perform a magnitude comparison. With the exception of string data, the two expressions used in the comparison can be any data type, but the result of the comparison is always Boolean, true (non-zero) or false (zero). String data can only use the equality and inequality operators. Due to the way floating point numbers are rounded off, avoid equality checks on floating point numbers. It is recommended that the value be compared with an acceptable deadband instead. Example: IF ($TC1.MEASURE >= 100.00) AND ($TC1.MEASURE <= 100.50) THEN BEGIN Statement; Statement; Statement; END
4-5
A logical expression uses one of the logical operators to perform Boolean algebra on two integers or real expressions. The result is either true (non-zero) or false (zero).
In the following example, the value of C is multiplied by the value of D. The result of this operation is subtracted from the quantity A + B. The final result is assigned to X. X:= A + B C * D; When parentheses are used in an expression or part of an expression, the expression inside parentheses is computed first, then the resulting value is used in further computations. For example, in the following statement the value of B + C is computed first, then the result is subtracted from A and assigned to X: X:= A (B + C); In the case of nested parentheses, priority is given to computing the values in the innermost parentheses. For example, in the following statement the value of C + D is computed first: A (B (C + D)) In the absence of parentheses in an expression involving operators of equal priority, the operations of equal priority are performed from left to right. String values can be concatenated in the same way number values are added. For example, the following two examples have the same result: X:= 'AB' + 'CD'; X:='ABCD'; NOTE String values are enclosed in single or double quotation marks.
4-6
Taylor Control Language Users Guide Section 4.5.5 Mixed Mode Expressions
4-7
4-8
Taylor Control Language Users Guide Section 4.6.3 Bit Manipulation Functions
Table 4-1. TCL Functions Category Function ABS (x) LOG(x) Mathematical SQRT(x) EXP(x) LN(x) ROUND(x) SIN(x) COS(x) Trigonometric TAN(x) COT(x) BIT_AND(exp1,exp2) BIT_OR(exp1,exp2) Bit Manipulation BIT_XOR(exp1,exp2) BIT_COMP(exp) BIT_SHIFT(exp,count) LEN(x) MID(x,y,z) ORD(x) String Manipulation CHR(x) ASTOI(x) ASTOR(x) ITOAS(x) RTOAS(x) Date and Time DATE(x) TIME(x) Absolute value of x. Common log of x. Square root of x. e raised to the power x. Natural log of x. Round the decimal portion of x. Sine of x (x in radians). Cosine of x (x in radians). Tangent of x (x in radians). Cotangent of x (x in radians). Bitwise AND of the two expressions. Bitwise OR of the two expressions. Bitwise exclusive OR of the two expressions. Bitwise ones complement of the expression. Bitwise shift of the expression. Positive count for left shifts, negative count for right shifts. Length of string value x. Return substring of z characters starting at position y (z and y >= 1) in string x. Ordinal (integer) number related to ASCII character. ASCII character related to ordinal number x. Returns integer number equivalent of ASCII string. Returns real number equivalent of ASCII string. Returns ASCII string equivalent of integer number. Returns ASCII string equivalent of real number. Date according to x. Time according to x. Description
4-9
4-10
Taylor Control Language Users Guide Section 4.6.5 Date and Time Functions
4-11
The program header has three formats depending upon the program type. SCHED name; PROC name (parameters); OPER name (parameters); where SCHED, PROC and OPER name parameters are the keywords for declaring schedules, procedures and operations, respectively. is the program name. are an optional list of parameters and their respective data types. When parameters of different data types are included in the parameter list, separate the various data types with a semicolon. For instance:
(RECIPE1: STRING; COOKTEMP: REAL; STEP_NO: INTEGER) In the following example the header declares a procedure named BATCH1 with a string variable named RECIPE1. This variable is passed its initial value by a schedule that invokes BATCH1. PROC BATCH1 (RECIPE1: STRING);
4-12
The External Program Declaration statement has two formats depending upon the type of program being declared. EXTPROC name (parameters); EXTOPER name (parameters); where EXTPROC and EXTOPER name parameters are the keywords for declaring procedures and operations, respectively. is the name of the external program being declared (as specified in the TCL catalog). is an optional list of parameters and their respective data types. This parameter list must be identical to the parameter list in the header part of the external program.
Once an external program has been declared, it can be invoked in the executable part of the program by simply using the name and optional parameter list in a TCL statement. In the following example, three external procedures (BATCH1, BATCH2 and BATCH3) are declared and then invoked in a schedule (MONDAYS). Each procedure has a parameter list consisting of COOKTEMP whose data type is REAL. Three variables (TEMP1, TEMP2 and TEMP3) whose values are passed to the procedures are declared and initialized in the schedule. Each time a procedure is called, the appropriate temp value is passed to the COOKTEMP parameter in the procedure. Example: SCHED MONDAYS; EXTPROC BATCH1 (COOKTEMP: REAL); EXTPROC BATCH2 (COOKTEMP: REAL); EXTPROC BATCH3 (COOKTEMP: REAL); VAR TEMP1, TEMP2, TEMP3: REAL; BEGIN STEP INITIALIZE TEMP1:= 1100.0; TEMP2:= 1250.0; TEMP3:= 1400.0; ENDSTEP /* */ STEP CALL BATCH1 BATCH1 (TEMP1); ENDSTEP /* */ STEP CALL BATCH2 BATCH2 (TEMP2); ENDSTEP /* */ STEP CALL BATCH3 BATCH3 (TEMP3); ENDSTEP /* */ END.
4-13
4.9 Constants
Constants are real, integer or string data that do not change during program execution. Constants can be unnamed or named. An unnamed constant is simply the literal representation of a value. For example, 2 is an integer constant, 2.5 is a real constant and abcdefg is a string constant. A named constant is a user-defined string that stores a constant value. Named constants can be used to improve readability and for self-documenting purposes. The constant name is an alphanumeric string of up to 12 characters. The first character must be a letter. The string cannot be a keyword; however, keywords can be embedded. For instance, HIGH is not a valid constant name but HIGHLIMIT is. Named constants must be declared in the declaration part. The format for a constant declaration is as follows: CONST name: type = value; where CONST name type value is the constant declaration keyword. is the user-defined constant name. is the data type REAL, INTEGER or STRING. is the value that the named constant represents.
More than one constant can be declared after the CONST keyword. Each Constant Declaration statement must be terminated with a semicolon. Example: CONST PI: REAL = 3.14; OVERFLOW: INTEGER = 200; TEXT: STRING = abcdefg; Any named constant that is declared can be referenced and manipulated in a TCL program as if it were a literal value. Example: IF ($FIC101.MEASURE = OVERFLOW) THEN $CV101.DEV_CMND:= #ON; An integer constant can be specified in hex using the notation 0X. Example: CONST HE: INTEGER = 0XA1F;
4-14
4.10 Variables
Variables are names that are used to represent values that can change during program execution. TCL has three types of variables: Local variables whose scope is limited to the program where they are declared. Data base variables that exist in the Advant OCS data base and whose scope is the entire data base. Recipe parameters which are a subset of data base variables. Unit variables that are created on a Unit Master Templet and whose scope is the unit where they are created.
More than one variable type can be declared without repeating the VAR keyword. Variable Declaration statement must be separated by semicolons. For example: VAR MAXVALUE: REAL; STATUS: STRING; RATE: INTEGER;
4-15
In addition, more than one variable of the same data type can be listed in succession. Each variable name must be followed by a comma and/or space, except the last one which is followed by a colon. For example: VAR MAXVAL, MINVAL, AVEVAL, CURRENTVAL: INTEGER; Any local variable that is declared in the declaration part can be referenced and manipulated in the executable part as if it were a literal value. Local variables must be initialized to some value before they can be used in an expression. This is done using the assignment operator (:=) and either an unnamed constant, a named constant or another variable of the same data type. For example: STEP INITIALIZE VARIABLES MINVAL:= 0; CURRENTVAL:= MINVAL; ENDSTEP
4.10.1.2 Arrays
An array is a local variable that can store multiple values in either one dimension (a row) or two dimensions (rows and columns). The array variable has the same local scope as the simple variable described above. The array declaration is as follows: VAR name: ARRAY [a..m, b..n] OF type; where VAR name ARRAY a m b n type is the keyword for declaring local variables. is the variable name. is the keyword for declaring an array. is an integer that represents the lower boundary for the first dimension. It can be between 0 and 32766. is an integer that represents the upper boundary for the first dimension. It can be between 1 and 32767. is an integer that represents the lower boundary for the second (optional) dimension. It can be between 0 and 32766. is an integer that represents the upper boundary for the second (optional) dimension. It can be between 1 and 32767. is the data type REAL, INTEGER, STRING, BYTES, or TWO_BYTES.
The maximum number of values in a dimension is 32767. In addition, the minimum value for a lower boundary is 0 and the maximum value for an upper boundary is 32767. Thus a dimension having the maximum number of values can be declared as 0..32766, or 1..32767, but not 0..32767. An example of an array declaration for a single dimension array is shown below. This array stores up to 10 integer values. VAR TENCARDS: ARRAY [1..10] OF INTEGER;
4-16
Taylor Control Language Users Guide Section 4.10.2 Data Base Parameters
An example of an array declaration for a two dimension array is shown below. This array stores up to 50 string values. VAR FIFTYCARDS: ARRAY [1..10, 1..5] OF STRING; Like simple local variables, arrays must be initialized. Again, this is done through the assignment operator. Data locations in arrays are accessed by specifying the coordinates of the data in brackets following the variable name as shown below. TENCARDS[5]:= 10; This statement assigns the value 10 to data position no. 5 in the array TENCARDS. IF (FIFTYCARDS [2,5] = 10) THEN ($CV101.DEV_CMND:= #ON); This statement looks at the value stored at row no.2, column no.5 of array FIFTYCARDS, and sets the device command parameter for CV101 on if the value = 10. Array assignment operations can be used to initialize or copy the contents of an entire array. A second type of array, called an array unit variable, is governed by different rules and is described in Section 4.10.4, Unit Variables.
4-17
General Methods of Access Data base parameters can be accessed by a direct data base reference such as an assignment statement, or by SET and FETCH statements. When a direct data base reference is used and the parameter is not local to the TCL program, the data base parameter is accessed and the specified function is performed at the next data base scan at the TCL External Data Rate (see Section 3.4, TCL Runtime Templet). This delay may cause unexpected results. If you want the data base parameter to be accessed and have the value set or read immediately, use the SET and FETCH statements. This is particularly important for functions that use two different tag attributes (for example, when setting the DEV_CMND attribute for a tag, and then reading the DEV_STAT). Example: SET($CV101.DEV_CMND,#OPEN); . . . FETCH($CV101.DEV_STAT,STATUS); IF(STATUS = #OPEN)THEN . . . SET and FETCH are described in Section 4.10.6, Fetch and Set. Direct data base access methods are illustrated in the following paragraphs. The Assignment statement is described in Section 4.10.7, Assignment Statement. Methods of Access for Loop and FCM Parameters Loop parameters are parameters that can occur only once within a loop. For instance, every loop can have just one measured value (MEASURE) parameter associated with it. Loop variables can be accessed and manipulated by any TCL program. A loop parameter reference in a TCL program has the following format: $tag.para where $ tag indicates a loop (or FCM) parameter reference follows. is the tag name given the loop on the Loop Definition Templet. NOTE para Example: $CV101.DEV_CMND:= #OPEN; This statement sets the device command parameter for CV101 to OPEN. If the first character in a tag name is a letter and the remaining characters are alphanumeric or underscored, then quotes are optional. If the tag name includes a hyphen, then quotes are required. is the parameter mnemonic (refer to instruction book B140, Data Base Tables, for lists of mnemonics).
4-18
Taylor Control Language Users Guide Section 4.10.2 Data Base Parameters
FCM parameters can occur in one or more FCMs within a loop. For instance, each FCM within a loop can have a result (RESULT) parameter; therefore, there can be more than one result parameter within the loop. As these parameters can occur more than once within a loop, a more specific method of reference is required. This is done by appending the FCM name to the tag name as shown below. $tag-fcmname.para where fcmname para is the unique name given the FCM on the FCM templet. is the parameter mnemonic (refer to instruction book B140, Data Base Tables, for lists of mnemonics). NOTE If the first character in a tag or FCM name is a letter and the remaining characters are alphanumeric or underscored, then quotes are optional. If the tag or FCM name includes a hyphen, then quotes are required.
The following is an example of an FCM parameter reference. Example: IF ($CV101-RES.OUTPUT = MAXOUT) THEN ($TIC101.SETPOINT:= 50.5); This statement looks at the value of the output parameter for the FCM named RES in loop CV101. If OUTPUT = MAXOUT (a locally declared constant or variable), then the setpoint for loop TIC101 is set at 50.5. Methods of Access for Unit Relative Parameters Loop and FCM parameters that have been assigned a unit relative name via the Unit Relative Names templet can be referenced by their unit relative name rather than by tag. These parameters must be declared using the DBVAR Declaration statement as described above. The format for referencing by unit relative name is as follows: *name.para; where * name para Example: *RINSEVALVE.DEV_CMND:= #OPEN; *TANKLEVEL-PID.RESULT:= 10.2; Methods of Access for Control Block Parameters Control block parameters are associated with dynamic program control such as state, status and mode. A complete list of control block parameters is provided in Table 4-2. indicates a unit relative variable reference follows. is the unit relative name assigned via the Unit Relative Names templet. is the parameter mnemonic.
4-19
Control block parameters are global since they can be accessed by any TCL program. They must be declared before they can be used in a program. Control block parameters must also be declared within the programs in which they are being manipulated. This is achieved using the DBVAR Declaration statement as described above. Control block parameters are referenced in a TCL program as follows: @program-unit.para where @ program unit para indicates a control block parameter reference follows. is the program name as shown in the TCL catalog. is the unit name as defined in the Unit Master templet. is the parameter mnemonic indicated in Table 4-2.
If a unit or program is not specified, the database reference is made to the program or unit which is executing the statement. Example: @STARTUP-UNIT1.SEQSTATE:= #ACTIVE; This statement sets the state parameter for the program called STARTUP running on UNIT1 to active. Table 4-2. Program Control Parameters Mnemonic CURSTEP CURSTMT INSTID NEXTSTEP PAUSTEP SEQMODE SEQSTATE SEQTYPE SSTATUS Data Type Integer Integer String Integer Integer Integer Integer Integer Integer #MANUAL, #AUTO, or #SEMIAUTO #ACTIVE, #PAUSED, or #INACTIVE #SCHED, #PROC, or #OPER #NORMAL, #ABNORMAL_1 thru #ABNORMAL_16 Unit name as defined on a Unit Master Templet Value
4-20
TCL recipe and Batch 300 recipe parameters are accessed using the formats: *RECIPE (itemid,unit).parameter OR *BATCH (itemid,unit).parameter where itemid parameter unit is the item ID of the item that contains the parameter. is the parameter mnemonic as given in Table 4-3. is an optional parameter. When unit is not specified, the parameter value comes from the unit that is executing the sequence. When unit is specified, the value comes from the specified unit (or in the case of *BATCH, when unit is specified, the value comes from the batch that has the specified unit booked). Table 4-3. Recipe Parameters Mnemonic RVALUE HI_R LO_R IVALUE HI_I LO-I SVALUE DESC ENGU RECIPEID Data Type Real Real Real Integer Integer Integer String String String String Description Value of real item High limit for a real item Low limit for a real item Value of an integer item High limit of an integer item Low limit of an integer item Value of a string item Descriptor of a string item Engineering units label for a string item Name of recipe Comments One per real item One per real item One per real item One per integer item One per integer item One per integer item One per string item One per string item One per string item One per string item
The following examples show TCL recipe variables in TCL program statements. $TC1201.SETPOINT:= *RECIPE(COOKTEMP).RVALUE IF($'TC1201'.MEASURE +10 >*RECIPE('COOKTEMP').HI_R) THEN FETCH (*RECIPE('COOKTEMP').RVALUE, TEMP1 SET (*RECIPE('COOKTEMP').RVALUE, 50.4 FETCH (*RECIPE('END_MSG').RECIPEID, MSG1 $'TC1201'.SETPOINT:= *RECIPE('COOKTEMP','UNIT1').RVALUE The following examples show Batch 300 recipe variables in TCL program statements. $TCL1201.SETPOINT:= *BATCH(COOKTEMP).RVALUE; IF ($'TCL1201'.MEASURE + 10 > *BATCH('COOKTEMP').HI_R) THEN...
4-21
For recipes, parameter mnemonics must be declared in DBVAR statements. For example. DBVAR RVALUE, HI_R, LO_R: REAL; ENGU, DESC: STRING A complete description of recipes is provided in Chapter 5, Recipe Development.
4-22
Taylor Control Language Users Guide Section 4.10.5 Variable Tags - VARTAGS
Example: LOAD (VAR, ARY1:ARRAY[1..10] OF REAL,UNIT1); The variable can be removed with a REMOVE statement in the form: label: REMOVE (VAR, name, unit); The Remove can only be performed when no program is using the variable. A unit array variable must be declared before it can be used by a program. The keyword is UNITVAR. For example: UNITVAR A,B,XYZ: ARRAY[1..*, 5..20] OF REAL; The end of array dimension is computed using the total array size that was specified at LOAD time. Unit array variables are used like other array variables during runtime, except that an optional unit name parameter allows arrays from different units to be accessed. Examples: XYZ[I,J]:= 5; (XYZ, UNIT2)[I,J]:= 4;
4-23
4-24
Taylor Control Language Users Guide Section 4.10.6 Fetch and Set
The possible types of items are: *name.para @program-unit.para Unit relative name and parameter for a unit relative tag. Program, unit, parameter for a control block parameter.
*RECIPE(itemid, unit).para Item identifier, unit, and parameter for a TCL recipe item. *BATCH(itemid, unit).para unitvar $tag.para $tag-fcmname.para Item identifier, unit, and parameter for a Batch 300 recipe item. Name for a unit variable. Loop or device tag and parameter. Loop tag, FCM name, and parameter.
These data base items are described in Section 4.10.2, Data Base Parameters, Section 4.10.3, Recipe Parameters, and Section 4.10.4, Unit Variables. value subroutine is a program variable that contains the parameter value after the fetch is performed and must match the data type of the parameter item. is a subroutine to execute if there is an error getting the value or if there is an associated data quality which is bad. If the subroutine parameter is omitted, execution continues when an error occurs. Therefore, a subroutine should be included if you want to trap a failure. are parameters that may optionally be passed to the subroutine by value only.
parameters
4-25
String Tags A string variable can be used to represent either tag or tag-fcmname. Unit relative string tags are not allowed. For example: $S1.SETPOINT If the string contains a tag with an embedded hyphen, be sure to define the variable using quotation marks around the tag. For example: S2 =: " TC100-AIN" You must use alternate types of quotation marks. Note in the above example that TC100 is enclosed in single quotes, while the whole expression is enclosed in double quotes. The first time a SET or FETCH is executed after a string variable is assigned to a given data base variable, the data base reference is resolved into a logical reference. This logical reference is an internal description of the exact location of the data base variable. The next time the statement is executed, the logical reference is available for use and the statement executes faster. It is best to avoid reassigning the string variable or using a different data base parameter because each reassignment causes the system to resolve the data base reference again. If you must reassign, do not do so more than once every 30 seconds.
parameters
In the following example, a SET statement is used to cause a transition request that activates a TCL program at priority 3. SET (@TCLPROG.SEQSTATE, ACTIVE (3)); The SET statement can be used to issue a command to a digital device. If the device is a type that has a status feedback, the program checks to see if the device has reached the desired state. If the desired state has not been reached, the program continues to check the status until a timeout period, which is configurable via the TIMER field of the Device Templet, has expired. At this time, the device is considered to be in a time-out alarm condition and the corrective subroutine is executed.
4-26
Taylor Control Language Users Guide Section 4.10.6 Fetch and Set
In the following example, subroutine FAIL is executed with a parameter value equal to 1 if VALVE B does not open within the time-out period limit. SET ($VALVEB.DEV_CMND, #OPEN, FAIL (1)); A device can also be manipulated by directly changing one of its parameters. For example $CV101.DEV_CMND:= #ON SET Statement for Trend Data One form of the SET statement is used to cause historical trend data to be displayed on Current Trend Displays at a Multibus console, or Advant Station. The statement has the form: label: SET (TRENDON, $tag, historical_node, subroutine (parameters)); where TRENDON $tag indicates that the trend data for the loop is to be updated. indicates the loop.
historical_node name of the Generic_DPSS templet for the node containing history with the trend data for the loop. subroutine is a subroutine to execute in case of error. If the subroutine parameter is omitted, execution continues when an error occurs. Therefore, a subroutine should be included if you want to trap a failure. are parameters that may optionally be passed to the subroutine by value only.
parameters
This statement can be used by programs executing in Multibus Subsystems, Advant Stations, or SC controllers. It cannot be used in 6000 series controllers. When the statement is executed, any information in the current trend data buffer for the loop is overwritten with information from the historical files. This means that TCL checks the current time and the trend rate for the loop. It then accesses the historical files and writes the 300 most recent data values for the variable into the current trend buffer. For example, if the loops trend rate is 12 seconds, TCL gets data points from 12 seconds ago, 24 seconds ago, and so on, up to 3600 seconds ago (12 * 300). The historical data can be normally saved data or it can be data entered via the RECORD statement of TCL. Figure 4-1 shows how trend data are displayed for the loop on the Current Trend Display. The graph displays 300 data points. The first part, labelled Historical Data, has values that come from the Historical Recorder. It starts at the beginning of the trend interval and goes to the point where the historical data runs out. After the historical data runs out, TCL maintains the graph at its last value to the point where the SET statement was executed. After that, current loop data are provided up to the present time. This current data can be data normally collected for the loop or you can use a special technique to cause the trend buffer to contain a constant value. This situation is illustrated in Figure 4-1. A description of the procedure follows.
4-27
To give the current data in the trend buffer a constant value: 1. 2. 3. Use RECORD statement to load values you want to show on Current Trend Display into historical recorder. These values are displayed in the Historical Data portion of Figure 4-1. Choose constant value for current data. Put loop in manual and write this value to loop MEASURE variable. This value is displayed in the Current Data portion of Figure 4-1. Execute the SET TRENDON statement for the loop. 200.000
SET TRENDON statement is executed Figure 4-1. Historical Data on a Current Trend Graph 4. Call up the Current Trend Display for the loop.
Current Time
The graph is displayed as shown in Figure 4-1. Each time the graph refreshes, the new current value is displayed at the constant value. When the last historical data is scrolled off the graph, the real current data is displayed for the variable in the standard fashion. This example describes one loop. A Group Trend Display can display up to 12 loops. You must execute a SET statement for each loop that requires historical data. If you do not execute a SET statement for a loop, its trend buffer contains current data which is displayed on the trend graph.
4-28
The Assignment statement can also be used to initialize and copy arrays. If the value portion (right side) of the statement is an expression, the resulting value is assigned to each element of the destination array. For example: INT_ARY:= X - 1; /*initialize an integer array*/
The expressions must be compatible. String arrays cannot be assigned numeric expression values or vice versa. This version of the statement cannot be used with unit array variables. If the right side of the statement is an array name (no indices given), a copy from the source to the destination array up to the size of the smaller variable is performed. It is a direct byte copy with no regard for data types. Mixed data types are allowed. Only the total array size of each variable is checked and unit array variables are allowed. For example: STR_ARY:= BYT_ARY; STR_ARY:= X + CHR(0); /*copy byte array to string array*/ /*initialize a string array*/
4.11 Units
The UNITS keyword is used to declare the units whose unit relative data base references must be resolved when the program is linked. Unit declaration is mandatory when the program is linked at compilation time (via the LINK or COMP & LINK softkey functions of the TCL compiler) and the program contains unit relative data base references. Unit declaration is optional when the program is not linked at compilation time (program is linked automatically each time the program is loaded). The Units Declaration statement must occur in the declaration part of the program and has the following format: UNITS unitnames; where unitnames Example: UNITS unit1, unit2, unit3; is a list of up to 100 unit names (as specified in their respective Unit Master templets). Names must be separated with commas.
4.12 Subroutines
TCL supports internal and external subroutines.
4-29
The subroutine call provides the means for the calling program to pass parameters (up to 16 maximum) to the subroutine. Parameters can be passed by value as in external programs, or they can be passed by reference. When a parameter is passed by value, the parameter in the calling program retains its original value, even if the value changes during execution of the subroutine (that is, the subroutine cannot pass a new parameter value back to the calling program). When a parameter is passed by reference, the subroutine manipulates the parameter as dictated by the Subroutine statements, and then returns the manipulated parameter back to the calling program. The subroutine must be internal to the program that calls it. It must be declared following all external programs, constants and variables. Limitations and syntax regarding parameter lists are described in Section 4.7, Program Header And Parameter Lists. The Subroutine statements must be entered prior to the BEGIN statement that marks the start of executable statements in the program. The Subroutine statements must be bounded by BEGIN/END statements. The STEP/ENDSTEP structure CANNOT be used in subroutines. The subroutine structure is shown below. SUBR name (VAR parameters); BEGIN statement; statement; END; where SUBR name VAR is the keyword for declaring a subroutine. is the subroutine name, up to 12 characters starting with a letter. is the keyword for passing parameters by reference (this option is only applicable when a parameter list is specified). If VAR is omitted from the parameter list, the parameters are passed by value. are the names and data types of the variables in the subroutine that data are being passed to by the calling program. As many as 16 parameters can be passed maximum. are keywords that mark the beginning and the end of subroutine statements.
parameters
BEGIN/END Example:
SUBR DRAIN (x: INTEGER); BEGIN x:= x * x; IF x = 100 THEN *DRAINVALVE.DEV_CMND:= #OPEN; END; In this example, since the parameter x is passed by value, the new value is not returned to the calling program. For example: SUBR FAIL (VAR y: INTEGER); BEGIN $CV101.DEV_CMND:= #CLOSE; y:= 0; END;
4-30
In this example, since the parameter y is passed by reference, the new value for y is returned to the calling program. Once a subroutine has been declared in a program, it can be invoked as often as required by specifying the subroutine name and parameter list (if any) in a TCL statement. For example: PROC HEATER; VAR PORT1, PORT2, STATUS: INTEGER; SUBR FAIL (x: INTEGER); BEGIN IF x = 1 THEN MESG (PERIPHERAL I/O FAIL, PORT1); IF x = 2 THEN MESG (PERIPHERAL I/O FAIL, PORT2); END; BEGIN STEP OPEN PORTS PORT1:= OPEN (DEVICE1); IF (PORT1 = -1) THEN FAIL (1); PORT2:= OPEN (DEVICE2); IF (PORT2 = -1) THEN FAIL (2); ENDSTEP END.
4-31
cannot pass a new parameter value back to the calling program). When a parameter is passed by reference, the subroutine manipulates the parameter as dictated by the Subroutine statements, and then returns the manipulated parameter back to the calling program. All parameters passed by reference to an external subroutine are (if the parameter was modified) automatically updated in backup memory at the end of the subroutine. All variables within an external subroutine are automatic, meaning temporarily defined on a stack. They are not kept between calls. When an external subroutine is invoked by an external program call, execution of the calling program is suspended while the external subroutine executes. When the external subroutine is finished, control is returned to the calling program and its execution resumes at the point where it was suspended. External subroutines can be INCLUDED in the calling sequence for interpreted execution so they may be debugged in that mode. If you use external subroutines be sure that the proper entries are made to the Concurrent External Subroutines and Maximum External Subroutine Stack fields of the TCL Runtime Templet as described in Section 3.4, TCL Runtime Templet. The statement for declaring external subroutines has the form: EXTSUBR name (VAR parameters); where EXTSUBR name VAR is the keyword for declaring an external subroutine. is the subroutine name. is the keyword for passing parameters by reference (this option is only applicable when a parameter list is specified). If VAR is omitted from the parameter list, the parameters are passed by value. contain names and data types of variables in the subroutine that data are passed to by the calling program. Up to 16 parameters can be passed. EXTSUBR ARSBR (I: INTEGER, VAR AR: ARRAY [1..480] OF REAL); ARSBR (56, RARY1);
parameters Examples:
4-32
Curly braces, {}, can be used in place of the BEGIN and END keywords wherever the BEGIN/END structure is used. The same punctuation rules for END apply to curly brace (}).
4-33
Punctuation after END (}) in a compound statement results in a null statement. Compound statements can be nested. For example: BEGIN statement1; statement2; BEGIN statement3a; statement3b; END statement4; statement5; END These examples show how a compound statement may be used in a conditional structure to associate multiple statements with one condition. The first example uses BEGIN/END. The second example is the same except that it uses brackets instead: IF ($TI101.MEASURE > 100.0) THEN BEGIN MESG (TURN FAN ON); WAIT (10); IF ($HS201.DEV_CMND:= #ON) THEN $HS201.DEV_STAT:= #ON; END IF ($TI101.MEASURE > 100.0) THEN {MESG (TURN FAN ON); WAIT (10); IF ($HS201.DEV_CMND:= #ON) THEN $HS201.DEV_STAT:= #ON;}
4-34
Example: IF (X >= Y) THEN statement1; statement2; statement3; If the result of the example above is true, statements 1, 2, and 3 are executed. If the result is false, statements 2 and 3 are executed. For example: IF (X >= Y) THEN statement1; ELSE statement2; statement3; If the condition is true, statements 1 and 3 are executed. If false, 2 and 3 are executed.
A semicolon (;) is required following END (}) in a CASE statement. In the following example, if PROD_TYPE evaluates to 1, 2 or 3, the statement having the matching constant in the CASE structure (statement 1, 2 or 3) is executed, and then statements 4 and 5 following the CASE structure are executed. If PROD_TYPE evaluates to some value other than 1, 2 or 3, none of the statements in the CASE structure are executed. Execution resumes with statements 4 and 5 following the CASE structure.
4-35
For example: CASE PROD_TYPE OF 1: statement1; 2: statement2; 3: statement3; END; statement4; statement5; In the following example, if PROD_TYPE evaluates to 1, 2 or 3, the statement having the matching constant in the CASE structure (statement 1, 2 or 3) is executed, and then statements 5 and 6 following the CASE structure are executed. If PROD_TYPE evaluates to some value other than 1, 2 or 3, the OTHERWISE statement (statement 4) is executed, and then statements 5 and 6 following the CASE structure are executed. For example: CASE PROD_TYPE OF 1: statement1; 2: statement2; 3: statement3; OTHERWISE statement4; END; statement5; statement6;
4-36
4-37
When GOTO is used to branch to another step, it must specify the beginning of the step (the STEP statement) and not any statement within the step. GOTO should be used only in unusual situations, such as error processing. The statement has the form: label: GOTO identifier; where identifier Example: GOTO 55; is the program line number (as specified by label for program line) where execution is resumed.
If OPEN is successful, port is set equal to the port number for the specified port. If OPEN is not successful, port is set equal to -1. Generally, the error code for fail is 0. For the OPEN statement (1) is used in place of 0 since 0 is a valid port number. Example: PORTX:= OPEN(DEVICE1);
4-38
4-39
This type of I/O does not perform any pre-processing of the data during operation. The information is transmitted directly to or from the port with formatting performed under the users control. Binary codes or checksums can be inserted into the array buffer and transmitted without conversion to ASCII.
4-40
Taylor Control Language Users Guide Section 4.15 Disk I/O Statements
To make the FILESYS_INCL file accessible by your TCL sequence, create the FILESYS_INCL file using the CREATE function on the TCL Catalog Display, and include the file in your TCL sequence via the INCLUDE statement. Having created and included the FILESYS_INCL file, you can create a file control block by a Declaration statement in the form: VAR FCB: ARRAY[FILE_FCBBEG..FILE_FCBSIZ] OF TWO_BYTES; NOTE If you are using the TCL Builder, you must upload and edit the FILESYS_INCL file. See the TCL Builder Users Guide for instructions on how to upload files.
4-41
The FILESYS statement has several forms: An Open must be performed on the file control block prior to using any other FILESYS statement except REMOVE a file. If you try to open a file that does not exist, the file is automatically created. status:= FILESYS(OPEN, fcb, path_name); An input copies records from disk into the buffer. status:= FILESYS(INPUT, fcb, buffer, rec_num); An output writes the buffer to the specified record. status:= FILESYS(OUTPUT, fcb, buffer, rec_num); Close the file when you are finished performing I/O. status:= FILESYS(CLOSE, fcb); To remove a file, the form is: status:= FILESYS(REMOVE, fcb, path_name); To remove a record, the form is: status:= FILESYS(REMOVE, fcb, rec_num); where status fcb path_name is a local integer variable that stores the error code. is a two byte array of sufficient size for the file control block. is a string variable indicating the file path. For example: "FD00:[220.MYSTUFF]FILENAME.EX" CAUTION All disk accesses should be limited to file path names using the user number 220, reserved for TCL users. Any other access could impede normal system performance or cause irrecoverable loss of system data. buffer rec_num is a variable of the desired record size. is an optional integer parameter indicating the record number. If it is not present, the next record is used. NOTE A successful FILESYS OPEN in TCL maintains a WC00 disk access lock until a FILESYS CLOSE is completed. This may affect other system functions such as tape backups. If TCL has access locked, tape backups are not allowed to run. In addition, unless TCL can obtain an access lock, the FILESYS OPEN will fail. This means that, if a tape backup is in progress, TCL is prohibited from gaining access. If the file that TCL is accessing is on FD00, an access lock for WC00 is still required.
4-42
Taylor Control Language Users Guide Section 4.16 Program Control Statements
device
Example:
4-43
device
Example:
The following examples are equivalent. Either format can be used as a matter of preference.
4-44
or WHILE (CHECK (SEQUENCE,BENCHOPER,UNIT2) = FALSE) DO WAIT (10); ACTIVATE (BENCHOPER,2,UNIT2); Be careful when performing a load of a recipe that may already be loaded. First execute a REMOVE statement to remove the existing recipe. Then use a CHECK loop to insure that the recipe has been removed. Then load the new recipe and use a check loop to insure that the new recipe has been loaded. This prevents a CHECK from succeeding on the previously loaded recipe and then an access occurring on old data or data that has been removed.
4-45
unit
*JOB
*BATCH
4-46
unit
*JOB
*BATCH
Example:
4-47
If the program that executed the EVENT statement is removed, the event is cleared as if the CLEAREVENT statement was executed. CLEAREVENT can be executed by a program other than the one that executed the EVENT statement. To do this, CLEAREVENT must specify the event name, the name of the program that executed the EVENT, and the name of the unit where the program executed. The event structure has the form: EVENT name SETEVENT (expression); ACTION (transition,program,unit); ENDEVENT ... CLEAREVENT (name, setup-program, setup-unit); where name expression is a literal string of up to 12 characters that identifies the event. is one or two relational expressions which must be met for the specified transitions to occur. The first part of each relational expression must be a data base variable, i.e., loop, FCM, or recipe variable. The second part of the expression can be a value or a data base variable. If data base variables from two loops are used, the loops must be in the same subsystem or controller. If you use two conditions, couple them with a logical expression (AND or OR). A special situation occurs when two conditions are coupled with an AND in the expression. When either condition is satisfied, it is latched as being satisfied. The ACTION statement is implemented as soon as the second condition is satisfied, whether or not the first condition is still satisfied. transition is one or more actions to be performed; actions include state transitions (ACTIVE(priority), ABORT, PAUSE, RESUME), mode transitions (AUTO, MANUAL), and status transitions (ABNORM(condition)).ACTIVE and ABNORM require that a priority or condition ranging from 1 (highest) to 16 be specified. The keywords ACTIVE and ABNORM are used in the ACTION part of an event rather than ACTIVATE and ABNORMAL. is the name of the program where actions are applied, as defined in the TCL catalog. The default is the program that executed the statement. is the name of the unit (as defined on the Unit Master templet); unit can only be specified when program is also specified. EVENT RESTART SETEVENT ($CV101.STAT = #OPEN OR $CV201.STAT = #OPEN); ACTION (ABORT, SEQUENCEA, UNIT1); ACTION (ACTIVE(4), SEQUENCEB, UNIT1); ENDEVENT statement; statement; CLEAREVENT (RESTART);
4-48
unit
*JOB
*BATCH
Example:
4-49
4-50
Taylor Control Language Users Guide Section 4.16.11 CRITICAL and NONCRITICAL Statements
Table 4-6. Fatal Abnormal 4 Conditions (Continued) Keyword Applies to external subroutine calls Applies to any subroutine call Applies to any statement using non-indexed VARTAG access Description UNITVAR array not big enough to pass to this EXTSUBR UNITVAR array not local to pass to subroutine Tag was not found in vartag list
Status of external sequence becomes abnormal Not enough parameters passed to external sequence Status of external sequence becomes abnormal Too many parameters passed to external sequence A separate ABNORMSUBR statement is required for each abnormal condition that requires an abnormal subroutine. When no abnormal subroutine is defined for an abnormal condition and that condition occurs, a system error message is logged and the program is paused. The statement has the form: label: ABNORMSUBR (ABNORM (condition), subroutine (parameters)); where condition subroutine parameters Example: ABNORMSUBR (ABNORM(7), SHUTDOWN (TIME)); is an integer from 1 to 16 that represents the abnormal condition being associated with the subroutine (see Table 4-5). is the name of the subroutine to be called should the condition occur (as defined in the subroutine declaration). are user-defined parameters that may optionally be passed to the subroutine.
4-51
If an abnormal condition occurs while statement 2 is being processed, statement 2 completes processing and the system takes its designated recovery action (either an ABNORMAL subroutine or a program pause). If an abnormal condition occurs while statement 4 is processing, statements 4 and 5 process before the program takes its recovery action. There does not have to be a one-to-one correspondence between CRITICAL and NONCRITICAL statements. For instance, in a program where conditional branching occurs, a CRITICAL statement may have two or more NONCRITICAL statements associated with it.
4.17 Report Services And History Services Interface 4.17.1 STARTBATCHENDBATCH Structure
STARTBATCH creates a batch file where data for a specific batch is recorded (see RECORD statement). If you use Multibus-based Reports Services, the batch file is created in the report generator node. If you use AdvaInform Reports, a batch task log is created on the Information Management Station (IMS). STARTBATCH also sends a timestamp to indicate when the file (or task log) was created. Batch files and batch task logs are described further in the Batch 300 Users Guide. The statement has the form: label: STARTBATCH (batch); where batch is a literal string or string variable of up to 20 characters STEP START BATCH BEGIN REPLY (ENTER BATCH NAME, STANDARD, BATCHNAME); IF (BATCHNAME < > ) THEN STARTBATCH (BATCHNAME); END ENDSTEP ENDBATCH sends the end time to the batch file (or batch task log) and releases the file for later use. Data can still be recorded to the batch file (or task log) until the file is reused by the Report Generator due to the number of STARTBATCH statements issued. The statement has the form: label: ENDBATCH (batch);
A REPLY statement makes it possible to enter a batch ID via the console. For example:
4-52
4-53
These statements have the form: label: TRENDON ($tag.para,batch); label: TRENDOFF ($tag.para,batch); where $tag-fcm.para or $tag.para For Multibus-based Reports Services, this is the loop and the loop parameter for which trend data is being collected. For AdvaInform Reports, this is the history log that you want to create a History Association log for. Enter the log name using one of the above formats. When the function is processed by AdvaInform History, the name is translated into the format required by AdvaInform History. Refer to the AdvaInform History Users Guide for further information. batch is the batch file created by STARTBATCH/ENDBATCH structure that stores the timestamps for Multibus-based reports. For AdvaInform reports, this is the batch task log whose batch the association is being created for. The timestamps generated by TRENDON and TRENDOFF are stored in the History Association Log rather than the Batch Task Log. Example: TRENDON ($CV101.SETPOINT);
4-54
node name
Example:
4-55
Example:
4-56
Taylor Control Language Users Guide Section 4.18 TCL Mailbox Interface
TRANS_CODE:= SEND (START_TIME, TIMESLOT, NOWAIT); The RECEIVE statement is used to remove a message from a mailbox. If there is no message in a mailbox when the RECEIVE statement is executed and the Wait option is used, the receiving program is paused until a message is sent. The statement has the form: status:= RECEIVE (variable, mailbox, wait); where status variable is a local integer variable that stores the error code (TRUE for successful or FALSE for failure). is a local variable of any type that stores the message being sent. If an array variable is used, the array data is used as the message, up to a maximum of 40 bytes. This is equivalent to 10 integer or real array elements. is the name of a specific mailbox as defined on the Mailbox templet. is the delay option desired (WAIT or NOWAIT). Example: TRANS_CODE:= RECEIVE (START_TIME, TIMESLOT, WAIT);
mailbox wait
4-57
priority Example:
priority response
4-58
timeout
is an amount of time in seconds. It can also be a real or integer variable. The program waits this amount of time for a response and then continues processing. If a timeout does not occur, the response variable returns with the operators reply. If a timeout occurs, the response variable retains whatever value it had prior to the REPLY statement execution. Thus, to check for a timeout, the response variable should be initialized before the REPLY statement is executed and tested after execution. REPLY (CONTINUE PROCESS: YES-NO?, HIGH, ANSWER); REPLY (CONTINUE PROCESS: YES-NO?, HIGH, ANSWER,90);
Examples:
priority
num
When a programmable unit alarm occurs, the MSG indicator on the display flashes continuously until the alarm is acknowledged. The alarm message is presented on the Unit Message Display. It is removed after the alarm is acknowledged and the program sends an alarm clear signal via the UNIT_ALARM statement. The order of the events is not important. If the program issues the clear signal first, the message stays on the screen until the operator acknowledges it. For example, the first statement generates alarm 6 on the unit; the second statement clears all alarms on the unit: UNIT_ALARM (VESSEL TOO HOT, MEDIUM, 6); UNIT_ALARM (VESSEL NORMAL, _CLEAR, _ALL);
4-59
4.20 Comments
Comments can be used to improve readability and/or to document the program. A comment may occur anywhere in a program. Although comments have no effect on program execution, they are presented in the program listing. A comment does not take up any memory space. A comment begins with a slash and an asterisk and is followed by any number of lines of text. Comments must end with an asterisk and a slash. Comments do not nest. The form is: /*string*/ Example: /*This is a comment.*/
4-60
Taylor Control Language Users Guide Section 4.23 Updateon And Updateoff Statements
4-61
If you want to modify a loaded subroutine or program, you remove it with a REMOVE statement in the form: REMOVE (UCAL,prog,tag); and load the modified version with a LOAD statement. For processing to occur, the CCF loop and UCAL FCM must be on. Use an Auto Load TCL program for the unit. The program can be designed to load all UCAL programs and subroutines for the unit at system initialization time, and turn on the CCF loops and FCMs when loading is complete.
DATA_ARRAY contains the values of inputs 1 to 4 of the UCAL FCM. Each time the loop runs, it acquires current values for the inputs to pass to the subroutine.
4-62
VALU_ARRAY contains the four scratchpad values of the UCAL FCM. When the node is initialized, the four scratchpad values are set to their initial values as specified by the Init Values for Var n fields of the UCAL FCM templet. During runtime, their values are determined by the TCL subroutine, that is, the values CCF passes to TCL are the values that TCL passed to CCF the previous time the UCAL finished executing. PROC_VAL should be used to store the result of the TCL subroutine. When the subroutine is finished, the UCAL FCM writes the value of PROC_VAL to its result.
DATA_QUALS the zeroth element of this array is the data quality of PROC_VAL. The TCL subroutine should set this value after it has made its calculation. Elements 1 to 4 are the data qualities related to the four elements of DATA_ARRAY. When the CCF loop executes, it sets these values to represent the current data qualities of the inputs. 0 indicates bad data, 1 indicates good. LOOP_ARRAY is an array that can be used if more data area is needed. The subroutines calculation result should be written to the PROC_VAL variable. Its data quality should be placed in the zeroth element of the DATA_QUALS array. When the external subroutine is finished, the UCAL FCM does some error checking. If no errors occurred, the value of the PROC_VAL parameter is copied to the UCALs RESULT parameter, and the value of the DATA_QUALS [0] parameter is copied to the DATAQUAL (result data quality) parameter. I/O, unit-related, and data base access statements cannot be used in synchronous UCALs. These statements are: PAUSE, SET, REPLY, FETCH UNIT_ALARM, INPUT, STARTBATCH, OUTPUT, ENDBATCH, *RECIPE, RECORD, ACTIVATE, TRENDON / TRENDOFF, MESG, REPORT. After you write the subroutine, you should compile it. CCF Loop Processing for a Synchronous UCAL A loop with a synchronous UCAL is processed in almost the same manner as a standard CCF loop. The events occur as follows: 1. 2. 3. 4. 5. The FCMs preceding the UCAL FCM are executed. The UCAL FCM is executed. It passes parameters by reference to the TCL subroutine. The CCF loop processor waits for the subroutine to complete processing. When the subroutine is finished, the UCAL FCM makes the result of the TCL calculation into its result. The remaining FCMs execute. The loop processor goes on to the next loop.
4-63
The UCAL parameters can be referenced in TCL programs by the following method: $'tag'-'FCM'.parameter For instance: $'TIC101'-'UCL'.DATA1
4-64
Thus, the program result (UCAL_DATA) can be passed to the PROC_VAL parameter in the UCAL as follows: $TIC101-UCL.PROC_VAL:= UCAL_DATA; Further information on UCALs is provided in B130, Configurable Control Functions (CCF). Configuring the Loop Containing an Asynchronous UCAL A loop with an asynchronous UCAL is configured in the normal manner. The loop must be given a processing rate at least twice the base rate of the node containing the loop. When specifying the processing rate, it should be remembered that the maximum time for the TCL program to complete its execution is somewhat less than the processing rate of the loop. Configuring the FCM for an Asynchronous UCAL Consider these points when configuring the UCAL FCM for use with an asynchronous UCAL. You can configure up to four inputs for the UCAL FCM using the INPUT SOURCE 1 through 4 fields of the templet. When the UCAL FCM is processed, the values of these inputs are sampled and placed in the DATA1 through DATA4 parameters of the UCAL FCM. These parameters and their respective data qualities, DAPL_F1 through DAPL_F4, can be accessed by the TCL program. The initial values of up to four scratchpad variables are configured via the INIT VALUE FOR VARIABLE 1 through 4 fields. These initial values are placed into the VAR1 through VAR4 parameters of the FCM, respectively. They can be accessed by the TCL program.
CCF Loop Processing for an Asynchronous UCAL A loop with an asynchronous UCAL is processed in a manner different from standard CCF loops. The events occur as follows: 1. 2. The FCMs preceding the UCAL FCM are executed. The UCAL FCM is executed. It starts the TCL program. The loop processor does not wait for the program to complete. It puts the loop with the UCAL FCM on quick scan. Any FCMs that follow the UCAL FCM are not processed at this point. The loop processor goes on to other loops. While the loop with the UCAL FCM is on quick scan, the loop processor does not wait till the next loop scan to check this loop. Instead it checks the UCAL FCM of the loop during every CCF base rate cycle. For example, if the loop scan rate is 4 seconds and the CCF base rate is 1 second, the loop is started and the UCAL FCM is processed between seconds 0 and 1. The UCAL FCM is checked between seconds 1 and 2, and, if necessary, between seconds 2 and 3, and 3 and 4. The action taken when the UCAL FCM is checked depends on the status of the TCL program. The possibilities are: If the program has completed, the rest of the UCAL FCM and the remaining FCMs of the loop are processed. The loop is put back on its normal scan rate and the loop processor goes to the next loop.
3. 4.
5.
4-65
f the program timed out (did not complete within the loop scan rate), the UCAL FCM is turned off, its data quality goes to BAD, the remaining FCMs of the loop are processed, and the loop is put back on its normal scan rate. The loop processor goes on to the next loop. If the program has not completed and not timed out, processing moves to the next loop. The loop with the UCAL FCM stays on quick scan. It is checked during the next CCF base rate cycle. However, the program must finish by the base rate cycle preceding the next normally scheduled loop scan. For example, if the loop scan is 4 seconds and the CCF base rate is 1 second, the program must be finished before the loop processor checks it between seconds 3 and 4. If the program does not complete in the allocated time, the UCAL FCM is turned off, its data quality goes to BAD, the remaining loop FCMs are processed, and the loop is put back on its normal scan rate.
runtime message is an optional message composed of any combination of variables and constants of any data type (string, real, or integer). The message can be up to 39 characters. Items (variables, constants) must be separated by a commas. Example: STEP_ACTIVITY WAIT TO DISSOLVE SOLIDS (WAIT FOR 5 MIN. TIME=,*TIMER.RESULT); Load-time text is displayed on the SFC display when the TCL program is downloaded.The runtime message replaces the load-time text when the statement is executed. The runtime message may include variables and constants which are evaluated when the statement is executed. If a runtime message is not used, the load-time message continues to be displayed when the statement is executed. The load-time text or runtime message (whichever is displayed) is highlighted in one of three user-defined colors to indicate the status of a particular activity: Base color Initially, the text/message is displayed in the base color. This indicates that the STEP_ACTIVITY statement has not been executed yet. Last-executed color When the STEP_ACTIVITY statement is executed, the text is highlighted in the Lastexecuted color.
4-66
Executed color When the next STEP_ACTIVITY statement is executed, the text of the previous Lastexecuted statement is highlighted in the Executed color. All statements that have been executed (except Last-executed) are highlighted in the Executed color.
A step can have as many STEP_ACTIVITY statements as required. When a sequence is activated, all STEP_ACTIVITY text/messages are displayed in the Base color. This provides a clean slate following a previous execution of the sequence. Also, when a step is entered, all STEP_ACTIVITY text/messages in that step are reset to the Base color. This provides for steps that are repeated within a sequence. STEP_ACTIVITY text/messages for statements that have been executed retain their color designation, even when the sequence state changes to inactive.
4.25.2 STEP_CONDITION
STEP_CONDITION conveys information on true/false conditions related to the step. The STEP_CONDITION statement has the following format: label: STEP_CONDITION load-time text (runtime message) statement; where label load-time text is an optional program label (unsigned integer) is an optional user-defined string and/or string constant (39 characters maximum) bounded by single or double quotation marks
runtime message is an optional message composed of any combination of variables and constants of any data type (string, real, or integer). The message can be up to 39 characters. Items (variables, constants) must be separated by a commas. statement is either an assignment statement (boolean, integer, or real, but NOT string), or an IF statement. The first database reference in this statement must be either an explicit tag name, unit relative tag, or VARTAG. REPEAT /*Goto done step when level reached or pump is off*/ STEP_CONDITION LEVEL>20% OR L1:=$LIC-1.RESULT>20; WAIT(1); STEP_CONDITION PUMP IS OFF GOTO DONE STEP P1:= *PUMP.DEV_STAT = #OFF; UNTIL (L1 = TRUE) OR (P1 = TRUE); GOTO 9; Load-time text is displayed on the SFC display when the TCL program is downloaded.The runtime message replaces the load-time text when the statement is executed. The runtime message may contain embedded variables and constants which are evaluated when the statement is executed. If a runtime message is not used, the load-time message continues to be displayed when the statement is executed. The load-time text or runtime message (whichever is displayed when the statement is executed) is highlighted in one of three user-defined colors to indicate the condition:
Example:
4-67
Base color Initially, the text/message is displayed in the base color. This indicates that the STEP_CONDITION statement has not been executed yet.
Executed False color When the STEP_CONDITION statement is executed, if the statement is false (result = zero), the text is highlighted in the Executed False color.
Executed True color When the STEP_CONDITION statement is executed, if the statement is true (has a non-zero result), the text/message is highlighted in the user-defined Executed True color.
A step can have as many STEP_CONDITION statements as required. When a sequence is activated, all STEP_CONDITION text/messages are displayed in the Base color. This provides a clean slate for all text/messages. Also, when a step is entered, all STEP_CONDITION text/messages within that step are reset to the Base color. This provides for steps that are repeated within a sequence. STEP_CONDITION text/messages for statements that have been executed retain their color designation, even when the sequence state changes to inactive. A link is provided to the first database reference in the embedded statement. This provides the operator with the means to manually control the referenced database point in the statement (that is set the condition to TRUE or FALSE). Access is allowed only after the statement has been executed and not before.
expression
4-68
GOTO
is the action that is performed. Other standard ACTION statements may also be included. The label must refer to a STEP, not a statement within a step.
Example: STEP_TRANSITION VALVES_OPEN,CHARGE VALVES OPEN, /*empty load-time text*/ SETEVENT (*CHRG_VALVES.DEV_STAT = #OPEN); ACTION (GOTO 7); ENDEVENT; NOTE Since there is only one SETEVENT expression in this example, the second loadtime statement is empty (). This statement is a variation of the EVENT structure described in Section 4.16.8, EVENT, SETEVENT, ACTION, ENDEVENT, CLEAREVENT Statements. STEP_TRANSITION provides the means to define two load-time text strings (one for each of two SETEVENT expressions that may be defined). This text is highlighted in one of three user-defined colors based on the status of the associated SETEVENT expression as described below: Base color Initially, the text is displayed in the base color. This indicates that the STEP_TRANSITION statement has not been executed yet. Evaluated False color The text is highlighted in the Evaluated False color when the event is armed (when the ENDEVENT statement is executed). This means the system looks for the condition(s) specified by the SETEVENT statement and executes the state, status and/or mode transitions defined in the ACTION statement(s) when the condition(s) are satisfied. An initial check to see if the condition has been satisfied is performed upon execution of the ENDEVENT statement. The event remains armed until the next step is entered, even when the program where the event is defined goes inactive. Evaluated True color The text is highlighted in the Evaluated True color when the event is triggered. A step can have as many STEP_TRANSITION statements as required. When a sequence is activated, all STEP_TRANSITION text is displayed in the Base color. This provides a clean slate following a previous execution of the sequence. Also, when a step is entered, all STEP_TRANSITION events for the current step and all previous steps are cleared and text associated with the events are reset to the Base color. This provides for steps that are repeated within a sequence. A link is provided to the database references in the SETEVENT expression. If two relational expressions are used, one link is provided for each load-time text position on the SFC display. If only one database reference, both links refer to the same reference. This provides the operator with the means to manually trigger the event. Access is allowed only after the statement has been executed and not before.
4-69
4.26 _TCLACCESS
The _TCLACCESS statement provides a method to control Batch 300 jobs and batches via a TCL program. This statement can be used to invoke the commands listed in Table 4-7. The _TCLACCESS statement has the form: status:= _TCLACCESS (command, object, cmd_parameter, node_name); where status command object local integer variable that stores the error code (0 = OK). one of the strings listed in Table 4-7 that specifies the function to be invoked on the job or batch. the object that the function is being applied to. The object can be either:
*BATCH (jobid, index) jobid is a string of up to 12 characters, or variable that specifies a job. index is an integer that specifies the batch index within a job *JOB (jobid) jobid is a string of up to 12 characters, or variable that specifies a job. *EQP (equipid) equipid is a string of up to 12 characters, or variable that specifies an equipment unit. cmd_parameter integer, real, or string value that is either passed or returned as a result of a command (when applicable) node_name name of node that the command is being applied to (node name is specified in template name field when using Multibus-based database configurator, or it is defined as the object ID when using AdvaBuild basic functions). This allows the command to be applied to nodes other than where the TCL program is running. If node_name is not specified, it defaults to the node where the TCL program is running.
Examples are provided at the end of this section. The _TCLACC_INCL include file is provided with the TCL software and should be included in TCL sequences that use the _TCLACCESS command. This file provides constants for interpreting the results of _TCLACCESS statements. The contents of _TCLACC_INCL are described in Table 4-8. To make the contents of the _TCLACC_INCL file accessible by your TCL sequence, create the _TCLACC_INCL file using the CREATE function on the TCL Catalog Display, and include the file in your TCL sequence via the INCLUDE statement.
4-70
. Table 4-7. _TCLACCESS Commands Object Command Type CREATE *JOB *BATCH DELETE *JOB *BATCH PREPARE *JOB *BATCH ENABLE PAUSE *JOB *JOB *BATCH *BATCH RESUME *JOB *BATCH *BATCH ACTIVATE *JOB *BATCH ID jobid jobid jobid jobid jobid jobid jobid jobid jobid NULL jobid jobid NULL jobid jobid Yes Yes Applies to Batch Manager Allowed if job is COMPLETE Allowed if batch is prepared in manual, and is the next index to be started. Yes Applies to Batch Manager Yes Yes Index Type string integer Description Recipe ID No. of batches to create Parameter
SHUTDOWN
*JOB *BATCH
jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid Real Job goal Yes Yes integer integer Abnormal no. 1-16 Abnormal no. 1-16
ABNORMAL
*JOB *BATCH
4-71
Table 4-7. _TCLACCESS Commands (Continued) Object Command Type TOLERANCE YIELD *JOB *JOB *BATCH JOBSTART SELECT *JOB *JOB *BATCH DESELECT_AND_FOLLOW *JOB *BATCH DESELECT *JOB *BATCH SELECT_AND_FOLLOW *JOB *BATCH OUT_OF_SERVICE *JOB *BATCH *EQP AVAILABLE *JOB *BATCH *EQP GET_STATE *JOB *BATCH *EQP AUTO SEMIAUTO MANUAL BATCHID BOOKED JOB_BOOKED JOBS_SHARE *BATCH *BATCH *BATCH *BATCH *EQP *EQP *EQP ID jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid jobid equipid jobid jobid equipid jobid jobid equipid jobid jobid jobid jobid equipid equipid equipid Yes Yes Yes Yes String Batch ID Yes Integer* Integer* Integer* Status code, See Table 4-8 Status code, See Table 4-8 Status code, See Table 4-8 Yes Yes Yes Yes Yes Yes Yes Index Type Real Real Real String String String String String String String String String Description Job tolerance Job yield Batch yield dd-mmm-yy hh:mm Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Logical ID, equipment ID Parameter
* For GET_STATE integer parameter, a value is returned to the parameter rather than passed.
4-72
Table 4-8. _TCL_ACC_INCL.TCL File Contents Type of Code Mnemonic ACC_EXPERR ACC_ILLCMD ACC_FILEXI ACC_FILNFD ACC_MISPRM ACC_NOTINI Error Codes ACC_BADPRM Value (Integer) 2 8 18 19 23 62 101 Description equipment in use, disallowed; or batch not in proper mode unrecognized command file/target already exists target object not found parameter required for this command is missing Batch300 is not installed on the specified node cmd_parameter is not valid for this command Beginning of comm. error codes, specified node is down or node not Batch 300 type END of communication errors job is active, disallowed not allowed from current state batch has been deleted job/batch is active job/batch is paused job/batch is completed batch has been removed from memory job/batch has been created job/batch is prepared job/batch has prep errors job/batch is preparing job/batch enabled equipment cannot be booked equipment can be booked batch has been booked job will share with other jobs a job has equipment booked
ACC_COMM_BEG 208 ACC_COMM_END 255 ACC_JOBACT ACC_NOTALL _DELETED _ACTIVE _PAUSED _COMPLETED _REMOVED _NOT_READY Status Codes _PREPARED _PREP_ERRS _PREPARING _ENABLED _OUT_OF_SERV _AVAILABLE _BOOKED _JOBS_SHARE _JOBS_BOOKED 1000 65535 0 1 2 3 6 10 11 12 13 14 15 16 17 18 19
4-73
Table 4-8. _TCL_ACC_INCL.TCL File Contents (Continued) Type of Code Status Codes Mnemonic _ABNORM1 to _ABNORM16 _SHUTDOWN Examples Example 1 mystatus:= _TCLACCESS(FOLLOW_1ST_EXECUTION, *JOB(JOB_1),, NODE_101); /* Sets the execution of batches in JOB_1 to FOLLOW_1ST. */ Value (Integer) 21 to 36 31 Description job/batch is in corresponding TCL or user status (1 to 16) job/batch is shutdown
Example 3 JOB2_ID:= RUN36; EQUIP:= UNIT1,R-101; CMND:= SELECT; NODE_NAME:= NODE_101; STAT:= _TCLACCESS(CMND,*BATCH(JOB2_ID,2),EQUIP,NODE_NAME); /* Selects R-101 for UNIT1 logical unit of batch 2 in the job RUN36 */
4-74
Example 6 PROC EXAMPLE; INCLUDE _TCLACC_INCL; VAR status : INTEGER; jobId : STRING; state : INTEGER; BEGIN STEP Run Batch 300 Job jobId := EXAMPLE; /* First create a job using job id and ExampleRcp as the master recipe */ status := _TCLACCESS( CREATE, *JOB(jobId), ExampleRcp, BatchNode ); /* Now prepare the job */ status := _TCLACCESS( PREPARE, *JOB(jobId),, BatchNode ); /* Wait for prepare to finish */ WHILE ( status = FALSE AND state <> _PREPARED ) DO { WAIT(5); status := _TCLACCESS( GET_STATE, *JOB(jobId), state, BatchNode ); } /* Create several batches */ status := _TCLACCESS( CREATE, *BATCH(jobId), 3, BatchNode ); /* :astly, enable job to run */ status := _TCLACCESS( ENABLE, *JOB(jobId),, BatchNode ); ENDSTEP END.
4-75
4-76
The parameters are described below: item ID value description units label up to 12 characters to identify the item value of the item character string up to 20 characters that describes the item engineering units label up to eight characters for the item
high &low limits define the acceptable range for the value. Any attempt change to the value via an operator display is checked to ensure that it is within range. The limits do not affect a programs ability to change the value.
5-1
TCL programs can access the parameters from recipes as described in Section 4.10.3, Recipe Parameters. Recipe items can be updated to disk during runtime by a version of the RECORD statement as described in Section 4.17, Report Services And History Services Interface.
5-2
Taylor Control Language Users Guide Section 5.2.1 Recipe Catalog Display
Either editor can be used to build a recipe unless the recipe is going to be uploaded or downloaded to a host computer that is connected to the Advant OCS by an Ethernet interface. In that case, the source editor is required. The editor used to create a recipe is indicated by the LOAD STATUS column on the display.
5-3
To call up the Recipe Catalog display, press the LIBRARY key to obtain the main Library Display, and then select the TCLRECIPE field (or other name assigned to the recipe software in your system). The information provided on the recipe Catalog display is described below: Field RECIPE ID Description The name assigned to the recipe when it was created. Each recipe has a target in front of its ID. To select a recipe, move the cursor to its target and press the SELECT key. The number of items in the recipe A descriptive phrase for the recipe Information about the load status of the recipe and the editor that was used to build the recipe. Possible statuses are: Recipe was created by the recipe editor and is ready to be loaded into a unit. Recipe was built with the source editor. It has been successfully compiled and can be loaded into a unit. Recipe was built with the source editor, but has not been compiled. Recipe was built with the source editor and is being compiled. Recipe was built with the source editor. The compile was not successful. Recipe can be loaded but contains warnings. This field indicates the time of the last change to the recipe for recipes that were produced with the recipe editor. It indicates the time of the last SAVE or COMPILE for recipes that were produced with the source editor.
# ITEMS DESCRIPTION LOAD STATUS READY COMPILED NOT COMPILED COMPILING COMPILER ERRORS COMPL WARNINGS TIMESTAMP
The functions of the Recipe Catalog Display are generally accomplished by selecting a recipe and then using softkey functions. The display initially contains the softkeys that are shown in Figure 5-1. Other softkeys are provided as required when you use these initial softkeys. NOTE The message please wait is displayed when commands that cannot be completed instantaneously are being processed. When this message is displayed, you should not make further entries nor change the current display so that errors and status messages may be received and interpreted.
5-4
Taylor Control Language Users Guide Section 5.2.2 CREATEHow to Create a New Recipe
Several of these softkey sets include the following general keys: MORE This softkey is used to call up additional softkey functions for the Recipe Catalog Display. It toggles the display between the first level softkeys as shown in Figure 5-1 and the second level as shown in Figure 5-2.
Figure 5-2. Second Level of Softkeys ob Recipe Catalog Display PAGE FWRD and PAGE BACK These softkeys are used when the recipe list contains more items than can be displayed at one time. It moves the display forward to the next page of information, or backward to the previous page.
Figure 5-3. CREATE Softkey Set for Recipe Catalog Display 3. Choose either the recipe or source editor. You can use either editor, unless the recipe is going to be transmitted over an interface to a host computer. In that case, the source editor must be used. Select CREATE RECIPE for the recipe editor, or CREATE SOURCE for the source editor. A prompt requests an ID for the recipe.
4.
5-5
5.
Assign an ID by typing a character string with a maximum of 12 characters and pressing the ENTER key. Recipe IDs must be unique system-wide. A prompt requests a descriptor for the recipe.
6.
Assign a descriptor by typing a character string with a maximum of 20 characters and pressing the ENTER key. Upon entry of the descriptor, the name of the recipe is displayed in the recipe list on the display.
7. 8.
Press the QUIT softkey to exit from the CREATE mode. Select the new recipe and press the EDIT softkey. The proper editor is automatically accessed. Instructions for using the editors are provided inSection 5.2.3, EDITHow to Use the Recipe Editor and Section 5.2.4, EDITHow to Use the Source Editor.
5-6
Taylor Control Language Users Guide Section 5.2.3 EDITHow to Use the Recipe Editor
Figure 5-4. Recipe Editor Display The TCL Recipe Editor Display contains a header, item data and softkeys. The header contains the display title, the recipe ID, the number of items in the recipe and the recipe descriptor. The softkey section contains the softkeys for doing recipe editing functions. These softkey functions are described in the following paragraphs. ADD INTEGER, ADD REAL, ADD STRING The TCL Recipe Editor provides the means to add an integer, real, or string value. To add any one of these items to a recipe: 1. Select the MORE softkey to call up the ADD softkey set, Figure 5-5.
5-7
2. 3.
Select the appropriate softkey (ADD INTEGER, REAL or STRING) Enter the item ID and then press the ENTER key. The item is added to the recipe and data fields are provided on the Recipe editor based on the selected data type. Initially, these fields will take on the default values. The default values can be changed as required. Real and integer items have item IDs, values, descriptions, units and high and low limits. String items have item IDs, values and descriptions. These parameters are described in Section 5.1.1, Recipe Items.
ADD COMMNT To add a comment: 1. 2. Select the MORE softkey to call up the ADD softkey set, Figure 5-5. Select the recipe item that you want insert the comment after, and then select the ADD COMMNT softkey. This opens s comment box directly below the selected recipe item (if no item was selected, the comment box is displayed at the end of the recipe). 3. Select inside the comment box and type the comment. The comment box is free format and can have up to five full lines of text.
DELETE To delete an item from a recipe: 1. 2. 3. 4. Select the item to be deleted. Select the DELETE softkey. A prompt to select the softkey a second time is displayed. Select the DELETE softkey a second time to delete. To abort the DELETE process, select the QUIT softkey.
TEXT SEARCH To find a text string when the recipe has multiple pages: 1. Select the TEXT SEARCH softkey. An entry field is provided for specifying the text string. 2. Enter the text string and then press the ENTER key. The system searches for the specified text string. If the text string is found, the system scrolls the Recipe Editor Display to the page where it is located.
5-8
Taylor Control Language Users Guide Section 5.2.4 EDITHow to Use the Source Editor
PAGE FWRD and PAGE BACK To move forward to the next page of a recipe or back to the previous page, select the PAGE FWRD and PAGE BACK softkeys, respectively. You can also use the Page target in the top right corner of the display to change pages. Select the number part of the Page target, then enter the page number and press ENTER. QUIT To return to the previous set of softkey functions, select the QUIT softkey.
The value, high value and low value must be edited in the correct order; otherwise, range errors occur. The correct order is highest value first, followed by next highest value and then lowest value. For instance, if all the values are positive, the correct order is: high value, then value, then low value. If all the values are negative, the correct order is: low value, then value, then high value. The TCL recipe editor does not provide the means for exiting the editor without saving the changes made. This is because changes are made directly to the recipe file through the display.
The source editor uses the same editing functions that are described for the TCL sequence editor in Chapter 7, TCL Source and Recipe Editor Functions.
5-9
The format for the source is: RECIPE recname; { INTEGER itemid: value, units, low value, high value, description; itemid: value, units, low value, high value, description; (more integer item definitions) REAL itemid: value, units, low value, high value, description; itemid: value, units, low value, high value, description; itemid: value, units, low value, high value, description; (more real item definitions) STRING itemid: value, units, description; itemid: value, units, description; (more string item definitions) }. Comments in the following format can be included /* comment */ Example: RECIPE WASH_RINSE; /* THIS IS THE WASHER/RINSER RECIPE */ { INTEGER WASHER:105, SECONDS, 93, 120,WATER BATH; RINSER:78, SECONDS, 75, , WATER RINSE; REAL TEMP_WASH:90.0, DEGC, 85.0, 97.0, HOT WATER; TEMP_RINSE:30.0, DEGC, 25.0, 30.0, COLD WATER; STRING END_CYCLE: END, , END-MESSAGE; }. The format is flexible. The integer, real and string item groups can be added in any order. There can be multiple real, string and integer item groupings. The items are made up of the following: itemid value is a label that is used to identify the item. It can contain up to 12 characters followed by a colon. Special characters can be used if enclosed in quotes. is the value of the item. String values must be enclosed in quotes.
5-10
Taylor Control Language Users Guide Section 5.2.5 COMPILHow to Compile a Recipe Created with the Source Editor
units
is an engineering units label for the item. It can contain up to eight characters. It must be enclosed in quotes.
The values that are entered should be suitable for the data type they follow. However, if the data type is real and an integer is entered, the integer is converted to a real value when the source is compiled. high &low limits define the acceptable range for the value parameter for a real or integer item. Any attempted change to the value of the item from the Console Display is checked to ensure that it is within range. The limits do not affect a programs ability to change the value. If a low limit is omitted, the compiler defaults the limit to 0. If a high limit is omitted, the compiler defaults the limit to 100. If you omit an item, you must still enter the commas that precede and follow the item. When the source is compiled, the value is checked to see if it is within the limits. description is a character string that describes the item. It can contain up to 20 characters. It must be enclosed in quotes.
When the source is complete, press the SAVE key to save the file. It must be compiled before it can be loaded into a unit. Instructions are provided in Section 5.2.5, COMPILHow to Compile a Recipe Created with the Source Editor.
Figure 5-6. COMPIL Softkey Set 2. 3. Select the target for the recipe to be compiled. Press the COMPIL softkey. The compiling process starts and the LOAD STATUS field for the recipe displays COMPILING. When the compile operation is complete, the LOAD STATUS field displays either COMPILED or COMPILER ERRORS. Press the QUIT softkey to return the display to the first level of softkeys. If the status of the compile is COMPILER ERRORS, you can request to view a compiler listing by selecting the recipe and pressing the COMPLR LISTNG softkey.
4.
5-11
The proper editor is automatically accessed. Instructions for using the editors are provided inSection 5.2.3, EDITHow to Use the Recipe Editor and Section 5.2.4, EDITHow to Use the Source Editor.
5.2.7 REMOVE SOURCEHow to Change a Recipe from the Source Editor Format to the Recipe Editor Format
The following procedure changes the format of the recipes but loses the form and comments of the source file. If these items are important to you, back up the recipes to some other device before performing the procedure. 1. 2. Press the COMPIL KEYS softkey. This displays the COMPIL softkeys, Figure 5-6. Select the recipe to be changed. CAUTION Do not perform this procedure on a file that is not compiled or that has compiler errors. If this procedure is attempted on such a file, everything in the file is lost because the object file is empty. 3. 4. 5. Press the REMOVE SOURCE softkey. This removes the source and listing files from the recipes and sets the recipe status to READY. You are prompted to press REMOVE SOURCE again to verify that you want the procedure to be performed. Pressing any other key aborts the procedure. Press the QUIT softkey to return the display to the first level of softkeys.
5.2.8 DE-COMPILHow to Change a Recipe from the Recipe Editor Format to the Source Editor Format
To change a recipe from the recipe editor format to the source editor format: 1. 2. 3. 4. Press the COMPIL KEYS softkey. This displays the COMPIL softkeys, Figure 5-6 Select the recipe to be changed. Press the DE-COMPIL softkey. The object file of the recipe is decompiled and a source file is produced. The status is set to NOT COMPILED. Follow the instructions in Section 5.2.5, COMPILHow to Compile a Recipe Created with the Source Editor.
5-12
Taylor Control Language Users Guide Section 5.2.9 COPYHow to Make a Copy of a Recipe and Store it Under a Different Name
5.2.9 COPYHow to Make a Copy of a Recipe and Store it Under a Different Name
The COPY softkey is used to make a duplicate copy of a recipe under a new name. This function provides a convenient method for creating similar recipes. The duplicate copy can be edited as required. To make a copy of a recipe: 1. 2. 3. 4. The COPY softkey is on the second level of softkeys. If the first level of softkeys is displayed, press the MORE softkey to access the second level. Select the target for the recipe to be copied. Select the COPY softkey. Enter the name for the duplicate copy and press the ENTER key. If the original recipe was produced with the source editor, the new copy will have a status of NOT COMPILED.
5.2.10 XFER (SAVE)How to Make Backup Copies of Recipes to Other Disk Devices
Backup copies of recipes can be made to floppy disks or removable Winchester disks. These copies can be reloaded into the system when necessary. 1. Press the XFER KEYS softkey. This displays the XFER softkeys, Figure 5-7.
Figure 5-7. XFER KEYS Softkey Set 2. Either Save all recipes by selecting BACKUP ALL or Save an individual recipe by selecting a recipe and selecting SAVE. CAUTION It is recommended that you do not leave the Recipe Catalog Display until the backup is done, to avoid missing any prompts that may occur during the course of the backup.
5-13
3.
New softkeys, Figure 5-8, are displayed that ask you if you want the recipe saved to floppy disk (FD00), removable Winchester disk (WC01) or if you want to abort the Save (QUIT). Select the proper softkey.
Figure 5-8. Disk Keys If a recipe was produced with the source editor, its copy on the backup disk has a NOT_COMPILED status when saved with the SAVE key. When saved with BACKUP ALL, the original status is preserved and all files associated with the recipe are copied. If you need to format the floppy disk, you can do so by inserting it into the drive and pressing FORMAT FD00. Formatting a disk device erases all data that is currently stored on it. Be sure to verify that the disk is blank, or that the current data is not required before formatting a disk.
5-14
Taylor Control Language Users Guide Section 5.2.12 DELETEHow to Delete a Recipe
3.
Either Press RESTOR ALL to reload all recipes or Select a recipe and press LOAD to reload an individual recipe. If a recipe was produced with the source editor, the reloaded copy has a NOT_COMPILED status when loaded with the LOAD key. When LOADED with RESTOR ALL, the original status is preserved and any compiler listing for the recipe is LOADED.
5-15
5-16
6.1 General
This section provides instructions and reference information for development and maintenance of TCL programs through the TCL Catalog Display, and the Multibus-based TCL editor and TCL compiler. NOTE The Multibus-based TCL Editor and Recipe Editor are not supported on the Advant Station platform. If you want to use the Advant Station for TCL development, you must use the AdvaBuild TCL Builder.
6-1
LOAD STATUS The load status of the program. Possible statuses are: COMPILED The program was successfully compiled and can be loaded into a unit. It has not been linked.
6-2
Taylor Control Language Users Guide Section 6.2.1 TCL Catalog Display
Figure 6-1. TCL Catalog Display Field Description The program has not been compiled. The program is being compiled. The compile was not successful. The program can be loaded but contains warnings. The program has been compiled and linked. The program has been compiled and is now linking. The program has been compiled but the linking was not successful. It can still be loaded.
NOT COMPILED COMPILING COMPILE ERRORS COMPL WARNINGS LINKED LINKING LINK ERRORS TIMESTAMP
This field indicates the time of the last SAVE or COMPILE for the program. The time of the last link is in the link summary in the listing file.
6-3
Figure 6-2. Second Level of Softkeys on TCL Catalog Display PAGE FWRD and PAGE BACK Softkeys These softkeys are used when the program list contains more items than can be displayed at one time. It moves the display forward to the next page, or backward to the previous page. NOTE The message please wait is displayed when commands that cannot be completed instantaneously are being processed. When this message is displayed, you should not make further entries nor change the current display so that errors and status messages can be received and interpreted.
6-4
Taylor Control Language Users Guide Section 6.2.3 EDITHow to Access the TCL Editor
A full range of functions is supported for program editing. These functions are described in Chapter 7, TCL Source and Recipe Editor Functions.
6-5
4.
6-6
Taylor Control Language Users Guide Section 6.2.6 XFER (SAVE)How to Make Backup Copies of Programs and Include Files to Other Disk Devices
6.2.6 XFER (SAVE)How to Make Backup Copies of Programs and Include Files to Other Disk Devices
Backup copies of programs and include files can be made to floppy disks or removable Winchester disks. These copies can be reloaded into the system when necessary. 1. Press the XFER KEYS softkey. A new set of softkeys is displayed. See Figure 6-4.
Figure 6-4. XFER Softkeys 2. Either Save all programs and files by selecting BACKUP ALL or Save an individual program or file by selecting it and selecting SAVE. NOTE When you attempt to SAVE an individual program or file to disk, and the name (ID) already exists on the disk, you get a message that indicates the ID already exists. You can not save the program or file until the duplicate ID is deleted from the disk. When you attempt to BACKUP ALL programs and files to disk, and one or more names (IDs) already exist on the disk, you get a message that duplicate names will be replaced (existing files with same names will be overwritten). You can either press BACKUP ALL again to continue the backup, or press any other key to cancel. CAUTION It is recommended that you do not leave the TCL Catalog Display until the backup is done, to avoid missing any prompts that occur during the course of the backup.
6-7
3.
New softkeys, Figure 6-5, are displayed that ask you if you want to save to floppy disk (FD00) or removable Winchester disk (WC01) or if you want to abort the Save (QUIT). Select the proper softkey.
Figure 6-5. Disk Softkeys A copy of a program on the backup disk has a NOT COMPILED status when saved with the SAVE key. When saved with BACKUP ALL, the original status is preserved and all files associated with the program are copied. If you need to format the floppy disk, you can do so by inserting it into the drive and pressing FORMAT FD00. Formatting a disk device erases all data that is currently stored on it. Be sure to verify that the disk is blank, or that the current data is not required before formatting a disk.
6-8
Taylor Control Language Users Guide Section 6.2.8 DELETEHow to Delete a Program or Include File
4.
Either Press RESTOR ALL to reload all backup copies or Select a program or include file and press LOAD to reload an individual backup copy. A reloaded program has a NOT_COMPILED status when loaded with the LOAD key. When LOADED with RESTOR ALL, the original status is preserved and any compiler listing for the program is also LOADED. NOTE When you attempt to LOAD an individual program or file from backup disk, and the name (ID) already exists on the Winchester disk, you get a message that indicates the ID already exists. You can not save the program or file until the duplicate ID is deleted from the Winchester disk. When you attempt to RESTOR ALL programs and files from backup disk, and one or more names (IDs) already exist on the Winchester disk, you get a message that duplicate names will be replaced (existing files with same names will be overwritten). You can either press RESTOR ALL again to continue the restore, or press any other key to cancel.
6-9
6.2.13 EXIT
This softkey is used to exit the sequence catalog function.
6-10
7-1
Taylor Control Language Users Guide Chapter 7 TCL Source and Recipe Editor Functions
There are several keys used to move the cursor. The arrow keys are used to move it by character. There are keys used to move the cursor by word or line. There are also keys used to move the cursor to the beginning or the end of the file, and to move it by screen section. UP, DOWN, LEFT and RIGHT ARROW Keys Press the UP ARROW key to move the cursor to the character in the line above. If the line does not extend as far as the present cursor position, the cursor is placed at the end of the line. The cursor moves back to the original character position in successive lines that extend that far. Press the DOWN ARROW key to move the cursor to the character in the line below. If the line does not extend to the present cursor position, the cursor is placed at the end of the line. The cursor moves back to the original character position in successive lines that extend that far. Press the LEFT ARROW key to move the cursor to the preceding character. When the cursor is positioned at the left margin, pressing the LEFT ARROW key moves it to the space following the rightmost character in the line above. The RIGHT ARROW key is used to move the cursor to the next character. When the cursor is positioned following the rightmost character, pressing the RIGHT ARROW key moves it to the first character on the line below. WORD Key A word in the editor is one or more characters that are preceded and followed by spaces or any character other than a-z or 0-9. Pressing the WORD key moves the cursor forward or backward by word, depending on whether cursor direction is Advance or Backup. When the cursor is positioned at the end of a line, pressing the WORD key moves the cursor to the next line. EOL Key The EOL key is used to move the cursor to the end of the line immediately preceding the line terminator. If the cursor direction is Advance, EOL moves the cursor to the end of the current line. If the cursor direction is Backup, EOL moves the cursor to the end of the previous line. BOL Key The BOL key is used to move the cursor to the left margin. If the cursor direction is Advance, BOL moves it to the left margin in the next line. If the cursor direction is Backup, BOL moves it to the beginning of the current line. PAGE DOWN, UP, LEFT and RIGHT Keys The Page keys are used to move by screen section. The PAGE DOWN key is used to move down by a half-screen; the PAGE UP key is used to move up by a half-screen. If there is less than a half-screen remaining at the beginning when PAGE UP is pressed, the cursor moves to the beginning of the file, and the message Start of File appears. If less than a half-screen remains at the end of the file when PAGE DOWN is pressed, the cursor moves to the end, and the message End of File appears.
7-2
Taylor Control Language Users Guide Section 7.3 Text Editing Functions
Press the PAGE LEFT key to move the screen image eight columns to the left. Press the PAGE RIGHT key to move the screen image eight columns to the right. TOP and BOTTOM Keys The TOP key is used to move the cursor to the beginning of the file; the BOTTOM key is used to move the cursor to the end of the file.
7-3
Taylor Control Language Users Guide Chapter 7 TCL Source and Recipe Editor Functions
Reinserting Text The UNDEL key is used to reinsert text deleted by one of the delete functions. It is typically used when material has been deleted accidentally. Locating Text The FIND key is used to locate the beginning of the first occurrence of the character string specified. The direction searched depends on whether Advance or Backup has been selected. The located text is stored in the search string buffer until a new search string is entered or until the editor is exited. The NEXT FIELD key is used to locate the next (or first) occurrence of the string stored in the search string buffer. The direction depends on whether Advance or Backup has been selected. When the ANY CASE softkey is used in conjunction with FIND, the system disregards the case of the character string being searched. When the EXACT CASE softkey is used with FIND, the system searches for the exact case match of the string. Selecting the ANY CASE softkey changes it to the EXACT CASE softkey and vice versa. Marking Text Marking is the process of identifying a string of text so that editing functions (copying, moving, deleting) can be performed on it. Marked text is displayed in reverse video. SELECT Key The SELECT key is used to identify one end of a string of marked text. As the cursor is moved (in either direction) toward the other end of the string, the text between the point where SELECT was pressed and the cursor position appears in reverse video. Once the cursor is positioned at the other end of the string, and the appropriate softkey (CUT, COPY, REPLACE, SUBSTITUTE NEXT) is pressed, the marked string is placed in the paste buffer. The paste buffer is an area where marked text is stored temporarily so that it can be used in other editing operations. Text in the paste buffer remains there until one of the following occurs: The text is replaced by a more recent operation which also marks text for storage in the paste buffer. The editor is exited, thereby erasing the contents of the buffer from memory.
To deactivate text marked by the SELECT key, press the SELECT key again. Deactivated text is returned to normal video. Moving, Deleting and Copying Text The CUT softkey is used with the SELECT key and PASTE softkey to move sections of text. The CUT softkey can also be used with SELECT to delete text. SELECT is used to identify one end of the marked text. When the cursor is moved to the other end of the string of text, and CUT is pressed, the text is removed from the screen and stored in the paste buffer.
7-4
Taylor Control Language Users Guide Section 7.3 Text Editing Functions
To delete the text placed in the paste buffer, simply continue to do other editing operations. The delete operation is finalized either when you put new text in the paste buffer (which overwrites the previous text), or when the editor is exited. To move the text in the paste buffer to a new location, position the cursor at the new location and press the PASTE key. This writes the contents of the paste buffer at the cursor position. The COPY softkey is used with the SELECT key and PASTE softkey to copy sections of text. SELECT identifies one end of a string. When the cursor is moved to the other end of the string and COPY is pressed, a copy of the marked text is copied into the paste buffer. The original marked text remains on the screen. To copy the text in the paste buffer, position the cursor at the location where you want to write the text, and press PASTE. This writes the contents of the paste buffer at the cursor position. Replacing and Substituting Text The REPLACE softkey is used with the SELECT key to replace text currently in the file. SELECT is used at one end of a string, REPLACE at the other. When REPLACE is pressed, the contents of the paste buffer replaces the marked text. The FIND key can also be used with the REPLACE softkey. The FIND key is used to locate the text to be replaced; the text is then marked with SELECT and REPLACE. The operation can be repeated by pressing NEXT FIELD and then REPLACE. The SUBST NEXT softkey works like the REPLACE softkey in that it is used to replace text currently in the file with the text in the paste buffer. However, unlike the REPLACE function, SUBST NEXT has an automatic findnext feature. SUBST NEXT is used with the SELECT key. SELECT is used at one end of a string, SUBST NEXT at the other. When SUBST NEXT is pressed, a prompt asks for the string to be searched. The SUBST NEXT function replaces each occurrence of the searched string found within the bounds of the marked text with the contents of the paste buffer. Changing Case of Text Use the UPPER CASE / LOWER CASE softkey to choose the desired case. Then select the text to be changed. Then press the NEXT CHOICE key on the keyboard and the text changes to the desired case. Tabs and Tab Intervals The editor provides equally spaced tab columns, with the spacing between columns depending on the tab interval. The default tab interval is 8. The TAB key is used to move the cursor to the next tab column. The tab interval may be decremented or incremented by using the DEC TAB or INC TAB softkeys, respectively.
7-5
Taylor Control Language Users Guide Chapter 7 TCL Source and Recipe Editor Functions
7-6
NAK negative acknowledge 21 SYN synchronous idle ETB end of block CAN cancel line EM end of medium SUB substitute ESC escape FS file separator GS group separator RS record separator US unit separator 22 23 24 25 26 27 28 29 30
31
A-1
Table A-2. ASCII Character to Ordinal Number Conversion Table Character space ! " # $ % & , ( ) * + . / 0 1 2 3 4 5 6 7 Ordinal Value 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O Character Ordinal Value 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 _ a b c d e f g P Q R S T U V W X Y Z [ \ ] Character Ordinal Value 80 80 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 h i j k l m n o p q r s t u v w x y z { | } ~ DEL Character Ordinal Value 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
A-2
Table A-3. Abnormal Conditions Priority 1 2 3 4 5 6 7 8 Condition Communications Failure Data Base Access Failure Reserved TCL Runtime Error User-defined User-defined User-defined User-defined 9 10 11 12 13 14 15 16 Priority Condition Reserved Events Cleared (Node Down) Batch 300 Shutdown Reserved User-defined User-defined User-defined User-defined
Table A-4. Program Control Parameters Mnemonic CURSTEP CURSTMT INSTID NEXTSTEP PAUSTEP SEQMODE SEQSTATE SEQTYPE SSTATUS Integer Integer String Integer Integer Integer Integer Integer Integer #MANUAL, #AUTO, or #SEMIAUTO #ACTIVE, #PAUSED, or #INACTIVE #SCHED, #PROC, or #OPER #NORMAL, #ABNORMAL_1 thru #ABNORMAL_16 Unit name as defined on a Unit Master Templet Data Type Value
A-3
A-4
INDEX
Symbols
_ALL 4-59 _CLEAR 4-59
C
CASE 4-35 Catalog 5-3 Catalog Display 6-1 CHECK 4-44 CHR 4-10 CLEAREVENT 4-48 CLOSE 4-39, 4-42 Compile a Program 6-5 Compile a Recipe 5-11 compound statement 4-33 Concurrent Ext Subrs 3-5 CONST 4-14 Constants 4-14 control block 2-5 Control block parameters 4-19 Copy a Program 6-9 Copy of a Recipe 5-13 Create a New Program 6-4 Create a New Recipe 5-5 CRITICAL 4-51 Curly braces, { } 4-33 CURSOR MOVEMENT 7-1
A
ABNORM 4-48, 4-51 ABNORMAL 4-49 abnormal 2-6 abnormal conditions 2-6 ABNORMSUBR 4-51 ABORT 4-45, 4-48 ABS 4-8 absolute value 4-8 Access the TCL Editor 6-5 ACTION 4-48 ACTIVATE 4-45 ACTIVE 4-48 active 2-5 Actual Tag Name 3-3 add a comment 5-8 add any one of these items to a recipe 5-7 AND 4-6, 4-48 ANY CASE softkey 7-4 arithmetic 4-5 Arithmetic expressions 4-4 ARRAY 4-16, 4-22 Arrays 4-16 Assignment statement 4-28 ASTOI 4-10 ASTOR 4-10 Asynchronous UCALs 4-64 AUTO 4-48 Auto 2-7 Auto Start TCL Task 3-7
D
data base parameters 2-10, 4-17 data types 4-3 DATE 4-11 DATE function 4-11 DBVAR 4-17 declaration 4-1 Delete a Program 6-9 Delete a Recipe 5-15 delete an item from a recipe 5-8 DELETE CHAR key 7-3 DELETE WORD key 7-3 Device Names 3-8 DISK I/O STATEMENTS 4-41 DO 4-36 to 4-37 Downloading 2-4 DOWNTO 4-36
B
BACKSPACE key 7-3 Backup Copies of Programs 6-7 Backup Copies of Recipes 5-13 BEGIN 4-32 Bit Ones Complement function 4-8 Bit Shift function 4-8 BOL key 7-2 Boolean algebra 4-6 BOTTOM key 7-3 BYTES 4-16, 4-22
E
edit a recipe 5-6 Editing functions 7-1 Editing Recipe Items 5-9 ELSE 4-34
END 4-32 ENDBATCH 4-52 ENDEVENT 4-48 ENDSTEP 4-33 EOL 7-2 EOL DELETE key 7-3 EVENT 4-48 event 2-7 EXACT CASE softkey 7-4 Export to Devices 3-3, 3-8 expression 4-7 External Data Rate 3-5 External programs 4-12 External Subroutines 4-31 external subroutines 2-10 EXTOPER 4-13 EXTPROC 4-13 EXTSUBR 4-32
INPUT 4-39, 4-42 INSERT LINE key 7-3 INTEGER 4-7, 4-14 to 4-17, 4-22, 4-58 Integer Var Name 3-8 Integers 4-4 Internal Subroutines 4-29 ITEMS ITOAS 4-10
K
Keywords 4-3
L
Labels 4-3 LEN 4-10 LINE DELETE key 7-3 Link a Program 6-6 literal 4-14 LOAD 4-22, 4-43 Load (Restore) Backup Copies 5-14, 6-8 LOAD STATUS 5-4 Loading Recipes 5-2 Load-time text 2-19, 4-66 to 4-67 Local variables 4-15 logical operators 4-6 Loop parameters 4-18
F
FALSE 4-39 to 4-40, 4-44, 4-57 FCM parameters 4-19 FETCH 4-25, 4-70 file control block 4-42 FILESYS 4-41 find a text string 5-8 FIND key 7-4 floating point numbers 4-5 FOR 4-36 FORDOWNTO (TO)DO 4-36 format 4-2 functions 4-7
M
Mailbox Templet 3-6 mailboxes 2-14 MANUAL 4-48 Manual 2-7 Marking Text 7-4 Mathematical Functions 4-8 Max of Abnorm Cond Max of Actions Max of Active Seq Max of Parameters Max of Simu Events Maximum Ext Subr Stack 3-5 MEDIUM 4-58 to 4-59 MESG 4-58 MID 4-10 mixed mode expressions 4-7 MOD 4-5 Mode 2-7 mode 2-7 Modify a Recipe 5-12 Modulo 4-5
G
GOTO 4-38
H
header 4-11 Hex constants 4-4 hierarchy 2-2 HIGH 4-58 to 4-59 HR_START 4-56 HR_STOP 4-56
I
IF 4-34 IFTHENELSE 4-34 inactive 2-5 INCLUDE 4-60 INCLUDE function 2-14
ii
N
named constant 4-14 NEXT FIELD key 7-4 NONCRITICAL 4-51 normal 2-6 NOT 4-6 NOWAIT 4-57 Number of Messages 3-6 Number of Waiters 3-6
O
OPEN 4-38, 4-42 OPER 4-12 operations 2-2 operators 4-4 OR 4-6, 4-48 ORD 4-10 Order Of Computations 4-6 OTHERWISE 4-35 OUTPUT 4-40, 4-42
P
PAGE DOWN key 7-2 PAGE LEFT key 7-3 PAGE RIGHT key 7-3 PAGE UP key 7-2 Parallel Processing 2-8 Parameters 2-11 PAUSE 4-46, 4-48 paused 2-5 peripheral I/O statements 2-13 Print a Hard Copy 5-15 Print a Hard Copy of a Program 6-10 Print a List of the Items on the Catalog 6-10 Print a List of the Recipes 5-15 Printer 6-10 priority 2-8 PROC 4-12 procedures 2-2 program control parameters 2-18 Program flow statements 4-32 program header 4-11 Program hierarchy 2-3 program modes 2-7
RECEIVE 4-57 RECIPE 4-21, 4-43 to 4-44, 4-56 recipe 2-3 recipe catalog 5-2 Recipe Catalog Display 5-3 Recipe Device Name 3-7 Recipe Editor 5-6 recipe editor 5-2 RECIPE ID 5-4 RECORD 4-54 to 4-56 RECORDER 4-56 relational expression 4-5 relational operators 4-5 Relative Device Names 3-8 REMOVE 4-23, 4-42, 4-44 REPEAT 4-37 REPEATUNTIL 4-37 REPLY 4-58 REPORT 4-53 Report ID, REPORT ID2 3-7 RESUME 4-47 to 4-48 ROUND 4-8 ROUND function 4-8 RTOAS 4-10 runtime message 2-19, 4-66 to 4-67 Runtime Templet 3-3
S
SCHED 4-12 schedules 2-2 SELECT key 7-4 Semiauto 2-7 SEND 4-57 SEQUENCE 4-43 to 4-44 Sequence Debug Display 2-7 Serial I/O statements 4-38 SET 4-26 to 4-27 SET Statement 4-26 SET Statement for Trend Data 4-27 SETEVENT 4-48 Source Editor 5-9 source editor 5-2 STANDARD 4-58 to 4-59 STARTBATCH 4-52 STARTBATCHENDBATCH 4-52 state 2-7 State descriptors 4-4 Statement labels 4-3 states 2-5
R
REAL 4-7, 4-14 to 4-17, 4-22, 4-58 Real data 4-3 Real Var Name 3-8
iii
status 2-6 to 2-7 STEP 4-33 step 2-2 STEP_ACTIVITY 2-19, 4-66 STEP_CONDITION 2-19, 4-67 STEP_TRANSITION 2-19, 4-68 STRING 4-14 to 4-17, 4-22, 4-58 string 4-4 String Manipulation Functions 4-10 String Tags 4-26 String Var Name 3-8 SUBR 4-30 Synchronous UCALs 4-62
V
VAR 4-15 to 4-16, 4-22 Variable tags 4-23 Variables 4-15 variables 2-10 VARTAG 4-23
W
WAIT 4-57, 4-60 WHILE 4-37 WHILEDO 4-37
T
TCL Development Templet 3-1 TCL FUNCTIONS 4-7 TCL Mailbox Templets 3-6 TCL Runtime Templet 3-3 THEN 4-34 TIME function 4-11 TIMESTAMP 5-4 TO 4-36 TOP key 7-3 TRENDOFF 4-54 TRENDON 4-27, 4-54 Trigonometric Functions 4-8 TRUE 4-39 to 4-40, 4-44, 4-57 TWO_BYTES 4-16, 4-22
U
UCALS 4-61 UNDEL key 7-4 Unit Descriptor 3-7 Unit Detail Display 2-4 Unit Identifier 3-3 Unit Master Templet 3-7 Unit Message Display 2-13 Unit Relative Names Templet 3-2 Unit Relative Parameters 4-19 unit symmetry 2-1 Unit variables 4-22 UNIT_ALARM 4-59 Unit-Relative Name 3-3 UNITS 4-29 units 2-1 UNITVAR 4-22 unnamed constant 4-14 UNTIL 4-37
iv