100% found this document useful (2 votes)
945 views158 pages

TCL User's Guide

Programación lenguaje TCL

Uploaded by

rivasbc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
945 views158 pages

TCL User's Guide

Programación lenguaje TCL

Uploaded by

rivasbc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 158

Taylor Control Language Users Guide Table of Contents

TABLE OF CONTENTS
Chapter 1 - Introduction
1.1 1.2 1.3 General Information................................................................................................. 1-1 Manual Organization ............................................................................................... 1-2 Related Documentation............................................................................................ 1-2

Chapter 2 - TCL Overview


2.1 2.2 2.3 2.4 2.5 2.6 2.7 General..................................................................................................................... 2-1 Units And Unit Symmetry ....................................................................................... 2-1 Step Structure........................................................................................................... 2-2 TCL Program Hierarchy .......................................................................................... 2-2 Recipes..................................................................................................................... 2-3 Downloading And Removing TCL Programs And Recipes.................................... 2-4 Program Control ...................................................................................................... 2-5 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.9 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 State ........................................................................................................ 2-5 Status....................................................................................................... 2-6 Mode ....................................................................................................... 2-7 Manipulating State, Status and Mode In TCL Programs........................ 2-7 Activating TCL Programs for Parallel Processing.................................. 2-8 External Program Calls........................................................................... 2-9 External Subroutine Calls ..................................................................... 2-10 Methods of Access................................................................................ 2-11 Loop and FCM Parameters ................................................................... 2-11 Control Block Parameters ..................................................................... 2-12 Recipe Parameters................................................................................. 2-12 Unit Variables ....................................................................................... 2-12 Unit Array Variables ............................................................................. 2-12

Methods For Activating TCL Programs .................................................................. 2-8

Variables And Data Base Access ........................................................................... 2-10

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

Runtime Console Support ...................................................................................... 2-16

Chapter 3 - Data Base Templets for TCL


3.1 3.2 3.3 3.4 3.5 3.6 Overview .................................................................................................................. 3-1 TCL Development Templet...................................................................................... 3-1 Unit Relative Names Templet .................................................................................. 3-2 TCL Runtime Templet ............................................................................................. 3-3 TCL Mailbox Templet.............................................................................................. 3-6 Unit Master Templet ................................................................................................ 3-7

Chapter 4 - TCL Language Specifications


4.1 4.2 Conventions.............................................................................................................. 4-1 TCL Program Structure............................................................................................ 4-1 4.2.1 4.2.2 4.2.3 4.2.4 4.3 4.4 Declaration Part....................................................................................... 4-2 Executable Part........................................................................................ 4-2 Format ..................................................................................................... 4-2 Statement Labels ..................................................................................... 4-3

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

Operators .................................................................................................................. 4-4 4.5.1 4.5.2 4.5.3

ii

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

TCL Functions ......................................................................................................... 4-7

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

Date and Time Functions ...................................................................... 4-11 4.6.5.1 4.6.5.2

4.7 4.8 4.9 4.10

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

3BUR 000 242 R0301 REV H

iii

Taylor Control Language Users Guide Table of Contents

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

Assignment Statement........................................................................... 4-28

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

Program Flow Statements ...................................................................................... 4-32 4.13.1 4.13.2 4.13.3 4.13.4

Looping Statements............................................................................... 4-36

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

Report Services And History Services Interface ................................................... 4-52

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

Chapter 5 - Recipe Development


5.1 General Information................................................................................................. 5-1 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.2 Recipe Items ........................................................................................... 5-1 Recipe Development............................................................................... 5-2 Loading Recipes into Units..................................................................... 5-2 Recipes Items in TCL Programs............................................................. 5-2 Changing Values from the Recipe Detail Display .................................. 5-2

Recipe Development And Maintenance .................................................................. 5-2

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

Chapter 6 - TCL Program Development


6.1 6.2 General ..................................................................................................................... 6-1 TCL Catalog Functions ............................................................................................ 6-1 6.2.1 TCL Catalog Display .............................................................................. 6-1 6.2.1.1 6.2.1.2 6.2.1.3 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.2.10 6.2.11 How to Call up the TCL Catalog Display ........................ 6-1 Description of Fields on TCL Catalog Display................ 6-2 Softkey Functions ............................................................. 6-4

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

Chapter 7 - TCL Source and Recipe Editor Functions


7.1 7.2 7.3 Editing Functions..................................................................................................... 7-1 Cursor Movement .................................................................................................... 7-1 Text Editing Functions............................................................................................. 7-3

Appendix A - Reference Tables


A.1 Reference Tables......................................................................................................A-1

INDEX

3BUR 000 242 R0301 REV H

vii

Taylor Control Language Users Guide Table of Contents

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Table of Contents

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

3BUR 000 242 R0301 REV H

ix

Taylor Control Language Users Guide Table of Contents

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 1.1 General Information

Chapter 1 Introduction

1.1 General Information


TCL is a structured programming language modeled after Pascal. In addition to its many Pascallike programming structures, TCL has unique programming structures that are specifically designed for process control and Advant OCS (Open Control System) applications. Englishlike keywords and specially designed programming structures, make it easy for users with relatively little programming experience to develop custom programs for process control. Typical applications for TCL programs include: Sequential/batch control. Complex arithmetic and logic functions. Supervisory tasks such as start-ups and shutdowns.

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.

3BUR 000 242 R0301 REV H

1-1

Taylor Control Language Users Guide Chapter 1 Introduction

1.2 Manual Organization


For applications where TCL development is done via a Multibus-based TCL development node, this book provides both reference information for TCL development guidelines and syntax, and instructions for using the Multibus-based TCL editor and source recipe editor. For applications where TCL development is done via an Advant Station, use this book as a reference source for TCL development guidelines and syntax. Refer to the TCL Builder Users Guide, for instructions on using the TCL development tools provided by the TCL Builder. This book is not intended as the sole source of instruction for Taylor Control Language. It is recommended that those people involved in TCL development attend the applicable courses offered by ABB Industrial Systems, Inc. This book is organized into sections as follows: SECTION 1INTRODUCTION describes the scope of this book, and related documentation. SECTION 2TCL OVERVIEW provides a functional overview of TCL. It describes the unique features of TCL that make it well suited for process control applications. This includes the development and runtime support facilities for TCL such as editors, compilers, templets and Runtime Displays associated with TCL. SECTION 3DATA BASE TEMPLETS FOR TCL describes how to configure the Advant OCS database to support TCL functionality. This involves configuring templets (database objects) for both the TCL development and runtime nodes. SECTION 4TCL LANGUAGE SPECIFICATIONS describes the conventions for TCL program format and structure. In addition, it provides a detailed description and syntax for the functional elements of TCL such as variables, operators, functions and statements. SECTION 5RECIPE DEVELOPMENT provides instructions for using the Multibus-based recipe editor and recipe source editor to develop TCL recipes. If you use the TCL Builder for these functions, refer to the TCL Builder Users Guide. SECTION 6TCL PROGRAM DEVELOPMENT provides instructions for using the Multibus-based TCL editor and compiler to develop and revise TCL programs. If you use the TCL Builder for these functions, refer to the TCL Builder Users Guide. SECTION 7TCL EDITOR AND SOURCE RECIPE EDITOR FUNCTIONS describes the editing functions available for these two editors. Refer to the TCL Builder Users Guide for similar information when using the TCL Builder for TCL development. APPENDIX A- TCL REFERENCE TABLES INDEX

1.3 Related Documentation


The following books provide information regarding the development of TCL programs: System Configurator User's Guide Configurable Control Functions Data Base Tables TCL Builder User's Guide

1-2

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.1 General

Chapter 2 TCL Overview

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.2 Units And Unit Symmetry


It is important to understand the concept of units and unit symmetry for development of TCL programs and integration of these programs in the Advant OCS environment. In this book, the term unit is used to describe an arrangement of related Advant OCS components such as controller cards and/or a Multibus Subsystem where TCL programs and recipes are specified to run. When the Advant OCS components are associated with such devices as a batch reactor with valves, measuring elements, etc., the term unit is expanded to include these devices as well. In this context, the term unit refers to a group of related system and process devices that collectively perform a specific function on a process. Units for TCL are established by configuring Unit Master objects (templets) in the Advant OCS database. One Unit Master object is required for each unit. The term unit symmetry is used in Advant OCS literature to describe the situation where a process may have many units that are structurally and functionally identical. For example, the three units shown in Figure 2-1 may be considered symmetrical units. TCL provides the means to establish an association between the common elements in symmetrical units such that generic programs are developed and run on symmetrical units without having to be modified for each individual unit. For instance, consider the three symmetrical units shown in Figure 2-1. Each unit has a common rinse valve (RINSE-1, RINSE-2 and RINSE-3). These valves are assigned a common reference name such as RINSEVALVE on a Unit Relative Names Templet. See Chapter 3, Data Base Templets for TCL. Then a TCL program can be developed using the reference name instead of the specific device names as shown below. For example: *RINSEVALVE.DEV_CMND:= #OPEN; When the program is run on UNIT 1, RINSE-1 is opened. When the program is run on UNIT 2, RINSE-2 is opened, and when the program is run on UNIT 3, RINSE-3 is opened.

3BUR 000 242 R0301 REV H

2-1

Taylor Control Language Users Guide Chapter 2 TCL Overview

Figure 2-1. Example, Symmetrical Units

2.3 Step Structure


The step is the building block of all TCL programs. All executable statements must be contained within the bounds of a STEP/ENDSTEP structure, except statements that occur within a subroutine. Subroutines cannot use the STEP/ENDSTEP structure. This structure organizes TCL programs into identifiable modules that are manipulated from TCL Runtime Displays such as the Sequence Debug Display and Sequence Detail Display. A user-defined name that is unique to the program is associated with each step in a TCL program. This name is shown on the TCL Runtime Displays where steps are being manipulated. For example: STEP LOADING PWRUP LOAD (SEQUENCE, PWRUP); WAIT (15); ENDSTEP

2.4 TCL Program Hierarchy


TCL provides a hierarchy of program types for applications that require a hierarchical control structure. This hierarchy includes operations, procedures and schedules. Every TCL program must be one of these types, even when hierarchical control is not required.

2-2

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.5 Recipes

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.

3BUR 000 242 R0301 REV H

2-3

Taylor Control Language Users Guide Chapter 2 TCL Overview

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.

Figure 2-2. Example, Recipe Display

2.6 Downloading And Removing TCL Programs And Recipes


To implement TCL programs and recipes, they must be downloaded from the TCL development node (Multibus-based or Advant Station) to the specific location where they are to run. Downloading is invoked by a console operator via the Unit Detail Display, or by another TCL program via the LOAD statement. The LOAD statement provides the means to specify a particular unit or CCF loop to which the program or recipe is to be downloaded (recipes cannot be downloaded to a CCF loop). The CHECK statement is used to determine whether or not a program or recipe has been loaded. When a unit is specified in the LOAD statement, an Advant OCS device within the unit can also be specified. Advant OCS devices where TCL programs can run include Controller Cards and Multibus Subsystems. When a unit or loop is not specified in the LOAD statement, the program or recipe is downloaded to a default location. Refer to Section 4.16, Program Control Statements, for further information.

2-4

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.7 Program Control

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.

2.7 Program Control


When a program is downloaded, a control block is created for the program. The control block stores dynamic program control parameters (state, status and mode) that govern the execution of the program. These parameters are manipulated by a console operator from either the Unit Detail or Sequence Detail Display, or they are manipulated through execution of TCL statements in a program. This control block is deleted from the data base when the program is removed. Manipulation of these parameters provides the means to: Activate, abort or pause a program (state) Define, detect and handle abnormal conditions (status) Control method of stepwise execution (mode)

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.

3BUR 000 242 R0301 REV H

2-5

Taylor Control Language Users Guide Chapter 2 TCL Overview

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

End Abort Activate Resume Paused Active

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.7.3 Mode

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.4 Manipulating State, Status and Mode In TCL Programs


TCL statements such as ACTIVATE, PAUSE, and ABNORMAL manipulate dynamic program control parameters. They are implemented in a TCL program by any of the three methods described below. Demand A demand is a direct (unconditional) command causing a state, status or mode transition. For example: ACTIVATE (PWRUP, 3); This statement activates the TCL program called PWRUP and assigns the program priority level 3. Event An event is defined in a TCL program through an EVENT/ENDEVENT structure which includes the following TCL statements: EVENT, SETEVENT, ACTION, ENDEVENT and CLEAREVENT. These statements are used to define specific conditions under which one or more state, status and/or mode transitions occur.

3BUR 000 242 R0301 REV H

2-7

Taylor Control Language Users Guide Chapter 2 TCL Overview

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 Methods For Activating TCL Programs


TCL programs are activated for parallel processing, or they are activated as if they were internal subroutines within other TCL programs.

2.8.1 Activating TCL Programs for Parallel Processing


TCL provides a priority-structured, multitasking environment in which programs that are active on a card are executed in parallel and on a priority basis. There are 17 priority levels in TCL with 0 being the highest priority and 16 being the lowest. TCL programs are activated for parallel processing by one of the following methods: Execution of an ACTIVATE statement Execution of an EVENT/SETEVENT statement which includes ACTIVE as an action

2-8

3BUR 000 242 R0301 REV H

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.8.2 External Program Calls


A TCL program can call another (external) program and pass it parameters much like a program can call an internal subroutine. The calling program must be higher in the TCL program hierarchy than the external program. External programs are independent of the programs that call them. They are called by any higher level program with the following restriction: The external program must be declared in the calling program using an External Program Declaration statement (EXTPROC for procedures or EXTOPER for operations). Once an external program is declared, it is invoked in an executable statement by specifying the external program name and a parameter list.

3BUR 000 242 R0301 REV H

2-9

Taylor Control Language Users Guide Chapter 2 TCL Overview

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.8.3 External Subroutine Calls


TCL programs running in SC controllers or Multibus Subsystems can call external subroutines and pass them parameters. A detailed description of external subroutines is provided in Section 4.12.2, External Subroutines.

2.9 Variables And Data Base Access


TCL programs can manipulate variables that are declared within the programs. These variables have a local scope, meaning they are not recognized outside the program when the program is active and they are terminated when the program becomes inactive. In addition to these local variables, TCL programs can access and manipulate data base parameters in the Advant OCS. Since data base parameters are independent of the TCL programs, they are not limited in scope as locally declared variables are. They are accessed by any active TCL program, and they will continue to exist when the program becomes inactive.

2-10

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.9.1 Methods of Access

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.9.1 Methods of Access


