Batch 90 and UDF Programming Language
Batch 90 and UDF Programming Language
for Harmony
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.
WBPEEUI330254B3
WBPEEUI330254B3
Table of Contents
WBPEEUI330254B3 iii
Table of Contents (continued)
iv WBPEEUI330254B3
Table of Contents (continued)
WBPEEUI330254B3 v
Table of Contents (continued)
vi WBPEEUI330254B3
Table of Contents (continued)
WBPEEUI330254B3 vii
Table of Contents (continued)
viii WBPEEUI330254B3
Table of Contents (continued)
List of Figures
No. Title Page
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
xii WBPEEUI330254B3
Trademarks and Registrations
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:
WBPEEUI330254B3 1-1
Intended User
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
1-2 WBPEEUI330254B3
How to Use this Instruction
Run-time Fault Codes Lists and explains the possible run-time error codes.
• Additional information.
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.
WBPEEUI330254B3 1-3
Glossary of Terms and Abbreviations
Example:
file1.b90
c:\new
Revision variable A ? indicates a value that may change depending on the ver-
sion of an item. Example:
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.
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.
WBPEEUI330254B3 2-1
PHASEX Execution Model
2-2 WBPEEUI330254B3
Unit Procedures
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:
WBPEEUI330254B3 2-3
Unit Procedures
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
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
WBPEEUI330254B3 2-5
Unit Procedures
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
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
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
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.
• 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
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.
2 - 10 WBPEEUI330254B3
Batch Programs
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
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.
2 - 12 WBPEEUI330254B3
Batch Program Construction
WBPEEUI330254B3 2 - 13
Batch Program Construction
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.
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
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.
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
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
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
WBPEEUI330254B3 2 - 17
Batch Program Construction
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.
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
WBPEEUI330254B3 2 - 19
Batch Program Construction
2 - 20 WBPEEUI330254B3
Batch Program Construction
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.
WBPEEUI330254B3 2 - 21
Batch Program Construction
2 - 22 WBPEEUI330254B3
Batch Program Construction
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
• Acknowledgment of messages.
• Changing an operation number within a unit recipe.
2 - 24 WBPEEUI330254B3
Batch Sequence Function Code
WBPEEUI330254B3 2 - 25
Batch Sequence Function Code
2 - 26 WBPEEUI330254B3
Batch Sequence Function Code
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.
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
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.
2 - 28 WBPEEUI330254B3
Phase Execution Function Code
• Acknowledgment of messages.
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
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.
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.
WBPEEUI330254B3 3-1
UDF Programs
• Function blocks.
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.
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.
3-2 WBPEEUI330254B3
UDF Programs
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
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.
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.).
WBPEEUI330254B3 3-5
UDF Program Construction
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
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
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
VAR I
VAR HIGHEST_RUN_TIME
VAR LOWEST_RUN_TIME
VAR NEXT_PUMP_TO_START
VAR NEXT_PUMP_TO_STOP
END DATA
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.
3-8 WBPEEUI330254B3
UDF Program Construction
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
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
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
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
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
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
3 - 12 WBPEEUI330254B3
UDF Program Construction
WBPEEUI330254B3 3 - 13
UDF Program Construction
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:
• Legal names.
• Reserved words/constants/directives.
• Types of expressions.
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
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
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
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
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
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
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
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
Extension Description BSQ PHX UDF Extension Description BSQ PHX UDF
.ALM alarm status X X X .CLR message X X X
color
WBPEEUI330254B3 4-7
Syntax
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
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
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
4 - 10 WBPEEUI330254B3
Syntax
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.
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
4 - 12 WBPEEUI330254B3
Syntax
(var = (const1,const2,...,constn))
where:
IF (X = ARYLIST(*)) THEN
SET FC101.MODE = AUTO
ENDIF
WBPEEUI330254B3 4 - 13
Syntax
where:
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:
4 - 14 WBPEEUI330254B3
Syntax
where:
WBPEEUI330254B3 4 - 15
Syntax
where:
Minus exp.
* Usage exp1 * exp2
Product of exp1 and exp2.
4 - 16 WBPEEUI330254B3
Syntax
e to exp1 power.
RND Usage RND (exp)
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
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.
4 - 18 WBPEEUI330254B3
ACQUIRE
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).
Parameter Description
name Name of the APID function block.
const Function block address.
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
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.
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
WBPEEUI330254B3 4 - 21
Analog Exception Report (Function Block)
NOTE: Input S1 of the AOL function block must be set to 2. Otherwise, batch
program commands will be ignored.
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.
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
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.
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
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
WBPEEUI330254B3 4 - 25
BATCH DATA (Statement)
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.
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
Parameter Description
bseqx Name of the BSEQ function block.
const Function block address.
WBPEEUI330254B3 4 - 27
BBUF
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).
4 - 28 WBPEEUI330254B3
Block Array (Data Structure)
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)
WBPEEUI330254B3 4 - 29
Block Array (Data Structure)
Element of an array
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.
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
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.
WBPEEUI330254B3 4 - 31
Block Array (Data Structure)
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.
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).
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.
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
WBPEEUI330254B3 4 - 33
CASE (Statement)
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
CASE 5
CASE 1 TO 10
CASE 5
CASE 1 TO 4, 6 TO 10
WBPEEUI330254B3 4 - 35
#CASESENSE (Directive)
#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.
- 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)
• 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).
WBPEEUI330254B3 4 - 37
Common Sequence (Data Structure)
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
NOTE: PHASEX programs can only act as the client to BSEQ server programs
4 - 38 WBPEEUI330254B3
Common Sequence (Data Structure)
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.
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).
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.
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.
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.
WBPEEUI330254B3 4 - 41
Common Sequence (Data Structure)
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.
cseqname.MODE
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.MODE Control mode:
0 = operator (manual).
1 = remote (auto).
4 - 42 WBPEEUI330254B3
Common Sequence (Data Structure)
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).
cseqname.FAULT
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.FAULT Fault code.
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.
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.
cseqname.CAMPAIGN
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.CAMPAIGN Campaign identifier.
THIS.CAMPAIGN Campaign identifier.
cseqname.BATCH
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.BATCH Batch identifier.
THIS.BATCH Batch identifier.
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.LOT Lot identifier.
THIS.LOT Lot identifier.
4 - 44 WBPEEUI330254B3
Common Sequence (Data Structure)
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
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...
cseqname.PROGRAM
Parameter Description
cseqname Name of the CSEQ function block.
cseqname.PROGRAM Program ID number.
WBPEEUI330254B3 4 - 45
Common Sequence (Data Structure)
cseqname.TPID
Parameter Description
cseqname Name of the CSEQ block.
cseqname.TPID Target program ID number.
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.
4 - 46 WBPEEUI330254B3
Common Sequence (Data Structure)
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.
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.
WBPEEUI330254B3 4 - 47
Common Sequence (Data Structure)
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.
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))
WBPEEUI330254B3 4 - 49
Common Sequence (Data Structure)
Connect to a CSEQ
CONNECT cseqname
Parameter Description
cseqname Name of the CSEQ function block.
UNCONNECT cseqname
Parameter Description
cseqname Name of the CSEQ function block.
2. The module containing the CSEQ function block leaves execute mode.
4 - 50 WBPEEUI330254B3
Common Sequence (Data Structure)
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.
- and -
- and -
3. The CSEQ function block is inactive, OPTIONS = NORMAL.
- or -
WBPEEUI330254B3 4 - 51
Common Sequence (Data Structure)
- or -
- and -
Unacquire a CSEQ
UNACQUIRE cseqname
Parameter Description
cseqname Name of the CSEQ or THIS function block.
4 - 52 WBPEEUI330254B3
Common Sequence (Data Structure)
Reserve a CSEQ
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.
- and -
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.
Start/restart a CSEQ
- 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.
4 - 54 WBPEEUI330254B3
Common Sequence (Data Structure)
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.
- or -
- or -
- or -
WBPEEUI330254B3 4 - 55
Common Sequence (Data Structure)
Parameter Description
cseqname Name of the CSEQ function block.
n Number of command variable (1 through 8).
exp Value.
- or -
Parameter Description
cseqname Name of the CSEQ function block.
exp Value.
4 - 56 WBPEEUI330254B3
Common Sequence (Data Structure)
Parameter Description
n Number of status variable (1 through 8).
exp Value.
Parameter Description
exp Value.
WBPEEUI330254B3 4 - 57
CONNECT
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.
Parameter Description
name Name of the constant.
const Value of the constant.
4 - 58 WBPEEUI330254B3
CONST ARRAY (Data Structure)
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)
Array element
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)
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.
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)
References CONST STRING data can be read using the appropriate name
in an expression.
Parameter Description
cstrname Name of the constant string.
cstrname.CLEN The number of characters included in the string value parameter.
cstrname.MLEN
Parameter Description
cstrname Name of the constant string.
cstrname.MLEN The number of characters included in the string value parameter.
4 - 62 WBPEEUI330254B3
CONST STRING (Data)
cstrname
Parameter Description
cstrname Name of the constant string.
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.
WBPEEUI330254B3 4 - 63
CONST STRING ARRAY (Data Structure)
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)
Array element
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.
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)
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.
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.
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.
4 - 68 WBPEEUI330254B3
CYCLE TIME (Variable)
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.
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
4 - 70 WBPEEUI330254B3
Data Buffer (Function Block)
Data is initialized when a UDF program is run for the first time
(that is, on the multifunction processor transition to execute).
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.
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
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.
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)
Parameter Description
ctrblk Name of the DATAEXPT function code.
cons1 Block address of the DATAEXPT function block.
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).
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)
WBPEEUI330254B3 4 - 75
Data Export (Function Block)
- 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.
Remarks The entire output string will be written. The ability to write to
substrings within the output string is not supported.
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.
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.
WBPEEUI330254B3 4 - 77
#DEBUG LEVEL (Directive)
Parameter Description
const A number from 1 to 4.
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
CALL
ENDSUBR of monitor and function subroutines
MONITOR subroutine declaration
SET AND WAIT
WAIT
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.
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)
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.
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.
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.
4 - 82 WBPEEUI330254B3
Digital Exception Report (Function Block)
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).
NOTE: Input S1 of the DOL function block must be set to two. Otherwise, batch
program commands will be ignored.
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.
WBPEEUI330254B3 4 - 83
Digital Exception Report (Function Block)
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
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.
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.
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
4 - 86 WBPEEUI330254B3
DISABLE FAULT CODE (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
#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
WBPEEUI330254B3 4 - 87
ENABLE EXTERNAL HOLD (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).
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
WBPEEUI330254B3 4 - 89
FAULT LOGIC (Section)
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.
- or -
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.
4 - 92 WBPEEUI330254B3
FUNCTION (Subroutine)
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.
FUNCTION name
Parameter list
DECLARATIONS
Local data
EXECUTABLE
Executable statements
ENDSUBR [name]
FUNCTION name
type1 fname1
type2 fname2
•
•
•
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 (*,*,*))
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
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.
Parameter Description
name Name of the function subroutine parameter.
paramN N th actual parameter.
4 - 96 WBPEEUI330254B3
FUNCTION (Subroutine)
Parameter Description
name Name of the function subroutine.
paramN N th actual parameter.
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.
WBPEEUI330254B3 4 - 97
Function Block
Function Block
Purpose Function blocks in a control module batch system perform
continuous functions including:
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)
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.
WBPEEUI330254B3 4 - 99
Function Block Array (Data Structure)
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.
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.
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)
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)
(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
4 - 102 WBPEEUI330254B3
Function Generator (Data Structure)
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
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).
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.)
#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:
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.
4 - 104 WBPEEUI330254B3
HISTORIAN BUFFER (Variable)
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)
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
4 - 106 WBPEEUI330254B3
IF THEN...ENDIF (Control Structure)
WBPEEUI330254B3 4 - 107
#INCLUDE (Directive)
#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.
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.
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)
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.
4 - 110 WBPEEUI330254B3
INTEGRATOR (Data Structure)
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
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).
WBPEEUI330254B3 4 - 111
LAST OPERATION (Variable)
- or -
Parameter Description
bseqx Name of the BSEQ function block that is executing the current unit recipe.
4 - 112 WBPEEUI330254B3
LAST SUBR (Variable)
- 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
#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)
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.
WBPEEUI330254B3 4 - 115
MONITOR (Subroutine)
of the monitor subroutine is global and exists all the while the
BSEQ program is active (running or held).
MONITOR name
Parameter list
DECLARATIONS
Local data
CONTINUOUS
Executable statements
ENDSUBR [name]
4 - 116 WBPEEUI330254B3
MONITOR (Subroutine)
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.
WBPEEUI330254B3 4 - 117
MONITOR (Subroutine)
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
4 - 118 WBPEEUI330254B3
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)
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.
4 - 120 WBPEEUI330254B3
Multistate Device Driver (Function Block)
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.
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.
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.
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)
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.
WBPEEUI330254B3 4 - 123
NEXT OPERATION (Statement)
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.
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).
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.
Parameter Description
name Name of the state subroutine to be activated.
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.
4 - 126 WBPEEUI330254B3
Normalize String (Command)
Parameter Description
vstrname Name of a variable string.
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
WBPEEUI330254B3 4 - 127
OPERATION DESCRIPTOR (Function)
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))
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.
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
Parameter Description
name UDF function block output name.
exp Output value.
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.
4 - 130 WBPEEUI330254B3
PHASE SUBR (Subroutine)
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:
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.
4 - 132 WBPEEUI330254B3
PHASE SUBR (Subroutine)
Parameter Description
const1 Default low limit.
const2 Default value.
const3 Default high limit.
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)
Parameter Description
constN Name of a constant declared in the batch data section of the program, or a Batch 90
reserved constant.
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.
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.
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)
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)
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.
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)
Parameter Description
r name Name of the ramp.
exp1 Initial ramp value.
exp2 Upper limit of ramp.
exp3 Rate of change.
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.
4 - 138 WBPEEUI330254B3
RBUF
RBUF
Refer to Data Buffer (Function Block).
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.
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)
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.
name.VAL
Parameter Description
name Name of the RCM function block.
name.VAL Output value.
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.
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.
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.
4 - 142 WBPEEUI330254B3
Remote Manual Set Constant (Function Block)
name.VAL
Parameter Description
name Name of the REMSET function block.
name.VAL Output value.
Example X = RSET501.VAL
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.
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)
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.
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
- or -
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.
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)
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 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)
- or -
Paramete
Description
r
id Positive integer that uniquely identifies this point in normal logic.
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 -
- or -
RESUME AT id
Parameter Description
id An ID of a restart point statement.
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.
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).
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 -
Parameter Description
array_name Name of an array of any type.
n First, second, or third array dimension.
WBPEEUI330254B3 4 - 151
SKIP CYCLE (Statement)
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.
Parameter Description
name Name of the function block.
const Function block address.
4 - 152 WBPEEUI330254B3
Smith Predictor (Function Block)
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
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.
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).
Language UDF
Heading A state subroutine heading defines the name of the subrou-
tine. The heading format is:
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)
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)
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.
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)
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
WBPEEUI330254B3 4 - 157
Text Selector (Function Block)
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.
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
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.
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.
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)
Parameter Description
tname Name of the timer.
units Unit of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.
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)
Start
Parameter Description
tname Name of the timer.
exp Alarm limit.
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.
Reset
Parameter Description
tname Name of the timer.
exp Initial time.
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 n
Parameter Description
n 1 for UDF Type 1 function blocks.
2 for UDF Type 2 function blocks.
UNACQUIRE
Refer to Common Sequence (Data Structure).
UNCONNECT
Refer to Common Sequence (Data Structure).
4 - 162 WBPEEUI330254B3
UNIT DATA (Statement)
Parameter Description
type Any one of the following:
ANY Constant.
BLOCK Function block.
CONST STRING Constant string.
name Name of the 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
4 - 164 WBPEEUI330254B3
UNIT DESCRIPTOR (Function)
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.
WBPEEUI330254B3 4 - 165
UNRESERVE
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.
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.
name
Parameter Description
name Name of the variable.
Example X = VOLUME
WBPEEUI330254B3 4 - 167
VAR ARRAY (Data Structure)
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.
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)
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
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)
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
Parameter Description
dname Name of the destination variable array.
sname Name of the source variable array.
(*...) Number of dimensions.
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)
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.
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)
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)
4 - 172 WBPEEUI330254B3
VAR STRING (Data)
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).
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.
WBPEEUI330254B3 4 - 173
VAR STRING ARRAY (Data Structure)
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.
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.
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.
WBPEEUI330254B3 4 - 175
VAR STRING ARRAY (Data Structure)
STRING = Z (1, 2, K)
SUBSTRING = B (I, 3) (FROM 1 FOR 8)
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
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)
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.
Parameter Description
dname Name of the destination array.
sname Name of the source array.
(*...) Number of dimensions.
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)
Parameter Description
exp Time interval.
units Units of time:
SEC Seconds.
MIN Minutes.
HOUR Hours.
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.
4 - 178 WBPEEUI330254B3
WAIT WHILE (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
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:
xx.yy
where:
WBPEEUI330254B3 A-1
Batch 90
RECIPE ID: 1
RECIPE DESCRIPTOR: PARALLEL_TEST
A-2 WBPEEUI330254B3
Batch 90
where:
WBPEEUI330254B3 A-3
Batch 90
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
A-4 WBPEEUI330254B3
Batch 90
#MAXPARALLEL = n
where:
WBPEEUI330254B3 A-5
Batch 90
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
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
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
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
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
• 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.
A - 10 WBPEEUI330254B3
Batch 90
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.
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
- or -
- 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
WBPEEUI330254B3 A - 13
User Defined Function (UDF)
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
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
A - 14 WBPEEUI330254B3
User Defined Function (UDF)
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
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
WBPEEUI330254B3 A - 17
User Defined Function (UDF)
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)
WBPEEUI330254B3 A - 19
User Defined Function (UDF)
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
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
A - 22 WBPEEUI330254B3
BSEQ State Transition Diagram Appendix B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
WBPEEUI330254B3 B-1
Batch Sequence States
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
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).
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
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
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.
WBPEEUI330254B3 C-1
States
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
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.
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).
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
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.
C-4 WBPEEUI330254B3
States
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.
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.
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:
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.
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
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.
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.
Acquire
This command acquires the UEM configuration for a batch
program. Upon successful completion of this command, it:
WBPEEUI330254B3 C-7
External Commands
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
C-8 WBPEEUI330254B3
External Commands
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.
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:
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.
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
(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
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.
WBPEEUI330254B3 D-1
BSEQ
D-2 WBPEEUI330254B3
BSEQ
WBPEEUI330254B3 D-3
PHASEX
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.
D-4 WBPEEUI330254B3
PHASEX
WBPEEUI330254B3 D-5
PHASEX
D-6 WBPEEUI330254B3
PHASEX
WBPEEUI330254B3 D-7
WBPEEUI330254B3
Index
WBPEEUI330254B3 Index - 1
Index (continued)
Index - 2 WBPEEUI330254B3
Index (continued)
WBPEEUI330254B3 Index - 3
Index (continued)
Index - 4 WBPEEUI330254B3
Index (continued)
WBPEEUI330254B3 Index - 5
Index (continued)
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