0% found this document useful (0 votes)
344 views304 pages

Batch 90 and UDF Programming Language

Uploaded by

jonathan
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
344 views304 pages

Batch 90 and UDF Programming Language

Uploaded by

jonathan
Copyright
© © All Rights Reserved
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

Composer ™

for Harmony

Batch 90 and UDF Programming Language


Composer (Version 4.2)
NOTICE
The information in this document is subject to change without notice and should not be
construed as a commitment by ABB. ABB assumes no responsibility for any errors that
may appear in this document.

In no event shall ABB be liable for direct, indirect, special, incidental or consequential
damages of any nature or kind arising from the use of this document, nor shall ABB be
liable for incidental or consequential damages arising from use of any software or hard-
ware described in this document.

This document and parts thereof must not be reproduced or copied without written per-
mission from ABB, and the contents thereof must not be imparted to a third party nor used
for any unauthorized purpose.

The software or hardware described in this document is furnished under a license and
may be used, copied, or disclosed only in accordance with the terms of such license.

This product meets the requirements specified in EMC Directive 89/336/EEC and in Low
Voltage Directive 72/23/EEC.

Copyright © 2004 ABB


All rights reserved.

Release: November 2004


Document number: WBPEEUI330254B3
Preface

The Batch 90™ programming language provides a method of


configuring batch sequence strategies. The User Defined Func-
tion (UDF) programming language provides a method of creat-
ing a custom control function. This instruction explains the
Batch 90 and UDF programming languages.

WBPEEUI330254B3
WBPEEUI330254B3
Table of Contents

Section 1 Introduction ..................................................................................................1-1


Overview .................................................................................................................. 1-1
Enhancements......................................................................................................... 1-1
Intended User .......................................................................................................... 1-2
Instruction Content.................................................................................................. 1-2
How to Use this Instruction...................................................................................... 1-3
Document Conventions ............................................................................................ 1-3
Glossary of Terms and Abbreviations ..................................................................... 1-4
Reference Documents .............................................................................................. 1-5

Section 2 Batch 90 Description ...................................................................................2-1


Introduction............................................................................................................. 2-1
BSEQ Execution Model ............................................................................................ 2-1
PHASEX Execution Model ........................................................................................ 2-2
Unit Procedures ....................................................................................................... 2-3
BSEQ Batch 90 Programming .............................................................................. 2-5
PHASEX Batch 90 Programming .......................................................................... 2-5
Batch Programs ....................................................................................................... 2-8
Batch Data Types ................................................................................................. 2-8
Phase Subroutine................................................................................................. 2-8
Function Subroutine .......................................................................................... 2-11
Monitor Subroutine ............................................................................................ 2-12
Batch Program Construction ................................................................................. 2-13
Monitor Subroutine Definitions .......................................................................... 2-14
Basic Device Interlocking................................................................................ 2-14
Reactor Protection Interlock............................................................................ 2-17
Function Subroutine Definitions ........................................................................ 2-18
Phase Subroutine Definitions ............................................................................. 2-18
CLEANING_REACTOR Phase .......................................................................... 2-18
ADD_B_OR_C Phase Subroutine..................................................................... 2-19
ADD_D Phase Subroutine............................................................................... 2-21
Ramp Temperature of Reactor Phase Subroutine ............................................ 2-22
BRINE_ON_JACKET Phase Subroutine ........................................................... 2-22
DUMP_PRODUCT Phase Subroutine............................................................... 2-22
Batch Sequence Function Code.............................................................................. 2-24
Phase Execution Function Code ............................................................................. 2-28

Section 3 User Defined Function (UDF) Description .................................................3-1


Introduction............................................................................................................. 3-1
UDF Programs ......................................................................................................... 3-1
Data..................................................................................................................... 3-1

WBPEEUI330254B3 iii
Table of Contents (continued)

Section 3 User Defined Function (UDF) Description (continued)


State Subroutine ..................................................................................................3-2
Function Subroutine.............................................................................................3-3
Monitor Subroutines.............................................................................................3-4
UDF Program Execution ...........................................................................................3-5
UDF Program Construction ......................................................................................3-5
Monitor Subroutine Definition ..............................................................................3-8
Function Subroutine Definitions ...........................................................................3-8
State Subroutine Definitions.................................................................................3-8

Section 4 Function Library ..........................................................................................4-1


Introduction .............................................................................................................4-1
Syntax......................................................................................................................4-1
Comments ............................................................................................................4-1
Names ..................................................................................................................4-2
Lines ....................................................................................................................4-2
Reserved Words/Constants/Directives..................................................................4-2
Expressions ........................................................................................................4-11
Notation .............................................................................................................4-11
Relational Operators and Expressions.................................................................4-12
Variable to List or Array Comparisons .............................................................4-13
Variable to Limits Comparisons.......................................................................4-14
Array Comparisons .........................................................................................4-14
Minimum/Maximum Array Values ..................................................................4-15
Boolean Operators and Expressions....................................................................4-15
Arithmetic Operators and Expressions ................................................................4-16
Local/Global Conventions...................................................................................4-17
Commands and Statements....................................................................................4-18
ACK (Variable) ........................................................................................................4-18
ACQUIRE ...............................................................................................................4-19
Advanced PID (Function Block) ...............................................................................4-19
#ALPHA (Directive) .................................................................................................4-21
Analog Exception Report (Function Block) ..............................................................4-22
ARRAY ...................................................................................................................4-24
Assignment (Statement)..........................................................................................4-24
BATCH (Variable)....................................................................................................4-25
BATCH DATA (Statement).......................................................................................4-25
Batch Sequence (Function Block) ...........................................................................4-27
BBUF .....................................................................................................................4-28
Block Array (Data Structure) ..................................................................................4-28
BREAK (Statement) ................................................................................................4-33
CALL ......................................................................................................................4-33

iv WBPEEUI330254B3
Table of Contents (continued)

Section 4 Function Library (continued)


CAMPAIGN (Variable) ............................................................................................. 4-33
CASE (Statement) .................................................................................................. 4-34
#CASESENSE (Directive)........................................................................................ 4-36
Case Conversion (Command).................................................................................. 4-36
Common Sequence (Data Structure)....................................................................... 4-37
CONNECT.............................................................................................................. 4-58
CONST (Data) ........................................................................................................ 4-58
CONST ARRAY (Data Structure) ............................................................................. 4-59
CONST STRING (Data) ........................................................................................... 4-61
CONST STRING ARRAY (Data Structure) ................................................................ 4-64
CONTINUOUS (Statement) ..................................................................................... 4-66
Control Station (Function Block) ............................................................................ 4-67
CYCLE TIME (Variable) .......................................................................................... 4-69
DATA (Statement) .................................................................................................. 4-69
Data Buffer (Function Block).................................................................................. 4-71
Data Export (Function Block) ................................................................................. 4-73
#DEBUG LEVEL (Directive) .................................................................................... 4-78
DECLARATIONS (Statement) .................................................................................. 4-79
#DESCRIPTOR (Directive) ...................................................................................... 4-80
Device Driver (Function Block) ............................................................................... 4-80
Digital Exception Report (Function Block) .............................................................. 4-83
DIGIT (Function) .................................................................................................... 4-85
DISABLE EXTERNAL HOLD (Statement) ................................................................ 4-86
DISABLE FAULT CODE (Statement) ....................................................................... 4-87
DONE (Statement).................................................................................................. 4-87
#EJECT (Directive) ................................................................................................. 4-87
ENABLE EXTERNAL HOLD (Statement) ................................................................. 4-88
ENABLE FAULT CODE (Statement) ........................................................................ 4-88
ENDSUBR (Statement) ........................................................................................... 4-89
FAULT (Statement)................................................................................................. 4-89
FAULT LOGIC (Section) .......................................................................................... 4-90
FIRST CYCLE (Variable) ......................................................................................... 4-91
FOR...END FOR Loop (Control Structure) ............................................................... 4-91
FUNCTION (Subroutine)......................................................................................... 4-93
Function Block ...................................................................................................... 4-98
Function Block Array (Data Structure) ................................................................... 4-99
Function Generator (Data Structure).................................................................... 4-102
Global Data Structures (Integrators, Timers, Etc.) ................................................ 4-104
#HIHI (Directive) .................................................................................................. 4-104
HISTORIAN BUFFER (Variable) ............................................................................ 4-105
HISTORIAN STATUS (Variable)............................................................................. 4-105
HOLD .................................................................................................................. 4-105

WBPEEUI330254B3 v
Table of Contents (continued)

Section 4 Function Library (continued)


HOLD LOGIC (Section) .........................................................................................4-106
IF (Statement).......................................................................................................4-106
IF THEN...ENDIF (Control Structure) ....................................................................4-107
IF THEN...ELSE...ENDIF (Control Structure).........................................................4-107
#INCLUDE (Directive) ...........................................................................................4-108
INPUT (Declaration) ..............................................................................................4-109
INTEGRATOR (Data Structure) .............................................................................4-110
LAST OPERATION (Variable) .................................................................................4-112
LAST PHASE (Variable) .........................................................................................4-112
LAST SUBR (Variable)...........................................................................................4-113
#LIST (Directive) ...................................................................................................4-113
LOT (Variable) ......................................................................................................4-114
#MAXPARALLEL (Direction) ..................................................................................4-114
MONITOR (Subroutine).........................................................................................4-115
MONITOR (Declaration) ........................................................................................4-120
Multistate Device Driver (Function Block) .............................................................4-121
NEXT OPERATION (Statement) .............................................................................4-124
NEXT PHASE (Statement) .....................................................................................4-125
NEXT STATE (Statement)......................................................................................4-125
#NOLIST (Directive) ..............................................................................................4-126
NORMAL LOGIC (Section) .....................................................................................4-126
Normalize String (Command) ................................................................................4-127
OPERATION (Variable) ..........................................................................................4-127
OPERATION DESCRIPTOR (Function)...................................................................4-128
OUTPUT (Declaration)...........................................................................................4-129
PHASE (Statement)...............................................................................................4-130
PHASE DESCRIPTOR (Function)...........................................................................4-130
PHASE NUMBER (Variable) ..................................................................................4-130
PHASE SUBR (Subroutine) ...................................................................................4-131
PROGRAM DESCRIPTOR (Function) .....................................................................4-136
#PROGRAMID (Directive) ......................................................................................4-136
Ramp Data (Data Structure) .................................................................................4-137
RBUF ...................................................................................................................4-139
RECIPE DESCRIPTOR (Function) .........................................................................4-139
RECIPE ENTRY (Function) ....................................................................................4-139
Remote Control Memory (Function Block) .............................................................4-141
Remote Manual Set Constant (Function Block) .....................................................4-142
Remote Motor Control (Function Block) ................................................................4-144
REPEAT...UNTIL (Control Structure) .....................................................................4-146
RESERVE.............................................................................................................4-146
RESET .................................................................................................................4-146
RESTART (Statement) ...........................................................................................4-147

vi WBPEEUI330254B3
Table of Contents (continued)

Section 4 Function Library (continued)


RESTART LOGIC (Section).................................................................................... 4-147
RESTART POINT (Statement)................................................................................ 4-148
RESUME.............................................................................................................. 4-149
RESUME AT (Statement) ...................................................................................... 4-149
RETURN (Statement)............................................................................................ 4-150
SET ..................................................................................................................... 4-150
SET AND WAIT .................................................................................................... 4-150
SIZEOF (Function) ............................................................................................... 4-151
SKIP CYCLE (Statement) ...................................................................................... 4-152
Smith Predictor (Function Block).......................................................................... 4-152
START ................................................................................................................. 4-154
STATE SUBR (Subroutine) ................................................................................... 4-154
STEP SUBR (Subroutine) ..................................................................................... 4-156
SUBPHASE (Variable)........................................................................................... 4-156
SUBR DESCRIPTOR (Function) ............................................................................ 4-156
SUBR STATUS (Function) .................................................................................... 4-157
Text Selector (Function Block).............................................................................. 4-157
TIMER (Data Structure) ....................................................................................... 4-160
#TITLE (Directive) ................................................................................................ 4-162
UDF TYPE (Function Block) ................................................................................. 4-162
UNACQUIRE ........................................................................................................ 4-162
UNCONNECT ....................................................................................................... 4-162
UNIT DATA (Statement)........................................................................................ 4-163
UNIT DESCRIPTOR (Function) ............................................................................. 4-165
UNIT PARAMETERS (Declarations)....................................................................... 4-165
UNRESERVE ....................................................................................................... 4-166
VAR (Data) ........................................................................................................... 4-167
VAR ARRAY (Data Structure)................................................................................ 4-167
VAR STRING (Data) .............................................................................................. 4-171
VAR STRING ARRAY (Data Structure) .................................................................. 4-174
WAIT FOR (Statement) ......................................................................................... 4-178
WAIT UNTIL (Statement) ...................................................................................... 4-178
WAIT WHILE (Statement) ..................................................................................... 4-179
WHILE...ENDWHILE (Control Structure) .............................................................. 4-179

Appendix A Sample Applications .............................................................................. A-1


Batch 90 .................................................................................................................. A-1
Parallel Phase Subroutines................................................................................... A-1
BSEQ Batch 90 Program Implementation Requirements ................................... A-3
BSEQ Logic Execution Control Flow ................................................................. A-4
PHASEX Batch 90 Program Implementation Requirements ............................... A-5

WBPEEUI330254B3 vii
Table of Contents (continued)

Appendix A Sample Applications (continued)


PHASEX Logic Execution Control Flow ............................................................. A-5
Common Sequences............................................................................................. A-6
Common Sequence Function Block Diagram .................................................... A-7
Common Sequence Communication ............................................................... A-10
Acquiring Control of a CSEQ Function Block.................................................. A-11
Typical Application......................................................................................... A-12
User Defined Function (UDF) ................................................................................. A-14

Appendix B BSEQ State Transition Diagram ............................................................ B-1


Batch Sequence States ............................................................................................ B-1
Batch Sequence Transitions .................................................................................... B-3

Appendix C PHASEX State Transition Diagrams ..................................................... C-1


Introduction ............................................................................................................ C-1
States...................................................................................................................... C-2
Aborted................................................................................................................ C-2
Aborting .............................................................................................................. C-3
Complete ............................................................................................................. C-3
Held .................................................................................................................... C-3
Holding................................................................................................................ C-4
Idle (Program Active) ............................................................................................ C-4
Idle (Program Inactive) ......................................................................................... C-4
Paused ................................................................................................................ C-5
Pausing ............................................................................................................... C-5
Restarting............................................................................................................ C-6
Running .............................................................................................................. C-6
Stopped ............................................................................................................... C-6
Stopping .............................................................................................................. C-7
External Commands ................................................................................................ C-7
Abort ................................................................................................................... C-7
Ack (Operator Acknowledge)................................................................................. C-7
Acquire ................................................................................................................ C-7
Hold .................................................................................................................... C-9
Init Cold .............................................................................................................. C-9
Init Hot ................................................................................................................ C-9
Pause .................................................................................................................. C-9
Release .............................................................................................................. C-10
Reset ................................................................................................................. C-10
Restart .............................................................................................................. C-10
Resume ............................................................................................................. C-10

viii WBPEEUI330254B3
Table of Contents (continued)

Appendix C PHASEX State Transition Diagrams (continued)


Start ..................................................................................................................C-10
Stop ...................................................................................................................C-10
Program Commands ..............................................................................................C-11
Fault ..................................................................................................................C-11
Next Phase/Operation ........................................................................................C-11
Restart ...............................................................................................................C-11
Resume At .........................................................................................................C-12

Appendix D Run-Time Fault Codes ........................................................................... D-1


BSEQ.......................................................................................................................D-1
PHASEX...................................................................................................................D-4

List of Figures
No. Title Page

2-1. Batch Process ........................................................................................... 2-4


2-2. Batch Sequence Listing of Phases ............................................................. 2-5
2-3. Unit Procedure Printed from Batch Data Manager ..................................... 2-6
2-4. PHASEX Batch Manager Recipe ................................................................ 2-7
2-5. PHASEX Listing of Phases......................................................................... 2-7
2-6. Phase Subroutine Structure...................................................................... 2-9
2-7. Function Subroutine Structure ............................................................... 2-12
2-8. Monitor Subroutine Structure ................................................................. 2-12
2-9. Batch Data Section ................................................................................. 2-15
2-10. Function Block Configuration ................................................................. 2-16
2-11. Monitor Subroutine for Basic Device Interlocking .................................... 2-17
2-12. Monitor Subroutine for Reactor Protection Interlocking ........................... 2-17
2-13. Example Device Mode Change Function Subroutine................................ 2-19
2-14. Cleaning Reactor Phase Subroutine ........................................................ 2-20
2-15. Add Component B or C Phase Subroutine ............................................... 2-21
2-16. Add Component D Phase Subroutine ...................................................... 2-23
2-17. Ramp Reactor Temperature Phase Subroutine ........................................ 2-25
2-18. Put Jacket on Low Temperature Brine Phase Subroutine ........................ 2-26
2-19. Dump Product Phase Subroutine ............................................................ 2-27
2-20. Batch Sequence Interface Logic............................................................... 2-28
2-21. PHASEX Configuration............................................................................ 2-29
3-1. State Subroutine Structure ....................................................................... 3-2

WBPEEUI330254B3 ix
List of Figures (continued)
No. Title Page
3-2. Function Subroutine Structure..................................................................3-4
3-3. Monitor Subroutine Structure ...................................................................3-4
3-4. UDF Process..............................................................................................3-6
3-5. Data Section..............................................................................................3-7
3-6. Level Controller and Pump Function Block Configurations ........................3-9
3-7. UDF Function Block Configuration ..........................................................3-10
3-8. Monitor Subroutine for Determining Pump Status ...................................3-11
3-9. Function Subroutine to Start a Pump ......................................................3-12
3-10. Function Subroutine to Stop a Pump.......................................................3-12
3-11. State Subroutine for Initializing the Pumps .............................................3-13
3-12. State Subroutine for Running the Pumps ................................................3-14
4-1. Production Train .....................................................................................4-38
4-2. Multistate Device Driver Digit Positions ...................................................4-86
4-3. Function Subroutine Structure................................................................4-93
4-4. Example Function Generator .................................................................4-102
4-5. Monitor Subroutine Structure ...............................................................4-116
4-6. Phase Subroutine Structure ..................................................................4-131
4-7. State Subroutine Structure ...................................................................4-154
A-1. BSEQ Parallel Phase Subroutine Unit Procedure ...................................... A-2
A-2. BSEQ Phase 3 Program Logic Flow Diagram ............................................. A-4
A-3. PHASEX Phase 3 Program Logic Flow Diagram ......................................... A-6
A-4. PHASEX Function Block Configuration..................................................... A-7
A-5. Common Sequence Function Block Configuration (Page 1 of 2) ................. A-8
A-6. Common Sequence Function Block Configuration (Page 2 of 2) ................. A-9
A-7. Usage of Common Sequence ................................................................... A-12
A-8. Phase Subroutine Using CSEQ Commands............................................. A-13
A-9. UDF Process........................................................................................... A-14
A-10. UDF Function Block Configuration (Page 1 of 2) ..................................... A-21
A-11. UDF Function Block Configuration (Page 2 of 2) ..................................... A-22
B-1. Example State Transition Diagram ........................................................... B-1
C-1. PHASEX External Command State Transition Diagram ............................ C-8
C-2. PHASEX Program Command State Transition Diagram........................... C-12

x WBPEEUI330254B3
List of Tables
No. Title Page
1-1. Glossary of Terms and Abbreviations ........................................................ 1-4
1-2. Reference Documents ............................................................................... 1-5
4-1. Reserved Words ........................................................................................ 4-3
4-2. Reserved Constants .................................................................................. 4-6
4-3. Reserved Reference Extensions ................................................................. 4-7
4-4. Reserved Directives ............................................................................... 4-10
4-5. Operators and Expressions ..................................................................... 4-11
A-1. Parallel Phase Subroutine CHARGE_REACTOR Locations ......................... A-3
D-1. BSEQ Run-Time Fault Codes ....................................................................D-1
D-2. PHASEX Run-Time Fault Codes ................................................................D-4

WBPEEUI330254B3 xi
Support Services

ABB will provide assistance in the operation and repair of its


products. Requests for sales or application services should be
made to your nearest sales or service office. ABB can also pro-
vide installation, repair and maintenance contract services.

When ordering parts, use nomenclature or part numbers and


part descriptions from equipment manuals. Parts without a
description must be ordered from the nearest sales or service
office. Recommended spare parts lists, including prices are
available through the nearest sales or service office.

ABB has modern training facilities available for training your


personnel. On-site training is also available. Contact your
nearest ABB sales office for specific information and
scheduling.

Additional copies of this instruction, or other instructions, can


be obtained from the nearest ABB sales office at a reasonable
charge.

xii WBPEEUI330254B3
Trademarks and Registrations

Registrations and trademarks used in this document include:


™ Batch 90 Registered trademark of ABB.
™ Composer Trademark of ABB.
® INFI 90 Registered trademark of ABB.
® INFI-NET Registered trademark of ABB.
® Microsoft Registered trademark of Microsoft Corporation
® Network 90 Registered trademark of ABB.
™ Symphony Trademark of ABB.
® Windows Registered trademark of Microsoft Corporation

WBPEEUI330254B3 xiii
WBPEEUI330254B3
Introduction Section 1

Overview
Batch 90 and User Defined Function (UDF) are programming
languages whose purpose is to create sequence control logic
using descriptive, readable, and understandable statements.
The Batch 90 programming language is specifically designed to
implement flexible sequences in which the order of operations
and parameter data are specified by recipes. Similarly, the
UDF programming language is designed to implement fixed
sequences for which the order of operations is less flexible.

Enhancements
Batch 90 and UDF for Composer offers the following features
and benefits:

• Graphical user interface that is easy to understand and


use.

• Include a text editor that is fully integrated with all other


batch tools.

• Support for constant and variable string arrays that allows


for more streamlined coding of complex string
manipulations.

Additional features of Batch 90 include:


• Support for phase execution (PHASEX) function codes.

• Ability to specify alphanumeric campaign, batch, lot, and


recipe identifiers allows for more meaningful naming con-
ventions.

• Support for command and status string variables in the


common sequence data structures enabling the passing of
alphanumeric data between common sequence
applications.

• Ability of phases to extend beyond operation boundaries.

WBPEEUI330254B3 1-1
Intended User

Information regarding features added to this product as the


document was being printed is available in a README.B90 or
README.UDF file located in the directory specified during the
installation process. This is an ASCII document file and can be
routed to a printer via Windows or DOS commands. Print this
file and append it to this document.

Intended User
This instruction provides the necessary information to utilize
the Batch 90 and UDF programming languages. It is intended
for programmers with batch process or sequential logic control
experience and a working knowledge of function codes and the
Composer software. The programmer should also be familiar
with the configuration of human system interfaces such as
workstations executing Conductor software.

Instruction Content
This instruction contains four sections and three appendices.
It also includes a Table of Contents, List of Figures, List of
Tables, and Index giving several options to locate specific infor-
mation quickly. Appendices supplement information presented
in the individual sections. The sections and appendices that
make up this instruction include:
Introduction Provides an overview of the Batch 90 and UDF programming
languages and this instruction.
Batch 90 Description Describes the Batch 90 programming language.
User Defined Function Describes the UDF programming language.
(UDF) Description

Function Library Provides detailed information about and an example of each


command and statement. Also explained are the rules,
reserved words, and logic operators used in commands and
statements.
Sample Applications Details a few applications to illustrate some important con-
cepts of Batch 90.
BSEQ State Transition Provides and describes a BSEQ state transition diagram.
Diagram

1-2 WBPEEUI330254B3
How to Use this Instruction

PHASEX State Provides and describes state transition diagrams.


Transition Diagrams

Run-time Fault Codes Lists and explains the possible run-time error codes.

How to Use this Instruction


Read the applicable information in this instruction before
attempting to program using the Batch 90 or UDF program-
ming languages. It is important to become familiar with the
entire contents of the instruction prior to creating any pro-
grams to insure maximum use of all programming language
capabilities.

This instruction limits the information presented in each sec-


tion to only specific items required to complete the desired
task. The organization enables finding specific information
quickly, and permits using this instruction as a reference after
becoming fully familiar with the programming languages.

Be sure to read notes in text. Notes provide:

• Additional information.

• Information that should be considered before using a cer-


tain command or statement.

Document Conventions
This document uses standard text conventions to represent
keys, display items and user data inputs:
Display item Any item displayed on a screen appears as italic text. Example:

Running
User data input Bold - Identifies any part of a command line that is not
optional or variable and must be entered exactly as shown.

Italic - Identifies a variable parameter entered in a command


line.

[ ] - Indicates an optional parameter; text within the brackets


follows the previously described conventions.

WBPEEUI330254B3 1-3
Glossary of Terms and Abbreviations

Example:

CUP [port] [baud] [file_name.CSP]

SPECIAL KEYS - Identifies a specific key that is not alphabetic,


numeric or punctuation. Examples:
Press ENTER.
Press ESC V M. (Press and release each key in sequence.)
Press CTRL-ALT-SHIFT-DEL. (Press all keys in sequence without
releasing any one key until you have pressed them all.)
File names Name - Indicates a file or directory name. Example:

file1.b90
c:\new
Revision variable A ? indicates a value that may change depending on the ver-
sion of an item. Example:

Part number: 1234567?0


Part number: 1234567??

Glossary of Terms and Abbreviations


Table 1-1 is a glossary of terms and abbreviations used in this
instruction. It contains those terms and abbreviations that are
unique to ABB or have definitions that are different from stan-
dard industry usage.

Table 1-1. Glossary of Terms and Abbreviations

Term Definition
BDM Batch data manager. A proprietary software that is used to configure Batch 90
programs and recipes, download files to a control module, and debug Batch 90
programs and recipes.
Controller Directs field processes; the Harmony area controller (HAC) and multifunction
processor (MFP) are examples.
Control network Data communication highway.

1-4 WBPEEUI330254B3
Reference Documents

Reference Documents
Table 1-2 lists the documents that are referenced in this
instruction.

Table 1-2. Reference Documents

Number Document
WBPEEUI330253?? Batch Data Manager, Composer
WBPEEUI210504?? Symphony™ Function Code Application Manual

WBPEEUI330254B3 1-5
WBPEEUI330254B3
Batch 90 Description Section 2

Introduction
This section describes unit recipes, batch programs, opera-
tions, and subroutines. This section also defines what they do
and how they interact with each other.

There are two types of batch execution models supported by


function code logic. The batch sequence (BSEQ) function code
is used by one model while the phase execution (PHASEX)
function is used by the other model.

BSEQ Execution Model


The BSEQ function block executes recipe files that were cre-
ated using the unit or master recipe editors of the Batch Data
Manager application. These editors create a recipe file referred
to as a unit procedure. A unit recipe is created when a unit
procedure containing formulation data for a particular product
is built. The unit recipe and Batch 90 program files are then
downloaded to the controller.
Select the recipe ID (unit recipe file name) using input specifi-
cation S1 of the BSEQ function block and toggle the run/hold
input specification S3 from zero to one to execute the unit rec-
ipe. During execution the unit recipe uses the Batch 90 pro-
gram file referenced by specification S9 of the BSEQ function
block. This file contains all the phases that are allowed to be
executed by the BSEQ function block. Typically the Batch 90
program file declares equipment for an entire unit.

The BSEQ batch execution model has the advantage of higher


system integrity because all the information needed to execute
the unit recipe is contained within the controller. This model is
especially useful where a limited number of products are pro-
duced and for sequence control operations that rarely change.

WBPEEUI330254B3 2-1
PHASEX Execution Model

PHASEX Execution Model


The PHASEX function block executes phases defined in a con-
trol recipe configured by the Batch Manager software. This
recipe utilizes the required units to produce a product. The
ISA S88.01 standard specifies that a control recipe is made up
of unit recipes which are made of operations that contain
phases. No two operations can execute at the same time on the
same unit. Phases within an operation can execute sequen-
tially and simultaneously on the same unit. The Batch Man-
ager recipes can be configured in strict adherence to ISA
S88.10 if desired. This adherence is assumed in the following
discussions.
When a control recipe is executing, the target unit for a phase
is referenced to a PHASEX tag in the operator workstation. The
Batch Manager sends the phase name and formulation data to
the PHASEX tag which forwards the information to the
PHASEX function block in the controller. The PHASEX func-
tion block verifies the phase name and formulation data with
the phases defined in the Batch 90 program referenced by
PHASEX specification S9. The Batch Manager starts the exe-
cution of the requested phase by issuing a start command to
the PHASEX function block. The PHASEX function block state
changes to running and notifies the PHASEX tag when the
phase logic completes. When the PHASEX tag detects the com-
plete state, the Batch Manager moves on the next phase
defined in the control recipe.

Phase name and formulation data are stored in the Batch


Manager and only exist in the controller during the execution
of the phase when using the PHASEX execution model. The
advantage of this execution model is that it is more flexible in
configuration and easier to modify a recipe. It is especially use-
ful in applications where many units are used to make a prod-
uct, product formulation changes often, or many different
products are produced in a single facility.

Batch 90 programs used for PHASEX projects can be designed


in one of two ways. The program can define a unit (reactor,
crystallizer, etc.) as the scope it controls. Alternately, the pro-
gram can define an equipment module as the scope it controls.
An equipment module is a functional group of equipment that
can carry out a finite number of minor processing activities
(dosing, weighing, etc.). Using the equipment module

2-2 WBPEEUI330254B3
Unit Procedures

programming style provides greater flexibility because the


phases can be defined to run in parallel or series with the
phases of any other equipment modules defined by the Batch
Manager.
Unit programming In the unit programming style, the Batch 90 program refer-
ences and controls all the equipment associated with one unit.
The unit programming style is also used with the BSEQ func-
tion block. The number of phases allowed to execute simulta-
neously in a unit is set by the #MAXPARALLEL directive and
the number of linked PHASEX function blocks defined in the
control logic.
Equipment module This style utilizes one PHASEX function block to control an
programming equipment module whose program is referenced by specifica-
tion S9. The Batch 90 program references and controls all the
equipment in the module. The phases defined in the program
represent all the phases permitted to execute on the equip-
ment module.

Unit Procedures
There are two methods of configuring unit procedures. The
Batch Data Manager is used to create unit procedures that
utilize BSEQ function codes. The Batch Manager is used to
create unit procedures that utilize PHASEX function codes.
The unit procedure specifies the following information for each
operation:

1. The names of the phase subroutines that the operation will


execute. An operation can specify any phase subroutine con-
tained in the batch program. For example, operation five of a
particular unit procedure may call the phase subroutine
named BRINE_ON_JACKET. Operation five of another unit
procedure may call the phase subroutine named
ADD_B_OR_C. The operation numbers specify the normal exe-
cution order of the operations. The compiler directive #MAX-
PARALLEL limits the number of phase subroutines that can be
assigned to any given operation for the BSEQ function code.

2. The formulation data for each phase. The selected phase


subroutines specify the parameter lists. The formulation data
is passed from the unit procedure to the associated phase sub-
routine in accordance with the respective parameter lists. For
example, operation five of a unit procedure calls phase

WBPEEUI330254B3 2-3
Unit Procedures

subroutine ADD_B_OR_C. The formulation data specifies the


quantity of component B to be added to the reactor and a
default time during which the addition must be completed.
Therefore, phase ADD_B_OR_C of operation five of this unit
procedure has two pieces of formulation data associated with
it. This data passes to the phase subroutine ADD_B_OR_C
through the parameter list.

The formulation data associated with the phase does not have
to be numerical data exclusively. For example, it is possible to
pass device drivers, function block identities, etc. This is a very
powerful feature. It allows generic phase subroutines to be
written and the passing of actual devices and sensors to be
used from the unit procedure to the batch program logic.
Batch Manager unit procedures can pass numerical and string
formulation data to the phase.
Example Unit Figure 2-1 shows a diagram of a simple batch process. This
Procedure process has several operations. Figure 2-2 is a listing of these
operations. A phase subroutine performs each operation.

F V 501 AG 1
F V 510
A FT
F V 502 50 3
B TT T IC
F V 503 501 501A F V 511 LO W T E M P
C B R IN E
F V 504 RETURN
D

F V 512
F V 505
T IC
CW
50 1B
LO W F V 506
LT
TEM P
B R IN E P1
502 Y
S O LV E N T
R E C OV E RY
STEAM F V 508
RETURN
P RO D U C T
F V 509
N

F V 50 7

STEAM T 03 0 5 8A

Figure 2-1. Batch Process

2-4 WBPEEUI330254B3
Unit Procedures

EXECUTED STOP
CLEANING REACTOR
ADD COMPONENT B TO REACTOR
ADD COMPONENT C TO REACTOR
ADD COMPONENT D TO REACTOR
RAMP TEMPERATURE OF REACTOR
PUT JACKET ON LOW TEMP BRINE
DUMP PRODUCT

Figure 2-2. Batch Sequence Listing of Phases

A unit procedure specifies the operation execution order which


specifies the order that phase subroutines are executed and
the data that is passed. Figure 2-3 is a listing of a typical unit
procedure for this process controlled by a BSEQ function
block.

BSEQ Batch 90 Programming


Executed stop is always operation zero of every unit proce-
dure. When the executed stop input of the BSEQ function
block goes to a one, the BSEQ block executes operation zero.
Therefore, any specific logic that is to be performed on an exe-
cuted stop must be configured within a phase subroutine that
is in operation zero of the unit procedure. Numbering of opera-
tions is from zero to 250. Operation zero must be present or
the unit procedure editor will renumber the operations so that
the first operation is operation zero.

Create unit procedures for BSEQ Batch 90 programs using the


unit procedure editor. Establish formulation parameters (LO
and HI values) in the unit procedure using the editor. These
values place input boundaries on formulation data. If the val-
ues in the formulation data are not within the LO/HI values,
the editor generates a compilation error that must be corrected
before the unit recipe can be downloaded to a control module
for execution.

PHASEX Batch 90 Programming


Abort phase provides the same functionality for PHASEX pro-
grams as the executed stop does for BSEQ programs. The
abort phase is required in the phase logic program file for a
PHASEX function code. However this phase is not specified in

WBPEEUI330254B3 2-5
Unit Procedures

OPERATION PHASE SUBR LO VALUES HI

0.0 ESTOP
ESTOP
1.0 OPER1
CLEANING_REACTOR
2.0 OPER2
ADD_B_OR_C
ASL IN_VALVE: B
ANY CHARGE_AMOUNT: ( < 0 < 400 < 500 < )
ANY DEFAULT_TIME: ( < 0 < 900 < 1000 < )
3.0 OPER3
BRINE_ON_JACKET
ANY REACTOR_TEMP: ( < 0 < 30 < 50 < )
4.0 OPER4
RAMP_TEMPERATURE
ANY RATE1: ( < < 0 < 1.5 < )
ANY DEFAULT_TIME: ( < 0 < 900 < 2000 < )
ANY INITIAL_TEMP: ( < -50 < -40 < 10 < )
ANY FINAL_TEMP: ( < 0 < 30 < 60 < )
5.0 OPER5
ADD_B_OR_C
ASL IN_VALVE: C
ANY CHARGE_AMOUNT: ( < 0 < 600 < 900 < )
ANY DEFAULT_TIME: ( < 0 < 1200 < 1500 < )
6.0 OPER6
ADD_D
ANY COOK_TIME: ( < 0 < 1500 < 2000 < )
ANY DEFAULT_TIME: ( < 0 < 2000 < 2200 < )
ANY TOTAL_FLOW_D: ( < 0 < 500 < 600 < )
ANY REACTOR_TEMP: ( < 0 < 50 < 100 < )
7.0 OPER7
DUMP_PRODUCT

Figure 2-3. Unit Procedure Printed from Batch Data Manager

the batch manager recipe. The abort phase can be invoked by


issuing the abort command from a batch manager recipe or an
operator workstation faceplate. It can also be invoked from
interlock logic or by a global monitor detecting a fault. In the
case of linked PHASEX function blocks, all linked PHASEX
function blocks transfer to the aborting state if any active
PHASEX function block receives an abort command. Figure
2-4 shows an example (PHASEX) batch manager recipe. An
example listing of PHASEX phases is shown in Figure 2-5.

2-6 WBPEEUI330254B3
Unit Procedures

S TA R T

C L E A N IN G
R E AC TO R

ADD
B OR C

B R IN E O N
JAC K E T

RAM P
T E M P E R ATU R E

ADD
B OR C

ADD D

DUMP
PRO DUCT

DONE

T0324 4A

Figure 2-4. PHASEX Batch Manager Recipe

ABORT
CLEANING REACTOR
ADD COMPONENT B TO REACTOR
ADD COMPONENT C TO REACTOR
ADD COMPONENT D TO REACTOR
RAMP TEMPERATURE OF REACTOR
PUT JACKET ON LOW TEMP BRINE
DUMP PRODUCT

Figure 2-5. PHASEX Listing of Phases

WBPEEUI330254B3 2-7
Batch Programs

Batch Programs
A batch program consists of data declaration sections (BATCH,
UNIT DATA, or both) and a set of subroutines. There are three
types of subroutines: phase, function, and monitor. Each
BSEQ and PHASEX function block will have one batch pro-
gram file associated with it. Several different batch programs,
each associated with a different BSEQ or PHASEX function
block, can reside in a single control module.
Use the editor within the Batch Data Manager to write
Batch 90 programs. If necessary, any word processor or text
editor that outputs an ASCII formatted file can be used to cre-
ate batch files. The text file is the source file. The compiler pro-
cesses the program file and checks the syntax before
generating the executable object file.

This is a general overview of these program elements (refer to


Section 4 for detailed explanations).

Batch Data Types


Batch data defines data that is available to all subroutines of a
given batch program. Examples of information of global impor-
tance are control loops, devices (pumps, valves, etc.), and
function blocks used to solve calculation or interlock prob-
lems. The advantage of batch data declaration is that the data
is permanent, defined only once, and available to all
subroutines.

There are four types of batch data:

• Function blocks.
• Active data structures (integrators, timers, ramps, etc.).
• Variables and constants.
• Monitor subroutine declarations.

Phase Subroutine
The phase subroutine is the major part of a batch program. It
is responsible for controlling the sequence of activities within a
phase.
Within a unit procedure, each operation specifies the names of
phase subroutines to be executed for that operation. Each
phase subroutine contains a parameter list for which values

2-8 WBPEEUI330254B3
Batch Programs

are specified in the unit procedure in BSEQ applications.


Phase subroutine execution may extend beyond operation
boundaries. Such multi-operation phases (superphase) are
specified within the Batch Data Manager unit recipe editor.
When an operation containing a single phase completes the
phase logic, control passes to the next operation. The same
phase subroutine may be called by different operations, or
called multiple times by an operation. Figure 2-6 shows the
structure of a phase subroutine.

PHASE SUBR name (HEADING section)


[Phase comment] (HEADING section)
Parameter list (HEADING section)
DECLARATIONS
Local data and monitor subroutine calls
CONTINUOUS
Executable statement
NORMAL LOGIC
Executable statements
FAULT LOGIC
Executable statements
HOLD LOGIC
Executable statements
RESTART LOGIC
Executable statements
ENDSUBR [name]

Figure 2-6. Phase Subroutine Structure

Heading Section This section defines the phase subroutine name, parameter
list, and optional phase comment. The name allows the unit
procedure to address a phase subroutine by a meaningful title
such as ADD_A. The parameter list defines the parameter
names, data types, (optional) default values, and allowable
selections for the formulation data passed from the unit
recipe.
Declarations Section The declarations section defines the data structures that are
local to the phase subroutine and calls made to local monitor
subroutines. Local data typically is timers, integrators, ramps,
variables, etc. Local data can only be used by the phase
subroutine that declared it. Also, this data is temporary; it is
only valid while the phase subroutine is active. Local data
divides into three types:

• Variables.

WBPEEUI330254B3 2-9
Batch Programs

• Constants.
• Active data structures.

Phase subroutines have access to all global data (including


function blocks) declared in any batch or unit data section of
the batch program that comes before the phase subroutine. No
additional declaration is necessary or allowed inside the phase
subroutine.

It is recommended that phase logic be written to rely on local


declarations as much as possible when designing phases for
PHASEX programs. Also minimize the use of global data.
These practices will help assure that phase logic remains inde-
pendent from other phases.
Continuous Section The entire continuous section executes every function block
cycle in parallel with the sequential logic (NORMAL, HOLD,
FAULT, RESTART). It is ideal for defining interlock logic that
must be performed continuously and is specific to the phase
subroutine. The continuous section prohibits commands that
can result in a wait condition. Examples of prohibited com-
mands are REPEAT, WAIT, WAIT UNTIL, etc.
Normal Logic Normal logic is an executable section that performs the nor-
mal, sequential logic of a recipe phase within an operation of a
unit procedure. It begins when the phase subroutine starts. It
remains in operation until:

1. The last statement of the normal logic executes. The phase


subroutine has ended and control passes to the next phase
subroutine called for by the unit procedure. This is true for all
operations except for the special case of executed stop or
abort.

2. The execution of the active phase subroutine logic section


changes from NORMAL to FAULT or HOLD. The active logic
section typically changes to FAULT by some interlock failure
detected by the continuous section or a monitor subroutine.
The operator action of STOP also places the PHASEX logic in
the fault logic section of the program. Typically, an operator
action is required to place a phase subroutine into HOLD logic.
3. The execution of a NEXT OPERATION statement causes
the current phase subroutine to become inactive. Also, the
next phase subroutine called for by the unit procedure
becomes active.

2 - 10 WBPEEUI330254B3
Batch Programs

4. The execution of a DONE statement forces the program


execution to batch complete state. This statement is not per-
mitted in PHASEX programs.
Fault Logic Fault logic is the section that executes user defined statements
when a fault condition occurs. When a fault occurs in the nor-
mal logic, continuous logic or a monitor subroutine, execution
of normal logic suspends and control passes to the fault logic.
In a PHASEX program, fault logic is also invoked by selecting
STOP from the recipe or PHASEX faceplate. In the fault logic
the executable commands necessary to hold or stop the batch
safely must be defined while solving the problem. Once the
fault logic completes, the sequence goes into the held state for
BSEQ programs or the stopped state for PHASEX programs.
Hold Logic The purpose of hold logic is to allow execution of safety shut-
downs when the batch sequence is placed into hold. Control
transfers from normal logic to this section when the Run/Hold
input to the BSEQ function block toggles to hold. The PHASEX
program transfers from normal logic to hold logic when a
HOLD command is received by the PHASEX function block.
Restart Logic Restart logic performs a restart of a batch sequence placed
into the held or stopped state either through a fault or hold
command. Restart logic executes before normal logic and its
purpose is to return the batch unit to a state where normal
logic can continue operation.

NOTE: Refer to Appendix B for phase subroutine execution details of BSEQ


and PHASEX function codes.

Function Subroutine
The function subroutine allows the definition of commonly
used logic. This subroutine is then used as often as needed.
This aids in reducing the program size. A function subroutine
may be called from a phase, monitor, or other function sub-
routine. A function subroutine takes control from the caller,
executes to completion and then returns control to the caller.
Figure 2-7 shows the function subroutine structure.

WBPEEUI330254B3 2 - 11
Batch Programs

FUNCTION name (HEADING section)


Parameter list (HEADING section)
DECLARATIONS
Local data
EXECUTABLE
Executable statements
ENDSUBR [name]

Figure 2-7. Function Subroutine Structure

Heading Section This section defines the function name and parameter list.
Declarations Section Local data refers to data used solely within the subroutine.
This data is valid only while the subroutine is active. Only
variables and constants can be declared local to a function
subroutine.
Executable Section Execution starts with the first statement of the executable sec-
tion and continues until a RETURN or ENDSUBR statement
executes. Then, control transfers back to the caller.

Monitor Subroutine
Monitor subroutines execute continuous logic that the user
can stop and start when desired. Once defined, monitor sub-
routines can be called by multiple phase subroutines.
Executed continuously at the function block cycle, monitor
subroutines operate in parallel with normal logic according to
the state transition diagram in Appendix B. Refer to Figure 2-8
for the monitor subroutine structure.

MONITOR name (HEADING section)


Parameter List (HEADING section)
DECLARATIONS
Local Data
CONTINUOUS
Executable Statements
ENDSUBR [name]

Figure 2-8. Monitor Subroutine Structure

The monitor subroutine components are very similar to those


of the function subroutine. Monitor subroutines can be
declared either locally (in phase subroutines) or in a batch

2 - 12 WBPEEUI330254B3
Batch Program Construction

data section. When declared locally they can be referenced


only in the active phase subroutine that declared the monitor
subroutine.

When declared in a batch data section, the monitor subroutine


can be referenced by any phase subroutine that follows the
declaration. Once started, a monitor subroutine will continue
to execute until stopped or until the batch is complete (BSEQ)
or released (PHASEX). It will even run if the sequence is held
or stopped.

NOTE: A monitor subroutine cannot start itself.


Heading Section This section defines the monitor subroutine name and param-
eter list. The list defines the local parameter aliases (names
used solely in the monitor subroutine).
Declarations Section Local data refers to data used solely within the subroutine.
This data is valid only while the subroutine is active. Only vari-
ables and constants can be declared local to a monitor
subroutine.
Continuous Section The monitor subroutine has only a continuous logic section.
Continuous logic executes every function block cycle. A moni-
tor subroutine may not contain any statements that can result
in a wait condition (for example, REPEAT, WAIT UNTIL, etc.).

Batch Program Construction


This section illustrates how to construct a batch program
through an example. This example will show how to:

• Create data sections (batch, unit, or both).


• Create monitor subroutines.
• Create function subroutines.
• Create phase subroutines.

The batch process has several devices, control loops and


alarms associated with it. These processes must be defined as
function blocks (normally with the engineering workstation).
Then, add the function blocks to the program with batch dec-
laration statements. The example declares two constants and
27 function blocks (with associated control module addresses).

WBPEEUI330254B3 2 - 13
Batch Program Construction

The block command identifies a configurable name that is


assigned to a function block (for example, FV501) and function
block type (for example, FC = DD meaning device driver).

Any function code can be declared and its value read by the
batch program. For certain types of function codes (device
drivers, multistate device drivers, control stations, remote con-
trol memories and remote manual set constants, etc.) addi-
tional attributes are available. Reference extensions identify
the attributes. Reference extensions give the batch language
the ability to read or command attributes of these function
blocks. For example, with a control station, the command
CSNAME.SP allows the batch language to reference or change
the set point of the declared control station called CSNAME. A
detailed explanation of the reference extensions is in Section 4
of this document. Refer to Figure 2-9 for a batch data example.

It is possible to declare function blocks in the batch data sec-


tion that do not exist in the module. Similarly, it is possible to
declare function blocks incorrectly (for example, assign wrong
function code numbers). The Batch 90 compiler does not
check for these types of errors. Before the batch sequence
function block goes into run mode, it will check to make sure
that all function block declarations are correct. If not, the
batch sequence block generates a fault (fault code -16).

Figure 2-10 is an example of how to configure device drivers


and control loops using an engineering workstation.

Monitor Subroutine Definitions


The batch process example has several levels of device inter-
locking. They are:

• Basic device interlocking.


• Reactor protection interlocking.

Basic Device Interlocking


The control system must monitor all the valves associated with
inlet reactant feed valves (FV501, FV502, FV503, and FV504)
and the discharge valves (FV508 and FV509). These devices
must be interlocked constantly and, in case of failure, a safety
shutdown must be executed. Figure 2-11 is the configuration
for this interlock. The purpose of the FAULT statement is to
suspend the normal logic of the phase subroutine and start

2 - 14 WBPEEUI330254B3
Batch Program Construction

BATCH DATA
CONST EXPIRED = 1
CONST NOT_OPEN = 0
CONST B = 1
CONST C = 2
BLOCK FV501, BLK = 100, FC = DD
BLOCK FV502, BLK = 102, FC = DD
BLOCK FV503, BLK = 104, FC = DD
BLOCK FV504, BLK = 106, FC = DD
BLOCK FV505, BLK = 108, FC = DD
BLOCK FV506, BLK = 110, FC = DD
BLOCK FV507, BLK = 112, FC = DD
BLOCK FV508, BLK = 114, FC = DD
BLOCK FV509, BLK = 116, FC = DD
BLOCK FV510, BLK = 118, FC = DD
BLOCK FV511, BLK = 120, FC = DD
BLOCK FV512, BLK = 122, FC = DD
BLOCK FC503, BLK = 130, FC = DD
BLOCK TC501A, BLK = 142, FC = CS
BLOCK TC501B, BLK = 150, FC = CS
BLOCK CIS, BLK = 200, FC = 79, OUT (0) = LT502, OUT (1) = FT503
BLOCK P1, BLK = 210, FC = DD
BLOCK AG1, BLK = 212, FC = DD
BLOCK START PB, BLK = 300, FC = RCM
BLOCK PHASE NUMBER, BLK = 320, FC = REMSET
BLOCK BUFFER, BLK = 330, FC = BBUF, OUT (0) = B00, OUT (1) = B01, OUT (2) = B02, \
OUT (3) = B03
BLOCK TEXT_LINE_1, BLK = 500, FC = TEXT
BLOCK TEXT_LINE_2, BLK = 510, FC = TEXT
BLOCK TEXT_LINE_3, BLK = 520, FC = TEXT
BLOCK TEXT_LINE_4, BLK = 530, FC = TEXT
BLOCK TEXT_LINE_5, BLK = 540, FC = TEXT
BLOCK OPER_MSG, BLK = 600, FC = DATAEXPT
DD ARRAY INLET_VALVE (1:2) (FV502, FV503)
END DATA

Figure 2-9. Batch Data Section

the fault logic. The numerical value after the FAULT statement
allows the passing of a variable to the fault logic. This allows
the identification of the specific fault. Although the figure
shows a different fault number for each fault statement, it is
not required that each fault number be unique.

In PHASEX programs where global monitors contain state-


ments, the PHASEX program transfers to normal logic section
of the abort phase. This allows the identification of a specific
fault in the abort phase. This functionality should be reserved
for unit fault conditions or safety shutdowns. Phase specific

WBPEEUI330254B3 2 - 15
Batch Program Construction

E X A M P LE F U N C T IO N B LO C K C O N F IG U R AT IO N FO R D E V IC E D R IV E R B LO C K

Z S -50 1A D D R IV E
S1 (123 ) F V 501
CI O
S2 100
FB1 ST
S3 101
FB2
S5
Z S -50 1B OP
S6
OS

T H IS PA R TIC U LA R E X A M P L E IS FO R F V 5 01

E X A M P LE F U N C T IO N B LO C K C O N F IG U R ATIO N F O R C O N T R O L LO O P

M /A
M F C /P
S1 (80)
PV SP
P ID S2 143 T C V-501 A
SP O
S1 (19) S3 142
SP A A
T T-50 1 S2 141 S4 144
PV TR C /R
S3 S5 146
TR TS C
S4 S 18 145
TS MI C -F
S 19 147
AX
S 20
C /R
S 21
LX
S 22
CX
S 24
HAA
S 25
LA A
S 26
H DA
S 27
LDA
S 28
AO
S 29
TR S 2
S 30
TR P V T

N OT E : Z S -5 0 1A A N D 50 1 B A R E T H E VA LV E L IM IT S W ITC H E S. T H E O U T P U T
O F T H E D E V IC E D R IV E R (L A B E L E D F V 50 1 ) G O E S TO TH E I/O D R AW IN G . T 0 3 05 9A

Figure 2-10. Function Block Configuration

faults in PHASEX programs should be detected in local moni-


tors or continuous logic of the phase.

2 - 16 WBPEEUI330254B3
Batch Program Construction

MONITOR BASIC_INTERLOCKING
CONTINUOUS
IF (FV501.STS = BAD) FAULT 1
IF (FV502.STS = BAD) FAULT 2
IF (FV503.STS = BAD) FAULT 3
IF (FV504.STS = BAD) FAULT 4
IF (FV510.STS = BAD) FAULT 5
IF (FV508.STS = BAD) FAULT 6
IF (FV509.STS = BAD) FAULT 7
ENDSUBR BASIC_INTERLOCKING

Figure 2-11. Monitor Subroutine for Basic Device Interlocking

Reactor Protection Interlock


During the addition of component D, there is an exothermic
reaction. Due to the possibility of a runaway reactor during the
addition of component D, the cooling system must be moni-
tored to assure that all components are operating correctly. In
addition, the temperature is also monitored. If either the cool-
ing system malfunctions or the temperature rises above a cer-
tain level, then an emergency shutdown must be executed. The
cooling system consists of transmitter TT501, pump P1, and
valves FV505, FV506, FV511, and FV512. This monitor activ-
ity is only valid during those phase subroutines in which com-
ponent D is added. Figure 2-12 shows the programming for the
monitor subroutine providing reactor protection interlocking.

MONITOR REACTOR_PROTECTION
ANY TEMPERATURE
DECLARATIONS
VAR X
CONTINUOUS
IF (FV505.STS = BAD) FAULT 8
IF (FV506.STS = BAD) FAULT 9
IF (FV511.STS = BAD) FAULT 10
IF (FV512.STS = BAD) FAULT 11
IF (P1.STS = BAD) FAULT 12
X = TEMPERATURE + 5
IF (X > TC501A.PV) FAULT 13
ENDSUBR REACTOR_PROTECTION

Figure 2-12. Monitor Subroutine for Reactor Protection Interlocking

WBPEEUI330254B3 2 - 17
Batch Program Construction

Function Subroutine Definitions


The devices in the batch sequence example can be either in
manual or automatic mode. In manual mode, the operator has
taken control. In automatic mode, the batch logic can control
the devices. It is often necessary to put the devices into auto-
matic. It is best to create a function subroutine to do this.
Refer to Figure 2-13 for an example.

Phase Subroutine Definitions


This process has several processes that need to be defined.
They are:

• Cleaning the reactor.


• Adding component B.
• Adding component C.
• Adding component D.
• Ramping the reactor temperature.
• Filling reactor jacket with low temperature brine.
• Dumping the product.

CLEANING_REACTOR Phase
This phase subroutine opens the feed valve to component A
(cleaning solvent), starts the agitator, and waits for five min-
utes. When the five minutes are over, the feed valve shuts and
the dump valve to solvent recovery (valve FV508) opens. A 10
minute allowance provides time to empty the reactor.

The only interlocking needed is the basic device interlocking


performed by the monitor subroutine BASIC_INTERLOCKING.
In case of failure, all valves shut and the program informs the
operator. There is no need to have restart logic for this phase
subroutine. Refer to Figure 2-11 for monitor subroutine
details.

Any text between an open and closed bracket (characters { }) is


strictly a comment. The batch compiler includes comments in
its reference listing, but they are ignored for all other pur-
poses. Refer to Figure 2-14 for an example of a phase subrou-
tine for cleaning the reactor.

2 - 18 WBPEEUI330254B3
Batch Program Construction

FUNCTION INITIALIZE_VALVES
EXECUTABLE
SET FV501.MODE = AUTO
SET FV502.MODE = AUTO
SET FV503.MODE = AUTO
SET FV504.MODE = AUTO
SET FV505.MODE = AUTO
SET FV506.MODE = AUTO
SET FV507.MODE = AUTO
SET FV508.MODE = AUTO
SET FV509.MODE = AUTO
SET FV510.MODE = AUTO
SET FV511.MODE = AUTO
SET FV512.MODE = AUTO
SET FV501.MODE = AUTO
SET P1.MODE = AUTO
SET AG1.MODE = AUTO
ENDSUBR INITIALIZE_VALVES

Figure 2-13. Example Device Mode Change Function Subroutine

ADD_B_OR_C Phase Subroutine


For the example batch process shown in Figure 2-1, it can be
concluded that the phase logic required to add components B
and C is identical. The only change is the inlet valve to be
operated. Only one phase subroutine needs to be written.
Which inlet valve to be operated and thereby which component
to be added (B or C), is specified by the IN_VALVE parameter
located in a device driver array. The allowable selections for
the IN_VALVE parameter are specified by the selection list (“=
(B, C)”). The IN_VALVE parameter is passed to the device driver
array INLET_VALVE to select the valve used by the phase logic.
Thus the unit recipe will specify the following:
The selected component is added to the reactor by opening the
valve specified by the recipe and integrating the flow. When the
integrated value (FIQ.VAL) is equal to or greater than the
CHARGE_AMOUNT value, the inlet valve is closed.

This phase subroutine adds component B or C to the reactor


by opening valve FV502 or FV503, integrating the flow and
comparing it to the amount called for by the unit procedure.
When the integrated value is equal to or greater than the
amount called for, valve FV502 or FV503 closes.

The basic interlocking monitor subroutine performs the inter-


locking on this phase subroutine. In declaring the monitor

WBPEEUI330254B3 2 - 19
Batch Program Construction

PHASE SUBR CLEANING_REACTOR


DECLARATIONS
TIMER TIMER1 (SEC)
MONITOR BASIC_INTERLOCKING STOPPED
NORMAL LOGIC
START BASIC_INTERLOCKING
CALL INITIALIZE_VALVES
SET AG1.CO = ON
SET FV501.CO = OPEN
START TIMER1 300 {SET FOR 300 SEC}
WAIT UNTIL (TIMER1.ALM = EXPIRED)
SET FV501.CO = CLOSED
SET FV508.CO = OPEN
RESET TIMER1 (0)
START TIMER1 600
WAIT UNTIL (TIMER1.ALM = EXPIRED)
SET FV508.CO = CLOSED
SET AG1.CO = OFF
FAULT LOGIC
CALL INITIALIZE_VALVES
SET FV501.CO = CLOSED
SET FV508.CO = CLOSED
{THIS SHUTS FEED TO THE REACTOR AND CLOSES VALVE TO
SOLVENT RECOVERY}
ENDSUBR CLEANING_REACTOR

Figure 2-14. Cleaning Reactor Phase Subroutine

IN_VALVE Determines the component to add.


CHARGE_AMOUNT Determines the amount of compo-
nent to add.
DEFAULT_TIME Determines the maximum time
allowed to add the component.

subroutine, it is running unless the declaration specifies it


stopped. Therefore, it is unnecessary to start the monitor in
either the normal or continuous logic. Additionally, there is a
test quality check on the flow signal to insure a good four to
20-milliamps signal. There is also a default time. This means
the phase subroutine can be active only so much time before
generating a fault. Refer to Figure 2-15 for an example of the
phase subroutine for adding component B or C.

One other operation that needs to be controlled is the agitator.


If the level in the tank is greater than 100 gallons or the trans-
mitter tests bad, the agitator starts.

2 - 20 WBPEEUI330254B3
Batch Program Construction

PHASE SUBR ADD_B_OR_C


{THIS PHASE WILL CHARGE THE REACTOR WITH EITHER COMPONENT B OR C. THE COMPONENT
SELECTION IS MADE BY THE INLET_VALVE PARAMETER (1 = B, 2 = C).
“CHARGE_AMOUNT” SPECIFIES THE AMOUNT TO BE CHARGED.}
ANY IN_VALVE = (B, C)
ANY CHARGE_AMOUNT
ANY DEFAULT_TIME
DECLARATIONS
MONITOR BASIC_INTERLOCKING
TIMER TIMER1 (SEC)
INTEGRATOR FIQB (FT503.VAL, MIN)
CONTINUOUS
IF (FT503.Q = BAD) FAULT 1
START TIMER1 DEFAULT_TIME
IF (TIMER1.ALM = EXPIRED) FAULT 2
IF (LT502.Q = BAD OR LT502.VAL > 100) SET AG1.CO = ON
NORMAL LOGIC
CALL INITIALIZE_VALVES
SET INLET_VALVE(IN_VALVE).CO = OPEN
START FIQB
WAIT UNTIL (FIQB.VAL >= CHARGE_AMOUNT)
SET INLET_VALVE(IN_VALVE).CO = CLOSED
FAULT LOGIC
CALL INITIALIZE_VALVES
SET INLET_VALVE(IN_VALVE).CO = CLOSED
IF (FAULT CODE = 1) DISPLAY MESSAGE 1 COLOR RED USING TEXT_LINE_1
IF (FAULT CODE = 2) SET OPER_MSG.OSTR = “DEFAULT TIME ELAPSED”
HOLD LOGIC
CALL INITIALIZE_VALVES
SET INLET_VALVE(IN_VALVE).CO = CLOSED
ENDSUBR ADD_B_OR_C

Figure 2-15. Add Component B or C Phase Subroutine

Three items pass from the unit procedure. These are given the
type ANY, indicating numeric formulation values. Other types
(such as DD for device drivers) can be passed from the unit
procedure to the phase subroutine of BSEQ Batch 90
programs.

ADD_D Phase Subroutine


This phase subroutine is also similar to phase subroutine
ADD_B_OR_C with the following exceptions: addition of com-
ponent D is very exothermic. Therefore, the reactor protection
monitor subroutine must be running. If the operator puts the
reactor into hold, there must be hold logic to freeze the reactor
(stop the reaction and put it into a safe state). There must be

WBPEEUI330254B3 2 - 21
Batch Program Construction

sufficient restart logic to allow the reactor's cooling jacket to


switch to water and for the temperature to recover near set
point before progressing.

The temperature controller set point is set to the value passed


from the unit recipe. When the temperature set point is within
one degree of the process variable, the phase subroutine ends.

Finally, there is a cook time specified in the unit recipe. Con-


trol must remain in this phase subroutine for a long enough
period to complete the reaction. Figure 2-16 shows the logic for
phase subroutine ADD_D.

Ramp Temperature of Reactor Phase Subroutine


This phase subroutine ramps the reactor temperature from
one unit recipe parameter value to another. This phase sub-
routine runs during the exothermic part of the reaction (the
reactor protection monitor subroutine must be used). Refer to
Figure 2-17 for an example of the phase subroutine that
ramps the reactor temperature.

BRINE_ON_JACKET Phase Subroutine


The jacket coolant switches from cooling water to low tempera-
ture brine. The jacket flushes with brine and then the brine
return opens. The purpose of this is to prevent dilution of the
brine system with water. Should there be a failure of the valves
during this phase subroutine, the reactor freezes; the low tem-
perature brine goes on and stays on. Refer to Figure 2-18 for
the phase subroutine BRINE_ON_JACKET logic.

DUMP_PRODUCT Phase Subroutine


This phase subroutine opens the product discharge valve and
allows material to go to the product header. After the level in
the tank drops below 100 gallons, the tank flushes for five
minutes with solvent. This material goes to the product header
as well. If there is a fault during this phase subroutine, all
valves shut and the operator receives alarms. Refer to
Figure 2-19 for an example of a phase subroutine that dumps
the product.

2 - 22 WBPEEUI330254B3
Batch Program Construction

PHASE SUBR ADD_D


ANY TOTAL_FLOW_D
ANY COOK_TIME
ANY DEFAULT_TIME
ANY REACTOR_TEMP
DECLARATIONS
VAR X
MONITOR BASIC_INTERLOCKING
MONITOR REACTOR_PROTECTION (REACTOR_TEMP)
TIMER TIMER1 (SEC)
TIMER TIMER2 (SEC)
TIMER TIMER3 (SEC)
INTEGRATOR FIQD (FT503.VAL, MIN)
CONTINUOUS
IF (FT503.Q = BAD) FAULT 1
START TIMER1 DEFAULT_TIME
IF (TIMER1.ALM = EXPIRED) FAULT 2
IF (LT502.Q = BAD OR LT502.VAL => 100) SET AG1.CO = ON
NORMAL LOGIC
CALL INITIALIZE_VALVES
START TIMER3 COOK_TIME
SET FV506.CO = CLOSED
SET FV511.CO = CLOSED
SET FV505.CO = OPEN
SET FV512.CO = OPEN
SET P1.MODE = AUTO
SET P1.CO = ON
SET TC501B.MODE = MANUAL
SET TC501A.SP = REACTOR TEMP
SET TC501A.MODE = AUTO
REPEAT
X = ABS (TC501A.PV - TC501A.SP)
UNTIL X > 1
SET FV504.CO = OPEN
START FIQD
WAIT UNTIL (FIQD.VAL => TOTAL_FLOW_D)
SET FV504.CO = CLOSED
WAIT UNTIL (TIMER3.ALM = EXPIRED)
FAULT LOGIC
CALL INITIALIZE_VALVES
SET FV504.CO = CLOSED
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501A.SP = -20
SET TC501A.MODE = AUTO
START TIMER2 300
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED

Figure 2-16. Add Component D Phase Subroutine

WBPEEUI330254B3 2 - 23
Batch Sequence Function Code

HOLD LOGIC
CALL INITIALIZE_VALVES
SET FV504.CO = CLOSED
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501B.SP = -20
SET TC501B.MODE = AUTO
START TIMER2 100
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
RESTART LOGIC
SET FV506.CO = CLOSED
SET FV505.CO = CLOSED
SET FV511.CO = CLOSED
SET FV512.CO = CLOSED
ENDSUBR ADD_D

Figure 2-16. Add Component D Phase Subroutine (continued)

Batch Sequence Function Code


Batch 90 language programs need to be linked to operator
consoles using standard exception reporting function blocks.
The BSEQ function code (FC 148) has inputs and outputs
designated to interface with existing function blocks that gen-
erate exception reports. Refer to the Function Code Applica-
tion Manual for detailed information about the batch
sequence function code. A properly configured BSEQ function
block allows:

• The running or holding of the batch program execution.

• Executed stopping of the batch program.

• Resetting the batch program from a previous unit recipe to


a new unit recipe when a previous batch sequence aborts
abnormally.

• Acknowledgment of messages.
• Changing an operation number within a unit recipe.

• Changing a unit recipe number when a batch program


completes or is in holding.

2 - 24 WBPEEUI330254B3
Batch Sequence Function Code

PHASE SUBR RAMP_TEMPERATURE


ANY RATE1
ANY DEFAULT_TIME
ANY INITIAL_TEMP
ANY FINAL_TEMP
DECLARATIONS
MONITOR BASIC_INTERLOCKING
MONITOR REACTOR_PROTECTION (FINAL_TEMP)
TIMER TIMER1 (SEC)
TIMER TIMER2 (SEC)
RAMP RAMP1 (TC501A.SP, SEC)
CONTINUOUS
START BASIC_INTERLOCKING
START REACTOR_PROTECTION
START TIMER1 DEFAULT_TIME
IF (TIMER1.ALM = EXPIRED) FAULT 1
IF (LT502.Q = BAD OR LT502.VAL => 100) SET AG1.CO = ON
NORMAL LOGIC
START RAMP1 FROM INITIAL_TEMP TO FINAL_TEMP AT RATE1
START TIMER2 300
WAIT UNTIL (TIMER2.ALM = EXPIRED)
FAULT LOGIC
CALL INITIALIZE_VALVES
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501B.MODE = MANUAL
SET TC501B.CO = 0
SET TC501A.SP = -20
SET TC501A.MODE = AUTO
START TIMER2 300
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
HOLD LOGIC
CALL INITIALIZE_VALVES
SET FV504.CO = CLOSED
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501B.MODE = MANUAL
SET TC501B.CO = 0
SET TC501A.SP = -20
SET TC501A.MODE = AUTO
START TIMER2 100
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
ENDSUBR RAMP_TEMPERATURE

Figure 2-17. Ramp Reactor Temperature Phase Subroutine

WBPEEUI330254B3 2 - 25
Batch Sequence Function Code

PHASE SUBR BRINE_ON_JACKET


ANY REACTOR_TEMP
DECLARATIONS
MONITOR BASIC_INTERLOCKING RUNNING
TIMER TIMER2 (SEC)
NORMAL LOGIC
CALL INITIALIZE_VALVES
SET TC501B.MODE = MANUAL
SET TC501B.CO = 0
SET TC501A.SP = REACTOR_TEMP
SET TC501A.MODE = AUTO
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
WAIT FOR 100 SEC
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
FAULT LOGIC
CALL INITIALIZE_VALVES
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501B.MODE = MANUAL
SET TC501B.CO = 0
SET TC501A.SP = -20
SET TC501A.MODE = AUTO
START TIMER2 300
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
HOLD LOGIC
CALL INITIALIZE_VALVES
SET FV504.CO = CLOSED
SET FV506.CO = OPEN
SET FV505.CO = CLOSED
SET TC501A.SP = -20
SET TC501A.MODE = AUTO
START TIMER2 100
WAIT UNTIL (TIMER2.ALM = EXPIRED)
SET FV511.CO = OPEN
SET FV512.CO = CLOSED
ENDSUBR BRINE_ON_JACKET

Figure 2-18. Put Jacket on Low Temperature Brine Phase Subroutine

Figure 2-20 shows the simplest configuration of a batch


sequence function block interfaced with a remote manual set
constant (RMSC) and remote control memory (RCM) function
blocks. The remote manual set constants hold the values of
the unit recipe and operation number. When the batch pro-
gram is running, the remote manual set constant function

2 - 26 WBPEEUI330254B3
Batch Sequence Function Code

PHASE SUBR DUMP_PRODUCT


DECLARATIONS
MONITOR BASIC_INTERLOCKING RUNNING
TIMER TIMER1 (SEC)
NORMAL LOGIC
CALL INITIALIZE_VALVES
SET FV509.CO = OPEN
WAIT UNTIL (LT502.VAL = 100)
START TIMER1 300
SET FV501.CO = OPEN
WAIT UNTIL (TIMER1.ALM = EXPIRED)
SET FV501.CO = CLOSED
WAIT FOR 100 SEC
SET FV509.CO = CLOSED
DONE
FAULT LOGIC
CALL INITIALIZE_VALVES
SET FV501.CO = CLOSED
SET FV503.CO = OPEN
DISPLAY MESSAGE 25 COLOR RED BLINKING ON USING TEXT_LINE_4
CALL INITIALIZE_VALVES
HOLD LOGIC
CALL INITIALIZE_VALVES
SET FV501.CO = CLOSED
SET FV509.CO = OPEN
DISPLAY MESSAGE 25 COLOR RED BLINKING ON USING TEXT_LINE_4
ENDSUBR DUMP_PRODUCT

Figure 2-19. Dump Product Phase Subroutine

blocks track the current unit recipe and operation number


being executed. This allows the operator to determine what the
current unit recipe and operation number are. The unit recipe
and operation number can not be changed while the program
is executing.

NOTE: Using the function code logic in Figure 2-20, the operation number will
increment to (last operation + 1) as defined by the unit recipe. To restart the
batch, select the starting operation number and cycle the run/hold pushbutton
to run. Failure to select the starting operation causes a -15 run-time fault code
or the unintentional starting of a new recipe.

If the sequence stops executing, the track signals stop. At this


point the operator can change the unit recipe and operation
number using the remote manual set constant function
blocks.

WBPEEUI330254B3 2 - 27
Phase Execution Function Code

S5 B S EQ
(6 8) R E C IPE S1 (1 48 )
S6 R E M SE T R# R#
330
31 0 S2 PH# PH#
S3 331
RU N RU N
S4 332
AC K F LT
S5 333
S5 ESP H
(6 8) P H AS E S6 334
S6 R E M SE T DB BC
335
315 S7 N /A R
336
FC
337
CS#
338
S1 RCM (6 2) RU N /H O L D PB
S S1 = 31 0
S2 32 0 S2 = 31 5
P
S1 (3 3 ) S1 (3 5) S3 S3 = 32 0
NOT T D -D IG R
S4 = 0
300 30 5 S4 O S5 = 32 5
S5 I S6 = 0
1 S EC O N D PU LS E S6 S7 = 0
F
S7 S8 = 0.0
A
S9 = 1
S 10 = 1
S 11 = 10
S1
RCM (6 2) E -S TO P S 12 = 25 6
S S 13 = 0
S2 32 5
P S 14 = 0
S3 R
S4 O
S5 I
S6 F
S7 A

S1 RCM (6 2) AC K N OW L E D G E
S
S2 32 6
P
S3
R
S4
O
S5
I
S6
F
S7
A

T 01 8 26 A

Figure 2-20. Batch Sequence Interface Logic

The program can stop executing in two ways. The first way is
for the operator to hold the program execution. The second
way is for fault logic within the program to cause the stop.

Refer to Appendix A for a more detailed control logic


configuration.

Phase Execution Function Code


Batch 90 language programs are linked to operator worksta-
tions using the standard exception reports generated by the

2 - 28 WBPEEUI330254B3
Phase Execution Function Code

PHASEX function code (FC 218). Refer to the Function Code


Application Manual for detailed information. A properly con-
figured PHASEX function block allows:

• The running, holding, or stopping of the batch program


execution.

• Aborting of the batch program.

• Acknowledgment of messages.

• Activating a new version of the batch program (with the ini-


tialize command) within an active batch when all the
linked PHASEX function blocks are held, stopped, aborted,
complete, or idle and the program is active.

Figure 2-21 shows the simplest configuration of a PHASEX


function block. Refer to Appendix A for a more detailed CAD
configuration of linked PHASEX function blocks. Since the
PHASEX function block is used in conjunction with the Batch
Manager application, the commands to change state are
issued by the operator (Appendix B) and the reporting of cur-
rent status is contained in the exception report data.

PHASEX
S1 LEAD
(2 1 8)
N O T C O N N E C T E D IF L E A D B LO C K S TAT E
S2 PHASE 4 0 10
S PA R E ID
S3 4 0 11
S PA R E F LT
CO DE 4 0 12
S4
S PA R E A B O R T
S5 4 0 13
IN T E R LO C K F R O M A B O RT AQ RD
S TAT 4 0 14
F U N C T IO N B L O C K L O G IC S PA R E
4 0 15
S PA R E
4 0 16
S PA R E
4 0 17
S9 = 1 - P R O G R A M ID
S10 = 1 - DEBUG
S11 = 1 0 - R A M A LL O C AT IO N F O R P R O G R A M O B JE C T (K B )
S12 = 1 00 0 - R A M A LL O C AT IO N F O R P H A S E D ATA (B Y T E S )

T 0 3 24 5 A

Figure 2-21. PHASEX Configuration

WBPEEUI330254B3 2 - 29
WBPEEUI330254B3
User Defined Function (UDF) Section 3
Description
Introduction
This section describes what a UDF program is, what it does,
and how it functions like a function code.

UDF Programs
A UDF program is a plan for executing a sequence of activities.
The program consists of a data section and a set of subrou-
tines. There are three types of subroutines: state subroutine,
function subroutine, and monitor subroutine. Each UDF dec-
laration function block will have one UDF program associated
with it. Several UDF Type 1 (UDF1) and UDF Type 2 (UDF2)
function blocks can reference the same UDF declaration func-
tion block.

Use the editor within the Batch Data Manager to write UDF
programs. If necessary, any word processor that outputs an
ASCII formatted file can be used to create batch files. The text
file is the source file. The compiler processes the ASCII file and
checks the syntax before generating the executable object file.

This is a general overview of these program elements (refer to


Section 4 for detailed explanations).

Data
The data section defines the data (called global data) that is
available to all subroutines in a given UDF program. Examples
of information of global importance are control loops, devices
(pumps, valves, etc.) and function blocks used to solve calcula-
tion or interlock problems. The advantages of global data dec-
laration is that the data is permanent, defined only once, and
available to all subroutines.

There are five types of global data:

• Inputs to UDF1, UDF2, and auxiliary UDF function blocks.

• Outputs from UDF1, UDF2, and auxiliary UDF function


blocks.

WBPEEUI330254B3 3-1
UDF Programs

• Specifications of UDF1, UDF2, and auxiliary UDF function


blocks.

• Function blocks.

• Variables and constants.

State Subroutine
The state subroutine is a major part of a UDF program. Every
UDF program must have one or more state subroutines. They
are responsible for controlling the flow of execution. Figure 3-1
shows the structure of a state subroutine.

STATE SUBR name (HEADING section)


DECLARATIONS
Local data and monitor subroutine calls
CONTINUOUS
Executable statement
NORMAL LOGIC
Executable statements
FAULT LOGIC
Executable statements
ENDSUBR [name]

Figure 3-1. State Subroutine Structure

Heading Section This section defines the state subroutine name. The name
allows the program to address a state subroutine by a mean-
ingful title.
Declarations Section The declarations section defines the state subroutine local
data and specifies calls to local monitor subroutines. Local
data typically has timers, integrators, ramps, variables, etc.
Local data can only be used by the state subroutine that
declared it. Also, this data is temporary; it is only valid while
the state subroutine is active. Local data divides into three
types:

• Variables.
• Constants.
• Active data structures.

State subroutines have access to all data (including function


blocks) declared in any data section of the UDF program that

3-2 WBPEEUI330254B3
UDF Programs

comes before the state subroutine. No additional declaration is


necessary or allowed inside the state subroutine.
Continuous Section The entire continuous section executes every function block
cycle in parallel with the sequential logic (NORMAL and
FAULT). It is ideal for defining interlock logic that must be per-
formed continuously and is specific to the state subroutine.
The continuous section prohibits commands that can result in
a wait condition. Examples of prohibited commands are
REPEAT, WAIT, WAIT UNTIL, etc.
Normal Logic Normal logic is an executable section that performs the nor-
mal sequential logic of a state subroutine. It begins when the
state subroutine starts. It remains in operation until:

1. The mode of the state subroutine changes from NORMAL


to FAULT. The mode typically changes to FAULT by some
interlock failure detected by the continuous section or a moni-
tor subroutine.

2. The execution of a NEXT STATE statement causes the cur-


rent state subroutine to become inactive. The next subroutine
specified by the NEXT STATE statement becomes active.
Fault Logic Fault logic is the section that executes user defined statements
when a fault condition occurs. When a fault occurs in the nor-
mal logic, continuous logic, or a monitor subroutine, execution
of normal logic suspends and control passes to the fault logic.
In the fault logic, define the executable commands necessary
to hold or stop the sequence safely while solving the problem.

Function Subroutine
The function subroutine allows the one time definition of com-
monly used logic and the reuse of this subroutine as often as
needed. This aids in reducing the program size. A function
subroutine may be called from a state subroutine, a monitor
subroutine or another function subroutine. A function sub-
routine takes control from the caller, executes to completion,
and then returns control to the caller. Figure 3-2 shows the
function subroutine structure.
Heading Section This section defines the function name and parameter list.
Declarations Section Local data refers to data used solely within the subroutine.
This data is valid only while the subroutine is active. Only

WBPEEUI330254B3 3-3
UDF Programs

constants and variables can be declared local to a function


subroutine.

FUNCTION name (HEADING section)


Parameter list (HEADING section)
DECLARATIONS
Local data
EXECUTABLE
Executable statements
ENDSUBR [name]

Figure 3-2. Function Subroutine Structure

Executable Section Execution starts with the first statement of the executable sec-
tion and continues until a RETURN or ENDSUBR statement
executes. Then, control transfers back to the caller. If a func-
tion subroutine is called from normal logic, it can contain wait
states. Wait states will be ignored if a function subroutine is
called from a continuous section or a monitor subroutine.

Monitor Subroutines
Monitor subroutines execute interlock logic common to several
state subroutines. Once defined, monitor subroutines can be
called by multiple state subroutines. Executed continuously at
the function block cycle, monitor subroutines operate in paral-
lel with normal logic and effectively watch process interlock
conditions. Fault mode operates when the monitor subroutine
sets a fault flag. Normal logic then stops and control passes to
the fault logic. Refer to Figure 3-3 for the monitor subroutine
structure.

MONITOR name (HEADING section)


Parameter list (HEADING section)
DECLARATIONS
Local data
CONTINUOUS
Executable statements
ENDSUBR [name]

Figure 3-3. Monitor Subroutine Structure

3-4 WBPEEUI330254B3
UDF Program Execution

Heading Section This section defines the monitor subroutine name and param-
eter list. The list defines the local parameter aliases (names
used solely in the monitor subroutine).
Declarations Section Only variables, variable arrays, constants and constant arrays
can be declared in a monitor subroutine.
Continuous Section The monitor subroutine has only a continuous logic section.
Continuous logic executes every function block cycle. A moni-
tor subroutine may not contain any statements that can result
in a wait condition (for example, REPEAT, WAIT UNTIL, etc.).

UDF Program Execution


Startup of the control modules by either powering up or
changing from configure to execute mode causes the control
modules to scan for all UDF configuration blocks before nor-
mal function block execution. The control modules will then
load object files from NVRAM memory of the module into the
dynamic RAM memory defined by the configuration block. If
there is not enough memory allocated for the program to
reside in or if there is no such object file, the control module
will go into error mode. After successful loading of the UDF
files, the control module checks the UDF object file to verify all
declarations to function blocks are correct. If an error occurs,
the control module goes into error mode.
Assuming all diagnostic tests pass, normal function block exe-
cution will begin. Each UDF type one or type two function
block uses a declaration block and will contain the data values
specific to the particular function block. All UDF function
blocks can access the same UDF program but contain within
themselves unique variables, timers, etc. pertaining to their
own function block.

UDF Program Construction


This section illustrates how to construct a UDF program
through an example. This example will show how to:

• Create the data section.


• Create monitor subroutines.
• Create function subroutines.
• Create state subroutines.

WBPEEUI330254B3 3-5
UDF Program Construction

Figure 3-4 shows a diagram of a simple UDF process. The UDF


process has several devices, control loops associated with it.
These processes must be defined as function blocks (normally
with the workstation). Then, add the function blocks to the
program with data declaration statements. The example
declares five variables, five function blocks (with associated
control module addresses), and 13 UDF block inputs.

W AT E R

TA N K

LT

P U M P H S I01

EXCESS
P U M P H S I02 W AT E R

P U M P H S I03

P U M P H S I04
T03045A

Figure 3-4. UDF Process

The block command identifies a configurable name that is


assigned to a function block (for example, HS101) and function
block type (for example, FC = DD meaning device driver).
Device driver has an additional descriptor for whether it is nor-
mal (zero output closes the valves) or inverted (zero output
opens the valve). If not specified, the system will default to a
normal status on a device driver.

Any function code can be declared and its value read by the
UDF program. For certain types of function codes (device driv-
ers, multistate device drivers, control stations, remote control

3-6 WBPEEUI330254B3
UDF Program Construction

memories, remote manual set constants, etc.) additional


attributes are available. Reference extensions identify the
attributes. Reference extensions give the UDF language the
ability to read or command attributes of these functions. For
example, with a control station, the command CSNAME.SP
allows the UDF language to reference or change the set point
of the declared control station called CSNAME. A detailed
explanation of the reference extensions is in Section 4 of this
document. Refer to Figure 3-5 for a data example.

DATA
UDF TYPE2

INPUT 1 HS101_IN_SERVICE
INPUT 2 HS102_IN_SERVICE
INPUT 3 HS103_IN_SERVICE
INPUT 4 HS104_IN_SERVICE
INPUT 5 HS101_RUN_TIME
INPUT 6 HS102_RUN_TIME
INPUT 7 HS103_RUN_TIME
INPUT 8 HS104_RUN_TIME
INPUT 9 HS101_FEEDBACK
INPUT 10 HS102_FEEDBACK
INPUT 11 HS103_FEEDBACK
INPUT 12 HS104_FEEDBACK
INPUT 13 PUMPS_RUNNING

BLOCK HS101, BLK = 110, FC = DD


BLOCK HS102, BLK = 120, FC = DD
BLOCK HS103, BLK = 130, FC = DD
BLOCK HS104, BLK = 140, FC = DD
DD ARRAY PUMP (1:4) (HS101, HS102, HS103, HS104)
BLOCK TANK_LEVEL, BLK = 100, FC = CS

VAR I
VAR HIGHEST_RUN_TIME
VAR LOWEST_RUN_TIME
VAR NEXT_PUMP_TO_START
VAR NEXT_PUMP_TO_STOP
END DATA

Figure 3-5. Data Section

It is possible to declare function blocks in the data section that


do not exist in the control module. Similarly, it is possible to
declare function blocks incorrectly (for example, assign wrong
function code numbers). The UDF compiler does not check for
these types of errors. Before the UDF declaration function

WBPEEUI330254B3 3-7
UDF Program Construction

block goes into run mode, it will check to make sure that all
function block declarations are correct. If not, the control mod-
ule will go into error mode and the block address of the incor-
rect declaration is indicated by status bytes of the control
module.

Figure 3-6 is an example configuration for the level controller


and each pump. Figure 3-7 is an example UDF function block
configuration.

Monitor Subroutine Definition


It is necessary to monitor the status of the pumps in the sys-
tem. The status is used to determine which pump is to be
started next and which pump is to be stopped next based on
run-time. Figure 3-8 shows the configuration of this
subroutine.

Function Subroutine Definitions


Pumps must be started and stopped in this example program.
Function subroutines START_PUMP and STOP_PUMP perform
these pump operations. Figure 3-9 shows the function subrou-
tine that starts up a pump. Figure 3-10 shows the function
subroutine that stops a pump.

State Subroutine Definitions


This process has two activities that need to be defined. They
are:

• Initializing the pumps.


• Running the pumps.

The INITIALIZE START state subroutine puts the device driv-


ers into automatic mode and turns tracking on. This enables
the bumpless transfer between automatic and manual mode.
This subroutine also checks which pumps are running and
sets their device driver so that the control stations will follow
this field when the MFP module powers up. Refer to
Figure 3-11.
The RUN_PUMPS state subroutine has two modes. In manual
mode, the device drivers are put into manual mode and the
pumps must be operated by the operators. In automatic mode,
the device drivers are put into automatic mode and are started

3-8 WBPEEUI330254B3
UDF Program Construction

EX A M PLE P U M P F U N C TIO N BLO C K C O N F IG U R ATIO N


H S -101
D D R IV E
S1 (12 3) S TA RT P U M P 1 01
CI O
P U M P 1 01 RU N N IN G S2 10 0
FB1 ST
S3 11 1
FB2
S5
OP
S6
OS

S4 = 0
S7 = 0
S8 = 1
S9 = 10 .0
S 10 = 0

H S-101S

S1
RCM (62 ) P U M P 10 1 IN SE RVIC E
S
S2 11 2
P
S3
R
S4 0 = H S-1 0 1 N OT IN SE RVIC E
O
S5 1 = H S-1 0 1 IN S ERV IC E
I
S6 F
S7 A

S8 = 0

E TIM ER
P U M P 1 01 RU N N IN G S2 (8 6) PU M P 10 1 RU N T IM E
H V
S1 11 4
R A
11 5
S3 = 2
S4 = 10
S5 = 10
S6 = 0

E X AM P LE LEV E L C O N T RO LLER FU N C T IO N B LO C K C O N FIG U R ATIO N

M /A
M F C /P
TAN K L EV E L S1 (80 )
PV SP
S2 10 1
SP O
S3 10 0
A A
S4 10 2
TR C /R
S5 10 4
TS C
S 18 10 3
MI C -F
S 19 10 5
AX
S 20
C /R
S 21
LX
S 22
CX
S 24
H AA
S 25
LAA
S 26
H DA
S 27
LDA
S 28
AO
S 29
TR S 2
S 30
TR P V T
T030 46A

Figure 3-6. Level Controller and Pump Function Block Configurations

WBPEEUI330254B3 3-9
UDF Program Construction

P U M P 101
IN S E RV IC E

P U M P 102 (1 90)
U D FD E C N
IN S E RV IC E

P U M P 103 S1 = 1.0 S5 = 0.0


IN S E RV IC E S2 = 230 S6 = 0.0
S3 = 0.0 S7 = 0.0
S4 = 0.0 S8 = 0.0
P U M P 104
IN S E RV IC E UDF2
S1 (192 )
P U M P 101 S2 N
RU N TIM E S3 N +1
S4 N +2
P U M P 102 S5 N +3
RU N TIM E S6 N +4
S7 N +5
P U M P 103 S8 N +6
RU N TIM E S9 N +7
S10 N +8
P U M P 104 S11 N +9
RU N TIM E S12
S13
P U M P 101 S14
RU N N IN G S15
S16
P U M P 102 S17
RU N N IN G S18
S23
P U M P 103 S25
RU N N IN G
S19 = 0.0
P U M P 104 S20 = 0.0
S21 = 0.0
RU N N IN G S21 = 0.0
S1
S22 = 0.0
S2 S24 = 15 8
(65)
S3 DSUM S26 = 0.0
N
S4 S27 = 0.0
S28 = 0.0
S5 = 1.0
S6 = 1.0
S7 = 1.0
S8 = 1.0 T0 30 47 A

Figure 3-7. UDF Function Block Configuration

and stopped based on tank level. If one of the pumps fails, the
next pump is started to insure the appropriate number of
pumps are running. Refer to Figure 3-12.

3 - 10 WBPEEUI330254B3
UDF Program Construction

MONITOR PUMP_STATUS
CONTINUOUS
IF (HS101_IN_SERVICE.VAL = ON) AND (HS101.CO = OFF) THEN LOWEST_RUN_TIME = \
HS101_RUN_TIME.VAL
NEXT_PUMP_TO_START = 1
ENDIF
IF (HS102_RUN_TIME.VAL < LOWEST_RUN_TIME) AND (HS102_IN_SERVICE.VAL = ON) \
AND (HS101.CO = OFF) THEN LOWEST_RUN_TIME = HS102_RUN_TIME.VAL
NEXT_PUMP_TO_START = 2
ENDIF
IF (HS103_RUN_TIME.VAL < LOWEST_RUN_TIME) AND (HS103_IN_SERVICE.VAL = ON) \
AND (HS101.CO = OFF) THEN LOWEST_RUN_TIME = HS103_RUN_TIME.VAL
NEXT_PUMP_TO_START = 3
ENDIF
IF (HS104_RUN_TIME.VAL < LOWEST_RUN_TIME) AND (HS104_IN_SERVICE.VAL = ON) \
AND (HS101.CO = OFF) THEN LOWEST_RUN_TIME = HS104_RUN_TIME.VAL
NEXT_PUMP_TO_START = 4
ENDIF
IF (HS101.CO = ON) THEN HIGHEST_RUN_TIME = HS101_RUN_TIME.VAL
NEXT_PUMP_TO_STOP = 1
ENDIF
IF (HS102_RUN_TIME.VAL > HIGHEST_RUN_TIME) AND (HS102.CO = ON) THEN \
HIGHEST_RUN_TIME = HS102_RUN_TIME.VAL
NEXT_PUMP_TO_STOP = 2
ENDIF
IF (HS103_RUN_TIME.VAL > HIGHEST_RUN_TIME) AND (HS103.CO = ON) THEN \
HIGHEST_RUN_TIME = HS103_RUN_TIME.VAL
NEXT_PUMP_TO_STOP = 3
ENDIF
IF (HS104_RUN_TIME.VAL > HIGHEST_RUN_TIME) AND (HS104.CO = ON) THEN \
HIGHEST_RUN_TIME = HS104_RUN_TIME.VAL
NEXT_PUMP_TO_STOP = 4
ENDIF
ENDSUBR PUMP_STATUS

Figure 3-8. Monitor Subroutine for Determining Pump Status

WBPEEUI330254B3 3 - 11
UDF Program Construction

FUNCTION START_PUMP
DD PUMP
EXECUTABLE
IF (PUMP.MODE ISNOT AUTO) THEN SET PUMP.MODE = \
AUTO
SKIP CYCLE
ENDIF
SET PUMP.CO = ON
WAIT UNTIL PUMP.STS ISNOT WAITING
ENDSUBR START_PUMP

Figure 3-9. Function Subroutine to Start a Pump

FUNCTION STOP_PUMP
DD PUMP
EXECUTABLE
IF (PUMP.MODE ISNOT AUTO) THEN SET PUMP.MODE = \
AUTO
SKIP CYCLE
ENDIF
SET PUMP.CO = OFF
WAIT UNTIL PUMP.STS ISNOT WAITING
ENDSUBR STOP_PUMP

Figure 3-10. Function Subroutine to Stop a Pump

3 - 12 WBPEEUI330254B3
UDF Program Construction

STATE SUBR INITIALIZE START


N ORMAL LOGIC
SET HS101.TRK = ON
SET HS102.TRK = ON
SET HS103.TRK = ON
SET HS104.TRK = ON
SET HS101.MODE = AUTO
SET HS102.MODE = AUTO
SET HS103.MODE = AUTO
SET HS104.MODE = AUTO
IF (HS101_FEEDBACK.VAL = ON) THEN SET HS101.CO = ON
ENDIF
IF (HS102_FEEDBACK.VAL = ON) THEN SET HS102.CO = ON
ENDIF
IF (HS103_FEEDBACK.VAL = ON) THEN SET HS103.CO = ON
ENDIF
IF (HS104_FEEDBACK.VAL = ON) THEN SET HS104.CO = ON
ENDIF
NEXT STATE RUN_PUMPS
ENDSUBR INITIALIZE

Figure 3-11. State Subroutine for Initializing the Pumps

WBPEEUI330254B3 3 - 13
UDF Program Construction

STATE SUBR RUN_PUMPS


DECLARATIONS
MONITOR PUMP_STATUS RUNNING
NORMAL LOGIC
IF (TANK_LEVEL.MODE = MANUAL) THEN
FOR I = 1 TO 4 DO
SET PUMPS(I).MODE = MANUAL
ENDFOR
ELSE
FOR I = 1 TO 4 DO
SET PUMPS(I).MODE = AUTO
ENDFOR
IF ((PUMPS_RUNNING.VAL <= 1) AND (TANK_LEVEL.PV - TANK_LEVEL.SP > 1)) OR \
((PUMPS_RUNNING.VAL <= 2) AND (TANK_LEVEL.PV - TANK_LEVEL.SP > 2)) OR \
((PUMPS_RUNNING.VAL <= 3) AND (TANK_LEVEL.PV - TANK_LEVEL.SP > 3)) OR \
((PUMPS_RUNNING.VAL <= 4) AND (TANK_LEVEL.PV - TANK_LEVEL.SP > 4)) \
THEN CALL START_PUMP (PUMPS (NEXT_PUMP_TO_START))
ENDIF
IF ((PUMPS_RUNNING.VAL => 1) AND (TANK_LEVEL.PV - TANK_LEVEL.SP < 0.5)) OR \
((PUMPS_RUNNING.VAL => 2) AND (TANK_LEVEL.PV - TANK_LEVEL.SP < 1.5)) OR \
((PUMPS_RUNNING.VAL => 3) AND (TANK_LEVEL.PV - TANK_LEVEL.SP < 2.5)) OR \
((PUMPS_RUNNING.VAL => 4) AND (TANK_LEVEL.PV - TANK_LEVEL.SP < 3.5)) \
THEN CALL STOP_PUMP (PUMPS (NEXT_PUMP_TO_STOP))
ENDIF
WAIT FOR 1 MIN
ENDIF
NEXT STATE RUN_PUMPS
ENDSUBR RUN

Figure 3-12. State Subroutine for Running the Pumps

3 - 14 WBPEEUI330254B3
Function Library Section 4

Introduction
Batch 90 and User Defined Function (UDF) programming lan-
guages, like other programming languages, have certain usage
rules. These rules include the use of upper and lowercase let-
ters, punctuation, etc. This section presents general usage
information and then explains syntax rules, commands, and
statements. This section should be used to answer any ques-
tions about proper syntax.

Syntax
Syntax rules for the commands and statements consist of:

• How to use comments.

• Legal names.

• Command and statement length.

• Reserved words/constants/directives.

• Types of expressions.

• Relational, boolean, and arithmetic operators and


expressions.

• Local and global conventions.

Comments
All comments inserted in Batch 90 or UDF programs begin
with either { or/* and end with } or */. A comment can cross a
line boundary. Comments can not be nested within other
comments.
Example {This is a comment} or /*This is a comment*/

WBPEEUI330254B3 4-1
Syntax

Names
Legal characters are:

• a through z
• A through Z
• 0 through 9
• _ (underscore)
Example NAME1

In source code, case (upper/lower) is not significant. In an


application, case sensitivity can be enabled.
Batch 90 and UDF languages consider a hyphen a minus sign.
Therefore, a hyphen should never be used as a separator
between text.

First character must be alphabetic.

Maximum of 32 characters for a name except phase subrou-


tine names which are limited to 16 characters.

Lines
One statement per line is permissible. A backslash (\) any-
where in a line causes the remainder of the display line to be
ignored and the statement is continued on the next display
line.

Reserved Words/Constants/Directives
Tables 4-1, 4-2, 4-3, and 4-4 provide listings of reserved
words, predefined constants, reference extensions and direc-
tives respectively.

NOTES:
1. Table entries marked (SP88) apply only when programming in
ISA-S88.01-1995 standard terms. Table entries marked (ABB) apply only when
programming in ABB traditional terms.
2. BSQ denotes BSEQ batch programs, PHX denotes PHASEX batch pro-
grams, and UDF denotes UDF programs.

4-2 WBPEEUI330254B3
Syntax

Table 4-1. Reserved Words

Reserved Word BSQ PHX UDF Reserved Word BSQ PHX UDF
ABS X X X CONST ARRAY X X X
ACK X X CONST STRING X X X
ACQUIRE X X CONST STRING ARRAY X X X
ALIAS X X X CONTINUOUS X X X
ALPHA X X CONTINUOUS LOGIC X X X
AND X X X COS X X X
AND WAIT X CS X X X
ANY X X X CS ARRAY X X X
AOL X X X CSEQ X X X
AOL ARRAY X X X CYCLE TIME X X X
APID X X X CYCLETIME X X X
APID ARRAY X X X DATA X
ARRAY X X X DATAEXPT X X X
AT X X X DATAEXPT ARRAY X X X
AUX X DD X X X
BATCH X X DD ARRAY X X X
BATCH DATA X X DD INVERT X X X
BBUF X X X DD NORMAL X X X
BBUF ARRAY X X X DEBUG X X X
BLINKING X X X DECLARATIONS X X X
BLK X X X DESCRIPTOR X X X
BLOCK X X X DIGIT X X X
BREAK X X X DISABLE X X X
BSEQ X X X DISPLAY MESSAGE X X X
CALL X X X DO X X X
CAMPAIGN X X DO CASE X X X
CASE X X X DOL X X X
CASESENSE X X X DOL ARRAY X X X
CLASS X X DONE X
COLOR X X X EJECT X X
COMMON X ELSE X X X
CONNECT X X ENABLE X X X
CONST X X X END X X X

WBPEEUI330254B3 4-3
Syntax

Table 4-1. Reserved Words (continued)

Reserved Word BSQ PHX UDF Reserved Word BSQ PHX UDF
END CASE X X X HOUR X X X
END DATA X X X IF X X X
END FOR X X X INCLUDE X X X
END IF X X X INPUT X
END SUBR X X X INTEGRATOR X X X
END WHILE X X X INVERT X X X
ENDCASE X X X IS X X X
ENDDATA X X X IS NOT X X X
ENDFOR X X X ISNOT X X X
ENDIF X X X LAST OPERATION (SP88) X X
ENDSUBR X X X LAST PHASE (ABB) X X
ENDWHILE X X X LAST SUBR X X
ESTOP INPUT X LIST X X X
EXECUTABLE X X X LOCATION X
EXP X X X LOG X X X
EXTERNAL X X LOGIC X
EXTERNAL HOLD X X LOOP X X X
FALSE X X X LOT X X
FAULT X X X MAINTAIN X X
FAULT CODE X X X MAJOR X X X
FAULT LOGIC X X X MAJOR ID X X X
FC X X X MAJOR POINT X X X
FGEN X X X MAXPARALLEL X X
FIRST CYCLE X X X MESSAGE X X X
FOR X X X MIN X X X
FROM X X X MINE X X
FUNCTION X X X MINOR X X X
HIHI X MINOR ID X X X
HISTORIAN X MINOR POINT X X X
HISTORIAN BUFFER X MODULE X X X
HISTORIAN STATUS X MONITOR X X X
HOLD X X X MSDD X X X
HOLD LOGIC X X MSDD ARRAY X X X

4-4 WBPEEUI330254B3
Syntax

Table 4-1. Reserved Words (continued)

Reserved Word BSQ PHX UDF Reserved Word BSQ PHX UDF
NEXT OPERATION (SP88) X X RECIPEID X
NEXT PHASE (ABB) X X REMSET X X X
NEXT STATE X REMSET ARRAY X X X
NOLIST X X X REPEAT X X X
NORMAL LOGIC X X X RESERVE X X
NORMALIZE X X X RESET X X X
NOT X X X RESTART X X X
OPERATION (SP88) X X RESTART LOGIC X X
OPERATION DESCRIP- X RESTART POINT X X X
TOR (SP88)
OPTIONS X X RESUME X X X
OR X X X RESUME AT X X X
OTHER X X X RETURN X X X
OUT X X X RING X X
OUTPUT X RMC X X X
PCU X X X RMC ARRAY X X X
PHASE (ABB) X X RND X X X
PHASE DESCRIPTOR X X RUN INPUT X
(ABB)
PHASE NUMBER (SP88) X SEC X X X
PHASE SUBR (SP88) X X SEND X X
PRIORITY X X SET X X X
PROGRAM X X SIN X X X
PROGRAM DESCRIPTOR X X SIZEOF X X X
PROGRAMID X X SKIP CYCLE X X X
RAMP X X X SMITH X X X
RBUF X X X SMITH ARRAY X X X
RBUF ARRAY X X X SPEC X
RCM X X X START X X X
RCM ARRAY X X X STARTUP STATUS X
RECIPE X X STATE SUBR X
RECIPE DESCRIPTOR X X STEP X X X
RECIPE ENTRY X X STEP SUBR (ABB) X X

WBPEEUI330254B3 4-5
Syntax

Table 4-1. Reserved Words (continued)

Reserved Word BSQ PHX UDF Reserved Word BSQ PHX UDF
STRING X X X TUNED STATUS X
STRING ARRAY X X X UDF TYPE X
SUBPHASE (ABB) X UNACQUIRE X X
SUBR X X X UNCONNECT X X
SUBR DESCRIPTOR X X X UNIT DATA X X
SUBR STATUS X X X UNIT DESCRIPTOR X X X
SUPPRESS X X X UNIT PARAMETERS X X
TAN X X X UNRESERVE X X
TEXT X X X UNTIL X X X
TEXT ARRAY X X X USING X X X
THEN X X X VAR X X X
TIMER X X X VAR ARRAY X X X
TIMER ARRAY X X X VAR STRING X X X
TITLE X X VERSION X X
TO X X WAIT X X X
TO LOWER X X WAIT FOR X X X
TO UPPER X X WAIT UNTIL X X X
TOLOWER X X WAIT WHILE X X X
TOUPPER X X WATCH X
TPR X X WHILE X X X
TRUE X X X XOR X X X
TRUNC X X X

Table 4-2. Reserved Constants

Constant Value BSQ PHX UDF Constant Value BSQ PHX UDF
ALLOWED 1 X X X CYAN 5 X X X
AUTO 1 X X X GOOD 0 X X X
BAD 1 X X X GREEN 3 X X X
BLACK 0 X X X FALSE 0 X X X
BLUE 4 X X X FORCED_OFF 0 X X X
CASCADE 2 X X X FORCED_ON 1 X X X
CLOSED 0 X X X HOLDING 0 X X X
COMPLETE 0 X X X INVERT 1 X X X

4-6 WBPEEUI330254B3
Syntax

Table 4-2. Reserved Constants (continued)

Constant Value BSQ PHX UDF Constant Value BSQ PHX UDF
LOCAL -3 X X RUNNING 1 X X X
MAGENTA 6 X X X STATE_ONE 1 X X X
MANUAL 0 X X X STATE_ 3 X X X
THREE
MINE -2 X X STATE_TWO 2 X X X
NO 0 X X X STATE_ZERO 0 X X X
NORMAL 0 X X X STOPPED 0 X X X
NOT_FORCED 2 X X X TRUE 1 X X X
OFF 0 X X X UNDEFINED -∝ X X X
ON 1 X X X WAITING 2 X X X
OPEN 1 X X X WHITE 1 X X X
PI 3.1415 X X X YELLOW 7 X X X
RED 2 X X X YES 1 X X X
RATIO 2 X X X YOURS -1 X X

Table 4-3. Reserved Reference Extensions

Extension Description BSQ PHX UDF Extension Description BSQ PHX UDF
.ALM alarm status X X X .CLR message X X X
color

.AMSK alarm mask X X X .CMDSTRG CSEQ X X


command
string
.BATCH batch X X X .CO control X X X
identifier output
.BLNK blink status X X X .CPEND CSEQ X X
command
pending
status
.CAMPAIGN campaign X X X .CSTS CSEQ X X
identifier connection
status
.CLEN current string X X X .CV1 CSEQ X X
length command
variable 1

WBPEEUI330254B3 4-7
Syntax

Table 4-3. Reserved Reference Extensions (continued)

Extension Description BSQ PHX UDF Extension Description BSQ PHX UDF
.CV2 CSEQ X X .FBV feedback X X X
command value
variable 2
.CV3 CSEQ X X .FF feedforward X X X
command value
variable 3
.CV4 CSEQ X X .GAIN gain value X X X
command
variable 4
.CV5 CSEQ X X .HAL high alarm X X X
command status
variable 5
.CV6 CSEQ X X .HALIM high alarm X X X
command limit
variable 6
.CV7 CSEQ X X .HAMSK high alarm X X X
command mask
variable 7
.CV8 CSEQ X X .HLIM high limit X
command
variable 8
.DAL deviation X X X .ILK1 interlock 1 X X X
alarm value
.DILK data export X X X .ILK2 interlock 2 X X X
block data value
interlock
status
.DIR controller X X X .ILK3 interlock 3 X X X
direction value
.DTIM dead time X X X .ILK4 interlock 4 X X X
value value
.FAULT fault code X X X .ISTR data export X X X
block input
string value
.FB1 feedback X X X .K gain X X X
value 1 multiplier
.FB2 feedback X X X .KA derivative lag X X X
value 2 constant
.FBT feedback X X X .KD derivative X X X
target rate action

4-8 WBPEEUI330254B3
Syntax

Table 4-3. Reserved Reference Extensions (continued)

Extension Description BSQ PHX UDF Extension Description BSQ PHX UDF
.KI integral reset X X X .OSTR data export X X X
block output
string
.KP proportional X X X .OSTS CSEQ X X
gain ownership
status
.LAG lag value X X X .OVR status X X X
override
.LAL low alarm X X X .PERM1 permissive 1 X X X
status value
.LALIM low alarm X X X .PERM2 permissive 2 X X X
limit value
.LAMSK low alarm X X X .PHASE phase X X
mask limit number
(ABB)
.LIM alarm limit X X X .PROGRAM CSEQ X X
program ID
number
.LLIM low limit X .PV process X X X
value
.LOT lot identifier X X X .Q quality X X X
.MLEN maximum X X X .QMSK quality mask X X X
string length
.MLOCK data export X X X .QSTS CSEQ X X
block mode ownership
lock status queue status
.MODE mode X X X .RATE rate X X X
.MSG message X X X .REALM data export X X X
number block realarm
status
.NEW data export X X X .RECIPE recipe X X X
block new identifier
input string
status
.OPERA- operation X X .RSTS reservation X X
TION number status
(SP88)

WBPEEUI330254B3 4-9
Syntax

Table 4-3. Reserved Reference Extensions (continued)

Extension Description BSQ PHX UDF Extension Description BSQ PHX UDF
.RX ratio index X X X .SV8 CSEQ status X X
variable 8
.SP set point X X X .TIM time X X X
.SPM set point X X X .TPID CSEQ target X X
modifier program ID
value number
.STATSTRG CSEQ status X X .TPR CSEQ target X X
string partial recipe
ID number
.STS status X X X .TRK track X X X
.SV1 CSEQ status X X .TRUNC data export X X X
variable 1 block
truncated
value
.SV2 CSEQ status X X .TUN tuning time X X X
variable 2 constant
block
.SV3 CSEQ status X X .TYP algorithm X X X
variable 3 type
.SV4 CSEQ status X X .VAL value X X X
variable 4
.SV5 CSEQ status X X .WATCH watch status X X
variable 5
.SV6 CSEQ status X X .XSTS execution X X X
variable 6 status
.SV7 CSEQ status X X
variable 7

Table 4-4. Reserved Directives

Directive BSQ PHX UDF Directive BSQ PHX UDF


ALPHA X X HIHI X
BRM X INCLUDE X X X
CASESENSE X X LIST X X X
DEBUG X X X LOCATION X X
DESCRIPTOR X X X MAXPARALLEL X X
EJECT X X X NOLIST X X X

4 - 10 WBPEEUI330254B3
Syntax

Table 4-4. Reserved Directives (continued)

Directive BSQ PHX UDF Directive BSQ PHX UDF


PROGRAMID X X TITLE X X X
RECIPE X X VERSION X X X
MANAGEMENT
SUPPRESS X X X

Expressions
An expression consists of one or more operands with an opera-
tor. Refer to Table 4-5 for a list of operators that apply to both
Batch 90 and UDF programming languages.

Table 4-5. Operators and Expressions

Relational Boolean Arithmetic


<> AND +
>= NOT -
<= OR *
=< XOR **
=> /
= ABS
< EXP
> LOG
IS RND
IS NOT TRUNC
ISNOT

Notation
Operators and comments require certain kinds of operands.
The following notation is used to indicate operand type:
exp Any expression.
const Constant.
var Item of data that can be written.
If several operands appear in an expression, they must be dis-
tinguished by appending a number (for example, exp1 + exp2).

WBPEEUI330254B3 4 - 11
Syntax

Relational Operators and Expressions


The logical value false is represented by a value greater than
or equal to -0.5 and less than 0.5. Otherwise, the value is true.
The values of relational and boolean expressions are 0.0 for
false and 1.0 for true.
<> Usage exp1 <> exp2
True if exp1 is not equal to exp2; otherwise false.
Example IF (FC501.VAL <> 25.0)
= Usage exp1 = exp2
True if exp1 equals exp2; otherwise false.
Example WAIT UNTIL (LC501.VAL = 12.5)
< Usage exp1 < exp2
True if exp1 is less than or equal to exp2; otherwise false.
Example WAIT UNTIL (LC501.VAL < LC502.VAL)
<= Usage exp1 <= exp2
=< Usage exp1 =< exp2
True if exp1 is less than or equal to exp2; otherwise false.
Examples WAIT UNTIL (LC501.VAL <= 12.5)
WAIT UNTIL (LC501.VAL =< 12.5)
> Usage exp1 > exp2
True if exp1 is greater than exp2; otherwise false.
Example WAIT UNTIL (LC501.VAL > 12.0)
>= Usage exp1 >= exp2
=> Usage exp1 => exp2
True if exp1 is greater than or equal to exp2; otherwise false.
Examples WAIT UNTIL (LC501.VAL >= LC502.VAL)
WAIT UNTIL (LC501.VAL => LC502.VAL)

4 - 12 WBPEEUI330254B3
Syntax

IS Usage exp1 IS exp2


True if exp1 (rounded to the nearest integer) is equal to exp2
(rounded to the nearest integer); otherwise false.
Example IF (LC501.MODE IS AUTO)
IS NOT Usage exp1 IS NOT exp2
ISNOT Usage exp1 ISNOT exp2
True if exp1 (rounded to nearest integer) is not equal to exp2
(rounded to nearest integer); otherwise false.
Examples IF (LC501.MODE IS NOT AUTO)
IF (LC501.MODE ISNOT AUTO)

Variable to List or Array Comparisons


The following expressions compare the value of a variable with
a set of parameters to determine if the variable is included in
the set. If the value of the variable is in the set, the result of
the comparison is true. Otherwise, the result is false. Con-
stants must be numeric or symbolic and can be mixed within a
list. Array elements must also be numeric or symbolic.

(var = (const1,const2,...,constn))

(var = array (*))

where:

var Name of the variable to be compared to


the list or array.
constn Name of the constants to be compared to
the variable.
array Name of the array to be compared to the
variable.
Examples IF (XMODE = (-i,OPEN,7)) THEN
SET FC101.MODE = MAN
SET FC101.CO = CLOSED
ENDIF

IF (X = ARYLIST(*)) THEN
SET FC101.MODE = AUTO
ENDIF

WBPEEUI330254B3 4 - 13
Syntax

Variable to Limits Comparisons


The following expressions compare the value of a variable with
high and low limits to determine if the expression is true. The
limits can be constants, variables, or expressions.

(high >var >low )


(high >=var >low )
(high >=var >=low )
(high >var >=low )
(low <var <high)
(low <=var <high)
(low <=var <=high)
(low <var <=high)

where:

var Name of the variable to be compared to the limits.


high High limit of the comparison.
low Low limit of the comparison.
Examples IF (95>XX>5) THEN
SET FC101.MODE = MANUAL
ENDIF

IF (FC101.HLIM>ALM_VAR>FC101.LLIM) THEN
SET FC101.MODE = MANUAL
SET SV201.CO = CLOSED
ENDIF

Array Comparisons
The following expression compares the elements in one con-
stant or variable array to the elements of a second constant or
variable array. Only if there is an exact match is the expres-
sion considered to be true.
(array1(*) = array2 (*))

where:

array1, array2 Name of the declared constant or variable


arrays of the same dimensions.

4 - 14 WBPEEUI330254B3
Syntax

Example IF (OLD_ARRAY(*) = NEW_ARRAY(*)) THEN





ENDIF

Minimum/Maximum Array Values


The following expressions select the minimum or maximum
value from the elements of a constant or variable array.

MAX array_name (*)


MIN array_name (*)

where:

array_name Name of the declared constant or variable


array.
Examples MAX_VALUE = MAX ALM_LIMIT(*)
MIN_VALUE = MIN SP_MIN_VAL(*)

Boolean Operators and Expressions


NOT Usage NOT exp

True if exp false; otherwise false.


Example WAIT UNTIL (NOT FC501.Q)
AND Usage exp1 AND exp2
Logical AND of exp1 and exp2. Value is true only if both exp1
and exp2 are true.
Example WAIT UNTIL ((LC501.VAL >= 12.0) AND
(LC501.MODE IS AUTO))
OR Usage exp1 OR exp2
Logical OR of exp1 and exp2. Value is true if either exp1 or
exp2 is true.
Example WAIT UNTIL ((LC501.VAL >= 12.0) OR
(LC501.MODE IS AUTO))

WBPEEUI330254B3 4 - 15
Syntax

XOR Usage exp1 XOR exp2


Logical EXCLUSIVE OR of exp1 and exp2. Value is true if
either exp1 or exp2 is true, but not both.
Example WAIT UNTIL ((LC501.VAL >= 12.0) XOR
(LC501.MODE IS AUTO))
Boolean functions AND, OR, and XOR are also supported by
arrays. For an AND expression to be true, both arrays must be
identical. For an OR expression to be true, at least one element
must be identical in both arrays. For an XOR expression to be
true, every element is different from that of the other array.

(array1(*) AND array2 (*))


(array1(*) OR array2 (*))
(array1(*) XOR array2 (*))

where:

array1, array2 Name of the declared constant or variable


arrays with the same dimensions.
Example IF (OLD_ARRAY(*) AND NEW_ARRAY(*)) THEN



ENDIF

Arithmetic Operators and Expressions


+ Usage exp1 + exp2
Sum of exp1 and exp2.
- Usage exp1 - exp2
Difference of exp1 and exp2.
- Usage -exp

Minus exp.
* Usage exp1 * exp2
Product of exp1 and exp2.

4 - 16 WBPEEUI330254B3
Syntax

** Usage exp1 ** exp2


exp1 to exp2 power.
/ Usage exp1 / exp2
Quotient of exp1 divided by exp2.
ABS Usage ABS (exp)

Absolute value of exp.


LOG Usage LOG (exp)

Natural log of exp.


EXP Usage EXP (exp1)

e to exp1 power.
RND Usage RND (exp)

Round exp to nearest whole number.


TRUNC Usage TRUNC (exp)

Truncate exp to whole number.

Trigonometric functions include:


SIN Usage SIN (exp)
COS Usage COS (exp)
TAN Usage TAN (exp)

where exp = value in radians.

Local/Global Conventions
Data structures (timers, integrators, ramps, etc.) can be
declared either in the phase subroutine or in a data section.
When declared in a phase (Batch 90) or state (UDF) subrou-
tine, the data structure is said to be local. When declared in a
data section, the data structure is said to be global.

Local data structures only exist when the phase or state sub-
routine they are declared within is active. All local data struc-
tures are initialized when the phase or state subroutine

WBPEEUI330254B3 4 - 17
Commands and Statements

becomes active. Most data structures (for example, timers,


integrators, etc.) have initial values of zero.

Global data structures are initialized on a complete to run


transition. Global data is available to all subroutines that fol-
low for reference or command.

Any element (function subroutine, monitor subroutine, vari-


ables, function blocks, etc.) must be defined before it can be
used in a program statement.

Commands and Statements


The purpose and format of each command and statement is
explained in the following text. Also provided are examples and
any other pertinent information.

ACK (Variable)
Purpose ACK is a built-in, read-only status variable. It indicates the
status of operator acknowledge input to BSEQ function block
or receipt of ACK command by a PHASEX function block.
Language BSEQ, PHASEX
Declaration Not required.
References ACK value is read by using ACK in an expression.

ACK Status of operator acknowledge input:


0 = false (no acknowledge).
1 = true (acknowledge has occurred).

Examples WAIT UNTIL (ACK)


WAIT UNTIL (ACK IS TRUE)

Remarks ACK is latched in the true state by a 0 to 1 transition of the


operator acknowledge input. It remains true until reset by a
read operation. It is usually desirable to do a dummy read to
clear the ACK prior to the actual test for operator acknowledge.
Example X = ACK {Clear ACK}
SET USERMESSAGE.OSTR = “WAIT FOR OPERATOR ACK”
WAIT UNTIL (ACK) {Wait for operator input}

The first statement clears any operator acknowledge that may


be left from an earlier time. The second statement is used to

4 - 18 WBPEEUI330254B3
ACQUIRE

display a text message at the workstation. The third statement


is waiting for ACK to be equal to one.

NOTE: The seventh (n+6) block output of the BSEQ function block is designed
to give the programmer a convenient means to reset the ACK pushbutton (typ-
ically configured as a remote control memory function block (FC 62)).

ACQUIRE
Refer to Common Sequence (Data Structure).

Advanced PID (Function Block)


Purpose Advanced PID function blocks (APID, FC 156) provide a mech-
anism for the analog control of single input single output pro-
cesses. The program interface to an APID function block
provides information about a process and its controller and
allows changes of the controller tuning parameters.
Language BSEQ, PHASEX, UDF
Declaration BLOCK name, BLK = const, FC = APID

Parameter Description
name Name of the APID function block.
const Function block address.

Example BLOCK A501, BLK = 250, FC = APID

References APID data may be read by using the appropriate name in an


expression.

name.data

Parameter Description
name Name of the APID function block.
data Type of data being read.
CO Control output.
DIR Direction (spec 21):
0 = reverse mode error (SP minus PV).
1 = direct mode error (PV minus SP).
HLIM High output limit (spec s16).

WBPEEUI330254B3 4 - 19
Advanced PID (Function Block)

Parameter Description
data Type of data being read.
(continued)
K K value (gain multiplier, spec S11).
KA KA value (derivative log constant, spec S15).
KD KD value (derivative rate, spec S14).
KI KI value (integer reset, spec S13).
KP KP value (proportional gain, spec S12)
LLIM Low output limit (spec S17).
PV Process variable (spec S1).
SP Set point (spec S2).
SPM Set point modifier (spec S20):
0 = normal.
1 = integral only on set point change.
TRK Track flag input (spec S4):
0 = tracking.
1 = released.
TYP Algorithm type (spec S18):
0 = classical.
1 = non interacting.
2 = classical with external reset.
3 = manual reset non interacting.

Examples X = A501.CO
X = A501.TYP

Commands Use the following statement to tune APID function blocks.

SET name.data = exp

Parameter Description
name Name of the APID function block.
data Type of data being set.
K K value (gain multiplier, spec S11).
KD KD value (derivative rate, spec S14).
KI KI value (integer reset, spec S13).
KP KP value (proportional gain, spec S12).
exp New value of data.

Examples SET A501.K = 2.0


SET A501.KP = 0.3

4 - 20 WBPEEUI330254B3
#ALPHA (Directive)

#ALPHA (Directive)
Purpose The #ALPHA directive signals the compiler that the Batch 90
application contains alphanumeric identifiers for BATCH,
CAMPAIGN, LOT, and RECIPE variables. These identifiers can
be up to 16 characters in length. Valid alphanumeric charac-
ters are zero through nine, A through Z, and underscores.
Language BSEQ, PHASEX
Format #ALPHA
Example #TITLE “EXAMPLE USING ALPHANUMERIC IDENTIFIERS”
#DEBUG LEVEL = 4
#DESCRIPTOR “ALPHA ID PROGR”
#ALPHA

Remarks Usage of alphanumeric identifiers requires a change in func-


tion block configurations. REMSET function blocks, typically
used as input blocks to BSEQ and BHIST function blocks, are
replaced with DATAEXPT function blocks. Figure A-5 shows
an example function block configuration.

Usage of at least one alphanumeric BATCH, CAMPAIGN, LOT,


and RECIPE identifier within a project dictates that all BATCH,
CAMPAIGN, LOT, and RECIPE identifiers within the project be
alphanumeric. Numeric and alphanumeric identifiers can not
be used in the same project.

Alphanumeric identifiers for BATCH, CAMPAIGN, LOT, and


RECIPE require MFP module firmware revision F.2 or later.

#ALPHA is recommended for PHASEX Batch 90 programs. For


PHASEX programs, the BATCH, CAMPAIGN, LOT, and RECIPE
are written as alphanumeric characters in the batch manager
ACQUIRE command. The batch manager allows the ID’s to be
less than 32 characters in length. However, the ID’s are trun-
cated to the first 16 characters in Batch 90 syntax to support
CSEQ connections.

WBPEEUI330254B3 4 - 21
Analog Exception Report (Function Block)

Analog Exception Report (Function Block)


Purpose The analog exception report (AOL, FC 30) transmits an analog
value and its attributes (quality and alarm) via the control net-
work to operator workstations and other nodes.
Language BSEQ, PHASEX, UDF
Declaration Each AOL function block to be used by a batch program must
be declared as follows:

NOTE: Input S1 of the AOL function block must be set to 2. Otherwise, batch
program commands will be ignored.

BLOCK name, BLK = const, FC = AOL [, WATCH]

Parameter Description
name Name of the AOL function block.
const Function block address.
WATCH If WATCH is specified, the initial AOL function block watch status is set to on
(BSEQ only) by the batch historian on program startup. If WATCH is not specified, the initial
watch status is off.

Example BLOCK AOL501, BLK = 240, FC = AOL

References AOL data may be read by using the appropriate name in an


expression.

name.data

Parameter Description
name Name of the AOL function block.
data Type of data being read.
HAL Current high alarm status:
0 = not high alarm.
1 = high alarm.
HALIM Current high alarm limit (specification S5).
HAMSK Current high alarm mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.
LAL Current low alarm status:
0 = not low alarm.
1 = low alarm.

4 - 22 WBPEEUI330254B3
Analog Exception Report (Function Block)

Parameter Description
data Type of data being read.
(continued)
LALIM Current low alarm limit (specification S6).
LAMSK Current low alarm mask:
0 = forced 0 (not low).
1 = forced 1 (low).
2 = not forced.
Q Current quality:
0 = good.
1 = bad.
QMSK Current quality mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.
VAL Current value.

Examples X AOL501.VAL
X AOL501.VAL

Commands Use the following statement to tune AOL function blocks:

SET name.data = exp

Parameter Description
name Name of the AOL function block.
data Type of data being set.
HAMSK High alarm mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.
LAMSK Low alarm mask:
0 = forced 0 (not low).
1 = forced 1 (low).
2 = not forced.
QMSK Quality mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.
VAL Current value.

WBPEEUI330254B3 4 - 23
ARRAY

Parameter Description
data Type of data being set.
(continued)
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Examples SET AOL501.HAMSK = FORCED_OFF


SET AOL501.VAL = 32.0
SET AOL501.WATCH = ON

ARRAY
Refer to Block Array (Data Structure), CONST ARRAY (Data
Structure), CONST STRING ARRAY (Data Structure), VAR
ARRAY (Data Structure), and VAR STRING ARRAY (Data
Structure).

Assignment (Statement)
Purpose This statement assigns a value to a variable.
Language BSEQ, PHASEX, UDF
Format var = exp

Parameter Description
var Name of variable where value is to be stored.
exp Expression to be evaluated.

Examples x = 123.0
x = y + z + 123.0
x = (FT101.VAL + FT102.VAL) / 2.0
STATUS = FT101.STS

Remarks Refer to VAR ARRAY (Data Structure) for more information.

4 - 24 WBPEEUI330254B3
BATCH (Variable)

BATCH (Variable)
Purpose BATCH is a built-in status variable.
Language BSEQ, PHASEX
Declaration None required.
References Batch ID is read by using BATCH in an expression.
Examples PRODUCT_NO = BATCH + 1
SUBPROD_ID_NO = BATCH

Remarks The Batch 90 language includes three built-in variables (CAM-


PAIGN, BATCH and LOT). These variables may be used by the
batch historian function block for record keeping or by the
common sequence function block for controlling resource allo-
cation. Refer to CAMPAIGN (Variable) and LOT (Variable) for
more information.

When #ALPHA is used in the Batch 90 program file for


PHASEX batch ID’s are set by the ACQUIRE command to the
PHASEX function code. Batch ID will use the first 16 charac-
ters of the batch ID in the ACQUIRE command. If #ALPHA is
not used in the Batch 90 program file for PHASEX and the
batch ID set by the ACQUIRE command is six or less digits
long, the alphanumeric batch ID will be converted to a
numeric batch ID. The numeric batch ID is referenced by the
built-in status variable.

BATCH DATA (Statement)


Purpose This is the first statement of a batch data section within a
batch program. This section defines global data, function
codes, and symbols. All declarations in the batch data section
are global since they can be referenced by all following phase,
function, and monitor subroutines in the batch program.
There may be more than one batch data section in a program.
The second batch data section is often used to declare global
monitors. Since global monitor subroutines must be defined in
the program before they are declared, the second batch data
section should appear after the monitor subroutine
definitions.
Language BSEQ, PHASEX

WBPEEUI330254B3 4 - 25
BATCH DATA (Statement)

Format BATCH DATA


type1 name1
type2 name2



END DATA

Parameter Description
type Any one of the following:
BLOCK Function block.
block ARRAY Array of function codes.
CONST Constant.
CONST ARRAY Constant array.
CONST STRING Constant string.
CONST STRING ARRAY Constant string array.
FGEN Function generator.
INTEGRATOR Integrator.
MONITOR Monitor call.
RAMP Ramp.
TIMER Timer.
VAR Variable.
VAR ARRAY Variable array.
VAR STRING Variable string.
VAR STRING ARRAY Variable string array.
name Name of the data.

Example BATCH DATA


VAR SUM{variable}
CONST NOT_OPEN = 0{constant}
BLOCK DI02A, BLK = 100, FC = 84, \
OUT (0) = FV501, OUT (1) = FV501{function block}
BLOCK FV501, BLK = 205, FC = DD{device driver}
END DATA

Remarks For function block declaration details, refer to:

AOL Analog exception report


APID Advanced PID
BBUF Boolean data buffer
CS Control station
CSEQ Common sequence
DATAEXPT User defined data export
DOL Digital exception report

4 - 26 WBPEEUI330254B3
Batch Sequence (Function Block)

DD Device driver
MSDD Multistate device driver
RBUF Real data buffer
RCM Remote control memory
REMSET Remote manual set constant
RMC Remote motor control
SMITH Smith block
TEXT Text

Other function codes may be referenced by their function code


number.

Batch data is permanent; the values remain from one phase


subroutine to the next. Batch data is initialized when a batch
program is run for the first time (that is, on the transition from
batch complete to running).

The active data structures (for example, timers and monitor


calls) execute independently of the active phase subroutine.
They will execute even while the active phase subroutine is
held. Active data structures declared in a batch data section
are sometimes referred to as being global. Their values are ini-
tialized to zero at the start of the batch sequence. They are
never initialized again unless explicitly done so through a
statement such as RESET.

Batch Sequence (Function Block)


Purpose The following reference extensions will retrieve the recipe,
phase, campaign, batch, and lot ID and the execution status of
a batch sequence function block.
Language UDF
Declaration Each BSEQ function block to be used by a UDF program must
be declared as follows:
BLOCK bseqx, BLK = const, FC = BSEQ

Parameter Description
bseqx Name of the BSEQ function block.
const Function block address.

WBPEEUI330254B3 4 - 27
BBUF

Example BLOCK BSEQ501, BLK = 240, FC = BSEQ

References BSEQ data may be read by using the appropriate name in an


expression.

bseqx.data

Parameter Description
bseqx Name of the BSEQ function block.
data PHASE Number of the phase subroutine being executed by
the BSEQ function block declared by bseqx.
XSTS Execution status of the BSEQ function block
declared by bseqx:
-1 = batch inactive (complete).
0 = holding.
1 = running (normal logic active).
2 = hold (hold logic active).
3 = fault (fault logic active).
4 = restart (restart logic active).

Examples X = BSEQ501.PHASE
X = BSEQ501.XSTS
VAL = RECIPE_ID (NUMERIC)

BBUF
Refer to Data Buffer (Function Block).

Block Array (Data Structure)


Purpose A block array is a group of previously defined function blocks
of the same function code type, organized into an array. An
array may have one, two, or three dimensions. The array as a
whole has a name. An individual block (element) of an array is
identified by an array index which specifies the position of the
element within the array. An array index consists of subscripts
- one subscript for each dimension.
Language BSEQ, PHASEX, UDF
Declaration The following statements are used to declare (in data sections)
block arrays.
{for one dimensional array}
type ARRAY name (low :high1) (list )

4 - 28 WBPEEUI330254B3
Block Array (Data Structure)

{for two dimensional array}


type ARRAY name (low :high1, [low :]high2 ) (list )
{for three dimensional array}
type ARRAY name (low :high1, [low :]high2, [low :]high3 ) (list )

Parameter Description
type Any one of the following:
AOL Analog output over the loop.
BBUF Boolean buffer.
BLOCK Value of any declared function block.
CS Control station.
DATAEXPT Data export.
DD Device driver.
DOL Digital output over the loop.
MSDD Multistate device driver.
RBUF Real buffer.
RCM Remote control memory.
REMSET Remote manual set constant.
RMC Remote motor control block.
TEXT Text selector.
name Name of the array.
low Lowest subscript value must be 0 or 1. For second and third
dimensional arrays, the lowest subscript is optional but must
match the value from the first dimension.
highN Highest subscript value for the Nth dimension. This must be a
constant. The total number of elements in an array must not
exceed 16K.
list List of array element names. This 1 dimensional list has one
entry for each element of the array. The order of entries is
determined by varying the first (left) subscript the fastest,
then the second and third.

Examples In the following examples, the names included in the list corre-
spond to names assigned to function block declarations in the
data.
TEXT ARRAY TXT_MSGS (1:5) \
(LINE1, LINE2, LINE3, LINE4, LINE5)

CS ARRAY CONTROL_VLVS (1:3, 1:2) \


(FIC110, PIC118, TIC122, \
FIC207, PIC209, TIC225)

DD ARRAY REACTOR_FUNCTION_BLOCKS (1:4, 3, 2) \


(PV52, PV58, PV60, PV66, \

WBPEEUI330254B3 4 - 29
Block Array (Data Structure)

TV41, TV42, TV71, TV72, \


FV53, FV57, FV63, FV67, \
PV152, PV158, PV160, PV166, \
TV141, TV142, TV171, TV172, \
FV153, FV157, FV163, FV167)

Reference Block array data structures can be referenced using the


appropriate name in an expression.

Element of an array

{for one dimensional array}


name (exp1) .ref ext
{for two dimensional array}
name (exp1, exp2 ) .ref ext
{for three dimensional array}
name (exp1, exp2, exp3 ) .ref ext

Parameter Description
name Name of the array.
expN Value of the nth subscript. Subscript boundary checking will be
performed as is for all other array types.
.ref ext Valid reference extension for the function block type of the
array.

Examples F1_PV = CONTROL_VLVS (1, 1) .PV


F1_TGT = CONTROL_VLVS (1, 1) .SP
T2_CO = CONTROL_VLV (3, 2) .CO
SOV_MODE = REACTOR_FUNCTION_BLOCKS (4, 1, 2) .MODE
DISPLAY MESSAGE 1234 COLOR GREEN USING TXT_MSGS(I)

Entire array - In many operations it is necessary to refer to


an entire array as a whole. An entire array of function blocks
will be referenced as follows:

name [.ref ext ]


- or -

name (*...) [.ref ext ]

4 - 30 WBPEEUI330254B3
Block Array (Data Structure)

Parameter Description
name Name of the array.
(*...) Number of dimensions (that is, (*), (*, *), (*, *, *)).
.ref ext Valid reference extension for the function block type of the
array.

The first form (just the name) is used when an array is passed
as an argument to a function or monitor subroutine. The sec-
ond form is used in other whole array operations.
Examples CALL CLEAR_MSGS (TXT_MSGS1)
TARGETS (*, *) = CONTROL_VLVS (*, *) .SP
PROCESS_VARIABLES (*, *) = CONTROL_VLVS (*, *) .PV

Commands Use the following statements to tune block array data.

Assign (write a value to a block array element)

{for one dimensional array}


SET name (exp1) .ref ext = exp

{for two dimensional array}


SET name (exp1, exp2 ) .ref ext = exp

{for three dimensional array}


SET name (exp1, exp2, exp3 ) .ref ext = exp

Parameter Description
name Name of the array.
expN Value of the Nth subscript. Subscript boundary checking will
be performed as is for all other array types.
.ref ext A valid reference extension for the function code block type of
the array.
exp Command value for the reference extension of the element.

Examples SET CONTROL_VLVS (1, 1) .SP = 0


SET REACTOR_FUNCTION_BLOCKS (1, 2, 1) .MODE = AUTO
SET INDICATORS (2, 2, 2) .VAL = 1

WBPEEUI330254B3 4 - 31
Block Array (Data Structure)

Entire array - Command references to block arrays may be


made to the array as a whole. Thus, an entire array of function
blocks is written to:

SET name (*...) .ref ext = exp

Parameter Description
name Name of the array.
(*...) Number of dimensions.
.ref ext A valid reference extension for the function block type of the
array.
exp Command value for the reference extension of the element.

Examples SET CONTROL_VLVS (*, *) .SP = 0


SET REACTOR_FUNCTION_BLOCKS (1, *, *).MODE = AUTO
SET INDICATORS (1, *, *) .VAL = 1.0

NOTES:
1. Only function blocks explicitly defined in data sections may be included in
an array (that is, no unit procedure dependent function blocks are allowed).

2. Data export arrays do not support wildcard assignments. Use a for..end


for loop to assign all elements of a data export array, to a value or expression.

Elements within the array are static. Once defined in the list of
the array declaration, the program is not able to dynamically
change which function blocks are included in the array.

Subscript range checking is done by the compiler if all of the


subscripts of an array are constants. Range checking is always
performed during program execution. Each time an array ele-
ment is read, the subscript values are checked. If a subscript
value is out of bounds, some error action is taken. If the error
occurs during any mode other than fault mode (for example,
normal mode), the normal flow of control is aborted. The mode
is changed to fault and control is transferred to fault logic with
the system generated fault code of -17 indicating the error in
array subscript boundary. If the error occurs during fault
mode, flow of control is not aborted. A value of zero is returned
for the incorrectly subscribed array element.

4 - 32 WBPEEUI330254B3
BREAK (Statement)

BREAK (Statement)
Purpose This statement terminates the smallest enclosing loop struc-
ture (for example, REPEAT-UNTIL, WHILE-ENDWHILE, DO
CASE or FOR LOOP).
Language BSEQ, PHASEX, UDF
Format BREAK
Remarks When this statement is executed, control passes to the state-
ment following the terminated loop (for example, following an
UNTIL, ENDWHILE, END CASE, or FOR LOOP).
Example REPEAT
IF (TIMER1.VAL > 30.0) BREAK
IF (TIMER2.VAL > 10.0) BREAK
UNTIL (A > 10)

The BREAK statement will not break out of an IF (...) THEN (...)
ELSE (...) statement, because this IF statement is not classi-
fied as a looping structure.

CALL
Refer to FUNCTION (Subroutine).

CAMPAIGN (Variable)
Purpose CAMPAIGN is a built-in status variable.
Language BSEQ, PHASEX
Declaration None required
References Campaign ID is read by using CAMPAIGN in an expression.
Example TRAIN_NO = CAMPAIGN
PROD_ID_NO = CAMPAIGN + 1000

Remarks The Batch 90 language includes three built-in variables


(BATCH, CAMPAIGN, and LOT). These variables may be used
by the BSEQ function block for record keeping or by the CSEQ
function block for controlling resource allocation. Refer to
BATCH (Variable) and LOT (Variable) statements for more
information.

WBPEEUI330254B3 4 - 33
CASE (Statement)

When #ALPHA is used in the Batch 90 program file for


PHASEX campaign ID’s are set by the ACQUIRE command to
the PHASEX function code. Campaign ID will use the first 16
characters of the campaign ID in the ACQUIRE command. If
#ALPHA is not used in the Batch 90 program file for PHASEX
and the campaign ID set by the ACQUIRE command is six or
less digits long, the alphanumeric campaign ID will be con-
verted to a numeric campaign ID. The numeric campaign ID is
referenced by the built-in status variable.

CASE (Statement)
Purpose This structure organizes statements into one or more cases (a
block of statements with an identifier) and a switch to select
one of the cases for execution.
Language BSEQ, PHASEX, UDF
Format DO CASE exp
CASE id_list
statement 1a



statement 1n
CASE id_list2
statement 2a



statement 2n
[other ]
statement
statement
END CASE

4 - 34 WBPEEUI330254B3
CASE (Statement)

Parameter Description
exp This value selects the case to be executed.
id_list Each case is identified by its id_list. An id_list may be single
number (for example, 3), a number range (for example, 5 TO
10), or a combination of numbers and ranges (for example, 3,
5 TO 10). All ranges are inclusive).
other Identifies the case to be executed when none of the previous
id_lists include the switch value.
NOTES:
1. The other case specification must be the last case specified.
2. The switch value is rounded to the nearest integer value prior to evaluation.
3. The maximum number of cases that can be specified is 500.

Example DO CASE X
CASE 1
SET TIC220.SP = 55
SET TIC221.SP = 45
CASE 4 TO 6, 8
SET TIC220.SP = 45
SET TIC221.SP = 55
OTHER
SET TIC220.SP = 50
SET TIC221.SP = 50
END CASE

Remarks When the DO CASE statement is executed, the cases are


searched in order (starting from the top) for the first id_list
that contains the switch value. If a match is found, then the
block of statements for that case is executed, and control then
passes to the statement following the END CASE.

Id_lists may be overlapping (although the compiler will gener-


ate a warning message). The first case that matches the switch
is the one executed. For example, the cases:

CASE 5
CASE 1 TO 10

are equivalent to the cases:

CASE 5
CASE 1 TO 4, 6 TO 10

Execution of a BREAK statement within a case passes control


to the statement following the END CASE. The OTHER case is
executed if none of the case expressions are trues.

WBPEEUI330254B3 4 - 35
#CASESENSE (Directive)

CASE statements may be nested.

#CASESENSE (Directive)
Purpose This compiler directive enables or disables case sensitivity for
string comparison operations only.
Language BSEQ, PHASEX, UDF
Format #CASESENSE = n

Parameter Description
n Case sense comparison options:
0 = all characters compared as uppercase.
1 = characters compared as they exist.

Remarks The default case sensitivity is disabled (set to zero). Once


enabled, the sensitivity remains enabled until another direc-
tive is encountered. This directive may be included in any type
of subroutine but must be the first characters of the first line
of the source program. This directive does not effect write
operations to the output string of export string function
blocks.

Case Conversion (Command)


Purpose This command converts the case of characters within a vari-
able string. The result of the conversion is stored in the origi-
nal string variable.
Language BSEQ, PHASEX, UDF
Format TO UPPER (vstrname)

- or -
TO LOWER (vstrname)

Parameter Description
vstrname Name of VAR STRING data only.

NOTE: Variable strings associated with data export and CSEQ function blocks
can not be directly effected by TO UPPER or TO LOWER commands.

4 - 36 WBPEEUI330254B3
Common Sequence (Data Structure)

Examples TO UPPER (PROMPT_MSG) {converts to uppercase}


TO LOWER (REQUIRED_ACTION) {converts to lowercase}

Common Sequence (Data Structure)


Purpose The common sequence (CSEQ) function block provides the
communication interface with batch sequence (BSEQ) func-
tion blocks. This interface is established when a BSEQ or
PHASEX function block (the client program) connects to a
BSEQ function block (the server program) via a CSEQ function
block attached to the server BSEQ function block.

Once the client program has established the connection, the


server program sends the following status information about
the server to the client:

• Connection status.
• Reservation status.
• Ownership status.
• Control mode (operator, remote).
• Program execution status (inactive, running, holding).
• Unit recipe ID.
• Operation number.
• Fault code.
• Program ID number.
• Campaign, batch and lot identifiers.
• Status variables (.SV1 through .SV8).
• Status strings (.STSSTRG).

This information is available to all connected client programs


by references to the server programs CSEQ name as identified
in the CSEQ function block declaration.

For a client program to gain control of a server program, the


client program must acquire ownership of the server. The cli-
ent program that has acquired ownership of the server may
perform the following operations on the server via commands
to the CSEQ function block.

• Select the unit recipe, operation and start/restart for the


program.

• Select the program to execute.


• Put the program into hold logic.

WBPEEUI330254B3 4 - 37
Common Sequence (Data Structure)

• Send command variables to the CSEQ function block (.CV1


through .CV8).

• Send command strings (.CMDSTRG) to the CSEQ function


block.

• Unacquire (release ownership of) the CSEQ function block.


The client server relationship between programs, with the cli-
ent capable of controlling the server programs execution, is
realized with the use of the CSEQ function block. One program
may be the owner (client) of a second program or server, as
well as a server to a third program. Thus, production trains
contain batch units linked via CSEQ function blocks. Refer to
Figure 4-1 for an example production train.

U N IT 1 U N IT 2 U N IT 3
P RO GR A M X P RO G R A M Y P RO GR A M Z
B SE Q B L O C K B SE Q B L O C K B SE Q B L O C K
C S EQ B LO C K C S EQ B LO C K C S E Q B LO C K
P R O G R A M X: P RO G R A M Y : P RO GR A M Z:
C L IE N T TO U N IT 2 C L IE N T TO U N IT 3 C L IE N T TO N E X T U N IT
S ER V E R T O S ER V E R T O S ER V E R T O
P R E V IO U S U N IT U N IT 1 U N IT 2
T 01 9 56 A

Figure 4-1. Production Train

Language BSEQ, PHASEX

NOTE: PHASEX programs can only act as the client to BSEQ server programs

4 - 38 WBPEEUI330254B3
Common Sequence (Data Structure)

Declaration A CSEQ function block must be declared in a batch data, unit


data, or unit parameter section of the program before it can be
accessed from a subroutine. The CSEQ reserve allow, owner-
ship allow, and control mode inputs effect what access is given
to connected client programs. Reserve allow and ownership
allow inputs determine whether the server is eligible to grant
reserve and acquire requests. The control mode input deter-
mines the source of program execution control for the server.
In operator mode, the unit recipe, operation, and run/hold
inputs from the BSEQ function block control the program exe-
cution. In operator mode, reservation and ownership requests
may be granted. However, control of program execution
remains in the operators control until the control mode is
changed to remote. In remote mode, the owner (a client pro-
gram that has acquired ownership) controls program
execution.
Declaration in batch BLOCK cseqname, BLK = const1, FC = CSEQ \
data RING = const2, PCU = const3, MODULE = const4, \
[TPR = const5,] [PROGRAM = const6 ]

Parameter Description
cseqname Name of the CSEQ function block.
const1 Block address of the BSEQ function block attached to the CSEQ function block.
const2 Loop address (0 = this loop).
const3 Process control unit address (0 = this process control unit).
const4 Module address (0 = this module).
const5 Target partial unit recipe number.
const6 Target program ID number.

Examples UNIT DATA


BLOCK CSEQ_NAME, BLK = FC = CSEQ
END DATA

UNIT DATA
BLOCK CSEQ_NAME, BLK = 3050, FC =CSEQ, RING = 2, \
PCU = 1, MODULE = 10
END DATA

WBPEEUI330254B3 4 - 39
Common Sequence (Data Structure)

References When the following references are operative from the client
programs side of the connection, cseqname is the name
assigned to the CSEQ data structure in the clients program
that represents the server. Other references are operative from
the server programs side of the connection. In these cases, cse-
qname is THIS (that is, THIS refers to the CSEQ name assigned
to a Batch 90 program requesting status of itself).

Get connection status

cseqname.CSTS
- or -
THIS.CSTS

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.CSTS Connection status:
-1 = failed
0 = not connected
1 = connected
≥2 = trying to connect.
THIS.CSTS Number of active connections currently being supported by the CSEQ
function block. Not supported in PHASEX programs.

Examples WAIT WHILE (FEED_TANK.CSTS = WAITING)


IF (FEED_TANK.CSTS = FAILED) FAULT1
IF (THIS.CSTS < 1) NEXT OPERATION 1
WAIT UNTIL (THIS.CSTS > 1)

Get reserved status

cseqname.RSTS
- or -

THIS.RSTS

4 - 40 WBPEEUI330254B3
Common Sequence (Data Structure)

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.RSTS Reserved status:
1 = reservation not allowed.
0 = not reserved.
1 = reserved (production ID qualify).
2 = reserved (production ID does not qualify).
THIS.RSTS Reserved status (not supported in PHASEX programs):
-1 = reservation not allowed.
0 = not reserved.
1 = reserved.

Examples IF (DELIVERY_HEADER.RSTS IS UNRESOLVED) THEN...


IF (DELIVERY_HEADER.RSTS IS ANOTHER) THEN...
IF (THIS.RSTS IS RESERVED) THEN...
IF (THIS.RSTS IS NOT_ALLOWED) THEN...

Get ownership status

cseqname.OSTS
- or -
THIS.OSTS

Parameter Description
cseqname Name of CSEQ function block.
cseqname.OSTS Ownership status:
-1 = ownership not allowed.
0 = not owned.
1 = owned by me.
2 = owned by another.
THIS.OSTS Ownership status (not supported in PHASEX programs):
-1 = ownership not allowed.
0 = not owned.
1 = owned.

Examples IF (PREP_TANK.OSTS = ANOTHER THEN...


WAIT UNTIL (THIS.OSTS IS OWNED)
IF (THIS.OSTS IS NOT_ALLOWED) THEN...
WAIT UNTIL (THIS.OSTS IS OWNED)

WBPEEUI330254B3 4 - 41
Common Sequence (Data Structure)

Get ownership queue status from a client program

cseqname.QSTS
- or -
THIS.QSTS

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.QSTS Ownership queue status:
-1 = ownership queue off and erased.
0 = ownership queue off.
1 = ownership queue on.
THIS.QSTS Ownership queue status (not supported in PHASEX programs):
-1 = ownership queue off and erased.
0 = ownership queue off.
1 = ownership queue on.

Examples WAIT UNTIL (HEADER.QSTS IS ON)


IF (HEADER.QSTS IS OFF) UNCONNECT HEADER
REPEAT ... UNTIL (THIS.QSTS IS ON)
IF (THIS.QSTS = FLUSHED) SET FLAGS.VAL = OFF

Get control mode

cseqname.MODE

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.MODE Control mode:
0 = operator (manual).
1 = remote (auto).

Remarks In the operator mode, the server program execution is con-


trolled normally. In the remote mode, inputs to the BSEQ
function block are disabled. Control of these items is passed to
the CSEQ function block which responds to commands
received from the client program that owns the server. The
emergency stop and acknowledge inputs are active in both
modes.
Examples IF (TANK_1.MODE IS OPERATOR) CONNECT TANK_2
WAIT UNTIL (COOLING_SYS.MODE IS REMOTE)

4 - 42 WBPEEUI330254B3
Common Sequence (Data Structure)

Get program execute status

cseqname.XSTS

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.XSTS Program status:
-1 = batch inactive (complete).
0 = held (hold or fault logic completed).
1 = running (normal logic active).
2 = hold (hold logic active).
3 = fault (fault logic active).
4 = restart (restart logic active).

Examples IF (REACTOR.XSTS <> INACTIVE) THEN


WAIT UNTIL (REACTOR.XSTS IS RUNNING)

Get fault code

cseqname.FAULT

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.FAULT Fault code.

Examples IF (HEADER.FAULT > 0) SET XFER_ALARM.VAL = ON


IF (FEED_TANK.FAULT = -10) RECIPE_ERROR = ON

Get operation number

cseqname.OPERATION
{ISA-S88.01-1995 compliant terminology}
- or -

cseqname.PHASE
{ABB traditional terminology}

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.OPERATION Operation number.
cseqname.PHASE Phase number.

Examples WAIT UNTIL (REACTOR.OPERATION > 1)


IF (TANK.OPERATION < 3) THEN

WBPEEUI330254B3 4 - 43
Common Sequence (Data Structure)

Remarks The data type for the BATCH, CAMPAIGN, LOT, and RECIPE
identifiers depends on the identifier mode. Default mode is
numeric. Using the #ALPHA directive changes the numeric
identifiers to 16 character alphanumeric character strings.
Both client and server parts of the CSEQ connection must be
running in the same mode. A CSEQ function block in numeric
mode can not communicate with a CSEQ function block
running in alpha mode.

Get campaign indentifier

cseqname.CAMPAIGN

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.CAMPAIGN Campaign identifier.
THIS.CAMPAIGN Campaign identifier.

Examples IF (STRG_TANK.CAMPAIGN <> CAMPAIGN) THEN...


IF (HEADER.CAMPAIGN > 0) THEN...

Get batch identifier

cseqname.BATCH

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.BATCH Batch identifier.
THIS.BATCH Batch identifier.

Examples IF (STRG_TANK.BATCH <> BATCH) BNUM_MATCH = OFF


IF (REACTOR.BATCH <> STRG_TANK.BATCH) THEN...

Get lot identifier


cseqname.LOT

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.LOT Lot identifier.
THIS.LOT Lot identifier.

4 - 44 WBPEEUI330254B3
Common Sequence (Data Structure)

Examples IF (STRG_TANK.LOT <> LOG) LNUM_MATCH = OFF


IF (HEADER.LOT < TANK.LOT) THEN...

Get unit recipe identifier

cseqname.RECIPE

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.RECIPE Unit recipe identifier.
THIS.RECIPE Unit recipe identifier.

Remarks The unit procedure name or number is that of the unit proce-
dure that is currently being run by the server program.
Examples IF (REACTOR.RECIPE <> REACTOR_UNIT_PROCEDURE_NO) THEN
IF (PREP_TANK.RECIPE <> INGRED_UNIT_PROCEDURE_NO) THEN

Get target partial unit recipe number

cseqname.TPR

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.TPR Unit recipe identifier.

Remarks The target partial unit recipe identifier is the unit recipe identi-
fier supplied by the owners unit recipe or in the declaration,
along with the CSEQ function block location. The primary use
for this value is to select the unit recipe in the start command.
Examples IF (PREP_TANK.TPR = PREP_TANK.RECIPE) THEN...
IF (REACTOR.TPR = <> PRODUCT_ID_NO) THEN...

Get program ID number

cseqname.PROGRAM

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.PROGRAM Program ID number.

Remarks The program ID number is the ID number of the program that


is currently being run by the server program.

WBPEEUI330254B3 4 - 45
Common Sequence (Data Structure)

Examples IF (DIGESTER.PROGRAM <> VAPOR_PHASE) THEN...


IF (PREP_TANK.PROGRAM <> INGRED_TYPE) THEN...

Get target program ID number

cseqname.TPID

Parameter Description
cseqname Name of the CSEQ block.
cseqname.TPID Target program ID number.

Remarks The cseqname.TPID is the program ID number supplied by the


owners unit procedure or in the declaration, along with the
CSEQ function blocks location. The primary use for this value
is to select the program to be executed by the CSEQ function
block in the start command.
Examples IF (DIGESTER.PROGRAM <> DIGESTER.TPID) THEN...
IF (PREP_TANK.TPID <> PREP_TANK.PROGRAM) THEN...

Get status variable

cseqname.SVn
- or -

THIS.SVn

Parameter Description
cseqname Name of the CSEQ function block.
n Number of status variable (1 - 8).
cseqname.SVn Value of status variable n.
THIS.SVn Value of status variable n. Not supported in PHASEX programs.

Remarks Status variables provide a convenient way for a server program


to send status data to its owner and other client programs. The
server program writes to a status variable using the reference
to itself (THIS). A client program reads a status variable using
the name of the server defined in the declaration of the CSEQ
function block.
Examples (Client) COOLING_STS = COOLING_SYS.SV2
BLOW_TIIME = DIGESTER.SV8

Examples (Server) PARTIAL.STEP_NO = THIS.SV5


SET THIS.SV1 = THIS.CV1

4 - 46 WBPEEUI330254B3
Common Sequence (Data Structure)

Get status string variable

cseqname.STATSTRG
- or -
THIS.STATSTRG

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.STATSTRG Value of the status string variable.
THIS.STATSTRG Value of the status string variable. Not supported in PHASEX programs.

Remarks Status string variables provide a convenient way for a server


program to send alphanumeric data to its owner and other cli-
ent programs. The server program writes to the status string
variable using the reference to itself (THIS). A client program
reads the status string variable using the name of the server
defined in the declaration of the CSEQ function block.
Examples (Client) REACTOR_STATE = REACTOR_EXE.STATSTRG
STRING_VAR = FEED_TANK.STATSTRG

Example (Server) SET THIS.STATSTRG = CURRENT_STATE

Get command variable

cseqname.CVn
- or -

THIS.CVn

Parameter Description
cseqname Name of the CSEQ function block.
n Number of command variable (1 - 8).
cseqname.CVn Target value of command variable n.
THIS.CVn Target value of command variable n. Not supported in PHASEX programs.

Remarks The actual value of a server command variable is equal to the


target value of the owner. If the client is not the owner, its tar-
get values are UNDEFINED.

WBPEEUI330254B3 4 - 47
Common Sequence (Data Structure)

Examples (Client) { Set the variable TGT_BLOW_TIME to the value of DIGESTER.CV4. }


TGT_BLOW_TIME = DIGESTER.CV4
{ Sets the value of the control variable to the value of FIQ1025.VAL. }
SET CSEQ_NAME.CVN = FIQ1025.VAL

Examples (Server) SEQ_STEP_CMD = THIS.CV3


SET STEP_NO_IND.VAL = THIS.CV7

Get command string variable

cseqname.CMDSTRG
- or -

THIS.CMDSTRG

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.CMDSTRG Target value of the command string variable.
THIS.CMDSTRG Actual value of the command string variable. Not supported in PHASEX
programs.

Remarks The actual value of a server command variable is equal to the


target value of the owner. If the client is not the owner, its tar-
get values are UNDEFINED.
Example (Client) RX_STRING = REACTOR_EXEC.CMDSTRG
STRINGX = FEED_TANK.CMDSTGR
SET FEED_TANK.CMDSTRG = “CHARGING UNIT 1”

Example (Server) OP_MSG = THIS.CMDSTRG


STRINGY = THIS.CMDSTRG

Get command pending status

cseqname.CPEND

Parameter Description
cseqname Name of the CSEQ function block.
cseqname.CPEND Value of command pending status:
0 = not waiting (good).
1 = waiting.

4 - 48 WBPEEUI330254B3
Common Sequence (Data Structure)

Remarks This form of the reference is operative only from a client pro-
gram. This reference is intended to give the owner program a
means to verify that CSEQ commands have actually been
received by the server programs CSEQ function block. The
CSEQ function code will not guarantee the synchronous
receipt of the sequential CSEQ commands.
Example WHILE ((FD_TANK.CPEND IS WAITING) AND (FD_TANK.CSTS = 1))
UNTIL (CL_SYS.CPEND <> WAITING) OR (CL_SYS.CSTS <> 1))

Commands Common sequence commands are executed in a manner simi-


lar to function block commands. Commands do not communi-
cate directly with the CSEQ function block. The CSEQ
command is buffered in the CSEQ data structure and the pro-
gram goes on to the next statement. When the client program
reaches a wait state, the command is sent from the CSEQ data
structure to the servers CSEQ function block. There are
important consequences to this approach:

1. CSEQ commands are allowed in all program logic sections


(that is, normal, continuous, fault, etc.).

2. There is a time delay between the issuance of a command


by the client and action taken by the server.

3. If a command is pending (a command statement has been


issued but the command has not been acted upon) and a
counteracting command is executed, the second command
may overwrite the first. For example, if a hold command is fol-
lowed too quickly by a start command, the CSEQ function
block will see only the start command. As another example, if
a command variable update is followed too quickly by another
update of the same command variable, the first value is lost. In
some cases, it may be necessary for the program to control the
order in which commands take effect. This can be
accomplished by checking the appropriate status reference
between commands.
Example HOLD FILL_TANK
WAIT UNTIL (FILL_TANK.XSTS = WAITING)
START FILL_TANK
WAIT UNTIL (FILL_TANK.XSTS = RUNNING)

WBPEEUI330254B3 4 - 49
Common Sequence (Data Structure)

Connect to a CSEQ

CONNECT cseqname

Parameter Description
cseqname Name of the CSEQ function block.

Examples CONNECT FEED_TANK


CONNECT REACTOR

Remarks This command causes a client program to establish a connec-


tion with the specified server CSEQ function block.

If a connection cannot be established or if an established con-


nection fails, the connection status indicates failed. A program
should monitor all of its connections and take appropriate
action in case of a failure.

Unconnect from a CSEQ

UNCONNECT cseqname

Parameter Description
cseqname Name of the CSEQ function block.

Example UNCONNECT REACTOR


UNCONNECT FEED_TANK

Remarks This command causes the client program to unconnect from


the specified server CSEQ function block.

NOTES: A connected client program will be unconnected from a server


CSEQ function block if the following occurs:
1. The connected program terminates or its module leaves execute mode.

2. The module containing the CSEQ function block leaves execute mode.

3. The communication system fails.

When a program becomes unconnected, all pending com-


mands are lost.

4 - 50 WBPEEUI330254B3
Common Sequence (Data Structure)

Acquire ownership of a CSEQ

ACQUIRE cseqname CAMPAIGN = exp1, BATCH = exp2,\


LOT = exp3, [PRIORITY = exp4 ] [OPTIONS = exp5 ]

Parameter Description
cseqname Name of the CSEQ function block.
exp1 through exp3 Campaign, batch and lot identifiers to be passed through to the CSEQ
function block. By use of the reserved words MINE, YOURS and LOCAL,
the client program may specify the CSEQ function block to use values
associated with the client program (MINE) or the server program
(YOURS) or the server block inputs (LOCAL).
exp4 Optional request priority level (1 through 127). One is the highest priority
and 127 is the lowest. If not specified, the request is given a priority of
127. A priority value of -1 specifies a one time request (not queued).
exp5 Specifies the execution status of the CSEQ function block that is required
before ownership is granted.
0 = server program status must be complete.
1 = server program status may be complete, running or holding.

Remarks When a CSEQ function block receives an acquire request and


the CSEQ function block is eligible to be acquired and the
request is qualified, it will grant the request. If the CSEQ func-
tion block is not eligible or the request is not qualified, the
request will either be queued or discarded (one time).

A common sequence is eligible to be acquired if:

1. The CSEQ function block is not owned.

- and -

2. The ownership allow input of the CSEQ function block is


1.0 or 2.0.

- and -
3. The CSEQ function block is inactive, OPTIONS = NORMAL.

- or -

The CSEQ function block is in any state, OPTIONS =


ALLOWED.

WBPEEUI330254B3 4 - 51
Common Sequence (Data Structure)

An acquire request is qualified if:

1. The CSEQ function block is not reserved.

- or -

2. The CSEQ function block is reserved.

- and -

The production ID specified in the ACQUIRE command by


the requestor matches the reservation.

NOTE: When a CSEQ function block is acquired, it receives production ID


information (BATCH, CAMPAIGN, and LOT identifiers) from the owner. The
production ID identifiers do not become active until the CSEQ function block
performs an inactive to run transition. For example, the owner starts the CSEQ
function block from the batch complete state.
Example ACQUIRE FEED_TANK CAMPAIGN = MINE, \
BATCH = YOURS, LOT = 1, PRIORITY = 1
WAIT UNTIL (FEED_TANK.OSTS = OWNED)

Unacquire a CSEQ

UNACQUIRE cseqname

Parameter Description
cseqname Name of the CSEQ or THIS function block.

Remarks The purpose of this command is to counteract an earlier


acquire command.

If the acquire command was queued, the unacquire command


cancels it. In addition to the unacquire command, a queued
acquire command is canceled if the requesting program termi-
nates or stops communicating.

If the acquire command was granted, the unacquire command


(issued by the owner) terminates ownership. The CSEQ func-
tion block becomes unowned and eligible for acquire in the fol-
lowing ways:

NOTES: Unacquire of a CSEQ function block can also happen in the


following ways.
1. The ownership-allow input of the CSEQ block changes to 0.0 or -1.0.
2. The owner program terminates or stops communicating.

4 - 52 WBPEEUI330254B3
Common Sequence (Data Structure)

Examples UNACQUIRE FEED_TANK


UNACQUIRE REACTOR

Reserve a CSEQ

RESERVE cseqname [CAMPAIGN = exp1,] [BATCH = \


exp2,] [LOT = exp3,] [MAINTAIN = exp4]

Parameter Description
cseqname Name of the CSEQ or THIS function block.
exp1 through exp3 Campaign, batch and lot identifiers to be passed through to the CSEQ
function block. By use of the reserved words MINE, YOURS and LOCAL,
the client program may specify the CSEQ function block to be reserved
use values associated with the client program (MINE) or the CSEQ
function block (YOURS) or the server block inputs (LOCAL).
exp4 Reservation status:
0 = reservation is cancelled when ownership is granted.
1 = reservation is maintained when ownership is granted.

Remarks The purpose of this command is to restrict future ownership of


the CSEQ function block. The requesting program specifies
which parameters (BATCH, CAMPAIGN, and LOT) are to be
included in the reservation. If campaign, batch or lot is not
specified in the reserve command then the omitted parameter
is considered as a don't care.

When a CSEQ function block receives a reserve request and


conditions permit, it will grant the request. Otherwise, it will
discard the request. The following conditions must be true for
a reserve request to be granted:

CSEQ function block is not reserved.

- and -

CSEQ function block reserve allow input is 1.0.

The data type for the BATCH, CAMPAIGN, and LOT identifiers
depends on the identifier mode. Default mode is numeric.
Using the #ALPHA directive changes the numeric identifiers to
16 character alphanumeric character strings.
Examples RESERVE REACTOR CAMPAIGN = MINE, BATCH = MINE, \
LOT = YOURS
RESERVE FEEDTANK BATCH = 456

WBPEEUI330254B3 4 - 53
Common Sequence (Data Structure)

Unreserve a CSEQ

UNRESERVE cseqname

Parameter Description
cseqname Name of the CSEQ or THIS function block.

Remarks The purpose of this command is to unreserve a CSEQ function


block. The command is operative only if issued by the CSEQ
function block or its owner.

In addition to this command, a CSEQ function block can


become unreserved in the following ways:

1. The reserve allow input of the CSEQ function block


becomes 0.0.

2. The CSEQ program becomes owned by a qualified program


and the reservation was not specified as MAINTAIN.
Example UNRESERVE REACTOR

Start/restart a CSEQ

START cseqname [RECIPE = exp1] [OPERATION = exp2 ]\


[PROGRAM = exp3]
{ISA-S88.01-1995 compliant terminology}

- or -
START cseqname [RECIPE = exp1] [PHASE = exp2 ]\
[PROGRAM = exp3]
{ABB traditional terminology}

Parameter Description
cseqname Name of the CSEQ function block.
exp1 Unit recipe identifier.
exp2 Operation number.
exp3 Program ID number.

Remarks This command starts or restarts a CSEQ function block. The


CSEQ function block starts if the current status is complete
and restarts if the current status is holding. The command is
ignored if the CSEQ function block is already running.

4 - 54 WBPEEUI330254B3
Common Sequence (Data Structure)

The unit procedure, operation, and program ID specifications


in this command are optional. If not specified, the CSEQ func-
tion block will use its current value for the unspecified item.

This command is operative only if issued by the owner of the


CSEQ function block. This command is disabled while the
CSEQ function block is in the operator mode.

The data type for the RECIPE identifier depends on the identi-
fier mode. Default mode is numeric. Using the #ALPHA direc-
tive changes the numeric identifiers to 16 character
alphanumeric character strings.
Example START REACTOR RECIPE = “PROD_123”, OPERATION = 1
START FEEDTNK RECIPE = 123

Hold a CSEQ

HOLD cseqname

Parameter Description
cseqname Name of the CSEQ function block.

Remarks This command requests a CSEQ function block to switch into


HOLD LOGIC.

The command is ignored if:

1. The CSEQ function block is in operator mode.

- or -

2. The CSEQ function block is holding or complete.

- or -

3. The CSEQ function block is in hold or fault logic.

- or -

4. External hold is disabled.

This command is operative only if issued by the owner of a


CSEQ function block.
Example HOLD REACTOR
HOLD FEEDTNK

WBPEEUI330254B3 4 - 55
Common Sequence (Data Structure)

Commands Use the following statements to tune CSEQ function blocks.

Set a command variable

SET cseqname.CVn = exp


- or -

SET THIS.CVn = exp

Parameter Description
cseqname Name of the CSEQ function block.
n Number of command variable (1 through 8).
exp Value.

Remarks The command variable provides a convenient way for an owner


of a CSEQ function block to send numeric data to the server.
The owner program writes to the command variables using the
name of the CSEQ function block. The server program writes
to the command variables using the name THIS only when the
server is not owned.

This command is operative from the client program only if it is


the owner.

This command is operative from the server program only when


the server is not owned.
Example (Client) SET FILLTANK.CV2 = 3

Example (Server) X = THIS.CV2 {server program}

Set a command string variable

SET cseqname.CMDSTRG = exp

- or -

SET THIS.CMDSTRG = exp

Parameter Description
cseqname Name of the CSEQ function block.
exp Value.

4 - 56 WBPEEUI330254B3
Common Sequence (Data Structure)

Remarks The command string variable provides a convenient way for an


owner of a CSEQ function block to send alphanumeric data to
the server. The owner program writes to the command string
variables using the name of the CSEQ function block. The
server program writes to the command string variables using
the name THIS only when the server is not owned.

This command is operative from the client program only if it is


the owner.

This command is operative from the server program only when


the server is not owned.
Example (Client) SET REACTOR_EXEC.CMDSTRG = “REACTOR READY”

Example (Server) SET THIS.CMDSTRG = STRING_VAR

Set a status variable

SET THIS.SVn = exp

Parameter Description
n Number of status variable (1 through 8).
exp Value.

Remarks The status variables provide a convenient way for a CSEQ


function block to send numeric data to its owner and other
connected programs. The server program writes to a status
variable using the name THIS. The owner or other connected
program reads a status variable using the name of the CSEQ
function block. This command is operative only if issued by
the server.
Example (Client) SET THIS.SV2 = 3

Example (Server) SET THIS.SV7 = THIS.BATCH

Set a CSEQ status string variable

SET THIS.STATSTRG = exp

Parameter Description
exp Value.

WBPEEUI330254B3 4 - 57
CONNECT

Remarks The status string variables provide a convenient way for a


CSEQ function block to send alphanumeric data to its owner
and other connected programs. The CSEQ function block
writes to a status string variable using the name THIS. The
owner or other connected program reads a status string vari-
able using the name of the CSEQ function block. This com-
mand is operative only if issued by the server.
Examples (Server) SET THIS.STATSTRG = “CHARGE ABORTED”
SET THIS.STATSTRG = STRING_VAR

CONNECT
Refer to Common Sequence (Data Structure).

CONST (Data)
Purpose To define a constant.
Language BSEQ, PHASEX, UDF
Declaration The following declaration is used to define a constant.

CONST name = const

Parameter Description
name Name of the constant.
const Value of the constant.

Example CONST MAX_LNT = 10.0

Remarks Refer to BATCH DATA (Statement) and DECLARATIONS


(Statement).
References The value of a constant is read by using its name in an expres-
sion or a definition.
Example IF (X > MAX_LNT) THEN

4 - 58 WBPEEUI330254B3
CONST ARRAY (Data Structure)

CONST ARRAY (Data Structure)


Purpose A CONST ARRAY is a group of constants organized in a table.
An array may have one, two or three dimensions. The array as
a whole will have a name. An individual constant (element) of
an array is identified by an array index which specifies the
position of the element within the array. An array index con-
sists of subscripts - one subscript for each dimension.
Language BSEQ, PHASEX, UDF
Declaration The following statements are used to declare CONST ARRAYS.

{for one dimensional array}


CONST ARRAY name (low :high1) (list )
- or -

CONST ARRAY name (low :* ) (list )

{for two dimensional array}


CONST ARRAY name (low :high1, low :high2 ) (list )
{for three dimensional array}
CONST ARRAY name (low :high1, low :high2, low :high3 ) (list )

Parameter Description
name Name of the array.
low Lowest subscript value (must be 0 or 1).
highN Highest subscript value for the N th dimension. Must be a constant. The total number
of elements in an array must not exceed 16K.
list List of array element names. This one-dimensional list has one entry for each
element of the array. The order of the entries is determined by varying the first (left)
subscript the fastest, then the second and third.
NOTE: For multidimensional arrays the lowest subscript value for all dimensions must match the value specified by the first di-
mension.

Examples In the following examples, the values in the constant list corre-
spond to the respective subscript values.
CONST ARRAY C (1:5) (1, 2, 3, 4, 5)
CONST ARRAY CZ (0:5) (0, 1, 2, 3, 4, 5)
CONST ARRAY CC (1:3, 1:2) (11, 21, 31, 12, 22, 32)
CONST ARRAY CCC (1:2, 1:2, 1:2) (111, 211, 121, 221, \
112, 212, 122, 222)

WBPEEUI330254B3 4 - 59
CONST ARRAY (Data Structure)

Reference CONST ARRAY data structures can be referenced using the


appropriate name in an expression.

Array element

{for one dimensional array}


name (exp1)
{for two dimensional array}
name (exp1, exp2 )
{for three dimensional array}
name (exp1, exp2, exp3 )

Parameter Description
name Name of the array.
expn Value of the nth subscript. If a subscript value
exceeds its specified range, it causes an error.

Examples A = C (5)
A = CC (i, j)
A = CCC (1, 2, i)
CALL MAX (CC (i, j), X)

Entire array - In some operations it is necessary to refer to an


entire array as a whole. An entire array is referenced as
follows:

name
- or -

name (*...)

Parameter Description
name Name of the array.
(*...) Indicates the number of dimensions, (that is (*),(*, *) or
(*, *, *)).

The first form (just the name) is used when an array is passed
as an argument to a function or monitor subroutine. The sec-
ond form is used in other whole array operations (that is, array
copy).
Examples CALL MAX_ELEMENT (C)
XB (*) = C (*)

4 - 60 WBPEEUI330254B3
CONST STRING (Data)

Commands Since constant arrays are read only, there are no commands
to write to them.

NOTE: Subscript range checking is done by the compiler if all of the subscripts
of an array are constant. Range checking is always performed during program
execution. Each time an array element is read, the subscript values are
checked. If a subscript value is out of bounds, some error action is taken. If the
error occurs during any mode other than FAULT mode (for example, NORMAL
mode), the normal flow of control is aborted. The mode is changed to fault and
control is transferred to fault logic with the system generated fault code of -17.
If the error occurs during FAULT mode, flow of control is not aborted. A value of
zero is returned for the incorrectly subscribed array element.

CONST STRING (Data)


Purpose Constant strings can be declared in the BATCH DATA section,
UNIT PARAMETERS section, or any place in the phase, func-
tion, or monitor subroutines. Constant strings can also be
declared in the UNIT DATA section of a program and then
declared again (given a value) in the unit definition file.
Language BSEQ, PHASEX, UDF
Declaration {from the BATCH DATA section of a Batch 90 program}
CONST STRING cstrname = ”string value”

{from the UNIT DATA section of a Batch 90 program}


CONST STRING cstrname [(cons)]

{from the UNIT DATA section of a unit definition file}


CONST STRING name = ”value”
{explicit constant string}
CONST STRING name = ”string_exp”

Parameter Description
cstrname Name of the constant string.
string value Value of the constant string.
cons Maximum number of characters that may be included in the string value
specification in the unit definition file. The default value is 80 characters.
name The same name used in the UNIT DATA section.
value Value of the constant string. This value can not contain more characters than were
specified in the UNIT DATA section of the batch program.
string_exp Explicit constant string used within a string command or reference.

WBPEEUI330254B3 4 - 61
CONST STRING (Data)

Examples CONST STRING CLASS_NAME = “GLASS_LINED_REACTORS”


CONST STRING UNIT_NAME = “REACTOR - R552”
IF (VAR_STR = “SKIP”) THEN...

References CONST STRING data can be read using the appropriate name
in an expression.

Get current string length


cstrname.CLEN

Parameter Description
cstrname Name of the constant string.
cstrname.CLEN The number of characters included in the string value parameter.

Examples SOME_VAR = CLASS_NAME.CLEN


OTHER_VAR = UNIT_NAME.CLEN

Remarks The .CLEN reference returns numerically the maximum and


current number of characters contained within the referenced
constant string. For constant strings, these numbers will be
identical with the possible exception of constant strings
declared within UNIT DATA sections. For constant strings
declared within UNIT DATA sections, this reference will return
the number of characters that were included in the specified
string value from the unit definition file. In the event the spec-
ified string value is shorter than the maximum specified in the
batch program, the constant string will not be back filled with
spaces.
Get maximum string length

cstrname.MLEN

Parameter Description
cstrname Name of the constant string.
cstrname.MLEN The number of characters included in the string value parameter.

Examples SOME_VAR = CLASS_NAME.MLEN


OTHER_VAR = UNIT_NAME.MLEN

Remarks The .MLEN reference returns numerically the maximum and


current number of characters contained within the referenced
constant string. For constant strings, these numbers will be
identical with the possible exception of constant strings

4 - 62 WBPEEUI330254B3
CONST STRING (Data)

declared within UNIT DATA sections. For constant strings


declared in UNIT DATA sections, this reference will return the
maximum number of characters that were specified by the
declaration in the batch program.

Get entire string value

cstrname

Parameter Description
cstrname Name of the constant string.

Examples SOME_VAR_STRING = CLASS_NAME


OTHER_VAR_STRING = UNIT_NAME

Remarks If the referenced constant string is longer than the variable


string, the first x (maximum number of characters for string
variable) characters of the constant string shall be stored in
the variable string.

Get value of a substring


cstrname (FROM exp1[ FOR exp2 ])

Parameter Description
cstrname Name of the constant string.
exp1 First character or starting point of the substring.
exp2 Number of characters to be included in the substring. If not specified, the substring
is terminated at the end of cstrname.

Examples SOME_VSTRING = CLASS_NAME (FROM 1 FOR 11)


OTHER_VSTRING = UNIT_NAME (FROM 11 FOR 14)

Remarks Character positions begin with the left character as character


number one. Subsequent characters are numbered according
to their position relative to character number one. References
that extend beyond the end of the constant string shall be ter-
minated at the end of the constant string.

WBPEEUI330254B3 4 - 63
CONST STRING ARRAY (Data Structure)

CONST STRING ARRAY (Data Structure)


Purpose A CONST STRING ARRAY is a group of constants organized
into an array. An array may have one, two or three dimen-
sions. The array as a whole has a name. An individual con-
stant string (element) of an array is identified by an array
index that specifies the position of the element within the
array. An array index consists of subscripts - one subscript for
each dimension.
Language BSEQ, PHASEX, UDF
Declaration The following statements are used to declare constant string
arrays.

{for one dimensional array}


CONST STRING ARRAY name (low :high1) [=] (list )

{for two dimensional array}


CONST STRING ARRAY name (low :high1, [low :]high2 ) [=] \
(list )

{for three dimensional array}


CONST STRING ARRAY name (low :high1, [low :]high2, \
[low :] high3 ) [=] (list )

Parameter Description
name Name of the array.
low Lowest subscript value (must be 0 or 1).
highN Highest subscript value for the N th dimension. Must be a constant. The total number
of elements in an array must not exceed 16K.
list List of array element names. This one-dimensional list has one entry for each
element of the array. Elements can be either explicit strings enclosed by quotation
marks or names of previously defined constant strings. The order of the entries is
determined by varying the first (left) subscript the fastest, then the second and third.
NOTE: For two and three dimensional arrays the lowest subscript value for the second and third dimension must match the value
that was specified by the first dimension.

4 - 64 WBPEEUI330254B3
CONST STRING ARRAY (Data Structure)

Examples CONST STRING ARRAY C (1:3) (STRING1, STRING2, STRING3)


CONST STRING ARRAY CZ (0:4) (STRING0, STRING1, STRING2, \
STRING3)
CONST STRING ARRAY RESPONSES (1:3) (OPERATOR \
RESPONSE MESSAGE #1”, “OPERATOR RESPONSE MESSAGE #2”,\
OPERATOR RESPONSE MESSAGE #3”)

Reference CONST STRING ARRAY data structures can be referenced


using the appropriate name in an expression.

Array element

{for one dimensional array}


name (exp1)
{for two dimensional array}
name (exp1, exp2 )
{for three dimensional array}
name (exp1, exp2, exp3 )

Parameter Description
name Name of the array.
expn Value of the n th subscript. If a subscript value
exceeds its specified range, it causes an error.

Examples ASTRING = C (3)


ASTRING = CC (i, j)
ASTRING = CCC (1, 2, k)
SUBSTRING = CC (i, j) (FROM 6 FOR 15)

Entire array - In some operations it is necessary to refer to an


entire array as a whole. An entire array is referenced as
follows:

name
- or -

name (*...)

Parameter Description
name Name of the array.
(*...) Indicates the number of dimensions, (that is, (*), (*, *) or (*, *, *)).

WBPEEUI330254B3 4 - 65
CONTINUOUS (Statement)

The first form (just the name) is used when an array is passed
as an argument to a function or monitor subroutine. The sec-
ond form is used in other whole array operations (that is, array
copy).
Example NEW_ARRAY (*) = OLD_ARRAY (*)

Commands Since constant string arrays are read only, there are no com-
mands to write to them.

NOTE: Subscript range checking is done by the compiler if all of the subscripts
of an array are constant. Range checking is always performed during program
execution. Each time an array element is read, the subscript values are
checked. If a subscript value is out of bounds, some error action is taken. If the
error occurs during any mode other than FAULT mode (for example, NORMAL
mode), the normal flow of control is aborted. The mode is changed to fault and
control is transferred to fault logic. If the error occurs during FAULT mode, flow
of control is not aborted.

CONTINUOUS (Statement)
Purpose This statement marks the beginning of the CONTINUOUS sec-
tion of a phase, state, or monitor subroutine. This section pro-
vides continuous operations specific to the subroutine. This is
the only executable section of a monitor subroutine.
Language BSEQ, PHASEX, UDF
Format CONTINUOUS [LOGIC]
statement



statement
Example CONTINUOUS
IF (FIC501.STS = BAD) FAULT 4
IF (FIC502.STS = BAD) FAULT 5

Remarks When the phase or state subroutine is active, this section exe-
cutes continuously (the entire section is executed once every
function block cycle). It executes in all modes (that is, normal,
fault, etc.). No loops (except FOR LOOP) or waits are allowed
in this section.

4 - 66 WBPEEUI330254B3
Control Station (Function Block)

Control Station (Function Block)


Purpose Control station function blocks (FC 80) provide an interface
between the control module and operator workstations. A con-
trol station provides several modes for managing its set point
and control output.
Language BSEQ, PHASEX, UDF
Declaration Before a control station can be accessed from a subroutine, it
must be declared. The declaration can appear only in a data
section.

BLOCK csname, BLK = const, FC = CS [, WATCH]

Parameter Description
csname Name of the control station function block.
const Function block address.
WATCH Control station to be placed on watch by the batch historian upon program
(BSEQ only) startup. If not specified, the control station will be off watch.

Example BLOCK FC501, BLK = 100, FC = CS

References Control station data may be read by using the appropriate


name in an expression.

csname.data

Parameter Description
csname Name of the control station function block.
data Type of data being read.
CO Control output
DAL Deviation alarm status:
1 (true) = deviation alarm.
0 (false) = not deviation alarm.
HAL High alarm status:
1 (true) = high alarm.
0 (false) = not high alarm.
LAL Low alarm status:
1 (true) = low alarm.
0 (false) = not low alarm.

WBPEEUI330254B3 4 - 67
Control Station (Function Block)

Parameter Description
data Type of data being read.
(continued)
MODE Mode:
0 = manual.
1 = auto.
2 = cascade/ratio.
PV Process variable.
RX Ratio index.
SP Set point.

Commands Use the following statement to tune control station function


blocks.

SET csname .data = exp

Parameter Description
csname Name of the control station function block.
data Type of data being set.
CO Control output
MODE Mode:
0 = manual.
1 = auto.
2 = cascade/ratio.
RX Ratio index.
SP Set point.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.

Examples SET FC501.CO = 53.2


SET CS501.WATCH = ON

Remarks These commands act like workstation commands. Specifically,


the control station may refuse a command depending on the
mode and auxiliary logic effecting the station. For example, if
the output of a station is in CO track or the station is in auto-
matic, the SET.CO statement is ignored. These commands are
buffered within the function block and do not have an immedi-
ate effect on the function block. The command will not take
effect until the function block executes on its next cycle.

4 - 68 WBPEEUI330254B3
CYCLE TIME (Variable)

CYCLE TIME (Variable)


Purpose CYCLE TIME is a built-in, read-only variable. Value of the
CYCLE TIME variable is the elapsed time (in seconds) from the
start of the previous function block cycle to the start of the
current cycle.
Language BSEQ, PHASEX, UDF
Declaration Not required.
References CYCLE TIME is read by using it in an expression.
Example TOTAL = TOTAL + CYCLE TIME

DATA (Statement)
Purpose This is the first statement of the data section of a UDF pro-
gram. This section defines global data, function codes, and
symbols. All declarations in the data section are global since
they can be referenced by all function and monitor subrou-
tines in the UDF program.

There may be more than one data section in a program. The


second data section is often used to declare global monitor
subroutines.Since global monitor subroutines must be defined
in the program before they are declared, the second data sec-
tion should appear after the monitor subroutine definitions.
Language UDF
Format DATA
type1 name1
type2 name2



END DATA

Parameter Description
type Any one of the following:
AUX Auxiliary UDF function block.
BLOCK Function block.
CONST Constant.
CONST ARRAY Constant array.
FGEN Function generator.

WBPEEUI330254B3 4 - 69
DATA (Statement)

Parameter Description
type (continued) VAR ARRAY Variable array.
INPUT UDF block input.
INTEGRATOR Global integrator.
MONITOR Monitor call.
OUTPUT UDF block output.
RAMP Ramp.
SPEC UDF block specification.
TIMER Timer.
UDF1 UDF type one.
UDF2 UDF type two.
VAR Variable.
name Name of the data.

Example DATA
INPUT 1 P105, FC = MSDD
INPUT 2 FIC105, FC = CS
OUTPUT 0 FE105_DT
OUTPUT 1 FQ105
SPEC 9 DELTA_T
SPEC 10 MAX_CHARGE
CONST NOT_OPEN = 0
VAR SUM
BLOCK START_PB, BLK = 125, FC = RCM
END DATA

Remarks For function block declaration details, refer to:

AOL Analog exception report


APID Advanced PID
BBUF Boolean data buffer
CS Control station
CSEQ Common sequence
DATAEXPT User defined data export
DOL Digital exception report
DD Device driver
MSDD Multistate device driver
RBUF Real data buffer
RCM Remote control memory
REMSET Remote manual set constant
RMC Remote motor control
SMITH Smith block
TEXT Text

4 - 70 WBPEEUI330254B3
Data Buffer (Function Block)

Other function codes may be referenced by their function code


number.

Data is initialized when a UDF program is run for the first time
(that is, on the multifunction processor transition to execute).

The active data structures (for example, timers and monitor


calls) execute independently of the active state subroutine.
Active data structures declared in a data section are some-
times referred to as being global. Their values are initialized to
zero at the start of the UDF sequence. They are never initial-
ized again unless explicitly done so through a statement such
as RESET.

Data Buffer (Function Block)


Purpose The data buffer function blocks (FCs 137, 138) provide the
general mechanism for getting data from a batch or UDF pro-
gram to the function blocks. FC 137 is the real buffer, and FC
138 is the boolean buffer. A batch or UDF subroutine writes to
the buffer function blocks using the statements described
below. The data is then available (in the form of function block
outputs) to the other function blocks.
Language BSEQ, PHASEX, UDF
Declaration Before a data buffer can be accessed from a subroutine, it
must be declared. The declaration can appear only in the
batch data section of a batch program.

BLOCK fbname, BLK = const, FC = fc [, OUT (0) = \


oname0] [, OUT (1) = oname1] [, OUT (2) = oname2 ] \
[, OUT (3) = oname3 ]

Parameter Description
fbname Name of the data buffer function block.
const Function block address.
fc Function code name:
RBUF (FC 137.).
BBUF (FC 138.).
oname0 Name of output 0.
oname1 Name of output 1.

WBPEEUI330254B3 4 - 71
Data Buffer (Function Block)

Parameter Description
oname2 Name of output 2.
oname3 Name of output 3.

Example BLOCK BUF01, BLK = 100, FC = RBUF, OUT (0) = FT501, \


OUT (1) = FT502, OUT (3) = FT504

Reference Data buffer output data can be read using the appropriate
name in an expression.

oname.VAL

Parameter Description
oname Name of the data buffer function block output.
oname.VAL Output value.

Example X = FT501.VAL

Commands Use the following statement to tune data buffer function


blocks.

SET oname .data = exp

Parameter Description
oname Name of the data buffer function block output.
data Type of data being set.
Q Output quality.
VAL Output value.
exp New value of data.

Examples SET FT501.VAL = 100.0


SET FV501.Q = BAD

NOTE: If oname is an BBUF (FC 138), a value >= -0.5 and < 0.5 is considered
false (0), otherwise it is true (1).

4 - 72 WBPEEUI330254B3
Data Export (Function Block)

Data Export (Function Block)


Purpose Data export function codes (DATAEXPT, FC 194) enable the
batch program to display operator messages at the operator
workstation as well as receive text string inputs from the work-
station. The DATAEXPT function block can be declared in the
BATCH DATA or UNIT DATA sections of a batch program or in
the DATA section of a UDF program.
Language BSEQ, PHASEX, UDF
Declaration BLOCK strblk, BLK = cons1, FC = DATAEXPT

Parameter Description
ctrblk Name of the DATAEXPT function code.
cons1 Block address of the DATAEXPT function block.

Examples BLOCK DIALOGUE, BLK = 1024, FC = DATAEXPT


BLOCK STATUS_IND, BLK = 9021, FC = DATAEXPT

Remarks Batch programs are able to write strings to the DATAEXPT


function block only if specifications S1, S2, and S3 are set to a
value of two (default value). The data export function block
actually contains two separate strings. The input string
corresponds to the operator entered response strings received
from the operator workstation. The output string corresponds
to the output of the function block. The relationship between
the input and output strings is determined by the mode and
data interlock status of the DATAEXPT function block. Both
mode and data interlock attributes may be read or written by
the batch program when specifications S1, S2, and S3 are set
to a value of two.
References DATAEXPT data may be read using the appropriate name in
an expression.

strblk.data

WBPEEUI330254B3 4 - 73
Data Export (Function Block)

Parameter Description
strblk Name of the DATAEXPT function block.
data Type of data being read.
ALM Alarm status:
0 = no alarm.
1 = level one alarm.
2 = level two alarm.
3 = level three alarm.
CLEN Number of characters in the current input string value.
DILK Data interlock status:
0 = unlocked.
1 = locked.
ISTR Entire input string value of last operator entry.
MLEN Maximum number of characters in either string value (spec S4).
MLOCK Control mode change status:
0 = mode change unlocked (enabled).
1 = mode change locked (disabled).
MODE Control mode:
0 = manual.
1 = auto.
New New value status:
0 = new value has not changed (false).
1 = new input string value exists (true).
OSTR Entire output string value.
Q Current quality status:
0 = good.
1 = bad.
REALM A 0 to 1 or 1 to 0 transition in value indicates the function block has
gone into or out of realarm condition.
TRUNC Truncation status:
0 = string value not truncated (false).
1 = string value truncated (true).

Examples SOME_VAR = DIALOGUE.ALM


IF (STATUS_IND.ALM > 0) OTHER_VAR = TRUE
IF (DIALOGUE.TRUNC = TRUE)...
IF (STATUS_IND.TRUNC)...

Remarks In auto mode, only the batch program can write new output
string values. In manual mode, the output string may be writ-
ten by the batch program as well as echo the input string

4 - 74 WBPEEUI330254B3
Data Export (Function Block)

received from the operator workstation. The initial mode of the


DATAEXPT function block upon startup is manual.

The data interlock status of the DATAEXPT function block


determines what the function block does with input string
from the operator workstation. When the interlock status is
locked (1), messages received from the console are ignored.
When the interlock status is unlocked (0), messages from the
workstation are read into the input string of the function
block. The control mode determines whether or not the mes-
sage is echoed by the output string. The initial interlock status
of the DATAEXPT function block upon startup is locked.

If the mode lock status is unlocked, the mode of the function


block can be changed by the operator of an OIS console or by
the batch program. If the mode lock status is locked, the mode
of the function block can not be changed. The initial mode lock
status of the DATAEXPT function block upon startup is
unlocked.

The NEW reference may be used by a batch program to deter-


mine when a new message has been received from the operator
workstation. The status is latched in the true state when a new
input string is received. It remains latched until reset by a
read operation from the batch program.

When a string value exceeding the maximum string length


specification of the function block is being written, the func-
tion block truncates the string, writes the value, and sets a
flag.

The quality status of the DATAEXPT function block upon star-


tup is determined by the startup control specification S6. If the
specification is set to a value of zero, the quality on startup is
bad. If the specification is set to one, the quality on startup is
forced to good.

The realarm status may be read by batch programs. The


realarm condition is indicated by a change in the .REALM
value.

WBPEEUI330254B3 4 - 75
Data Export (Function Block)

Commands Use the following statements to tune data export function


codes.

SET strblk.OSTR = strname [(FROM exp1 FOR exp2 )]

- or -
SET strblk.OSTR = “string_exp”

Parameter Description
ctrblk Name of the DATAEXPT function block.
strname Name of the constant or variable string.
exp1 Starting point within the string.
exp2 Number of characters to be included in the substring. If not specified, the entire
contents of strname is written to the output string.
string_exp Explicit constant string to be written to the output string.

Examples SET DIALOGUE.OSTR = “PROCESS CRITICAL !”


SET STATUS_IND.OSTR = REQUIRED_ACTION (FROM 1 FOR 32)

Remarks The entire output string will be written. The ability to write to
substrings within the output string is not supported.

SET strblk.data = exp

Parameter Description
strblk Name of the DATAEXPT function block.
data Type of data being set.
ALM Alarm status:
0 = no alarm.
1 = level one alarm.
2 = level two alarm.
3 = level three alarm.
DILK Data interlock status:
0 = unlocked.
1 = locked.
MLOCK Control mode lock status:
0 = unlocked.
1 = locked.
MODE Control mode:
0 = manual.
1 = auto.

4 - 76 WBPEEUI330254B3
Data Export (Function Block)

Parameter Description
data Type of data being set.
(continued)
Q Quality status:
0 = good.
1 = bad.
exp New value of data.

Examples SET STATUS_IND.ALM = 2


SET DIALOGUE.DILK = 0
SET STATUS_IND.MLOCK = ON
SET DIALOGUE.MODE = AUTO
SET STATUS_IND.Q = 1

Remarks DILK - The data interlock status of the DATAEXPT function


block determines what the function block does with input
string from the operator workstation. When the interlock sta-
tus is locked (1), messages received from the console are
ignored. When the interlock status is unlocked (0), messages
from the workstation are read into the input string of the func-
tion block. The control mode determines whether or not the
message is echoed by the output string. The initial interlock
status of the DATAEXPT function block upon startup is
unlocked.

MLOCK - If the mode lock status is unlocked, the mode of the


function block can be changed by the operator of an operator
workstation or by the batch program. If the mode lock status is
locked, the mode of the function block can not be changed.
The initial mode lock status of the DATAEXPT function block
upon startup is unlocked.

MODE - In auto mode, only the batch program can write new
output string values. In manual mode, the output string may
be written by the batch program as well as echo the input
string received from the operator workstation. The initial mode
of the DATAEXPT function block upon startup is manual.

Q - Character positions begin with the left character as char-


acter number one. Subsequent characters are numbered
according to their position relative to character number one.
References that extend beyond the end of the constant string
shall be terminated at the end of the constant string.

WBPEEUI330254B3 4 - 77
#DEBUG LEVEL (Directive)

#DEBUG LEVEL (Directive)


Purpose The #DEBUG LEVEL directive tells the compiler to set the
debug level for the statements that follow the directive. A
higher debug level causes more statements to be debuggable
but causes the programs object file to be larger. A lower debug
level causes fewer statements to be debuggable but causes the
object file to be smaller.
Language BSEQ, PHASEX, UDF
Format #DEBUG LEVEL = const

Parameter Description
const A number from 1 to 4.

Example #DEBUG LEVEL = 4

Remarks Refer to the Batch Data Manager instruction for a descrip-


tion of the debug level function and how the debugger oper-
ates. Debug level determines which lines of the program may
be stopped at and what the N+7 (line number of the program)
output of the BSEQ function block is. There is no correspond-
ing output for the PHASEX function block. The debug levels
are:

Level 4 - Can stop at all executable lines of code.

Level 3 - Can stop at every occurrence of:

CALL
CASE
CONTINUOUS logic declaration
ENDSUBR for monitor and function subroutines
FAULT logic declaration
FOR...END FOR loop
FUNCTION subroutine declaration
HOLD logic declaration
IF
MONITOR subroutine declaration
NORMAL logic declaration
PHASE subroutine declaration
REPEAT...UNTIL
RESTART logic declaration
SET AND WAIT

4 - 78 WBPEEUI330254B3
DECLARATIONS (Statement)

WAIT FOR
WAIT UNTIL
WAIT WHILE
WHILE... ENDWHILE

Level 2 - Can stop at every occurrence of:

CALL
ENDSUBR of monitor and function subroutines
MONITOR subroutine declaration
SET AND WAIT
WAIT

Level 1 - Can stop at every occurrence of:

SET AND WAIT


WAIT

Level 0 - Will not stop at any line of code.

This directive can be used anywhere in a program and as


many times as desired. Different parts of the program may be
at different debug levels.

DECLARATIONS (Statement)
Purpose This statement marks the beginning of a DECLARATIONS sec-
tion. Refer to BATCH DATA (Statement), DATA (Statement),
FUNCTION (Subroutine), MONITOR (Subroutine), PHASE
SUBR (Subroutine), and STATE SUBR (Subroutine) for
details.
Language BSEQ, PHASEX, UDF

WBPEEUI330254B3 4 - 79
#DESCRIPTOR (Directive)

#DESCRIPTOR (Directive)
Purpose This directive assigns a 16 character descriptor to the pro-
gram. This descriptor is displayed by the various utilities to
make it very clear what each object file represents.
Language BSEQ, PHASEX, UDF
Format #DESCRIPTOR ”string”

Parameter Description
string Up to 16 ASCII characters.

Example #DESCRIPTOR ”K41 BATCH LOGIC”

NOTE: If the descriptor specified by string contains more than 16 characters,


the compiler truncates the descriptor to the first 16 characters and generates a
warning.

Device Driver (Function Block)


Purpose Device driver function blocks (FC 123) are used to control
two-state devices (for example, opened and closed).
Language BSEQ, PHASEX, UDF
Declaration A device driver must be declared before it can be accessed
from a subroutine. The declaration must appear in a BATCH
DATA (BSEQ and PHASEX), UNIT DATA (BSEQ and PHASEX),
or DATA (UDF) section. BSEQ, PHASEX, and UDF languages
will only manipulate device driver function blocks in which
specification S1 is set to zero.

BLOCK ddname, BLK = const, FC = DD [co_action]


[, WATCH]

Parameter Description
ddname Device driver function block name.
const Function block address.
co_action Specifies whether the control output value is to be inverted as it passes to and
from the function block domain (NORMAL-normal CO value, INVERT-inverted
CO value). If no action is specified, NORMAL is assumed.
WATCH Specifies device driver to be placed on watch by the batch historian upon
(BSEQ only) program startup. If not specified, the device drive will be off watch.

4 - 80 WBPEEUI330254B3
Device Driver (Function Block)

Examples BLOCK FV501, BLK = 100, FC = DD NORMAL


BLOCK FV502, BLK = 150, FC = DD INVER

References Device driver data may be read by using the appropriate name
in an expression.

ddname .data

Parameter Description
ddname Device driver function block name.
data Type of data being read.
CO Control output.
MODE Mode:
0 = manual.
1 = auto.
STS Status:
0 = good.
1 = bad.
2 = waiting.
TRK Tracking status:
0 = tracking off.
1 = tracking on.

Examples X = FV501.CO (Refer to Co-Action in DECLARATIONS (Statement).)


IF (FV501.MODE IS AUTO) THEN
IF (FV501.STS = BAD) THEN
IF (FV501.TRK = 0) FAULT 15

Remarks STS - The time duration used by the device driver function
block when waiting to verify its feedback inputs is determined
by specification S9 of the function block.
Commands Use the following statements to tune device driver function
blocks.

SET ddname.data = exp

Parameter Description
ddname Device driver function block name.
data Type of data being set.
CO Control output.
MODE Mode:
0 = manual.
1 = auto.

WBPEEUI330254B3 4 - 81
Device Driver (Function Block)

Parameter Description
data Type of data being set.
(continued)
OVR Status override value:
0 = override off.
1 = override on.
TRK Device tracking:
0 = off.
1 = on.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Examples SET FV501.CO = 1


SET FV501.MODE = 1
SET FV501.OVR = ON
SET FV505.TRK = ON
SET FV505.WATCH = ON

Remarks CO - The operation of the CO command depends on the mode


and tracking status of the function block:

1. If the mode is auto, the control output state is set to exp.

2. If the mode is not auto and tracking is disabled, exp is


recorded inside the function block, but the control output
state is not updated. If the mode is later changed to auto, then
the control output state is updated.

3. If the mode is not auto and tracking is enabled, the com-


mand has no effect.

The command retries the operation (once per cycle) while


waiting.

Confirmation does not require that the mode is auto. It


requires the feedback status is good and the control output is
in the specified state.
TRK - The purpose of control output tracking is to provide a
bumpless transfer of the control output during a mode change
from manual to auto. In manual mode, the operator controls
the control output value. If tracking is disabled and the mode
is changed from manual to auto, the control output will go to
the last value that was written to the function block by the
program (that is, the control output may bump). If tracking is

4 - 82 WBPEEUI330254B3
Digital Exception Report (Function Block)

enabled, the control output value will remain unchanged dur-


ing the mode change. The initial value of tracking status (when
the control module is placed into the execute mode) is off.

WATCH - These commands are buffered within the function


block and do not have an immediate effect on the function
block. The command will not take effect until the function
block executes on its next cycle.

SET AND WAIT ddname.CO = exp

Parameter Description
ddname Device driver function block name.
exp Control output.

Remarks The SET AND WAIT version of this command performs this
operation and then waits for confirmation (that is, the control
output state is equal to exp and the feedback status is good).

Digital Exception Report (Function Block)


Purpose The digital exception report (DOL, FC 45) transmits a digital
(boolean) value and its attributes (quality and alarm) via con-
trol network to operator workstations and other nodes.
Language BSEQ, PHASEX, UDF
Declaration Each DOL function block to be used by a batch program must
be declared as follows:

NOTE: Input S1 of the DOL function block must be set to two. Otherwise, batch
program commands will be ignored.

BLOCK name, BLK = const, FC = DOL [, WATCH]

Parameter Description
name Name of the function block.
const Function block address.
WATCH The DOL function block placed on watch by the batch historian on program
(BSEQ only) startup. If WATCH is not specified, the initial watch status is off.

Example BLOCK DOL501, BLK = 240, FC = DOL

WBPEEUI330254B3 4 - 83
Digital Exception Report (Function Block)

References DOL data may be read by using the appropriate name in


expression.

name.data

Parameter Description
name Name of the DOL function block.
data Type of data being read.
ALM Current alarm status:
0 = no alarm.
1 = alarm.
AMSK Current alarm mask:
0 = forced no alarm.
1 = forced alarm.
2 = not forced.
Q Current quality:
0 = good.
1 = bad.
QMSK Current quality mask:
0 = forced good.
1 = forced bad.
2 = not forced.
VAL Current value.

Examples X = DOL501.ALM
X = DOL501.AMSK
X = DOL501.Q
X = DOL501.QMSK
X = DOL501.VAL

Commands The following statement is used to control DOL function


blocks.

SET name.data = exp

Parameter Description
name Name of the DOL function block.
data Type of data being set.
AMSK Alarm mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.

4 - 84 WBPEEUI330254B3
DIGIT (Function)

Parameter Description
data Type of data being set.
(continued)
QMSK Quality mask:
0 = forced 0 (good).
1 = forced 1 (bad).
2 = not forced.
VAL Value.
WATCH Batch historian watch status (Batch 90):
0 = off.
1 = on.
exp New value of data.

Example SET DOL501.AMSK = FORCED_OFF


SET DOL501.QMSK = 0
SET DOL501.VAL = 0
SET DOL501.WATCH = ON

DIGIT (Function)
Purpose The digit function extracts a single digit from a decimal
number.
Language BSEQ, PHASEX, UDF
Format DIGIT (exp1,exp2 )

Parameter Description
exp1 Number from which digit is to be extracted.
exp2 Digit position.

Examples IF (DIGIT (FV501.FBT, 2) = 1) THEN


IF (DIGIT (DE201, 1) = 5) THEN

NOTE: Digits are numbered from right to left, starting with zero for the units
digit. For example, the result of digit (678, 0) is eight. The result of digit
(678, 1) is seven.
Remarks A common use for this operation is to examine feedback tar-
gets and values of a multistate device driver function block.
The .FBT reference extension returns a four digit value.
Figure 4-2 shows the digit positions for the feedbacks on the
multistate device driver.

WBPEEUI330254B3 4 - 85
DISABLE EXTERNAL HOLD (Statement)

F E E D B AC K 1
F E E D B AC K 2
F E E D B AC K 3
F E E D B AC K 4

4-D IG IT N U M B E R (F E E D B AC K
n n n n = F R O M M U LT I-S TAT E D E V IC E
D R IV E R )

D IG IT 0
D IG IT 1
D IG IT 2
D IG IT 3
T030 44A

Figure 4-2. Multistate Device Driver Digit Positions

Examples FEEDBACK_1 = DIGIT (MSDD_1.FBT, 3)


FEEDBACK_3 = DIGIT (MSDD_1.FBT, 1)

DISABLE EXTERNAL HOLD (Statement)


Purpose This statement disables external hold; that is, it causes the
BSEQ function block to ignore the hold state of its run/hold
input (specification S3) and the PHASEX function block to
ignore the hold command. There is a complementary ENABLE
EXTERNAL HOLD statement. These two statements allow a
batch program to have critical sections of code that cannot
be interrupted by the operator.
Language BSEQ, PHASEX
Format DISABLE EXTERNAL HOLD
Example DISABLE EXTERNAL HOLD



ENABLE EXTERNAL HOLD

Remarks Once external hold is disabled, it remains disabled until


explicitly enabled by the program. External hold can also be
disabled by the debugger utility.

4 - 86 WBPEEUI330254B3
DISABLE FAULT CODE (Statement)

DISABLE FAULT CODE (Statement)


Purpose This statement disables fault code: that is, it causes subse-
quent FAULT statements to be ignored.
Language BSEQ, PHASEX, UDF
Format DISABLE FAULT CODE
Example DISABLE FAULT CODE



ENABLE FAULT CODE

Remarks Refer to ENABLE FAULT CODE (Statement) statement and


FAULT (Statement) statement.

NOTE: Run-time errors indicated by negative fault code numbers are not dis-
abled by this statement.

DONE (Statement)
Purpose The DONE statement indicates that a batch program has
finished.
Language BSEQ
Format DONE
Example DONE

Remarks This statement terminates execution of the batch program and


sets the program status to BATCH COMPLETE (inactive).

#EJECT (Directive)
Purpose The #EJECT directive tells the compiler to insert a form feed in
the listing file. This is used to separate pages in the printed
listing.
Language BSEQ, PHASEX, UDF
Format #EJECT
Example #EJECT

Remarks This directive has no effect on the Batch Data Manager.

WBPEEUI330254B3 4 - 87
ENABLE EXTERNAL HOLD (Statement)

ENABLE EXTERNAL HOLD (Statement)


Purpose This statement enables external hold; that is, it causes the
BSEQ function block to recognize the hold state of its Run/
Hold input (S3) and the PHASEX hold command. There is a
complementary DISABLE EXTERNAL HOLD statement. These
two statements allow a batch program to have critical sections
of code which cannot be interrupted by the operator.
Language BSEQ, PHASEX
Format ENABLE EXTERNAL HOLD
Example DISABLE EXTERNAL HOLD



ENABLE EXTERNAL HOLD

Remarks Once external hold is disabled, it remains disabled until


explicitly enabled by the program. External hold can also be
disabled by the debugger utility. This statement does not effect
the disable request of the debugger utility.

ENABLE FAULT CODE (Statement)


Purpose This statement is the inverse of the DISABLE FAULT CODE
statement (it clears the condition set by the DISABLE FAULT
CODE statement).
Language BSEQ, PHASEX, UDF
Format ENABLE FAULT CODE
Example DISABLE FAULT CODE



ENABLE FAULT CODE

Remarks Refer to FAULT (Statement) statement.

4 - 88 WBPEEUI330254B3
ENDSUBR (Statement)

ENDSUBR (Statement)
Purpose This statement marks the end of a subroutine (phase (Batch
90 and PHASEX), state (UDF), function, or monitor).
Language BSEQ, PHASEX, UDF
Format ENDSUBR [name]

Parameter Description
name Name of the subroutine (optional).

Example ENDSUBR ADD_A

NOTE: A warning is generated if name does not match the subroutines name.

FAULT (Statement)
Purpose The FAULT statement changes the mode of a phase (BSEQ and
PHASEX) or state (UDF) subroutine to FAULT; that is, it trans-
fers control from the current logic section (NORMAL, HOLD or
RESTART) to the FAULT LOGIC section.
Language BSEQ, PHASEX, UDF
Format FAULT exp

Parameter Description
exp Value to be assigned to the built-in status variable named
fault code. This value must be positive.

Examples CONTINUOUS



IF ( ...) FAULT 10



FAULT LOGIC

IF (FAULT CODE IS 10) THEN


SET FV501.CO = OPEN
SET AG1.CO = ON
ENDIF

WBPEEUI330254B3 4 - 89
FAULT LOGIC (Section)

IF (FAULT CODE = 10) THEN


SET FV502.CO = OPEN
SET AG1.CO = OFF
ENDIF

Remarks FAULT CODE provides a convenient way to pass a small


amount of information to the FAULT LOGIC. The value is read
by using FAULT CODE in an expression. The fault statement
may not be used in the FAULT LOGIC section.
The fault statement has no effect if fault code is disabled. Any
one of the following conditions disables the fault code.

1. Program disable - set by DISABLE FAULT CODE, cleared


by ENABLE FAULT CODE.

2. Restart disable - set by transition to RESTART LOGIC,


cleared by ENABLE FAULT CODE or transition to NORMAL
LOGIC.

3. Debug disable - set and cleared by debugger utility.

FAULT LOGIC (Section)


Purpose This statement marks the beginning of a phase (BSEQ and
PHASEX) or state (UDF) subroutines FAULT LOGIC section. It
provides the sequential control of an operation in fault mode.
Language BSEQ, PHASEX, UDF
Format FAULT LOGIC
statement



statement
Example FAULT LOGIC
SET FIC401.CO = OPEN
SET FIC402.CO = CLOSED

Remarks The FAULT LOGIC section is activated when the program


sequence mode is changed from HOLD, NORMAL or RESTART
to FAULT.
When the last statement of this section is executed, the pro-
gram sequence enters the held state for the BSEQ function

4 - 90 WBPEEUI330254B3
FIRST CYCLE (Variable)

code or stopped state for the PHASEX function code and all
phase activity is suspended. Refer to Appendix A for more
information about phase execution.

When the program sequence state is changed to run, sequen-


tial control is transferred to the RESTART LOGIC of the cur-
rent phase, or if a new phase has been selected, then control
starts with the NORMAL LOGIC of the new phase.

If the FAULT LOGIC executes a RESTART statement, control is


transferred directly to the RESTART LOGIC.

FIRST CYCLE (Variable)


Purpose FIRST CYCLE is a built-in status variable. It is true during the
first cycle of any subroutine and false thereafter.
Language BSEQ, PHASEX, UDF
Declaration Not required.
References FIRST CYCLE is read by using it in an expression.
Example IF (FIRST CYCLE) THEN
X = 10
ENDIF

FOR...END FOR Loop (Control Structure)


Purpose This looping structure repeatedly executes a block of state-
ments while the specified loop test is true.
Language BSEQ, PHASEX, UDF
Format FOR var = const1 [STEP const1 ]TO const2 DO
statement1



statementN
END FOR [var ]

- or -

FOR var = const1 [STEP const1 ]WHILE exp3 DO


statement1

WBPEEUI330254B3 4 - 91
FOR...END FOR Loop (Control Structure)



statementN
END FOR [var ]

Parameter Description
var Loop variable.
exp1 Initial value of var.
const1 Step value. This value may be positive or negative. This term (STEP const1) is
optional. If this value is omitted, a value of one is used.
exp2 Final value of loop variable. The loop test compares loop variable to final value. The
sense of comparison depends on sign of step value. If step is positive, loop test is
var <= final value. If step is negative, loop test is var >= final value.
exp3 Loop test expression.

Examples FOR I = 1 TO 5 DO A(I) = 1{Executes 5 times}


END FOR
FOR I = 5 STEP -1 TO 2 DO A(I) = 1{Executes 4 times}
END FOR
FOR I = 1 WHILE (I <= X) DO A(I) = 1{Executes X times}
END FOR

Remarks Following is a description of the FOR LOOP operation.

Initialize loop (var = exp). Perform loop test. If result is:

True Execute statements 1 through N. Add


step value to loop variable (var = var +
step). Repeat loop test.
False Exit loop (transfer control to statement
following END FOR).

A FOR loop may be terminated by a BREAK statement (control


transfers to the statement following END FOR).

Other looping structures (for example, REPEAT-UNTIL) sus-


pend the program on each cycle of the loop. The FOR loop does
not suspend the program. Therefore:

• The FOR loop may be used in continuous sections.


• The FOR loop should be used only for closed loops (where
the number of iterations is predictable); for example,
indexing through an array. The FOR loop should not be
used for open-ended loops (for example, waiting for some

4 - 92 WBPEEUI330254B3
FUNCTION (Subroutine)

function block event). Keep in mind that function blocks


(in the same segment as the program) cannot execute while
a FOR loop is executing.

FUNCTION (Subroutine)
Purpose A function subroutine is a unit of repetitive logic. The function
subroutine may be called by a phase (BSEQ and PHASEX),
state (UDF), monitor or another function subroutine. Informa-
tion is passed to a function subroutine by means of parame-
ters. A function subroutine can also return a value to the
caller. This means that a function subroutine call can be used
in an expression in the same way that a simple variable is
used.

Figure 4-3 shows the basic function subroutine structure.

FUNCTION name
Parameter list
DECLARATIONS
Local data
EXECUTABLE
Executable statements
ENDSUBR [name]

Figure 4-3. Function Subroutine Structure

Language BSEQ, PHASEX, UDF


Heading A function subroutine heading defines the name of the sub-
routine and its formal parameters. The heading format is
explained below:

FUNCTION name
type1 fname1
type2 fname2


NOTE: When passing a numeric recipe item to a function, it must be defined as


type ANY.

WBPEEUI330254B3 4 - 93
FUNCTION (Subroutine)

Parameter Description
name Name assigned to this subroutine.
fname Local name assigned to the nth formal parameter.
typeN Data type of the Nth formal parameter. Available data types are:
ANY Any data type or expression.
AOL Analog exception report.
APID Advanced PID controller.
ARRAY Any array type.
BBUF Boolean data buffer.
BLOCK Function block.
CS Control station block.
CSEQ Common sequence.
DATAEXPT User defined data export block
DD Device driver block.
DOL Digital exception report.
FGEN Function generator.
INTEGRATOR Integrator.
MSDD Multistate device driver block.
RAMP Ramp.
RBUF Real data buffer.
RCM Remote control memory.
REMSET Remote manual set constant.
RMC Remote motor control block.
SMITH Smith controller block.
TEXT Text block.
TIMER Timer.
VAR Variable.
(*...) Indicates number of dimensions. (that is, (*), (*,*) or (*,*,*))

When a formal parameter is type ARRAY, the parameter speci-


fication must indicate the number of dimensions as follows:
VAR ARRAY fnameN (*...)

There is no fixed limit on the number of parameters. However,


only one parameter per line is permitted. The parameter list is
terminated by the start of the next section.

Parameters whose data type is ANY are passed by value and


cannot be modified by the subroutine. All other parameters are
passed by reference and may be modified by the subroutine.
Example FUNCTION SET_DEVICE
DD DEVICE
ANY CMD_POSN
VAR FAULT_ID

4 - 94 WBPEEUI330254B3
FUNCTION (Subroutine)

DECLARATIONS
VAR ORIGINAL_MODE
EXECUTABLE
ORIGINAL_MODE = DEVICE.MODE
IF (DEVICE.MODE <> AUTO) SET DEVICE.MODE = AUTO
SET DEVICE.CO = CMD_POSN
WAIT WHILE (DEVICE.STS = WAITING)
IF (DEVICE.STS = GOOD) THEN
SET DEVICE.MODE = ORIGINAL_MODE
FAULT_ID = 0
ELSE
FAULT FAULT_ID
ENDIF
ENDSUBR SET_DEVICE

The formal parameter list defines local names (those to be


used inside the subroutine). Each formal parameter can be
thought of as a placeholder for an actual parameter. The
actual parameters are specified by the caller when it calls the
function subroutine. Each actual parameter in the call refers
to a value (type ANY) or to some object of data (for example,
timer, variable, function block). When the function subroutine
is executed, each reference to a formal parameter becomes ref-
erence to the corresponding actual parameter.
Declarations The declarations statement marks the beginning of the decla-
rations section. This section specifies data that is local to
(owned by) the function. The following shows the format of the
declarations section.

DECLARATIONS
type1 name1



typeN nameN

WBPEEUI330254B3 4 - 95
FUNCTION (Subroutine)

Parameter Description
name Name of data object.
type Data type; must be one of the following:
VAR Variable.
VAR ARRAY Variable array.
VAR STRING Variable string.
VAR STRING
ARRAY Variable string array.
CONST Constant.
CONST ARRAY Constant array.
CONST STRING Constant string.
CONST STRING
ARRAY Constant string array.
BLOCK ARRAY Function block array.

Example DECLARATIONS
VAR COUNTER
CONST TEN = 10.0

NOTE: The local data of a function exists only while the function subroutine is
executing. The data disappears when the function subroutine returns to the
caller.

Local data of a function subroutine is not initialized to any


particular value.
Function Call There are two methods for calling function subroutines. The
syntax used depends on whether or not the function subrou-
tine has a return value.

Function does not have a value - The following syntax is


used if the function subroutine does not have a value:

CALL name (param1, param2, ...)

Parameter Description
name Name of the function subroutine parameter.
paramN N th actual parameter.

Example CALL CHARGE (FV501, TOTAL_A, FIQA)

4 - 96 WBPEEUI330254B3
FUNCTION (Subroutine)

Function does have a value - If a function subroutine does


have a return value, the call must be embedded as an operand
of an expression. The following syntax is used:

name (param1, param2, ...)

Parameter Description
name Name of the function subroutine.
paramN N th actual parameter.

Example Consider a function subroutine called MAX_VAL whose value


is the larger of two parameters. Following is an example of a
call to MAX_VAL:
FUNCTION MAX_VAL
ANY VAL1
ANY VAL2
ANY VAL3
DECLARATIONS
VAR ARRAY VALUES (1, 3)
EXECUTABLE
VALUES (1) = VAL1
VALUES (2) = VAL2
VALUES (3) = VAL3
RETURN (MAX VALUES (*))
ENDSUBR MAX_VAL



SOME_VAR = 1 + MAX_VAL (X, Y, Z)

NOTES:
1. The data type of each actual parameter must match the data type of the
corresponding formal parameter. For example, if a formal parameter type is
timer, then the corresponding actual parameter must be a timer. However, if the
data type of a formal parameter is ANY, then the corresponding actual parame-
ter may be a value, a constant, or an expression.

2. A function subroutine must be defined before it is called.

3. Function subroutine is an ordinary subroutine in that it takes control from


the caller, executes to completion and returns control to the caller (as opposed
to a monitor subroutine that executes in parallel with the caller).

4. RETURN statements may appear anywhere in the executable section.


The ENDSUBR statement is equivalent to a RETURN.

WBPEEUI330254B3 4 - 97
Function Block

5. If any RETURN statement in a function subroutine specifies a return


value, all RETURNS must specify values.

Function Block
Purpose Function blocks in a control module batch system perform
continuous functions including:

• Continuous control and computation.


• Process I/O (field and peer-to-peer).
• Operator I/O.

The function blocks are accessible from Batch 90 and UDF


programs. General purpose access methods are described
below. Function blocks are also accessible through special
methods such as data buffer, device driver, control station
resource manager, remote control memory, remote manual set
constant.
Language BSEQ, PHASEX, UDF
Declaration Function blocks must be declared before they can be accessed
from a Batch 90 or UDF program. The declaration can appear
only in the data section.

BLOCK fbname, BLK = const1, [FC = const2, OUT (0 ) = \


0name0, OUT (1) = oname1 ...]

Parameter Description
fbname Name of the function block.
const1 Function block address.
const2 Function code number.
oname0 Name of output 0.
oname1 Name of output 1.

Example BLOCK DI02A, BLK = 100, FC = 84, OUT (0) = FV501, OUT (1) \
= FV502

NOTE: Currently, the compiler does not use the function code database.
Therefore, it is unable to tell if too many output names are assigned.
Reference Subroutines may read the value of any declared function block
output by using the name in an expression. If alarm and qual-
ity are associated with a function block output, these
attributes are readable. Alarm and quality are associated with

4 - 98 WBPEEUI330254B3
Function Block Array (Data Structure)

exception report generating function blocks and I/O function


blocks.

oname.data

Parameter Description
oname Name of the function block output.
data Type of data being read.
ALM Alarm status:
0 = false (no alarm).
1 = true (alarm).
HAL High alarm status:
0 = false (not high).
1 = true (high).
LAL Low alarm status:
0 = false (not low).
1 = true (low).
Q Block output quality:
0 = good.
1 = bad.
VAL Output value.

Examples IF (FT501.ALM) THEN


IF (FT501.HAL) THEN
IF FT501.LAL) THEN
IF (FT501.Q = BAD) SET FV500.CO = CLOSED
X = PB101.VAL

Function Block Array (Data Structure)


Purpose A function block array is a group of previously defined function
block outputs (from any function code type) organized in a
table. An array may have one, two or three dimensions. The
array as a whole has a name. An individual function block out-
put (element) of an array is identified by an array index that
specifies the position of the element within the array. An array
index consists of subscripts - one subscript for each dimen-
sion. A function block array is a read only array that is used
exclusively for referencing common reference extensions of
function block outputs listed in the array.
Language BSEQ, PHASEX, UDF

WBPEEUI330254B3 4 - 99
Function Block Array (Data Structure)

Declaration The following statements are used to declare function block


arrays:

{for one dimensional array}


BLOCK ARRAY name (low :high1) (list )

{for two dimensional array}


BLOCK ARRAY name (low :high1, [low :]high2 ) (list )
{for three dimensional array}
BLOCK ARRAY name (low :high1, [low :]high2, [low :]high3 )
(list )

Parameter Description
name Name of the array.
low Lowest subscript value. Must be 0 or 1.
highN Highest subscript value for the N th dimension. Must be a constant. The total number
of elements in an array must not exceed 16K.
list List of array element names. This one dimensional list has one entry for each
element of the array. The order of the entries is determined by varying the first (left)
subscript the fastest, then the second and third.
NOTE: For two and three dimensional arrays the lowest subscript value for the second and third dimension must match the
value that was specified by the first dimension.

Examples BLOCK ARRAY FLOW_SIGNALS (1:3) \


(FT201, FT202, FT203)
BLOCK ARRAY CONTROL_FEED (1:2, 1:2), \
(PY504,FY504,PU504,TV504)
BLOCK ARRAY LOGIC_VLV (1:3, 1:2, 1:3) \
(LS111,LS211,LS311,LS121,LS221,LS321, \
PV112,PV212,PV312,PV122,PV222,PV322, \
FY113,FY213,FY313,FY123,FY223,FY323)

References Element of an array - An individual element of an array is


referenced as follows:

{for one dimensional array}


name (exp1) .refext
{for two dimensional array}
name (exp1, exp2 ) .refext
for three dimensional array}
name (exp1, exp2, exp3 ) .refext

4 - 100 WBPEEUI330254B3
Function Block Array (Data Structure)

Parameter Description
name Name of the array.
expN Value of the N th subscript. If a subscript value exceeds its specified range, it causes
an error.
.refext Valid reference extension for a generic function block array. If the output does not
contain the attribute referenced, the resulting value is meaningless. Valid references
are .VAL, .ALM, .Q, .HAL, and .LAL.

Examples NEXT_TARGET = FEED_VALUES (1,3) .VAL


PRO_STAT = CELL_STATUS (15) .VAL

Entire array - In some operations it is necessary to refer to an


entire array as a whole. An entire array is referenced as
follows:

name [.refext ]
- or -
name (*...) [.refext ]

Parameter Description
name Name of the array.
(*...) Number of dimensions (that is, (*), (*,*), (*,*,*)).
.refext Valid reference extension for a generic function block array.

The first form (just the name) is used when an array is passed
as an argument to a function or monitor subroutine. The
second form is used in other whole array operations (that is,
array copy).
Examples CALL GET_ALARM (VALUE_STAT)
NEW_POSITION (*,*) = OLD_POSITION (*,*) .VAL

WBPEEUI330254B3 4 - 101
Function Generator (Data Structure)

Function Generator (Data Structure)


Purpose A function generator is an active data structure. It produces a
value that varies in a piece-wise linear function of time.
Language BSEQ, PHASEX, UDF
Declaration The following is used to declare a function generator:

FGEN fgname ((0, value0 ), (time1, value1)..., units)

Parameter Description
fgname Name of the function generator.
time Time of N th breakpoint (must be a constant).
valueN Value of N th breakpoint (must be a constant).
units Units of time (must be positive):
SEC Seconds.
MIN Minutes.
HOUR Hours.

Example FGEN PROFILE1 ((0, 80.0), (30, 100.0), (60, 100.0), (90, 20.0), \
MIN)

Refer to Figure 4-4 for an example function generator.

(30,100) (60,100)
100

80
(0,80)

60
VA LU E
(.VA L)
40

(90,20 )
20

0
30 60 90
TIM E (.TIM ) T 03 06 0A

Figure 4-4. Example Function Generator

4 - 102 WBPEEUI330254B3
Function Generator (Data Structure)

Reference Function generator data may be read by using the appropriate


name in an expression.

fgname.data

Parameter Description
fgname Name of the function generator.
data Type of data being read.
STS Current status:
0 = holding.
1 = running.
TIM Current time value.
VAL Current value.

Examples X = FGEN1.STS
X = FGEN1.TIM
X = FGEN1.VAL

Commands Use the following statement to control function generators.

operation fgname (exp)

Parameter Description
operation Operation being used:
HOLD Hold the function generator.
RESET Reset time to the exp value.
START Start the function generator.
fgname Name of the function generator.
(exp) New time value (for RESET operations only).

Examples HOLD FGEN1


RESET FGEN1 (0)
START FGEN1

Remarks RESET - This sets the time to exp, the value (.VAL) to the
appropriate value for the specified time and the status to
holding.

WBPEEUI330254B3 4 - 103
Global Data Structures (Integrators, Timers, Etc.)

Global Data Structures (Integrators, Timers, Etc.)


Refer to BATCH DATA (Statement) and DATA (Statement)
statements.

#HIHI (Directive)
Purpose The #HIHI compiler directive forces the numeric recipe param-
eters to include the LOW-LOW and HI-HI boundary values.
These values function identically to LOW and HI boundary val-
ues except these are absolute boundaries that can be set only
from within the program.
Language BSEQ
Declaration #HIHI
Remarks The result of this directive is that the syntax for recipe argu-
ments of type ANY are expanded to:

ANY name = (const1<const2 <const3 <const4 <const5 )

Parameter Description
name Name of the parameter.
const1 Default low-low limit.
const2 Default low limit.
const3 Default parameter value.
const4 Default high value.
const5 Default high-high value.

Any combination of default values may be specified by the pro-


gram and is completely optional. For example:
(1) - Low-low limit only.
(<<3) - Value only.
(<<<4) - High limit only.
(<<3<4<5) - Value, high, and high-high only.
(1<2<3<4<5) - Low-low, low, value, high, and high-high.

#HIHI generates an error in Batch 90 programs utilizing


PHASEX function codes.

4 - 104 WBPEEUI330254B3
HISTORIAN BUFFER (Variable)

HISTORIAN BUFFER (Variable)


Purpose HISTORIAN BUFFER is a built-in status variable that indicates
the fraction of the historian event queue that is currently in
use.
Language BSEQ
Declaration Not required.
References The value is read by using HISTORIAN BUFFER in an expres-
sion. The range of the value is 0 through 1.0. The value 0 indi-
cates that the buffer is empty or no historians are expected.
Example WAIT UNTIL (HISTORIAN BUFFER < 0.5)

HISTORIAN STATUS (Variable)


Purpose HISTORIAN STATUS is a built-in status variable that indicates
the summary status of the expected batch historians.
Language BSEQ
Declaration Not required.
References The value is read by using HISTORIAN STATUS in an
expression.

0 Good. At least one expected historian


has good status (or no historians are
expected).
1 Bad. All expected historians have bad
status.
Examples WAIT UNTIL (HISTORIAN STATUS IS GOOD)
WAIT WHILE (HISTORIAN STATUS)

HOLD
Refer to Common Sequence (Data Structure), Function Gener-
ator (Data Structure), INTEGRATOR (Data Structure), MONI-
TOR (Declaration), Ramp Data (Data Structure), or TIMER
(Data Structure).

WBPEEUI330254B3 4 - 105
HOLD LOGIC (Section)

HOLD LOGIC (Section)


Purpose This statement marks the beginning of the hold logic section of
a phase subroutine. This section provides the sequential con-
trol of an operation during the transition from normal execu-
tion to held.
Language BSEQ, PHASEX
Format HOLD LOGIC
statement



statement
Example HOLD LOGIC
SET FIC401.CO = OPEN
SET FIC402.CO = CLOSED

Remarks This section is active during the transition from normal execu-
tion to held. When the last statement of this section is exe-
cuted, all phase activity is suspended until the phase is
restarted. When the batch sequence mode is changed to run,
sequential control is transferred to the restart logic (refer to
Appendix A for details on parallel phase subroutine execution).

IF (Statement)
Purpose The IF statement causes a single statement to be executed or
passed over, based on a logical expression.
Language BSEQ, PHASEX, UDF
Format IF (exp) statement
Example IF (FC101.MODE IS MAN) SET FC101.MODE = AUTO

Remarks IF exp is true, the statement is executed; otherwise, the state-


ment is not executed. If no statement is defined, no action is
taken.

4 - 106 WBPEEUI330254B3
IF THEN...ENDIF (Control Structure)

IF THEN...ENDIF (Control Structure)


Purpose The IF THEN statement causes a block of statements to be exe-
cuted or passed over, based on a logical expression.
Language BSEQ, PHASEX, UDF
Format IF (exp) THEN
statement1



statementN
ENDIF
Example IF (FC101.MODE IS MAN) THEN
SET FC101.MODE = AUTO
SET FC101.CO = 50.0
ENDIF

Remarks IF exp is true, statements 1 through N are executed; otherwise,


statements 1 through N are skipped.

IF THEN...ELSE...ENDIF (Control Structure)


Purpose This statement causes one of two blocks of statements to be
executed, and the other to be passed over, based on a logical
expression.
Language BSEQ, PHASEX, UDF
Format IF (exp) THEN
statement T1



statement TN
ELSE
statement F1



statement FN
ENDIF

WBPEEUI330254B3 4 - 107
#INCLUDE (Directive)

Example IF (FLAG IS TRUE) THEN


SET FC101.MODE = AUTO
SET FC102.MODE = AUTO
ELSE
SET FC101.MODE = MAN
SET FC102.MODE = MAN
ENDIF

Remarks IF exp is true, statements T1 through TN are executed; other-


wise, statements F1 through FN are executed.

#INCLUDE (Directive)
Purpose The #INCLUDE directive tells the compiler to replace this line
with the contents of a specified file.
Language BSEQ, PHASEX, UDF
Format #INCLUDE ( \ path\ file name)

Parameter Description
file name Name of the file.

Example #INCLUDE (\BATCH\FILE.ABC)

Remarks As the compiler processes a source file, it builds a temporary


version of the file. The include directive effects only the tempo-
rary version. The original source file is not changed.

The purpose of this directive is to simplify the development of


application standards. Include files provide a convenient
means to maintain standard function, monitor, phase, or state
subroutines for use in multiple BSEQ, PHASEX, and UDF pro-
grams. In this manner, the subroutine to open a valve (for
example) can be written only once and included in each pro-
gram application that needs this functionality. When the drive
is not specified in the path, the drive is assumed to be the
same one used by the Batch 90 or UDF program file.

4 - 108 WBPEEUI330254B3
INPUT (Declaration)

INPUT (Declaration)
Purpose The INPUT declaration provides an alternate means of declar-
ing function blocks within the UDF language. The UDF lan-
guage fully supports the function block declarations used in
DATA (Statement) and FUNCTION (Subroutine). Additionally,
the INPUT declaration enables the declaration of function
blocks without specific block address information. This func-
tionality allows one UDF application to be implemented in
many instances.
The INPUT declaration defines function blocks that have been
configured as inputs to the UDF Type 1, UDF Type 2, or AUX-
ILIARY UDF function blocks. Declared as an INPUT, the UDF
program can manipulate these function blocks in the same
way as the explicit declarations that included block address
information (that is, BATCH DATA). All references and com-
mands associated with the function code type are available to
the UDF program.
Language UDF
Declaration Function blocks must be declared before they can be accessed
from an UDF program. The declarations can appear only in the
data section.

[AUX x] INPUT y name, FC = type

Parameter Description
AUX x Name of the auxiliary UDF function block that connects to the UDF type 1 or 2 func-
tion block.
y Input number of the UDF declaration function block or auxiliary UDF function block
connected to the UDF type 1 or 2 function block.
name Name for the input.
type Function code acronym or function code number of the UDF type1 or 2 function block
connected.

Example AUX 1
INPUT 2 TIC503, FC = DD
INPUT 3 TIC501, FC = CS

WBPEEUI330254B3 4 - 109
INTEGRATOR (Data Structure)

Remarks For function block details, refer to:

AOL Analog exception report


APID Advanced PID
BBUF Boolean data buffer
BSEQ Batch sequence
CS Control station
DOL Digital exception report
DD Device driver
MSDD Multistate device driver
RBUF Real data buffer
RCM Remote control memory
REMSET Remote manual set constant
RMC Remote motor control
SMITH Smith block
TEXT Text

INTEGRATOR (Data Structure)


Purpose Integrators are active data structures. Integrators can be
either local or global.
Language BSEQ, PHASEX, UDF
Declaration Integrators must be declared as follows:

INTEGRATOR iname (input, units)

Parameter Description
iname Name of the integrator.
input Name of value to be integrated. This name must refer to a data object that has
already been declared (for example, batch data, data, phase subroutine, state
subroutine, and local data).
units Units of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.

Example INTEGRATOR TOTAL501 (FI1501.VAL, MIN)


INTEGRATOR INTGX (X, SEC)

4 - 110 WBPEEUI330254B3
INTEGRATOR (Data Structure)

When declared locally (in a phase or state subroutine) the inte-


grator value is initialized to zero at the start of the subroutine.
Reference Integrator data may be read by using the appropriate name in
an expression.

iname.data

Parameter Description
iname Name of the integrator.
data Type of data being read.
STS Current status:
0 = holding.
1 = running.
VAL Current value of the integrator.

Example X = INTG1.VAL

Commands Use the following statement to control integrators.

operation iname (exp)

Parameter Description
operation Operation being used:
HOLD Hold the integrator (value is not effected).
RESET Reset value to the exp value.
START Start the integrator (value is not effected).
iname Name of the integrator.
(exp) New integrator value (for RESET operations only).

Examples HOLD INTG1


RESET INTG1 (0)
START INTG1

WBPEEUI330254B3 4 - 111
LAST OPERATION (Variable)

LAST OPERATION (Variable)


Purpose LAST OPERATION and LAST OPERATION (bseqx) are built-in
read-only variables that return the operation number of the
last operation within the unit recipe being executed or within a
unit recipe being executed by a specific BSEQ function
block.
Language BSEQ, UDF
Format LAST OPERATION - {for batch program looking at its own
recipe}

- or -

LAST OPERATION (bseqx ) - {for batch or UDF program look-


ing at another BSEQ function block within the same control-
ler}

Parameter Description
bseqx Name of the BSEQ function block that is executing the current unit recipe.

Remarks The LAST OPERATION variable returns the operation number


of the final operation for the currently executing unit recipe.
The number is returned when the variable LAST OPERATION
is used in an expression.
Example FINAL_OP_NUM = LAST OPERATION

NOTE: LAST OPERATION is an ISA-S88.01-1995 standard term. Usage of


this term prohibits compiling with ABB specific terms. The ABB specific term is
LAST PHASE. To use the ABB specific term, replace OPERATION with
PHASE.

LAST PHASE (Variable)


NOTE: LAST PHASE is a ABB specific term whose usage prohibits compiling
to ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard term is LAST
OPERATION. To use the ABB specific term, refer to LAST OPERATION (Vari-
able) and replace OPERATION with PHASE. LAST PHASE is not supported in
Batch 90 programs for the PHASEX function code.

4 - 112 WBPEEUI330254B3
LAST SUBR (Variable)

LAST SUBR (Variable)


Purpose LAST SUBR and LAST SUBR (bseqx) are built-in read-only
variables that return the phase subroutine number of the last
phase subroutine within the current operation of the unit rec-
ipe being executed or within a unit recipe being executed by a
specific BSEQ function block.
Language BSEQ, UDF
Format LAST SUBR

- or -
LAST SUBR (bseqx )

Parameter Description
bseqx Name of the BSEQ function block that is executing the current unit recipe.

Remarks The phase subroutine number of the last phase of the current
operation is returned when LAST SUBR is used in an
expression.
Example NUM_PHASES = LAST SUBR

#LIST (Directive)
Purpose The #LIST directive turns on the generation of the listing file if
it was suspended by a #NOLIST directive. If the listing was not
suspended, no action is taken.
Language BSEQ, PHASEX, UDF
Format #LIST

NOTE: The #LIST directive may prevent the ability to inspect parameters and
variables in the debugger.

WBPEEUI330254B3 4 - 113
LOT (Variable)

LOT (Variable)
Purpose LOT is a built-in status variable.
Language BSEQ, PHASEX
Declaration Not required.
References LOT ID is read by using LOT in an expression.
Examples EXECUTION_NO = LOT
LOT_STORAGE_NO = LOT + 100

Remarks The Batch 90 language includes three built-in variables


(BATCH, CAMPAIGN, and LOT). These variables may be used
by the BHIST function block for record keeping, or by the
CSEQ function block for controlling resource allocation. Refer
to BATCH (Variable) and CAMPAIGN (Variable) statements.

When #ALPHA is used in the Batch 90 program file for


PHASEX lot ID’s are set by the ACQUIRE command to the
PHASEX function code. Lot ID will use the first 16 characters
of the lot ID in the ACQUIRE command. If #ALPHA is not used
in the Batch 90 program file for PHASEX and the lot ID set by
the ACQUIRE command is six or less digits long, the alphanu-
meric lot ID will be converted to a numeric lot ID. The numeric
lot ID is referenced by the built-in status variable.

#MAXPARALLEL (Direction)
Purpose The #MAXPARALLEL directive specifies the maximum number
of parallel phase subroutines permitted. The actual number of
parallel phase subroutines is specified by the unit recipe.
Language BSEQ, PHASEX
Format #MAXPARALLEL = const

Parameter Description
const Value from 1 through 32.

Example #MAXPARALLEL = 3

4 - 114 WBPEEUI330254B3
MONITOR (Subroutine)

Remarks The #MAXPARALLEL directive is optional. If not used, the


value of #MAXPARALLEL defaults to 1. This parameter directly
effects the amount of RAM memory that needs to be allocated
for step data (corresponds to specification S12 of the BSEQ
function code). The batch compiler calculates the minimum
number of parallel phase subroutines required and displays
that number at the end of the program listing.

The #MAXPARALLEL value in PHASEX programs has no effect


on memory requirements. #MAXPARALLEL is used to deter-
mine the number of linked PHASEX function blocks present in
the configuration logic. The address of each PHASEX block is
shown on the address page of the B90 program class or unit
data file property page. The address is used by the debugger
application.

MONITOR (Subroutine)
Purpose A monitor subroutine is a program unit that is similar, in some
ways, to a function subroutine. Like a function subroutine, a
monitor subroutine is defined once and may be called many
times. The definition may be thought of as a template and each
call is an independent instance (use) of the template.

There are two major characteristics that distinguish a monitor


subroutine from a function subroutine.
1. A monitor subroutine executes in parallel with the active
phase (BSEQ and PHASEX) or state (UDF) subroutine.

2. The call to a monitor subroutine is a data declaration


(rather than an executable statement).

Monitor subroutines are typically used to watch for abnormal


conditions while a phase or state subroutine performs the
sequential part of an operation procedure.
Language BSEQ, PHASEX, UDF
Remarks The call to a monitor subroutine may be declared in the local
data of a phase or state subroutine or in a data section. If the
call is in a phase or state subroutine, then the instance of the
monitor subroutine is local to the phase or state subroutine. It
exists only while the phase or state subroutine is active (run-
ning or held). If the call is in a data section, then that instance

WBPEEUI330254B3 4 - 115
MONITOR (Subroutine)

of the monitor subroutine is global and exists all the while the
BSEQ program is active (running or held).

Each instance of a monitor subroutine has an execution sta-


tus - running or stopped. The active phase or state subroutine
may stop or start each instance of a monitor subroutine. Once
a global instance of a monitor subroutine is started, it will con-
tinue to run until commanded to stop by the active phase or
state subroutine or the program completes. It may run across
operations and will run even while the active phase or state
subroutine is held.

Global monitors, once active, remain active while the program


is acquired or the program status is active. Global monitors in
a PHASEX program are disabled by the program using a hold
monitor statement or by releasing the PHASEX block.

Once a local (instance of a) monitor subroutine is started, it


will continue to run until one of the following occurs:

• It is commanded to stop by the active phase or state


subroutine.

• The operation ends.

• The status of the active phase or state subroutine changes


from running to held (a local monitor subroutine does not
run while the phase or state subroutine is held). When the
phase or state subroutine status changes back to running,
the monitor subroutine will automatically resume running
(if the monitor subroutine status was running).

If a monitor definition contains data declarations, then each


instance of the monitor subroutine has its own unique data
space for that data. Refer to Figure 4-5 for the basic structure
of a monitor subroutine.

MONITOR name
Parameter list
DECLARATIONS
Local data
CONTINUOUS
Executable statements
ENDSUBR [name]

Figure 4-5. Monitor Subroutine Structure

4 - 116 WBPEEUI330254B3
MONITOR (Subroutine)

Heading The monitor subroutine heading has the following format:

MONITOR name
type1 pname1
type2 pname2


Paramete
Description
r
name Name of this subroutine.
typeN Data type of the Nth formal parameter. Available data types are:
ANY Any data type or expression.
AOL Analog exception report.
APID Advanced PID controller.
ARRAY Any array type.
BBUF Boolean data buffer.
BLOCK Function block.
CS Control station block.
CSEQ Common sequence.
DATAEXPT User defined data export block.
DD Device driver block.
DOL Digital exception report.
FGEN Function generator.
INTEGRATOR Integrator.
MSDD Multistate device driver block.
RAMP Ramp.
RBUF Real data buffer.
RCM Remote control memory.
REMSET Remote manual set constant.
RMC Remote motor control block.
SMITH Smith controller block.
TEXT Text block.
TIMER Timer.
VAR Variable.
pname Local name assigned to the nth formal parameter.

Example MONITOR CHK_TOTAL


BLOCK FLOW
INTEGRATOR AMOUNT
VAR LIMIT

Remarks While there is no fixed limit on the number of parameters, the


subroutine can have only one parameter per line. The parame-
ter list is terminated by the start of the next section.

WBPEEUI330254B3 4 - 117
MONITOR (Subroutine)

When a formal parameter is any array, the parameter specifi-


cation must indicate the number of dimensions as follows:

VAR ARRAY fnameN (*....)


CONST ARRAY fname (*....)

Parameter Description
(*....) Number of dimensions.
(that is, (*), (*, *) or (*, *, *))

Parameter The formal parameter list defines the local parameter names
References (those used inside the monitor subroutine). Each formal
parameter can be thought of as a place holder for an actual
parameter. The actual parameters are specified when the mon-
itor subroutine is declared (either in a data section or in a step
or state subroutine). Each actual parameter refers to a value
(type ANY) or to some object of data (for example, timer, vari-
able, function block). When the monitor subroutine is called,
each reference to a formal parameter becomes a reference to
the corresponding actual parameter.
Example Consider the following monitor subroutine:
MONITOR CHK_TIMER
TIMER TIM
VAR LIMIT
VAR STATUS
CONTINUOUS

IF (TIM.VAL < LIMIT) THEN


STATUS = 0
ELSE
STATUS = 1
STOP TIM
ENDIF
ENDSUBR CHK_TIMER

Consider the following PHASE or STATE subroutine


declaration:
DECLARATIONS:
VAR TIM_LIMIT
VAR TIM_STS
TIMER TIMER1 (SEC)
MONITOR CHK_TIMER (TIMER1, TIM_LIMIT, TIM_STS) ALIAS \
CHK_TIME1

4 - 118 WBPEEUI330254B3
MONITOR (Subroutine)

Declarations The declarations statement marks the beginning of the decla-


ration section of the monitor subroutine. This section specifies
data local to the monitor subroutine.

DECLARATIONS
type1 name1



typeN nameN

Parameter Description
nameN Name of Nth data object.
typeN Data type of the Nth data object. Available data types are:
CONST Constant.
CONST ARRAY Constant array.
CONST STRING Constant string.
CONST STRING ARRAY Constant string array.
BLOCK ARRAY Function block array.
VAR Variable.
VAR ARRAY Variable array.
VAR STRING Variable string.
VAR STRING ARRAY Variable string array.

Example DECLARATIONS
VAR COUNTER
CONST INDEX = 1.0

The monitor local data exists for the entire length of time the
monitor subroutine exists. Starting and stopping a monitor
subroutine does not effect its local data.
References Monitor status can be read using the appropriate name in an
expression.

name.STS

Parameter Description
name Name or ALIAS of the monitor call.
name.STS Monitor status:
0 = stopped.
1 = running.

Example X = MON_LEVEL1.STS

WBPEEUI330254B3 4 - 119
MONITOR (Declaration)

Remarks Self-referencing - A self-referencing feature allows a monitor


subroutine to stop its own execution. For example:
MONITOR monitor_name
CONTINUOUS
statement1



HOLD monitor_name
ENDSUBR monitor_name

Any logic statements appearing after an unconditional HOLD


monitor_name statement will never be executed and shall be
marked as such by the compiler.

MONITOR (Declaration)
Purpose The monitor declaration is used to specify a call to a monitor
subroutine. Each declaration represents a separate call and
has a parameter list that specifies the actual parameters that
are passed to the monitor subroutine. This parameter list
must match the formal parameter list of the specified monitor
subroutine in number and types of parameters.
Language BSEQ, PHASEX, UDF
Declaration MONITOR name (param1, param2, ...paramN ) init [ ALIAS
name2 ]

Parameter Description
name Name of the monitor subroutine to be called. The specified monitor subroutine
must already be defined.
paramN Nth actual parameter. Each parameter must specify a data object which has
already been declared in local or batch data.
init Initial status (running or stopped). If no status is specified, running is assumed.
name2 Name used to identify this call to a monitor subroutine.

Examples MONITOR STATUS (FV211, FV215, FC534) RUNNING


MONITOR MON_LEVEL (TMR501, LIC501) STOPPED \
ALIAS MON_LEVEL_1

4 - 120 WBPEEUI330254B3
Multistate Device Driver (Function Block)

Commands The following commands control the execution status of moni-


tor subroutines.

operation name

Parameter Description
operation Operation being used.
HOLD Hold the monitor subroutine.
START Start the monitor subroutine.
name Name of the monitor subroutine or name of alias.

Example HOLD MON_LEVEL


START MON_LEVEL

Remarks HOLD - This command changes the status from running to


stopped. It has no effect if the status is stopped. A monitor can
set itself to the hold condition.

START - This command changes the monitor subroutines sta-


tus from stopped to running (the command has no effect if the
status is already running). This command simply changes the
status of the monitor subroutine - it does not immediately exe-
cute the monitor subroutine. The monitor subroutine will exe-
cute during the next function block cycle.

Multistate Device Driver (Function Block)


Purpose Multistate device drivers (FC 129) are used to control devices
with up to four states, three outputs, and four feedbacks.
Applications of this function block are multistate motors (fast,
slow and stopped), valves with bidirectional motors (forward,
reverse and stop states), etc. As with the device driver, FC 129
does the low level interlocking (confirmation of state within
feedback time).
Language BSEQ, PHASEX, UDF
Declaration A multistate device driver function block must be declared
before it can be accessed from a subroutine. The declaration
must appear in the data section of a program. Batch 90 and
UDF languages can only manipulate multistate device drivers
in which specifications S1 and S2 are set to zero.

BLOCK msddname, BLK = const, FC = MSDD [, WATCH]

WBPEEUI330254B3 4 - 121
Multistate Device Driver (Function Block)

Parameter Description
msddname Name of the MSDD function block.
const Function block address.
WATCH Specifies that the multistate device driver is to be placed on watch upon program
(BSEQ only) startup. If WATCH is not specified, the multistate device driver will be off watch.

Example BLOCK FAN, BLK = 100, FC = MSDD

References Multistate device driver data may be read by using the appro-
priate name in an expression.

msddname .data

Parameter Description
msddname Name of the MSDD function block.
data Type of data being read.
CO Control output state (0 - 3).
FBT Feedback target values.
FBV Feedback values.
MODE Mode:
0 = manual.
1 = auto.
STS Status:
0 =good.
1 = bad.
2 = waiting.

Example IF (FV501.CO IS 2) THEN


IF (FB501.FBV = FB501.FBT) THEN
IF (DIGIT (FV501.FBV,2)) = 1 THEN
IF (FV501.MODE IS BAD) THEN
IF (FV501.STS IS BAD) THEN

Remarks FBV - The four feedback values are encoded into a single
4-digit number with each digit representing an individual feed-
back value. The most significant digit is associated with feed-
back 1, the next digit with feedback 2 and so on.

FBT - The four target values are encoded into a single 4-digit
number with each digit representing an individual target
value. The most significant digit is associated with target 1, the
next digit with target 2 and so on.

4 - 122 WBPEEUI330254B3
Multistate Device Driver (Function Block)

Commands The following commands are used to control multistate device


drivers.

SET msddname.data = exp

Parameter Description
msddname Name of the MSDD function block.
data Type of data being set.
CO Control output value (0 - 3).
MODE Mode:
0 = manual.
1 = auto.
OVR Override status:
0 = off.
1 = on.
TRK Control output tracking flag:
0 = disable.
1 = enable.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Example SET FV501.CO = 2


SET FV501.MODE = AUTO
SET FV501.OVR = ON
SET FV501.TRK = 1
SET FV501.WATCH = EXP

Remarks CO - The operation of this command depends on the mode and


tracking status of the function block.
1. If the mode is auto, the control output state is set to exp.

2. If the mode is not auto and tracking is disabled, exp is


recorded inside the function block, but the control output
state is not updated. If the mode is later changed to auto, then
the control output state is updated.

3. If the mode is not auto and tracking is enabled, the com-


mand has no effect.
TRK - The purpose of control output tracking is to provide a
bumpless transfer of the control output during a mode change
from manual to auto. In manual mode, the operator controls

WBPEEUI330254B3 4 - 123
NEXT OPERATION (Statement)

the control output value. If tracking is disabled and the mode


is changed from manual to auto, the control output will go to
the last value that was written to the block by the program
(that is, the control output may bump). If tracking is enabled,
the control output value will remain unchanged during the
mode change.

The initial value of tracking status (when the MFP module is


placed into the execute mode) is off.

WATCH (BSEQ only) - These commands are buffered within


the function block and do not have an immediate effect on the
function block. The command will not take effect until the
function block executes on its next cycle.

SET AND WAIT msddname.CO = exp

Parameter Description
msddname Name of the MSDD function block.
exp Control output value (0 - 3).

Remarks The SET AND WAIT version of this command performs this
operation and then waits for confirmation (that is, the control
output state is equal to exp and the feedback status is good).
The command retries the operation (once per cycle while wait-
ing. Confirmation does not require that the mode is auto. It
requires that only the feedback status is good and the control
output is in the specified state.

NEXT OPERATION (Statement)


Purpose This statement terminates the current operation and activates
another operation.
Language BSEQ, PHASEX
Format NEXT OPERATION [exp]

Parameter Description
exp Number of operation to be activated. If exp is not specified, then the
next sequential operation is activated (that is, current phase + 1).

Examples NEXT OPERATION


NEXT OPERATION 10

4 - 124 WBPEEUI330254B3
NEXT PHASE (Statement)

Remarks If the value of the exp is greater than the number of operations
called for the unit recipe, then the unit recipe is complete (that
is, a done statement will be executed).

NOTES:
1. If the value of the exp is equal to the current operation number, then con-
trol will transfer to the top of continuous logic. If the next operation statement is
in continuous logic it will prevent normal logic from being executed. This has
the effect of freezing the program.

2. NEXT OPERATION is an ISA-S88.01-1995 standard term. Usage of this


term prohibits compiling with ABB specific terms. The ABB specific term is
NEXT PHASE. To use the ABB specific term, replace OPERATION with
PHASE.

3. NEXT OPERATION always transfers to the complete state in PHASEX


programs not running a sequence of phases. The transfer to complete occurs
no matter what the exp parameter number is set to. When pausing, a NEXT
OPERATION transfers the PHASEX function block to the paused state.

4. NEXT OPERATION in a global monitor is ignored and skipped in PHASEX


programs.

NEXT PHASE (Statement)


NOTE: NEXT PHASE is a ABB specific term. Usage of this term prohibits com-
piling to ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard term is
NEXT OPERATION. To use the ABB specific term, refer to NEXT OPERATION
(Statement) and replace OPERATION with PHASE.

NEXT STATE (Statement)


Purpose This statement terminates the current state subroutine and
activates another state subroutine.
Language UDF
Format NEXT STATE name

Parameter Description
name Name of the state subroutine to be activated.

Example NEXT STATE MOTORSTOP

WBPEEUI330254B3 4 - 125
#NOLIST (Directive)

#NOLIST (Directive)
Purpose The #NOLIST directive turns off the generation of the listing
file. This directive is useful if long #INCLUDE files are being
used in a number of programs and their listings were
unnecessary.
Language BSEQ, PHASEX, UDF
Format #NOLIST

NOTES:
1. The listing will remain off until a #LIST directive is seen. Any errors
detected by the compiler are still displayed.

2. The #NOLIST directive may prevent the ability to inspect parameters and
variables in the debugger.

NORMAL LOGIC (Section)


Purpose This statement marks the beginning of a phase (BSEQ and
PHASEX) or state (UDF) subroutine's normal logic section.
This section provides the normal sequential control of a phase
subroutine (BSEQ and PHASEX) or state subroutine (UDF).
Language BSEQ, PHASEX, UDF
Format NORMAL LOGIC
statement



statement
Remarks This section executes when the phase or state subroutine is
active and the operation is in the normal mode. When the
phase or state subroutine is first activated, the normal logic
statement begins executing at the first statement. It continues
to execute statement by statement until either the last state-
ment or a next operation statement is executed or the mode is
changed from normal to fault or hold (refer to Appendix A for
details for parallel operation).
Example NORMAL LOGIC
START TIMER1
SET FIC501.CO = OPEN

4 - 126 WBPEEUI330254B3
Normalize String (Command)

WAIT UNTIL ((LT501 >= 45.0) OR (TIMER1.VAL >= 30))


SET FIC501.CO = CLOSED

Normalize String (Command)


Purpose This command removes all leading and trailing blank spaces
from a variable string. Multiple spaces between characters and
tabs will be replaced with one space. The resultant string is
stored in the original variable string.
Language BSEQ, PHASEX, UDF
Format NORMALIZE (vstrname)

Parameter Description
vstrname Name of a variable string.

Example NORMALIZE (REQUIRED_ACTION)

OPERATION (Variable)
Purpose OPERATION is a built-in status variable. OPERATION indi-
cates the current operation number being executed by the
BSEQ function block.
Language BSEQ
Declaration Not required.
References The operation number may be read by using OPERATION in
an expression.
Example IF (OPERATION > 0) THEN

Remarks OPERATION may be used to determine the current operation


number being executed. For example, if the BSEQ function
block is executing phase subroutines in parallel (that is, 3.1,
3.2, 3.3, etc.) OPERATION returns only the whole number por-
tion of the operation number (OPERATION = 3). Refer to the
PHASE NUMBER (Variable) statement.

NOTE: OPERATION is an ISA-S88.01-1995 standard term. Usage of this term


prohibits compiling with ABB specific terms. The ABB specific term is PHASE.
To use the ABB specific term, replace OPERATION with PHASE.

WBPEEUI330254B3 4 - 127
OPERATION DESCRIPTOR (Function)

OPERATION generates an error in Batch 90 programs utilizing


PHASEX function codes.

OPERATION DESCRIPTOR (Function)


Purpose To retrieve the operation descriptor from the current unit rec-
ipe executing in a BSEQ function block.
Language BSEQ, UDF
Declaration {from a Batch 90 program}
OPERATION DESCRIPTOR (exp, vstring)

{from a UDF or other Batch 90 program}


OPERATION DESCRIPTOR (bseqx, exp, vstring)

Paramete
Description
r
exp Number of the operation from which the descriptor is desired.
vstring Variable string (capable of storing at least 64 characters) used
to return the specified descriptor.
bseqx Name of the BSEQ function block declaration.

Example O_NUM = -1
REPEAT
O_NUM = O_NUM + 1
OPERATION_DESCRIPTOR (O_NUM, O_DESCS (O_NUM))
UNTIL ((O_NUM >= LAST OPERATION) OR (ONUM > 19))

Remarks The OPERATION DESCRIPTOR is entered using the unit pro-


cedure editor (UPE) or the optional master recipe editor (MRE).
Each operation within a unit recipe has a descriptor that can
be up to 64 characters long.

NOTE: OPERATION DESCRIPTOR is an ISA-S88.01-1995 standard term.


Usage of this term prohibits compiling with ABB specific terms. The ABB spe-
cific term is PHASE DESCRIPTOR. To use the ABB specific term, replace
OPERATION with PHASE.

OPERATION DESCRIPTION generates an error in Batch 90


programs utilizing PHASEX function codes.

4 - 128 WBPEEUI330254B3
OUTPUT (Declaration)

OUTPUT (Declaration)
Purpose The OUTPUT declaration assigns a name to UDF Type 1, UDF
Type 2, and Auxiliary UDF function block outputs. The name
specified in the declaration is used by UDF commands to write
values to the function block output.
Language UDF
Declaration An output statement is necessary to declare any output from
the UDF declaration function block. An output statement
defines a boolean or real value depending upon the UDF func-
tion block type. The declaration can appear only in the data
section.

[AUX x] OUTPUT y name

Parameter Description
AUX x Name of the auxiliary UDF function block that
connects to the UDF Type 1 or 2 function block.
y Output of either the UDF declaration function block
or auxiliary UDF function block.
name Name for the output.

Examples AUX 1
OUTPUT 2 PV501
OUTPUT 3 PV503

AUX 2
OUTPUT 1 FV40
OUTPUT 2 FV42

Commands The SET command is used to write a value to the function


block output.

SET name.VAL = exp

Parameter Description
name UDF function block output name.
exp Output value.

Examples SET PV501.VAL = 75.5


SET FV42.VAL = ON

WBPEEUI330254B3 4 - 129
PHASE (Statement)

PHASE (Statement)
NOTE: PHASE is a ABB specific term. Usage of this term prohibits compiling to
ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard term is OPERA-
TION. To use the ABB specific term, refer to OPERATION (Variable) and
replace OPERATION with PHASE. PHASE is not supported in Batch 90 pro-
grams using PHASEX function codes.

PHASE DESCRIPTOR (Function)


NOTE: PHASE DESCRIPTOR is a ABB specific term. Usage of this term pro-
hibits compiling to ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard
term is OPERATION DESCRIPTOR. To use the ABB specific term, refer to
OPERATION DESCRIPTOR (Function) and replace OPERATION with
PHASE. PHASE DESCRIPTOR is not supported in Batch 90 programs using
PHASEX function codes.

PHASE NUMBER (Variable)


Purpose PHASE NUMBER is a built-in status variable. PHASE NUM-
BER indicates the phase number of the active phase
subroutine.
Language BSEQ
Declaration Not required.
References The phase number may be read by using PHASE NUMBER in
an expression.
Example IF (PHASE NUMBER > 1) THEN

Remarks The phase number is the decimal portion of the operation


number. For example, if the second phase subroutine of opera-
tion 3 is active (3.2), then OPERATION is 3 and PHASE NUM-
BER is 2.

NOTE: PHASE NUMBER is an ISA-S88.01-1995 standard term. Usage of this


term prohibits compiling with ABB specific terms. The ABB specific term is
SUBPHASE. To use the ABB specific term, replace PHASE NUMBER with
SUBPHASE.

PHASE NUMBER generates an error in Batch 90 programs uti-


lizing PHASEX function codes.

4 - 130 WBPEEUI330254B3
PHASE SUBR (Subroutine)

PHASE SUBR (Subroutine)


Purpose A phase subroutine is a major unit of a batch program. It is
responsible for controlling the sequence of activities within a
phase.

Each operation of a unit recipe specifies the names of the


phase subroutines that are to be executed for that operation.
The unit recipe also specifies a list of formulation data. When
an operation becomes active, the specified phase subroutines
are called and the formulation data is passed to them (via the
parameter list of each phase subroutine). When the phase
subroutines complete their activities, control is passed to the
next operation.

There is no limit to the amount of times a phase subroutine


may be called.

Figure 4-6 shows the general structure of a phase subroutine.

PHASE SUBR name


[Phase comment]
Parameter list
DECLARATIONS
Local data and monitor subroutine calls
CONTINUOUS
Executable statement
NORMAL LOGIC
Executable statements
FAULT LOGIC
Executable statements
HOLD LOGIC
Executable statements
RESTART LOGIC
Executable statements
ENDSUBR [name]

Figure 4-6. Phase Subroutine Structure

Language BSEQ, PHASEX


Heading A phase subroutine heading defines the name of the subrou-
tine and its formal parameters. When a phase subroutine is
called, a list of formulation data is passed from the unit recipe
to the phase subroutine. The phase comment is an optional
1400 character field that can be viewed as help information

WBPEEUI330254B3 4 - 131
PHASE SUBR (Subroutine)

from the recipe editor. The parameter list defines the names to
be used within the phase subroutine for the individual items of
formulation data. The heading format is:

PHASE SUBR name


type1 pname1
type2 pname2


Parameter Description
name Name of this subroutine. The name must be unique within the batch program. The
maximum length is 16 alphanumeric characters. Embedded spaces are not allowed.
typeN Data type of the Nth parameter. Data type must be one of the following:
ANY Any data type or extension.
AOL Analog exception report.
APID Advanced PID controller.
BBUF Boolean data buffer.
BLOCK Function block.
CS Control station block.
CSEQ Common sequence.
DATAEXPT User defined export block.
DD Device driver block.
DOL Digital exception report.
MSDD Multistate device driver block.
RBUF Real data buffer.
RCM Remote control memory.
REMSET Remote manual set constant.
RMC Remote motor control block.
SMITH Smith controller block.
STRING Recipe string argument.
TEXT Text block.
pnameN Local name assigned to the n th parameter. The N th parameter corresponds to the
nth item in the unit procedures list of formulation data. The name is restricted to a
maximum of 32 characters.

Example PHASE SUBR ADD_COMPONENT_A


ANY RATE_A = (100<500<1000)
ANY TOTAL_A = (MIN_CHRG, NORMAL_CHRG, MAX_CHRG)
DD VALVE_A = (PV51, FV52)
STRING INAME = “COMMENT ID #XXX”

4 - 132 WBPEEUI330254B3
PHASE SUBR (Subroutine)

Remarks 1. Parameter list is terminated by the start of the next section


(that is, declarations).

2. There can be no more than 255 parameters for BSEQ pro-


grams and 32 parameters for PHASEX programs.

3. Parameters with data type ANY or BLOCK can only be read


by the subroutine. They cannot be modified.
Argument The formal arguments to a phase subroutine can be given ini-
Initialization tial values. These values are used as the default value by the
unit procedure editor when preparing a unit procedure opera-
tion for this phase subroutine.
Format For a type ANY argument the following combination is allowed:

ANY pnameN = (const1 < const2 < const3 )

Parameter Description
const1 Default low limit.
const2 Default value.
const3 Default high limit.

Any combination is allowed (1 < 2 < 3).


(1) - Low only
(< 2) - Value only.
(< < 3) - High only.
(1 < < 3) - Low and high.
(1 < 2 < 3) - Low, value, and high.

Refer to #HIHI (Directive) for low-low and hi-hi parameter


details (BSEQ programs only). For function block arguments,
it is possible to specify a function block name or number of the
proper type.
Example DD D1 = (DD_1)
RBUF B1 = (127)

Argument Selection List For a type ANY argument a list of allowable entries will be
defined. When preparing a unit procedure, the unit procedure
editor presents a list of the only valid inputs for the argument.

WBPEEUI330254B3 4 - 133
PHASE SUBR (Subroutine)

Format ANY pnameN = (const1, const2 [...constN])

Parameter Description
constN Name of a constant declared in the batch data section of the program, or a Batch 90
reserved constant.

Example ANY COLOR_CHOICE = (RED, BLUE, MAGENTA)

Remarks Pick lists for parameters are not used by the recipe editor
when editing programs utilizing PHASEX function codes.
Therefore parameter pick lists generate a warning in Batch 90
programs utilizing PHASEX function codes.
High and Low Limits The .HLIM and .LLIM reference extensions allow a program to
read the high and low limits of recipe ANY parameters.
References Parameter data can be using the appropriate name in an
expression.

pname.data

Parameter Description
pname Name of the parameter.
data Type of data being read. Not supported by PHASEX programs.
.HLIM High limit value.
.LLIM Low limit value.

Example PHASE SUBR EXAMPLE_SUBR


ANY TGT_RATE
NORMAL_LOGIC
SET SETPOINT_MIN.VAL = TGT_RATE.LLIM
SET SETPOINT_MAX.VAL = TGT_RATE.HLIM



ENDSUBR

Remarks The values returned by .LLIM and .HLIM are the low limit and
high limit values specified by the active unit procedure. These
extensions are not allowed in Batch 90 programs utilizing
PHASEX function codes.

4 - 134 WBPEEUI330254B3
PHASE SUBR (Subroutine)

Declarations This section specifies local data and calls to monitor subrou-
tines. The format is:

type1 name1



typeN nameN
Example DECLARATIONS
VAR COUNTER
ONST MIN_LIMIT = 3.0
TIMER TMR (MIN)
INTEGRATOR INTG1
FGEN PROFILE1 ((0.0, 80.0), (30.0, 100.0), (60.0, 80.9))
RAMP LEVEL RAMP (LIC501.SP, SEC)
MONITOR MON1 (FC211, FC215, FC534)

NOTES:
1. The phase subroutines local data exists only while the operation is active.

2. PHASE SUBR is an ISA-S88.01-1995 standard term. Usage of this term


prohibits compiling with ABB specific terms. The ABB specific term is STEP
SUBR. To use the ABB specific term, replace PHASE with STEP.

Parameter Description
type May be any one of the following:
ARRAY All types.
CONST Constant.
CONST STRING Constant string.
FGEN Function generator.
INTEGRATOR Integrator.
MONITOR Call to monitor.
RAMP Ramp.
TIMER Timer.
VAR Variable.
VAR STRING Variable string.
name Local name assigned to the nth parameter. The nth parameter
corresponds to the n th item in the unit procedures list of formulation
data. The name is restricted to a maximum of 32 characters.

WBPEEUI330254B3 4 - 135
PROGRAM DESCRIPTOR (Function)

PROGRAM DESCRIPTOR (Function)


Purpose To retrieve the program descriptor from the current Batch 90
program executing in a BSEQ function block.
Language BSEQ, PHASEX, UDF
Declaration {from a Batch 90 program}
PROGRAM DESCRIPTOR (vstring)

{from a UDF program}


PROGRAM DESCRIPTOR (bseqx, vstring)

Parameter Description
vstring Name of the variable string (capable of storing at least 64 characters) used to return
the specified descriptor. PHASEX programs can only accept 32 (or less) characters.
bseqx Name of the BSEQ function block declaration.

#PROGRAMID (Directive)
Purpose Sets the program ID of the .OBJ file generated when the class
is successfully compiled. The program ID must match specifi-
cation S9 of the BSEQ and PHASEX function codes used to
execute the Batch 90 program. The program ID of the Batch
90 program defaults to zero if not declared.
Language BSEQ, PHASEX, UDF
Declaration #PROGRAMID = const

Parameter Description
const Any real number.

4 - 136 WBPEEUI330254B3
Ramp Data (Data Structure)

Ramp Data (Data Structure)


Purpose The ramp is an active data structure that changes a control
station set point at a uniform rate over time.
Language BSEQ, PHASEX, UDF
Declaration The ramp declaration format is:

RAMP r name (vname, units)

Parameter Description
r name Name of the ramp.
vname Name of the value to be ramped. This value must be one of the following types:
AOL.VAL
CS.CO
CS.SP
REMSET.VAL
RBUF.VAL
VAR
(or an array element of one of the above types)
units Units of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.

Examples RAMP TEMP_RAMP (TIC501.SP, MIN) {station SP}


RAMP LEVEL_RAMP (LIC501.SP, SEC) {station CO}

Reference Ramp data may be read by using the appropriate name in an


expression.

r name.VAL

Parameter Description
r name Name of the ramp.
data Type of data being read.
LIM Upper limit.
RATE Rate.
STS Current status:
0 = holding.
1 = running.
VAL Current value.

WBPEEUI330254B3 4 - 137
Ramp Data (Data Structure)

Example IF (TEMP_RAMP.LIM > 150) THEN


IF (TEMP_RAMP.RATE > 2.5) THEN
IF (TEMP_RAMP.STS IS RUNNING) THEN
X = TEMP_RAMP.VAL

Commands Use the following statements to tune ramp data.


START rname FROM exp1 TO exp2 AT exp3

Parameter Description
r name Name of the ramp.
exp1 Initial ramp value.
exp2 Upper limit of ramp.
exp3 Rate of change.

This command changes the status from holding to running;


has no effect if status is running.

NOTE: If the ramp rate is positive (that is, from a low initial value to a higher
final value) then the rate (exp3) must reflect this by being a positive number.
Similarly, if the ramp is negative (that is, from a high initial value to a lower final
value) then the rate (exp3) must be negative. If these values are not the correct
sign, the ramp step changes to the target end value.
Example START LEVEL_RAMP FROM 10.0 TO 15.8 AT 0.5

operation rname

Parameter Description
operation Type of operation being performed.
HOLD Hold the ramp execution.
RESUME Resume the ramp execution.
r name Name of the ramp.

Examples HOLD LEVEL_RAMP


RESUME LEVEL_RAMP

Remarks HOLD - This command changes the status from running to


holding; has no effect if status is not running.

RESUME - This command changes the status from holding to


running; has no effect if status is not holding.

4 - 138 WBPEEUI330254B3
RBUF

RBUF
Refer to Data Buffer (Function Block).

RECIPE DESCRIPTOR (Function)


Purpose To retrieve the unit recipe descriptor from the current unit rec-
ipe executing in a BSEQ function block.
Language BSEQ, UDF
Declaration {from a Batch 90 program}
RECIPE DESCRIPTOR (const, vstring)

{from a UDF program}


RECIPE DESCRIPTOR (bseqx, const, vstring)

Parameter Description
const Line type of the description to be returned. Descriptions that can be returned are:
1 = unit procedure description.
2 = unit description.
3 = equipment list description.
4 = master recipe description.
5 = train description.
vstring Name of the variable string (capable of storing at least 64 characters) used to return
the specified descriptor.
bseqx Name of the BSEQ function block declaration.

Examples RECIPE DESCRIPTOR = (1, REC_DESC_STRING)


RECIPE DESCRIPTOR = (3, EQ_LIST_STRING)

RECIPE ENTRY (Function)


Purpose To read descriptors from files in the Batch\UDF directory of
the control module. This function enables a Batch 90 program
to read all of the files contained in the Batch\UDF file direc-
tory and return their file ID and descriptor.
Language BSEQ, PHASEX
Declaration RECIPE ENTRY (const1, exp1, var1, vstring, var2 )

WBPEEUI330254B3 4 - 139
RECIPE ENTRY (Function)

Parameter Description
const1 Line type of the description to be returned. Descriptions that can be returned are:
1 = unit recipe description.
2 = unit description.
3 = equipment list description.
4 = master recipe description.
5 = train description.
exp1 The address of the BSEQ function block that contains the specified unit recipe
descriptors.
var1 Numeric variable used to track position in the batch directory. The value of the
variable at the beginning of execution specifies the starting position for the directory
search. Upon completion, the command will return a:
x = current directory position.
0 = end of the batch directory.
-1 = file error.
vstring Name of the variable string (capable of storing at least 64 characters) used to return
the specified descriptor.
var2 Numeric variable used by the command to return the unit procedure ID associated
with the unit procedure file selected by the search.

Example Read the unit recipe descriptors for the first 10 unit recipes
associated with function block 100. RDESCS is a variable
string array of 10 elements and RIDS is a numeric variable
array of 10 elements.
FUNCTION GET_DESCRS
DECLARATIONS
VAR NDEX
VAR D_POSN
VAR STRING ARRAY RDESCS (1:10)
VAR ARRAY RIDS (1:10)
EXECUTABLE
BNUM = 100
NDEX = 0
D_POSN = 0
REPEAT
D_POSN = D_POSN + 1
NDEX = NDEX + 1
RECIPE ENTRY (1, B_NUM, D_POSN, \
RDESCS (NDEX), RIDS (NDEX))
UNTIL ((D_POSN <= 0) OR (NDEX > 10))
ENDSUBR GET_DESCRS

4 - 140 WBPEEUI330254B3
Remote Control Memory (Function Block)

Remote Control Memory (Function Block)


Purpose The remote control memory (RCM) function block (FC 62) acts
as a remotely operated switch (controlled by an operator
workstation).
Language BSEQ, PHASEX, UDF
Declaration The RCM function block must be declared before it can be
accessed from a subroutine. The declaration can appear only
in the data section.

BLOCK name, BLK = const, FC = RCM [, WATCH]

Parameter Description
name Name of the RCM function block.
const Function block address.
WATCH The RCM function block to be placed on WATCH by the batch historian upon
(BSEQ only) program startup. If not specified, the RCM function block will be off watch.

Example BLOCK RCM501, BLK = 100, FC = RCM

References RCM data may be read by using the appropriate name in an


expression.

name.VAL

Parameter Description
name Name of the RCM function block.
name.VAL Output value.

Example IF (RCM501.VAL=ON) THEN

Commands Use the following statement to tune RCM function blocks.


SET name.data = exp

WBPEEUI330254B3 4 - 141
Remote Manual Set Constant (Function Block)

Parameter Description
name Name of the RCM function block.
data Type of data being set.
VAL Output value.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of the data.

Examples SET RCM501.VAL = 1


SET RCM501.WATCH = ON

Remarks The RCM function block treats these commands as if they were
issued by an operator workstation. For example, the command
is ignored if the function blocks permissive input does not
allow the command. These commands are buffered within the
function block and do not have an immediate effect on the
function block. The command will not take effect until the
function block executes on its next cycle.

Remote Manual Set Constant (Function Block)


Purpose A remote manual set constant (REMSET) function block
(FC 68) provides a way for an operator to set a constant in a
control module (via the operator workstation).
Language BSEQ, PHASEX, UDF
Declaration The REMSET function block must be declared before it can be
accessed from a subroutine. The declaration can appear only
in the data section.
BLOCK name, BLK = const, FC = REMSET[, WATCH]

Parameter Description
name Name of the REMSET function block.
const Function block address.
WATCH Specifies that the REMSET function block is to be placed on watch by the batch
(BSEQ only) historian upon program startup. If not specified, the REMSET function block will
be off watch.

Example BLOCK RSET501, BLK = 100, FC = REMSET

4 - 142 WBPEEUI330254B3
Remote Manual Set Constant (Function Block)

References REMSET data may be read by using the appropriate name in


an expression.

name.VAL

Parameter Description
name Name of the REMSET function block.
name.VAL Output value.

Example X = RSET501.VAL

Commands Use the following statement to tune REMSET function blocks.

SET name.data = exp

Parameter Description
name Name of the REMSET function block.
data Type of data being set.
VAL Output value.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Example SET RSET501.VAL = 100


SET REMSET501.WATCH = ON

Remarks The REMSET function block treats the set output command as
if it were issued by an operator workstation. For example, the
command is ignored if the function block is in track mode.
This command is buffered within the function block and does
not have an immediate effect on the function block. The com-
mand will not take effect until the function block executes on
its next cycle.

WBPEEUI330254B3 4 - 143
Remote Motor Control (Function Block)

Remote Motor Control (Function Block)


Purpose The remote motor control (RMC) function block (FC 136) is
used by an operator or a batch/UDF program to control a
motor.
Language BSEQ, PHASEX, UDF
Declaration Specifications S1 and S2 of an RMC function block determine
whether its control output is controlled by the batch/UDF pro-
gram or by function blocks. If both specifications are set to
two, the batch/UDF program has control.

BLOCK name, BLK = const, FC = RMC[, WATCH]

Parameter Description
name Name of the RMC function block.
const Function block address.
WATCH Specifies that the RMC function block is to be placed on watch by the batch historian
(BSEQ only) upon program start up. If not specified, the RMC function block will be off watch.

Example BLOCK MOTOR501, BLK = 240, FC = RMC

References RMC data may be read by using the appropriate name in an


expression.

name.data

Parameter Description
name Name of the RMC function block.
data Type of data being read.
CO Control output value (0, 1).
FBn Feedback number (1 or 2).
ILKn Interlock number (1, 2, 3, or 4).
PERMn Permissive number (1 or 2).
STS Control output status:
0 = good.
1 = bad.
2 = waiting.

4 - 144 WBPEEUI330254B3
Remote Motor Control (Function Block)

Example X = MOTOR501.CO
X = MOTOR501.FB1
Y = MOTOR501.ILK4
X = MOTOR501.PERM1
X = MOTOR501.STS

Commands The following statements are used to control RMC function


blocks.

SET name.data = exp

- or -

SET AND WAIT name.CO = exp

Parameter Description
name Name of the RMC function block.
data Type of data being set.
CO Control output value.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Example SET MOTOR501.CO = ON


SET RMC501.WATCH = ON

Remarks The first form of the statement (SET) writes the control output
value to the block and continues on to the next statement. The
second form (SET AND WAIT) writes the control outputs value
to the function block and then waits for confirmation (that is,
the function blocks control output value is the same as exp
and the control output status is good). The statement retries
the operation once per function block cycle while waiting.

WBPEEUI330254B3 4 - 145
REPEAT...UNTIL (Control Structure)

REPEAT...UNTIL (Control Structure)


Purpose This statement continuously executes a block of statements
until some condition becomes true.
Language BSEQ, PHASEX, UDF
Format REPEAT
statement1



statementN
UNTIL (exp)
Example START TIMER1
REPEAT



UNTIL (TIMER1.VAL >= 30.0)

Remarks Statements 1 through N are executed. If exp is FALSE, state-


ments 1 through N are executed and exp is evaluated again.
This continues until exp becomes true. If exp is TRUE, execu-
tion continues at statement following UNTIL.

A repeat loop can be terminated by a break statement.

The program is suspended for one cycle each time the exp is
evaluated (including the first time). The suspension occurs
before evaluating exp. This statement should not be used
where execution is continuous (for example, in a monitor
subroutine).

RESERVE
Refer to Common Sequence (Data Structure).

RESET
Refer to Function Generator (Data Structure), INTEGRATOR
(Data Structure), and TIMER (Data Structure).

4 - 146 WBPEEUI330254B3
RESTART (Statement)

RESTART (Statement)
Purpose This statement transfers control from the FAULT LOGIC to the
RESTART LOGIC.
Language BSEQ, PHASEX
Format RESTART
Example RESTART

Remarks If there is no RESTART LOGIC, control is transferred to the


beginning of NORMAL LOGIC or the last executed restart
point.

The RESTART statement can be used only in the FAULT


LOGIC of a phase subroutine. It cannot be used in a function
or monitor subroutine.

RESTART LOGIC (Section)


Purpose This statement marks the beginning of the restart logic section
of a phase subroutine. This section provides the sequential
control of an operation during the transition from held to
normal.
Language BSEQ, PHASEX
Format RESTART LOGIC
statement



statement
Example RESTART LOGIC
SET FIC401.CO = OPEN
SET FIC402.CO = CLOSED
RESUME AT MAJOR POINT

Remarks This section is activated when the batch mode is changed from
held to normal. This section must contain at least one
RESUME statement. When a RESUME statement is executed,
control is transferred to the normal logic at the appropriate
restart point.

WBPEEUI330254B3 4 - 147
RESTART POINT (Statement)

When this section is first activated, fault mode is disabled. If


desired, fault mode may be enabled anywhere in this section
by an ENABLE FAULT CODE statement. Otherwise, fault
mode is automatically enabled when control is transferred
back to the normal logic.

RESTART POINT (Statement)


Purpose The RESTART POINT statement marks a restart point in the
normal logic of a phase subroutine.
Language BSEQ, PHASEX
Format MAJOR RESTART POINT id

- or -

MINOR RESTART POINT id

Paramete
Description
r
id Positive integer that uniquely identifies this point in normal logic.

Examples MAJOR RESTART POINT 102


MINOR RESTART POINT 3

Remarks This statement may be used only in the normal logic of a


phase subroutine.

The normal logic may contain many MAJOR and MINOR


RESTART POINT statements. However, at any given time,
there is only one active major restart point and one active
minor restart point.

When a phase subroutine is first activated, both active restart


points are at the first statement of the normal logic. If a
MAJOR RESTART POINT statement is executed, both active
restart points move to that statement. If a minor restart point
statement is executed, only the active minor restart point
moves to that statement.

If the normal logic is interrupted (that is, the mode is changed


to FAULT or HOLD), the current restart state is maintained. If
the phase subroutine is restarted, then the restart logic may
specify where to resume the normal logic based on the restart
state (refer to the RESUME AT (Statement) statement).

4 - 148 WBPEEUI330254B3
RESUME

RESUME
Refer to Ramp Data (Data Structure).

RESUME AT (Statement)
Purpose This statement transfers control from the restart logic to the
appropriate normal logic statement.
Language BSEQ, PHASEX
Format RESUME AT MAJOR POINT

- or -

RESUME AT MINOR POINT

- or -

RESUME AT id

Parameter Description
id An ID of a restart point statement.

Examples RESUME AT MAJOR POINT {restart at active major restart point}


RESUME AT MINOR POINT {restart at active minor restart point}
RESTART AT 101 {restart at restart point with id of 101}

Remarks If an id is specified, control is transferred to the normal logic


restart point statement with the specified ID. Otherwise, con-
trol is transferred to the normal logic at the specified (major or
minor) active restart point.

The RESUME AT statement can be used only in the restart


logic of a phase subroutine. It cannot be used in any other
phase, monitor, or function subroutine section.

WBPEEUI330254B3 4 - 149
RETURN (Statement)

RETURN (Statement)
Purpose The RETURN statement (optionally) specifies a functions value
and returns control from a function subroutine.
Language BSEQ, PHASEX, UDF
Format RETURN [exp]

Parameter Description
exp Value to be returned to caller.

Examples RETURN {no value}


RETURN (10){value is 10}
RETURN (x + y){value is x + y}

Remarks When the RETURN statement executes, it terminates the func-


tion subroutine and returns control to the caller.

A function subroutine may contain more than one RETURN


statement. If the last statement of a function is not a return
then one is automatically generated by the compiler.

All RETURN statements in a function must be consistent in


their use of return values. All must specify return values or
none may (refer to FUNCTION (Subroutine) subroutine).

SET
Refer to Advanced PID (Function Block), Analog Exception
Report (Function Block), Common Sequence (Data Structure),
Control Station (Function Block), Data Buffer (Function
Block), Device Driver (Function Block), Digital Exception
Report (Function Block), Multistate Device Driver (Function
Block), Remote Control Memory (Function Block), Remote
Manual Set Constant (Function Block), Remote Motor Control
(Function Block), and Smith Predictor (Function Block).

SET AND WAIT


Refer to Device Driver (Function Block), Multistate Device
Driver (Function Block), and Remote Motor Control (Function
Block).

4 - 150 WBPEEUI330254B3
SIZEOF (Function)

SIZEOF (Function)
Purpose SIZEOF refers to the dimension size of an array. It returns the
number of elements in the specified dimension of the array.
Language BSEQ, PHASEX, UDF
Declaration None required.
References Use the following statement to read the number of elements.
SIZEOF (array_name) {total number of elements)

- or -

SIZEOF (array_name, n) {number of elements in dimension}

Parameter Description
array_name Name of an array of any type.
n First, second, or third array dimension.

Example FUNCTION ARRAY_MANIPULATE


VAR ARRAY SARRAY
DECLARATION
VAR I, J, K, X, Y, Z
EXECUTABLE
X = SIZEOF (SARRAY, 1)
Y = SIZEOF (SARRAY, 2)
Z = SIZEOF (SARRAY, 3)
FOR I = 1 TO X DO
FOR J = 1 TO Y DO
FOR K = 0 TO Z DO



END FOR K
END FOR J
END FOR I
ENDSUBR ARRAY_MANIPULATE

Remarks SIZEOF enables the programmer to write function subroutines


that do array manipulations with arrays of variable
dimensions.

WBPEEUI330254B3 4 - 151
SKIP CYCLE (Statement)

SKIP CYCLE (Statement)


Purpose The SKIP CYCLE statement causes a program section (for
example, CONTINUOUS, NORMAL LOGIC) to terminate execu-
tion until the next cycle.
Language BSEQ, PHASEX, UDF
Format SKIP CYCLE
Example NORMAL LOGIC
SET FC501.MODE = MANUAL
SKIP CYCLE
SET FC501.CO = 0.0

Remarks When the SKIP CYCLE statement is executed, the section con-
taining the statement terminates execution for the current
cycle (that is, the remaining part of the section is skipped).
When SKIP CYCLE is used in normal logic, it terminates the
execution of the normal logic and returns to function block
execution on the next cycle. Execution of normal logic returns
to the executable statement after the SKIP CYCLE statement.

SKIP CYCLE should not be used in monitor subroutines.

Smith Predictor (Function Block)


Purpose The smith predictor function block (FC 160) provides a mecha-
nism for the control of processes with dead time. The program
interface to a smith predictor provides information about a
process and its controller and allows changes to the tuning
parameters.
Language BSEQ, PHASEX, UDF
Declaration BLOCK name, BLK = const, FC = SMITH

Parameter Description
name Name of the function block.
const Function block address.

Example BLOCK S501, BLK = 240, FC = SMITH

4 - 152 WBPEEUI330254B3
Smith Predictor (Function Block)

References Smith predictor data may be read by using the appropriate


name in an expression.

name.data

Parameter Description
name Name of the function block.
data Type of data being read.
CO Value of control output.
DTIM Dead time (specification S8) in seconds.
GAIN Gain (specification S7).
HLIM High limit (specification S11).
LAG Lag time (specification S9) in seconds.
LLIM Low limit (specification S12).
PV Value of process variable (specification S1).
SP Value of set point (specification S2).
TRK Tracking flag (specification S4):
0 = tracking.
1 = released.
TUN Tuning time constant (specification S10) in seconds.

Examples X = S501.CO
X = S501.TUN

Commands The following statements are used to tune smith predictor


function blocks.

SET name.data = exp

Parameter Description
name Name of the function block.
data Type of data being set.
DTIM Dead time parameter.
GAIN Gain value.
LAG Lag value.
TUN Tuning parameter value.
exp New value of data.

Examples SET S501.DTIM = 30.0


SET S501.TUN = 30.0

WBPEEUI330254B3 4 - 153
START

START
Refer to Common Sequence (Data Structure), Function Gener-
ator (Data Structure), INTEGRATOR (Data Structure), MONI-
TOR (Subroutine), Ramp Data (Data Structure), and TIMER
(Data Structure).

STATE SUBR (Subroutine)


Purpose A state subroutine is a major unit of an UDF program. It is
responsible for controlling the sequence of activities within a
UDF program. Figure 4-7 shows the general structure of a
state subroutine.

STATE SUBR name [START [AND WAIT]]


DECLARATIONS
Local data and monitor subr calls
CONTINUOUS
Executable statement
NORMAL LOGIC
Executable statements
FAULT LOGIC
Executable statements
ENDSUBR [name]

Figure 4-7. State Subroutine Structure

Language UDF
Heading A state subroutine heading defines the name of the subrou-
tine. The heading format is:

STATE SUBR name [START [AND WAIT]]

Parameter Description
name Name of this subroutine. The name must be unique within the UDF program. The
maximum length is 16 alphanumeric characters. Embedded spaces are not allowed.
START Specifies that this subroutine will be executed first when the UDF program is started.
Only one state subroutine may be designated as the starting point of the UDF
program.
AND WAIT Designates that the normal logic of the state subroutine will not execute until startup
of the multifunction processor module is complete.

4 - 154 WBPEEUI330254B3
STATE SUBR (Subroutine)

Examples STATE SUBR INITIAL_SUBR START


STATE SUBR FIRST_SUB START AND WAIT
STATE SUBR MOTOR_STOP

Declarations The following specifies local data and calls to monitor subrou-
tines for state subroutines:

type1 name1



typen namen
Example DECLARATIONS
VAR COUNTER
CONST MIN_LIMIT = 3.0
TIMER TMR1 (MIN)
INTEGRATOR INTG1
FGEN PROFILE1 ((0.0, 80.0), (30.0, 100.0), (60.0, 80.0)))
RAMP LEVEL RAMP (LIC501.SP, SEC)
MONITOR MON1 (FC211, FC215, FC534)

Parameter Description
typen Data type of the Nth parameter. Data type must be one of the following:
BLOCK ARRAY Function block array.
CONST Constant.
CONST STRING Constant string.
CONST STRING ARRAY Constant string array.
FGEN Function generator.
INTEGRATOR Integrator.
MONITOR Monitor subroutine.
RAMP Ramp.
TIMER Timer.
TIMER ARRAY Timer array.
VAR Variable.
VAR ARRAY Variable array.
VAR STRING Variable string.
VAR STRING ARRAY Variable string array.
namen Local name of the n th parameter. The N th parameter corresponds to the n th item in
the recipes list of formulation data. The name is restricted to 32 characters maximum.

WBPEEUI330254B3 4 - 155
STEP SUBR (Subroutine)

STEP SUBR (Subroutine)


NOTE: STEP SUBR is a ABB specific term. Usage of this term prohibits com-
piling to ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard term is
PHASE SUBR. To use the ABB specific term, refer to PHASE SUBR (Subrou-
tine) and replace PHASE with STEP.

SUBPHASE (Variable)
NOTE: SUBPHASE is a ABB specific term. Usage of this term prohibits compil-
ing to ISA-S88.01-1995 standards. The ISA-S88.01-1995 standard term is
PHASE NUMBER. To use the ABB specific term, refer to PHASE NUMBER
(Variable) and replace PHASE NUMBER with SUBPHASE. SUBPHASE is not
supported in Batch 90 programs using the PHASEX function code.

SUBR DESCRIPTOR (Function)


Purpose To retrieve the phase subroutine descriptor of the currently
active operation from the current unit recipe executing in a
BSEQ function block.
Language BSEQ, PHASEX, UDF
Declaration {from a Batch 90 program}
SUBR DESCRIPTOR (exp, vstring)

{from a UDF program}


SUBR DESCRIPTOR (bseqx, exp, vstring)

Parameter Description
exp Phase number of the active operation within the unit recipe from which the
descriptor is desired.
vstring Name of the variable string (capable of storing at least 32 characters) used to return
the specified descriptor.
bseqx Name of the BSEQ function block declaration. Only supported for UDF programs.

Example S_NUM = 0
REPEAT
S_NUM = S_NUM + 1
SUBR DESCRIPTOR (S_NUM, SUBRS(S_NUM))
UNTIL ((S_NUM >= LAST SUBR) OR (S_NUM > 31))

Remarks PHASEX programs return the phase name from the active
phase subroutine.

4 - 156 WBPEEUI330254B3
SUBR STATUS (Function)

SUBR STATUS (Function)


Purpose To retrieve the phase subroutine execution status from the
current operation of the unit recipe executing in a BSEQ func-
tion block.
Language BSEQ, UDF
Declaration {from a Batch 90 program}
var = SUBR STATUS (exp)
{from a UDF program}
var = SUBR STATUS (bseqx, exp)

Parameter Description
var Name of the variable used to return the execution status which can be:
-1 = complete.
0 = outside range of the current operation.
1 = active.
exp Number of the phase subroutine from which the execution status is desired.
bseqx Name of the BSEQ function block declaration.

Example S_NUM = 0
FOR I = 1 TO 32 DO
S_NUM = I
STS_VAR (S_NUM) = SUBR STATUS (BATCH_UNIT, S_NUM)
IF (S_NUM >= LAST SUBR) BREAK
END FOR

Remarks The exp number must be one for PHASEX programs.

Text Selector (Function Block)


Purpose This function block displays messages on operator
workstations.
Language BSEQ, PHASEX, UDF
Declaration The text selector function block (FC 151) must be declared
before it can be accessed from a subroutine. The declaration
can appear only in the data section. Batch 90 and UDF pro-
gramming languages will only manipulate text selector func-
tion blocks if specifications S1 and S2 have values of five.
Specification S3 must have a value of zero. These are the func-
tion blocks default values.

WBPEEUI330254B3 4 - 157
Text Selector (Function Block)

BLOCK fbname, BLK = const, FC = TEXT [, WATCH]

Parameter Description
fbname Name of the function block.
const Function block address.
WATCH Specifies that the text selector be placed on WATCH by the batch historian
(BSEQ only) upon program startup. If not specified, the text selector will be off watch.

Example BLOCK K100_FMSG, BLK = 100, FC = TEXT

Reference Text selector data can be read using the appropriate name in
an expression.

name.data

Parameter Description
name Name of the function block.
data Type of data being read.
BLNK Blink status:
False (0) = not blinking.
True (1) = blinking.
CLR Message color.
MSG Message number.

Examples X = OPMSG.BLNK
X = OPMSG05.MSG

Commands Use the following statements to tune text selector function


block.

DISPLAY MESSAGE exp1 COLOR exp2 \


[BLINKING exp3 ] USING name

Parameter Description
exp1 A message number.
exp2 Console color code:
Black (0)
White (1)
Red (2)
Green (3)
Blue (4)
Cyan (5)
Magenta (6)

4 - 158 WBPEEUI330254B3
Text Selector (Function Block)

Parameter Description
exp2 (continued) Console color code:
Yellow (7)
Orange (8)
Yellow-Green (9)
Green-Cyan (10)
Cyan-Blue (11)
Blue-Magenta (12)
Magenta-Red (13)
Dark Gray (14)
Light Gray (15)
Purple (17)
Brown (32)
exp3 Blinking status:
On = message will blink.
Off = message will not blink.
name Name of the text select function block.

Example DISPLAY MESSAGE 2 COLOR GREEN BLINKING ON USING \


BIN_FILL_NO.

SET name.data = exp

Parameter Description
name Name of the function block.
data Type of data being set.
BLNK Blink status:
Off = 0 (not blinking).
On = 1 (blinking).
CLR Message color.
MSG Message number.
WATCH Batch historian watch status (BSEQ only):
0 = off.
1 = on.
exp New value of data.

Examples SET OPMSG05.BLNK = X


SET OPMSG05.WATCH = ON

Remarks These commands are buffered within the function block and
do not have an immediate effect on the function block. The
command will not take effect until the function block executes
on its next cycle.

WBPEEUI330254B3 4 - 159
TIMER (Data Structure)

TIMER (Data Structure)


Purpose Timers are active data structures used to measure elapsed
time. A timer may be declared either globally or locally.
Language BSEQ, PHASEX, UDF
Declarations The following is used to define a timer.

TIMER tname (units)

Parameter Description
tname Name of the timer.
units Unit of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.

Examples TIMER TIMER1 (SEC)


TIMER COOK_TIME (MIN)

If a timer is declared locally (that is, in a phase or state sub-


routine) then its value is initialized to zero at the start of the
subroutine.
Reference Timer data may be read by using the appropriate name in an
expression.

tname.data

Parameter Description
tname Name of the timer.
data Type of data being read.
ALM Alarm status:
0 = false (no alarm).
1 = true (alarm).
LIM Alarm limit:
-1 = the START command does not specify an alarm
status.
STS Status of timer:
0 = holding.
1 = running.
VAL Timer value.

4 - 160 WBPEEUI330254B3
TIMER (Data Structure)

Examples IF (TIMER1.ALM) THEN


X = TIMER1.VAL

Commands The following statements are used to control timers.

Start

START tname [exp]

Parameter Description
tname Name of the timer.
exp Alarm limit.

Examples START TIMER1


START TIMER1 30.0

This sets the alarm limit, updates the alarm status and sets
the timer status to running. The timer value is not effected. If
an alarm limit is not specified, the alarm status is not
changed.

Hold

HOLD tname

Parameter Description
tname Name of the timer.

Example HOLD TIMER1

This sets the status to holding (nothing else is effected).

Reset

RESET tname (exp)

Parameter Description
tname Name of the timer.
exp Initial time.

Example RESET TIMER1 (0)

This sets the time to exp, updates the alarm status and sets
the status to holding. If no limit is specified, it is assumed to
be zero.

WBPEEUI330254B3 4 - 161
#TITLE (Directive)

#TITLE (Directive)
Purpose The #TITLE directive assigns a title to each page of the listing
file. Typically this is done to make the listing easier to read.
Language BSEQ, PHASEX, UDF
Format #TITLE “string”

Parameter Description
string User defined title.

Remarks The #TITLE directive will cause an immediate page eject unless
#TITLE is the first line of a program. The string is limited to a
single line (250 characters).

UDF TYPE (Function Block)


Purpose The UDF Type 1 or UDF Type 2 function block executing the
UDF program must be declared. This allows the compiler to
check that all declarations to UDF Type 1 and UDF Type 2
function block inputs, outputs, and specifications are correct.
Language UDF
Declarations The following is used to declare the UDF TYPE function block.

UDF TYPE n

Parameter Description
n 1 for UDF Type 1 function blocks.
2 for UDF Type 2 function blocks.

Examples UDF TYPE 1


UDF TYPE 2

UNACQUIRE
Refer to Common Sequence (Data Structure).

UNCONNECT
Refer to Common Sequence (Data Structure).

4 - 162 WBPEEUI330254B3
UNIT DATA (Statement)

UNIT DATA (Statement)


Purpose The is the first statement in the UNIT DATA section of a batch
program. Unit data (like batch data) defines global data, func-
tion blocks, and symbols. Declarations made in unit data cre-
ate generic references to specific declarations contained in unit
definition files. Unit definition files are created, compiled, and
downloaded separate from the batch program. For a given
class of process equipment only one batch program source
needs to be written.
The match between generic declarations in the UNIT DATA
section of the batch program and the specific declarations with
unit-specific values in the unit definition file is made by data
type, name, and order. All components must match for the
proper connection between declarations and references to be
made.
Language BSEQ, PHASEX
Format UNIT DATA
type1 name1
type2 name2



END DATA

Parameter Description
type Any one of the following:
ANY Constant.
BLOCK Function block.
CONST STRING Constant string.
name Name of the data.

Example UNIT DATA


CONST STRING UNIT_NAME (16)
ANY UNIT_CAPACITY = (100<500<1000)
BLOCK INLET_VALVE, FC = DD
BLOCK DRAIN_VALVE, FC = DD
BLOCK TEMP_LOOP, FC = CS
BLOCK UNIT_MSG, FC = DATAEXPT
BLOCK FILTER_UNIT, FC = DD
END DATA

WBPEEUI330254B3 4 - 163
UNIT DATA (Statement)

Remarks All of the function block types supported by batch data are
also supported in unit data. The only difference between the
declarations is that the unit data declaration does not include
the function block address information. The function block
address information is supplied by the unit definition file. The
batch language compiler generates a blank template from
which the user can create the required number of unit defini-
tions by simply filling in the blank spaces. Refer to the follow-
ing example.
Example #TITLE “UNIT DEFINITION FILE EXAMPLE TITLE”
#DESCRIPTOR “16-CH FILE DESC”
#LOCATION LOOP = 1, PCU = 20, MODULE = 7, BSEQ = 1250
UNIT DATA
CONST STRING UNIT_NAME = “PROD TANK T402”
ANY UNIT_CAPACITY = (750)
BLOCK INLET_VALVE, BLK = 2005, FC = DD
BLOCK DRAIN VALVE, BLK = 2015, FC = DD
BLOCK TEMP_LOOP, BLK = 2025, FC = CS
BLOCK UNIT_MSG, BLK = 2045, FC = DATAEXPT
BLOCK FILTER_UNIT, BLK = 2450, FC = CSEQ, RING = 1,
PCU = 5, MODULE = 9
END DATA

For function block declaration details, refer to:

AOL Analog exception report.


APID Advanced PID.
BBUF Boolean data buffer.
CS Control station.
CSEQ Common sequence.
DATAEXPT User defined data export.
DOL Digital exception report.
DD Device driver.
MSDD Multistate device driver.
RBUF Real data buffer.
RCM Remote control memory.
REMSET Remote manual set constant.
RMC Remote motor control.
SMITH Smith block.
TEXT Text.

The block address data included on the #LOCATION line


within the unit definition file is the one-time address

4 - 164 WBPEEUI330254B3
UNIT DESCRIPTOR (Function)

specification for the BSEQ/PHASEX function block associated


with the unit. This unit address data is used by other tools
responsible for debugging, recipe creation, and file
maintenance.

UNIT DESCRIPTOR (Function)


Purpose To retrieve the unit descriptor from the unit definition associ-
ated with the BSEQ/PHASEX function block. This command is
only applicable when the batch program includes a UNIT
DATA section.
Language BSEQ, PHASEX, UDF
Declaration {from a Batch 90 program}
UNIT DESCRIPTOR (vstring)

{from a UDF program}


UNIT DESCRIPTOR (bseqx, vstring)

Parameter Description
vstring Name of the variable string (capable of storing at least 32
characters) used to return the specified descriptor.
bseqx Name of the BSEQ function block declaration.

UNIT PARAMETERS (Declarations)


Purpose Unit parameters are used to declare a list of global recipe
parameters that are valid for the entire program. This list pro-
vides a means for passing data from a recipe to all phase sub-
routines within the program. This section contains
declarations that define the name and data type of each
parameter. The parameter values are supplied by the recipe
and are valid for the entire recipe execution.
Language BSEQ
Declaration UNIT PARAMETERS
ANY pname
- or -
ANY pname = (min <val <max )
- or -
ANY pname = (const1, const2[,..., constn])
- or -

WBPEEUI330254B3 4 - 165
UNRESERVE

CSEQ seqname, LIST = (filename)


- or -
STRING str_arg [(cons)]
- or -
STRING str_arg [(cons)] = (cstrname)
- or -
STRING str_arg [(cons)] = (cstr1, cstr2 [, ..., cstrN ])
- or -
STRING str_arg [(cons)] = “text_string”



END DATA

Parameter Description
pname Name of the parameter used by the program.
min Low limit value.
val Parameter value.
max High limit value.
constn Nth constant value of the selection list.
seqname Alias name that may be used by subroutines to reference or command a CSEQ
function block.
filename Name of the ASCII text file that contains CSEQ declarations written in the format as
required by the CSEQ declarations in the BATCH DATA section.
str_arg Name of the string recipe parameter.
cons Maximum number of characters that the recipe may specify for the string parameter.
The default value is 80 characters.
cstrname Name of the constant string.
cstrN Nth string constant value from the selection list.
text_string Explicit constant string.

References Any subroutine within the program can refer to a parameter


declared in the UNIT PARAMETERS section.
Remarks Only one UNIT PARAMETERS section is allowed within a pro-
gram and it must appear before all phase subroutines. There
can be no more than 250 unit parameters.

UNRESERVE
Refer to Common Sequence (Data Structure).

4 - 166 WBPEEUI330254B3
VAR (Data)

VAR (Data)
Purpose To define a variable.
Language BSEQ, PHASEX, UDF
Declaration The following is used to define a variable.
VAR name [= cons]

Parameter Description
name Name of the variable.
cons Initial value.

Example VAR VOLUME

Reference The value of a variable is read by using its name in an


expression.

name

Parameter Description
name Name of the variable.

Example X = VOLUME

Commands Refer to the Assignment (Statement) function.

VAR ARRAY (Data Structure)


Purpose A variable array is a group of variables organized in a table. An
array may have one, two or three dimensions. The array as a
whole has a name. An individual variable (element) of an array
is identified by an array index which specifies the position of
the element within the array. An array index consists of sub-
scripts - one subscript for each dimension.
Language BSEQ, PHASEX, UDF
Declaration The following statements are used to declare variable arrays:

{for one dimensional array}


VAR ARRAY name (low :high1)

{for two dimensional array}


VAR ARRAY name (low :high1, [low ]:high2 )

WBPEEUI330254B3 4 - 167
VAR ARRAY (Data Structure)

{for three dimensional array}


VAR ARRAY name (low :high1, [low ]:high2, [low ]:high3 )

Parameter Description
name Name of the variable array.
low Lowest subscript value. Must be 0 or 1.
highN Highest subscript value for the N th dimension. Must be a constant.
The total number of elements in an array must not exceed 16K.

Example VAR ARRAY XA (0:9), XB (0:9), XC (1:20)


VAR ARRAY Y (1:5, 1:10), YY (1:5, 1:10)
VAR ARRAY Z (0:5, 0:6, 0:7)

Reference VAR ARRAY data structures can be referenced by using the


appropriate name in an expression.

Element of an array - An individual element of an array is


referenced as follows:

{for one dimensional array}


name (exp1)
{for two dimensional array}
name (exp1, exp2 )
{for three dimensional array}
name (exp1, exp2, exp3 )

Parameter Description
name Name of the variable array.
expN Value of the N th subscript. If a subscript value
exceeds its specified range, it causes an error.

Examples A= XA (5)
A= Y (i, j)
A= Z (1, 2, i)
CALL MAX (Y (i, j), 105)

4 - 168 WBPEEUI330254B3
VAR ARRAY (Data Structure)

Entire array - In some operations it is necessary to refer to an


entire array as a whole. An entire array is referenced as
follows:

name
- or -

name (*...)

Parameter Description
name Name of the variable array.
(*...) Number of dimensions (that is, (*), (*,*), (*,*,*)).

The first form (just the name) is used when an array is passed
as an argument to a function or monitor. The second form is
used in other whole array operations (that is, array copy).
Examples CALL MAX_ELEMENT (Y)
XA (*) = 1
XB (*) = XA
Z (*,*,*) = 0

Commands The following statements are used to operate on array ele-


ments and whole arrays.

Assign (write) a value to an array element

{for one dimensional array}


name (exp1) = exp
{for two dimensional array}
name (exp1, exp2 ) = exp
{for three dimensional array}
name (exp1, exp2, exp3 ) = exp

Parameter Description
name Name of the variable array.
expN Value of the N th subscript. If a subscript value exceeds its
specified range, it causes an error.
exp Value to be assigned to element.

Examples XA (5) = 10
Y (i, j) 10 + XA (i)
Z (0,j, k) = 1

WBPEEUI330254B3 4 - 169
VAR ARRAY (Data Structure)

Initialize an array (set all elements to the same value)

name (*...) = val

Parameter Description
name Name of the variable array.
(*...) Number of dimensions.
val Value to be assigned to elements of an array. Must
be a single constant or variable.

Examples XA (*) = 0
Y (*, *) = 10
Z (*, *, *) = 10

Copy one array to another

dname (*...) = sname (*...)

Parameter Description
dname Name of the destination variable array.
sname Name of the source variable array.
(*...) Number of dimensions.

Examples XA (*) = XB (*)


Y (*, *) = YY (*, *)

This statement assigns the value from each element of the


source array to the corresponding element of the destination
array. The source array is not effected. The source array and
the destination array must be congruent (that is, the same
number of dimensions and same range for corresponding
dimensions). If they are not congruent, an error occurs.

NOTE: Subscript range checking is done by the compiler if all of the subscripts
of an array are constant. Range checking is always performed during program
execution. Each time an array element is read, the subscript values are
checked. If a subscript value is out-of-bounds, some error action is taken. If the
error occurs during any mode other than FAULT mode (for example, NORMAL
mode), the normal flow of control is aborted. The mode is changed to fault and
control is transferred to fault logic. if the error occurs during FAULT mode, flow
of control is not aborted.

4 - 170 WBPEEUI330254B3
VAR STRING (Data)

VAR STRING (Data)


Purpose Variable strings can be declared in the BATCH DATA section,
UNIT PARAMETERS section, or any place in the phase, func-
tion, or monitor subroutines.
Language BSEQ, PHASEX, UDF
Declaration VAR STRING vstrname [(cons)]

Parameter Description
vstrname Name of the variable string.
cons Maximum number of characters that may be written to the vari-
able string. Allowable values range from 1 to 80 (default value).

References Variable string data can be read using the appropriate name in
the following statements.

vstrname.data

Parameter Description
vstrname Name of the variable string.
data Type of data being read.
blank Entire value of the variable string.
CLEN Number of characters contained in the variable string.
MLEN Number of characters that may be contained within the variable string.

Examples OTHER_VAR_STRING = REQUIRED_ACTION


OTHER_VAR = REQUIRED_ACTION.MLEN

Remarks MLEN - The value defined by the .MLEN reference corresponds


to the value specified by the variable string declaration. This
value matches the value returned by the .CLEN reference only
when the variable string is full.

vstr name (FROM exp1[ FOR exp2 ])

Parameter Description
vstr name Name of the variable string that contains the referenced substring.
exp1 First character or starting point of the substring.
exp2 Number of characters to be included in the substring. If not specified, the
substring is terminated at the end of vstrname.

WBPEEUI330254B3 4 - 171
VAR STRING (Data)

Examples SOME_VSTRING = PROMPT_MSG (FROM 32)


OTHER_VSTRING = REQUIRED_ACTION (FROM 5 FOR 25)

Remarks Character positions begin with the left character as character


number one. Subsequent characters are numbered according
to their position relative to character number one. References
that extend beyond the end of the constant string shall be ter-
minated at the end of the variable string.
Commands When the source string or substring of a write string value
operation exceeds the capacity of the destination variable
string, only the amount of the source string that will fit shall
be shifted to the destination. If the starting point of a substring
write operation lies beyond the last character of the initial
string value, the operation is treated as an append operation.

Write to an entire string variable

vstrname = strname [ (FROM exp1 FOR exp2 )]


- or -

vstrname = “string_exp”
- or -

vstrname = strblk.ref_ext

Parameter Description
vstr name Name of the variable string.
str name Name of any type of string, string constant, or string variable.
exp1 Starting point within strname.
exp2 Number of characters from exp1 to be included in the substring. If no substring
references are made, the entire contents of strname shall be written to vstrname.
string_exp Explicit constant string to be written to vstrname.
strblk Name of a DATAEXPT function block.
ref_ext Input or output string reference extension (.ISTR or .OSTR)

Examples REQUIRED_ACTION = “VERIFY PROCESS CONDITION”


PROMPT_MSG = REQUIRED_ACTION (FROM 1 FOR 8)
SOME_VSTRING = STATUS_IND.ISTR

4 - 172 WBPEEUI330254B3
VAR STRING (Data)

Write to substring of string variable

vstr name (FROM exp1) = strname [ (FROM exp2 FOR \


exp3 )]
- or -
vstr name (FROM exp1) = “string_exp”
- or -

vstr name (FROM exp1) = strblk.ref_ext

Parameter Description
vstr name Name of the variable string.
exp1 First character or starting point of substring, within vstrname, that is to be written to.
strname Name of any string constant or string variable.
exp2 Starting point within strname.
exp3 Number of characters from exp1 to be included in the substring. If no substring
references are made, the entire contents of strname shall be written to vstrname.
string_exp Explicit constant string to be inserted into vstrname beginning at the exp1 character.
strblk Name of an export string function block.
ref_ext Input or output string reference extension (.ISTR or .OSTR).

Examples REQUIRED_ACTION (FROM 32) = “CLEAN VESSELS”


PROMPT_MSG (FROM 24) = UNIT_NAME (FROM 1 FOR 16)
SOME_VSTRING (FROM 17) = DIALOGUE.OSTR

Remarks Character positions begin with the left character as character


number one. Subsequent characters are numbered according
to their position relative to character number one.

Fill an entire string with a character

vstr name (*) = “a”

Parameter Description
vstr name Name of the variable string.
(*) Denotes that the entire variable string is to be filled with the character specified.
a The single character that is to used to file the entire variable string.

Examples PROMPT_MSG (*) = “ “


REQUIRED_ACTION (*) = “?”

WBPEEUI330254B3 4 - 173
VAR STRING ARRAY (Data Structure)

Append a string to the end of a variable string

vstr name (END) = str name [(FROM exp1 FOR exp2 )]

Parameter Description
vstr name Name of the variable string.
(END) Denotes that the string write operation will add the string to the end of the current
string contained in vstrname.
str name Name of any type of string, string constant (symbolic or explicit), string variable, or
string function block.
exp1 Starting point within strname.
exp2 Number of characters from exp1 to be included in the substring. If no substring
references are made, the entire contents of strname shall be written to vstrname.

Examples PROMPT_MSG (END) = “SAMPLE REQUIRED!”


REQUIRED_ACTION (END) = UNIT_NAME (FROM 17 FOR 32)

VAR STRING ARRAY (Data Structure)


Purpose A variable string array is a group of variable strings organized
in a table. An array may have one, two or three dimensions.
The array as a whole has a name. An individual variable string
(element) of an array is identified by an array index which
specifies the position of the element within the array. An array
index consists of subscripts - one subscript for each
dimension.
Language BSEQ, PHASEX, UDF
Declaration The following statements are used to declare variable string
arrays:
{for one dimensional array}
VAR STRING ARRAY name ([length, ]low :high1) [list ]

{for two dimensional array}


VAR STRING ARRAY name ([length, ]low :high1, \
[low :]high2 ) [list ]

{for three dimensional array}


VAR STRING ARRAY name ([length, ]low :high1, \
[low :]high2, [low :]high3 ) [list ]

4 - 174 WBPEEUI330254B3
VAR STRING ARRAY (Data Structure)

Parameter Description
name Name of the array.
length Maximum string length for each array element. Allowable values range from 1 to 80
(default value).
low Lowest subscript value. Must be 0 or 1.
highN Highest subscript value for the N th dimension. Must be a constant. The total number
of elements in an array must not exceed 16K.
list List of array element names. This one dimensional list has one entry for each
element of the array. The order of the entries is determined by varying the first (left)
subscript the fastest, then the second and the third.
NOTE: For two and three dimensional arrays, the lowest subscript value for the second and third dimension must match the
value that was specified by the first dimension.

Examples VAR STRING ARRAY XA (20, 1:3) (“STRING1”, “STRING2”, \


“STRING3”)

VAR STRING ARRAY Y (1:3, 1:2) (“STRING11”, “STRING21”, \


“STRING31”, “STRING12”, “STRING22”, “STRING32”)

VAR STRING ARRAY Z (60, 1:2, 1:2, 1:2) (“STRING111”, \


“STRING211”, “STRING121”, “STRING221”, “STRING112”, \
“STRING212”, “STRING122”, “STRING222”)

Reference VAR STRING ARRAY data structures can be referenced by


using the appropriate name in an expression.

Element of an array - An individual element of an array is


referenced as follows:

{for one dimensional array}


name (exp1)
{for two dimensional array}
name (exp1, exp2 )
{for three dimensional array}
name (exp1, exp2, exp3 )

Parameter Description
name Name of the array.
expN Value of the N th subscript. If a subscript value exceeds its
specified range, it causes an array error.

Examples STRING = XA (5)


STRING = Y (I, J)

WBPEEUI330254B3 4 - 175
VAR STRING ARRAY (Data Structure)

STRING = Z (1, 2, K)
SUBSTRING = B (I, 3) (FROM 1 FOR 8)

Entire array - In some operations it is necessary to refer to an


entire array as a whole. An entire array is referenced as
follows:

name
- or -

name (*...)

Parameter Description
name Name of the array.
(*...) Number of dimensions (that is, (*), (*,*), (*,*,*)).

The first form (just the name) is used when an array is passed
as an argument to a function or monitor. The second form is
used in other whole array operations (that is, array copy).
Examples NEW ARRAY (*) = OLD_ARRAY(*)
INIT_ARRAY (*,*) = 1

Commands The following statements are used to operate on array ele-


ments and whole arrays.

Assign (write) a value to an array element


{for one dimensional array}
name (exp1) = exp
{for two dimensional array}
name (exp1, exp2 ) = exp
{for three dimensional array}
name (exp1, exp2, exp3 ) = exp

Parameter Description
name Name of the array.
expN Value of the N th subscript. If a subscript value exceeds its
specified range, it causes an array error.
exp Value to be assigned to element.

4 - 176 WBPEEUI330254B3
VAR STRING ARRAY (Data Structure)

Examples STRING1 (5) = “ELEMENT 3”


STRING2 = “ELEMENT_IJ”
STRING3 (1, 3, K) = “ELEMENT13K”

Initialize an array (set all elements to the same value)

name (*...) = STRING

Parameter Description
name Name of the array.
(*...) Number of dimensions.
STRING Value to be assigned to elements of an array. Must be a single string constant or
variable whose length is less than or equal to the specified maximum string length.

Examples STRING1 (*) = “INIT ON”


STRING2 (*, *) = “EMPTY”
STRING3 (*, *, *) = “NULL STRING”

Copy one array to another

dname (*...) = sname (*...)

Parameter Description
dname Name of the destination array.
sname Name of the source array.
(*...) Number of dimensions.

Examples NEW_STRING (*) = OLD_STRING (*)


STRING2 (*, *) = DATA_ARRAY (*, *)

This statement assigns the value from each element of the


source array to the corresponding element of the destination
array. The source array is not effected. The source array and
the destination array must be congruent (that is, the same
number of dimensions and same range for corresponding
dimensions). If they are not congruent, an array error occurs.

NOTE: Subscript range checking is done by the compiler if all of the subscripts
of an array are constant. Range checking is always performed during program
execution. Each time an array element is read, the subscript values are
checked. If a subscript value is out-of-bounds, some error action is taken. If the
error occurs during any mode other than FAULT mode (for example, NORMAL
mode), the normal flow of control is aborted. The mode is changed to fault and
control is transferred to fault logic. If the error occurs during FAULT mode, flow
of control is not aborted.

WBPEEUI330254B3 4 - 177
WAIT FOR (Statement)

WAIT FOR (Statement)


Purpose This statement delays sequential execution for the specified
period of time.
Language BSEQ, PHASEX, UDF
Format WAIT FOR exp units

Parameter Description
exp Time interval.
units Units of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.

Examples WAIT FOR 4.5 MIN {wait for 4.5 minutes}


WAIT FOR X SEC {wait for X seconds}

Remarks The program is suspended for one cycle each time the timer is
checked. This statement can not be used where execution is
continuous (for example, in a monitor subroutine). This state-
ment (once begun) must complete before a debug stop is
allowed.

WAIT UNTIL (Statement)


Purpose This statement causes a phase (BSEQ and PHASEX) or state
(UDF) subroutine to wait until a specified condition is met.
Language BSEQ, PHASEX, UDF
Format WAIT UNTIL (exp)
Examples WAIT UNTIL (LT102 >= 45.0) OR (TIMER1.VAL >= 30))
WAIT UNTIL (TRUE) {one cycle delay}

Remarks If exp is false, exp is evaluated until it becomes true. If exp is


true, execution resumes at the following statement.
The program is suspended for one cycle each time exp is evalu-
ated (including the first time). The suspension occurs before
evaluating exp. This statement can not be used where execu-
tion is continuous (for example, in a monitor subroutine). This
statement can be acted upon by a debug stop immediately.

4 - 178 WBPEEUI330254B3
WAIT WHILE (Statement)

WAIT WHILE (Statement)


Purpose This statement causes a phase (Batch 90) or state (UDF) sub-
routine to wait as long as a specified condition is true.
Language BSEQ, PHASEX, UDF
Format WAIT WHILE (exp)
Examples WAIT WHILE (LT102 >= 45.0) OR (TIMER1.VAL >= 30))
WAIT WHILE (FALSE) {one cycle delay}

Remarks If exp is true, exp is evaluated until it becomes false. If exp is


false, execution resumes at the following statement.

The program is suspended for one cycle each time exp is evalu-
ated (including the first time). The suspension occurs before
evaluating exp. This statement can not be used where execu-
tion is continuous (for example, in a monitor subroutine). This
statement can be acted upon by a debug stop immediately

WHILE...ENDWHILE (Control Structure)


Purpose This statement continuously executes a block of statement
while some condition is true.
Language BSEQ, PHASEX, UDF
Format WHILE (exp)
statement1



statementN
ENDWHILE
Example WHILE (FC101.PV < 50)
SET FC101.CO = FC101.CO + 1
ENDWHILE

Remarks If exp is false, execution transfers to statement following END-


WHILE. A while loop can be terminated by a BREAK state-
ment.

WBPEEUI330254B3 4 - 179
WHILE...ENDWHILE (Control Structure)

The program is suspended for one cycle each time exp is evalu-
ated (including the first time). The suspension occurs before
evaluating exp. This statement can not be used where execu-
tion is continuous (for example, in a monitor subroutine). This
statement can be acted upon by a debug stop immediately.

4 - 180 WBPEEUI330254B3
Sample Applications Appendix A

Batch 90
There are many applications for the Batch 90 programming
language. This section details a few applications to point out
some important concepts. Some sample applications are:

• Parallel phase subroutines.


• Common sequences.

Parallel Phase Subroutines


In many batch applications it is advantageous to perform more
than one activity simultaneously. Usually, it is not practical to
embed logic for parallel activities within programs. This is par-
ticularly true when the parallel activities depend upon which
recipe is being run. Therefore, it is necessary for the recipe to
select phase subroutines for parallel execution within an oper-
ation. Batch 90 allows recipes to specify parallel phase sub-
routines. The major advantages of this capability are:

1. Each phase subroutine is self contained and does not need


to include complex logic for monitoring parallel activities.

2. Phase subroutine logic is simplified. Recipes more readily


depict the activities to be performed and the order in which
they are to be executed (sequential or parallel).

Figure A-1 shows a typical example of a BSEQ recipe (unit pro-


cedure) that contains parallel phase subroutines. The manner
in which parallel subroutines are assigned operation numbers
is as follows:

xx.yy
where:

xx Operation number containing parallel


phase subroutines.
yy Phase number of parallel phase subrou-
tine within the operation (specify zero if
there are no parallel phase subroutines).

WBPEEUI330254B3 A-1
Batch 90

RECIPE ID: 1
RECIPE DESCRIPTOR: PARALLEL_TEST

OPERATION PHASE SUBR LO VALUES HI


0 EMERGENCY_STOP
1 RINSE_HEADER
RINSE_TYPE FULL
2.1 CHARGE_REACTOR
INGREDIENT D_WATER
QUANTITY 0.0 < 100.0 < 500.0
MAX_TIME < 5.0 <
TIME_UNITS MINUTES
2.2 HEAT_REACTOR
END_TARGET_TEMP 20.0 < 25.0 < 30.0
TARGET_RATE_CHANGE < 5.0 <
3.1 CHARGE_REACTOR
INGREDIENT INGRED_A
QUANTITY 10.0 < 25.5 < 125.0
MAX_TIME < 2.5 <
TIME_UNITS MINUTES
3.2 CHARGE_REACTOR
INGREDIENT NGRED_B
QUANTITY 20.0 < 75.5 < 250.0
MAX_TIME < 250.0 <
TIME_UNITS SECONDS
3.3 RUN_AGITATOR
TARGET_SPEED 10.0 < 50.0 < 60.0
MAX_RATE_CHANGE < 2.5 <
4.1 HEAT_REACTOR
END_TARGET_TEMP 20.0 < 95.0 < 150.0
TARGET_RATE_CHANGE < 1.5 <
4.2 DOSE_REACTOR
INGREDIENT CATALYST_1
QUANTITY 0.0 < 10.0 < 50.0
4.3 CHARGE_REACTOR
INGREDIENT INGRED_C
QUANTITY 5.0 < 100.0 < 500.0
MAX_TIME < 1.0 <
TIME_UNITS HOURS
5 PRODUCT_SAMPLE
QUALITY_PARAM1_TOLERANCE ONE_PERCENT
QUALITY_PARAM2_TOLERANCE TEN_PERCENT
QUALITY_PARAM3_TOLERANCE NOT_APPLICABLE
SIGN_OFF_REQD YES
6 XFER_PRODUCT

Figure A-1. BSEQ Parallel Phase Subroutine Unit Procedure

In Figure A-1, operation two has two parallel phase subrou-


tines. Operations three and four have three parallel phase

A-2 WBPEEUI330254B3
Batch 90

subroutines. Operations zero, one, five, and six have one


phase subroutine.

BSEQ Batch 90 Program Implementation Requirements


The structure of a parallel phase subroutine is no different
from other phase subroutines. The phase subroutine may
include unit procedure parameters, local data, continuous
logic, normal logic, fault logic, etc. The only additional require-
ment is that the compiler directive known as #MAXPARALLEL
must be included within the Batch 90 program. This compiler
directive determines the maximum number of parallel phase
subroutines allowed by the unit procedure editor.
#MAXPARALLEL = n

where:

n Value between two and 32.

The compiler uses the #MAXPARALLEL directive to calculate


the required data space for the program (specification S12 of
the BSEQ function block).

S12 = [largest_phase_subroutine * #MAXPARALLEL] +


batch data
The built-in status variables OPERATION and PHASE NUM-
BER enable the programmer to include logic that determines
the phase subroutine’s location within the unit procedure
(that is, if the phase subroutine is part of an operation that
includes parallel phase subroutines). Within the example unit
procedure (refer to Fig. A-1) the parallel phase subroutine
CHARGE_REACTOR is assigned to four locations (refer to
Table A-1).

Table A-1. Parallel Phase Subroutine CHARGE_REACTOR Locations

Operation Number Phase Subroutine Operation Phase


2.1 CHARGE_REACTOR 2 1
3.1 CHARGE_REACTOR 3 1
3.2 CHARGE_REACTOR 3 2
4.3 CHARGE_REACTOR 4 3

WBPEEUI330254B3 A-3
Batch 90

BSEQ Logic Execution Control Flow


It is important to understand the manner in which parallel
phase subroutines are executed. Within the boundaries of an
operation that contains parallel phase subroutines, the phase
subroutines are executed sequentially by phase number.
Figure A-2 shows the program logic flow for operation three of
the example unit procedure.

G LO B A L M O N ITO R S A N D AC T IV E DATA S T RU C T U R E S

3.1 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S


3.1 C O N T IN U O U S S E C T IO N
3.1 N O R M A L, FAU LT, H O LD O R R E S TA RT L O G IC S E C T IO N

3.2 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S


3.2 C O N T IN U O U S S E C T IO N
3.2 N O R M A L, FAU LT, H O LD O R R E S TA RT L O G IC S E C T IO N

3.3 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S


3.3 C O N T IN U O U S S E C T IO N
3.3 N O R M A L, FAU LT, H O LD O R R E S TA RT L O G IC S E C T IO N
T 03051A

Figure A-2. BSEQ Phase 3 Program Logic Flow Diagram

Data structures include items such as timers, integrators,


ramps, and function generators. All phase subroutines within
an operation will be in the same sequential logic mode (that is,
all executing normal logic or all executing fault logic, etc.).
Thus, when any phase subroutine executes a fault command,
all phase subroutines transfer from normal to fault logic. Sim-
ilarly, if any phase subroutine executes a restart command, all
phase subroutines will transfer to restart logic. If the operator
puts the sequence into hold, all phase subroutines go to hold
logic.
An operation with parallel phase subroutines is complete only
if all phase subroutines have completed (finished normal logic)
or one of the phase subroutines executes a NEXT OPERATION
statement. The NEXT OPERATION statement will terminate all
parallel phase subroutines and change the operation number
to the value specified by the command.

A-4 WBPEEUI330254B3
Batch 90

If the parallel phase subroutines are executing restart logic,


program execution is not returned to normal logic until all
phase subroutines have completed restart logic.

PHASEX Batch 90 Program Implementation Requirements


The structure of a parallel phase subroutine is no different
from other phase subroutines. The phase subroutine may
include unit procedure parameters, local data, continuous
logic, normal logic, fault logic, etc. The only additional require-
ment is that the compiler directive known as #MAXPARALLEL
must be included within the Batch 90 program. This compiler
directive determines the maximum number of parallel phase
subroutines allowed in the recipe.

#MAXPARALLEL = n

where:

n Value between two and 32. In PHASEX


programs this value must match the
number of PHASEX function blocks
linked together.

PHASEX Logic Execution Control Flow


It is important to understand the manner in which parallel
phase subroutines are executed. Within the boundaries of a
recipe that contains parallel phase subroutines, the phase
subroutines are executed sequentially by phase number.
Figure A-3 shows the recipe logic flow of the example unit
procedure.

Figure A-4 shows an example PHASEX function block configu-


ration. Some important guidelines to remember about
PHASEX programming are:

• The lead PHASEX function block must have a lower num-


ber than the links.

• The lead and all linked PHASEX function blocks must be in


the same controller segment.

• It is recommended that no blocks be placed between lead


and linked function blocks.

WBPEEUI330254B3 A-5
Batch 90

G L O B A L M O N ITO R S A N D AC TIV E DATA S T RU C T U R E S


LE A D
PHASEX 3.1 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S
B LO C K 3.1 C O N T IN U O U S S E C T IO N
3.1 N O R M A L, FAU LT, H O LD O R R E S TA RT LO G IC S E C T IO N

BLO CK
3.2 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S
C Y C LE
LIN K 1 3.2 C O N T IN U O U S S E C T IO N
E X E C U TIO N
3.2 N O R M A L, FAU LT, H O LD O R R E S TA RT LO G IC S E C T IO N

3.3 LO C A L M O N ITO R S A N D DATA S T RU C T U R E S


LIN K 2 3.3 C O N T IN U O U S S E C T IO N
3.3 N O R M A L, FAU LT, H O LD O R R E S TA RT LO G IC S E C T IO N
T 0 3 22 0 A

Figure A-3. PHASEX Phase 3 Program Logic Flow Diagram

• unitname_P1 is always the name of the tag used by the lead


PHASEX block. Linked blocks are named unitname_P2
through P32.

Data structures include items such as timers, integrators,


ramps, and function generators. When any phase subroutine
executes a fault command, only that phase transfers from nor-
mal to fault logic. Similarly, if any phase subroutine executes a
restart command, only that phase will transfer to restart logic.
If the operator puts the recipe into hold, all phase subroutines
go to hold logic. However if the operator puts a phase in hold,
only the selected phase goes to hold logic.

If a parallel phase subroutine is executing restart logic, the


phase program execution is returned to normal logic when
that phase subroutine has completed restart logic.

Common Sequences
In many applications, certain batch units may serve as com-
mon resources to other batch units. For example, a series of
reactors might share common feed tanks, headers, or cooling
systems. Each of the shared resources have batch sequences
associated with them. Because control of these sequences is
required by more than one batch unit, they are referred to as
common sequences (common sequence function block,
FC 219).

A-6 WBPEEUI330254B3
Batch 90

PHASEX
S1 LE A D
(2 18 )
B LO C K S TAT E 4 0 10
S2 PHASE
S PA R E ID
S3 4 0 11
S PA R E P LT
CODE 4 0 12
S4
S PA R E A B O R T
S5 4 0 13
O N /O FF A B O R T ASQTAT
RD
4 0 14
S PA R E
4 0 15
S PA R E
A B O RT 4 0 16
S PA R E
IN P U T 4 0 17

PHASEX PHASEX
S1 LE A D
(2 1 8) S1 LE A D
(2 1 8 )
B LO C K S TATE 4020 B LO C K S TATE 4030
S2 PH ASE S2 PHASE
S PA R E ID S PA R E ID
S3 4021 S3 4031
S PA R E P LT S PA R E P LT
CODE 4022 CODE 4032
S4 S4
S PA R E A B O RT S PA R E A B O R T
S5 4023 S5 4033
A B O R T AQ RD
S TAT A B O R T AQ RD
S TAT
4024 4034
S PA R E S PA R E
4025 4035
S PA R E S PA R E
4026 4036
S PA R E S PA R E
4027 4037

PHASEX PHASEX
S1 LE A D
(2 1 8) S1 LE A D
(2 1 8 )
B LO C K S TATE 4040 B LO C K S TATE 4050
S2 PH ASE S2 PHASE
S PA R E ID S PA R E ID
S3 4041 S3 4051
S PA R E P LT S PA R E P LT
CODE 4042 CODE 4052
S4 S4
S PA R E A B O RT S PA R E A B O R T
S5 4043 S5 4053
A B O R T AQ RD
S TAT A B O R T AQ RD
S TAT
4044 4054
S PA R E S PA R E
4045 4055
S PA R E S PA R E
4046 4056
S PA R E S PA R E
4047 4057

T 03215 A

Figure A-4. PHASEX Function Block Configuration

Common Sequence Function Block Diagram


Figure A-5 shows an example common sequence function
block (CSEQ) configuration. The batch historian function
block (BHIST) is optional, and is not required for common
sequence operation.

The batch sequence function block (BSEQ) executes the batch


program. The CSEQ function block provides an interface by
which the batch sequence is shared or controlled by other
batch programs.

Common sequence affects control of some inputs to the BSEQ


and BHIST function blocks. The control mode of the CSEQ

WBPEEUI330254B3 A-7
Batch 90

A
S1 (3 5) S1 A (3 7 )
T D -D IG 2501 S1 (3 4)
S2 N S
2502 2504
D
S2
S2 = 1 R
S3 = 3
S3 R E C IP E N O.
I
(3 3 )
D ATA
S1
N OT EXPT
25 0 3 (1 94 )
S1 ID 1 B
S2 2540 1
IC ST
S3 2541
IS

(3 3 ) TYP S4 = 8
S1
N OT S6 = 1
2 5 05
U N IT B S E Q
P H A S E N O. BSEQ
S1 (1 4 8 )
EM ERGENCY S5 R# R# C
S TO P (6 8 ) S2 2542
S6 REMSET PH# PH#
2 5 38 S3 2543
RCM RUN RUN D
S1 (6 2 ) 2544
S S4 AC K F LT
S2 2 5 00 2545
P S5 ESP H
S3 R S6 2546
DB BC
S4 2547 E
O S1 A (3 7 ) S7 N /A R
S5 I S2 N 2548
2 5 36 FC
S6 D 2549
F CS#
S7 2550
A

(2 ) S1 G
A 2480 (9 )
S2
T 24 9 0 S1 (3 4 ) S1 (3 4)
S3 S S H
S1 = 0 2507 2508
S2 S2
R R
S1 S3 S3
(2 ) S2 (9 ) I I
A T 24 9 1
2481 S3
I
S1 = 1

J
O IS FAC E P L ATE D IS P L AY
B S E Q C O N T R O L P U S H BU T TO N
B S E Q TAG BSEQ DESCR
TE X T

O U T P U T S TATE # 3 RU N RU N IN G FB IN P U T # 1
O U T P U T S TATE # 2 FAU LT FB IN P U T # 2
O U T P U T S TATE # 1 HO LD H O LD N G FB IN P U T # 3
D E FAU LT S TATE DO NE FB IN P U T # 4

M O D E : AU TO /M A N UA L M SDD M ODE
T 0 30 42 A

Figure A-5. Common Sequence Function Block Configuration (Page 1 of 2)

function block determines what effect it has on the BSEQ and


BHIST function block inputs.

A-8 WBPEEUI330254B3
Batch 90

C CSEQ
S1 (2 1 9)
BS C#
S2 2552
S1 A (3 7 ) CM B#
A S3 2553
S2 N 1.0 R E SRV L#
2554
2537 6 S4 H //L
D OW N R S TS
S5 2555 S1 (1 2 )
N /A O S TS H
S6 2556 30 0 0
N /A N /A L
S7 2557 30 0 1
B D P RU N /H O LD N /A N /A
2558
S8
N /A N /A
M S DV D R S9 2559
D (1 2 9 ) N /A N /A
S1 S10 2560
I1 1
2 52 8 N /A N /A
B S2 2561
I2 2
S3 2 52 9
G F1 3
S4 2 53 0
F2 ST
H S5 2 53 1
F3
S6 F4
E
S25 0
S1
(3 9 )
S1 (33 ) S2 OR J
N OT 30 0 4
3003
F

T S TA L M
(69 )
H
2533
L
2534
S2 = 2
I
LOT B AT C H C A M PA IG N
DATA DATA DATA
EXPT EXPT EXPT B H IS T
S1 (19 4 ) S1 (1 9 4 ) S1 (1 9 4 ) S12 (2 2 0 )
ID ID ID B S EQ STS
S2 3014 S2 3012 S2 3010 S13 2 5 63
IC ST IC ST IC ST C# ST S 1
S3 3015 S3 3013 S3 3011 S14 2 5 64
IS IS IS B# ST S 2
S15 2 5 65
L# ST S 3
TYP S4 = 16 S16 2 5 66
CHK ST S 4
S6 = 1 S17 2 5 67
S PA R E ST S 5
S18 2 5 68
S PA R E ST S 6
2 5 69
ST S 7
2 5 70
ST S 8
2 5 71
C#
2 5 72
B#
2 5 73
L#
2 5 74
E#
2 5 75
S PA R E
2 5 76

T 0 30 43 A

Figure A-6. Common Sequence Function Block Configuration (Page 2 of 2)

Operator Mode In the operator mode, BSEQ and BHIST function block inputs
are enabled and operate according to their normal function.
Remote Mode In the remote mode, BSEQ function block inputs (that is, run/
hold, unit procedure, and operation) are disabled. The BSEQ
function block responds to remote commands received
through the CSEQ function block or these input functions.
The BHIST inputs (that is, campaign, batch and lot number)

WBPEEUI330254B3 A-9
Batch 90

are disabled. The BHIST function block receives the input


parameters from the CSEQ function block.

Common Sequence Communication


The CSEQ function block serves as an interface between the
common sequence and other batch or common sequences. The
CSEQ function block receives commands from other programs
and sends status information to these programs.

Before a program can communicate with a CSEQ function


block, it must establish a connection with the CSEQ function
block. The CSEQ block can only support a limited number of
program connections. The limit of program connections is con-
figurable, not tunable and set through specification S13 of the
CSEQ function block.

Once a client program connects to a server CSEQ function


block, the client program will receive status information from
the server program. The server program sends status
information via its CSEQ function block to all connected client
programs on the following basis:

1. Upon initial connection, the CSEQ function block sends


the client program all of the following data:

• Connection status.
• Reservation status.
• Ownership status.
• Control mode (operator or remote).
• Program status (inactive, running or holding).
• Unit procedure number.
• Operation number.
• Fault code.
• Campaign, batch and lot numbers.
• Eight status variables (set by the server program).

2. After the server CSEQ function block sends the initial sta-
tus information, it sends only changing status information to
the connected client programs. A CSEQ function block mes-
sage will not be sent more often than the time period deter-
mined by specification S11 (update minimum time) of the
CSEQ function block.

3. If status information does not change, the CSEQ function


block periodically sends a message to confirm that the

A - 10 WBPEEUI330254B3
Batch 90

communication to client programs still exists. Specification


S12 of the CSEQ function block determines how often this
message is sent.

Acquiring Control of a CSEQ Function Block


Establishing a connection with a CSEQ function block allows
the client program to communicate with the server program. In
some cases, this is all that is required by the application. For
example, the client program connects to a server program to
determine the status of the batch unit being controlled by the
common sequence.

In many applications the client programs will need to gain con-


trol of the common sequence and manipulate it. For example,
the reactor client program may need to send material transfer
requests (quantities, flow rates, etc.) to a common feed tank
(the server). In another example, the client may need to initiate
the execution of a particular unit procedure by the server. In
this instance, the client program must acquire ownership of
the server.

The CSEQ function block may only have one owner at a time.
Therefore, the CSEQ function block has an ownership queue.
ACQUIRE commands issued by client programs have a priority
associated with each request (refer to Section 4 for information
on all CSEQ commands). The ownership queue stores
ACQUIRE commands received from clients by priority. Queued
ACQUIRE commands that meet the reservation criteria, are
granted in their order of priority.

Client programs may reserve a CSEQ function block for later


use. The reserve command enables client programs to specify
which values for campaign, batch and lot numbers must
match for an ACQUIRE command to be qualified. The CSEQ
function block may only have one active reservation at a time.
Reservation, ownership and ownership queuing combine to
provide the means for the first level of batch unit management.
The CSEQ application is a focal point for applications that
involve production scheduling or variable production paths.

WBPEEUI330254B3 A - 11
Batch 90

Typical Application
The process shown in Figure A-7 represents the simplest use
of the CSEQ function block. The process has a main reactor
that acquires control of a feed tank.

F EE D FE E D
TA N K 1 TAN K 2

M A IN
R EAC TO R
K1
T 03052A

Figure A-7. Usage of Common Sequence

In order for the reactor to control the batch programs associ-


ated with the feed tanks, the CSEQ function block for the feed
tanks must be declared within the batch data section of the
reactor program (refer to Section 4 for CSEQ declaration spe-
cifics). Figure A-8 shows typical logic used within a phase sub-
routine of the reactor program.

In Figure A-8, the logic issues a CSEQ command and then


waits for confirmation that the desired action has occurred.
This insures proper operation of the CSEQ function block.
There is a time delay between the issuing of CSEQ commands
and the response from the CSEQ function block. The typical
pattern of events used in common sequence applications is:

1. CONNECT AND CONFIRM cseq.CSTS

2. ACQUIRE AND CONFIRM cseq.OSTS

3. Manipulate required CSEQ attribute and confirm:

START AND CONFIRM cseq.XSTS

- or -

HOLD AND CONFIRM cseq.XSTS

- or -

A - 12 WBPEEUI330254B3
Batch 90

BATCH DATA
BLOCK FEEDTANK, BLK = 700, FC = CSEQ, /*BLOCK 700 IS THE ADDRESS OF THE BSEQ \
FOR THE FEEDTANK*/
END DATA



PHASE SUBR FEED_FROM_TNK1
ANY QUANTITY
CONTINUOUS
IF (FEEDTANK.CSTS = CONNECTED) THEN
IF (FEEDTANK.XSTS = IN_FAULT) FAULT 1
ENDIF
IF (FEEDTANK.CSTS = FAILED) FAULT 2
NORMAL LOGIC
CONNECT FEEDTANK
WAIT UNTIL (FEEDTANK.CSTS = CONNECTED)
ACQUIRE FEEDTANK CAMPAIGN = MINE, BATCH = MINE, LOT = MINE
WAIT UNTIL (FEEDTANK.OSTS = OWNED_BY_ME)
HOLD FEEDTANK
WAIT UNTIL ((FEEDTANK.XSTS = HOLDING) OR (FEEDTANK.XSTS = COMPLETED))
START FEEDTANK RECIPE = 21, OPERATION = 1
WAIT UNTIL (FEEDTANK.XSTS = RUNNING)
SET FEED_TANK,CV1 = EXP1
SET FEED_TANK.CV2 = EXP2
WAIT WHILE (FEEDTANK.CPEND >= WAITING



WAIT UNTIL (FEEDTANK.XSTS = COMPLETED
UNCONNECT FEEDTANK
ENDSUBR

Figure A-8. Phase Subroutine Using CSEQ Commands

SET cseq.CV(x) AND CONFIRM cseq.SV(y)

4. UNACQUIRE AND CONFIRM cseq.OSTS

5. UNCONNECT AND CONFIRM cseq.CSTS

The continuous section checks the validity of the CSEQ con-


nection and the actual fault status of the common sequence.
This type of logic implemented in a continuous logic section is
typical for most common sequence applications.

WBPEEUI330254B3 A - 13
User Defined Function (UDF)

User Defined Function (UDF)


The following example program demonstrates how to use the
UDF programming language to control the operation of a par-
allel grouping of filters. Filter condition is monitored by mea-
suring the differential pressure across the group of filters.
Figure A-9 shows a graphical representation of the process
and associated equipment.

IN L E T

IN L E T IN L E T IN L E T
VA LV E VA LV E VA LV E

DP F ILT E R F ILT E R FILTE R


1 2 3

D R A IN D R A IN D R A IN

O U T LE T O U T LE T O U T LE T
VA LV E VA LV E VA LV E

O U T LE T
T0 3 0 4 8A

Figure A-9. UDF Process

When a run input signal is sent to the program, the startup


sequence is executed. During the startup sequence, filter one
is backwashed for a tunable amount of time
(BWASH_DURATION) and put into operation. After a tunable
amount of time (BWASH_INTERVAL) filter two is put through
the same procedure. Filter three is put through the procedure
last. At this point all filters are functioning properly and the
program is monitoring differential pressure across the filters.
As the filters start to fill with material, the differential pressure
rises. When the differential pressure exceeds the tunable set

A - 14 WBPEEUI330254B3
User Defined Function (UDF)

point (TRIGGER_PRESSURE), the program executes the clean-


ing procedure on filter one. The cleaning procedure consists of
opening the inlet valve to the drain piping, closing the outlet
valve, and letting the process fluid flow into the filter and out
the drain pipes taking filtered material with it. After a tunable
amount of time (BWASH_DURATION), the outlet valve is
opened and the inlet valve is set to allow for normal flow
through the filter. The filter is put into operation, and a timer
value (BWASH_INTERVAL) is set. The program continues to
monitor differential pressure. If the differential pressure is still
higher than the set point when the timer value reaches zero,
the next filter is cleaned. This sequence continues until the
differential pressure drops below the set point. When the dif-
ferential pressure once again exceeds the set point, the next
filter is cleaned and the sequence continues until the differen-
tial pressure drops below the set point. When a stop input sig-
nal is sent to the program, the shutdown procedure is
executed. The shutdown procedure consists of closing the inlet
valve and then the output valve of filter one and then filter two
and finally filter three.
UDF Program The following program controls the filters.
#DEBUG LEVEL = 4
#DESCRIPTOR “UDF EXAMPLE”
#TITLE “UDF CONTROL PROGRAM FOR MULTI-SECTION FILTER”
DATA
UDF TYPE 2
{UDF BLOCK INPUT DECLARATIONS}
INPUT 1 FLTR1_INLET, FC = MSDD
INPUT 2 FLTR1_OUTLET, FC = MSDD
INPUT 3 FLTR2_INLET, FC = MSDD
INPUT 4 FLTR2_OUTLET, FC = MSDD
INPUT 5 FLTR3_INLET, FC = MSDD
INPUT 6 FLTR3_OUTLET, FC = MSDD
INPUT 16 OPERATOR_MSG, FC = DATAEXPT
INPUT 17 DIFF_PRESSURE, FC = AOL
INPUT 18 RUN_STOP_PB, FC = RCM
{UDF BLOCK OUTPUT DECLARATIONS}
OUTPUT 0 FLTR1_BWASH_IND
OUTPUT 1 FLTR2_BWASH_IND
OUTPUT 2 FLTR3_BWASH_IND
OUTPUT 4 FLTR1_SERVICE_IND
OUTPUT 5 FLTR2_SERVICE_IND
OUTPUT 6 FLTR3_SERVICE_IND
OUTPUT 8 BWASH_TIME_REMAINING
OUTPUT 9 TIME_TO_NEXT_BWASH
{UDF BLOCK TUNABLE PARAMTER SPECIFICATIONS}
SPEC 19 BWASH_DURATION

WBPEEUI330254B3 A - 15
User Defined Function (UDF)

SPEC 20 BWASH_INTERVAL
SPEC 21 SYSTEM_STARTUP_DURATION
SPEC 22 TRIGGER_PRESSURE
{UDF PROGRAM GLOBAL DATA DECLARATIONS}
VAR SYSTEM_STATUS, FLTR1_STS, FLTR2_STS, FLTR3_STS
CONST TO_FLTR = 3, TO_DRAIN = 2, NUMBER_OF_FLTRS = 3
CONST FILTERING = 3, BACKWASH = 2, SHUTDOWN = 1
TIMER BWASH_TIMER (MIN), FLTR_INTERVAL (MIN)
END DATA
MONITOR DEV_STATUS_MON
CONTINUOUS
IF ((FLTR1_INLET.STS = BAD) OR (FLTR1_OUTLET.STS = BAD)) \
THEN \
FLTR1_STS = BAD
ELSE
FLTR1_STS = GOOD
ENDIF
IF ((FLTR2_INLET.STS = BAD) OR (FLTR2_OUTLET.STS = BAD)) \
THEN \
FLTR2_STS = BAD
ELSE
FLTR2_STS = GOOD
ENDIF
IF ((FLTR3_INLET.STS = BAD) OR (FLTR3_OUTLET.STS = BAD)) \
THEN
FLTR3_STS = BAD
ELSE
FLTR3_STS = GOOD
ENDIF
IF ((FLTR1_STS = BAD) OR (FLTR2_STS = BAD) OR \
(FLTR3_STS = BAD)) THEN \
SYSTEM_STATUS = BAD
ELSE
SYSTEM_STATUS = GOOD
ENDIF
ENDSUBR DEV_STATUS_MON
DATA
MONITOR DEV_STATUS_MON RUNNING
END DATA
FUNCTION MOVE_VALVE
MSDD VALVE
ANY COMMAND_POSITION
EXECUTABLE
IF (VALVE.MODE <> AUTO) SET VALVE.MODE = AUTO
SET VALVE.CO = COMMAND_POSITION
WAIT WHILE (VALVE.STS = WAITING)
IF (VALVE.STS = BAD) THEN
SET VALVE.MODE = MANUAL

SET OPERATOR_MSG.OSTR = "VALVE FAILURE IN FILTER \

A - 16 WBPEEUI330254B3
User Defined Function (UDF)

SYSTEM"
FAULT 1
ELSE
RETURN
ENDIF
ENDSUBR MOVE_VALVE
FUNCTION FLTR_ACTION
MSDD INLET
MSDD OUTLET
OUTPUT BWASH_IND
OUTPUT SERVICE_IND
ANY FILTER_OP
ANY DURATION
EXECUTABLE
RESET BWASH_TIMER 0
START BWASH_TIMER (DURATION)
DO CASE FILTER_OP
CASE SHUTDOWN
SET SERVICE_IND.VAL = OFF
CALL MOVE_VALVE (INLET, CLOSED)
CALL MOVE_VALVE (OUTLET, CLOSED)
SET BWASH_IND.VAL = OFF
CASE BACKWASH
SET SERVICE_IND.VAL = OFF
CALL MOVE_VALVE (INLET, TO_DRAIN)
CALL MOVE_VALVE (OUTLET, CLOSED)
SET BWASH_IND.VAL = ON
CASE FILTERING
SET BWASH_IND.VAL = OFF
CALL MOVE_VALVE (OUTLET, OPEN)
CALL MOVE_VALVE (INLET, TO_FLTR)
SET SERVICE_IND.VAL = ON
END CASE
WAIT UNTIL (BWASH_TIMER.ALM)
RESET BWASH_TIMER 0
ENDSUBR FLTR_ACTION
STATE SUBR STARTUP_SYSTEM START AND WAIT
DECLARATIONS
VAR STARTUP_INTERVAL
CONTINUOUS
SET BWASH_TIME_REMAINING.VAL = BWASH_TIMER.LIM - \
BWASH_TIMER.VAL

SET TIME_TO_NEXT_BWASH.VAL = BWASH_TIME_REMAINING.VAL


NORMAL LOGIC

IF (RUN_STOP_PB.VAL <> RUNNING) SET RUN_STOP_PB.VAL = \


RUNNING
SET OPERATOR_MSG.OSTR = "FILTER SYSTEM START-UP \
INITIATED"
STARTUP_INTERVAL = SYSTEM_STARTUP_DURATION.VAL / \
NUMBER_OF_FLTRS

WBPEEUI330254B3 A - 17
User Defined Function (UDF)

CALL FLTR_ACTION (FLTR1_INLET, FLTR1_OUTLET, \


FLTR1_BWASH_IND, FLTR1_SERVICE_IND, BACKWASH, \
STARTUP_INTERVAL)
CALL FLTR_ACTION (FLTR1_INLET, FLTR1_OUTLET, \
FLTR1_BWASH_IND, FLTR1_SERVICE_IND, \
FILTERING, RUNNING)

SET OPERATOR_MSG.OSTR = "FILTER #1 START-UP COMPLETE"


CALL FLTR_ACTION(FLTR2_INLET, FLTR2_OUTLET, \
FLTR2_BWASH_IND, FLTR2_SERVICE_IND, BACKWASH, \
STARTUP_INTERVAL)
CALL FLTR_ACTION (FLTR2_INLET, FLTR2_OUTLET, \
FLTR2_BWASH_IND, FLTR2_SERVICE_IND, \
FILTERING, RUNNING)
SET OPERATOR_MSG.OSTR = "FILTER #2 START-UP COMPLETE"
CALL FLTR_ACTION (FLTR3_INLET, FLTR3_OUTLET, \
FLTR3_BWASH_IND, FLTR3_SERVICE_IND, BACKWASH, \
STARTUP_INTERVAL)
CALL FLTR_ACTION (FLTR3_INLET, FLTR3_OUTLET, \
FLTR3_BWASH_IND, FLTR3_SERVICE_IND, \
FILTERING, RUNNING)
SET OPERATOR_MSG.OSTR = "FILTER #3 START-UP COMPLETE
NEXT STATE SYSTEM_OPERATION
FAULT LOGIC
WAIT UNTIL (SYSTEM_STATUS = GOOD)
NEXT STATE SYSTEM_SHUTDOWN
ENDSUBR STARTUP_SYSTEM
STATE SUBR SYSTEM_OPERATION
DECLARATIONS
VAR NEXT_FILTER
CONST FILTER1 = 1, FILTER2 = 2, FILTER3 = 3
CONTINUOUS
SET BWASH_TIME_REMAINING.VAL = BWASH_TIMER.LIM - \
BWASH_TIMER.VAL
SET TIME_TO_NEXT_BWASH.VAL = BWASH_INTERVAL.VAL - \
FLTR_INTERVAL.VAL
NORMAL LOGIC
NEXT_FILTER = FILTER1
WHILE (RUN_STOP_PB.VAL = RUNNING)
WAIT UNTIL (DIFF_PRESSURE.VAL >= \
TRIGGER_PRESSURE.VAL)
RESET FLTR_INTERVAL 0
START FLTR_INTERVAL (BWASH_INTERVAL.VAL)
DO CASE NEXT_FILTER
CASE FILTER1
CALL FLTR_ACTION (FLTR1_INLET, \
FLTR1_OUTLET, FLTR1_BWASH_IND, \
FLTR1_SERVICE_IND, BACKWASH, \
BWASH_DURATION.VAL)
CALL FLTR_ACTION (FLTR1_INLET, \
FLTR1_OUTLET, FLTR1_BWASH_IND, \

A - 18 WBPEEUI330254B3
User Defined Function (UDF)

FLTR1_SERVICE_IND, FILTERING, \
RUNNING)
NEXT_FILTER = 2
CASE FILTER2
CALL FLTR_ACTION (FLTR2_INLET, \
FLTR2_OUTLET, FLTR2_BWASH_IND, \
FLTR2_SERVICE_IND, BACKWASH, \
BWASH_DURATION.VAL)
CALL FLTR_ACTION (FLTR2_INLET, \
FLTR2_OUTLET, FLTR2_BWASH_IND, \
FLTR2_SERVICE_IND, FILTERING, \
RUNNING)
NEXT_FILTER = 3
CASE FILTER3
CALL FLTR_ACTION (FLTR3_INLET, \
FLTR3_OUTLET, FLTR3_BWASH_IND, \
FLTR3_SERVICE_IND, BACKWASH, \
BWASH_DURATION.VAL)
CALL FLTR_ACTION (FLTR3_INLET,
FLTR3_OUTLET, FLTR3_BWASH_IND, \
FLTR3_SERVICE_IND, FILTERING, \
RUNNING)
NEXT_FILTER = 1
END CASE
WAIT UNTIL (FLTR_INTERVAL.ALM = TRUE)
ENDWHILE
NEXT STATE SYSTEM_SHUTDOWN
FAULT LOGIC
WAIT UNTIL (SYSTEM_STATUS = GOOD)
NEXT STATE SYSTEM_SHUTDOWN
ENDSUBR SYSTEM_OPERATION
STATE SUBR SYSTEM_SHUTDOWN
DECLARATIONS
VAR SHUTDOWN_INTERVAL
CONTINUOUS
SET BWASH_TIME_REMAINING.VAL = 999
SET TIME_TO_NEXT_BWASH.VAL = 999
NORMAL LOGIC
SHUTDOWN_INTERVAL = SYSTEM_STARTUP_DURATION.VAL / \
NUMBER_OF_FLTRS
SET OPERATOR_MSG.OSTR = "FILTER #1 SHUTDOWN \
INITIATED"
CALL FLTR_ACTION (FLTR1_INLET, FLTR1_OUTLET, \
FLTR1_BWASH_IND, FLTR1_SERVICE_IND, SHUTDOWN, \
SHUTDOWN_INTERVAL)
SET OPERATOR_MSG.OSTR = "FILTER #2 START-UP INITIATED"
CALL FLTR_ACTION (FLTR2_INLET, FLTR2_OUTLET, \
FLTR2_BWASH_IND, FLTR2_SERVICE_IND, SHUTDOWN, \
SHUTDOWN_INTERVAL)

SET OPERATOR_MSG.OSTR = "FILTER #3 START-UP COMPLETE"

WBPEEUI330254B3 A - 19
User Defined Function (UDF)

CALL FLTR_ACTION (FLTR3_INLET, FLTR3_OUTLET, \


FLTR3_BWASH_IND, FLTR3_SERVICE_IND, SHUTDOWN, \
SHUTDOWN_INTERVAL)
SET OPERATOR_MSG.OSTR = "FILTER SYSTEM SHUTDOWN \
COMPLETED"
WAIT UNTIL (RUN_STOP_PB.VAL = RUNNING)
NEXT STATE STARTUP_SYSTEM
ENDSUBR SYSTEM_SHUTDOWN

Figure A-10 shows the function block configuration for the


program.

A - 20 WBPEEUI330254B3
User Defined Function (UDF)

0 .0 2

M S DV D R
S1 (12 9) IV F 1-F C M D
IV F 1-Z S F
I1 1 JR 0 2-0 1 .0 3
S2 1 00
JR 02 -0 1.1 8 I2 2
S3 1 01
F1 3
S4 1 02 IV F 1-D C M D
F2 ST
IV F 1-Z S D S5 1 03 JR 0 2-0 3 .0 3
JR 02 -0 3.1 8 F3
S6 F4
S25 0
IV F 1-Z S C
JR 02 -0 2.1 8
M S DV D R
S1 (12 9) OV F 1 -C M D
OV F 1 -Z S O I1 1 JR 0 2-0 4 .0 3
JR 02 -0 4.1 8 S2 1 10
I2 2
S3 1 11
F1 3
S4 1 12
F2 ST
OV F 1 -Z S C S5 1 13
JR 02 -0 5.1 8 F3
S6 F4
S25 0

M S DV D R
S1 (12 9) IV F 2-F C M D
I1 1 JR 0 2-0 7 .0 3
IV F 2-Z S F S2 2 00
JR 02 -0 7.1 8 I2 2
S3 2 01
F1 3
S4 2 02 IV F 2-D C M D
F2 ST
IV F 2-Z S D S5 2 03 JR 0 2-0 9 .0 3
JR 02 -0 9.1 8 F3
S6 F4
S25 0
IV F 2-Z S C
JR 02 -0 8.1 8
M S DV D R
S1 (12 9) OV F 2 -C M D
OV F 2 -Z S O I1 1 JR 0 2-1 0 .0 3
JR 02 -1 0.1 8 S2 2 10
I2 2
S3 2 11
F1 3
S4 2 12
F2 ST
OV F 2 -Z S C S5 2 13
JR 02 -1 1.1 8 F3
S6 F4
S25 0

M S DV D R
S1 (12 9) IV F 3-F C M D
IV F 3-Z S F
I1 1 JR 0 2-1 3 .0 3
S2 3 00
JR 02 -1 3.1 8 I2 2
S3 3 01
F1 3
S4 3 02 IV F 3-D C M D
F2 ST
IV F 3-Z S D S5 3 03 JR 0 2-1 5 .0 3
JR 02 -1 5.1 8 F3
S6 F4
S25 0
IV F 3-Z S C
JR 02 -1 4.1 8
M S DV D R
S1 (12 9) OV F 3 -C M D
OV F 3 -Z S O I1 1 JR 0 2-1 6 .0 3
JR 02 -1 6.1 8 S2 3 10
I2 2
S3 3 11
F1 3
S4 3 12
F2 ST
OV F 3 -Z S C S5 3 13
JR 02 -1 7.1 8 F3
S6 F4
S25 0
A B C D E F
T0 304 9A

Figure A-10. UDF Function Block Configuration (Page 1 of 2)

WBPEEUI330254B3 A - 21
User Defined Function (UDF)

A B C D E F
UD F2
S1 (192) FILTE R 1 LO C A L
S2 600 B AC K W A S H IN D
S3 601
S4 602
FILTE R 2 LO C A L
S5 603
B AC K W A S H IN D
S6 604
S7 605
O P E R ATO R M S G FILTE R 3 LO C A L
S8 606
DATA B AC K W A S H IN D
S9 607
EXPT 608
(194) S 10
S1 FILTE R 1 LO C A L
0.0 2
ID S 11 609
S2 500 S E RV IC E IN D
IC ST S 12
S3 501
IS S 13
S 14 FILTE R 2 LO C A L
D IF F P R E S S S 15 S E RV IC E IN D
S 16
S1 (30) S 17 FILTE R 3 LO C A L
J R 02-2 4.18 AO /L
F ILT E R 510 S 18 S E RV IC E IN D
D IFF S 23
PRESS
S 25

S TA R T /S TO P P B S 19 = B AC K W A S H D U R AT IO N
S 20 = B AC K W A S H IN T E RVA L
S1
RCM (62) S 21 = S TA RT-U P D U R ATIO N
S
S2 520 S 22 = B AC K W A S H T R IG G E R P R E S S U R E
P
S3 R
S4 O
S5 I
S6 (190)
F UDFDEC
S7 599
A
T 0 30 50 A

Figure A-11. UDF Function Block Configuration (Page 2 of 2)

A - 22 WBPEEUI330254B3
BSEQ State Transition Diagram Appendix B

B ATC H S TA R T NORM AL HO LD FAU LT R E S TA RT E X E C U TE D


HELD
C O M P L E TE PHASE L O G IC LO G IC L O G IC L O G IC S TO P

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

B ATC H S TA R T NORM AL HO LD FAU LT R E S TA RT E X E C U TE D


HELD
C O M P L E TE PHASE L O G IC LO G IC L O G IC L O G IC S TO P
0001 1000 1010 11 0 0 0000 1000
rfh c rfhc rfhc rfh c rfhc rfh c

BSEQ BLOCK OUTPUTS: A B C


(n+2)r = RUNNING K E Y: = S TA RT P O IN T
(n+3)f = FAULT LOGIC ACTIVE FR O M TO TO
(n+4)h = HOLD LOGIC ACTIVE FR O M A TO B OR F R O M A TO C
(n+5)c = BATCH COMPLETE T 03053 A

Figure B-1. Example State Transition Diagram

Batch Sequence States


Batch_complete:
Previous batch sequence completed.
All sequential and continuous activity halted.
Program_ID (S9) may be changed.
Object file may be changed.
Recipe_ID input (S1) may be changed.

WBPEEUI330254B3 B-1
Batch Sequence States

Unit recipe file may be modified or deleted.


Operation number input (S2) may be changed.

Normal_logic:
For each function block execution cycle:
Execute global monitor subroutines and active data
structures (that is, timers, integrators).
For each parallel phase subroutine:
Execute local monitor subroutines and active data
structures (that is, timers, integrators).
Execute continuous section.
Execute first/next segment of normal logic.

Hold_logic:
For each function block execution cycle:
Execute global monitor subroutines and active data
structures (that is, timers, integrators).
For each parallel phase subroutine:
Execute local monitor subroutines and active data
structures (that is, timers, integrators).
Execute continuous section.
Execute first/next segment of hold logic.

Fault_logic:
For each function block execution cycle:
Execute global monitor subroutines and active data
structures (that is, timers, integrators).
For each parallel phase subroutine:
Execute local monitor subroutines and active data
structures (that is, timers, integrators).
Execute continuous section.
Execute first/next segment of fault logic.

Held:
For each function block execution cycle:
Execute global monitor subroutines and active data
structures (that is, timers, integrators).
Program_ID (S9) may be changed.
Object file may be modified (changes are restricted).
Recipe_ID input (S1) may be changed.
Unit recipe file may be modified.
Operation number input (S2) may be changed.

Restart_logic:
For each function block execution cycle:
Execute global monitor subroutines and active data

B-2 WBPEEUI330254B3
Batch Sequence Transitions

structures (that is, timers, integrators).


For each parallel phase subroutine:
Execute local monitor subroutines and active data
structures (that is, timers, integrators).
Execute continuous section.
Execute first/next segment of restart logic.

Emer_stop:
This is a state that contains all regular states (normal, fault,
hold, restart). These states and transitions behave
normally except for:
The operation number is 0.
The run input is ignored except in the handling state (that
is, the program runs whether the input is 1 or 0).
The following conditions must exist before control can be
transferred to a normal operation.
The executed_stop input must be 0.
The run input must be 0 to 1 transition.
Any attempt to transfer to a new operation (end of normal
logic, new operation, etc.) without meeting these
conditions will cause a transfer to hold_logic (in
operation 0).

Batch Sequence Transitions


Batch_complete:
(1) Run input (0 or 1) or CSEQ start command.
If executed_stop input is 1:
set fault code (-13)
goto---------------------------------------------> Batch_complete
If operation number input less than 1:
set fault code (-15)
goto---------------------------------------------> Batch_complete
Read program object file.
If error:
set fault code (-4, -5, -6, -7, -9 or -18)
goto-----------------------------------------> Batch_complete
Check function block references.
If error:
set fault code (-16)
goto-----------------------------------------> Batch_complete
Lock unit recipe file and check for compatibility with Batch
program.

WBPEEUI330254B3 B-3
Batch Sequence Transitions

If error:
set fault code (-8, -9, -10, -12, -19, -20, -25)
goto-----------------------------------------> Batch_complete
If waiting for historian:
set fault code (-23)
when historian is ready goto (start operation)---> (2)
Goto (start operation)---------------------------------------------> (2)

Start_operation (transition):
(2) If end of unit recipe (operation not in unit procedure):
goto---------------------------------------------> Batch_complete
Read unit recipe data for this operation.
If error:
set fault code (-10)
goto---------------------------------------------------> Held
Initialize local data (variables, timers, etc.) for all parallel
phase subroutines.
Set up for first statement of normal logic.
Goto----------------------------------------------------> Normal_logic

Normal_logic:
(3.1) End of normal logic -or- NEXT OPERATION statement.
Increment operation number.
Goto (start new operation).--------------------------------------> (2)
(3.2) New operation statement.
Set operation number to specified value.
Goto (start new operation)---------------------------------------> (2)

Normal_logic:
(4) Done statement.
Unlock unit recipe file.
Goto-------------------------------------------------> Batch_complete

Normal_logic:
(5) (Run input (0) -or- CSEQ hold command) -and- hold
enabled.
Set fault code (-1).
If hold logic is defined:
set up for first statement of hold logic
goto----------------------------------------------------> Hold_logic
else
unlock unit recipe file
goto-------------------------------------------------------> Held

Normal_logic:
(6) Fault statement.

B-4 WBPEEUI330254B3
Batch Sequence Transitions

If fault logic is defined:


set up for first statement of fault logic
goto---------------------------------------------------> Fault_logic
else
unlock unit recipe file
goto-------------------------------------------------------> Held

Hold_logic:
(7) End of hold logic.
Unlock unit recipe file.
Goto-----------------------------------------------------------> Held

Hold_Logic:
(8) Fault statement.
If fault logic is defined:
set up for first statement of fault logic
goto---------------------------------------------------> Fault_logic
else
unlock unit recipe file
goto-------------------------------------------------------> Held

Hold_logic:
(9.1) NEXT OPERATION statement.
Increment operation number.
Goto (start new operation)---------------------------------------> (2)
(9.2) New operation statement.
Set operation number to specified value.
Goto (start new operation)---------------------------------------> (2)

Hold_logic:
(10) Done statement.
Unlock unit recipe file.
Goto-------------------------------------------------> Batch_complete

Fault_Logic:
(11) End of fault Logic.
Unlock unit recipe file.
Goto-----------------------------------------------------------> Held

Fault_Logic:
(12) Restart statement.
Set up for first statement of Restart logic.
Disable fault statement.
Goto----------------------------------------------------> Restart_logic

WBPEEUI330254B3 B-5
Batch Sequence Transitions

Fault_logic:
(13.1) NEXT OPERATION statement.
Increment operation number.
Goto (start new operation)---------------------------------------> (2)
(13.2) New operation statement.
Set operation number to specified value.
Goto (start new operation)---------------------------------------> (2)

Fault_logic:
(14) Done statement.
Unlock unit recipe file.
Goto-------------------------------------------------> Batch_complete

Held:
(15) Run input (0-1) or CSEQ start command.
Read program object file.
If error:
set fault code (-4, -5, -6, -7, -9 or -18)
goto---------------------------------------------------> Held
If Batch data has changed:
set fault code (-21)
goto---------------------------------------------> Batch_complete
Check function block declarations in Batch data.
If error:
set fault code (-16)
goto---------------------------------------------------> Held
If recipe_ID input has changed:
goto (cold restart)----------------------------------------------> (2)
Lock unit recipe file and check for compatibility with Batch
program.
If error:
set fault code (-8, -9, -10, -12, -19, -20, -25)
goto---------------------------------------------------> Held
If operation number input has changed,
goto (cold restart)----------------------------------------------> (2)
Read unit recipe information for this operation.
If phase subroutine name has changed:
goto (cold restart)----------------------------------------------> (2)
If active phase subroutine data declarations have changed:
set fault code (-21)
goto-------------------------------------------------------> Held
If restart logic is defined:
disable fault statement
set up for first statement of restart logic
goto-------------------------------------------------> Restart_logic

B-6 WBPEEUI330254B3
Batch Sequence Transitions

else
set up for first statement of normal logic
goto-------------------------------------------------> Normal_logic

Restart_Logic:
(16) Resume statement.
Enable fault statement.
Set up for specified restart point.
Goto----------------------------------------------------> Normal_logic

Restart_logic:
(17) (Run input (0) -or- CSEQ hold command) -and- hold
enabled
Enable fault statement.
Set fault code (-1).
If hold logic is defined:
set up for first statement of hold logic
goto----------------------------------------------------> Hold_logic
else
unlock unit procedure file
goto-------------------------------------------------------> Held

Restart_logic:
(18.1) NEXT OPERATION statement.
Enable fault statement.
Increment operation number.
Goto (start new operation)---------------------------------------> (2)
(18.2) New operation statement.
Enable fault statement.
Set operation number to specified value.
Goto (start new operation)---------------------------------------> (2)

Restart_logic:
(19) Done statement.
Unlock unit recipe file.
Goto-------------------------------------------------> Batch_complete

Any state (except Batch_complete):


(20) Executed_stop input (1).
Set operation = 0.
Read unit recipe data for this operation.
If error
set fault code (-10)
goto---------------------------------------------------> Held
Initialize local data (variables, timers, etc.). (operation 0)
Set up for first statement of normal logic.

WBPEEUI330254B3 B-7
Batch Sequence Transitions

Goto----------------------------------------------------> Normal_logic
-----------------------------------------------------------> (operation 0)
(6) If fault.
If fault logic defined.
set up for statement of fault logic
goto-----------------------------------------------> Fault_logic
else
goto---------------------------------------------------> Held
(4) Done statement or last line of normal logic.
Unlock unit recipe file.
Set fault code (-13).
goto---------------------------------------------> Batch_complete

B-8 WBPEEUI330254B3
PHASEX State Transition Appendix C
Diagrams
Introduction
In units, one PHASEX (phase execution) function block is con-
figured as the lead and the other PHASEX function blocks are
configured as linked secondaries. The linked secondaries pro-
vide an environment for phase execution. The lead PHASEX
function block also provides an environment for phase execu-
tion and other UEM configuration responsibilities.

NOTE: A single PHASEX function block (for controlling an equipment module)


or set of linked PHASEX function codes (for controlling a unit) is called a UEM
configuration.

For example, the lead PHASEX function block allocates the


RAM memory space for the UEM configuration program and
global data. When a program is activated in a UEM configura-
tion, the .OBJ and .UNT files (specified the specification S9 of
the lead PHASEX function code) are read from the controller
and loaded into the RAM memory allocated by the lead
PHASEX function code.
The execution order of linked PHASEX function blocks must
be configured so that the lead PHASEX function block is exe-
cuted before any of the linked secondaries are executed. The
lead PHASEX function block must have a lower function block
number than that of the linked secondaries. All PHASEX func-
tion blocks must be in the same function block segment.

A batch program is composed of four major parts which are:

• Global Data - The data declared in the batch data and


unit data sections of the program. Active data (monitors,
timers, etc.), passive data (variables, etc.), and function
block references make up this data. This data belongs to
the whole UEM configuration.

• Phase Data - The data declared in a phase (step subrou-


tine). Active data (monitors, timers, etc.) and passive data
(variables, etc.) make up this data. This data belongs to an
individual active phase.

WBPEEUI330254B3 C-1
States

• Phase Continuous Logic - The continuous section of the


program.

• Phase Sequential Logic - The normal, fault, hold, and


restart logic sections of the program.

On each function block cycle of the UEM configuration, there


is a fixed order in which the major parts are executed. The
state of the PHASEX function blocks determines which parts
are active and executable. The execution order is as follows:

1. Global active data (global monitors and active data


structures).

2. For each PHASEX function block of the UEM configuration


the order is:

a. Phase active data.

b. Phase continuous logic (local monitors and the contin-


uous logic section).

c. Phase sequential logic. Only one sequential logic sec-


tion can be active at a time. The phase state determines
which, if any, section is active. The four sequential logic
sections allowed in a Batch 90 program are normal, fault,
hold, and restart.

States
Each PHASEX function code of the unit usually acts indepen-
dently of the other PHASEX function codes in the unit. The
state of one PHASEX function code does not usually depend on
the state of another. However, a few states are shared which
means all PHASEX function blocks are forced to the same
state when one PHASEX function block is changed to the
state. A description of each state follows.

Aborted
This is a shared state; all PHASEX function blocks in the UEM
configuration are put into this state at the same time. This
state always follows the aborting state. In this state, each
PHASEX function block continues to report the same phase
name it was reporting during the aborting state.

C-2 WBPEEUI330254B3
States

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, inactive Defined, inactive Defined, inactive

Aborting
This is a shared state; all PHASEX function blocks in the UEM
configuration are put into this state at the same time. The pur-
pose of this state is to perform the control and monitoring
required to bring the UEM configuration to the aborted state.
Entering this state causes each PHASEX function block with
an active phase to terminate the phase. A single instance of
the phase named abort is started in the normal logic section.
All PHASEX function blocks report the aborting state. Each
PHASEX function block having an active phase continues to
report the name of the terminated phase. Each PHASEX func-
tion block that was in the idle state reports the phase name of
abort. The abort phase automatically transitions to aborted
when normal logic is completed.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, normal
logic active

Complete
In this state, the UEM configuration has active global data and
the PHASEX function block has an inactive phase (for exam-
ple, the phase had been running and transitioned to the com-
plete state). The phase is now waiting for a reset command to
transition to idle (program active).

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, inactive Defined, inactive Defined, inactive

Held
In this state, the UEM configuration has active global data and
the PHASEX function block has an inactive phase. Previously

WBPEEUI330254B3 C-3
States

the phase was holding and automatically transitioned to the


held state when hold logic is completed.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, inactive Defined, inactive Defined, inactive

Holding
In this state, the UEM configuration has active global data and
the PHASEX function block has an active phase. The purpose
of this state is to perform the control and monitoring required
to bring the phase to the held state. In the absence of another
command or an exception, the phase will automatically transi-
tion to the held state when the hold logic is completed.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, hold
logic active

Idle (Program Active)


In this state, the UEM configuration has active data but no
phase data exists. This state may indicate normal operation
(for example, the PHASEX function block has completed a
phase) or abnormal operation (for example, the previous phase
was stopped or aborted). The PHASEX function block is ready
to start a new phase when in this state.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Undefined Undefined Undefined

Idle (Program Inactive)


This is a shared state; All PHASEX function blocks in the UEM
configuration are put into this state at the same time. In this
state the UEM configuration does not have an active program.

C-4 WBPEEUI330254B3
States

The following traits usually indicate normal UEM configura-


tion operation:

• This is the initial state of all PHASEX function blocks when


the controller enters execute mode.

• This is the inactive state of all PHASEX function blocks


when the UEM configuration is between batches.
This state can also be the result when an InitHot command
fails.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Undefined Undefined Undefined Undefined

Paused
In this state, the UEM configuration has active global data and
the PHASEX function block has an inactive phase. The phase
has been pausing and automatically transitioned to the
paused state after normal logic is completed. A resume com-
mand will transition the phase to the complete state.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, inactive Defined, inactive Defined, inactive

Pausing
In this state, the UEM configuration has active data and the
PHASEX function block has an active phase. The purpose of
this state is to perform normal phase control and monitoring
during the transition to the paused state. In the absence of
other commands or an exception, the phase will automatically
transition to the paused state when normal logic is completed.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, normal
logic active

WBPEEUI330254B3 C-5
States

Restarting
In this state, the UEM configuration has active global data and
the PHASEX function block has an active phase. The purpose
of the state is to perform the control and monitoring required
to return the phase to the running state. In the absence of an
external command or an exception, the phase will transition to
the running state in one of the following ways:

• The restart logic may enter the normal logic at a restart


point using the resume at command.

• The phase reaches the end of restart logic and automati-


cally transitions to the beginning of normal logic.

• The phase automatically transitions to the beginning of


normal logic if no restart logic is defined.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, restart
logic active

Running
In this state, the UEM configuration has active global data and
the PHASEX function block has an active phase. The purpose
of this state is to perform control and monitoring during the
normal operation of the phase. In the absence of another com-
mand or exception, the phase will automatically transition to
the complete state when it reaches the end of normal logic.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, normal
logic active

Stopped
In this state, the UEM configuration has active global data and
the PHASEX function block has an inactive phase. Previously,
the phase was in the stopping state and it will transition to the
stopped state when the fault logic is completed.

C-6 WBPEEUI330254B3
External Commands

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, inactive Defined, inactive Defined, inactive

Stopping
In this state, the UEM configuration has active global data and
the PHASEX function block has an active phase. The purpose
of this state is to perform the control and monitoring required
to bring the phase to the stopped state. In the absence of an
exception, the phase automatically transitions to the stopped
state when the fault logic is completed.

Phase Cont. Phase Seq.


Global Data Phase Data
Logic Logic
Defined, active Defined, active Defined, active Defined, fault
logic active

External Commands
The following state transition commands (Fig. C-1) are issued
from outside the UEM configuration.

Abort
This command transitions the UEM configuration to the abort-
ing state. All active phases in the UEM configuration are
immediately terminated and one instance of the abort phase is
started. No fault code or alarm is reported.

Ack (Operator Acknowledge)


This command sent by an operator sets the built-in status
variable named ack to the value of one.

Acquire
This command acquires the UEM configuration for a batch
program. Upon successful completion of this command, it:

• Assigns a batch program to the UEM configuration (sets


the campaign, batch, lot, and recipe IDs).

WBPEEUI330254B3 C-7
External Commands

EXTER NAL CO M M AND S

S E Q U E N T IA L
S TAT E S L O G IC
AC Q U IR E C O M P LE T E H O LD PAU S E RESET IN IT H OT R E LE A S E
ID LE S TA R T S TO P R E S TA RT RESU M E ABO RT IN IT C O LD
(P R O G R A M
IN AC TIV E )

ID LE
(P R O G R A M
AC T IV E )

CO M PLETE

R U N N IN G

PAU S IN G

PAU S E D

H O L D IN G

H E LD

R E S TA R T IN G

S TO P P IN G

S TO P P E D

A B O R T IN G

A B O RT E D

C1 C2 C3 = S TA R T O F T R A N S IT IO N
S1
= E N D O F T R A N S IT IO N
S2 C O M M A N D C 1 C AU S E S A N O R M A L T R A N S IT IO N F R O M S 1 TO S 2 .
C O M M A N D C 2 C AU S E S A N E R R O R T R A N S IT IO N F R O M S 1 TO S 2.
S3 C O M M A N D C 3 C AU S E S A N O R M A L T R A N S IT IO N F R O M S 1 TO S 3 O R FR O M S 2 TO S 3 . T 03341A

Figure C-1. PHASEX External Command State Transition Diagram

• Activates the program specified by specification S9 of the


lead PHASEX function block. The UEM configuration loads
the specified .OBJ and .UNT files into the RAM memory
allocated by the lead PHASEX function block and initializes
the global data.

C-8 WBPEEUI330254B3
External Commands

• Transitions the UEM configuration to the idle (program


active) state.

The state remains in idle (program active) and a fault code is


reported by all linked secondaries if a problem is detected.

Hold
This command transitions the phase to the holding state.

Init Cold
This command performs the same operation as the acquire
command but does not assign a batch program to the UEM
configuration.

Init Hot
This command invokes online changes to the logic in the active
program. The UEM configuration loads the modified program
logic but retains the data from the previous program. The
modified program must be downloaded to the controller before
this command is issued. Every PHASEX function block in the
UEM configuration must be in the idle (program active), held,
stopped, or aborted state before this command is accepted.
Every PHASEX function block retains its current state and
data after successful completion of this command.

The modification of data is considered an illegal operation and


should not be attempted. The UEM configuration attempts to
detect data modifications during the loading of modified pro-
gram logic. It detects most (but not all) of the modifications.
The UEM configuration transitions to the idle (program inac-
tive) state and all PHASEX function blocks report a fault code
when a modification is detected.

NOTE: Undetected data modifications will cause unpredictable operation.

Pause
This command transitions the phase to the pausing state.

WBPEEUI330254B3 C-9
External Commands

Release
This command is the functional opposite of the acquire com-
mand in that it:

• Releases the batch program from the UEM configuration


(clears the campaign, batch, lot, and recipe IDs).

• Deactivates (unloads) the batch program.

• Transitions the UEM configuration to the idle (program


inactive) state.

Reset
This command transitions the phase to the idle (program
active) state. If the phase is in the aborted state and specifica-
tion S9 (abort input) of the lead PHASEX function block is
true, the reset command will be rejected.

Restart
This command transitions the phase to the restarting state.

Resume
This command transitions the phase to the running state.

Start
This command starts a phase in the PHASEX function block.
The phase data, such as name and parameter values, must be
present in the PHASEX function block before this command is
issued. Use the send phase data message to send the data to
the PHASEX function block. The state is transitioned to run-
ning upon successful completion of this command. The
PHASEX function block stays in the idle (program inactive)
state and reports a fault code if a problem is detected.

Stop
This command transitions the phase to the stopping state.

C - 10 WBPEEUI330254B3
Program Commands

Program Commands
These state transition commands (Fig. C-2) are issued from
the program and are said to have scope. Scope refers to what
is affected by the command (UEM configuration or phase) and
the part of the program where the command is used (global
monitor or phase).
Global scope Command used in global monitors and it affects the state of
the UEM configuration.
Phase scope Command used in phase monitors, phase continuous logic,
and phase sequential logic. Only individual phase is affected.

Fault
This command indicates an exception condition. In the global
scope, all active phases in the UEM configuration are termi-
nated and one instance of the abort phase is started. A fault
code is reported by all PHASEX function blocks in the UEM
configuration. In the phase scope, the phase transitions to the
stopping state and a fault code is reported by the phase.

This command is disabled by the:

• Aborting state because global and phase scope are


disabled.

• Stopping state because phase scope is disabled.

• Restarting state because phase scope is disabled when a


phase enters this state. The scope may enable manually
using an enable command or automatically when the
phase leaves the restarting state.

Next Phase/Operation
This command transitions the phase to the complete state and
has phase scope.

Restart
This command transitions the phase directly from the stop-
ping state to the restarting state without going through the
stopped state. The restart command has phase scope but can
only be used in fault logic sections.

WBPEEUI330254B3 C - 11
Program Commands

PRO G RAM C OM M AN DS

S TAT E S FAU LT

ID LE GLO BAL PHASE R E S TA R T R E S U M E AT NEXT PHASE


(P R O G R A M
IN AC T IV E )

ID LE
(P R O G R A M
AC T IV E )

C O M P LE T E

R U N N IN G

PAU S IN G

PAU S E D

H O L D IN G

H E LD

R E S TA R T IN G

S TO P P IN G

S TO P P E D

A B O R T IN G

ABORTED

T 03342A

Figure C-2. PHASEX Program Command State Transition Diagram

Resume At
This command transitions the phase from the restarting state
to the running state. It specified a restart point from which the
phase enters normal logic. This command has phase scope but
can only be used in restart logic sections. Without this com-
mand, the end of the restart logic automatically transitions to
the beginning of the normal logic section.

C - 12 WBPEEUI330254B3
Run-Time Fault Codes Appendix D

BSEQ
The batch sequence (BSEQ) function block executes a series of
diagnostic tests that detect errors that cannot be detected by
the compiler. The fault codes can be seen using the batch
debugger or by viewing the BSEQ block output (N+7). The
errors are only detectable while the controller is in execution
and are, therefore, called run-time errors. Table D-1 lists the
possible error codes and an explanation of each.

Table D-1. BSEQ Run-Time Fault Codes

Fault Codes Explanation


Any positive number This number (any positive number) is assigned by the user in the batch
language program and is used to indicate what type of fault has occurred.
There is no limit to the number of fault codes the user may assign.
-1.0 Hold command The batch sequence is in hold, through either the BSEQ function block or a
command in the batch language. Going to hold suspends normal logic and
starts execution of hold logic.
-3.0 Stack overflow Contact ABB Technical Support Center.
-4.0 Error reading No batch program exists in the NVRAM memory that matches the number
object file indicated in specification S9 of the BSEQ function block. Normally this
means that the batch object file has not been downloaded to the controller
or specification S9 of the BSEQ function block references an undefined
program number.
-5.0 Object file The batch program size exceeds the amount of controller volatile memory
exceeds memory specified by specification S11 of the BSEQ function block. Correct this
allocation problem by increasing specification S11.
-7.0 Phase data size The amount of data used by a step/phase exceeds the amount of memory
exceeds memory specified by specification S12 of the BSEQ function block. To correct,
allocation increase the value of S12 in the BSEQ function block.
-8.0 Recipe refers to The unit recipe contains a phase subroutine name that is not contained
undefined phase within the batch program. This situation can happen when a batch program
subroutine is edited so that a phase subroutine is removed, but the corresponding
recipes are not changed. To correct, add the undefined phase subroutine or
remove the called (undefined) phase subroutine from the unit recipe.
-9.0 Batch directory Format controller and reload necessary programs, recipes, and data files.
error

WBPEEUI330254B3 D-1
BSEQ

Table D-1. BSEQ Run-Time Fault Codes (continued)

Fault Codes Explanation


-10.0 Recipe error The execution of a unit recipe that does not exist within the NVRAM memory
of the controller was attempted. To correct, create or download a unit recipe
to the controller or input a valid recipe ID and then restart the sequence.
-12.0 Illegal There is an argument data type conflict between the unit recipe and the
parameter type batch program. To correct, recompile the batch program and the recipe.
Then, download both the recompiled batch program and unit recipe.
-13.0 ESTOP/ The emergency input to the BSEQ function block (specification S5) is on.
Aborting from block This drives the batch program unconditionally to operation 0 of the current
input unit recipe. To correct, find out why the emergency shut down input is being
set to on and correct it.
-15.0 Invalid The starting of a batch sequence at an operation number not defined within
operation number the unit recipe being run was attempted. Create a unit recipe with an
operation number that matches the one to be executed or change the
operation number.
-16.0 Bad function In the batch data declaration sections of the batch language, the program is
block reference trying to reference a function block that does not exist or one whose type
does not match the function code type in the declaration. The batch
debugger will provide the function block number within the batch data
section that is making the reference. To correct, change the function block
number to a valid one, erase the reference from the program, or correct the
type to match the function block in the controller.
-17.0 Array error An array subscript is out of bounds. Normal logic is suspended and
execution of fault logic begins. It is possible to inspect the value of the fault
code to detect when this fault has occurred.
-18.0 BCODE The batch program was compiled using firmware that does not match the
revision mismatch firmware in the controller. Recompile the batch program with the compiler
that matches the firmware within the controller.
-19.0 Recipe The execution of a recipe that contains more parallel phase subroutines
requires too many than are allowed in the target program was attempted. To correct, edit and
parallel phases recompile the unit recipe to contain less parallel phase subroutines or edit
the #MAXPARALLEL statement.
-20.0 Invalid num- The unit recipe contains the wrong number of recipe parameters as
ber of parameters in compared to the target program. To correct, fix the recipe or the program
phase data (normally the recipe).
-21.0 Invalid online The attempted execution of a new program that differs from the previous
program change one because of a change in the batch data area or the local declaration
section of the active phase subroutine. Such online changes are not
permitted.
-22.0 Batch The batch and lot number in the BHIST function block are not unique to the
descriptor not unique batch historian. Change the batch and/or lot number and restart the
program.

D-2 WBPEEUI330254B3
BSEQ

Table D-1. BSEQ Run-Time Fault Codes (continued)

Fault Codes Explanation


-23.0 Wait for batch The batch historian is busy and the program may not proceed until it is
historian available. No corrective action is required.
-24.0 Batch historian The batch historian is offline and the program may not proceed until the
offline batch historian is online and the program is restarted.
-25.0 Bad block The unit recipe used contains a reference to an incorrect or nonexistent
reference in phase block. Correct the block number in the unit recipe.
data
-26.0 Bad data A data entry in the unit recipe does not match the program. This most
reference in recipe commonly happens when a unit recipe argument value was selected from a
selection list and the program was changed to no longer include that
selection. Resolve any discrepancies and recompile the unit recipe with the
batch program.
-27.0 Bad block A function block declaration in the unit data file does not match the
reference in Unit controller configuration (either the function block address or the function
Data code type are in error). Resolve any discrepancies and recompile the unit
data file against the batch program.
-28.0 Bad CSEQ A CSEQ reference in the unit data file does not match the program. Resolve
reference in Unit any discrepancies and recompile the unit data file against the batch
Data program.
-29.0 Unit Data does The unit data file does not match the batch program structurally (the number
not match B90 or type declarations do not match). Resolve any discrepancies and
program recompile the unit data file against the batch program.
-30.0 Error reading No unit data file exists in the NVRAM memory that matches the number
UNIT.DEF file indicated by specification S9 of the BSEQ function block. Normally this
means that the unit data object file has not been downloaded to the
controller.
-31 ID type The recipe ID type connected to the BSEQ function block is not the same as
mismatch the program file type selected by BSEQ specification S9. This error is
caused by the BSEQ input specification S1 connected to a DATAEXPT
(FC144) and the program referenced by specification S9 being Numeric or
specification S1 connected to a read and the program referenced is #alpha.

WBPEEUI330254B3 D-3
PHASEX

Table D-1. BSEQ Run-Time Fault Codes (continued)

Fault Codes Explanation


-32 String subscript The string position specified in the program is negative or larger than the
error maximum size of the string. This error occurs during program execution and
transfers the program to fault logic.
-33 Restart error, Hold-to-run command was received but ignored, due to a historian queue
Historian queue full full condition with a good historian status. This state is a continuation of the
hold command state (see fault code -1). Even though the run input may still
be active, a new hold-to-run transition must be initiated to attempt another
restart; the program will not restart unless the queue full condition was
rectified prior to the hold-to-run transition request (regardless of the setting
in FC220, specification 9). If and when the historian is marked bad, the
queue is cleared.

PHASEX
The phase execution (PHASEX) function block executes a
series of diagnostic tests that detect errors that cannot be
detected by the compiler. The fault codes can be seen using the
batch debugger or by viewing the PHASEX block output (N+2).
The errors are only detectable while the controller is in execu-
tion and are, therefore, called run-time errors. Table D-2 lists
the possible error codes and an explanation of each.

Table D-2. PHASEX Run-Time Fault Codes

Fault Codes Explanation


Any positive number This number (any positive number) is assigned by the user in the batch
language program and is used to indicate what type of fault has occurred.
There is no limit to the number of fault codes the user may assign.
-3.0 Stack overflow Contact ABB Technical Support Center.
-4.0 Error reading No batch program exists in the NVRAM memory that matches the number
object file indicated in specification S9 of the PHASEX function block. Normally this
means that the batch object file has not been downloaded to the controller
or specification S9 of the PHASEX function block references an undefined
program number.
-5.0 Object file The batch program size exceeds the amount of controller volatile memory
exceeds memory specified by specification S11 of the PHASEX function block. Correct this
allocation problem by increasing specification S11.
-6.0 Phase data The send phase data message can not fit in the memory allocated by
message exceeds specification S12 of the PHASEX function block. Correct this problem by
memory allocation increasing specification S12 and resending the phase data.

D-4 WBPEEUI330254B3
PHASEX

Table D-2. PHASEX Run-Time Fault Codes (continued)

Fault Codes Explanation


-7.0 Phase data size The amount of data used by a phase exceeds the amount of memory
exceeds memory specified by specification S12 of the PHASEX function block. To correct,
allocation increase the value of specification S12 in the PHASEX function block.
Fault data - The block number of the lead PHASEX function block with the
problem.
-8.0 Recipe refers to The recipe contains a phase subroutine name that is not contained within
undefined phase the batch program. This situation can happen when a batch program is
subroutine edited so that a phase subroutine is removed, but the corresponding recipes
are not changed. To correct, add the undefined phase subroutine or remove
the called (undefined) phase subroutine from the recipe.
Fault data:
0 = no phase data message was received.
1 = message received.
-9.0 Batch directory Format controller and reload necessary programs, recipes, and data files.
error
-10.0 Recipe error Contact ABB Technical Support Center.
-12.0 Illegal There is an argument data type conflict between the recipe and the batch
parameter type program. To correct, recompile the batch program and/or fix the recipe.
Then, download the recompiled batch program and rerun the phase.
Fault data - The position (starting with I) of the illegal parameter in the
recipe.
-13.0 ESTOP/ The abort phase was triggered by the specification 5 input of the PHASEX
Aborting from block function block. The fault is triggered when the abort phase is activated.
input Clear the fault by issuing a reset when the PHASEX function block is in the
aborted state.
-16.0 Bad function In the batch data declaration sections of the batch language, the program is
block reference trying to reference a function block that does not exist or one whose type
does not match the function code type in the declaration. The batch
debugger will provide the function block number within the batch data
section that is making the reference. To correct, change the function block
number to a valid one, erase the reference from the program, or correct the
type to match the function block in the controller.
-17.0 Array error An array subscript is out of bounds. Normal logic is suspended and
execution of fault logic begins. It is possible to inspect the value of the fault
code to detect when this fault has occurred.
-18.0 BCODE The batch program was compiled using firmware that does not match the
revision mismatch firmware in the controller. Recompile the batch program with the compiler
that matches the firmware within the controller.

WBPEEUI330254B3 D-5
PHASEX

Table D-2. PHASEX Run-Time Fault Codes (continued)

Fault Codes Explanation


-20.0 Invalid num- The recipe contains the wrong number of phase parameters as compared to
ber of parameters in the target program. To correct, fix the recipe or the program (normally the
phase data recipe).
-21.0 Invalid online The attempted execution of a new program that differs from the previous
program change one because of a change in the batch data area or the local declaration
section of the active phase subroutine. Such online changes are not
permitted.
-25.0 Bad block The recipe used contains a reference to an incorrect or nonexistent block.
reference in phase Correct the block number in the recipe.
data
Fault data - The position (starting with I) of the bad function block reference
in the recipe.
-27.0 Bad block A function block declaration in the unit data file does not match the
reference in Unit controller configuration (either the function block address or the function
Data code type are in error). Resolve any discrepancies and recompile the unit
data file against the batch program.
-28.0 Bad CSEQ A CSEQ reference in the unit data file does not match the program. Resolve
reference in Unit any discrepancies and recompile the unit data file against the batch
Data program.
-29.0 Unit Data does The unit data file does not match the batch program structurally (the number
not match B90 or type declarations do not match). Resolve any discrepancies and
program recompile the unit data file against the batch program.
-30.0 Error reading No unit data file exists in the NVRAM memory that matches the number
UNIT.DEF file indicated by specification S9 of the PHASEX function block. Normally this
means that the unit data object file has not been downloaded to the
controller.
-32.0 String sub- The string position specified in the program is negative or larger than the
script error maximum size of the string. This error occurs during program execution and
transfers the program to fault logic.
-35.0 Illegal The recipe parameter name does not match the parameter name of the
parameter name selected phase in the program file. Check the recipe and program file and
edit the names to match.
Fault data - The position (starting with I) of the illegal parameter in the
recipe.
-36.0 Abort phase The batch program file does not contain a phase named Abort. Edit the
not defined batch program to contain the Abort phase, recompile, and download the
program file.

D-6 WBPEEUI330254B3
PHASEX

Table D-2. PHASEX Run-Time Fault Codes (continued)

Fault Codes Explanation


-37.0 Phase data Phase data as received by the PHASEX function block is out of order. Send
receipt error the phase data again.
-38.0 Program not The command was accepted as an allowable command for the present
active state but the program was not active. The command could not be executed
successfully by the PHASEX function block. Activate (initialize or acquire)
the program and issue the command again.

WBPEEUI330254B3 D-7
WBPEEUI330254B3
Index

A BSEQ execution model .............................2-1


BSEQ function block ...............................4-27
Abbreviations ............................................ 1-4 BSEQ function code................................2-24
ACK variable........................................... 4-18 BSEQ run-time fault codes....................... D-1
ACQUIRE ............................................... 4-19
Advanced PID function block.................. 4-19
C
Analog exception report function block... 4-22
Arithmetic expressions............................ 4-16 CALL .......................................................4-33
Arithmetic operators ............................... 4-16 CAMPAIGN variable ...............................4-33
ARRAY ................................................... 4-24 Case conversion command.....................4-36
Arrays CASE statement......................................4-34
Array to array comparison ................... 4-14 #CASESENSE directive..........................4-36
Min/Max values.................................... 4-15 Commands
Variable to array comparison............... 4-13 Case conversion ..................................4-36
Assignment statement ............................ 4-24 Normalize string .................................4-127
Comments.................................................4-1
B Comparisons
Array.....................................................4-14
Batch 90 Variable to array...................................4-13
Batch data types .................................... 2-8 Variable to limit.....................................4-14
Batch sequence states ..........................B-1 Variable to list.......................................4-13
Batch sequence transitions....................B-3 CONNECT ..............................................4-58
BSEQ execution model.......................... 2-1 CONST ARRAY data structure ...............4-59
BSEQ function code ............................ 2-24 CONST data............................................4-58
Commands .......................................... 4-18 CONST STRING ARRAY data structure.4-64
CSEQ function code ..............................A-6 CONST STRING data .............................4-61
Function subroutines ........................... 2-11 Contents of instruction ..............................1-2
Monitor subroutine ............................... 2-12 Continuous section
Phase subroutines ................................. 2-8 Monitor subroutine ........................2-13, 3-5
PHASEX execution model ..................... 2-2 Phase subroutine .................................2-10
PHASEX function code........................ 2-28 State subroutine .....................................3-3
Program construction........................... 2-13 CONTINUOUS statement .......................4-66
Programs ............................................... 2-8 Control station function block ..................4-67
Sample application ................................A-1 Control structures
Syntax.................................................... 4-1 FOR...END FOR loop...........................4-91
Unit procedures ..................................... 2-3 IF THEN...ELSE...ENDIF ...................4-107
BATCH DATA statement ........................ 4-25 IF THEN..ENDIF ................................4-107
BATCH variable ...................................... 4-25 REPEAT...UNTIL ...............................4-146
BBUF ...................................................... 4-28 WHILE...ENDWHILE..........................4-179
Block array data structure....................... 4-28 CSEQ data structure ...............................4-37
Boolean expressions .............................. 4-15 CSEQ function code................................. A-6
Boolean operators .................................. 4-15 CYCLE TIME variable .............................4-69
BREAK statement................................... 4-33

WBPEEUI330254B3 Index - 1
Index (continued)

D #EJECT ............................................... 4-87


#HIHI ................................................. 4-104
Data #INCLUDE ......................................... 4-108
CONST.................................................4-58 #LIST ................................................. 4-113
CONST STRING ..................................4-61 #MAXPARALLEL............................... 4-114
VAR....................................................4-167 #NOLIST............................................ 4-126
VAR STRING .....................................4-171 #TITLE ............................................... 4-162
Data buffer function block .......................4-71 DISABLE EXTERNAL HOLD statement. 4-86
Data export function block.......................4-73 DISABLE FAULT CODE statement........ 4-87
DATA statement......................................4-69 DONE statement .................................... 4-87
Data structures
Block array ...........................................4-28
E
CONST ARRAY ...................................4-59
CONST STRING ARRAY.....................4-64 #EJECT directive.................................... 4-87
CSEQ ...................................................4-37 ENABLE EXTERNAL HOLD statement.. 4-88
Function block array.............................4-99 ENABLE FAULT CODE statement......... 4-88
Function generator .............................4-102 ENDSUBR statement ............................. 4-89
Global.................................................4-104 Executable section description ........ 2-12, 3-4
INTEGRATOR....................................4-110
Ramp data..........................................4-137 F
TIMER ................................................4-160
VAR ARRAY ......................................4-167 Fault logic
VAR STRING ARRAY........................4-174 Phase subroutine................................. 2-11
Data types State subroutine .................................... 3-3
UDF........................................................3-1 FAULT LOGIC section............................ 4-90
#DEBUG LEVEL directive.......................4-78 FAULT statement ................................... 4-89
Declarations FIRST CYCLE variable........................... 4-91
MONITOR ..........................................4-120 FOR...END FOR loop control structure .. 4-91
UNIT PARAMETERS .........................4-165 Function block array data structure ........ 4-99
Declarations section Function blocks
Function subroutine.......................2-12, 3-3 Advanced PID...................................... 4-19
Monitor subroutine ........................2-13, 3-5 Analog exception report....................... 4-22
Phase subroutine ...................................2-9 Batch sequence................................... 4-27
State subroutine .....................................3-2 Control station ..................................... 4-67
DECLARATIONS statement ...................4-79 Data buffer ........................................... 4-71
#DESCRIPTOR directive ........................4-80 Data export .......................................... 4-73
Device driver function block ....................4-80 Device driver........................................ 4-80
DIGIT function .........................................4-85 Digital exception report........................ 4-83
Digital exception report function block ....4-83 General................................................ 4-98
Directives ................................................4-10 Multi-state device driver..................... 4-121
#CASESENSE .....................................4-36 Remote control memory .................... 4-141
#DEBUG LEVEL ..................................4-78 Remote manual set constant ............. 4-142
#DESCRIPTOR....................................4-80 Remote motor control ........................ 4-144

Index - 2 WBPEEUI330254B3
Index (continued)

Smith predictor................................... 4-152 I


Text selector ...................................... 4-157
UDF TYPE 1 and 2 ............................ 4-162 IF statement ..........................................4-106
Function generator data structure ........ 4-102 IF THEN...ELSE...ENDIF
FUNCTION subroutine ........................... 4-93 control structure ....................................4-107
Function subroutine description IF THEN...ENDIF control structure........4-107
Batch 90............................................... 2-11 #INCLUDE directive ..............................4-108
UDF ....................................................... 3-3 INPUT statement...................................4-109
Functions INTEGRATOR data structure................4-110
#PROGRAM ID.................................. 4-136
DIGIT ................................................... 4-85 L
OPERATION DESCRIPTOR ............. 4-128
LAST OPERATION variable .................4-112
PHASE DESCRIPTOR ...................... 4-130
LAST PHASE variable ..........................4-112
PROGRAM DESCRIPTOR................ 4-136
LAST SUBR variable.............................4-113
RECIPE DESCRIPTOR..................... 4-139
Lines of code.............................................4-2
RECIPE ENTRY ................................ 4-139
#LIST directive ......................................4-113
SIZEOF.............................................. 4-151
LOT variable..........................................4-114
SUBR DESCRIPTOR ........................ 4-156
SUBR STATUS.................................. 4-157
UNIT DESCRIPTOR.......................... 4-165 M
MAJOR RESTART POINT statement ...4-148
G #MAXPARALLEL directive....................4-114
Min/Max array values ..............................4-15
Global data structures .......................... 4-104
MINOR RESTART POINT statement....4-148
Glossary ................................................... 1-4
MONITOR declaration...........................4-120
MONITOR subroutine ...........................4-115
H Monitor subroutine description .........2-12, 3-4
Heading section Multi-state device driver function block .4-121
Function subroutine ...................... 2-12, 3-3
Monitor subroutine ........................ 2-13, 3-5 N
Phase subroutine................................... 2-9
Names.......................................................4-2
State subroutine..................................... 3-2
NEXT OPERATION statement..............4-124
#HIHI directive ...................................... 4-104
NEXT PHASE statement.......................4-125
HISTORIAN BUFFER variable ............. 4-105
NEXT STATE statement .......................4-125
HISTORIAN STATUS variable ............. 4-105
#NOLIST directive.................................4-126
HOLD.................................................... 4-105
Normal logic description
Hold logic description ............................. 2-11
Phase subroutine .................................2-10
HOLD LOGIC section ........................... 4-106
State subroutine .....................................3-3
How to use this instruction........................ 1-3
NORMAL LOGIC section ......................4-126
Normalize string command ...................4-127
Notation...................................................4-11

WBPEEUI330254B3 Index - 3
Index (continued)

O RESERVE ............................................ 4-146


Reserved constants.................................. 4-6
OPERATION DESCRIPTOR function...4-128 Reserved words........................................ 4-3
OPERATION variable ...........................4-127 RESET.................................................. 4-146
OUTPUT statement...............................4-129 Restart logic description ......................... 2-11
Overview RESTART LOGIC section .................... 4-147
Batch 90 .................................................2-1 RESTART statement ............................ 4-147
Installation ..............................................1-1 RESUME .............................................. 4-149
Syntax ....................................................4-1 RESUME AT statement........................ 4-149
UDF........................................................3-1 RETURN statement.............................. 4-150
Run-time fault codes
P BSEQ.....................................................D-1
PHASEX ................................................D-4
PHASE DESCRIPTOR function............4-130
PHASE NUMBER variable....................4-130
PHASE statement .................................4-130 S
PHASE SUBR subroutine .....................4-131 Sample application
Phase subroutine description....................2-8 Batch 90 ................................................ A-1
PHASEX execution model ........................2-2 UDF ..................................................... A-14
PHASEX function code ...........................2-28 Sections of
PHASEX run-time fault codes .................. D-4 Function subroutine ...................... 2-11, 3-3
PROGRAM DESCRIPTOR function .....4-136 Monitor subroutine ........................ 2-12, 3-4
#PROGRAM ID function .......................4-136 Phase subroutine................................... 2-8
Programs State subroutine .................................... 3-2
Batch 90 .................................................2-8 SET....................................................... 4-150
Construction ..................................2-13, 3-5 SET AND WAIT .................................... 4-150
UDF........................................................3-1 SIZEOF function ................................... 4-151
SKIP CYCLE statement........................ 4-152
R Smith predictor function block .............. 4-152
START.................................................. 4-154
Ramp data structure..............................4-137
STATE SUBR subroutine ..................... 4-154
RBUF ....................................................4-139
State subroutine description ..................... 3-2
RECIPE DESCRIPTOR function...........4-139
Statements
RECIPE ENTRY function ......................4-139
Assignment .......................................... 4-24
Reference documents ...............................1-5
BATCH DATA ...................................... 4-25
Reference extensions ...............................4-7
BREAK ................................................ 4-33
Relational expressions ............................4-12
CASE................................................... 4-34
Relational operators ................................4-12
CONTINUOUS .................................... 4-66
Remote control memory function block.4-141
DATA ................................................... 4-69
Remote manual set constant
DECLARATIONS................................. 4-79
function block ........................................4-142
DISABLE EXTERNAL HOLD .............. 4-86
Remote motor control function block.....4-144
DISABLE FAULT CODE...................... 4-87
REPEAT...UNTIL control structure........4-146
DONE .................................................. 4-87

Index - 4 WBPEEUI330254B3
Index (continued)

ENABLE EXTERNAL HOLD................ 4-88 Directives .............................................4-10


ENABLE FAULT CODE....................... 4-88 Lines.......................................................4-2
ENDSUBR ........................................... 4-89 Min/Max array values ...........................4-15
FAULT ................................................. 4-89 Names....................................................4-2
IF........................................................ 4-106 Notation................................................4-11
INPUT ................................................ 4-109 Reference extensions ............................4-7
MAJOR RESTART POINT ................ 4-148 Relational expressions .........................4-12
MINOR RESTART POINT ................. 4-148 Relational operators .............................4-12
NEXT OPERATION ........................... 4-124 Reserved constants ...............................4-6
NEXT PHASE .................................... 4-125 Reserved words .....................................4-3
NEXT STATE..................................... 4-125 Variable to array comparisons .............4-13
OUTPUT ............................................ 4-129 Variable to limit comparison .................4-14
PHASE............................................... 4-130 Variable to list comparisons .................4-13
RESTART .......................................... 4-147
RESUME AT...................................... 4-149 T
RETURN............................................ 4-150
SKIP CYCLE...................................... 4-152 Terms ........................................................1-4
UNIT DATA........................................ 4-163 Text selector function block...................4-157
WAIT FOR ......................................... 4-178 TIMER data structure ............................4-160
WAIT UNTIL ...................................... 4-178 #TITLE directive ....................................4-162
STEP SUBR subroutine ....................... 4-156
Structure U
Function subroutine ...................... 2-11, 3-3
Monitor subroutine ........................ 2-12, 3-4 UDF
Phase subroutine................................... 2-8 Commands...........................................4-18
State subroutine..................................... 3-2 Data types ..............................................3-1
SUBPHASE variable ............................ 4-156 Function subroutines..............................3-3
SUBR DESCRIPTOR function.............. 4-156 Monitor subroutines................................3-4
SUBR STATUS function ....................... 4-157 Program construction .............................3-5
Subroutines Program execution .................................3-5
FUNCTION .......................................... 4-93 Programs................................................3-1
MONITOR.......................................... 4-115 Sample application.............................. A-14
PHASE SUBR.................................... 4-131 State subroutines ...................................3-2
STATE SUBR .................................... 4-154 Syntax ....................................................4-1
STEP SUBR ...................................... 4-156 UDF TYPE 1 and 2 function blocks.......4-162
Syntax....................................................... 4-1 UNACQUIRE.........................................4-162
Arithmetic expressions......................... 4-16 UNCONNECT .......................................4-162
Arithmetic operators............................. 4-16 UNIT DATA statement ..........................4-163
Array comparison................................. 4-14 UNIT DESCRIPTOR function................4-165
Boolean expressions ........................... 4-15 UNIT PARAMETERS declaration .........4-165
Boolean operators ............................... 4-15 Unit procedures.........................................2-3
Comments ............................................. 4-1 UNRESERVE........................................4-166
User qualifications.....................................1-2

WBPEEUI330254B3 Index - 5
Index (continued)

V HISTORIAN STATUS ........................ 4-105


LAST OPERATION ........................... 4-112
VAR ARRAY data structure ..................4-167 LAST PHASE .................................... 4-112
VAR data...............................................4-167 LAST SUBR....................................... 4-113
VAR STRING ARRAY data structure....4-174 LOT.................................................... 4-114
VAR STRING data ................................4-171 OPERATION ..................................... 4-127
Variable to array comparisons ................4-13 PHASE NUMBER .............................. 4-130
Variable to list comparisons ....................4-13 SUBPHASE ....................................... 4-156
Variables
ACK......................................................4-18
W
BATCH .................................................4-25
CAMPAIGN ..........................................4-33 WAIT FOR statement ........................... 4-178
CYCLE TIME........................................4-69 WAIT UNTIL statement ........................ 4-178
FIRST CYCLE......................................4-91 WAIT WHILE statement ....................... 4-179
HISTORIAN BUFFER ........................4-105 WHILE...ENDWHILE control structure . 4-179

Index - 6 WBPEEUI330254B3
WBPEEUI330254B3 Litho in U.S.A. November 2004
Copyright © 2004 by ABB. All Rights Reserved
® Registered Trademark of ABB.
™ Trademark of ABB.

http://www.abb.com/control

Automation Technology Products Automation Technology Products Automation Technology Products


Wickliffe, Ohio, USA Västerås, Sweden Mannheim, Germany
www.abb.com/processautomation www.abb.com/processautomation www.abb.de/processautomation
email: [email protected] email: [email protected] email: [email protected]

You might also like