Data base parameters can be accessed by a direct data base reference as described in the following paragraphs, or by SET and FETCH statements. When a direct data base reference is implemented 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 explanation in 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 when implementing a function where two different tag attributes are being used (for example, when setting the DEV_CMND attribute for a tag, and then reading the DEV_STAT). For example: SET($CV101.DEV_CMND,#OPEN); . . FETCH($CV101.DEV_STAT,STATUS); IF(STATUS = #OPEN)THEN . .

2.9.2 Loop and FCM Parameters


Loop parameters can occur once within a loop defined by a Loop Definition Templet. For instance, every loop can have just one measured value parameter (MEASURE). FCM parameters can occur in one or more FCMs within a loop. For instance, each FCM within a loop can have a result parameter (RESULT) associated with it. Thus, there can be more than one result parameter associated with a specific loop. Lists of loop and FCM parameters are provided in instruction book B140, Data Base Tables. Loop and FCM parameters are referenced in TCL programs by tag or by a unit relative name as defined on the Unit Relative Names Templet. These parameters are manipulated through TCL statements to implement control on a process device. For example, the following statements open a process valve. Both statements are functionally the same. One is an example of the tag reference method. $CV101.DEV_CMND:= #OPEN; The other is an example of the unit relative reference method. *RINSEVALVE.DEV_CMND:= #OPEN;

3BUR 000 242 R0301 REV H

2-11

Taylor Control Language Users Guide Chapter 2 TCL Overview

2.9.3 Control Block Parameters


Control block parameters are associated with dynamic program control. These parameters are accessed and manipulated in TCL programs to implement TCL program control. For example: IF (@STARTUP-UNIT1.SEQSTATE = #ACTIVE) THEN statement;

2.9.4 Recipe Parameters


Recipe parameters are associated with items in a recipe. They include recipe ID, description, engineering units, high limit, low limit and value. Recipe parameters provide data for a TCL program. The *BATCH statement provides a means to access header or formula data in the working recipe of the Batch 300 package. It can access recipe information for the batch which has currently booked the unit executing the sequence, or for the batch which has currently booked a specified unit.

2.9.5 Unit Variables


Unit variables are created on the Unit Master Templet. These variables are global for the unit with which the Unit Master Templet is associated. Unit variables provide a means of sharing parameters between programs running on a unit.

2.9.6 Unit Array Variables


Unit array variables are loaded and removed from units by TCL Load and Remove statements. These variables are used like other arrays except that arrays for the local unit and other units are accessed. While data base parameters are not local in scope, they must still be declared in any program where they are referenced. The following example shows how a loop parameter is declared in a TCL program and then later referenced in the same program. For example: OPER CHARGE; DBVAR MEASURE: REAL; BEGIN STEPDB REF $CV101.MEASURE:= 100.00; ENDSTEP END.

2-12

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.10 Report Services And History Services Interface

2.10 Report Services And History Services Interface


TCL includes a number of statements that interface TCL programs with Report Services and History Services Software. These statements are used to open and close batch files in the report generator (STARTBATCH/ENDBATCH), to mark the start and end of significant trend data (TRENDON/TRENDOFF), to record data (RECORD) to a report or History Subsystem, and to print and/or save a report (REPORT).

2.11 Peripheral I/O Interface


Data is exchanged between the TCL program and the Serial I/O ports, set up through the Serial I/O Port Setup Templet, via peripheral I/O statements (OPEN, CLOSE, INPUT and OUTPUT). OPEN and CLOSE establish and dissolve associations between specific ports and TCL programs. INPUT and OUTPUT read data from and write data to peripheral devices associated with the Serial I/O ports. In addition, these statements return an error code for error processing when a data exchange fails. It is recommended that no more than eight programs that use Input/Output statements be active on a given subsystem at one time. Input from a peripheral device must be null terminated. This means the ASCII string transmitted from the peripheral device must be terminated by the ASCII representation for 0 (zero). TCL provides ASCII string conversion functions (ASTOI, ASTOR, ITOAS and RTOAS) to convert ASCII strings from peripheral devices to their integer and/or real number equivalents and vice versa. These TCL functions eliminate the need to develop custom subroutines to perform the required ASCII string conversions.

2.12 Digital Device Control


Data base access is one way to implement direct control over digital devices in the system data base (see Section 2.9, Variables And Data Base Access). Control of digital devices is also implemented through the SET command, which provides the means for calling a subroutine in the event of a device error. For example: SET ($VALVEB.DEV_CMND, #OPEN, FAIL (1)); This statement sets the data base parameter VALVEB.DEV_CMND equal to open. If the command times out (valve does not open within allotted time), subroutine FAIL is called and is passed integer value 1.

2.13 Unit Message (Unitmsg) Display Interface


The Unit Message Display provides the means to communicate critical process information to an operator and to solicit a response. TCL programs interface with the Unit Message Display through the MESG or REPLY statements. Each of these statements sends a message to the display. Messages sent by REPLY statements require responses from the operators.

3BUR 000 242 R0301 REV H

2-13

Taylor Control Language Users Guide Chapter 2 TCL Overview

2.14 Mailbox Function


TCL mailboxes are used to pass data and synchronize TCL programs. For instance, consider that two programs are running on separate devices and require synchronization. The program running on one device (program no. 1) pauses itself by executing a RECEIVE statement with the WAIT option. This causes the program to wait for data to be present in a specific mailbox. The second program (program no. 2) causes program no. 1 to resume at the appropriate time by executing a SEND statement. This statement places data in the specified mailbox and allows the waiting program to resume. This method of synchronization eliminates the need for flagchecking logic. TCL mailboxes are defined by TCL Mailbox Templets as described in Section 3.5, TCL Mailbox Templet.

2.15 Include Function


The INCLUDE function allows you to set up and access a library of common subroutines, steps, variable declarations, and/or TCL statements so that blocks of common code are shared by a number of TCL programs. A block of common code can be included in a TCL program via the INCLUDE statement. This statement specifies the name of the include file where the common code is stored. There is no limit to the number of INCLUDE statements that may occur in a TCL program; however, INCLUDE statements are limited to ten nested levels (that is, the INCLUDE statement in a TCL program references an include file which contains an INCLUDE statement that references another include file, and so on.). Include files are created and edited through the TCL editor. An include file may contain any type of TCL statements except the program header statement (SCHED, PROC or OPER) and the program end statement (END. or}.). Include files cannot be compiled or loaded independently of TCL programs.

2.16 Implementing User Calculation FCMs Through TCL


Configurable Control Function (CCF) loops perform various functions by executing Function Class Modules (FCMs). There are a number of standard FCMs that support common algorithms such as PID control, linearization, simple calculations, and so on. If a CCF loop requires an algorithm that is not supported by standard FCMs, you can write the algorithm in TCL and access it for the loop by a CCF User Calculation (UCAL) FCM. A detailed description of this process is provided in Section 4.24, UCALs - User Calculation Routines For CCF.

2.17 Miscellaneous Functions


The following TCL functions are relatively common and have a similar method of implementation in Pascal. Compound statements IFTHENELSE CASE FORTO (or DOWNTO)DO

2-14

3BUR 000 242 R0301 REV H

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

2.18 Data Base Configuration Requirements


The following templets provide development and runtime support for TCL programs: TCL Development Templet Unit Master Templet TCL Runtime Templet Unit Relative Names Templet TCL Mailbox Templet

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.19 Program/Recipe Development Platforms


TCL programs and recipes can be developed using either a Multibus-based TCL development node in conjunction with a console subsystem, or an Advant Station that runs the AdvaBuild TCL Builder software. Multibus-based console support for program development includes the TCL editor, recipe editor, TCL compiler and TCL linker. Instructions for accessing and using these functions are provided in Chapter 5, Recipe Development and Chapter 6, TCL Program Development. For information regarding TCL program/recipe development via the Advant Station, refer to the AdvaBuild TCL Builder Users Guide. 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.

2.19.1 TCL and Recipe Editors


You can edit TCL recipes and sequences either via the Multibus-based editors, or via one of the editors supported by the TCL Builder (on the Advant Station). Editing is done in the form of source code. Source code is not executable. When a program is saved, it is stored as source code

3BUR 000 242 R0301 REV H

2-15

Taylor Control Language Users Guide Chapter 2 TCL Overview

in a source file. The editor includes processing functions such as insert text, delete text, search and replace, cut and paste, and so on.

2.19.2 Compiling and Linking


To run a TCL program, the source code must be transformed into executable code by the TCL compiler. The compiler checks the source code for syntax and format errors. When errors are found, they must be corrected through the editor and the edited program must be recompiled. Programs compiled without errors reside in an execution file in the node where they were compiled. Programs that are successfully compiled and then modified for functional reasons must also be recompiled. Data base references in the program are verified against the active data base through linking. If the data base references are valid, the linker puts them into a form that allows faster program loading. You may choose to link a program via the LINK or COMP & LINK softkey functions available through the Sequence Catalog Display. If a TCL program is not linked through the softkeys, linking is invoked automatically each time the program is loaded. It may be advantageous to invoke the TCL linker via the LINK or COMP & LINK softkeys when the program contains many data base references since it speeds up the program loading process. The following considerations should be noted when invoking the TCL linker by softkey: The program must be relinked whenever the current data base is recompiled. Any units for which data base references must be resolved must be declared in the TCL program. If the program is linked against multiple units and has unit-relative references to discrete loops, the same descriptor set must be used for all applicable discrete loops.

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.20 Runtime Console Support


TCL runtime console support includes the following functions: Downloading TCL programs to and removing them from their respective units Debugging Controlling TCL programs Manipulating recipes Interfacing with the Unit Message Display Sequential Function Chart Display (for Advant Station-based operator station only)

2-16

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 2.20.1 Download/Remove Function

2.20.1 Download/Remove Function


The Download function transfers a program or recipe from the node where it is compiled to the unit and Advant OCS device where it is executed. The Remove function removes the program or recipe from the unit and/or device. These functions are invoked via the Unit Detail Display. When a program is downloaded, its state is inactive. The program is not processed until it is activated by any one of several methods.

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.

3BUR 000 242 R0301 REV H

2-17

Taylor Control Language Users Guide Chapter 2 TCL Overview

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.

2.20.4 Recipe Manipulation


High and low limits, engineering units, and recipe item value can be changed for a recipe item during runtime via the Recipe Detail Display.

2.20.5 Unit Message Display


The Unit Message Display provides the means to communicate critical process information to an operator and to solicit a response. This communication occurs through the MESG, REPLY, and UNIT_ALARM statements. The MESG statement requires acknowledgment only. The REPLY statement solicits an operator response. UNIT_ALARM requires acknowledgment and an alarm clear signal.

2.20.6 Display, Logging, and Recording of TCL Messages


TCL messages can be sent to other system applications such as reports and history. Routing of TCL messages is configured via Configuration Area Templets. These messages include: TCL Unit (Billboard) Messages which must be sent to consoles if the Unit Message feature is to be used. In addition, these messages are sent to Historical Subsystems and Alarm/Event Loggers. TCL Event Messages which include any change from any source to a sequence mode and any operator change to a sequence state, status or mode. These messages are sent to Historical Subsystem and Alarm/Event Loggers.

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.20.7 Sequential Function Chart (SFC) Display Functions


The SFC display provides an intuitive picture of the actions and transitions that occur in the course of a TCL sequence. The SFC display is only available on the Advant Station-based operator station. This display is not available on the Multibus-based console.

2-18

3BUR 000 242 R0301 REV H

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.20.7.1 STEP_ACTIVITY Function


The STEP_ACTIVITY function alerts the system operator as to which activities have been performed in a step. This information is communicated in the form of load-time text and a runtime message. Load-time text is a text string (up to 39 characters). The runtime message is an optional message that, when used in the STEP_ACTIVITY statement, 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 status of a particular activity:

2.20.7.2 STEP_CONDITION Function


The STEP_CONDITION function informs the system operator of true/false conditions related to the step. Like, STEP_ACTIVITY, STEP_CONDITION also provides the means to define load-time text and a runtime message. This information is highlighted in one of three userdefined colors based on the evaluation of a statement associated with STEP_CONDITION. A link is provided to the first database reference in the 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.

2.20.7.3 STEP_TRANSITION Function


The STEP_TRANSITION function alerts the system operator of the occurrence of events that cause transitions to other steps. STEP_TRANSITION provides the means to define two loadtime 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. 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. The STEP_TRANSITION structure supports the following functionality.

3BUR 000 242 R0301 REV H

2-19

Taylor Control Language Users Guide Chapter 2 TCL Overview

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 3.1 Overview

Chapter 3 Data Base Templets for TCL

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.2 TCL Development Templet


One TCL Development Templet is required for each node where TCL programs are written. It establishes TCL editing and compiling capability for the subsystem. It may be advantageous to have TCL development capability on more than one subsystem for redundancy and system flexibility. The TCL Development Templet is a child of the Generic DPSS (GenericD) templet that represents the subsystem where TCL development will be supported. The only field on the TCL Development Templet that requires an entry is the Templet Name field. The templet name is an alphanumeric string of up to 21 characters. There is no template view for the TCL Development object in the AdvaBuild Structure Builder.

3BUR 000 242 R0301 REV H

3-1

Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL

3.3 Unit Relative Names Templet


The Unit Relative Names Templet, Figure 3-1, is required when TCL programs run in symmetrical units. This templet provides the means to relate common elements in symmetrical units by assigning generic reference names to the common elements. Thus, one generic program can run on multiple units that are symmetrical. Unit symmetry is described in Section 2.2, Units And Unit Symmetry. This templet is a child of the TCL Development Templet. The TEMPLET NAME field is used to assign a name to the templet. The edit window is used to associate a unit relative name for a loop with the actual tag for the loop. This information is used to define a lookup table in the data base which allows TCL programs to be written using the unit relative names. The entries in the following example assign the unit relative name RINSEVALVE to three loops in three separate units. Unit Identifier UNIT1 UNIT2 UNIT3 Unit Relative Name RINSEVALVE RINSEVALVE RINSEVALVE Actual Tag Name RV100 RV200 RV300

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

3BUR 000 242 R0301 REV H

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.4 TCL Runtime Templet


One TCL Runtime Templet is required for each node (subsystem or control module) that executes TCL programs. It is a child of the Generic DPSS or Controller Templet. The TCL Runtime Templet is used to define a number of runtime parameters for the TCL programs running on the node such as the maximum number of active programs, maximum number of abnormal conditions defined, etc. If the limits for any one of the TCL runtime parameters are exceeded during runtime, the status of the current program changes to abnormal. The condition is #4, TCL runtime error. If the program has an ABNORMSUBR statement for this abnormal condition, the designated subroutine runs. Generally, if there is no designated subroutine, the current program pauses and an error message is printed. In some cases a runtime error is fatal to the executing sequence, that is, no ABNORM SUBR is executed. The TCL Runtime Templet is shown in Figure 3-2. In addition to templet name, the following fields must be defined for the TCL Runtime Templet.

3BUR 000 242 R0301 REV H

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

3BUR 000 242 R0301 REV H

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.

Figure 3-2. TCL Runtime Templet

3BUR 000 242 R0301 REV H

3-5

Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL

3.5 TCL Mailbox Templet


The TCL Mailbox Templet is optional. This templet is a child of the TCL Runtime Templet. A TCL Runtime Templet can have as many TCL Mailbox Templets as required. A TCL mailbox can be used to pass data and/or synchronize TCL programs. The following fields must be defined for each TCL Mailbox Templet, Figure 3-3. Number of Messages This field specifies the maximum number of messages a TCL mailbox can hold. Each message can be up to 39 characters. The maximum number of messages is 255. The default entry is 1. Number of Waiters This field is used to specify the number of TCL programs that can be queued to receive mail from an empty box, or send mail to a full box. The maximum number of waiters is 167. The default entry is 1.

Figure 3-3. TCL Mailbox Templet

3-6

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 3.6 Unit Master Templet

3.6 Unit Master Templet


One Unit Master Templet is required for each unit in the system. The Unit Master Templet is a child of the Generic DPSS or Controller templet for the node where TCL programs can run. A unit is a construct that allows programs to be executed. There can be more than one unit associated with a node or one unit can be spread out over multiple nodes. Thus there is not always a one-to-one correspondence between the nodes where TCL programs can run and Unit Master Templets. In some cases, one Unit Master Templet is associated with multiple nodes and in other cases, one node requires multiple Unit Master Templets. The Unit Master Templet provides the means to specify the Advant OCS devices to be associated with the unit and to establish some unit wide parameters. In addition, the Unit Master Templet can be used to create unit variables for manipulation in TCL programs. The following fields are provided on the Unit Master Templet, Figure 3-4. Figure 3-5 shows the list view. Templet Name Templet name is an alphanumeric string that becomes the name of the unit. It is used in TCL statements that call for a unit name such as the LOAD, REMOVE, and ACTIVATE statements. To avoid problems with other software applications that use the Unit Master Template name, use a letter (rather than a number) for the first character of the template name, and do not use embedded blanks or hyphens in the unit name. Recipe Device Name This field specifies the node to receive recipes for this unit. Any node represented in the DEVICE NAME field of this templet can be specified as the recipe node. This field requires an entry, otherwise a compilation error will occur. Auto Start TCL Task This field specifies the supervisory TCL program that may load and activate other TCL programs for the unit. If a supervisory program is not required, this field can be left blank. When a supervisory program is required, the program name must be entered as it appears on the Sequence Catalog Display. The program must be compiled before the node is downloaded. It does not have to be linked. It is downloaded automatically and it starts automatically. Unit Descriptor This field is used to define a descriptor for the unit. The Unit Descriptor is shown on the Unit Overview and Unit Detail Displays. Report ID, REPORT ID2 These fields are used to specify the Reports software package(s) (up to two) that will process batch data for this unit. There are two Reports packages that can run in the Advant OCS: Multibus-based Reports Services or AdvaInform Reports. The Report ID must be entered

3BUR 000 242 R0301 REV H

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 3.6 Unit Master Templet

Figure 3-4. Unit Master Templet

3BUR 000 242 R0301 REV H

3-9

Taylor Control Language Users Guide Chapter 3 Data Base Templets for TCL

Figure 3-5. Unit Master Templet, List View

3-10

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.1 Conventions

Chapter 4 TCL Language Specifications

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.2 TCL Program Structure


Every TCL program has a declaration part and an executable part. The declaration part is used to specify the program type and name, and to declare the following program elements: external programs, constants, variables and subroutines. The executable part comprises the TCL statements, expressions and commands that specify the instructions to be carried out during program execution.

3BUR 000 242 R0301 REV H

4-1

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.2.1 Declaration Part


The declaration part of a TCL program must occur before any executable statements in the main program. You must declare items before you use them. Items that have to be declared include: Header (program type and name) External programs to be called from the program Named constants to be referenced in the program Local variables to be referenced in the program Data base variables to be referenced in the program Unit variables to be referenced in the program Units that unit relative data base references must be resolved for Internal subroutines to be called from the program External subroutines to be called by the program

4.2.2 Executable Part


There are relatively few rules regarding format for the executable part of a TCL program. These rules are as follows: The first statement must be BEGIN and the last statement must be END followed by a period (.). All executable TCL statements must be contained within the bounds of a STEP/ENDSTEP or subroutine structure.

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.2.4 Statement Labels

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.2.4 Statement Labels


Statement labels are optional. You must use a label if you intend to branch to a statement via a GOTO statement. Statement labels must be unsigned (positive) integers followed by colons. Example: 40: STEP LOADING ESD

4.3 TCL Keywords


Keywords include all TCL commands, statements, function names, and operator names. Keywords have a specific meaning in TCL and cannot be used in any other context in a TCL program. For instance, a keyword cannot be used as a variable name, constant name or program name. Successive keywords must always be separated by a space or special character as specified by syntax. A listing of all TCL keywords is provided in the index.

4.4 Data Types


TCL has the following data types: real, integer, string and state descriptor.

4.4.1 Real Data


Real data are floating point numbers defined by a characteristic (exponent) and a mantissa. The mantissa is accurate to six places. Real data are entered in decimal form. For example: 2.386 75.04 0.15342

3BUR 000 242 R0301 REV H

4-3

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.4.2 Integer Data


Integers are whole numbers in the range of 2,147,483,648 to 2,147,483,647. For example: 26 47561 Hex constants are specified by the notation 0X. For example: 0XA1F

4.4.3 String Data


A string can have up to 39 alphanumeric characters enclosed in single or double quotation marks. For example: 'FCM_NAME' "Rinse_1"

4.4.4 State Descriptors


State descriptors are textual representations of state values for discrete data base parameters such as DEV_MODE and SEQSTATE. State values are stored in the data base as integers. For instance, for SEQSTATE, 1 = ACTIVE, 2 = PAUSED, and 3 = INACTIVE. For display and programming purposes, it is more meaningful to represent the state values as text strings rather than as integers. Most discrete data base parameters have predefined state descriptors. Some discrete data base parameters such as DEV_CMND can have state descriptors defined on Device Descriptor Templets. The state descriptor is actually a special form of integer data type (the descriptor is merely a textual representation of integer data). Therefore, when declaring a discrete parameter for a TCL program, the data type should be specified as INTEGER. For example: DBVAR SEQSTATE: INTEGER; State descriptors have a special syntax for use in TCL statements. The descriptors must always be preceded by the # symbol. For example: @STARTUP-UNIT1.SEQSTATE:= #ACTIVE;

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.5.1 Arithmetic Operators

4.5.1 Arithmetic Operators


The TCL arithmetic operators are: Operator + * / MOD ** (REAL) (INTEGER) Function Performed Addition, string concatenation Subtraction or unary Multiplication Division Modulo for example., 27 MOD 10 = 7) Exponentiation See Section 4.5.5, Mixed Mode Expressions. See Section 4.5.5, Mixed Mode Expressions.

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.

4.5.2 Relational Operators


The relational operators, and the comparisons they invoke, are: Operator = <> < <= >= > Comparison Equal to Not equal to Less than Less than or equal to Greater than or equal to Greater than

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

3BUR 000 242 R0301 REV H

4-5

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.5.3 Logical Operators


TCL logical operators and the operations they perform are: Operator NOT AND OR Operation Negation Logical AND Logical OR

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).

