tcl user's guide

Upload: rivasbc

Post on 14-Apr-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 TCL User's Guide

    1/158

    Taylor Control Language Users GuideTable of Contents

    3BUR 000 242 R0301 REV H i

    TABLE OF CONTENTS

    Chapter 1 - Introduction

    1.1 General Information................................................................................................. 1-1

    1.2 Manual Organization ............................................................................................... 1-21.3 Related Documentation............................................................................................ 1-2

    Chapter 2 - TCL Overview

    2.1 General..................................................................................................................... 2-1

    2.2 Units And Unit Symmetry ....................................................................................... 2-1

    2.3 Step Structure........................................................................................................... 2-2

    2.4 TCL Program Hierarchy.......................................................................................... 2-2

    2.5 Recipes..................................................................................................................... 2-3

    2.6 Downloading And Removing TCL Programs And Recipes.................................... 2-4

    2.7 Program Control ...................................................................................................... 2-52.7.1 State ........................................................................................................ 2-5

    2.7.2 Status....................................................................................................... 2-6

    2.7.3 Mode ....................................................................................................... 2-7

    2.7.4 Manipulating State, Status and Mode In TCL Programs........................ 2-7

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

    2.8.1 Activating TCL Programs for Parallel Processing.................................. 2-8

    2.8.2 External Program Calls........................................................................... 2-9

    2.8.3 External Subroutine Calls..................................................................... 2-10

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

    2.9.1 Methods of Access................................................................................ 2-112.9.2 Loop and FCM Parameters ................................................................... 2-11

    2.9.3 Control Block Parameters..................................................................... 2-12

    2.9.4 Recipe Parameters................................................................................. 2-12

    2.9.5 Unit Variables ....................................................................................... 2-12

    2.9.6 Unit Array Variables............................................................................. 2-12

    2.10 Report Services And History Services Interface ................................................... 2-13

    2.11 Peripheral I/O Interface ......................................................................................... 2-13

    2.12 Digital Device Control........................................................................................... 2-13

    2.13 Unit Message (Unitmsg) Display Interface ........................................................... 2-13

    2.14 Mailbox Function................................................................................................... 2-142.15 Include Function ................................................................................................... 2-14

    2.16 Implementing User Calculation FCMs Through TCL........................................... 2-14

    2.17 Miscellaneous Functions........................................................................................ 2-14

    2.18 Data Base Configuration Requirements................................................................. 2-15

    2.19 Program/Recipe Development Platforms .............................................................. 2-15

  • 7/29/2019 TCL User's Guide

    2/158

    Taylor Control Language Users GuideTable of Contents

    ii 3BUR 000 242 R0301 REV H

    CONTENTS (continued)2.19.1 TCL and Recipe Editors........................................................................ 2-15

    2.19.2 Compiling and Linking .........................................................................2-16

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

    2.20.1 Download/Remove Function................................................................2-17

    2.20.2 Debugging............................................................................................. 2-17

    2.20.3 Program Control Through Unit Detail and Sequence Detail Displays . 2-18

    2.20.4 Recipe Manipulation.............................................................................2-18

    2.20.5 Unit Message Display ........................................................................... 2-18

    2.20.6 Display, Logging, and Recording of TCL Messages ...........................2-18

    2.20.7 Sequential Function Chart (SFC) Display Functions............................ 2-18

    2.20.7.1 STEP_ACTIVITY Function........................................... 2-19

    2.20.7.2 STEP_CONDITION Function ....................................... 2-19

    2.20.7.3 STEP_TRANSITION Function .....................................2-19

    Chapter 3 - Data Base Templets for TCL

    3.1 Overview.................................................................................................................. 3-1

    3.2 TCL Development Templet...................................................................................... 3-1

    3.3 Unit Relative Names Templet .................................................................................. 3-2

    3.4 TCL Runtime Templet ............................................................................................. 3-3

    3.5 TCL Mailbox Templet..............................................................................................3-6

    3.6 Unit Master Templet ................................................................................................3-7

    Chapter 4 - TCL Language Specifications

    4.1 Conventions.............................................................................................................. 4-14.2 TCL Program Structure............................................................................................4-1

    4.2.1 Declaration Part....................................................................................... 4-2

    4.2.2 Executable Part........................................................................................ 4-2

    4.2.3 Format ..................................................................................................... 4-2

    4.2.4 Statement Labels .....................................................................................4-3

    4.3 TCL Keywords .........................................................................................................4-3

    4.4 Data Types................................................................................................................4-3

    4.4.1 Real Data .................................................................................................4-3

    4.4.2 Integer Data .............................................................................................4-4

    4.4.3 String Data ..............................................................................................4-44.4.4 State Descriptors .....................................................................................4-4

    4.5 Operators.................................................................................................................. 4-4

    4.5.1 Arithmetic Operators...............................................................................4-5

    4.5.2 Relational Operators................................................................................4-5

    4.5.3 Logical Operators....................................................................................4-6

  • 7/29/2019 TCL User's Guide

    3/158

    Taylor Control Language Users GuideTable of Contents

    3BUR 000 242 R0301 REV H iii

    CONTENTS (continued)4.5.4 Order Of Computations .......................................................................... 4-6

    4.5.5 Mixed Mode Expressions ....................................................................... 4-7

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

    4.6.1 Mathematical Functions.......................................................................... 4-8

    4.6.1.1 ABS (Absolute) Function................................................. 4-8

    4.6.1.2 ROUND Function ............................................................ 4-8

    4.6.2 Trigonometric Functions......................................................................... 4-8

    4.6.3 Bit Manipulation Functions .................................................................... 4-8

    4.6.3.1 BIT ONES COMPLEMENT Function ........................... 4-8

    4.6.3.2 BIT SHIFT Function........................................................ 4-8

    4.6.4 String Manipulation Functions ............................................................. 4-10

    4.6.4.1 LEN Function................................................................. 4-10

    4.6.4.2 MID Function................................................................. 4-10

    4.6.4.3 ORD Function................................................................ 4-10

    4.6.4.4 CHR Function ................................................................ 4-10

    4.6.4.5 ASTOI Function............................................................. 4-10

    4.6.4.6 ASTOR Function ........................................................... 4-10

    4.6.4.7 ITOAS Function............................................................. 4-10

    4.6.4.8 RTOAS Function............................................................ 4-10

    4.6.5 Date and Time Functions ...................................................................... 4-11

    4.6.5.1 DATE Function .............................................................. 4-11

    4.6.5.2 TIME Function............................................................... 4-11

    4.7 Program Header And Parameter Lists ................................................................... 4-11

    4.8 External Programs.................................................................................................. 4-12

    4.9 Constants................................................................................................................ 4-14

    4.10 Variables................................................................................................................. 4-15

    4.10.1 Local Variables ..................................................................................... 4-15

    4.10.1.1 Simple Variables ............................................................ 4-15

    4.10.1.2 Arrays............................................................................. 4-16

    4.10.2 Data Base Parameters ........................................................................... 4-17

    4.10.2.1 Declaring Data Base Parameters.................................... 4-17

    4.10.3 Recipe Parameters................................................................................. 4-20

    4.10.4 Unit Variables ....................................................................................... 4-22

    4.10.4.1 Unit Array Variables ...................................................... 4-22

    4.10.5 Variable Tags - VARTAGS.................................................................... 4-23

    4.10.5.1 Declaring a VARTAG..................................................... 4-23

    4.10.5.2 Declaring Unit Relative VARTAGS............................... 4-24

    4.10.5.3 Using a VARTAG Reference.......................................... 4-24

  • 7/29/2019 TCL User's Guide

    4/158

    Taylor Control Language Users GuideTable of Contents

    iv 3BUR 000 242 R0301 REV H

    CONTENTS (continued)4.10.5.4 Using a VARTAG as a String in a Message Statement...4-25

    4.10.6 Fetch and Set .........................................................................................4-25

    4.10.6.1 Fetch Statement ..............................................................4-25

    4.10.6.2 SET Statement................................................................4-26

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

    4.11 Units .......................................................................................................................4-29

    4.12 Subroutines.............................................................................................................4-29

    4.12.1 Internal Subroutines ............................................................................. 4-29

    4.12.2 External Subroutines............................................................................. 4-31

    4.13 Program Flow Statements ...................................................................................... 4-32

    4.13.1 BEGIN/END Structure.......................................................................... 4-32

    4.13.2 STEP/ENDSTEP Structure................................................................... 4-33

    4.13.3 Compound Statements .......................................................................... 4-33

    4.13.4 Conditional Statements .........................................................................4-34

    4.13.4.1 IFTHENELSE ........................................................4-34

    4.13.4.2 CASE Statement............................................................. 4-35

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

    4.13.5.1 FORDOWNTO (TO)DO Statement....................... 4-36

    4.13.5.2 REPEATUNTIL Statement ........................................4-37

    4.13.5.3 WHILEDO Statement ................................................ 4-37

    4.13.5.4 GOTO Statement ............................................................4-37

    4.14 Serial I/O Statements.............................................................................................. 4-38

    4.14.1 OPEN Statement ................................................................................... 4-38

    4.14.2 CLOSE Statement ................................................................................. 4-39

    4.14.3 INPUT Statement.................................................................................. 4-39

    4.14.4 OUTPUT Statement ..............................................................................4-40

    4.15 Disk I/O Statements ...............................................................................................4-41

    4.16 Program Control Statements .................................................................................. 4-43

    4.16.1 LOAD Statement................................................................................... 4-43

    4.16.2 REMOVE Statement ............................................................................. 4-44

    4.16.3 CHECK Statement ................................................................................ 4-44

    4.16.4 ACTIVATE Statement........................................................................... 4-45

    4.16.5 ABORT Statement ................................................................................4-45

    4.16.6 PAUSE Statement.................................................................................. 4-46

    4.16.7 RESUME Statement..............................................................................4-47

    4.16.8 EVENT, SETEVENT, ACTION, ENDEVENT,

    CLEAREVENT Statements ..................................................................4-47

    4.16.9 ABNORMAL Statement.......................................................................4-49

  • 7/29/2019 TCL User's Guide

    5/158

    Taylor Control Language Users GuideTable of Contents

    3BUR 000 242 R0301 REV H v

    CONTENTS (continued)4.16.10 ABNORMSUBR Statement ................................................................. 4-50

    4.16.11 CRITICAL and NONCRITICAL Statements....................................... 4-51

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

    4.17.1 STARTBATCHENDBATCH Structure............................................. 4-52

    4.17.2 REPORT Statement .............................................................................. 4-53

    4.17.3 TRENDONTRENDOFF Statements ................................................ 4-53

    4.17.4 RECORD Statement ............................................................................. 4-54

    4.17.4.1 RECORD Statement for Reports ................................... 4-54

    4.17.4.2 RECORD Statement for History.................................... 4-55

    4.17.4.3 RECORD Statement for Recipes................................... 4-56

    4.17.4.4 RECORDER Statement ................................................. 4-56

    4.18 TCL Mailbox Interface .......................................................................................... 4-57

    4.18.1 SEND and RECEIVE Statements......................................................... 4-57

    4.19 Unit Message (Unitmsg) Display Interface ........................................................... 4-58

    4.19.1 MESG Statement .................................................................................. 4-58

    4.19.2 REPLY Statement ................................................................................. 4-58

    4.19.3 UNIT_ALARM Statement ................................................................... 4-59

    4.20 Comments .............................................................................................................. 4-60

    4.21 Wait Statement....................................................................................................... 4-60

    4.22 Include Statement .................................................................................................. 4-60

    4.23 Updateon And Updateoff Statements .................................................................... 4-61

    4.24 UCALs - User Calculation Routines For CCF ...................................................... 4-61

    4.24.1 Features Common to Synchronous and Asynchronous UCALs........... 4-62

    4.24.2 Synchronous UCALs ............................................................................ 4-62

    4.24.3 Asynchronous UCALs.......................................................................... 4-64

    4.25 Sequential Function Chart (SFC) Display Statements........................................... 4-66

    4.25.1 STEP_ACTIVITY ................................................................................ 4-66

    4.25.2 STEP_CONDITION............................................................................. 4-67

    4.25.3 STEP_TRANSITION, ACTION .......................................................... 4-68

    4.26 _TCLACCESS....................................................................................................... 4-70

    Chapter 5 - Recipe Development

    5.1 General Information................................................................................................. 5-1

    5.1.1 Recipe Items ........................................................................................... 5-1

    5.1.2 Recipe Development............................................................................... 5-2

    5.1.3 Loading Recipes into Units..................................................................... 5-2

    5.1.4 Recipes Items in TCL Programs............................................................. 5-2

    5.1.5 Changing Values from the Recipe Detail Display .................................. 5-2

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

  • 7/29/2019 TCL User's Guide

    6/158

    Taylor Control Language Users GuideTable of Contents

    vi 3BUR 000 242 R0301 REV H

    CONTENTS (continued)5.2.1 Recipe Catalog Display...........................................................................5-3

    5.2.2 CREATEHow to Create a New Recipe ...............................................5-5

    5.2.3 EDITHow to Use the Recipe Editor.................................................... 5-6

    5.2.3.1 Editing Recipe Items ........................................................5-9

    5.2.4 EDITHow to Use the Source Editor....................................................5-9

    5.2.5 COMPILHow to Compile a Recipe Created with the Source Editor 5-11

    5.2.6 EDITHow to Modify a Recipe.......................................................... 5-12

    5.2.7 REMOVE SOURCEHow to Change a Recipe from the

    Source Editor Format to the Recipe Editor Format............................... 5-12

    5.2.8 DE-COMPILHow to Change a Recipe from the

    Recipe Editor Format to the Source Editor Format............................... 5-12

    5.2.9 COPYHow to Make a Copy of a Recipe and Store it Under a

    Different Name......................................................................................5-13

    5.2.10 XFER (SAVE)How to Make Backup Copies of Recipes toOther Disk Devices ...............................................................................5-13

    5.2.11 XFER (RESTORE)How to Load (Restore) Backup Copies............. 5-14

    5.2.12 DELETEHow to Delete a Recipe......................................................5-15

    5.2.13 PRINTHow to Print a Hard Copy of a Recipe.................................. 5-15

    5.2.14 DIR LISTHow to Print a List of the Recipes.................................... 5-15

    5.2.15 EXITHow to Exit from the Recipe Software....................................5-16

    5.3 How to Transfer TCL Recipes from an IBM PC or VAX Computer..................... 5-16

    Chapter 6 - TCL Program Development

    6.1 General .....................................................................................................................6-1

    6.2 TCL Catalog Functions............................................................................................ 6-1

    6.2.1 TCL Catalog Display .............................................................................. 6-1

    6.2.1.1 How to Call up the TCL Catalog Display ........................6-1

    6.2.1.2 Description of Fields on TCL Catalog Display................6-2

    6.2.1.3 Softkey Functions.............................................................6-4

    6.2.2 CREATEHow to Create a New Program or Include File....................6-4

    6.2.3 EDITHow to Access the TCL Editor..................................................6-5

    6.2.4 COMPILHow to Compile a Program.................................................. 6-5

    6.2.5 LINKHow to Link a Program .............................................................6-6

    6.2.6 XFER (SAVE)How to Make Backup Copies of Programs and

    Include Files to Other Disk Devices .......................................................6-7

    6.2.7 XFER (RESTORE)How to Load (Restore) Backup Copies...............6-8

    6.2.8 DELETEHow to Delete a Program or Include File ............................6-9

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

    6.2.10 PRINTHow to Print a Hard Copy of a Program or Include File....... 6-10

    6.2.11 NEW PRINTRHow to Select a Different Printer..............................6-10

  • 7/29/2019 TCL User's Guide

    7/158

    Taylor Control Language Users GuideTable of Contents

    3BUR 000 242 R0301 REV H vii

    CONTENTS (continued)6.2.12 DIR LISTHow to Print a List of the Items on the Catalog ............... 6-10

    6.2.13 EXIT ..................................................................................................... 6-10

    Chapter 7 - TCL Source and Recipe Editor Functions7.1 Editing Functions..................................................................................................... 7-1

    7.2 Cursor Movement .................................................................................................... 7-1

    7.3 Text Editing Functions............................................................................................. 7-3

    Appendix A - Reference Tables

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

    INDEX

  • 7/29/2019 TCL User's Guide

    8/158

    Taylor Control Language Users GuideTable of Contents

    viii 3BUR 000 242 R0301 REV H

    ILLUSTRATIONS

    Figure 2-1. Example, Symmetrical Units ........................................................................2-2

    Figure 2-2. Example, Recipe Display..............................................................................2-4

    Figure 2-3. State Transitions............................................................................................ 2-6

    Figure 3-1. Unit Relative Names Templet .......................................................................3-2

    Figure 3-2. TCL Runtime Templet .................................................................................. 3-5

    Figure 3-3. TCL Mailbox Templet ..................................................................................3-6

    Figure 3-4. Unit Master Templet .....................................................................................3-9

    Figure 3-5. Unit Master Templet, List View.................................................................. 3-10

    Figure 4-1. Historical Data on a Current Trend Graph..................................................4-28

    Figure 5-1. Recipe Catalog Display ................................................................................ 5-3

    Figure 5-2. Second Level of Softkeys ob Recipe Catalog Display .................................5-5

    Figure 5-3. CREATE Softkey Set for Recipe Catalog Display .......................................5-5

    Figure 5-4. Recipe Editor Display................................................................................... 5-7

    Figure 5-5. ADD Softkey Set .......................................................................................... 5-7

    Figure 5-6. COMPIL Softkey Set..................................................................................5-11

    Figure 5-7. XFER KEYS Softkey Set ........................................................................... 5-13

    Figure 5-8. Disk Keys....................................................................................................5-14

    Figure 5-9. LOAD Softkeys...........................................................................................5-14

    Figure 6-1. TCL Catalog Display....................................................................................6-3

    Figure 6-2. Second Level of Softkeys on TCL Catalog Display.....................................6-4

    Figure 6-3. COMPIL Softkeys ........................................................................................6-5

    Figure 6-4. XFER Softkeys ............................................................................................. 6-7

    Figure 6-5. Disk Softkeys................................................................................................ 6-8

    Figure 6-6. LOAD Softkeys............................................................................................. 6-8

  • 7/29/2019 TCL User's Guide

    9/158

    Taylor Control Language Users GuideTable of Contents

    3BUR 000 242 R0301 REV H ix

    TABLES

    Table 4-1. TCL Functions.............................................................................................. 4-9

    Table 4-2. Program Control Parameters ...................................................................... 4-20

    Table 4-3. Recipe Parameters ...................................................................................... 4-21

    Table 4-4. FILESYS_INCL File.................................................................................. 4-41

    Table 4-5. Abnormal Conditions ................................................................................. 4-49

    Table 4-6. Fatal Abnormal 4 Conditions .................................................................... 4-50

    Table 4-7. _TCLACCESS Commands ....................................................................... 4-71

    Table 4-8. _TCL_ACC_INCL.TCL File Contents ..................................................... 4-73

    Table 5-1. Recipe Example............................................................................................ 5-1

    Table A-1. ASCII Control Code to Ordinal Number Conversion Table ........................A-1

    Table A-2. ASCII Character to Ordinal Number Conversion Table ..............................A-2

    Table A-3. Abnormal Conditions ...................................................................................A-3

    Table A-4. Program Control Parameters ........................................................................A-3

  • 7/29/2019 TCL User's Guide

    10/158

    Taylor Control Language Users GuideTable of Contents

    x 3BUR 000 242 R0301 REV H

  • 7/29/2019 TCL User's Guide

    11/158

    Taylor Control Language Users GuideSection 1.1 General Information

    3BUR 000 242 R0301 REV H 1-1

    Chapter 1 Introduction

    1.1 General InformationTCL is a structured programming language modeled after Pascal. In addition to its many Pascal-

    like programming structures, TCL has unique programming structures that are specifically

    designed for process control and Advant OCS (Open Control System) applications. English-

    like 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 TCLdevelopment, you must use the AdvaBuild TCL Builder.

  • 7/29/2019 TCL User's Guide

    12/158

    Taylor Control Language Users GuideChapter 1 Introduction

    1-2 3BUR 000 242 R0301 REV H

    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 forTCL 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 theMultibus-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

  • 7/29/2019 TCL User's Guide

    13/158

    Taylor Control Language Users GuideSection 2.1 General

    3BUR 000 242 R0301 REV H 2-1

    Chapter 2 TCL Overview

    2.1 GeneralTCL 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 TCLprograms 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, thethree units shown in Figure 2-1may 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.

  • 7/29/2019 TCL User's Guide

    14/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-2 3BUR 000 242 R0301 REV H

    2.3 Step Structure

    The step is the building block of all TCL programs. All executable statements must be containedwithin 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.

    Figure 2-1. Example, Symmetrical Units

  • 7/29/2019 TCL User's Guide

    15/158

    Taylor Control Language Users GuideSection 2.5 Recipes

    3BUR 000 242 R0301 REV H 2-3

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

  • 7/29/2019 TCL User's Guide

    16/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-4 3BUR 000 242 R0301 REV H

    A recipe is made up of items. Each item in a recipe has the following data associated with it:

    value, engineering units, item ID, high limit and low limit, and descriptor, Figure 2-2.

    2.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 toSection 4.16, Program Control

    Statements, for further information.

    Figure 2-2. Example, Recipe Display

  • 7/29/2019 TCL User's Guide

    17/158

    Taylor Control Language Users GuideSection 2.7 Program Control

    3BUR 000 242 R0301 REV H 2-5

    Every unit has a Unit Master Templet associated with it as described inChapter 3, Data BaseTemplets 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 statetransitions 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.

  • 7/29/2019 TCL User's Guide

    18/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-6 3BUR 000 242 R0301 REV H

    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.

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

    Figure 2-3. State Transitions

    Inactive

    Paused Active

    Pause

    Resume

    Abort

    Activate

    End Abort

  • 7/29/2019 TCL User's Guide

    19/158

    Taylor Control Language Users GuideSection 2.7.3 Mode

    3BUR 000 242 R0301 REV H 2-7

    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 inSection 4.16, Program Control Statements.

    2.7.3 Mode

    Mode establishes the method for stepwise execution of an active program. The possible programmodes 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 (seeSection 2.20.2, Debugging). In semi-auto, steps are skipped and/or repeatedthrough 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 methodsdescribed 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.

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

  • 7/29/2019 TCL User's Guide

    20/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-8 3BUR 000 242 R0301 REV H

    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 RESTARTSETEVENT ($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 activeon 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

  • 7/29/2019 TCL User's Guide

    21/158

    Taylor Control Language Users GuideSection 2.8.2 External Program Calls

    3BUR 000 242 R0301 REV H 2-9

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

    defined 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 aWAIT 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 inan executable statement by specifying the external program name and a parameter list.

  • 7/29/2019 TCL User's Guide

    22/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-10 3BUR 000 242 R0301 REV H

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

  • 7/29/2019 TCL User's Guide

    23/158

    Taylor Control Language Users GuideSection 2.9.1 Methods of Access

    3BUR 000 242 R0301 REV H 2-11

    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 bookB140, 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 tagreference method.

    $CV101.DEV_CMND:= #OPEN;

    The other is an example of the unit relative reference method.

    *RINSEVALVE.DEV_CMND:= #OPEN;

  • 7/29/2019 TCL User's Guide

    24/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-12 3BUR 000 242 R0301 REV H

    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)

    THENstatement;

    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.

  • 7/29/2019 TCL User's Guide

    25/158

    Taylor Control Language Users GuideSection 2.10 Report Services And History Services Interface

    3BUR 000 242 R0301 REV H 2-13

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

  • 7/29/2019 TCL User's Guide

    26/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-14 3BUR 000 242 R0301 REV H

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

    checking logic. TCL mailboxes are defined by TCL Mailbox Templets as described inSection3.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 commoncode 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

  • 7/29/2019 TCL User's Guide

    27/158

  • 7/29/2019 TCL User's Guide

    28/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-16 3BUR 000 242 R0301 REV H

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

  • 7/29/2019 TCL User's Guide

    29/158

    Taylor Control Language Users GuideSection 2.20.1 Download/Remove Function

    3BUR 000 242 R0301 REV H 2-17

    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 isactivated 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 ofBreakpoints. 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 enabledwithout disturbing the list of items that are locked.

  • 7/29/2019 TCL User's Guide

    30/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-18 3BUR 000 242 R0301 REV H

    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 controlthe 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 bookB100, System Configurator Users

    Guide (when using the Multibus-based database configuration platform), orAdvaBuild

    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.

  • 7/29/2019 TCL User's Guide

    31/158

    Taylor Control Language Users GuideSection 2.20.7 Sequential Function Chart (SFC) Display Functions

    3BUR 000 242 R0301 REV H 2-19

    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 relatedstatements 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 ofload-time textand 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 user-

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

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

  • 7/29/2019 TCL User's Guide

    32/158

    Taylor Control Language Users GuideChapter 2 TCL Overview

    2-20 3BUR 000 242 R0301 REV H

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

  • 7/29/2019 TCL User's Guide

    33/158

    Taylor Control Language Users GuideSection 3.1 Overview

    3BUR 000 242 R0301 REV H 3-1

    Chapter 3 Data Base Templets for TCL

    3.1 OverviewThe 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. Thistemplet 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 canbe 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) andAdvaBuild Basic Functions Users Guide for Advant Station-

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

  • 7/29/2019 TCL User's Guide

    34/158

    Taylor Control Language Users GuideChapter 3 Data Base Templets for TCL

    3-2 3BUR 000 242 R0301 REV H

    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, UnitsAnd 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 Unit Relative Name Actual Tag Name

    UNIT1 RINSEVALVE RV100

    UNIT2 RINSEVALVE RV200

    UNIT3 RINSEVALVE RV300

    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.

    Figure 3-1. Unit Relative Names Templet

  • 7/29/2019 TCL User's Guide

    35/158

    Taylor Control Language Users GuideSection 3.4 TCL Runtime Templet

    3BUR 000 242 R0301 REV H 3-3

    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 UnitMaster 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 bookB100, System Configurator

    Users Guide, andAdvaBuild 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 designatedsubroutine 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