4.5.4 Order Of Computations


The order for performing operations is: 1. 2. 3. 4. 5. 6. NOT, unary Exponentiation Multiplication, division, modulo Addition, string concatenation, subtraction All relational operators Logical operators AND and OR

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.5.5 Mixed Mode Expressions

4.5.5 Mixed Mode Expressions


In the case of mixed mode expressions (for example, where integer and real numbers are mixed in an expression), the expression result takes on the data type of the assigned variable. For instance, in the example below the expression ($CV101.MEASURE) evaluates to a real number and the result is assigned to an integer variable (assuming I1 has been declared as an integer variable). Consequently, the result is truncated. Example: I1:= $CV101.MEASURE; When the data type of the expression result is converted to fit the data type of the assigned variable, the bit pattern of the expression result is altered. There are cases when it is necessary to preserve the bit pattern of the expression result in a mixed mode expression, such as when passing bit patterns for device handling. The (REAL) and (INTEGER) operators can be used for this purpose. (INTEGER) allows a real number to be stored in an integer variable while preserving the bit pattern of the real number. (REAL) allows an integer number to be stored in a real variable while preserving the bit pattern of the integer number. The (INTEGER) or (REAL) operator must occur immediately after the assignment operator as shown in the examples below. Example: I1:= (INTEGER) $CV101.MEASURE; R1:= (REAL) I1 + I2 * I3;

4.6 TCL Functions


TCL functions, Table 4-1, can be used in any expression to return values that are then used in the same manner as a variable or constant. A function is invoked by its name. The argument for the function is enclosed in parentheses. The general form of a function is: name(x) where name x is the function name is the argument VAR1:= SQRT (VAR2); where VAR1 is assigned the value of the square root of VAR2 IF (ABS (VAR1) > VAR2) THEN statement; Table 4-1 provides a categorical listing of TCL functions. Functions are grouped in the following categories: mathematical, trigonometric, string manipulation and date/time manipulation. These categories are described in the following paragraphs.

A function can be used for an assignment, as shown below:

A function can also be used in a logical expression as follows:

3BUR 000 242 R0301 REV H

4-7

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.6.1 Mathematical Functions


Mathematical functions are used as operands in expressions. They return values which are used within the expression.

4.6.1.1 ABS (Absolute) Function


The ABS function returns the absolute value of any constant, variable, or expression. The form of the function is ABS(x). Examples: ABS(7) ABS(3.6) is 7 is 3.6

4.6.1.2 ROUND Function


The ROUND function rounds the decimal portion of x up when equal to or greater than 0.5, or down when less than 0.5. The form of the function is ROUND(x). Examples: ROUND(14.5) ROUND(9.487) is 15.0 is 9.0

4.6.2 Trigonometric Functions


The argument for a trigonometric function can be a constant, variable, or expression. The result is always real. An error condition (for example, arithmetic overflow) causes the result to be expressed as the largest floating-point number. It also causes a runtime error message (abnormal condition no. 4) to be posted.

4.6.3 Bit Manipulation Functions


4.6.3.1 BIT ONES COMPLEMENT Function
The Bit One's Complement function, BIT_COMP(exp), performs a NOT operation on each bit of the expression.

4.6.3.2 BIT SHIFT Function


The Bit Shift function shifts the bits within an expression a specified number of places. The form of the function is BIT_SHIFT(exp, count). When the count is positive, bits are shifted to the left. When the count is negative, bits are shifted right.

4-8

3BUR 000 242 R0301 REV H

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

3BUR 000 242 R0301 REV H

4-9

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.6.4 String Manipulation Functions


4.6.4.1 LEN Function
LEN returns the length (number of characters) of string x. Its form is LEN(x). For example, if x is the string ABCDEFG then LEN(x) is 7

4.6.4.2 MID Function


MID returns the substring value of z characters starting at position y (z and y >=1) in string x. Its form is MID(x,y,z). For example, if x is the string ABCDEFG then MID(x,3,4) is CDEF

4.6.4.3 ORD Function


ORD returns the ordinal number related to ASCII character x. Its form is ORD(x). For example, ORD(A) is 65. An ASCII character code table is provided in Appendix A, Reference Tables.

4.6.4.4 CHR Function


CHR returns the ASCII character related to ordinal number x. Its form is CHR(x). For example, CHR (65) is A. An ASCII character code table is provided in Appendix A, Reference Tables.

4.6.4.5 ASTOI Function


ASTOI returns the integer equivalent of an ASCII string. The form is ASTOI(x). For example: ASTOI (100) ASTOI (100+5) is 100 is 1005

4.6.4.6 ASTOR Function


ASTOR returns the real equivalent of an ASCII string. The form is ASTOR(x). For example: ASTOR (25.25) ASTOR (0.078) is 25.25 is 0.078

4.6.4.7 ITOAS Function


ITOAS returns the ASCII string equivalent of an integer. The form is ITOAS(x). For example: ITOAS (100) is 100

4.6.4.8 RTOAS Function


RTOAS returns the ASCII string equivalent of a real number. The form is RTOAS(x).

4-10

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.6.5 Date and Time Functions

Example: RTOAS (25.25) is 25.25

4.6.5 Date and Time Functions


4.6.5.1 DATE Function
DATE gets the specified portion of the date. Its form is DATE(x), where x is a constant, a variable, or an expression with a numeric value of 1, 2, or 3. x = 1 returns the day of the month (131) x = 2 returns the month of the year (112) x = 3 returns the year (1985) Example: X:= DATE(1); returns the day of the month

4.6.5.2 TIME Function


TIME gets the specified portion of the time of day. The form is TIME(x), where x is a constant, variable, or an expression with a numeric value of 1, 2, 3 or 4. x = 1 returns the second of the minute (059) x = 2 returns the minute of the hour (059) x = 3 returns the hour of the day (023) x = 4 returns TIME (3)*100 plus TIME (2) which provides military time Example: x:=TIME(3); returns the hour of the day

4.7 Program Header And Parameter Lists


The program header specifies the type of program (schedule, procedure or operation) and the name. For procedures and operations, the header may include an optional parameter list. The program name is an alphanumeric string of up to 12 characters. The first character must be a letter. In addition, the first eight characters must be a unique combination. This means the combination cannot be a keyword, variable name, constant name or another program name. The parameter list includes local variables and their respective data types. These local variables are passed their initial values via an external program call (see Section 4.8, External Programs). The number of integer and/or real variables in a parameter list cannot exceed eight. The number of string variables cannot exceed five. The total number of variables cannot exceed 12. Separate different variable types in a parameter list using the semicolon.

3BUR 000 242 R0301 REV H

4-11

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.8 External Programs


A TCL program can call another (external) program and pass it parameters much like a program can call an internal subroutine. The calling program must be higher in the TCL program hierarchy than the external program. External programs are independent of the programs that call them. They can be called by any higher level program with the following restriction. The external program must be declared in the calling program. The statement for declaring procedures is EXTPROC, and the statement for declaring operations is EXTOPER. Once an external program is declared, it can be invoked in an executable statement by specifying the external program name and parameter list (optional). 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 is resumed at the point where it was suspended. Parameters can be passed from the calling program to the external program by value only. This means that the parameter in the calling program retains its original value, even if the value changes during execution of the external program (that is, the external program cannot pass a new parameter value back to the calling program).

4-12

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.8 External Programs

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.

3BUR 000 242 R0301 REV H

4-13

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.10 Variables

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.

4.10.1 Local Variables


Local variables require a user-defined variable name. The variable name is an alphanumeric string of up to 12 characters. The first character must be a letter. The string cannot be a keyword but keywords can be embedded. Variables that are declared in the main program are global for the entire program, including any subroutines declared within. Variables that are declared in a subroutine are not recognized at higher levels, but are global to the subroutine and any subroutines declared within. A variable name declared within a main program can be declared again in any subroutine or parameter list for any external program declared in the main program. If a variable name is declared in the main program and declared again in a subroutine, only the variable name declared in the subroutine is recognized in that subroutine and any subroutine declared within. A local variable can either be a simple structure (one value per variable) or it can be an array structure (multiple values arranged in either one or two dimensions).

4.10.1.1 Simple Variables


The Declaration statement for a simple local variable has the following format: VAR name: type; where VAR name type is the keyword for local variable declaration. is the variable name. is the data type REAL, INTEGER or STRING.

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;

3BUR 000 242 R0301 REV H

4-15

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

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.10.2 Data Base Parameters


TCL programs can access and manipulate Advant OCS data base parameters that occur in loops (as defined by a Loop Definition Templet), Function Class Modules (FCMs), program control blocks and recipes. These parameters exist outside the TCL programs and therefore are not as limited in scope as local variables. Parameters must be declared within the program where they are being referenced. They do not need to be initialized since they already have a value within the system data base.

4.10.2.1 Declaring Data Base Parameters


To declare data base parameters, use the keyword DBVAR in place of VAR. The parameter name is not a user-defined string, but rather a predefined mnemonic. Refer to instruction book B140, Data Base Tables, for these mnemonics. The format for a Data Base Parameter Declaration statement is as follows: DBVAR name: type; where DBVAR name type Example: DBVAR RESULT, MEASURE, RVALUE: REAL; SEQMODE, SSTATUS: INTEGER; Each type of data base parameter (loop, FCM, program control block) has a different method for access in a TCL program as described in the following paragraphs. Recipe parameters are described separately in Section 4.10.3, Recipe Parameters. is the keyword for declaring data base parameters. is the parameter mnemonic (described later). is the data type REAL, INTEGER or STRING

3BUR 000 242 R0301 REV H

4-17

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

4-19

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.10.3 Recipe Parameters


TCL programs can access the parameters from TCL and Batch 300 recipes active on any unit. For integer and real items, the value, high limit and low limit parameters can be accessed. For string items, the value, descriptor, engineering units, and recipe ID parameters can be accessed. The mnemonics for the parameters are given in Table 4-3. Recipe access statements have two formats; one for TCL recipes and one for batch 300 recipes.

4-20

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.10.3 Recipe Parameters

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...

3BUR 000 242 R0301 REV H

4-21

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.10.4 Unit Variables


Unit variables are created via the Unit Master templet. The scope of unit variables is all programs running on the unit associated with the Unit Master templet where the variable was created. Unit variables must be declared in the program where they are referenced. The method for declaring unit variables is similar to the method for declaring local variables except that the UNITVAR keyword is used in place of the VAR keyword. In addition, the name part of the statement is different. The format for unit variable declaration is shown below. UNITVAR name: type; where UNITVAR name type is the keyword for declaring unit variables. is the name of the unit variable as defined in the Unit Master templet. is the data type REAL, INTEGER or STRING.

4.10.4.1 Unit Array Variables


Unit array variables are loaded/removed from units via the LOAD and REMOVE statements. They can be loaded in SC controllers, Multibus Subsystems, or Advant Stations. They CANNOT be loaded in 6000 series controllers. The LOAD statement has the format: label: LOAD (VAR, name: ARRAY [a..m, b..n] OF type, unit); where VAR name ARRAY a m b n type unit is a keyword that specifies the statement is to load an array unit variable. is the name to be assigned to the array. is the keyword for declaring an array. is an integer for lower boundary of first dimension. The range is 0 to 32766 for REAL or INTEGER types, or 0 to 1629 for STRING types. is an integer for upper boundary of first dimension. The range is 1 to 32767 for REAL or INTEGER types, or 1 to 1630 for STRING types. is the lower boundary of optional second dimension. Range is same as for a. is the upper boundary of optional second dimension. Range is same as for m. is the data type REAL, INTEGER, STRING, BYTES, or TWO_BYTES. is the name of the unit to receive the array. If unit is not provided, the array is loaded to the unit executing the statement. If the unit is split among multiple devices, the array is loaded to the device (subsystem or control module) where the Unit Master templet is assigned.

4-22

3BUR 000 242 R0301 REV H

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.10.5 Variable Tags - VARTAGS


The Variable Tag feature allows data base tags to be referred to via specified variables during runtime. These variables can also be used as regular string variables and can hold any string item. Variable tags can be used with loop data base parameters. There is a maximum of 255 VARTAG references per sequence.

4.10.5.1 Declaring a VARTAG


The variable tag declaration must be included in the variable declaration portion of a sequence. The keyword is VARTAG. Examples: VARTAG V1 = (LIC101, LIC102, LIC103); D1 = (PMP404, PMP407, PMP410, PMP420); or VARTAG LEVEL1 = (LIC-101, LIC-102, LIC-103); OUTLETPMP = (PMP-404, PMPM-407, PMP-410, PMP-420); Tag names with any non-alphanumeric characters or tags which start with a number must be enclosed in quotes. Tags assigned to a common VARTAG must all be capable of the same operations to be performed in any statement which references the VARTAG. For continuous loops, each loop in the list must have the same FCMs that are referenced. For device loops, the loops must have the same descriptor sets if the VARTAG is used to access the DEV_CMND or DEV_STAT attribute.

3BUR 000 242 R0301 REV H

4-23

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.10.5.2 Declaring Unit Relative VARTAGS


The following are examples of declaring unit relative VARTAGS. VARTAG V2 = (LEVEL01, LEVEL02, LEVEL03); D2 = (FEEDPMP, DSCHRGPMP); or VARTAG TANKLEVEL = (LEVEL-01, LEVEL-02, LEVEL-03); PUMPS = (FEEDPMP, DSCHRGPMP); Unit relative names with any non-alphanumeric characters or unit relative names which start with a number must be enclosed in quotes. Do not use an asterisk (*) when declaring unit relative VARTAGS. Do not mix unit relative and direct tag references in the same VARTAG declaration because they are not capable of the same usage. (Either * or $ must precede VARTAG id when it is referenced.).

4.10.5.3 Using a VARTAG Reference


There are two methods to reference VARTAGS. The first method assigns a string variable to the VARTAG variable. The second method uses an index into the VARTAG list. Method 1 - Assigning a string variable to the VARTAG variable. Example: V1: = LIC101; D1:= PMP + ITOAS (PMPNUM): /* PMPNUM is a local integer variable that has been assigned the value of 404, 407, 410, or 420)*/ At any point in the sequence, V1 or D1 may be assigned another value as long as it is one of the tag names specified in the VARTAG list. Using direct tag reference: $V1 -PID.SETPOINT:= 56.0; L1:= $V1.MEASURE; SET ($D2.DEV_CMND, #OPEN, FAIL(D2)); Using unit relative tag reference: *V2 - PID.OUT_MODE:= #MANUAL; IF *D2.DEV_STAT = #OPEN THEN *V2 - PID.SETPOINT:= 0.0; Method 2 - VARTAG as an array with actual tag assigned by array index into tag list. Example: $V1 [2] - PID.SETPOINT:= 45.0; /*This assigns the setpoint of LIC102 because it is the second tag in the VARTAG list.*/ CURLEVEL:= *V2 [1]. MEASURE; Both methods 1 and 2 can access a VARTAG variable in a sequence.

4-24

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.10.6 Fetch and Set

4.10.5.4 Using a VARTAG as a String in a Message Statement


The following are examples of using a VARTAG in a Message statement: MESG (D1[1], "IS ON"); /*Sets up the message: PMP401 IS ON*/ MESG (D2[1], "IS ON"); /*Will not give you the actual tag name for a unit relative tag in the message. It will set up the message: FEEDPMP IS ON */

4.10.6 Fetch and Set


The FETCH and SET statements provide a method for retrieving and changing items in the data base when the new value must be changed or retrieved immediately (rather than after the next data base scan in CCF, as in a direct data base reference). Such timing is particularly critical when performing an operation based on two different tag attributes (for example, when setting the DEV_CMND attribute for a tag, and then reading the DEV_STAT).

4.10.6.1 Fetch Statement


The FETCH statement can retrieve the value of any data base parameter that can be accessed by TCL. The fetch is performed synchronously, that is to say, as part of statement execution. No further statements are executed until the data base access is completed. The FETCH statement has the form: label: FETCH (item, value, subroutine (parameters)); where item is the data base item being fetched.

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

3BUR 000 242 R0301 REV H

4-25

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.

4.10.6.2 SET Statement


The SET statement can be used to change the values of any data base item that can be accessed by TCL. The changes are performed synchronously, as part of statement execution. The statement has the form: label: SET (item, value, subroutine (parameters)); where item value subroutine is the data base item being accessed, as described for the FETCH statement. is a new value assigned to the parameter for example, #ON, 50.5, #OFF). is a subroutine to execute if there is an error in performing the change or if the device times out when changing the device command for a device loop. 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

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

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

4-27

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

TCL maintains value Historical Data

Current Data 0.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.10.7 Assignment Statement


The Assignment statement is used to assign a new value to a variable. It has the form: label: identifier:= expression; where label identifier expression Examples: Y:= Y + 2; $CV101.MEASURE:= 90.0; is the optional statement label (unsigned integer followed by colon). is the variable name (local, data base, recipe or unit). is a combination of constants, variables, operators and functions that define the value of the variable.

4-28

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.11 Units

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.12.1 Internal Subroutines


An internal subroutine is a group of TCL statements that are declared in a specific TCL program and that can be invoked by that program through the execution of a single Subroutine Call statement. Internal subroutines are well suited for applications where a group of statements must be executed many times during the course of a program. Rather than enter the statements repeatedly in code, the statements can be entered once and then referenced as required through the subroutine call.

3BUR 000 242 R0301 REV H

4-29

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.12.2 External Subroutines

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.12.2 External Subroutines


A TCL program can call an external subroutine and pass it parameters (up to 16) much like a program can call an internal subroutine. The external subroutine structure is the same as an internal subroutine except that it resides in its own file on the TCL catalog. External subroutines can run in SC controllers or Multibus Subsystems. They cannot run in 6000 series controllers. External subroutines are created on the TCL catalog using the program header SUBR. They are automatically translated after compilation into object code. This code is linked when the calling program is downloaded. The subroutine executes at the priority of the calling sequence. External subroutines can be used by more than one program. They are re-entrant using no static variables so they can be called simultaneously from several tasks. The subroutine can have a name with up to 12 alphanumeric characters. The first character must be a letter, and the first eight characters must be a unique combination. This means the combination cannot match another program name on the TCL catalog. External subroutines are independent of the programs that call them. They can be called by any program if the external subroutine is declared in the program. The keyword for declaring an external subroutine is EXTSUBR. 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. An external subroutine performs local data manipulation only, i.e., assignments, logical, and mathematical functions. Parameters must be constants or TCL variables which are passed by reference or value (except strings or arrays). No expressions are allowed. 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

3BUR 000 242 R0301 REV H

4-31

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.13 Program Flow Statements


Program flow statements either control the order in which statements are executed, or they provide the required structure for TCL programs.

4.13.1 BEGIN/END Structure


All executable TCL statements must be bounded by a BEGIN/END structure. BEGIN marks the beginning of the executable part of a TCL program. END followed by a period (.) marks the end. When END followed by a period is executed, the program is placed in the inactive state. END is also used in compound statements, CASE statements, and subroutine declarations. In a compound statement, there is no punctuation following the END statement. In a CASE statement or subroutine declaration, a semicolon is required following the END statement.

4-32

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.13.2 STEP/ENDSTEP Structure

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.13.2 STEP/ENDSTEP Structure


All executable statements must be within the boundaries of a STEP/ENDSTEP structure. Thus, every TCL program must have at least one STEP/ENDSTEP structure. STEP marks the start of a step, which is one or more related TCL statements that perform a specific function. STEP requires a user-defined step name which appears on the TCL Runtime Displays, where steps can be manipulated. ENDSTEP marks the end of the step. STEP/ENDSTEP has the form: label: STEP step name statement1; statement2; statementn; label: ENDSTEP where label step name statement1..n Example: STEP FILL TO 45% WITH A SET ($FS101A.DEV_CMND, #OPEN, FAIL (1)); WHILE ($LI101A.MEASURE = 45.0) DO WAIT (5); SET ($FS101A.DEV_CMND, #CLOSE, FAIL (2); ENDSTEP is an optional program line number (unsigned integer). is the user-defined string of up to 20 characters bounded by single or double quotation marks. are the TCL statements that comprise the step.

4.13.3 Compound Statements


A compound statement is formed by bounding a series of statements with keywords BEGIN and END (without a period). Curly braces { and } can be used in place of BEGIN and END, respectively. All the statements within the bounds of a compound statement are treated as one statement. The compound statement is particularly useful in conditional structures where it is necessary to associate more than one statement with a specific condition. The compound statement has the form: label: BEGIN statement1; statement2; statementn; END

3BUR 000 242 R0301 REV H

4-33

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.13.4 Conditional Statements


4.13.4.1 IFTHENELSE
This statement has two forms: IF..THEN or IF..THEN..ELSE. The IFTHEN statement evaluates an expression, then executes a statement if the evaluation is true. The IFTHENELSE statement evaluates an expression, then executes one statement if the evaluation is true, or a different statement if the evaluation is false. This statement has the form: label: IF (expression) THEN statement; ELSE statement; where label expression statement is the optional program line number (unsigned integer). is an arithmetic, relational or logical expression. is a simple or compound statement.

4-34

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.13.4 Conditional Statements

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.

4.13.4.2 CASE Statement


CASE evaluates an expression and then executes one statement out of a list of statements based on the result of the expression. Each statement in the list must have an integer or string constant associated with it. The statement whose constant matches the expression result is executed. If the evaluation does not match any of the constant values, control passes to the statement following the CASE statement unless the optional OTHERWISE is included. If OTHERWISE is included, the statement following it is executed before control is passed to the statement following the CASE statement. If a CASE statement is used within a CASE statement, the constant must be unique throughout the entire CASE structure. The statement has the form: label: CASE expression OF constant1: statement1; constant2: statement2; constantn: statementn; OTHERWISE statementa; END; where label expression constant statement is the optional program line number. evaluates to an integer or string. is an integer or string unique throughout the CASE structure. is a simple or compound statement.

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.

3BUR 000 242 R0301 REV H

4-35

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.13.5 Looping Statements


TCL has three constructs for looping suited for different programming situations.

4.13.5.1 FORDOWNTO (TO)DO Statement


The FOR statement is used when the number of loop iterations is known beforehand. The loop counter variable is initialized to the initial count value, which is then incremented or decremented by one until the end count is reached. If the loop counter is initialized to a value that exceeds the end count, the loop is not executed. The statement has the form: label: FOR loop counter:= initial count DOWNTO end count DO statement; or label: FOR loop counter:= initial count TO end count DO statement; where loop counter initial count end count statement Example: FOR COUNT:= 10 DOWNTO 1 DO x[COUNT]:= COUNT * 5; is a local integer variable. is an expression that evaluates to an integer value. is an expression that evaluates to an integer value. is a simple or compound statement.

4-36

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.13.5 Looping Statements

4.13.5.2 REPEATUNTIL Statement


This type of loop executes until the result of the condition expression is true. Since the condition check occurs at the end, the body of the loop is executed at least once. The REPEAT statement has the form: label: REPEAT statement1; statement2; statementn; UNTIL expression; where expression statement Example: REPEAT IF ($TC106A.MEASURE > 260.0) THEN FAIL (2); WAIT (NAME [3]/10); COUNTER:= COUNTER + 1; UNTIL COUNTER >= 10; is an arithmetic, relational or logical expression. is a simple or compound statement.

4.13.5.3 WHILEDO Statement


The WHILE...DO statement evaluates the expression and executes the loop as long as the evaluation is true. Since the expression is evaluated before the body of the loop, the loop may or may not be executed. The statement has the form: label: WHILE expression DO statement; where expression statement Example: WHILE $FIC2125.MEASURE < 10.0 DO BEGIN MESG (INCREASE AIR FLOW); WAIT (10); END is an arithmetic, relational or logical expression. is a simple or compound statement.

4.13.5.4 GOTO Statement


The GOTO statement interrupts the normal flow of the program, causing it to resume execution on the statement number named by it. GOTO can be used to branch to any statement within the same step (or subroutine) that the GOTO statement occurs, or GOTO can be used to branch from any step (or subroutine) to the beginning of any other step.

3BUR 000 242 R0301 REV H

4-37

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.

4.14 Serial I/O Statements


The Serial I/O statements (OPEN, CLOSE, INPUT and OUTPUT) support data exchange between the TCL program and Serial I/O ports established via the Serial I/O Port Setup templet. These statements are used to establish and dissolve associations between these ports and TCL programs, and to read data from and write data to peripheral devices connected to the Serial I/O ports. It is recommended that no more than eight programs that use Input/Output statements be active on a given subsystem at one time. ASCII conversion functions (ASTOI, ASTOR, RTOAS and ITOAS) facilitate communications with peripheral ASCII devices. These functions can be used to convert ASCII strings to their integer and/or real number equivalents or vice versa. Refer to Section 4.6.4, String Manipulation Functions, for further information regarding these functions.

4.14.1 OPEN Statement


The OPEN statement opens a specific port. It also returns either a port number (port in the other peripheral I/O statements), or an error code. This statement has the form: port:= OPEN(name); where port name is a local integer variable that stores the number assigned to the port on the Serial I/O Port Setup Templet or the error code. is the port name on the Serial I/O Port Setup templet (literal or variable).

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.14.2 CLOSE Statement

4.14.2 CLOSE Statement


The CLOSE statement dissolves the association between a port and a TCL program. CLOSE also returns an error code (TRUE if CLOSE is successful or FALSE if CLOSE fails). The statement has the form: status:= CLOSE(port); where status port Example: STATUS:= CLOSE (PORTX); is a local integer that stores the error code, (TRUE for successful or FALSE for failure). is a local integer variable that represents a port number acquired by an OPEN statement.

4.14.3 INPUT Statement


The INPUT statement reads data from a peripheral device to local variables declared in the program, and returns an error code (TRUE if INPUT is successful or FALSE if INPUT fails). Variables in the input from the peripheral device must be null terminated. If a string variable in the peripheral input is longer than 39 characters, multiple TCL string variables can be used to receive it. For example, a string variable in the peripheral input has 51 characters with the 51st character being the null terminator. Two TCL variables are set up to receive it. Characters 1 to 39 of the input go into the first TCL variable, characters 40 to 50 go into the second one. In addition, the complete input packet from the peripheral device must be null terminated. This is done automatically for input devices whose port type is GENERIC, TERMCHAR or MODBUSA. For input devices whose port type is MODBUSB, MOD30 or MICROMAC, you must insure that the input is null terminated. The statement has the form: status:= INPUT(port, variables); where status port variables Example: TRANS_CODE:= INPUT (PORTX, INDATA); I1:= ASTOI (INDATA); The Input statement (and Output statement) allow a single array variable (without indices) to be used which designates both a direct I/O buffer address and an implied number of bytes for the operation. For example: TRANS_CODE:= INPUT (PORTX, BUFARY); is a local integer variable that stores the error code (TRUE for successful or FALSE for failure). is a local integer variable that represents a port number acquired by an OPEN statement. are one or more local variables (real, integer, or string).

3BUR 000 242 R0301 REV H

4-39

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.14.4 OUTPUT Statement


The OUTPUT statement transfers data from specified variables to a peripheral device. OUTPUT also returns an error code (TRUE if OUTPUT is successful or FALSE if OUTPUT fails). The statement has the form: status:= OUTPUT(port, variables); where status port variables is a local integer variable that stores the error code (TRUE for successful or FALSE for failure). is a local integer variable that represents a port number acquired by an OPEN statement. are up to 13 variables in any combination of real, integer and string (12 string variables maximum). STEP OPEN PORTS PORT1:= OPEN (DEVICE1); IF (PORT1 = -1) THEN FAIL (1); PORT2:= OPEN (DEVICE2); IF (PORT2 = -1) THEN FAIL (2); ENDSTEP /* */ STEP INPUT FROM DEVICE1 STATUS:= INPUT (PORT1, INDATA); IF (STATUS = FALSE) THEN FAIL (1); I1:= ASTOI (INDATA); ENDSTEP /* */ STEP OUTPUT TO DEVICE2 STATUS:= OUTPUT (PORT2, I1); IF (STATUS = FALSE) THEN FAIL (2); ENDSTEP /* */ STEP CLOSE PORTS STATUS:= CLOSE (PORT1); IF (STATUS = FALSE) THEN FAIL (1); STATUS:= CLOSE (PORT2); IF (STATUS = 0) THEN FAIL(2); ENDSTEP The Output statement can use a single array variable in the manner described above for the Input statement.

The following example shows a sequence of peripheral I/O statements:

4-40

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.15 Disk I/O Statements

4.15 Disk I/O Statements


The FILESYS statement is used to access the Advant OCS disk file system. The statement must execute in the subsystem that contains the disk. The FILESYS_INCL include file is provided with the TCL software to support the FILESYS; statement. This file provides the means to create a file control block of the proper size and to interpret status responses and information in the file control block. The contents of FILESYS_INCL are described in Table 4-4. Table 4-4. FILESYS_INCL File Mnemonic FILE_FCBBEG FILE_FCBSIZ Data Type/value Integer = 1 Integer = 48 Description Row begin for FCB array, sets size of array with FCBSIZ Row end for FCB array, sets size of array with FCBBEG Note that FILE_FCBSIZ must be changed from 48 to 50 in the TCL Builder version of the FILESYS_INCL file before you run the syntax checker on a sequence that has filesys statements. Refer to the TCL Builder Users Guide for details. FILE_BCOUNT FILE_RECHIGH FILE_RECORD FILE_END FILE_NOFILES FILE_NOCHANS FILE_BADPATH FILE_BADDEV FILE_NOROOM FILE_OVERFL FILE_OPEN FILE_SIZCON FILE_CBINUSE Integer = 34 Integer = 27 Integer = 28 Integer = 0x1 Integer = 0xA Integer = 0xB Integer = 0x11 Integer = 0x14 Integer = 0x1A Integer = 0x1F Integer = 0x22 Integer = 0x2B Integer = 0x100 Array location where actual I/O byte count is stored Array location where current record number (high word) is stored Array location where current record number (low word) is stored Status - End of File (FALSE = no error) Status - Too many files open (FALSE = no error) Status - Same as FILE_NOFILES Status - Invalid file path format (FALSE = no error) Status - Invalid device given (FALSE = no error) Status - Insufficient space on dev (FALSE = no error) Status - Data truncated to fit buffer (FALSE = no error) Status - File already open (FALSE = no error) Status - Buffer size conflict (FALSE = no error) Status - TCL FCB already in use (FALSE = no error)

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.

3BUR 000 242 R0301 REV H

4-41

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.16 Program Control Statements

4.16 Program Control Statements


Program control statements include: LOAD, REMOVE, CHECK, ACTIVATE, ABORT, PAUSE, RESUME, ABNORMAL, ABNORMSUBR, CRITICAL/NONCRITICAL, and the EVENT/SETEVENT structure (EVENT / SETEVENT / ACTION / ENDEVENT / CLEAREVENT). These statements provide the means to: Download/remove programs and recipes Check whether or not programs and recipes have been downloaded Activate, abort and pause program execution Define and react to abnormal conditions Control method of stepwise execution

4.16.1 LOAD Statement


The LOAD statement is used to download a TCL program or recipe to the subsystem or controller where it will run. The LOAD statement may optionally specify the unit and Advant OCS device or the loop to which the program or recipe is downloaded (recipes cannot be downloaded to a loop). If the loop, device and/or unit are not specified for a program, the program is downloaded to the unit and device where the program that executed the LOAD statement is running. If the device and/or unit are not specified for a recipe, the recipe is downloaded to the device that is specified in the RECIPE DEVICE NAME field on the applicable Unit Master Templet. The LOAD statement has the form: label: LOAD (type, name, unit/loop,device); where type name unit/loop is RECIPE for recipes or SEQUENCE for programs. is the program or recipe name as defined in the TCL catalog. is the name of the unit or loop to which the program/recipe is being loaded (name must be entered as it is defined via the Unit Master or Loop Definition templet); loop specification is only applicable for programs (when type is SEQUENCE). is the relative device name of the subsystem or controller the program is being loaded to. This relative device name is defined in the Device Name-Relative Device Name Edit Window of the Unit Master Templet that defines the unit. A device can only be specified when a unit is also specified. LOAD (SEQUENCE, STARTUP, UNIT1, CNTR1);

device

Example:

3BUR 000 242 R0301 REV H

4-43

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.16.2 REMOVE Statement


The REMOVE statement removes a program or recipe from a subsystem. It has the form: label: REMOVE (type, name, unit/loop,device); where type name unit/loop is RECIPE for recipes or SEQUENCE for programs. is the program or recipe name as defined in the TCL catalog. is the name of the unit or loop from which the program/recipe is being removed (name must be entered as it is defined on the Unit Master or Loop Definition templet). is the relative device name of the subsystem or controller from which the program is being removed. This relative device name is defined in the Device Name-Relative Device Name edit window of the Unit Master templet that defines the unit. A device can only be specified when a unit is also specified. REMOVE (SEQUENCE, STARTUP, UNIT1, CNTR1);

device

Example:

4.16.3 CHECK Statement


The CHECK statement is used to determine whether or not a program or recipe has been downloaded. The CHECK statement has the form: label: status:= CHECK(type,name,unit/loop); where status type name unit/loop is a Boolean variable that is TRUE when the program or recipe has been downloaded, or FALSE when the program or recipe has not been downloaded. is RECIPE for recipes, SEQUENCE for programs, or LOCAL for local access. is the program or recipe name as defined in the TCL catalog. is the name of the unit or loop where program/recipe is being loaded (name must be entered as defined on the Unit Master or Loop Definition templet); loop specification is only applicable for programs (when type is LOCAL which only checks in the same node where the sequence is executing). STATUS:= FALSE; WHILE (STATUS = FALSE) DO BEGIN STATUS:= CHECK (SEQUENCE, BENCHOPER,UNIT2); IF (STATUS = FALSE) THEN WAIT (10); END ACTIVATE (BENCHOPER,2,UNIT2);

The following examples are equivalent. Either format can be used as a matter of preference.

4-44

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.16.4 ACTIVATE Statement

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.16.4 ACTIVATE Statement


ACTIVATE invokes another program to execute in parallel with the program that executes the ACTIVATE statement. ACTIVATE includes the means for specifying the priority level at which the activated program runs. The unit where the program runs can be specified as an option. If the unit is not specified, the program runs on the same unit as the program that activated it. label: ACTIVATE (program, priority,unit); where program priority unit Example: ACTIVATE (PWRUP, 3); is the name of the program being activated as defined in the TCL catalog. is an integer from 1 (highest) to 16 (lowest). is the name of the unit where the program runs (as defined on the Unit Master templet).

4.16.5 ABORT Statement


The ABORT statement places a program in the inactive state. The program name and unit can be specified as an option. If no program is specified, the program executing the statement is aborted. If no unit is specified, the program is aborted on the unit which executed the ABORT statement. This statement has the form: label: ABORT (program, unit); where program unit Example: ABORT (TRKMONITOR, UNIT1); is the name of the program being aborted as defined in the TCL catalog. is the name of the unit where the program is to be aborted (as defined on the Unit Master templet), unit can only be specified when program is specified.

3BUR 000 242 R0301 REV H

4-45

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.16.6 PAUSE Statement


The PAUSE statement suspends a program, or a job or batch related to Batch 300. The paused program, job or batch can be resumed by the RESUME statement. A paused program cannot resume itself. It must be resumed by another program. The statement has the form: label: PAUSE ([*JOB|*BATCH|'program'], 'unit'); where program is used to pause a specific program rather than a job or batch. This is the name of the program being paused as defined in the TCL catalog. If program and unitid are both omitted, the program that executes the PAUSE is paused. is the name of the unit where the program, job, or batch is to be paused (as defined on the Unit Master templet). When used with a program, if the program option is omitted, the unitid must also be omitted. When used with *JOB or *BATCH, if unitid is omitted, PAUSE uses the unit where the program that issues the statement is running. is used for Batch300 applications only. This pauses the job that currently has equipment booked for the specified unit. The unit can be specified explicitly via the unitid option. If unitid is omitted, PAUSE uses the unit where the program that issues the statement is running. is used for Batch300 applications only. This pauses the batch that currently has equipment booked for the specified unit. The unit can be specified explicitly via the unitid option. If unitid is omitted, PAUSE uses the unit where the program that issues the statement is running.

unit

*JOB

*BATCH

Example: PAUSE ('HEATER', 'UNIT3'); PAUSE (*JOB, 'UNIT3');

4-46

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.16.7 RESUME Statement

4.16.7 RESUME Statement


The RESUME statement causes a paused program, job, or batch to resume execution at the point where execution was suspended. The statement has the form: label: RESUME ([*JOB|*BATCH|program],unit); where program is used to resume a specific program rather than a job or batch. This is the name of the program being resumed as defined in the TCL catalog. If unitid is omitted, the program that issues the RESUME command is resumed. is the name of the unit where the program, job, or batch is to be resumed (as defined on the Unit Master templet). When used with a program, if the program option is omitted, the unitid must also be omitted. When used with *JOB or *BATCH, if unitid is omitted, RESUME uses the unit where the program that issues the statement is running. is used for Batch300 applications only. This resumes the job that currently has equipment booked for the specified unit. The unit can be specified explicitly via the unitid option. If unitid is omitted, RESUME uses the unit where the program that issues the statement is running. is used for Batch300 applications only. This resumes the batch that currently has equipment booked for the specified unit. The unit can be specified explicitly via the unitid option. If unitid is omitted, RESUME uses the unit where the program that issues the statement is running. RESUME (HEATER, UNIT3)

unit

*JOB

*BATCH

Example:

4.16.8 EVENT, SETEVENT, ACTION, ENDEVENT, CLEAREVENT Statements


These statements are used to define events to trigger state, status and mode transitions in TCL programs. An event definition is bounded by the EVENT and ENDEVENT statements. The SETEVENT statement specifies the condition under which certain state, status and/or mode transitions occur. Up to two conditions can be coupled by a Boolean operator. ACTION statements define the specific transitions to occur when the SETEVENT condition(s) are satisfied. Program and unit can be specified in the ACTION statements as an option. If they are not specified, the actions occur in the program and unit where the event is defined. To minimize overhead, use discrete variables rather than continuous variables to set up events. For instance, check for alarm status rather than the continuous measured value. 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, 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 a CLEAREVENT statement is executed, even when the program where the event is defined goes inactive.

3BUR 000 242 R0301 REV H

4-47

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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);

program unit Example:

4-48

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.16.9 ABNORMAL Statement

4.16.9 ABNORMAL Statement


The ABNORMAL statement sets a program, job, or batch to an abnormal status condition, Table 4-5. User-defined abnormal conditions must have logic associated with the ABNORMAL statement to detect the condition. For pre-defined abnormal conditions, the system automatically detects these conditions and places the program in the appropriate abnormal status, so neither the detection logic nor the ABNORMAL statement are required. The statement has the form: label: ABNORMAL (ABNORM (condition),[*JOB|*BATCH|program],unit); where condition program is an integer (1 to 16) that represents a specific abnormal condition, Table 4-5. is used to set a specific program to an abnormal condition rather than a job or batch. This is the name of the program being set to an abnormal condition as defined in the TCL catalog. If program and unitid are both omitted, the program that issues the ABNORMAL statement is set to abnormal condition. is the name of the unit where the program, job, or batch is to be set to an abnormal condition (as defined on the Unit Master Templet). When used with a program, if the program option is omitted, the unitid must also be omitted. When used with *JOB or *BATCH, if unitid is omitted, ABNORMAL uses the unit where the program that issues the statement is running. Batch300 applications only. It sets the job that currently has equipment booked for the specified unit to an abnormal condition. The unit can be specified explicitly via the unitid option. If unitid is omitted, ABNORMAL uses the unit where the program that executes the statement is running. Batch300 applications only. It sets the batch that currently has equipment booked for the specified unit to an abnormal condition. The unit can be specified explicitly via the unitid option. If unitid is omitted, ABNORMAL uses the unit where the program that executes the statement is running. ABNORMAL (ABNORM(7), HEATER, UNIT1); Table 4-5. Abnormal Conditions Priority 1 2 3,9,12 4 Condition Communications Failure Data Base Access Failure Reserved TCL Runtime Error

unit

*JOB

*BATCH

Example:

5,6,7,8,13,14,15,16 User-defined 10 11 Events Cleared (Node Down) Batch 300 Shutdown

3BUR 000 242 R0301 REV H

4-49

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.16.10 ABNORMSUBR Statement


The ABNORMSUBR statement is used to associate a specific subroutine with a specific abnormal condition so that the subroutine runs when the abnormal condition occurs. This provides the means to pass parameters from the program to the subroutine by value only. These parameters must be named variables that are declared in the VAR or VARTAG section. NOTE The Abnormal 4 conditions in Table 4-6 are fatal to TCL sequences, and cause the sequence to go inactive. In such cases the abnormal subroutine is not executed. Table 4-6. Fatal Abnormal 4 Conditions Keyword ABNORMSUBR ABNORMSUBR ACTION ACTION ACTION ENDEVENT INPUT MESG OUTPUT REPLY SETEVENT SETEVENT STEP Applies to any assignment to SEQSTATE, SEQMODE, or SSTATUS Applies to explicit or abnormal subroutine calls Applies to explicit or abnormal subroutine calls Applies to any statement with an array access Description Maximum number of ABNORMSUBR parameters (as defined on TCL Runtime Templet) set up Maximum number of ABNORMSUBRs (as defined on TCL Runtime Templet) set up DBMS error finding target sequence to set up ACTION Maximum number of ACTION request blocks (as defined on TCL Runtime Templet) set up Error finding event for related ACTION statement Error finding event for related ENDEVENT statement Too many parameters Too many parameters Too many parameters Too many parameters Maximum number of EVENTS (as defined on TCL Runtime Templet) set up EVENT is already set up for this sequence Sequence NEXTSTEP attribute is out of valid range Illegal transition request value Stack overflow from subroutine nesting too deep or too many parameters to subroutine Array size mismatch between caller and subroutine definition of parameter Index is out of array bounds

4-50

3BUR 000 242 R0301 REV H

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.16.11 CRITICAL and NONCRITICAL Statements


The CRITICAL statement is used to insure that processing of a statement or a group of statements is not interrupted. If an abnormal condition occurs during processing of a statement that is protected by CRITICAL, no recovery action is taken until the program reaches the next non-protected statement. The CRITICAL statement indicates the beginning of a protected block of code. The NONCRITICAL statement indicates the end. Example: Statement 1 Statement 2 Statement 3 CRITICAL; Statement 4 Statement 5 NONCRITICAL; Statement 6

3BUR 000 242 R0301 REV H

4-51

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.17.2 REPORT Statement

4.17.2 REPORT Statement


The REPORT statement is used to print and/or save a report configured either by Multibusbased Report Services or AdvaInform Reports. To print or save a report in AdvaInform Reports, the Program scheduling function must be enabled as described in the AdvaInform Reports Users Guide. Whether you use the REPORT statement to activate a Multibus report, or an AdvaInform report, the syntax is basically the same. The print option specifies whether or not to print the report. The save option specifies whether or not to save the report. For Multibus reports, the SAVE option causes the report to be archived. For AdvaInform reports, the SAVE option saves the report in a report log configured via the AdvaInform History Builder (as described in AdvaInform History Builder Users Guide). Report logs can then be archived via the AdvaInform History archive function. Batch and unit specification is optional. The statement has the form: label: REPORT (reportname, printer, printoption, saveoption, batch,' 'unit'); where reportname printer printoption saveoption batch unit is the report name. For AdvaInform Reports, this is the name of the Report Object Instance. is the device on which to print the report. is PRINT (print the report) or NOPRINT (do not print the report). is SAVE (save the report) or NOSAVE (do not save the report). is the batch name. It must be specified if an ENDBATCH has been issued for the batch or if there are multiple batches started on the unit. is the name of the unit as specified on the Unit Master templet. Unit can only be specified when batch is also specified.

4.17.3 TRENDONTRENDOFF Statements


If you use Multibus-based Reports Services, TRENDON marks the start of significant (usable) trend data from the trend channel of the historical recording package. TRENDOFF marks the end of significant trend data. TRENDON and TRENDOFF timestamps are stored in the batch file created by the STARTBATCH...ENDBATCH structure. If you use AdvaInform Reports, TRENDON creates a History Association Log for a history log and marks the start of the data collection time period for the association. TRENDOFF marks the end of the data collection time period for association. The History Association provides the means for you to request historical data for a specific batch without knowing the actual time period when that batch was run. Also, if the history log that you are creating the history association for has not been configured yet, the log will be automatically configured for you. (auto-configuring of history logs is supported for numeric logs, but not message logs).

3BUR 000 242 R0301 REV H

4-53

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.17.4 RECORD Statement


There are separate RECORD statements for Reports and History.

4.17.4.1 RECORD Statement for Reports


The RECORD statement for Reports records the current value of a local variable or parameter to Reports. It also records the occurrence of the variable being recorded, allowing multiple recordings of the same item. The statement has the form: label: RECORD (variable, occurrence, batch); where variable occurrence is the name given the local variable or parameter in the variable declaration. is an integer value that marks the sequential occurrence of the data recorded for the variable. Recording the same occurrence of a variable causes a totalization with the previous value in the batch file. NOTE AdvaInform PDL does not totalize the variable. PDL automatically increments the occurrence number and ignores the occurrence number specified in the RECORD statement. batch is the batch name.

4-54

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.17.4 RECORD Statement

Example: RECORD (VARIABLEX, 3);

4.17.4.2 RECORD Statement for History


The RECORD statement for History is used to write a value to a channel in Multibus-based History, or to a numeric log in AdvaInform History. The RECORD statement for History can execute in either Advant Stations or Multibus Subsystems. It cannot execute in Advant Controllers, SC Controllers, or 6000 Series Controllers. It has the following syntax: label: RECORD ($tag-fcm.para, value, quality, time, node name); where $tag-fcm.para or $tag.para identifies the channel (or log) that data is being sent to. Tag and/or FCM can be either string constants or variables containing the string to send to History. To record a value in a numeric log in AdvaInform History, enter the log name using one of the above formats. When the RECORD function is processed by AdvaInform History, the name is translated into the format required by AdvaInform History ($HSlogname,para or $HSlogname.fcm,para). value quality time is the value to be recorded. This field is not used. is the time stamp for the data. It is a six-element array of integers for the month, day, year (use 1989, not 89), hour, minute, second. Zeros in this array cause the present time to be used for the time stamp. is the templet name (referred to as Object ID in AdvaBuild) for the node where the History software resides. If node name is used literally (not declared as a variable), then use quotes (for example, NODE2). RECORD ($TIC101-PID.SETPOINT,100,1, TIMEARRAY,HISTORY_NODE); For information regarding Multibus-based History, refer to History Services with Statistical Process Control. For information regarding AdvaInform History, refer to the AdvaInform History Users Guide.

node name

Example:

3BUR 000 242 R0301 REV H

4-55

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.17.4.3 RECORD Statement for Recipes


The RECORD statement for recipes updates the disk resident object code for a recipe by writing the value of the loaded recipe item to the object code. The value written is the one shown on the Recipe Detail Display for the unit. The RECORD statement for recipes statement can execute in either SC controllers, Advant Stations, or Multibus Subsystems. It cannot execute in 6000 series controllers. The statement has the form: label: RECORD (*RECIPE, item, unit); where *RECIPE item unit Example: RECORD (*RECIPE,COOKTEMP); This function updates the object file only. A decompile must be performed to update the source file if the recipe were produced with the source recipe editor. A decompile does not retain the original source file format such as comment lines. indicates a recipe item is to be updated. is the item ID or _ALL for all items of the recipe. is an optional unit id used when the recipe is in a unit other than the unit executing the program.

4.17.4.4 RECORDER Statement


The RECORDER statement is used to start or stop historical recorders for Multibus-based History, or logsets for AdvaInform History. The statement has the form: label: RECORDER (HR_START, recorder number, node name); or label: RECORDER (HR_STOP, recorder number, node name); where recorder number For Multibus-based History this is the ID number (1 to 16) of the recorder as assigned via the RECORDER NUMBER field of its RECORDER templet. The number can be expressed as an identifier, constant, expression, or integer number. For AdvaInform History, this is the number that you assigned to the logset in AdvaInform History. The logset must be assigned a name in AdvaInform History with the following format: TCLLOGSETn, where n is an integer from 1 to 16. node name is the templet name for the Multibus Subsystem or Advant Station where the History software resides (templet name is referred to as Object ID when you configure using AdvaBuild Basic Functions). RECORDER (HR_START,1,HISTORY_NODE);

Example:

4-56

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.18 TCL Mailbox Interface

4.18 TCL Mailbox Interface


Statements for interfacing with a TCL mailbox are SEND and RECEIVE. These statements can be used to pass data and/or provide synchronization between TCL programs. When a message is sent, it can be up to 39 characters long. The maximum number of messages that a specific mailbox can hold is defined through its TCL Mailbox templet.

4.18.1 SEND and RECEIVE Statements


The SEND statement is used to direct the TCL program to put a message in a specific mailbox. If the mailbox is full and the Wait option is used, the program is paused until the RECEIVE statement removes a message. SEND also returns an error code (TRUE if SEND is successful or FALSE if SEND fails). This statement has the form: status:= SEND (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 that stores the message being sent. It can be any type of variable. 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).

mailbox wait Example:

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

3BUR 000 242 R0301 REV H

4-57

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.19 Unit Message (Unitmsg) Display Interface


TCL programs can interface with the Unit Message Display via the MESG or REPLY statements. These messages can be displayed by consoles (or Advant Stations), logged by loggers, and archived by history software. The console, loggers, and history packages to receive these messages are specified on the Configuration Area templet. Messages of this type are classified under the heading TCL_BILLBOARD or TCL_BOTH when making entries to the templet.

4.19.1 MESG Statement


The MESG statement sends a message from the program to the Unit Message Display. The message may contain variables and constants of any data type (integer, real and string) as well as literal text strings. Messages that are longer than 39 characters are truncated. An acknowledgment causes the message to be removed from the display. The MESG statement does not interrupt the execution of the originating program. It has the form: label: MESG (message, priority); where message is any combination of variables and constants of any data type (string, real and/or integer). The message (the combined characters of all variables, constants and literals) should not exceed 39 characters. Item must be separated by commas. is the priority level of STANDARD, MEDIUM, or HIGH. MESG (INCREASE AIR FLOW TO , FLOWVAL1, HIGH);

priority Example:

4.19.2 REPLY Statement


The REPLY statement transmits the message, then waits for a response. REPLY causes the originating program to pause until the required response is entered. A priority can be specified to determine the color of the message on the Unit Message Display. The format is: label: REPLY (message, priority, response, timeout); where message is any combination of variables and constants of any data type (string, real and/or integer). The message (the combined characters of all variables, constants and literals) should not exceed 39 characters. Items must be separated by commas. is the priority level of STANDARD, MEDIUM, or HIGH. is a local variable (REAL, INTEGER, or STRING) that stores the operators response.

priority response

4-58

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.19.3 UNIT_ALARM Statement

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:

4.19.3 UNIT_ALARM Statement


The UNIT_ALARM statement is used to generate and clear programmable alarms on the unit executing the statement. The format is: label: UNIT_ALARM (message, priority, num); where message is any combination of variables and constants of any data type (string, real and/or integer). The message (the combined characters of all variables, constants and literals) should not exceed 39 characters. Items must be separated by commas. If the statement is used to generate a new alarm, the parameter is the priority level of STANDARD, MEDIUM, or HIGH. If the statement clears alarm(s), the parameter is _CLEAR. If the statement is used to generate an alarm, the parameter is an integer of your choosing to be assigned to the alarm as its alarm number. If the statement is used to clear alarms, the parameter is the alarm number of the alarm to be cleared, or it can be _ALL to clear all programmable unit alarms. It is possible for a program to clear alarms that were generated by other programs and to generate more than one alarm with the same alarm number.

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);

3BUR 000 242 R0301 REV H

4-59

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.21 Wait Statement


The WAIT statement is used to suspend the program for the specified time period. The time period is expressed in seconds. The time can be expressed as a constant, variable or arithmetic expression. The statement has the form: label: WAIT (expression); where expression Examples: WAIT (5); WAIT (X * 15); is an integer or real value (real data type can be used to specify fractional values with resolution of 0.5 seconds).

4.22 Include Statement


The INCLUDE statement is used to include a section of code that exists in an external (include) file. When the INCLUDE statement is invoked, the entire file that is specified is read in at compile time. Any syntax errors that exist in the included file occur in the program when the program is compiled. For information regarding creation of an include file, consult Section 6.2.2, CREATEHow to Create a New Program or Include File. This statement has the format: INCLUDE filename; where filename is the name of the file to be included in program.

4-60

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.23 Updateon And Updateoff Statements

4.23 Updateon And Updateoff Statements


The UPDATEON and UPDATEOFF statements allow the program to enter and exit a condition in which parameters in the local data base that can be logged and/or updated are immediately logged and/or updated when the program changes their values. In the normal program condition, UPDATEOFF, no updating or logging is performed. After an UPDATEON statement is executed, the Data Base Manager checks each local parameter whose value is being changed. If it can be logged, a message is sent to the alarm/event logging printers configured to receive CCF event messages from the configuration area containing the node running the program. If the changed parameter can be updated, its new value is sent to the configurator loadable image resident in the node containing the configurator program. The program should remain in the UPDATEOFF condition whenever possible since the UPDATEON condition is a considerable load on the system. These statements only apply to local parameters; that is, parameters in the Multibus Subsystem, Advant Station, or Controller in which the program is running. No updating/logging is performed for parameters that are accessed from other nodes or subnodes. The formats for the statements are: UPDATEON; UPDATEOFF; Example: UPDATEON; $TANKLEVEL.SETPOINT:= 25.5; UPDATEOFF; For information on configuring printers to log CCF events (parameter changes) refer to the System Configurator Users Guide (for Multibus-based configurators) or AdvaBuild Engineering Methods for Advant OCS with MOD 300 Software (for Advant Station-based configurators).

4.24 UCALs - User Calculation Routines For CCF


Configurable Control Function (CCF) loops perform various functions by executing Function Class Modules (FCMs). There are a number of standard FCMs that support common algorithms such as PID control, linearization, simple calculations, and so on. If a CCF loop requires an algorithm that is not supported by standard FCMs, you can write the algorithm in TCL and connect it to the loop by a CCF User Calculation (UCAL) FCM. UCALs can be either synchronous or asynchronous: A synchronous UCAL is implemented as an external subroutine. It executes quickly and, since the subroutine is reentrant, more than one CCF loop can use a given UCAL subroutine. The subroutine can perform local data manipulation only, that is, loads, stores, and mathematical functions. It cannot access the data base. Synchronous UCALs can execute in SC controllers, Advant Stations, and Multibus Subsystems, BUT NOT 6000 series controllers. An asynchronous UCAL is implemented as a TCL program. It can perform data base accesses, but it usually executes more slowly than a synchronous UCAL.

3BUR 000 242 R0301 REV H

4-61

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.24.1 Features Common to Synchronous and Asynchronous UCALs


A CCF loop can contain only one UCAL FCM. Its name must be UCL. Unlike other FCMs you cannot change its name. Before the UCAL FCM is processed, the TCL subroutine or program must be made available to the CCF loop by loading it from a TCL program via a LOAD statement in the form: LOAD (UCAL,prog,tag); where prog tag is the name of the subroutine or program performing the algorithm. is the tag of the loop containing the UCAL FCM.

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.

4.24.2 Synchronous UCALs


A synchronous UCAL uses an external TCL subroutine to implement the UCAL calculation. The subroutine executes quickly, but is limited to local data manipulation. It is reentrant so that more than one loop can use the same subroutine. Writing the TCL External Subroutine for a Synchronous UCAL The UCAL FCM passes parameters to the TCL subroutine by reference. This allows the subroutine to manipulate the parameters as dictated by the Subroutine statements. The modified parameters are then readily available to the UCAL FCM. The first statement of the subroutine must be in the form: SUBR name(VAR DATA_ARRAY: ARRAY [1..4] OF REAL; VAR VALU_ARRAY: ARRAY [1..4] OF REAL; VAR PROC_VALUE: REAL; VAR DATA_QUALS: ARRAY [0..4] OF BYTES; VAR LOOP_ARRAY: ARRAY [n..m] OF datatype; ); where name becomes the subroutine name.

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.24.2 Synchronous UCALs

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.

3BUR 000 242 R0301 REV H

4-63

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4.24.3 Asynchronous UCALs


An asynchronous UCAL can perform data base accesses, but it executes relatively slowly. Writing the TCL Program for an Asynchronous UCAL Consider the following when you write a TCL program for an asynchronous UCAL. The maximum allowed time for the program to execute is one CCF base rate less than the loop scan rate. The result of the program's calculation should be made into the result of the UCAL FCM. The preferred method to accomplish this is to pass the result of the program's calculation to the PROC_VAL parameter of the UCAL FCM. The corresponding data quality should be passed to the PROC_DQ parameter. When the UCAL FCM receives these parameters, it performs some error checking. If no errors occurred, the value of the PROC_VAL parameter is copied to the RESULT parameter, and the value of the PROC_DQ parameter is copied to the DATAQUAL (result data quality) parameter. The PROC_VAL and PROC_DQ parameters are referenced using the tag and FCM name. For example, when the default name of the UCAL FCM is used, PROC_VAL appears in TCL expressions in the following format: $'tag'-'UCL'.PROC_VAL These statements cannot be used in asynchronous UCAL programs: ACTIVATE, ENDBATCH, MESG, RECORD, REPLY, TRENDON / TRENDOFF, UNIT_ALARM, *RECIPE, STARTBATCH, REPORT. After you write the program, you should compile and link it. The TCL procedure can acquire any of these data base parameters associated with the UCAL: DATA1 DATA2 DATA3 DATA4 DAPL_F1 DAPL_F2 DAPL_F3 DAPL_F4 VAR1 VAR2 VAR3 VAR4 UCAL FCM Input 1 UCAL FCM Input 2 UCAL FCM Input 3 UCAL FCM Input 4 Input 1 Data Quality Input 2 Data Quality Input 3 Data Quality Input 4 Data Quality Variable 1 Initial Value Variable 2 Initial Value Variable 3 Initial Value Variable 4 Initial Value

The UCAL parameters can be referenced in TCL programs by the following method: $'tag'-'FCM'.parameter For instance: $'TIC101'-'UCL'.DATA1

4-64

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.24.3 Asynchronous UCALs

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.

3BUR 000 242 R0301 REV H

4-65

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.

4.25 Sequential Function Chart (SFC) Display Statements 4.25.1 STEP_ACTIVITY


STEP_ACTIVITY provides the means to alert the system operator about the status of certain activities related to a step. The STEP_ACTIVITY statement has the following format: label: STEP_ACTIVITY load-time text (runtime message); 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. 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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.25.2 STEP_CONDITION

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:

3BUR 000 242 R0301 REV H

4-67

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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.

4.25.3 STEP_TRANSITION, ACTION


STEP_TRANSITION alerts the system operator of the occurrence of events that cause transitions to other steps. The STEP_TRANSITION statement has the following format: label: STEP_TRANSITION event name load-time text load-time text SETEVENT (expression); ACTION (...); ACTION (GOTO label); ENDEVENT where label event name load-time text is an optional program label (unsigned integer) is a name for the event, up to 12 characters (no spaces) bounded by single or double quotation marks. The name must be unique within the step. is an optional user-defined string and/or string constant (39 characters maximum) bounded by single or double quotation marks. One load-time text string can be defined for each of the two possible SETEVENT expressions. is one or two relational expressions which must be met for the specified transition to occur. The first part of each relational expression must be a database variable, that is, loop, FCM, or recipe variable. The second part of the expression can be a value or a database variable. If database variables from two loops are compared, the loops must be in the same node.

expression

4-68

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.25.3 STEP_TRANSITION, ACTION

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.

3BUR 000 242 R0301 REV H

4-69

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.26 _TCLACCESS

. 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

CONTROL_YIELD_ONLY PARTIAL_YIELDS FIXED_BATCHES FOLLOW_1ST_EXECUTION PARALLEL_EXECUTION GOAL

*JOB *JOB *JOB *JOB *JOB *JOB

3BUR 000 242 R0301 REV H

4-71

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.26 _TCLACCESS

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

3BUR 000 242 R0301 REV H

4-73

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

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 2 JOB1_ID:= RUN35; STAT:=_TCLACCESS(PREPARE, *JOB(JOB1_ID)); /*prepares job RUN35. */

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 */

Example 4 STAT:=_TCLACCESS(GET_STATE,*JOB(JOB_3),INTPARM); /* Gets status of JOB_3. */

Example 5 STAT:=_TCLACCESS(PAUSE,*BATCH()); /* Pauses the batch manager */

4-74

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 4.26 _TCLACCESS

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.

3BUR 000 242 R0301 REV H

4-75

Taylor Control Language Users Guide Chapter 4 TCL Language Specifications

4-76

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 5.1 General Information

Chapter 5 Recipe Development

5.1 General Information


A recipe is a collection of data that define parameters related to the process such as flow rates and timing intervals. Recipes are stored in the memory of a given unit and are used by programs that run on that unit and/or other units. Recipes allow the same program to run at different times with different values. For example, a program may use one recipe to produce a certain product in one manufacturing cycle, and use a different recipe to product a slightly different product in the next manufacturing cycle. 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.

5.1.1 Recipe Items


Recipes are organized into items that have a specific set of parameters as shown by the example in Table 5-1. Table 5-1. Recipe Example Item ID COMPA COMPB COMPC COOKTIME COOKTEMP MESSAGE 2.0 10.2 3.1 5 350.0 DONE Value Description Component A amount Component B amount Component C amount Cooking time Cooking temperature Batch finished Units GAL GAL GAL MIN DEGF High Limit 2.2 10.3 3.1 6 360.0 Low Limit 1.8 9.7 2.9 4 345.0

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.

3BUR 000 242 R0301 REV H

5-1

Taylor Control Language Users Guide Chapter 5 Recipe Development

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.1.2 Recipe Development


The TCL recipe catalog is the central display for recipe development. It provides a directory of the existing recipes and softkeys for creating new recipes, printing and copying existing recipes, and so on. This display resides in the TCL development node. The Multibus-based TCL development platform supports two editors for building recipes: the recipe editor and the source editor. The recipe editor creates an object file for its recipes. Since this editor checks for errors as entries are made, it produces recipes that are always in a loadable format. The source editor initially creates source code for a recipe which must be compiled to create a loadable object file. When you create a recipe, you choose whether it is in the recipe editor or the source editor format. Either format can be chosen, unless you plan to upload and download the recipes across an Ethernet interface to a host computer. In that case, you must use the source editor. Instructions for using the Recipe Catalog Display and the editors are provided in Section 5.2, Recipe Development And Maintenance. Instructions for using the Advant Station-based TCL Builder for recipe development is provided in 3BUR000206R0001 TCL Builder Users Guide.

5.1.3 Loading Recipes into Units


Recipes reside on disk in the TCL development node. A recipe can be loaded into the memory of a unit where it is available for all programs running on that unit. Recipes loading can be initiated by selecting the RECIPE ID field on the Unit Detail Display. Loading can also be initiated from programs by a LOAD statement. Recipes can be removed from units by REMOVE statements, but cannot be removed via the Unit Detail Display. The CHECK statement can verify that a specific recipe is resident in a unit.

5.1.4 Recipes Items in TCL Programs


When a recipe is loaded into a unit, the recipe items become part of the data base and can be accessed by programs running on that unit. A complete description of the procedures for using recipe parameters in programs are provided in Section 4.10.3, Recipe Parameters.

5.1.5 Changing Values from the Recipe Detail Display


The value of a recipe item can be changed from the Recipe Detail Display. When you change a value, the high and low limits for the value prevent an out-of-range value from being accepted.

5.2 Recipe Development And Maintenance


Recipes are built either with the recipe editor or the source editor. A recipe built with the recipe editor consists of an object file that is always in loadable form. A recipe built with the source editor consists of both a source file and an object file. When a recipe is created with the source editor, it must be compiled before it can be loaded into a unit.

5-2

3BUR 000 242 R0301 REV H

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.2.1 Recipe Catalog Display


The TCL Recipe Catalog Display, Figure 5-1, lists existing recipes. It provides the means to: Create and delete recipes Call up the recipe Editors Print the contents of a recipe Print a list of all recipes contained by the Recipe Catalog Display Make a duplicate copy of a recipe under a new name Copy a recipe to another disk device

Figure 5-1. Recipe Catalog Display

3BUR 000 242 R0301 REV H

5-3

Taylor Control Language Users Guide Chapter 5 Recipe Development

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

3BUR 000 242 R0301 REV H

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.

5.2.2 CREATEHow to Create a New Recipe


You start building a new recipe on the Recipe Catalog Display by entering the following commands: 1. 2. Press MORE if necessary to access the second level of softkeys. Select the CREATE softkey. This calls up a new softkey set shown in Figure 5-3.

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.

3BUR 000 242 R0301 REV H

5-5

Taylor Control Language Users Guide Chapter 5 Recipe Development

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.2.3 EDITHow to Use the Recipe Editor


The Recipe Editor Display, Figure 5-4, provides the means to add, delete, define and edit recipe items for a recipe. To build a recipe with the recipe editor, follow the instructions in Section 5.2.2, CREATEHow to Create a New Recipe. To edit a recipe originally built with the recipe editor: 1. 2. 3. Call up the Recipe Catalog Display by selecting the TCLRECIPE field on the Library Display. (Your system may use another name for the recipe software.) Select the target for the desired recipe. Press the EDIT softkey.

5-6

3BUR 000 242 R0301 REV H

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.

Figure 5-5. ADD Softkey Set

3BUR 000 242 R0301 REV H

5-7

Taylor Control Language Users Guide Chapter 5 Recipe Development

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

3BUR 000 242 R0301 REV H

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.

5.2.3.1 Editing Recipe Items


Select the recipe item to be edited. The ITEM ID field for the selected item is backlit (light letters on dark background). Next, the specific attribute to be edited must be selected. This field is also backlit when selected. In addition, there is a prompt near the bottom of the screen requesting a new entry. Make a new entry for the field using the alphanumeric keys. If the entry is valid, the new entry replaces the old one. After the entry has been made, the ATTRIBUTE field automatically deselects (reverts to dark letters on light background). The item remains selected so that other attributes for the item can be modified if required. The item can be deselected by any of the following methods: Reselect the backlit item ID Select a null target on the screen Select a new item Invoke forward or backward scroll

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.

5.2.4 EDITHow to Use the Source Editor


The Source Editor Display provides the means to produce source code for a recipe. To build a recipe with the source editor, follow the instructions in Section 5.2.2, CREATEHow to Create a New Recipe. To edit a recipe that was originally built with the source editor: 1. 2. 3. Call up the TCL Recipe Catalog Display by selecting the TCLRECIPE field on the Library Display. (Your system may use another name for the recipe software.) Select the target for desired recipe. Press the EDIT softkey.

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.

3BUR 000 242 R0301 REV H

5-9

Taylor Control Language Users Guide Chapter 5 Recipe Development

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

3BUR 000 242 R0301 REV H

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.

5.2.5 COMPILHow to Compile a Recipe Created with the Source Editor


Recipes that are produced with the source editor must be compiled before they can be loaded onto units. 1. Press the COMPIL KEYS softkey. This displays the COMPIL softkeys, Figure 5-6.

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.

3BUR 000 242 R0301 REV H

5-11

Taylor Control Language Users Guide Chapter 5 Recipe Development

5.2.6 EDITHow to Modify a Recipe


The process of modifying a recipe starts on the Recipe Catalog Display. 1. 2. Select the recipe to be modified. Select the EDIT key.

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

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

5-13

Taylor Control Language Users Guide Chapter 5 Recipe Development

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.2.11 XFER (RESTORE)How to Load (Restore) Backup Copies


Backup copies of recipes can be reloaded onto the Winchester disk individually or as a group. 1. 2. Select the XFER KEYS softkey. A new set of softkeys is displayed. See Figure 5-7. Press the XFER DISP softkey. New softkeys, Figure 5-8, are displayed that ask you if you want the recipe loaded from floppy disk (FD00), removable Winchester disk (WC01) or if you want to abort the Restore (QUIT). Select the proper softkey. The recipe catalog for the backup disk is displayed with the softkeys that are shown in Figure 5-9.

Figure 5-9. LOAD Softkeys

5-14

3BUR 000 242 R0301 REV H

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.2.12 DELETEHow to Delete a Recipe


To delete a recipe: 1. 2. 3. 4. The DELETE softkey is on the second level of softkeys. If the first level is currently displayed, select the MORE softkey to access the second level. Select the target for the recipe to be deleted. Select the DELETE softkey. You are prompted to press DELETE again to verify that you want the deletion to be performed. Pressing any other key aborts the procedure.

5.2.13 PRINTHow to Print a Hard Copy of a Recipe


To print a hard copy of a recipe: 1. 2. 3. The PRINT key is on the second level of softkeys. If the first level is currently displayed, press the MORE softkey to access the second level. Select the target for the recipe to be printed. Recipe source and compiler listing cannot be printed. Select the PRINT softkey. If this is the first job sent to the printer, you are asked to enter the printer name. The entry should be the name assigned to the printer via the Serial Port Setup Templet of the configurator software. Complete the entry by pressing the ENTER key.

5.2.14 DIR LISTHow to Print a List of the Recipes


To print a hard copy listing of the recipes currently included on the Recipe Catalog Display: 1. 2. Select the DIR LIST softkey. Enter the name of the printer and then press the ENTER key. If this is the first job sent to the printer, you are asked to enter the printer name. The entry should be the name assigned to the printer via the Serial Port Setup Templet of the configurator software. Complete the entry by pressing the ENTER key.

3BUR 000 242 R0301 REV H

5-15

Taylor Control Language Users Guide Chapter 5 Recipe Development

5.2.15 EXITHow to Exit from the Recipe Software


To exit from the recipe software, press the EXIT softkey.

5.3 How to Transfer TCL Recipes from an IBM PC or VAX Computer


TCL recipes can be produced on either a VAX computer or an IBM PC and transferred to the Advant OCS. This activity is supported by the TCL CATALOG function which is provided in both the IBM PC Interface and VAX/VMS Computer Interface packages. Refer to the applicable instruction book for details. For the VAX/VMS Computer Interface refer to the Taylor VAX/VMS Interface User's Guide. For the IBM PC Interface refer to the Taylor IBM PC Interface User's Guide.

5-16

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 6.1 General

Chapter 6 TCL Program Development

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.2 TCL Catalog Functions


TCL provides several features for creating and modifying sequences.

6.2.1 TCL Catalog Display


The TCL (Sequence) Catalog Display, Figure 6-1, lists the existing programs and include files that are resident on a single TCL development node. The TCL Catalog Display provides the means to: Create new programs and include files Delete programs and include files Call up the TCL editor Compile and link programs Print the contents of programs and include files Print a list of all programs and include files contained by the Sequence Catalog Display Make duplicate copies of programs and include files under new names Copy programs and include files to another disk device

6.2.1.1 How to Call up the TCL Catalog Display


Press the LIBRARY key to call up the main Library Display, and then select the TCLCATALOG field (or other name assigned to the catalog software in your system).

3BUR 000 242 R0301 REV H

6-1

Taylor Control Language Users Guide Chapter 6 TCL Program Development

6.2.1.2 Description of Fields on TCL Catalog Display


Field Description SEQUENCE ID The name assigned to the program when it was created. Each program has a target in front of its ID. To select a program, move the cursor to the desired line and press the SELECT key. TYPE SCHED PROC OPER INCL SUBR The possible types are: Schedule Procedure Operation Include file (default until a successful compile) External subroutine

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

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

6-3

Taylor Control Language Users Guide Chapter 6 TCL Program Development

6.2.1.3 Softkey Functions


The functions of the Catalog Display are generally accomplished by selecting a program and pressing softkeys. The display initially contains the softkeys that are shown in Figure 6-1. Other sets of softkeys are accessed by pressing some of these initial softkeys. Several of these softkey sets include the following general keys: MORE Softkey This softkey is used to call up additional softkey functions for the TCL Catalog Display. It toggles the display between the first level softkeys as shown in Figure 6-1 and the second level as shown in Figure 6-2.

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.2.2 CREATEHow to Create a New Program or Include File


The CREATE softkey is used to create an entry for a new file on the TCL Catalog Display. It must be used before a program or include file can be written. To create a new listing: 1. 2. 3. 4. Select the CREATE softkey. (If the CREATE softkey is not currently displayed, select the MORE softkey to access the second level of softkeys.) Enter the file name and then press the ENTER key. Select target line with the file name. Select the EDIT key. This accesses the TCL editor which can be used to write the program.

6-4

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 6.2.3 EDITHow to Access the TCL Editor

6.2.3 EDITHow to Access the TCL Editor


The EDIT softkey is used to obtain the TCL (Sequence) Editor Display. This display provides access to a specific file and contains softkey functions for editing the contents of the file. To acquire the TCL editor for a specific file: 1. 2. 3. Call up the TCL Catalog Display. Select the target line for desired file. Press the EDIT softkey.

A full range of functions is supported for program editing. These functions are described in Chapter 7, TCL Source and Recipe Editor Functions.

6.2.4 COMPILHow to Compile a Program


1. 2. 3. Press the COMPIL KEYS softkey. A new set of softkeys is displayed. See Figure 6-3. Select the target line for the file on the TCL Catalog Display. Either Request that the program be compiled by pressing the COMPIL softkey. or Request that program be compiled and linked by pressing the COMPIL & LINK SOFTKEY. See Section 6.2.5, LINKHow to Link a Program. The compiling process starts and the LOAD STATUS field for the program displays COMPILING. When the compile operation is complete, the LOAD STATUS field displays either COMPILED or COMPILER ERRORS. 4. Press the QUIT softkey to return the display to the first level of softkeys. The TCL compiler checks TCL programs for syntax errors. When compilation is complete, a list that indicates the number of steps, the number of errors found and the number of warnings during compilation is produced. This list can be displayed upon request via the COMP LIST softkey. Errors are usually indicated under the program line where they occur. A compiler warning occurs when the compiler detects a non-fatal program error. A non-fatal error does not prevent the program from being compiled. Non-fatal errors should be corrected along with any fatal errors. Programs that are compiled without errors can be downloaded to the subsystem where they are to run.

Figure 6-3. COMPIL Softkeys

3BUR 000 242 R0301 REV H

6-5

Taylor Control Language Users Guide Chapter 6 TCL Program Development

6.2.5 LINKHow to Link a Program


Linking verifies the data base references in the program against the installed data base. If linking is not invoked through this key, the TCL program is linked automatically each time that it is loaded. For programs that contain many data base references, loading time can be saved by linking the program at compilation time through this softkey. By invoking the linking process through this softkey, the program is not linked each time it is loaded; but rather, it is linked just once. If the program is linked against multiple units and the program has unit relative references to discrete loops, the same descriptor set must be used for all of the applicable discrete loops. NOTE If the current data base is recompiled, any programs that were linked through the LINK or COMP&LINK softkeys should be relinked via the softkeys. If they are not relinked, they load as if they were not linked, that is, data base references are verified and resolved to the loaded data base each time the program is loaded. To enable the system to resolve unit relative data base references when the LINK function is invoked, the applicable units must be declared in the TCL program using the UNITS keyword. See Section 4.11, Units. To link a program: 1. 2. 3. Press the COMPIL KEYS softkey. A new set of softkeys is displayed. See Figure 6-3. Select the target line for the program. Press the LINK softkey. (Compiling and linking can be requested simultaneously by pressing the COMPIL & LINK softkey). The linking process starts and the LOAD STATUS field for the program displays LINKING. When the operation is complete, the LOAD STATUS field displays either LINKED or LINK ERRORS. Press the QUIT softkey to return the display to the first level of softkeys.

4.

6-6

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

6-7

Taylor Control Language Users Guide Chapter 6 TCL Program Development

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.2.7 XFER (RESTORE)How to Load (Restore) Backup Copies


Backup copies of programs and include files can be reloaded onto the Winchester disk either individually or as a group. 1. 2. 3. Select the XFER KEYS softkey. A new set of softkeys is displayed. See Figure 6-4. Press the XFER DISP softkey. New softkeys, Figure 6-5, are displayed that ask you if you want the recipe loaded from floppy disk (FD00) or removable Winchester disk (WC01) or if you want to abort the Restore (QUIT). Select the proper softkey. The TCL catalog for the backup disk is displayed with the softkeys that are shown in Figure 6-6.

Figure 6-6. LOAD Softkeys

6-8

3BUR 000 242 R0301 REV H

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.2.8 DELETEHow to Delete a Program or Include File


The DELETE softkey is used to delete the listing for a file from the TCL Catalog Display. To delete a listing: 1. 2. 3. Select the target for the program or file to be deleted. Select the DELETE softkey. Select the DELETE softkey a second time.

6.2.9 COPYHow to Copy a Program and Store it Under a Different Name


The COPY softkey is used to make a duplicate copy of a program under a new name. This function provides a convenient method for creating similar programs. The duplicate copy can be edited as required. To make a copy: 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 program to be copied. Select the COPY softkey. Enter a name for the duplicate copy and press the ENTER key. The new copy has a status of NOT COMPILED.

3BUR 000 242 R0301 REV H

6-9

Taylor Control Language Users Guide Chapter 6 TCL Program Development

6.2.10 PRINTHow to Print a Hard Copy of a Program or Include File


The PRINT softkey is used to print a hard copy of the contents of a file. To make a hard copy record of a file: 1. 2. Select the target for the file to be printed. Select the PRINT softkey. If this is the first job sent to the printer, you are asked to enter the printer name. The entry should be the name assigned to the printer via the Serial Port Setup Templet of the configurator software. Complete the entry by pressing the ENTER key.

6.2.11 NEW PRINTRHow to Select a Different Printer


The NEW PRINTR softkey is used to change the printer name. To change the printer: 1. 2. Select the NEW PRINTR softkey. Enter the name of the printer and then press the ENTER key.

6.2.12 DIR LISTHow to Print a List of the Items on the Catalog


The DIR LIST softkey is used to obtain a hard copy listing of the files currently included on the TCL Catalog Display. To obtain a hard copy listing of these files: 1. 2. Select the DIR LIST softkey. Enter the name of the printer and then press the ENTER key.

6.2.13 EXIT
This softkey is used to exit the sequence catalog function.

6-10

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section 7.1 Editing Functions

Chapter 7 TCL Source and Recipe Editor Functions

7.1 Editing Functions


This section describes the editing functions for the Multibus-based TCL development node. Editing functions for AdvaBuild TCL Builder are described in the TCL Builder Users Guide. 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. In the Multibus-based TCL development node, the TCL editor and the unit relative source editor are used to produce program source code and recipe source code, respectively. They use identical editing functions. They are called up via the TCL Catalog Display or the Recipe Catalog Display, which are described in Chapter 5, Recipe Development and Chapter 6, TCL Program Development. Program editing through an editor does not directly affect the program or recipe source file. Rather, a workspace is created in the console. The file must be saved on the fixed disk after each editing session; otherwise, all changes made during the current editing session are lost. In addition, a program or recipe cannot be compiled unless it has been saved first. Editing functions are performed through softkeys on the display and the alphanumeric keys on the keypad. These functions are described below.

7.2 Cursor Movement


The cursor moves forward or backward, depending on which direction has been selected. Once a direction has been selected, the cursor continues to move in that direction until set to move the opposite way. Other editing functions are affected by the direction in which the cursor is set to move. For example, if FIND is being used, and the cursor direction is forward, the search is forward toward the end of the file; if the cursor direction is backward, the search is backward toward the beginning of the file. The following functions are affected by cursor direction: FIND, NEXT FIELD, LINE, EOL, PAGE, WORD, DELETE WORD, and SUBSTITUTE. ADVANCE and BACKUP Keys When the cursor is in Advance mode, it moves forward toward the end of the file. Advance is the default cursor direction. Select the Advance mode by pressing the ADVANCE key. In Backup mode, the cursor direction is backward toward the beginning of the file. Select Backup mode by pressing the BACKUP key.

3BUR 000 242 R0301 REV H

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

3BUR 000 242 R0301 REV H

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 Text Editing Functions


The information in this section refers to keys on the alphanumeric keyboard and softkeys on the TCL Editor Displays. Insert Line The INSERT LINE key is used to insert a carriage return after the cursor. If the key is pressed when the cursor is positioned in the middle of a line, any text to the right of the cursor is moved down to the beginning of the next line. If the cursor is at the beginning or end of a line when INSERT LINE is pressed, a blank line is created. Deleting Material can be deleted in various ways: by character, by unit (word or line), or by section. Each time a delete operation is performed, the material that was just deleted is placed in the undelete buffer. The undelete buffer stores the material until another delete operation occurs. At this time, the contents of the buffer is cleared, and the newly deleted material is placed in it. The contents of the buffer may be used in other editing operations (for example, it may be reinserted, moved to a new position, etc.). The BACKSPACE key, located with the alphanumeric keys on the main part of the keyboard, is used to delete the character to the left of the cursor. If the cursor is at the left margin when BACKSPACE is pressed, the preceding line terminator is deleted and the text is moved to the right of the text in that line. The DELETE CHAR key is used to delete the character at the cursor position. The DELETE WORD key deletes forward or backward, depending on the cursor movement direction. When in the Advance mode, DELETE WORD deletes up to the first character in the next word. When in the Backup mode, DELETE WORD deletes the characters from the cursor back to the beginning of the word. It does not, however, delete the character at the cursor position. When in the Backup mode and with the cursor positioned on the first character in a word, DELETE WORD deletes the preceding word and the spaces in between. The EOL DELETE key is used to delete all characters from the cursor position to the end of the line. If the cursor is at the end of a line when EOL DELETE is pressed, the next line is deleted. The LINE DELETE key is used to delete text from the cursor position through the next line terminator. The first character of the next line then appears at the cursor position.

3BUR 000 242 R0301 REV H

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

3BUR 000 242 R0301 REV H

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.

3BUR 000 242 R0301 REV H

7-5

Taylor Control Language Users Guide Chapter 7 TCL Source and Recipe Editor Functions

7-6

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section A.1 Reference Tables

Appendix A Reference Tables

A.1 Reference Tables


Table A-1. ASCII Control Code to Ordinal Number Conversion Table Control Code NUL null SOH start of heading STX start of transmission ETX end of transmission EOT end of text ENQ enquiry ACK acknowledge BEL bell BS backspace HT horizontal tab LF line feed VT vertical tab FF form feed CR carriage return SO shift out SI shift in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Ordinal Value Control Code DLE delete DC1 device control 1 DC2 device control 2 DC3 device control 3 DC4 device control 4 16 17 18 19 20 Ordinal Value

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

3BUR 000 242 R0301 REV H

A-1

Taylor Control Language Users Guide Appendix A Reference Tables

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Section A.1 Reference Tables

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

3BUR 000 242 R0301 REV H

A-3

Taylor Control Language Users Guide Appendix A Reference Tables

A-4

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Index

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Index

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

3BUR 000 242 R0301 REV H

Taylor Control Language Users Guide Index

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

3BUR 000 242 R0301 REV H

iii

Taylor Control Language Users Guide Index

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

UPDATEOFF 4-61 UPDATEON 4-61 USER CALCULATION ROUTINES 4-61

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

3BUR 000 242 R0301 REV H

You might also like