Escolar Documentos
Profissional Documentos
Cultura Documentos
! WARNING
WARNING indicates a potentially hazardous situation that, if not avoided, could
result in death or serious injury, and/or property damage.
! CAUTION
CAUTION used with a safety alert symbol indicates a potentially hazardous situ-
ation that, if not avoided, could result in minor or moderate injury.
CAUTION
CAUTION used without the safety alert symbol indicates a potentially
hazardous situation that, if not avoided, could result in property damage.
NOTICE
NOTICE indicates a potential situation that, if not avoided, could result in an
undesirable result or state.
Reproduction, transmission, or use of this document or contents is not permitted without express consent of Siemens Energy &
Automation, Inc. All rights, including rights created by patent grant or registration of a utility model or design, are reserved.
Since Siemens Energy & Automation, Inc., does not possess full access to data concerning all of the uses and applications of
customer’s products, we do not assume responsibility either for customer product design or for any infringements of patents or rights
of others which may result from our assistance.
MANUAL PUBLICATION HISTORY
SIMATIC PCS 7 OSX 4.1.1 Batch Programming Manual
Order Manual Number: 6ES7 6550XX048BC4
Refer to this history in all correspondence and/or discussion about this manual.
Cover/Copyright Original
History/Effective Pages Original
Trademarks Original
iii — xvii Original
1-1 — 1-11 Original
2-1 — 2-7 Original
3-1 — 3-36 Original
4-1 — 4-22 Original
5-1 — 5-6 Original
6-1 — 6-4 Original
7-1 — 7-26 Original
A-1 — A-10 Original
B-1 — B-1 Original
C-1 — C-63 Original
D-1 — D-12 Original
E-1 — E-3 Original
F-1 — F-5 Original
G-1 — G-28 Original
Index-1 — Index-5 Original
Registration Original
Trademarks
SIMATICr, SINECr, and STEPr are registered trademarks, and S5t and S7t are trademarks, of Siemens AG.
PCSt, APTt, Series 505t, and TISOFTt are trademarks of Siemens Energy & Automation, Inc.
Adober and Acrobatr are registered trademarks of Adobe Systems, Inc.
@aGlancet and Net OLEt are trademarks of eMation, Inc.
Epsonr is a registered trademark of Seiko Epson Kabushiki Kaisha.
Excelt is a trademark, and Windowsr and MS-DOSr are registered trademarks, of Microsoft Corporation.
HPr, DeskJetr, LaserJetr, and PaintJetr are registered trademarks of Hewlett--Packard Company.
IBMr is a registered trademark of International Business Machines Corporation.
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Chapter 1 Overview of Batch Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
1.1 What Is OSx Batch Processing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Components of Batch Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Interaction of Batch Processing Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
2.4 Configuring Unit Tags and Establishing Links to Other Tags . . . . . . . . . . . . . . . . . . . . . . . 2-6
Defining Units and Their Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Configuring Tag Capacities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Contents iii
3.3 Creating a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Steps to Create a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Referencing Tag Names in BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
3.4 Using Keywords to Write a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Reserved Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.5 Using #include Statements in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Translating BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
3.6 Using Variable Definitions in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Variable Definition Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
3.7 Using Unit Mapping in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Unit Mapping Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Parameter Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.8 Using Event Blocks in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Event Block Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Event Block Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Special Event Block Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
Database Event Trigger Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Referencing Controller-Resident Data in WHERE Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Event Block trigger_spec Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Event Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24
Retrieve Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
Replace Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
Delete Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
Event Block Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30
BCL Program Bit Conversion Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31
Invalid Bit Type Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31
3.9 Controlling Batch Operation with Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-32
3.10 Controlling the Operation of BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34
BCL Program Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34
3.11 Creating BCL Code to Handle Error Conditions in Event Blocks . . . . . . . . . . . . . . . . . . . . 3-35
BCL Error Handling Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35
iv Contents
4.2 Compiling a Program Interactively . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Contents v
Chapter 7 Running and Supervising a Batch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Sequence of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
vi Contents
Appendix C Batch Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
C.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
Custom and Internal Batch IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
C.2 bc_activate_autolog( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-6
Contents vii
C.26 bc_lock_batch_id( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-30
viii Contents
Appendix D BCL Program Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1
D.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-2
E.2 Security Privileges for Unit Commands and Batch Mode Commands . . . . . . . . . . . . . . . E-3
Appendix F Advanced BCL Programming Techniques . . . . . . . . . . . . . . . . . . . . . . . . F-1
F.1 BCL Access to Custom Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2
Who Should Read This Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2
Custom Database Table Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2
Privilege Masks of Standard Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-3
F.2 USER_MSG Event Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-4
Using the USER_MSG Event Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-4
Appendix G BCL Application Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . G-1
G.1 BCL Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Simple Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Sample Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Configuration Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-4
Program Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-5
Program Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-5
Event Block #1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-9
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1
Contents ix
List of Figures
x Contents
A-1 Bit Locations for Batch Status Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4
A-2 Bit Locations for UNIT Status Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
Contents xi
List of Tables
xii Contents
Preface
New Features of SIMATIC PCS 7 OSx Release 4.1.1 supports the following new features:
PCS 7 OSx
S7 417H support — Support for the S7 417H redundant controller has
been incorporated into OSx 4.1.1. OSx supports this controller in either
stand-alone or redundant mode. When a single CPU417H is configured
as an independent controller, it operates in stand-alone mode. When
two CPU417H and two CP443-1 modules are configured in separate
subsystems (racks), one controller acts as the Master while the other
serves as an emergency Standby.
Move to Linux Operating System — OSx 4.1.1 has been moved from
the SCO UNIX operating system to the Red Hat Linux Operating
System. This should allow for more efficient support of any underlying
operating system problems that might arise in the future, in addition to
a quicker response time to supporting any future hardware platform
modifications or peripheral additions.
OK Saves information that you have entered and closes the window.
Save Saves information that you have entered and does not close the
window.
Cancel Closes the window without saving any information that you
entered and terminates any action that you initiated.
Dismiss Closes the window. If you have already pressed Enter, your work
is not lost; if you have not pressed Enter, your work is discarded.
The different fonts used in the manual set have the following meanings.
Entries that you enter from the keyboard are indicated with the
courier font.
Items that you select on the screen, or keys that you press on the
keyboard are indicated with this bolded font.
Items that you select on a cascaded menu are linked in the manual text
with arrows. The first term indicates where to click the main menu bar. For
example, Controls->Change System State tells you to click Controls on the
main menu bar, then select Change System State from the pull-down menu.
OK Cancel
SIMATIC PCS 7 OSx Operator Manual This manual is written for the
configuration engineer, but it describes how to carry out the various
tasks that the process operator must do when the system is in the
Operate state. You can photocopy all or portions of this manual as a
reference for your operators. You may prefer to rewrite sections and
perhaps incorporate additional information where necessary.
If You Need Help If you have difficulty with your system, contact the Siemens Energy &
Automation, Inc., Technical Services Group in the U.S.A. at 423--461--2522.
Outside the U.S.A., call 49--911--895--7000.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-1
1.1 What Is OSx Batch Processing?
Overview OSx enables you to supervise and record information related to the
operation of a batch process. Figure 1-1 illustrates where OSx fits in a
typical batch control system and lists those aspects of batch processing that
are controlled and supervised by OSx.
Operator Supervisory
Station Station
Offers several batch control
utilities to help integrate OSx
with the batch.
Control
Station
Displays batch-related graphics
and tag details.
I/O modules
local and
Offers configurable action remote
requests that announce when a
batch changes state and that
prompt operators for a response.
1-2 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
With SIMATIC PCS 7 OSx, batch processing typically involves one or more
units. In a factory environment, a unit corresponds to a specific collection of
machinery or equipment (for example: an evaporator or boiler). In the OSx
environment, a unit corresponds to a collection of one or more I/O tags that
are configured and associated with factory equipment.
In the sample process shown in Figure 1-2, the data model for the factory
process consists of one batch, three units, and eight I/O tags. OSx uses the
information gathered by these tags to create an internal model of the
process and to supervise the batch.
Batch
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-3
What is Batch Processing? (continued)
1-4 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Batch log and reports The batch log contains all log messages that
are generated during batch processing. This log records the
step-by-step progress of a batch and lists any errors that might occur
during processing. The batch reports are similar to other reports, but
they primarily consist of batch-related data from the batch log and the
database.
Refer to Chapter 6 for more information about creating batch logs and
reports.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-5
What is Batch Processing? (continued)
Interaction of Batch Figure 1-3 illustrates the interactions between the OSx components that
Processing can be associated with batch processing. Table 1-1 describes the interactions
Components that are labeled A--L in Figure 1-3.
C D
Batch Batch
E Control F
F
6 Reports
Language
G
H I J
Control Node
1-6 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table 1-1 Interactions between Batch Processing Components
Interaction Description
This interaction enables you to configure OSx to generate action requests when specific
batch-related events occur. If an action request is triggered, a flashing icon appears on the
A
Operator Station Display. If a batch requires operator interaction, an action request can
prompt the operator for a response.
This interaction logs an action request to the batch log if a tag in the action request is part of
B
a batch.
This interaction enables you to develop a program of batch control instructions that pull
C specific data from the OSx database, manipulate the data (if required), and place the data in
the batch log associated with the currently running batch.
This interaction enables you to create report formats that pull data from a batch log and
D create customized reports. Each report contains data related to a single batch. You can also
use a report function to write data to the batch log.
This interaction enables you to create action requests that constantly monitor the appropriate
E attributes in the OSx database for any changes. If any changes occur in the monitored
attributes, OSx triggers the corresponding action requests.
This interaction uses changes to tags from the OSx database to generate a batch log for the
F
batch associated with the changing tags.
This interaction causes data changes in the OSx database to be reflected in the corresponding
G graphics. While OSx is in the Operate state, any change that you enter through the Operator
Station Display updates the database.
This interaction enables you to develop a program of batch control instructions that pull
H specific data from the OSx database, manipulate the data (if required), and place the data
back in the database.
This interaction enables you to create report formats that pull data from the OSx database
I and create customized reports. You can also write data to the database with the #writetag
function.
This interaction enables you to create report formats that pull historical trend data from the
J
OSx database and create customized reports.
This interaction enables you to configure tags for a batch and store that configuration data in
the OSx database. Batch processing offers two additional tag types: batch and unit. You are
K not required to create batch tags because the system creates them automatically. Batches are
identified by a batch ID, not the batch tag name. You must, however, configure a unit tag for
each collection of I/O tags that you want to associate with a portion of the batch process.
This interaction causes data changes in the OSx database to be reflected in the corresponding
L
historical trends.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-7
1.2 Prerequisites
Ensure the following prerequisites are true before you configure OSx to
monitor and/or control a batch.
1-8 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Sequence of Tasks Figure 1-4 lists the recommended order for setting up OSx to run a batch
process. After you set up OSx, you can adapt the order to the needs of the
process.
Configure Batch
State OSx Configure OSx for a batch.
Recipe
Repeat
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-9
1.3 Working with Screen Elements
Using Navigational Use the navigational tools to display menus and lists, choose options, and
Tools to Enter Data enter data into the system.
Some buttons have no text or the text is adjacent to the button. Clicking on
the button causes no action when the button is inactive.
Radio Buttons These are specially linked buttons. When a second button
in the group is selected, the first automatically turns off. As a safeguard,
you are always required to confirm your selection, by clicking on an OK
button.
Toggle Buttons These buttons are not linked. Each one must be clicked
off and on independently; changing the status of one has no effect on the
other.
Text Browsers These tools allow you to see information not visible in a
window. Place the cursor on the bar and slide the bar back and forth while
holding down the left mouse button. You can also click on the pointers at
each end of the bar groove to display single lines or columns.
1-10 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Cascaded Menus When menus appear, you choose a given item by
clicking on it. Some menu items have cascaded menus that appear when
you slide the cursor to follow the triangle indicator. When you cannot select
an item because of the current operation or display, the text of the item is
gray.
The following five pushbuttons appear in most of the dialog windows used
in OSx. Their action does not change from window to window.
OK Saves information that you have entered and closes the window.
Save Saves information that you have entered and does not close the
window.
Cancel Closes the window without saving any information that you
entered and terminates any action that you initiated.
Dismiss Closes the window without undoing any changes that you have
entered. If you press Dismiss before you press Enter, the changes that you
make are discarded.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Overview of Batch Processing 1-11
1-12 Overview of Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Chapter 2
Configuring OSx for Batch Processing
2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Does OSx Configuration Change? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Sequence of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.2 Configuring Security Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Configuring OSx for Batch Processing 2-1
2.1 Overview
Does OSx The configuration of your system remains essentially unchanged in batch
Configuration processing. You still configure forms, symbols, graphics, and animation
Change? tables in the same way as is described in the SIMATIC PCS 7 OSx Process
Configuration Manual. However, additional features for configuring OSx to
run in a batch environment are described in this document.
Prerequisites Before you try to configure batch processing, ensure that the following
prerequisites and those listed in Section 1.2 are true.
You know the batch security privileges required for your operator.
You know the printer and file destinations that you want to define for
the batch log.
You know which tags and units you want to define and which tags you
want to link to a unit.
2-2 Configuring OSx for Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Sequence of Tasks Figure 2-1 lists the recommended order for performing the topics covered in
this chapter.
Log
Configure batch log destinations.
Unit 1 Unit 2
Establish unit/child tag linkages.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Configuring OSx for Batch Processing 2-3
2.2 Configuring Security Privileges
All batch and unit operations require the security privilege of either
Primary Control or Batch Control. For example, the batch Hold command
requires the Batch Control security privilege; the unit Jog command
requires the Primary Control security privilege.
A list of all batch and unit operations and their required security privileges
can be found in Appendix E.
Instructions for configuring security privileges for user IDs can be found in
the SIMATIC PCS 7 OSx Process Configuration Manual.
2-4 Configuring OSx for Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
2.3 Configuring the Batch Log Destination
Overview The batch log contains all messages pertaining to batches. Batch log
messages can appear in other logs as well. For example, an operator change
log message appears in both the Operator Change Log and the Batch Log if
the message also has a batch identification (batch ID).
Printer Refer to the SIMATIC PCS 7 OSx System Administration Manual for
Configuration information on how to configure printers.
Batch Identification Batch identification allows you to enter data to start a new batch and allows
you to modify data items associated with an existing batch. The default
batch log destination is configured using the Log Destination utility,
described in the SIMATIC PCS 7 OSx System Administration Manual. This
is the default destination for all batch log messages. To modify the default
destination for a particular batch, use the Batch Identification utility
(Section 7.2, Configuring a Batch).
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Configuring OSx for Batch Processing 2-5
2.4 Configuring Unit Tags and Establishing Links to Other Tags
Unit tags are configured in the same way that all other tag types are
configured. Figure 2-2 shows an example of a unit tag configuration.
Record Control Tag Type Tag Description Process Manual Parent Attribute Memory Locations Upload Twenty % Autolog Init
Node Group Set Value
T PC1 UNIT UNIT1 Bake_Unit_2 0xffffffff
A STATUS V100 1 N N N
A COMMAND V101 1 N N N
A MODE_CMD V102 1 N N N
A BCH_REQ V103 1 N N N
BCH_REQ_ 8
A V104 N N N
INFO
BCH_REQ_
A V112 1 N N N
RESP
E
Defining Units and In preparing to define a unit to the OSx system, follow these guidelines.
Their Links
Look over the P&ID for the batch process and determine whether some
of the process equipment can be logically grouped together into
functional units. Avoid making a unit a single device, such as a pump.
After you determine which units you want to define, create a unit tag
using the procedures described in the SIMATIC PCS 7 OSx Process
Configuration Manual. Before you can assign tags to a unit, you must
first create a unit tag.
NOTE: Do not delete a tag from the system if it is currently used in a BCL
program. Remove the tag from the program first, and then recompile and
reinstall the program. Then delete the tag from the system.
2-6 Configuring OSx for Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
After you create one or more unit tags, you are ready to assign the process
I/O tags to the unit tags.
Select a tag type other than the unit or batch tag types and enter the
appropriate unit tag name in the Parent field. As with the
configuration of any tag type, you do this in APT, a spreadsheet, or the
ASCII text file containing your tag data.
When you link a regular tag to a unit tag, OSx adds the process groups
of the unit tag to its child tag. Similarly, if the linkage is removed by
blanking out the name of the unit tag in the Parent field for a tag, then
the process groups of the unit tag are deleted from the child tag’s
process groups. Refer to the SIMATIC PCS 7 OSx Process
Configuration Manual for more information on process groups.
You can translate APT unit extensions to OSx by marking the unit in the
APT Program Content Directory. Table 2-1 lists the unit tag type and its
corresponding APT extensions. Refer to the SIMATIC APT User Manual for
information about how to mark tags for OSx.
Configuring Tag To reconfigure tag capacities, refer to the SIMATIC PCS 7 OSx Process
Capacities Configuration Manual.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Configuring OSx for Batch Processing 2-7
2-8 Configuring OSx for Batch Processing SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Chapter 3
Controlling Batch Operation Using BCL
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
What Is the Batch Control Language? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Components of a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.2 Planning a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
3.3 Creating a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Steps to Create a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Referencing Tag Names in BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
3.4 Using Keywords to Write a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.5 Using #include Statements in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Translating BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
3.6 Using Variable Definitions in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Variable Definition Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
3.7 Using Unit Mapping in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Unit Mapping Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Parameter Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.8 Using Event Blocks in a BCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Event Block Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Event Block Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Special Event Block Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
Database Event Trigger Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Referencing Controller-Resident Data in WHERE Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Event Block trigger_spec Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Event Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24
Retrieve Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
Replace Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
Delete Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
Event Block Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30
BCL Program Bit Conversion Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31
Invalid Bit Type Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31
3.9 Controlling Batch Operation with Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-32
3.11 Creating BCL Code to Handle Error Conditions in Event Blocks . . . . . . . . . . . . . . . . . . . . 3-35
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-1
3.1 Overview
What Is the Batch The Batch Control Language (BCL) consists of several programming tools
Control Language? that allow you to supervise and, to a lesser degree, control the operation of a
batch. These C-language-based tools enable you to write the OSx station
portion of a batch control program. Program the control node to assume the
major role in controlling the batch; allow the OSx station to oversee the
process.
Define events and the corresponding processing that takes place when
the events occur. Events consist of bit set/reset, simple changes, system
state changes, or BCL program startup/shutdown.
OSx uses a batch manager process to control the execution of the BCL
programs. When OSx transitions from the Offline state to the Operate state,
the batch manager starts any BCL programs that are installed. The
procedures for installing BCL programs are outlined in Section 4.4.
! WARNING
The standard OSx database tables contain configuration and operating
information maintained by the SIMATIC PCS 7 system processes and are
identified by the presence of the Database Admin privilege flag.
Attempting to delete records from the standard OSx database tables using a
BCL program, or attempting to replace attributes in any tables other than those
keyed by tag name, can cause unpredictable operation by the controller which
could cause death or serious injury and/or damage to equipment.
Do not attempt to delete records from standard OSx database tables or replace
attributes in any tables other than those keyed by tag name. This warning
applies to the standard OSx database tables. You can define custom tables and
add them to the database in such a way that BCL programs can freely append
records to them and delete records from them. See Appendix F for details.
3-2 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Components of a A typical BCL program consists of two major types of statements: definition
BCL Program statements and action statements. Figure 3-1 illustrates and describes the
components that comprise these two types of statements. A BCL program
does not require all the components in Figure 3-1 to operate correctly, but if
the program contains one or more of the components, they must appear in
the order shown in the diagram.
Program components
Unit maps
Unit maps enable the BCL program to
establish unit element names that are used Event blocks
to pass process information from one unit to
another.
* The program
components
must appear in
Event blocks enable the BCL program to the order shown
perform activities when specific events here.
Action statements
occur. Any bit transition or value change can
trigger an event.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-3
3.2 Planning a BCL Program
Prerequisites Ensure the following prerequisites are true before you begin to develop your
own BCL programs.
You must be familiar with accessing and reading the OSx database.
You must be thoroughly familiar with your batch process and its units.
You must identify all of the tags, including unit tags, that will be
referenced by the BCL program. Before you can execute the program,
you must also configure these same tags in the database.
3-4 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Sequence of Tasks Figure 3-2 lists the recommended order of tasks for developing and
installing BCL programs.
01001110
01110010 Translate and compile the program.
00001011
11000001 Correct any errors that might occur.
01010000
01001110
01110010 Validate the program. Correct any
00001011
11000001
✓ errors that might occur.
01010000
01001110
01110010 Translate, compile, and install the BCL
00001011 program.
11000001
01010000
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-5
Planning a BCL Program (continued)
BCL Handling of If your BCL program writes networked tag:attributes to a given control
Network Writes node, keep these points in mind when you design the BCL program.
If the control node is in communication with OSx (that is, its tag:status
is active), and subsequently loses communication (for instance, due to a
network problem), any write of the tag:attributes returns an error
while the control node is off the network. Furthermore, this error is not
reported if the Ignore Network Response runtime option has been
selected for the BCL program through the BCL Program
Administration utility.
If the control node never comes on the network (that is, its tag:status
always remains inactive), all writes of the tag:attributes occur only on
the memory values held in the OSx database. The writes do not go to
the network, and no error is returned.
If necessary, you can code your BCL program to take into account the
active/inactive status of the control node (that is, to assess the
DATA_NODE:STATUS settings for the control node tag). There are two
ways to do this.
You can retrieve the status of the control node and check it before
writing the tag: attribute value to the control node.
You can write an event block that is triggered when the appropriate
DATA_NODE:STATUS bit changes, and set a global variable to be
checked prior to each write.
In either case, you can design your code so that the write is only performed
when the control node is in an active state, and in all other cases, an error is
generated.
3-6 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Considerations for Keep these points in mind when you write a BCL program for a system with
Multiple-Station more than one supervisory station.
Systems
BCL programs execute simultaneously on all supervisory stations.
Therefore, station role changes do not adversely affect automated batch
processing for a system with more than one supervisory station if you
follow the rules below.
Consider these effects of a role change when you design BCL event blocks.
You may observe some delay in the execution of a BCL program in the
Operate state when another OSx station is synchronizing. To see if this is
the cause of the delay, check Network Status, which shows when stations
are synchronizing. After synchronization has finished, program execution
will be complete shortly thereafter.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-7
Planning a BCL Program (continued)
If BCL programs use tag values other than the status attribute to trigger
events, and the value in the controller changes faster than the event scan
period, then it is possible that different OSx stations in the system will get
different values for the same tag. In addition, if such a tag value has a
deadband, it is very likely that a BCL program running on one station will
not get the same events as the same BCL program that is running on
another station. If this happens, then a role change could lead to unexpected
behavior by the BCL program.
! WARNING
If a BCL program uses tag values other than status to trigger events, it is
possible that different OSx stations in the system will get different values for
the same tag.
This can cause a BCL program running on one station not to get the same
events as the same BCL program that is running on another station. In this
situation, a role change could lead to unexpected behavior by the BCL program,
which could cause serious injury or death to personnel and/or damage to
equipment.
To avoid this situation, use a tag’s status attribute as the event trigger. When
the status attribute changes, the change will be seen on all OSx stations.
If you choose not to use the tag’s status attribute as the event trigger, then
these precautions can help minimize the possibility of a BCL program
running on one station not getting the same events as the same BCL
program that is running on another station.
Set the event scan period to be less than the change rate for all tag
values used for events.
Set the deadband for all tag values used for events to the lowest
possible value.
3-8 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
3.3 Creating a BCL Program
cd /usr/tistar/hist/batch/source
NOTE: The file system /usr/tistar/hist has more available disk space than
others. Storing BCL program files in smaller file systems may cause
interference with other OSx functions.
4. Use any text editor, such as vi or SCOedit, to create your BCL program
source file.
For a BCL source program, the filename must have the suffix .bcl, and
the non-suffix portion of the filename must be no more than ten
characters. For example, the filename packaging1.bcl consists of a
ten-character filename and the .bcl suffix.
NOTE: When you create a BCL program, make sure that you do not include
any infinite loops in your code.
Referencing Tags used in BCL programs must have standard valid tag names as
Tag Names in described in the SIMATIC PCS 7 OSx Process Configuration Manual.
BCL Programs
NOTE: Do not delete a tag from the system if it is currently used in a BCL
program. Remove the tag from the program first, and then recompile and
reinstall the program. Then delete the tag from the system.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-9
3.4 Using Keywords to Write a BCL Program
Reserved The Batch Control Language consists of several reserved keywords that
Keywords define the operation of BCL programs. Avoid using these keywords as
names for variables, structure members, and program statement labels. You
can embed keywords in comments because the BCL translator ignores all
comments.
The keywords listed in Table 3-1 are reserved for BCL statements that are
outside event blocks. Refer to Section 3.8 for information about event blocks.
3-10 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
The keywords listed in Table 3-2 are reserved for BCL statements that are
inside event blocks.
NOTE: Due to constraints within the BCL translator, if any of the keywords
listed in Table 3-2 appear within quoted strings in event blocks, the BCL
program generates a syntax error.
Before you start creating code for a BCL program, read the guidelines,
examples, and suggestions described in Section 3.5 through Section 3.11.
When you finish creating a BCL program, save the program, exit the editor,
and refer to Chapter 4 for instructions about compiling and installing the
program.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-11
3.5 Using #include Statements in a BCL Program
Translating BCL When you compile a BCL program (Section 4.2), OSx automatically inserts
Programs the following #include statements into the translated file.
#include <pcsstdinc.h>
#include <pcsinc.h>
#include <db_types.h>
#include <bclpgm.h>
#include <bc_fdecl.h>
#include <bc_lfdecl.h>
#include <vb.h>
.
.
.
3-12 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
3.6 Using Variable Definitions in a BCL Program
This section describes the BCL statement that enables you to define a block
of variables and group them under a single name. Variable definitions
enable you to define a set of global variables that can be used to store
intermediate values during batch processing. These variables are available
to all event blocks within the BCL program in which they are defined. They
are visible only within the program in which they are defined and cannot be
accessed by other BCL programs.
When a BCL program defines the variables, it does not initialize them.
Therefore, you must initialize the variables in the event block section of the
BCL program (see Section 3.8).
The variable data types can be any of the standard C-language types, any of
the types defined in the OSx header file pcstyp.h, or any of the types that
you define in custom header files.
Parameter var_block_name
Description Name corresponding to a block of variable definitions. Event blocks can use
this name to access any of the associated variables.
FOR ALL
These are required keywords which terminate the opening definition line.
Example The following example defines a block of variables. The variable block name
cook_var1 enables an event block that appears later in the BCL program to
access all of the variables between the braces.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-13
3.7 Using Unit Mapping in a BCL Program
This section describes the BCL statements that enable you to map elements
within a unit.
Unit maps enable you to generate meaningful element names for specific
tag attribute instances within a unit. OSx uses these element names to pass
information from one unit to another during the operation of a batch. For
example, you can assign the unit element name MIX_TEMPERATURE to
the tag attribute instance tmp101:pv. OSx then uses the element
MIX_TEMPERATURE to pass temperature data from one unit to another
unit containing the same element name. The BCL program typically uses
the bc_copy( ) function (described in Appendix C) to move element data from
unit to unit.
Parameter unit_name
Descriptions Name of the unit for which the element mapping applies.
tag:attr
Tag attribute instance that is associated with a specific element name. OSx
passes the value of this instance to the next unit that contains the same
element name.
element_name
Name of the element for which a tag attribute instance is associated. The
element name enables OSx to pass data associated with the name to other
units. For each unit, the element name is usually associated with a different
tag attribute instance.
3-14 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example defines an element mapping for the units mix_tank_1
and mix_tank_2. After the map is defined, the values associated with unit
elements MIX_WEIGHT, MIX_TEMP, and MIX_PH can be passed from unit to
unit if the subsequent unit contains the same elements.
ON EVENT mix_tank_1:status:OOS
{
bc_copy (“mix_tank_1”, “mix_tank_2”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-15
3.8 Using Event Blocks in a BCL Program
Event Block This section describes the BCL statements that enable you to create event
Definition blocks. Event blocks enable a BCL program to perform data manipulation
activities when a specific event occurs. Each event block consists of an event
trigger and one or more lines of database operations and/or C-language
code.
The event trigger defines the type of change in a tag attribute instance that
executes the activities listed within the event block. Events can be triggered
by a change in the system or program state, a change in an analog value, a
bit transition from one to zero, or a bit transition from zero to one.
When you have multiple event blocks within a BCL program, be aware of
how the event blocks interact. All event blocks within the same program
operate synchronously. This means that each event block, once triggered,
runs to completion before the program looks for another trigger event and
runs another block. An event block that takes a long time to execute will
delay the triggering of other event blocks in the same program. If event
blocks do not access the same OSx database tables, or write to the same tag
locations, you can place the event blocks in separate programs to avoid the
delay.
When you run multiple BCL programs at the same time, event blocks that
are located in different programs operate asynchronously and may interact
unpredictably if they access the same OSx database tables or write to the
same tag locations. To avoid these interactions, place event blocks that
access the same tables or control points in the same BCL program.
When the batch triggers an event, OSx executes the database or C-language
statements in the event block. Database operations enable the program to
access the controller data via the database. C-language code enables the
program to perform math and data manipulation functions. Database
operations and C-language code cannot be mixed within the same statement
but can exist in separate statements within an event block.
3-16 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
In the event block code, a variable reference refers to a C-language variable.
These variable references must translate to an address. Failure to properly
encode and/or initialize a variable reference can cause the BCL program to
dump core or operate on invalid data. In addition, the data type of the
variable must match the corresponding database type. Failure to match
data types can result in overwrites, memory faults, and/or corrupt data.
Parentheses around the variable references are optional, but use them for
clarity.
Within the event block code, you can determine which trigger activated the
block by reading the global variables BCL_block_event_id and
BCL_special_event_id, which are declared in one of the default header files.
The BCL_block_event_id variable consists of a zero-based index that
indicates which event of the ON EVENT trigger specifications triggered the
event block. A value of zero indicates the first trigger_spec.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-17
Using Event Blocks in a BCL Program (continued)
The bm_user.h header file defines the special event identifiers. This file is
not one of the default header files; therefore, if you intend to use the special
event labels, you must explicitly specify bm_user.h with a #include
statement.
Only one of the two global event variables can be set when an event triggers
the action block. When one variable is set by an event, the other is assigned
the value --1. You can mix database and special event triggers within the
same ON EVENT instruction. OSx indexes database event triggers
independently of special event entries. When OSx counts the index numbers
for database events, it does not include special event entries in the count
because these events are indicated by the special event identifiers.
3-18 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Database Event When a database event triggers an action block, the data value causing the
Trigger Values event is made available to the BCL program by means of the following
global variable:
Referencing Queries that reference controller-resident data as part of the key for
Controller-Resident selecting tuples from the database usually take longer than queries where
Data in WHERE all components of the key are resident in the OSx station. The extra time is
Clauses required to allow updates from the controller to refresh the referenced data.
The increase in access time is proportional to the number of
controller-resident items in the WHERE clause and to the number of tuples
that must be examined to satisfy the query. A single controller-resident
datum (that is, a single attribute in a single tuple) may require up to 0.25
seconds for the refresh update.
Note that controller-resident data that is configured for RBE or armed for
event notification does not require extra time since those data are
maintained fresh by the controller communications subsystem.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-19
Using Event Blocks in a BCL Program (continued)
Event Block The following trigger_spec options are available for the ON EVENT statement:
trigger_spec
Options STARTUP
OFLN_TO_STBY
Executes an event block when OSx transitions from the Offline state to
the Standby state.
STBY_TO_OPER
Executes an event block when OSx transitions from the Standby state
to the Operate state.
NOTE: When the OSx system state transitions directly from Offline to
Operate, BCL programs might miss the OFLN_TO_STBY and STBY_TO_OPER
transition messages. System loading causes some delay in the startup of
BCL programs; therefore, the programs might not be fully operational in
time to receive these messages. However, BCL programs usually receive the
OPER_TO_STBY and STBY_TO_OFLN messages. Although the Standby state
is not user selectable, the system still uses this state internally.
OPER_TO_STBY
Executes an event block when OSx transitions from the Operate state
to the Standby state.
STBY_TO_OFLN
Executes an event block when OSx transitions from the Standby state
to the Offline state.
SHUTDOWN
3-20 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
tag:attr CHANGES
Executes an event block when the value of the specified tag attribute
instance changes (for example: from 100 to 113).
tag:attr:bit
Executes an event block when the specified bit in the tag attribute
instance transitions from zero to one. Define the bit name in the
BIT_DEFS table in the database. Unless the bit name is a standard
name, you are responsible for defining it. You can use a numeric
constant to specify a bit position; decimal and hexadecimal (0X0001)
formats are acceptable. Avoid a bit pattern of all zeros (0x0000), as this
pattern does not allow an event to be detected. You must set one, and
only one, bit in the pattern in order for events to occur. If a bit name
contains spaces, you must place double quotes around it (‘‘HH ALM”).
tag:attr:bit RESET
Executes an event block when the specified bit in the tag attribute
instance transitions from one to zero. Define the bit name in the
BIT_DEFS table in the database. Unless the bit name is a standard
name, you are responsible for defining it. You can use a numeric
constant to specify a bit position; decimal and hexadecimal (0X0001)
formats are acceptable. Avoid a bit pattern of all zeros (0x0000), as this
pattern does not allow an event to be detected. You must set one, and
only one, bit in the pattern in order for events to occur. If a bit name
contains spaces, you must place double quotes around it (‘‘HH ALM”).
table:attr WHERE
(
table:attr1 = (var_spec1) AND
table:attr2 = (var_spec2) AND
...
table:attrN = (var_specN)
) CHANGES
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-21
Using Event Blocks in a BCL Program (continued)
Event Block The following trigger_spec options are available for the ON EVENT statement:
trigger_spec
Options table:attr:bit WHERE (table:attr1 = (var_spec1))
(continued)
Executes an event block when the specified table-attribute bit
transitions from zero to one where table:attr1 = var_spec1. Define the bit
name in the BIT_DEFS table in the database. Unless the bit name is a
standard name, you are responsible for defining it. You can use a
numeric constant to specify a bit position; decimal and hexadecimal
(0X0001) formats are acceptable. Avoid a bit pattern of all zeros
(0x0000), as this pattern does not allow an event to be detected. You
must set one, and only one, bit in the pattern in order for events to
occur. If a bit name contains spaces, you must place double quotes
around it (‘‘HH ALM”).
table:attr:bit WHERE
(
table:attr1 = (var_spec1) AND
table:attr2 = (var_spec2) AND
...
table:attrN = (var_specN)
)
3-22 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
table:attr:bit WHERE
(
table:attr1 = (var_spec1) AND
table:attr = (var_spec2) AND
...
table:attrN = (var_specN)
) RESET
USER_MSG
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-23
Using Event Blocks in a BCL Program (continued)
Event Block The following instructions are available for the event block controlled by the
Instructions ON EVENT statement:
c_instructions;
If the specified instance does not exist when INIT_VAR is invoked, the
program allocates a new instance and initializes a pointer named
var_type to point to the new instance. If the specified instance is already
allocated, the program sets the pointer var_type to the existing instance.
After it is initialized, var_type functions the same as a C-language
POINTER TO STRUCT. The variables defined within the block are
accessible as structure members.
REMOVE_VARS block_id;
3-24 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
LATCH tag:attribute:bit_name_or_pattern;
OFF tag:attribute:bit_name_or_pattern;
Retrieves data from the source_location and places a copy of the data in
the target_location. The following combinations of source_location and
target_location items are acceptable:
tag:attribute <--tag:attribute
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-25
Using Event Blocks in a BCL Program (continued)
Event Block The following instructions are available for the event block controlled by the
Instructions ON EVENT statement:
(continued)
WHERE_clause;
Enables the BCL program to use a key other than a tag name to
address a database record. BCL supports WHERE clauses in retrieve,
replace, and delete operations.
The following syntax examples for the retrieve, replace, and delete
operations represent suggested layouts for WHERE clauses. Because
BCL statements are free format, you can, however, insert new lines and
extra spaces at your discretion. Be sure to insert a space on both sides
of the = sign in a WHERE clause.
3-26 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Retrieve Operation For a retrieve operation with a WHERE clause that specifies a single
component key, use the following format:
The following only applies for an attribute that has an address in the
controller. When true, the global variable db_communicate indicates that the
system reads a value from the network. When false, the system reads the
value from the database. For BCL, the default is to read from the network.
You can set/unset this global variable anywhere in a BCL program.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-27
Using Event Blocks in a BCL Program (continued)
Replace Operation For a replace operation with a WHERE clause that specifies a single
component key, use the following format:
To replace multiple attributes in a single tuple with one operation, use the
following format:
The WHERE clause may contain one or more terms as presented in preceding
sections.
3-28 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Delete Operation The delete operation removes a single tuple from a database table according
to the key or keys that you specify.
! WARNING
The standard OSx database tables contain configuration and operating
information maintained by the SIMATIC PCS 7 OSx system processes and are
identified by the presence of the Database Admin privilege flag. Attempting to
delete records from the standard OSx database tables using a BCL program, or
attempting to replace attributes in any tables other than those keyed by tag
name, can cause unpredictable operation by the controller.
Unpredictable controller operation can cause death or serious injury to
personnel and/or damage to equipment.
Do not attempt to delete records from standard OSx database tables or replace
attributes in any tables other than those keyed by tag name. This warning
applies to the standard OSx database tables. You can define custom tables and
add them to the database in such a way that BCL programs can freely append
records to them and delete records from them. See Appendix F for further
details.
Error reporting for delete operations is the same as it is for other BCL
database operations except when a statement tries to delete a record that
does not exist. Unless you specifically request that errors of this type be
reported, BCL normally does not report them. For information about
reporting errors when you try to delete a non-existent record, refer to
Section 3.10.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-29
Using Event Blocks in a BCL Program (continued)
Event Block The following example defines an event block that executes when the
Example addition bit in rm2mt1:status transitions from zero to one. Refer to Appendix G
for a more detailed example. The event block then performs the following
activities in the order shown:
2. Retrieves the batch ID for the tag rm2mt1 and initializes an instance of
the variable block cook_var1 using the batch_id as the block identifier.
4. Retrieves data from the rm2mt1:value instance and places the data into
addition.
5. Adds the value currently in the variable v1 (in variable block cook_var1)
to the value in the variable addition and places the resulting value back
in v1.
6. Replaces the data in the tag attribute rm2mt1total:value with the data
from v1.
ON EVENT rm2mt1:status:addition
{
char batch_id [BATCH_ID_LENGTH];
float addition;
For clarity, the example listed above does not contain error handling code.
Refer to Section 3.11 for information about detecting and handling errors
within event blocks.
3-30 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
BCL Program Bit BCL runtime routines must convert the contents of the bit position field in a
Conversion Error BCL database reference statement into a bit position value. When a BCL
statement references an invalid bit name the following occurs.
Invalid Bit Type The BCL database reference statements with bit position fields include:
Examples trigger specifications, LATCH and OFF statements, and retrieve statements
that return a boolean value. Examples of each follow where the bit position
field is the third colon-separated field (such as 0x800). If the contents of this
field cannot be converted to a bit position value, Error 7949 occurs.
! WARNING
Termination of a BCL program caused by using an invalid bit name can result in
the BCL program’s failure to execute instructions that control a controller.
If the BCL program controls equipment, the program termination could cause
death or serious injury to personnel, and/or damage to equipment.
Ensure that correct bit position string names are recorded in the BIT_DEFS
table, and that no illegal characters exist in the decimal or hexadecimal
constants that the standard string-to-number conversion routines use in the
C library. Make sure the BCL runtime routines can convert the contents of the
bit position field in a BCL database reference statement into a bit position
value.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-31
3.9 Controlling Batch Operation with Library Functions
OSx contains several library functions that allow you to control and/or
supervise the operation of a batch more easily. The batch control functions,
which can be called from event blocks, enable a BCL program to perform
high-level functions when a trigger event occurs.
You can use the usrbcl utility to add your own object files to the BCL user
library archive libUBCL.a. This library is scanned when you compile and link
the BCL programs. The syntax for the command line is
usrbcl object_file.o [object_file.o], where the object_file.o
parameter specifies the name of an object file generated by the C compiler.
Table 3-3 lists the library functions that pertain specifically to batch
processing. For complete descriptions of these functions, see Appendix C.
3-32 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table 3-3 Batch Control Functions (continued)
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-33
3.10 Controlling the Operation of BCL Programs
BCL Program In addition to the batch control functions described in Table 3-3, BCL offers
Control Functions several built-in functions that enable you to control the operation of BCL
programs. While the batch control functions work within event blocks to
manipulate batch-related data, the BCL program control functions
determine how the programs execute. The BCL program control functions
described in Table 3-4 are currently available.
3-34 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
3.11 Creating BCL Code to Handle Error Conditions in Event Blocks
BCL Error Handling OSx provides a built-in method for detecting error conditions. Your BCL
Code program must read the result and use it to respond to the error condition.
Always encode some means for handling the errors that might occur within
BCL event blocks.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Controlling Batch Operation Using BCL 3-35
Creating BCL Code to Handle Error Conditions in Event Blocks (continued)
Return ERROR when the program exits from the error-producing event
block. This option generates another error message but does not
terminate the execution of the BCL program. This option simply
records the occurrence of an error; it does not perform any other action.
Generate a custom error message. You can use the standard macro
XMT_ERR within event blocks to generate a message to the system
error log. You can also use the error message to trigger an alarm if you
configure the message for alarming in the ERR_MSGS table. Refer to
header file pcsmacro.h for the syntax of the XMT_ERR macro.
Create your own custom error handling within event blocks. You can
include code that executes application-specific operations that are
appropriate for the process.
ON EVENT oven1:status:run
{
SINT16 tmp;
}
return (NO_ERROR);
}
3-36 Controlling Batch Operation Using BCL SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Chapter 4
BCL Administration
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Managing BCL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
BCL and Station Role Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Primary Role Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4.2 Compiling a Program Interactively . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Managing BCL After you write a BCL program, you can manage it interactively from the
Programs BCL Program Administration dialog box. You can also administer BCL
programs from the operating system command line. Use the command line
method when you want to manage multiple programs as a group, using a
shell script. You can do many of the same tasks that are supported by the
BCL Program Administration dialog box. These tasks are listed below.
You can display the BCL Program Administration dialog box and/or run the
the operating system commands on one or more supervisory stations
simultaneously, but you cannot administer a particular program from more
than one station at a time.
If you select a BCL program from the BCL Program Administration dialog
box after another user has already selected the same program on another
station, the system does not allow you to modify any program information.
The program remains selected and you can view any of the Compile- or
Modify-related information for the program. When the user on the other
station finishes with the program, you still cannot modify the program until
you deselect the program and then reselect it.
To display the BCL Program Administration dialog box, select the BCL
Program Administration option under Data on the menu bar. The BCL
Program Administration dialog box appears (Figure 4-1). The system
displays all BCL programs that you have created. All programs that you
store in the /usr/tistar/hist/batch/source directory, or in directories under this
directory, appear in the dialog box.
Make sure all programs have both read and write permissions.
Action Request
Alarm Group
Alarm Tag
Batch Identification
BCL Program Administration
Process Group
RDT Program Administration
Recipe
Recipe Area & Component
Report
Tag Group
Trend
Window Group
BCL and Station If a BCL Program Administration dialog box remains on the screen during
Role Changes multiple role changes involving the primary, and you reselect the original
primary to become the new primary, the system can fail to mount the
primary’s history file system. The system indicates this by displaying the
message Node can’t switch to primary. At this point, access to trend and report
outputs is no longer supported on the station displaying the BCL Program
Administration dialog box.
You can prevent this situation by exiting the BCL Program Administration
dialog box before you select the original primary as the new primary. If the
situation does occur, exit the BCL Program Administration dialog box, and
resynchronize the station.
Primary Role Do not use BCL Program Administration during a role change to a new
Change primary. Normally, the OSx system prevents you from doing this; however,
under heavily loaded conditions, you may be able to start BCL Program
Administration before the system has propagated the start of the role
change to all stations.
After you write a BCL program, you must compile the program before
installing it. When the program is successfully compiled, the system copies
the executable file to all supervisory stations. The path for the file is
/usr/tistar/hist/batch/work/<pgm> .exe, where <pgm> is the BCL program name
without the .bcl extension. When the compile is unsuccessful, the system
displays the file containing the compiler errors and the “Compiled On”
column shown in Figure 4-2 displays a string of asterisks (*****). It is
possible to recompile a BCL program while it is running.
If you compile the same BCL program later from the command line, the
system deletes the debug subdirectory and files unless you use the -C
compilation option. The original BCL source files, which are located in the
/usr/tistar/hist/batch/source subdirectory, are not affected. Refer to Section 4.9
for additional information.
You can rebuild the BCL program by accessing the BCL Program
Administration dialog box and recompiling with the Debug option.
Options Table 4-2 on page 4-20 lists the options that you can enter in this
field. The most common options can also be changed from the Modify BCL
Program Information dialog box (Section 4.3), which is the recommended
method for changing these options.
BCL programs are not compatible with all compiler options and can fail to
compile successfully if you specify an incompatible option. Do not use the
--ansi and --compat compiler options when compiling BCL programs. Use the
man cc command for online help about the compiler.
After you compile a BCL program, you can add or change its description and
specify various runtime options. To modify a BCL program, click on the
program name, and select the Modify button on the BCL Program
Administration dialog box. The system displays the Modify BCL Program
Information dialog box (Figure 4-3). Enter an appropriate description and
select one or more options from Table 4-1.
Because some of the options in Table 4-1 place their output files in the
/usr/tistar/hist/batch/output directory, the /usr/tistar/hist file system may
become full. To reduce the possibility of running out of disk space, either
delete or move the files when you are finished with them. The output
directory must exist on all superviory stations prior to the execution of the
BCL program or the system does not write the output. The BCL program
does not create the directory.
If you have already installed a program, you can still use the Modify feature
to change the description or program options. If the program is running
when you modify it, you must halt the program and restart it for your
changes to take effect.
Command
Option Description
Line Syntax
Inhibits the BCL program from automatically appending a new tuple
to the database when a replace operation fails. If a BCL replace
Inhibit operation fails because the target tuple does not exist, the BCL
Automatic --a program normally appends a new tuple and places the data in the new
Append location. The --a option disables this feature, prevents the creation of a
new tuple, and generates an error message if the replace operation
fails.
Ignores network responses to database replace operations that alter
controller-resident data. Normally, the DBMS routines that execute
the replace operation wait for a response from the network before they
return to the calling program. This procedure ensures the integrity of
Run Ignore the transaction but reduces the rate at which the program updates the
Time Network --r database. The --r option causes the DBMS routines to return to the
Options Response calling program immediately after they issue a request to network.
With this option active, the calling program is not informed if errors
occur when the network attempts to handle the request; therefore, use
the --r option only when the failure to write data to controller memory
can be ignored.
Reports errors when the BCL program attempts to delete a
non-existent record from the database. Normally, a BCL program does
Report
not report this type of error. If, however, you need to know whether a
Delete --d
record that the program tries to delete is missing, the --d option
Errors
enables you to report the error so that the BCL program can detect the
error condition.
Enables user trace output. This option causes the BCL program to
write output from the print_trace_message( ) function to a file that is
associated with the BCL program. The output filename is bcltrN.out,
Enable
where N is the program ID of the installed program. Program ID must
Trace --t
be unique for all installed and/or executing BCL programs. IDs of
Output
installed programs are recorded in the BCL_PROGRAM_DIR database
table. The default directory for the trace output is
/usr/tistar/hist/batch/output.
Enables internal debug output. This option causes the BCL program to
generate a file containing information intended for debugging internal
Output functions. This option is for internal debugging, not for debugging user
Enable
Options --d applications: the print_trace_message( ) function and --t option are
Debug
Output intended for this purpose. Refrain from using this option unless
instructed to do so by a Siemens Energy & Automation, Inc., customer
support representative.
Places the trace and verbose output files in the directory specified by
the parameter output_dir. BCL normally places these output files in
Output /usr/tistar/hist/batch/output. The output directory must exist on all
--o output_dir
Directory superviory stations prior to the execution of the BCL program or the
system does not write the output. The BCL program does not create
the directory.
If you need to reinstall a program and it is already running, you must halt
the program first.
NOTE: The system does not display an entry in the Description field until
you use the Modify option (Section 4.3) to add the description for a program.
To halt a BCL program, click on the program name, and select the Halt
button on the BCL Program Administration dialog box (Figure 4-5). The
system prompts you to confirm your choice. After halting a program, the
system enables the Start button and the Halted column displays Yes. You can
select this button to restart the program; and the Halted column then
displays No.
If you halt a program, it does not start again until you restart it by selecting
the Start button. When OSx transitions from Offline to Operate, no program
that you halt manually resumes execution until you restart it manually.
BCL Program If a BCL program executes an infinite loop, it can never return to an idle
Cannot Be Halted state where it is looking for program events. A program in such a condition
cannot process a Halt command. If you select the Halt button in the BCL
Program Administration dialog box, the system displays Yes for halted, even
though you cannot actually halt the program.
If you suspect that a program is running when the system shows that it is
halted, you can kill it using operating system commands. Follow the steps
below.
3. Note the first number that appears on the line containing your
program executable (not the grep command), if it exists. This is the
process ID (pid) for the program. If it does not appear, your program is
already halted. If the process ID does appear, go to step 4.
Correct the code within the program that caused the runaway processing.
Use the Remove feature to de-install a BCL program. A program that has
been removed no longer begins executing automatically when the system
transitions to the Operate state. To remove a BCL program, click on the
program name, and select the Remove button on the BCL Program
Administration dialog box (Figure 4-6). The system prompts you to confirm
your choice and then removes your program.
If the program is running, you must halt the program before removing it.
Use the Delete feature to delete a compiled BCL program. The source code
for that program is unaffected by the Delete feature. Use the rm command
to delete the file containing the source code.
To delete a BCL program, click on the program name, and select the Delete
button on the BCL Program Administration dialog box (Figure 4-7). The
system prompts you to confirm your choice and then deletes your program.
If the program is running, you must halt the program before deleting it.
Use the Update List feature to update the list of BCL programs in the BCL
Program Administration dialog box. This feature causes the program to
rebuild its list to reflect changes to BCL programs made on other
supervisory stations. You know the list needs updating if you select a
program and the buttons are not enabled or disabled correctly for the list
entry. For example, the Remove button is enabled but the Installed On
column for the selected program is empty.
To update the list, select the Update List button on the BCL Program
Administration dialog box (Figure 4-8).
You can compile a BCL program from the operating system command line.
Use this method when you want to compile multiple programs as a group,
using a shell script. Do not recompile a program if it is running. Halt the
program before compiling it again. Follow these steps.
At the command line, use -c to compile without the Debug option, and
-C to compile with Debug.
4. Correct any problems that might arise and exit the OSx terminal
window. Errors are written to a file. The system displays the error file
name when the compile finishes.
BCL programs are not compatible with all compiler options and can fail to
compile successfully if you specify an incompatible option. Do not use the
--ansi and --compat compiler options when compiling BCL programs.
NOTE: For BCL compile time syntax errors from within action blocks, the
erroneous BCL statement is displayed. For BCL statements outside of
action blocks, the numeric Block ID that is closest to or contains the
erroneous BCL statement is displayed. The Block ID for the first action
block is 0, with the following blocks consecutively numbered.
If you compile the same BCL program later from the operating system
command line, the system deletes the debug subdirectory and files unless
you use the -C compilation option. The original BCL source files, which are
located in the /usr/tistar/hist/batch/source subdirectory, are not affected.
You can rebuild the BCL program by accessing the BCL Program
Administration dialog box and recompiling with the Debug option.
You can install a BCL program from the operating system command line.
If the program is running, you must halt the program before re-installing it.
Executing a You can execute a BCL program from the operating system command line.
Program from the Typically, you do this operation from the command line when you are testing
Operating System the program. Make sure that the system is offline first. It is not necessary to
install a program before executing it from the command line; however, you
must install it before you can execute it from the BCL Program
Administration dialog box.
! WARNING
Testing BCL programs online (including installing, starting, and halting) can
affect I/O devices or controller operation.
Unpredictable operation by the controller and I/O could cause death or serious
injury to personnel, and/or damage to equipment.
Test a BCL program offline prior to installing it on the target system to ensure
that the program does not adversely affect I/O devices or the operation of the
controller.
3. Enter cd /usr/tistar/hist/batch/work
The system changes the default directory.
The pgm corresponds to the program name. The .exe extension must be
present to execute the program.
The pgm_id parameter at the end of the command line is the program
ID, which can be any number greater than 32 and less than 32,767.
This parameter is required. Use unique program IDs if you run more
than one standalone (--x option) program or if any installed programs
are currently running. Otherwise, the trace and debug files may
overlap.
For example, to run the program called line_1 and check for errors, produce
trace and verbose (debug) output, enter the following: line_1.exe
-tvex 99
The --e option is the best method for validating the program’s database
references. This mode of execution does not change the database.
! WARNING
After it is activated, a BCL program that was started with the stand-alone mode
(-x option) does not communicate with the batch manager; therefore, the batch
manager cannot shut down the BCL program when the system transitions to
the Offline state.
When you execute a BCL program in the stand-alone mode, the program has
full access to the OSx database and can make unexpected changes to I/O
devices and controller outputs. Such changes can cause unpredictable
operation by the controller that could cause death or serious injury to
personnel, and/or damage to equipment.
Do not attempt to run a BCL program in stand-alone mode (-x option) when OSx
is connected to the controller or is in the Operate state. Ensure that the OSx
system is in the Offline state or is disconnected from the controller before you
run a BCL program in stand-alone mode.
If you run a BCL program in the stand-alone mode (-x option), you cannot
halt it with the usual commands. Moreover, the program does not stop when
the system transitions to the Offline state. Use the kill command to stop the
program.
BCL Program Table 4-2 lists the BCL program options that you can specify when you
Options execute a BCL program from the operating system command line. See step 4
on page 4-17 for the syntax. The options listed in Table 4-2 can also be
entered in the Options field of the Compile dialog box. The most common
options can be changed in the Modify BCL Program Information dialog box
(Section 4.3), which is the recommended method for changing these options.
Option Description
Inhibits the BCL program from automatically appending a new tuple to the database when a
replace operation fails. If a BCL replace operation fails because the target tuple does not
--a exist, the BCL program normally appends a new tuple and places the data in the new
location. The --a option disables this feature, prevents the creation of a new tuple, and
generates an error message if the replace operation fails.
Reports errors when the BCL program attempts to delete a non-existent record from the
database. Normally, a BCL program does not report this type of error. If, however, you need
--d
to know whether a record that the program tries to delete is missing, the --d option enables
you to report the error so that the BCL program can detect the error condition.
Checks the BCL program for errors. When it is executed with this option, the BCL program
starts and executes all initialization steps that resolve references to the OSx database. The
references include tag, table, attribute, and bit names. The option also checks for data type
--e compatibility between similarly-named unit elements and then exits without performing any
further processing. The program reports any problems on the standard output. No output
indicates that the program validated properly. Refer to Section 4.5 for information about
running a BCL program manually.
Places the trace and verbose output files in the directory specified by the parameter output_dir.
--o output_dir
BCL normally places these output files in /usr/tistar/hist/batch/output.
Accesses the database in the directory specified by the parameter db_path. This option is
--p db_path necessary only if the TQL_DB environment variable is not set. The standard OSx login
normally sets the TQL_DB variable; therefore, the --p option is seldom required.
Ignores network responses to database replace operations that alter controller-resident data.
Normally, the DBMS routines that execute the replace operation wait for a response from the
network before they return to the calling program. This procedure ensures the integrity of
the transaction but reduces the rate at which the program updates the database. The --r
--r
option causes the DBMS routines to return to the calling program immediately after they
issue a request to network. With this option active, the calling program is not informed if
errors occur when the network attempts to handle the request; therefore, use the --r option
only when the failure to write data to controller memory can be ignored.
Table continues on next page.
Option Description
Enables user trace output. This option causes the BCL program to write output from the
print_trace_message( ) function to a file that is associated with the BCL program. The output
filename is bcltrN.out, where N is the program ID of the installed program. Program ID must
be unique for all installed and/or executing BCL programs. IDs of installed programs are
recorded in the BCL_PROGRAM_DIR database table. The default directory for the trace
--t output is /usr/tistar/hist/batch/output.
When you run a BCL program from the operating system command line, state change event
notification is not available, since the BCL program is not communicating with the batch
manager program in this mode. Therefore, the trace output does not show events such as
OFLN_TO_STBY, STBY_TO_OPER, OPER_TO_STBY, and STBY_TO_OFLN. All other
event messages (including STARTUP and SHUTDOWN) are received by the program.
Enables internal debug output. This option causes the BCL program to generate a file
containing information intended for debugging internal functions. This option is for internal
--v debugging, not for debugging user applications: the print_trace_message( ) function and --t
option are intended for this purpose. Refrain from using this option unless instructed to do so
by a Siemens Energy & Automation, Inc., customer support representative.
Runs the BCL program in stand-alone mode. This option allows offline testing of your BCL
programs. However, if the BCL program contains networked tags, you cannot run it with the
--x option in the Offline state. To use the --x option in the Offline state, you can temporarily
substitute non-networked tags for the networked tags. When executed with the --x option, a
--x
BCL program arms all events and executes event block code in response to events, regardless
of the OSx system state. Code within the event blocks might alter the database; therefore,
avoid using this option if the BCL program can interfere with the data that affects a live
process.
Removing a You can remove a BCL program from the operating system command line.
Program from the Use the Remove feature to de-install a BCL program. A program that has
Operating System been removed no longer begins executing automatically when the system
transitions to the Operate state.
If the program is running, you must halt the program before removing it.
Deleting a Program You can delete a compiled BCL program from the operating system
from the Operating command line. The Delete feature deletes only a compiled program; the
System source code for that program is unaffected by the Delete feature. Use the rm
command to delete the file containing the source code.
If the program is running, you must halt the program before deleting it.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Operations and the Controller 5-1
5.1 Overview
The Controller A mechanism has been devised to permit the controller program to contain
Program and OSx the batch control, but still allow OSx to assist in batch tracking/reports. The
Batch Tracking mechanism is to use the following three attributes, available in the unit tag
relation:
How Does the The controller program can set these attributes as needed to perform the
Controller Program appropriate connections between the control node and the OSx station. OSx
Work? uses its database to log batch changes and to create batch reports. Making
batch requests in the controller by way of the bch_req attribute allows OSx
to notify its database of the actions taking place in the controller and keep
appropriate records of what is happening during the batch. The bch_req _info
attribute is a variable used to provide more information that may be
required to perform the batch request being made. Typically, the controller
sets bch_req_resp to NO_COMMAND before a batch request.
Batch Request The bch_req can be set to valid batch and unit commands. Refer to Table 5-1
Commands for batch request commands and be aware of the following:
Refer to Table 2-1, on page 2-7, for information about how APT makes use of
these attributes for unit tags.
NOTE: Some batch and unit commands share the same name; therefore a
prefix of B_ (BATCH) and U_ (UNIT) is used to distinguish between the two
types of commands.
Batch Request Each time the bch_req is set to a batch or unit command, the OSx batch
Response manager processes the command and then writes successful (0x8000) or
failed (0x4000) to the bch_req_resp attribute of the unit that made the
request. Note that a value of successful does not mean that the requested
command was actually successfully executed; it merely means that the
batch manager successfully read the request and has passed it along to the
batch and/or unit.
5-2 Batch Operations and the Controller SIMATIC PCS 7 OSx 4.1.1 Batch Programming
5.2 Batch Request Commands
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Operations and the Controller 5-3
Batch Request Commands (continued)
5-4 Batch Operations and the Controller SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table 5-1 Batch Controller Request Commands (continued)
bch_req value Contents of
bch_req name Comments
Hex Dec bch_req_info
The unit making the request is released from the
BCH_REQ_U_RELEASE 0x0700 1792 batch in which it is currently assigned and is sent the
U_CMD_RELEASE command.*
The unit making the request is sent the
U_CMD_START command.*
BCH REQ U START
BCH_REQ_U_START 0x1a00 6656
The unit identified by tag name is sent the
tag name
U_CMD_START command.
The unit making the request is sent the
U_CMD_DONE command.*
BCH REQ U DONE
BCH_REQ_U_DONE 0x0a00 2560
The unit identified by tag name is sent the
tag name
U_CMD_DONE command.
The unit making the request is sent the
U_CMD_HOLD command.*
BCH REQ U HOLD
BCH_REQ_U_HOLD 0x1d00 7424
The unit identified by tag name is sent the
tag name
U_CMD_HOLD command.
The unit making the request is sent the
U_CMD_RESUME command.*
BCH REQ U RESUME
BCH_REQ_U_RESUME 0x0d00 3328
The unit identified by tag name is sent the
tag name
U_CMD_RESUME command.
The unit making the request is sent the
U_CMD_WAIT command.*
BCH REQ U WAIT
BCH_REQ_U_WAIT 0x1b00 6912
The unit identified by tag name is sent the
tag name
U_CMD_WAIT command.
The unit making the request is sent the U_CMD_JOG
command.*
BCH REQ U JOG
BCH_REQ_U_JOG 0x0b00 2816
The unit identified by tag name is sent the
tag name
U_CMD_JOG command.
The unit making the request is sent the
U_CMD_ABORT command.*
BCH REQ U ABORT
BCH_REQ_U_ABORT 0x1f00 7936
The unit identified by tag name is sent the
tag name
U_CMD_ABORT command.
The unit making the request is sent the
U_CMD_CLR_ABORT command.*
BCH REQ U CLR ABORT
BCH_REQ_U_CLR_ABORT 0x0f00 3840
The unit identified by tag name is sent the
tag name
U_CMD_CLR_ABORT command.
* Instead of using the bch_req attribute to issue a request, it is possible to bypass the batch manager by having the
unit write the command to its own command attribute.
Table continues on next page.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Operations and the Controller 5-5
Batch Request Commands (continued)
5-6 Batch Operations and the Controller SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Chapter 6
Batch Logs and Reports
6.1 Understanding Batch Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
What Is a Batch Log? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Batch Internal ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
6.2 Guidelines for Generating Batch Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Report Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Batch Report Format Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Logs and Reports 6-1
6.1 Understanding Batch Logs
What Is a Batch The batch log consists of all messages that OSx generates during batch
Log? processing. Like the other logs that OSx generates, the batch log is not a
separate group of messages. Instead, the batch log characterizes those
messages within the system log that are related either to a specific batch ID
or to all batch IDs. If a system-generated message does not relate to a
batch ID, then the message is not part of the batch log (Figure 6-1).
Batch Internal ID The batch ID field contains the internal ID of the batch, not the
user-defined custom batch ID, in the daily system log file. However, reports
reading the log file translate this internal ID to the customer-defined
batch ID.
6-2 Batch Logs and Reports SIMATIC PCS 7 OSx 4.1.1 Batch Programming
OSx creates a new log file every day and stores each file for the number of
days that is specified in the File Duration field of the Printer Configuration
Destination display. This log file is stored in the /usr/tistar/hist/rpt/output
directory and is named RPLOG.<date>--<sequence number>, for example,
RPLOG.06APR--1 for the first file of April 6th.
Figure 6-2 illustrates how OSx generates log messages and log files during
batch processing. To view or print data related to a specific batch, you must
develop a report format that extracts the required data from the log and
places it in a file. For more information about creating batch reports, refer
to Section 6.2.
Generates
OSx system
changes
Spooler:
Queues messages and
sends them to the correct Printer
destination depending on configuration
the items selected during
printer configuration
2 days old
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Logs and Reports 6-3
6.2 Guidelines for Generating Batch Reports
Prerequisites Before you try to generate batch reports, ensure that you are aware of the
following prerequisites.
You know which tags are linked to units that are associated with a
batch.
You know which batch IDs you want to use to create the batch reports.
You are thoroughly familiar with the message types and fields in the
log files. See the SIMATIC PCS 7 OSx Reports Manual for more
information about the message types.
Report Editor The procedures for creating batch reports with the Report Editor are exactly
the same as they are for creating typical reports. For information about
using the Report Editor, refer to the SIMATIC PCS 7 OSx Reports Manual.
Batch Report Several report functions exist that are especially useful for batch reports:
Format Functions @blog, @setbid, #readlog, and #field. For a description of these functions and
their syntax, usage, and output, refer to the SIMATIC PCS 7 OSx Reports
Manual.
6-4 Batch Logs and Reports SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Chapter 7
Running and Supervising a Batch
7.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Sequence of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
7.2 Configuring a Batch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Using Batch Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
7.3 Displaying a List of Active Batches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-1
7.1 Prerequisites
Ensure that you have done the following before you initiate and supervise a
batch.
You have configured one or more unit tags and their associated process
tags.
You have written a BCL program that links OSx with your process
(optional).
You are in the Offline or Operate state to configure batches; or you are
in the Operate state to start and monitor batches.
7-2 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Sequence of Tasks Figure 7-1 lists the recommended order of tasks for executing and
supervising a batch. The security privileges that are required to perform
these batch and unit commands are found in Appendix E.
ID 1
Associate a batch ID with a
ID 2 product.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-3
7.2 Configuring a Batch
Using Batch OSx enables you to associate a unique batch ID with every product. If, for
Identification example, you run six batches of the same product in one day, use a unique
batch ID for each batch. The unique batch IDs make it easy to track data
related to the batches.
7-4 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Batch ID Enter a unique batch ID or select a batch ID from the list. A
batch ID can have up to 16 characters. The space, the character
combinations --> and <-- and the characters ; , \ ” are invalid for
batch IDs. You can change a batch ID at any time while entering data for a
new batch. You can rename a batch by selecting an existing batch ID and
typing over the ID with the new batch ID.
Enter the batch ID description in the field to the right of the Batch ID field.
The characters ; \ ” are invalid for batch ID descriptions. If you select
an existing batch ID, the description appears in this field. You may change
the description by editing the field. The new description is saved when
Commit or OK is selected.
Typically, when you commit a new batch using the Batch Identification option,
the batch state changes from New to either Commit or Ready to indicate that
the system has successfully created the batch. However, if you modify an
existing batch, and the modification does not cause a batch state change,
then there is no visual feedback to indicate that the batch change
succeeded. To be sure that the change has actually succeeded, select Clear
and then enter the batch ID again in the Batch ID field. The system
displays the current information for the batch.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-5
Configuring a Batch (continued)
Batch State Displays the current state of a batch. You cannot edit this
field. This field displays New during the entry of new batch information.
This field dynamically updates as the state of the batch changes. Assigning
None as the product places the batch in the Commit state. Assigning any
other product to the batch causes the batch to bypass the Commit state and
go directly to the Ready state (Figure 7-3).
Initial batch messages print to the default batch log printer as configured in
the Log Destination dialog box (select Startup ->Printer ->Log Destination) until
you select a new destination. To minimize the number of messages printed
to the default printer, follow these guidelines.
When you select Data ->Batch Identification on the menu bar to create a new
batch, select Commit before making any changes in the printer destination.
Initial commit messages print at the default destination. After committing
the batch, make any changes that you want in the printer destination, and
all subsequent messages print at the new destination.
Before you modify an existing batch, make any changes in the printer
destination and select Commit. Then make any other changes that you want
for the batch, and select Commit or OK. All batch messages that are
generated after the destination change are then logged using the new
printer destination.
7-6 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Commit Saves the batch information that you enter and associates the
batch ID with a product (recipe). Commit does not start a batch recipe
(Figure 7-3). When you select the Commit option, the batch is considered
active, the batch start time is set to reflect the time at which the Commit
command was executed, and OSx places the batch ID with its description in
the Active Batch Directory. You cannot commit a batch unless it is
associated either with a product or with the special None product. Until a
batch has started and passed the Ready state, you can change the product
associated with a batch.
When you commit a new batch with a product other than the special None
product when OSx is in the Operate state, the system may log a batch
tracking message indicating that the batch has made a state change to
COMMIT transition. You can ignore this message. The COMMIT state is a
temporary, transitory state for batches committed with a product other than
the None product. A second batch tracking message follows, indicating a
state change to READY.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-7
7.3 Displaying a List of Active Batches
In the Operate state, OSx enables you to display a directory of all active
batches. A batch becomes active by associating a batch with a product and
committing the batch (Section 7.2). To display the Active Batch Directory,
select Batch from the Directory pushbutton in the navigation area
(Figure 7-4).
When you select a batch ID, OSx displays the graphic that your BCL
program associated with that batch. If a batch ID does not have an
associated graphic, OSx displays the corresponding batch tag detail.
7-8 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
7.4 Displaying the Active Batch Tag Group
To display the Active Batch Tag Group, select Active Batches from the
Navigation Area (Figure 7-5). A tag group containing one faceplate for each
currently active batch is displayed in alphabetical order by batch ID. Only
eight faceplates fit on one display page; if there are more than eight
currently active batches, then the Right button in the navigation area is
sensitized. Selecting Right displays the next set of active batches. Selecting
Left at any time after selecting Right returns you to the previous page of
active batches.
As with faceplates for other tag types, selecting Detail on the faceplate
displays the tag detail for the batch.
The Active Batches button is grayed out when there are no batches currently
active.
Left Button
Right Button
Active Batches
Detail
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-9
7.5 Viewing the Operation of an Active Batch
You can view the graphic associated with an active batch if a BCL program
has associated the graphic with the batch ID. If a batch ID is not associated
with a graphic, OSx displays the detail screen corresponding to the batch.
Viewing Program If your station is in Operate state, you may observe some delay in the
Execution execution of a BCL program when another station is synchronizing. To see if
this is the cause of the delay, check Network Status, which shows when
stations are synchronizing. Program execution will be complete shortly after
synchronization finishes.
Viewing To view the graphic associated with a batch, access the Active Batch
Batch-Related Directory and select a batch ID. OSx displays the currently associated
Graphics graphic (or the tag detail if an associated graphic does not exist). Your BCL
program can automatically change the graphic associated with a batch as
the batch progresses. For information on how to associate a graphic with a
batch, refer to the bc_assign_graphic function in Appendix C.
Viewing To view the tag detail associated with a batch graphic, select Tag Detail from
Batch-Related the navigation area Directory pushbutton while the batch graphic is
Detail displayed, or while the Active Batch Tag Group is displayed, select the Detail
button on the faceplate of your batch ID (Figure 7-6). The tag detail is then
displayed.
7-10 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-11
7.6 Assigning Batch Units
To assign one or more units to a batch from the batch tag detail, follow these
steps:
2. Select the unit(s) you want to assign to the batch. Use the scroll bar to
view multiple pages of units.
3. Select OK to assign the units or select Cancel to not assign any units.
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
7-12 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
7.7 Releasing Batch Units
To release one or more units from a batch using the batch tag detail, follow
these steps:
1. Select Release Unit. A list of all units currently assigned to the batch
displays in the navigation area (Figure 7-8). Use the scroll bar to view
multiple pages of units.
2. Select the unit(s) you want to release from the batches, or choose Select
All & OK to release all assigned units from the batch.
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-13
7.8 Changing Batch State
The batch tag detail enables you to monitor the status of a batch and to
access a dynamically built tag group consisting of the units currently
assigned to the batch. From these screens, an operator may issue commands
to a batch or unit if he or she has the correct security privilege. See
Table E-1 and Table E-3 in Appendix E for the valid security privileges for
batch and unit commands.
Changing the State To change the operational state of a batch and its assigned units, select the
of a Batch State field. OSx displays a command form that lists the batch state options
(Figure 7-9). The selected command is also propagated to the units assigned
to the batch.
Starting a Batch After creating an active batch, follow these steps to start the batch.
2. Select the Start option from the State field on the Batch Tag Detail. The
system sends the Start command to the batch and propagates it to the
units assigned to the batch.
The Start option sends the Start command to all units currently assigned to
the batch. The logic that you build into the batch program determines any
other actions that occur when you select the Start option. See Table A-5 on
page A-6 for the values of the batch command attribute and Table A-11 on
page A-10 for the values of the unit command attribute.
NOTE: At least one unit must be assigned to the batch before starting it.
Refer to Section 7.6 for instructions on assigning units to a batch.
7-14 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-15
7.9 Changing Batch Mode
To change the operational mode of a batch and its assigned units, select the
Mode field (Figure 7-10). OSx displays a command form that lists these
batch mode options.
The selected mode command is also sent to the units assigned to the batch.
See Table E-2 and Table E-4 in Appendix E for the valid security privileges
for mode commands, Table A-6 on page A-6 for the values for the batch
MODE_CMD attribute, and Table A-12 on page A-10 for values for the unit
MODE_CMD attribute.
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
7-16 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
7.10 Splitting a Batch
A batch may be split into multiple batches from the batch tag detail by
selecting Split Batch and entering a new, unique batch ID at the Sub-Batch ID
prompt, followed by selecting OK (Figure 7-11). This creates a new batch
with the same product as the parent batch. The new child batch is placed in
the ready state and its start time is set to reflect the time at which the split
command was performed. See Table E-1 in Appendix E for an explanation of
security privileges required to split batches.
Parent batches are automatically removed when all of their child batches
are removed. Of course, you may choose to remove the parent batch yourself
before all the children have been removed. See Section 7.11 for more
information on removing batches.
Reports may be created that include log messages for parents or children of
a particular batch. See Chapter 6 for more information.
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-17
7.11 Ending a Batch
2. Select Complete or Abort option for the batch State field (Figure 7-12).
The end time is set to reflect the time at which the Complete or Abort
command was executed.
The Complete option sets the end time for the batch and sends the Done
command to all units currently assigned to the batch. The logic that you
build into the batch program determines any other actions that occur when
you select the Complete option. The Abort option also sets the end time for
the batch and sends the Abort command to all units currently assigned to
the batch. The logic that you build into the batch program determines any
other actions that occur when you select the Abort option.
See Table A-5 for the values of the batch command attribute and Table A-11
for the values of the unit command attributes.
NOTE: The batch uses OSx resources until Remove is selected for the batch
State. After selecting Remove, the batch tag is released to the system and is
available for use by another batch. After the Remove is executed, the
batch ID is removed from the Active Batch Directory.
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
7-18 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Removing a Batch After the system completes or aborts a batch, you can remove a batch from
the system. Batch removal does not have to immediately follow the ending
of a batch. To remove a batch, select the Remove option from the batch
State. The batch is removed if all units assigned to it have been released.
NOTE: The Remove command does not remove the batch unless all units
associated with the batch have been released.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-19
7.12 Viewing Batch-Related Tag Groups
7-20 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-21
7.13 Viewing the Unit Tag Detail and Faceplate
Viewing Unit Tag The unit tag detail enables an operator to monitor the status of a unit and
Detail to issue commands to the unit. See Table E-3 in Appendix E for the valid
security privileges for unit commands.
To view a unit tag detail, follow the steps below. See Figure 7-14.
7-22 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Selection List
Incremental
Single Selection
_ACTREQ SYS ACTION REQUEST SYSTEM ALARM
_ALARMING SYS ALARMING SYSTEM ALARM
_ARCHIVING SYS ARCHIVING SYSTEM ALARM
_BATCH SYS BATCH SYSTEM ALARM
_CHANGE_LOG SYS OPERATOR CHANGE LOG SYSTEM
_CONFIG SYS CONFIGURATION SYSTEM ALARM
_DATA_BASE SYS DATABASE SYSTEM ALARM
_DATA_XFER SYS REMOTE DATA TRANSFER ALARM
_DIAGNOSTIC SYS DIAGNOSTICS SYSTEM ALARM
_FO_CIRCUIT SYS FAILOVER CIRCUIT ALARM
_GENERAL SYS GENERAL SYSTEM ALARM
_H1_COMM SYS H1 COMM. SYSTEM ALARM
_HT_COLLECT SYS HT COLLECTION SYSTEM ALARM
_HT_DISPLAY SYS HT DISPLAY SYSTEM ALARM
_HT_UPDATE SYS HTU SYSTEM ALARM
_LIBRARIAN SYS LIBRARIAN SYSTEM ALARM
OK Filter... Next
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-23
Viewing the Unit Tag Detail and Faceplate (continued)
Changing the State To change the operational state of a unit, select the State option on the Unit
of a Unit Tag Detail. OSx displays the unit state options (Figure 7-15).
The logic that you build into the batch program determines the actions that
take place when you select one of the unit commands. See Table A-11 for the
values of the unit command attribute.
Tag: UNIT_1
Tag Type: UNIT
Scan Status: Active
Batch ID: Dutch Cookies
P/C: C1
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
7-24 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Changing the Mode To change the operational mode of a unit, select the Mode option on the Unit
of a Unit Tag Detail. OSx displays the following unit mode options (Figure 7-16).
See Table A-12 for the values of the unit MODE_CMD attribute.
Tag: UNIT_1
Tag Type: UNIT
Scan Status: Active
Batch ID: Dutch Cookies
P/C: C1
Alarm Group:
Alarm State Sequencing:
Alarming:
State:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Running and Supervising a Batch 7-25
Viewing the Unit Tag Detail and Faceplate (continued)
Viewing the Unit You can view the unit faceplate by selecting the Display Units option from the
Faceplate batch tag detail (Figure 7-13 on page 7-21), or by creating and displaying a
tag group with one or more unit tags in it. The same state and mode
commands available from the unit tag detail are also available from the
faceplate (Figure 7-17).
7-26 Running and Supervising a Batch SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix A
Attributes and Status Bits for New Tags
A.1 Batch (BCH) Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Attributes and Status Bits for New Tags A-1
A.1 Batch (BCH) Tag
Table A-1 through Table A-6 and Figure A-1 describe the attributes for
Batch tags.
A-2 Attributes and Status Bits for New Tags SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table A-2 Bit Locations for Batch Status Attribute
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Attributes and Status Bits for New Tags A-3
Batch (BCH) Tag (continued)
MSB LSB
MODE
SPARE_2SPARE_3
READY COMMIT
ACTIVE
RUN SPARE_4 ALRM_UNACK
COMPLETE MAN_SET
SPARE_1
HOLD
ALARM
ABORT
A-4 Attributes and Status Bits for New Tags SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table A-4 Status Bit Settings for Batch Modes
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Attributes and Status Bits for New Tags A-5
Batch (BCH) Tag (continued)
A-6 Attributes and Status Bits for New Tags SIMATIC PCS 7 OSx 4.1.1 Batch Programming
A.2 Unit (UNIT) Tag
Table A-7 through Table A-12 describe the attributes for Unit tags.
Figure A-2 shows the bit locations for the Unit status word.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Attributes and Status Bits for New Tags A-7
Unit (UNIT) Tag (continued)
MSB LSB
IN_USE
MODE
SPARE_3 OOS
SPARE_2 SPARE_4 ACTIVE
RUN ALRM_UNACK
WAIT MAN_SET
SPARE_1
HOLD
ALARM
ABORT
A-8 Attributes and Status Bits for New Tags SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Table A-9 Status Bit Settings for Unit States
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Attributes and Status Bits for New Tags A-9
Unit (UNIT) Tag (continued)
A-10 Attributes and Status Bits for New Tags SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix B
Configuration Planning Sheet
SIMATIC PCS 7 OSx is designed to simplify the process of configuring a
system. The software provides easy-to-use menus and screens. Planning
sheets, found in the SIMATIC PCS 7 OSx Process Configuration Manual,
provide a means of organizing the configuration and recording system
information, thereby saving you a significant amount of time in the
data-entry process. Figure B-1 shows an example planning sheet that you
can use for Unit type tags.
NOTE: No planning sheet is included for batch tag type. You do not need to
configure batch tags, since the system creates them automatically.
TAG NAME:
DESCRIPTION:
PROCESS GROUP:
PARENT:
MEMORY NUMBER OF
ATTRIBUTES TYPE/ADDRESS LOCATIONS UPLOAD AUTOLOG INITIAL VALUE
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Configuration Planning Sheet B-1
B-2 Configuration Planning Sheet SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix C
Batch Control Functions
C.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-1
C.25 bc_load( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-29
C-2 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.51 bc_split_batch( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-61
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-3
C.1 Overview
This appendix describes the batch control functions that you can use within
your BCL programs to manipulate batch-related data. Each function
description consists of the following components.
Synopsis — shows the syntax and data types for the parameters used
by the function
Parameters — describes the parameters required by the function
Description — describes the operation of the function
Return values — lists the possible return codes that the function may
produce
Usage example — gives a brief example of the usage of the function
See also — refers to related functions
Custom and In order to understand and apply the batch control functions described in
Internal Batch IDs this appendix, it is important to understand some of the details concerning
the way OSx manages batch identifiers.
Internally, the system maintains two identifiers for each batch. One of these
can be modified by system users and BCL programs and is commonly
referred to as the “batch ID.” This is the ID that appears on displays and in
printed reports. Unless otherwise specified, references to batch ID
throughout this document refer to this customizable ID, which is why it is
often also referred to as the “custom batch ID” or just the “custom ID.”
Generally, this identifier is the one that is visible to operators and system
users other than system integrators and providers of custom-programmed
application software.
C-4 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
The other batch ID is internally generated. References to it are usually
qualified by the phrase “internally generated” or by the keywords “internal”
or “system.” When a batch is newly allocated, both the custom and internal
IDs are set to the same, internally-generated string and remain that way
unless the custom ID is altered by the user. The internal ID is not available
for modification. Its value remains fixed to provide the system with a means
of identifying the batch that is guaranteed to remain unique over time. The
internal ID is constructed in such a way that it will not repeat unless more
than 1000 batches are run in a single day. The format of the internal ID is
as follows:
BIDyymmdd-nnn
BID is the prefix for the internal ID
yy is the last two digits of the current year
mm is the number of the month, where January is 01
dd is the day of the month
nnn is a decimal sequence number
This convention of two batch identifiers allows you to reuse custom batch
IDs, provided that no two active batches are assigned the same custom ID.
If an attempt is made to assign a duplicate ID, the system refuses to accept
it and issues an error message.
Functions described on the following pages use both custom and internal
batch IDs as parameters. The distinction between the two must be closely
observed for proper operation of the batch control functions.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-5
C.2 bc_activate_autolog( )
Description This function enables OSx to log changes to the specified tag:attribute while
the system remains in the Standby or Operate state. If OSx transitions to
the Offline state, the auto logging feature stops. When OSx transitions to
the Standby or Operate state, the auto logging feature resets to its original
value. This value is defined when tags are configured. Refer to the SIMATIC
PCS 7 OSx Process Configuration Manual for additional information.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example enables the auto logging feature for rm1mt1:status
when the BCL program starts execution.
ON EVENT STARTUP
{
INT bc_status;
bc_status = bc_activate_autolog(”rm1mt1”, ”status”);
}
C-6 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.3 bc_add_batch_list_entry( )
Description This function adds the batch ID identified by batch_id to the list identified by
l_name. Before you execute this function, you must execute
bc_create_batch_list( ) to create the list.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates a new batch ID, creates an empty batch ID
list named BID_LIST, and then adds the new ID (specifically, the
internally-generated system ID) to the list. This is done when the BCL
program starts execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
bc_create_batch_list(”BID_LIST”);
bc_add_batch_list_entry(”BID_LIST”, sys_bid);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-7
C.4 bc_allocate_batch( )
Description This function finds an available batch tag and reserves it for the calling
program. The default NONE product is assigned to the batch and the batch
is placed in the COMMIT state. The function returns the system-generated
batch ID and descriptor to the calling program. The allocated batch then
becomes available to various BCL operations through its system or custom
batch ID.
The calling program is responsible for allocating the space that is required
for the batch ID and descriptor strings.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates an available batch ID and its descriptor to
to sys_bid and sys_desc, respectively, when the BCL program starts
execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
}
C-8 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.5 bc_assign( )
Description This function assigns the unit identified by unit_name to the batch identified
by system_batch_id. The unit must not be out of service or assigned to
another batch. If the unit is available for assignment, the assign command
will be written to the unit’s command attribute.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates a new batch ID and assigns the unit oven_1
to the batch when the BCL program starts execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
bc_assign(“oven_1”,sys_bid);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-9
C.6 bc_assign_graphic( )
Parameters graphic_name (in) Name of the graphic to be associated with the batch
system_batch_id (in) System-generated batch ID string
Description This function assigns the graphic display identified by graphic_name to the
batch identified by system_batch_id. For a list of possible graphic names,
display the Graphic Directory while OSx is in the Operate state.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates a new batch ID and assigns the graphic
display bake_area to the batch when the BCL program starts execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
bc_assign_graphic(“bake_area”, sys_bid);
}
C-10 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.7 bc_assign_id( )
Description This function assigns a custom ID to an existing batch. You can create a
custom batch ID only if the system-generated batch ID is unlocked and the
user_batch_id is unique.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates a new batch and assigns the custom
batch ID CHOC_CHIP to it when the BCL program starts execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
bc_assign_id(”CHOC_CHIP”, sys_bid);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-11
C.8 bc_batch_list_entry_exists( )
BOOLEAN bc_batch_list_entry_exists(l_name)
CHAR *l_name;
Description This function verifies the existence of an entry at the current pointer
location in the list identified by l_name.
Before you execute this function, you must call one or more of the following
functions:
bc_set_first_batch_list_entry( )
bc_set_next_batch_list_entry( )
Example The following example traverses the list named BID_LIST, allowing
operations of your choice to be performed using each batch ID stored in the
list. These operations are performed when the BCL program starts
execution.
ON EVENT STARTUP
{
CHAR *current_bid_ptr;
bc_set_first_batch_list_entry (”BID_LIST”);
while (bc_batch_list_entry_exists (”BID_LIST”))
{
current_bid_ptr =
bc_get_batch_id_entry (”BID_LIST”);
/*
** Do something with the current batch ID,
** then go on to the next one.
*/
bc_set_next_batch_list_entry (”BID_LIST”);
}
}
C-12 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.9 bc_clear_unit_elements( )
INT bc_clear_unit_elements(unit_name)
CHAR *unit_name;
Description This function clears each element within the specified unit by changing the
element value to either the defined null value or the low-range value (as
defined in the OSx database). If a unit element (or tag) relation contains
both low-range and high-range attributes, OSx assigns the low-range value
to the element. If a unit element does not use these attributes, OSx assigns
the null value to the element.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example copies unit elements from mix1 unit to oven1 unit and
clears the elements in mix1 when the OOS (out-of-service) bit goes high in
the status word.
ON EVENT mix1:status:OOS
{
bc_copy(”mix1”, ”oven1”);
bc_clear_unit_elements(”mix1”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-13
C.10 bc_copy( )
Synopsis The bc_copy( ) function is defined with the following parameter definitions.
Parameters src_unit_name (in) Name of the source unit with elements to be copied
dest_unit_name (in) Name of the destination unit receiving element data
Description This function copies all mapped element data from the source unit to the
destination unit. The destination unit must be assigned to the same batch
as the source unit.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example copies unit elements from mix1 unit to oven1 unit
when the OOS (out-of-service) bit goes high in the status word.
ON EVENT mix1:status:OOS
{
bc_copy(”mix1”, ”oven1”);
}
C-14 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.11 bc_create_batch_list( )
INT bc_create_batch_list(l_name)
CHAR *l_name;
Description This function creates an empty batch ID list identified by l_name. You can
access this list by using one or more of the batch control functions created
specifically for manipulating lists.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example creates the batch ID list BID_LIST when the BCL
program starts execution.
ON EVENT STARTUP
{
bc_create_batch_list(”BID_LIST”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-15
C.12 bc_deactivate_autolog( )
Description This function disables the auto logging feature for the specified tag:attribute
instance. When OSx transitions from Offline to the Standby or Operate
state, the auto logging feature resets to its configuration value. This value is
defined when tags are configured. Refer to the SIMATIC PCS 7 OSx Process
Configuration Manual for additional information.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example disables the auto logging feature for rm1mt1:status
when the BCL program transitions from Operate to Standby system state.
ON EVENT SE_OPER_TO_STBY
{
bc_deactivate_autolog(”rm1mt1”, ”status”);
}
C-16 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.13 bc_destroy_all_batch_lists( )
VOID bc_destroy_all_batch_lists( )
Parameters None
Description This function removes all batch ID lists that exist within the calling
program.
Example The following example removes all batch ID lists from the calling program
when the BCL program finishes execution.
ON EVENT SHUTDOWN
{
bc_destroy_all_batch_lists( );
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-17
C.14 bc_destroy_batch_list( )
INT bc_destroy_batch_list(l_name)
CHAR *l_name;
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example removes the batch ID list BID_LIST when the BCL
program finishes execution.
ON EVENT SHUTDOWN
{
bc_destroy_batch_list(”BID_LIST”);
}
C-18 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.15 bc_exit( )
Synopsis The bc_exit( ) function is defined with the following parameter definitions.
VOID bc_exit( )
Parameters None
Description Executing this function causes the BCL program to terminate execution
after it finishes executing the action block in which it is called.
Example The following example stops program execution when the abort bit goes high
for the unit status word.
ON EVENT oven1:status:abort
{
bc_exit( );
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-19
C.16 bc_get_batch_id( )
Parameters tag_name (in) Name of the tag associated with the custom batch ID
custom_batch_id (out) Custom batch ID string
Description This function retrieves the custom batch ID for the tag identified by
tag_name. The tag name parameter may specify a tag of any type.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves the custom batch ID associated with the
oven temperature tag tmp1 when the temperature changes.
#include <enum_types/b_i_d.t>
ON EVENT tmp1:pv CHANGES
{
CHAR custom_bid[T_B_I_D_LENGTH];
bc_get_batch_id(”tmp1”, custom_bid);
}
C-20 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.17 bc_get_batch_id_entry( )
CHAR *bc_get_batch_id_entry(l_name)
CHAR *l_name;
Description This function obtains the current batch ID from the current entry of l_name.
Before you use this function, ensure that the current entry ID has been set
with either the bc_set_first_batch_list_entry( ) function or the
bc_set_next_batch_list_entry( ) function.
Return Value This function returns a pointer to the batch ID string stored at the current
location of the specified list. If a current entry does not exist or the list is
empty, the function returns a NULL value.
Example The following example traverses the list named BID_LIST allowing
operations of your choice to be performed using each batch ID stored in the
list. These operations are performed when the BCL program starts
execution.
ON EVENT STARTUP
{
CHAR *current_bid_ptr;
bc_set_first_batch_list_entry (”BID_LIST”);
while (bc_batch_list_entry_exists (”BID_LIST”))
{
current_bid_ptr =
bc_get_batch_id_entry (”BID_LIST”);
/*
** Do something with the current batch ID,
** then go on to the next one.
*/
bc_set_next_batch_list_entry (”BID_LIST”);
}
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-21
C.18 bc_get_batch_mode( )
Description This function retrieves the mode bits from the batch tag identified by
system_batch_id. The two mode bits are found in the batch tag status word.
For more information about the batch status attribute, refer to Appendix A.
This function returns the value of the two mode bits. All other bits in the
status attribute are masked and return a value of zero. The calling routine
must decode the bit settings.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves the mode bits for the batch running in the
unit oven1 when the run bit goes high for that unit. In order to obtain the
batch’s system ID, which is required for the call to bc_get_batch_mode( ), the
custom ID for the unit tag oven1 is first retrieved and is then translated to
the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
#include <enum_types/b_qual.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_B_QUAL batch_mode;
bc_get_batch_id(“oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_get_batch_mode(system_id, &batch_mode);
}
C-22 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.19 bc_get_batch_state( )
Description This function retrieves the status attribute from the batch tag identified by
system_batch_id. For more information about the batch status attribute, refer
to Appendix A.
The state value does not include the mode bits that also appear in the status
attribute. The mode bits are masked and return a value of zero. The calling
routine must decode the bit settings.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves the batch state for the batch running in the
unit oven1 when the run bit goes high for that unit. In order to obtain the
batch’s system ID, which is required for the call to bc_get_batch_state( ), the
custom ID for the unit tag oven1 is first retrieved and is then translated to
the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_B_QUAL batch_state
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_get_batch_state(system_id, &batch_state);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-23
C.20 bc_get_custom_id( )
Description This function retrieves the custom batch ID for the batch tag identified by
the system-generated batch ID system_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves a character string from the TEXT tag job
and stores it in the local variable current_batch. This character string is
assumed to be a system-generated batch ID. It then uses this ID to get the
associated custom batch ID by calling bc_get_custom_id( ). These actions will
occur as the BCL program terminates execution.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT SHUTDOWN
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR current_batch[T_BATCH_INTERNAL_ID_LENGTH];
C-24 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.21 bc_get_printer_mask( )
Description This function retrieves the bit mask of a printer name and returns it in mask
form.
Example The following example sets the log destination to multiple printers, i.e.,
three printers, for the batch being processed in unit oven1 when the unit
in_use bit goes high. In order to obtain the batch’s system ID, which is
required for the call to bc_set_log_destination( ), the custom ID for the unit
tag oven1 is first retrieved and is then translated to the system ID.
#include <spool_user.h>
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_DEV_SET one_printer,all_printers;
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_get_printer_mask(”p1”,&one_printer);
all_printers = one_printer;
bc_get_printer_mask(”p2”,&one_printer);
all_printers |= one_printer;
bc_get_printer_mask(”p3”,&one_printer);
all_printers |= one_printer;
bc_set_log_destination(system_id, all_printers);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-25
C.22 bc_get_system_id( )
Description This function retrieves the system batch ID for the batch tag identified by
the custom batch ID custom_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”tmp1”, custom_bid);
bc_get_system_id(custom_bid, sys_bid);
}
C-26 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.23 bc_get_unit_mode( )
Description This function retrieves the mode bits from the unit identified by unit_name.
The two mode bits are found in the unit tag status word. For more
information about the unit status attribute, refer to Appendix A.
This function returns the value of the two mode bits. All other bits in the
status attribute are masked and return a value of zero. The calling routine
must decode the bit settings.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves the mode bits from the unit identified by
oven1 when the BCL program starts execution.
#include <enum_types/u_qual.t>
ON EVENT STARTUP
{
T_U_QUAL unit_mode;
bc_get_unit_mode(”oven1”, &unit_mode);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-27
C.24 bc_get_unit_state( )
Description This function retrieves the status attribute from the unit tag identified by
unit_name. For more information about the unit status attribute, refer to
Appendix A.
The state value does not include the mode bits that also appear in the status
attribute. The mode bits are masked and return a value of zero. The calling
routine must decode the bit setting.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example retrieves the unit state from the unit tag identified
by oven1 when the BCL program starts execution.
#include <enum_types/u_qual.t>
ON EVENT STARTUP
{
T_U_QUAL unit_state;
bc_get_unit_state(”oven1”, &unit_state);
}
C-28 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.25 bc_load( )
Synopsis The bc_load( ) function is defined with the following parameter definitions.
INT bc_load(unit_name)
CHAR *unit_name;
Description This function downloads a recipe to the controller for the unit identified by
unit_name. OSx downloads the recipe to the controller as if the controller
requested the download.
Before this function can operate successfully, the BCL program must
execute the bc_select( ) function to select a valid recipe.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example loads the recipe for the unit oven1 when the run bit
goes high for that unit. In order to obtain the batch’s system ID, which is
required for the call to bc_select( ), the custom ID for the unit tag oven1 is
first retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_select(system_id, ”oven1”);
bc_load(”oven1”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-29
C.26 bc_lock_batch_id( )
INT bc_lock_batch_id(system_batch_id)
CHAR *system_batch_id;
Description This function locks the batch identified by system_batch_id by setting the
id_locked attribute to LOCKED (or TRUE). The batch ID of a locked batch
cannot be changed.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example allocates a new batch, assigns the custom ID
CHOC_CHIP to it, and then locks the ID against further changes. This all
takes place when the BCL program starts execution.
#include <enum_types/batch.r>
#include <enum_types/t_desc.t>
ON EVENT STARTUP
{
CHAR sys_bid[T_BATCH_INTERNAL_ID_LENGTH];
CHAR sys_desc[T_T_DESC_LENGTH];
bc_allocate_batch(sys_bid, sys_desc);
bc_assign_id(”CHOC_CHIP”, sys_bid);
bc_lock_batch_id(sys_bid);
}
C-30 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.27 bc_log_comment( )
Description This function sends the comment message to the log for the batch identified
by batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sends a message that contains the comment “Oven
unit 1 is running” and the keyword STATUS to the log for the batch that
oven1 is currently processing. This takes place when the run bit goes high for
the oven1 unit.
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_log_comment(custom_bid, ”STATUS”, ”Oven unit 1 is running.”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-31
C.28 bc_log_operation( )
Description This function generates a log message for the specified unit and its
corresponding event (either EVENT_START or EVENT_FINISH). The log
message contains the unit operation in the specified event.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example logs the EVENT_START event when the run bit goes
high for the oven1 unit.
#include <ba_user.h>
ON EVENT oven1:status:run
{
bc_log_operation(”oven1”, EVENT_START);
}
C-32 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.29 bc_log_value( )
Description This function sends a tag:attribute message to the log associated with the
batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example logs the current oven temperature (from tag
oven1temp:pv) for the unit oven1 in the log for the batch that oven1 is
currently processing. This happens when the run bit goes high for the oven1
unit.
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_log_value(custom_bid, ”oven1temp”, ”pv”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-33
C.30 bc_print_batch_list( )
VOID bc_print_batch_list()
Parameters None
Description This function dumps the current contents of a batch ID list to a verbose
(debug) output file. This statement produces a dump only when the BCL
program is run with the --v option.
Example The following example prints batch ID lists when the BCL program finishes
execution.
ON EVENT SHUTDOWN
{
bc_print_batch_list();
}
C-34 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.31 bc_release( )
Parameters unit_name (in) Name of the unit tag to be released from a batch
system_batch_id (in) System-generated batch ID string
Description This function releases the unit identified by unit_name from the batch
identified by system_batch_id. The unit must be already assigned to the batch
specified by system_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example releases the unit oven1 from the batch with which it
is currently associated when the unit status bit oos (out-of-service) goes
high. In order to obtain the batch’s system ID, which is required for the call
to bc_release( ), the custom ID for the unit tag oven1 is first retrieved and is
then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:oos
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_release(”oven1”, system_id);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-35
C.32 bc_release_all( )
INT bc_release_all(system_batch_id)
CHAR *system_batch_id;
Description This function releases all units that are assigned to the batch identified by
system_batch_id. The units must be already assigned to the batch specified by
system_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example releases all units from the batch with which the unit
oven1 is associated when the in_use bit for oven1 goes low. In order to obtain
the batch’s system ID, which is required for the call to bc_release_all( ), the
custom ID for the unit tag oven1 is first retrieved and is then translated to
the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_release_all(system_id);
}
C-36 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.33 bc_release_graphic( )
INT bc_release_graphic(system_batch_id)
CHAR *system_batch_id;
Description This function releases the graphic that is assigned to the batch identified by
system_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example releases the graphic that is assigned to the batch
currently being processed in the unit oven1 when the in_use bit for oven1 goes
low. In order to obtain the batch’s system ID, which is required for the call
to bc_release_graphic( ), the custom ID for the unit tag oven1 is first
retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_release_graphic(system_id);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-37
C.34 bc_remove_batch_list_entry( )
Description This function removes the batch ID identified by batch_id from the list
identified by l_name.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-38 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example removes the ID for the batch which the unit oven1 is
currently processing from the list named BID_LIST when the in_use bit for
oven1 goes low.
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_remove_batch_list_entry(”BID_LIST”, custom_bid);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-39
C.35 bc_request_batch_mode( )
The following constants represent the legal values for the mode_command
parameter; they are defined in /usr/tistar/include/enum_types/b_md_cmd.t:
Description This function writes the specified mode command to the batch tag identified
by system_batch_id. The bit pattern representing the mode command is
defined in the header file enum_types/b_md_cmd.t. Appendix A also describes
the bit pattern for the batch mode command.
If this function completes successfully, the status attribute of the batch tag
reflects the specified mode command. The calling program, then, must query
the status attribute to determine the completion status of the request.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-40 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example writes the mode command B_MD_CMD_AUTO and
retrieves the mode bits for the batch currently being processed in unit oven1
when the unit in_use bit goes high. In order to obtain the batch’s system ID,
which is required for the call to bc_request_batch_mode( ), the custom ID for
the unit tag oven1 is first retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
#include <enum_types/b_md_cmd.t>
#include <enum_types/b_qual.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_B_QUAL batch_mode;
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_request_batch_mode(system_id, B_MD_CMD_AUTO);
bc_get_batch_mode(system_id, &batch_mode);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-41
C.36 bc_request_batch_state( )
The following constants represent the legal values for the command
parameter; they are defined in usr/tistar/include/enum_types/b_cmd.t:
Description This function writes the specified command to the command attribute of the
batch tag identified by system_batch_id. If this function completes
successfully, the status attribute of the batch tag reflects the specified
command. The calling program, then, must query the status attribute to
determine the completion status of the request.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-42 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example writes the command B_CMD_RESUME and
retrieves the state bits for the batch currently being processed in unit oven1
when the unit oos (out-of-service) bit goes low. In order to obtain the batch’s
system ID, which is required for the call to bc_request_batch_state( ), the
custom ID for the unit tag oven1 is first retrieved and is then translated to
the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
#include <enum_types/b_cmd.t>
#include <enum_types/b_qual.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_request_batch_state(system_id, B_CMD_RESUME);
bc_get_batch_state(system_id, &batch_state);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-43
C.37 bc_request_unit_mode( )
The following constants represent the legal values for the mode_command
parameter; they are defined in /usr/tistar/include/enum_types/b_md_cmd.t:
Description This function writes the specified mode command to the unit tag identified
by unit_name that is used in the batch identified by system_batch_id. If this
function completes successfully, the status attribute of the unit tag reflects
the specified mode command. The calling program, then, must query the
status attribute to determine the completion status of the request.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-44 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example writes the mode command B_MD_CMD_MANUAL
and retrieves the mode bits for the unit oven1 when the unit in_use bit goes
high. In order to obtain the batch’s system ID, which is required for the call
to bc_request_unit_mode( ), the custom ID for the unit tag oven1 is first
retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
#include <enum_types/b_md_cmd.t>
#include <enum_types/u_qual.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_U_QUAL unit_mode;
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_request_unit_mode(system_id, B_MD_CMD_MANUAL);
bc_get_unit_mode(system_id, &unit_mode);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-45
C.38 bc_request_unit_state( )
The following constants represent the legal values for the command
parameter; they are defined in /usr/tistar/include/enum_types/u_cmd.t:
Description This function writes the specified command to the command attribute of the
unit tag identified by unit_name. The unit must be assigned to the batch
identified by system_batch_id. If this function completes successfully, the
status attribute of the unit tag reflects the specified command. The calling
program, then, must query the status attribute to determine the completion
status of the request.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-46 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example writes the command U_CMD_JOG and retrieves the
state bits for the unit oven1 when the unit in_use bit goes high. In order to
obtain the batch’s system ID, which is required for the call to
bc_request_unit_state( ), the custom ID for the unit tag oven1 is first retrieved
and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
#include <enum_types/u_cmd.t>
#include <enum_types/u_qual.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_U_QUAL unit_state;
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_request_unit_state(system_id, U_CMD_JOG);
bc_get_unit_state(system_id, &unit_state);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-47
C.39 bc_scale_recipe( )
Description This function provides the scaling factor that the recipe package uses when
creating a production recipe. The function writes the scale_factor to every
area tag that is assigned to the unit_name.
Before this function can operate successfully, the BCL program must
execute the bc_select( ) function to select a valid recipe. The recipe scale
factor must be set before the recipe is downloaded.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example selects, scales (by 2.5), and loads the current recipe
for the unit oven1 when the run bit goes high for that unit. In order to obtain
the batch’s system ID, which is required for the call to bc_scale_recipe( ), the
custom ID for the unit tag oven1 is first retrieved and is then translated to
the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_select(system_id, ”oven1”);
bc_scale_recipe(”oven1”, 2.5);
bc_load(”oven1”);
}
C-48 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.40 bc_select( )
Description This function selects the current recipe for the unit identified by unit_name in
the batch identified by system_batch_id. The selected recipe corresponds to
the unit product name. The recipe is selected for all recipe areas associated
with the unit. After the recipe is selected, it can be downloaded to the
controller with the bc_load( ) function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example selects and loads the current recipe for the unit oven1
when the run bit goes high for that unit. In order to obtain the batch’s
system ID, which is required for the call to bc_select( ), the custom ID for
the unit tag oven1 is first retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_select(system_id, ”oven1”);
bc_load(”oven1”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-49
C.41 bc_set_batch_end( )
INT bc_set_batch_end(system_batch_id)
CHAR *system_batch_id;
Description This function sets the ending time stamp, time string, and date string for
the batch identified by system_batch_id to the current time and date. When
the batch is commanded to complete or abort, these times are set
automatically if they have not been already set with a call to
bc_set_batch_end( ); however, they may be overwritten with a call to this
function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sets the ending time stamp, time string, and date for
the batch being processed in unit oven1 when the unit in_use bit goes low. In
order to obtain the batch’s system ID, which is required for the call to
bc_set_batch_end( ), the custom ID for the unit tag oven1 is first retrieved
and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_set_batch_end(system_id);
}
C-50 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.42 bc_set_batch_operation( )
Description This function defines the operation string for the batch identified by
system_batch_id. The operation_name corresponds to the operation attribute of
the batch tag and can be any valid character string. If the string is too long,
the function truncates the string to a length of 10 characters before
continuing execution. The operation string appears in the batch tag detail
screen.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example installs the operation string “cooking” for the batch
currently being processed in unit oven1 when the unit run bit goes high. In
order to obtain the batch’s system ID, which is required for the call to
bc_set_batch_operation( ), the custom ID for the unit tag oven1 is first
retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:run
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_set_batch_operation(system_id, ”cooking”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-51
C.43 bc_set_batch_product( )
Description This function defines the product for the batch tag identified by
system_batch_id. The product parameter corresponds to the product name of a
recipe and can be any valid character string. If recipe downloads are to be
performed, the product name must also be a valid recipe name. If the string
is too long, the function truncates the string to a length of 12 characters
before continuing execution.
Successful execution of this function will cause the batch to enter the
READY state, unless the special NONE product is requested. In that case,
the COMMIT state will be entered. The function returns an error and will
not change the product if the batch is currently running.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example defines the product CHOC_CHIP for the batch
currently being processed in unit oven1 when the unit in_use bit goes high.
In order to obtain the batch’s system ID, which is required for the call to
bc_set_batch_product( ), the custom ID for the unit tag oven1 is first retrieved
and is then translated to the system ID
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_set_batch_product(system_id, ”CHOC_CHIP”);
}
C-52 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.44 bc_set_batch_start( )
INT bc_set_batch_start(system_batch_id)
CHAR *system_batch_id;
Description This function sets the starting time stamp, time string, and date string for
the batch identified by system_batch_id to the current time and date. When
the batch is committed, these times are set automatically; however, they
may be overwritten with a call to this function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sets the starting time stamp, time string, and date
for the batch being processed in unit oven1 when the unit in_use bit goes
high. In order to obtain the batch’s system ID, which is required for the call
to bc_set_batch_start( ), the custom ID for the unit tag oven1 is first retrieved
and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_set_batch_start(system_id);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-53
C.45 bc_set_first_batch_list_entry( )
INT bc_set_first_batch_list_entry(l_name)
CHAR *l_name;
Description This function sets the current pointer to the first batch ID in the list
identified by l_name.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example traverses the list named BID_LIST allowing
operations of your choice to be performed using each batch ID stored in the
list. These operations are performed when the BCL program starts
execution.
ON EVENT STARTUP
{
CHAR *current_bid_ptr;
bc_set_first_batch_list_entry (”BID_LIST”);
while (bc_batch_list_entry_exists (”BID_LIST”))
{
current_bid_ptr =
bc_get_batch_id_entry (”BID_LIST”);
/*
** Do something with the current batch ID,
** then go on to the next one.
*/
bc_set_next_batch_list_entry (”BID_LIST”);
}
}
C-54 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.46 bc_set_log_destination( )
Description This function sets the destination printer device(s) to those printer(s)
indicated with the bit pattern defined in destinations. The printer bit pattern
is retrieved using the bc_get_printer_mask function that identifies one or more
printer devices. You can logically OR the results of several
bc_get_printer_mask( ) calls to specify multiple printers. These printers can
receive log messages for the specified batch.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sets the log destination, printer p1 on station mynode,
for the batch being processed in unit oven1 when the unit in_use bit goes
high. In order to obtain the batch’s system ID, which is required for the call
to bc_set_log_destination( ), the custom ID for the unit tag oven1 is first
retrieved and is then translated to the system ID.
#include <spool_user.h>
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
ON EVENT oven1:status:in_use
{
CHAR custom_bid[T_B_I_D_LENGTH];
CHAR system_id[T_BATCH_INTERNAL_ID_LENGTH];
T_DEV_SET printer;
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_get_printer_mask(”p1”,”mynode”,&printer);
bc_set_log_destination(system_id, printer);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-55
C.47 bc_set_next_batch_list_entry( )
INT bc_set_next_batch_list_entry(l_name)
CHAR *l_name;
Description This function sets the current pointer to the next batch ID (relative to the
current position) in the list identified by l_name. Before this function can be
executed, the BCL program must call the bc_set_first_batch_list_entry ( )
function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
C-56 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Example The following example traverses the list named BID_LIST allowing
operations of your choice to be performed using each batch ID stored in the
list. These operations are performed when the BCL program starts
execution.
ON EVENT STARTUP
{
CHAR *current_bid_ptr;
bc_set_first_batch_list_entry (”BID_LIST”);
while (bc_batch_list_entry_exists (”BID_LIST”))
{
current_bid_ptr =
bc_get_batch_id_entry (”BID_LIST”);
/*
** Do something with the current batch ID,
** then go on to the next one.
*/
bc_set_next_batch_list_entry (”BID_LIST”);
}
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-57
C.48 bc_set_unit_end( )
INT bc_set_unit_end(unit_name)
CHAR *unit_name;
Description This function sets the ending time stamp, time string, and date string for
the unit identified by unit_name to the current time and date.
When the in_use bit of the unit status word goes off, these times will be set
automatically if they have not been set already by a call to
bc_set_unit_end( ); however, they may be overwritten with a call to this
function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sets the ending time stamp, time string, and date
string to the current date when the status bit oos goes high for oven1.
ON EVENT oven1:status:oos
{
bc_set_unit_end(”oven1”);
}
C-58 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.49 bc_set_unit_operation( )
Description This function defines the operation for the unit identified by unit_name. The
operation_name corresponds to the operation attribute of the unit tag and can
be any valid character string. If the string is too long, the function truncates
the string to a length of 10 characters before continuing execution. The
operation string appears in the unit tag detail screen.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example prints the operation string cooking in the unit tag
detail screen for the unit oven1 when the status bit run goes high for that
unit.
ON EVENT oven1:status:run
{
bc_set_unit_operation(”oven1”, ”cooking”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-59
C.50 bc_set_unit_start( )
INT bc_set_unit_start(unit_name)
CHAR *unit_name;
Description This function sets the starting time stamp, time string, and date string for
the unit identified by unit_name to the current time and date.
When the in_use bit of the unit status word goes on, these times will be set
automatically. Additionally, the end times are cleared for the unit. However,
the start times may be overwritten with a call to this function.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example sets the starting time stamp, time string, and date
string to the current date when the status bit run goes high for oven1.
ON EVENT oven1:status:run
{
bc_set_unit_start(”oven1”);
}
C-60 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.51 bc_split_batch( )
Description This function splits the batch referenced by system_batch_id. The new
split-off batch is named new_batch_id.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example splits off a new batch with custom ID set to
CHOC_CHIP_2 for the batch being processed in unit oven1 when the unit
run bit goes low. In order to obtain the batch’s system ID, which is required
for the call to bc_split_batch( ), the custom ID for the unit tag oven1 is first
retrieved and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_split_batch(system_id, ”CHOC_CHIP_2”);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-61
C.52 bc_trigger_request( )
INT bc_trigger_request(request_name)
CHAR *request_name;
Description This function triggers the action request identified by request_name. The
function sets the trigger bit that was defined during the configuration of the
action request.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example triggers the action request OVEN_ON when the status
bit run goes high for oven1.
ON EVENT oven1:status:run
{
bc_trigger_request(”OVEN_ON”);
}
C-62 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
C.53 bc_unlock_batch_id( )
INT bc_unlock_batch_id(system_batch_id)
CHAR *system_batch_id;
Description This function unlocks the batch identified by system_batch_id by setting the
id_locked attribute to UNLOCKED (or FALSE). After a batch ID is
unlocked, it can be changed.
Return Value ERROR Error occurred. The variable errno indicates the specific error.
NO_ERROR Normal return.
Example The following example unlocks the custom batch ID for the batch with
which the unit oven1 is associated when the in_use bit for oven1 goes low. In
order to obtain the batch’s system ID, which is required for the call to
bc_unlock_batch_id( ), the custom ID for the unit tag oven1 is first retrieved
and is then translated to the system ID.
#include <enum_types/batch.r>
#include <enum_types/b_i_d.t>
bc_get_batch_id(”oven1”, custom_bid);
bc_get_system_id(custom_bid, system_id);
bc_unlock_batch_id(system_id);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Batch Control Functions C-63
C-64 Batch Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix D
BCL Program Control Functions
D.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-2
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-1
D.1 Overview
This appendix describes the built-in functions that enable you to control the
operation of a BCL program while it is running. Each function description
consists of the following components.
Synopsis shows the syntax and data types for the parameters used by
the function.
Return value lists the possible return codes that the function may
produce.
D-2 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
D.2 bcl_auto_append( )
BOOLEAN bcl_auto_append( )
Parameters None
Description This function enables a BCL program to determine the setting of the
automatic append switch. The bcl_auto_append( ) function is useful when
you must set the switch to a particular setting and then return it to its
original setting at a later time.
Return Value TRUE Automatic append for a failed replace operation is enabled.
FALSE Automatic append for a failed replace operation is disabled.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-3
D.3 bcl_disable_auto_append( )
VOID bcl_disable_auto_append( )
Parameters None
Description This function disables the auto append feature that attempts to append a
record to the database if a replace operation fails. The auto append feature
remains disabled until the bcl_enable_auto_append( ) function executes.
D-4 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
D.4 bcl_disable_error_on_empty_delete( )
VOID bcl_disable_error_on_empty_delete( )
Parameters None
Description This function disables error reporting for delete operations that refer to
records that cannot be found when the operations are executed. This
function represents the default behavior of BCL programs under these
circumstances. The error reporting feature remains disabled until the
bcl_enable_error_on_empty_delete( ) function executes.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-5
D.5 bcl_disable_error_on_not_found( )
VOID bcl_disable_error_on_not_found( )
Parameters None
Description This function disables the generation of a system error message when a
BCL retrieve operation fails to find its intended target record in the
database. BCL programs normally issue an error message in such cases. In
order to suppress these error messages, this function must be called. This
error reporting feature will remain disabled until the
bcl_enable_error_on_not_found( ) function executes.
D-6 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
D.6 bcl_enable_auto_append( )
VOID bcl_enable_auto_append( )
Parameters None
Description This function enables the auto append feature that attempts to append a
record to the database if a replace operation fails. This function represents
the default behavior of BCL programs under these circumstances. This
feature applies only to replace operations that incorporate a WHERE clause.
The appended data record consists of the key data from the WHERE clause
and the data originally intended to be replaced. The auto append feature
remains enabled until the bcl_disable_auto_append( ) function executes.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-7
D.7 bcl_enable_error_on_empty_delete( )
VOID bcl_enable_error_on_empty_delete( )
Parameters None
Description This function enables error reporting for delete operations that refer to
records that cannot be found when the operations are executed. BCL
programs do not normally report errors of this type. The error reporting
feature remains enabled until the bcl_disable_error_on_empty_delete( )
function executes.
D-8 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
D.8 bcl_enable_error_on_not_found( )
VOID bcl_enable_error_on_not_found( )
Parameters None
Description This function enables the generation of a system error message when a BCL
retrieve operation fails to find its intended target record in the database.
This function represents the default behavior of BCL programs under these
circumstances. This error reporting feature remains enabled until the
bcl_disable_error_on_not_found( ) function executes.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-9
D.9 bcl_error_on_empty_delete( )
BOOLEAN bcl_error_on_empty_delete( )
Parameters None
Description This function enables a BCL program to determine the state of the empty
delete error switch. The bcl_error_on_empty_delete( ) function is useful when
you must set the switch to a particular state and then return it to its
original state at a later time.
D-10 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
D.10 bcl_error_on_not_found( )
BOOLEAN bcl_error_on_not_found( )
Parameters None
Description This function allows the BCL program to determine the state of the switch
that controls whether a system error message is generated when a BCL
retrieve operation fails to find its intended target record in the database.
This function is useful when you must set the switch to a particular state
and then return it to its original state at a later time.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Program Control Functions D-11
D.11 print_trace_message( )
VOID print_trace_message(message)
CHAR *message
Parameters message (in) Pointer to the character array containing the string
that the function sends to the trace file
Description This function appends the string in the message buffer to the trace output
file. The BCL program creates a trace file only if the --t option is specified
when the program is activated through the batch manager or the operating
system command line.
D-12 BCL Program Control Functions SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix E
Security Privileges for Commands
E.1 Security Privileges for Batch Commands and Batch Mode Commands . . . . . . . . . . . . . E-2
E.2 Security Privileges for Unit Commands and Batch Mode Commands . . . . . . . . . . . . . . . E-3
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Security Privileges for Commands E-1
E.1 Security Privileges for Batch Commands and Batch Mode Commands
NOTE: For user configuration security privileges, see the SIMATIC PCS 7
OSx Process Configuration Manual.
E-2 Security Privileges for Commands SIMATIC PCS 7 OSx 4.1.1 Batch Programming
E.2 Security Privileges for Unit Commands and Batch Mode Commands
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Security Privileges for Commands E-3
E-4 Security Privileges for Commands SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix F
Advanced BCL Programming Techniques
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Advanced BCL Programming Techniques F-1
F.1 BCL Access to Custom Database Tables
Who Should Read The information in this section is intended for SIMATIC PCS 7 OSx
This Appendix integrators and other advanced OSx users. It is assumed that the
reader/user is well-acquainted with the structure of the OSx database and
knows how to use ddl, the database utility program used to build the
database. If you are not experienced in these areas and have no need to add
custom tables to your OSx program, then this material is not important to
your application and can be ignored. If you think that you do need to
customize your database by adding tables specific to your application, please
consult a qualified SIMATIC PCS 7 OSx integrator.
Custom Database Each OSx database table has a privilege mask. This privilege mask is
Table Privileges defined by using the Privilege statement in the database table’s associated
.ddl file. In order for a BCL program to be able to modify a database table,
the Database Admin privilege must not be set. By not specifying any
privilege restrictions on the table, the table’s privilege mask has no
privileges set and BCL programs are able to freely manipulate the tables.
Or if any privilege flags are set as part of the table’s ddl definition, simply
refrain from specifying the Database Admin privilege for any of the table’s
attributes. This allows BCL programs to freely alter the table.
Definitions for the standard privilege flags in the database may be found in
database source file catalog.ddl in the /usr/tistar/data/db/tables directory.
F-2 Advanced BCL Programming Techniques SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Privilege Masks of The following warning must be adhered to in regard to privilege masks in
Standard Database standard database tables.
Tables
! WARNING
The standard tables contain configuration and operating information
maintained by the SIMATIC PCS 7 OSx system processes and may be identified
by the presence of the Database Admin privilege flag. Alteration of the
information in these tables by any custom program, including BCL programs,
may cause improper operation.
Alteration of the privilege masks of the standard OSx database tables to allow
BCL programs to alter their contents can cause unpredictable operations that
can result in death or serious injury to personnel and/or damage to the
equipment.
Do not attempt to delete records from standard OSx database tables or attempt
to replace attributes in any tables.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Advanced BCL Programming Techniques F-3
F.2 USER_MSG Event Blocks
Introduction The USER_MSG event block exists to allow BCL programs to interact with
OSx subsystems that issue response messages to the calling process’s input
queue. Writing BCL programs that interface in this manner requires
extensive experience with OSx system programming techniques and a high
degree of familiarity with OSx subsystems and their programming
interfaces. The information presented here is intended to provide only the
necessary details specific to the USER_MSG event block implementation to
allow the advanced system programmer to use this feature in conjunction
with the OSx subsystem interface libraries. BCL programmers wishing to
know more about these interfaces should consult a qualified SIMATIC
PCS 7 OSx system integrator.
Using the A USER_MSG event block executes when the BCL program receives an
USER_MSG Event input queue message that is not generated by a database change event nor
Block generated by the batch manager program. For example, a response message
from the network is one type of user message.
The block becomes active when it receives a message that the BCL program
kernel does not recognize. If your code does not recognize the message type,
use the USER_MSG block to generate an error message. If your BCL
program does not contain a block triggered on USER_MSG, the BCL
program kernel generates an error message and continues running.
F-4 Advanced BCL Programming Techniques SIMATIC PCS 7 OSx 4.1.1 Batch Programming
The code for this type of event block, whether it is written into the block or
in a function called by the block, must be able to distinguish between
expected and unexpected resource IDs. The following resource IDs are
handled internally and are already defined for all BCL programs.
#define BM_DB_EVENT_ID 1
#define BM_MGR_RSRC_ID 3
#define BM_BCPGM_RSRC_ID 4
The BCL program kernel initializes its interface to the network by calling
cs_init( ) with the following resource ID.
#define BM_UPDATE_REPLY_ID 2
When a message activates an event block, OSx stores the resource ID in the
global variable bcl_user_resource_id. To access this variable, you must include
the following declaration in your BCL program.
OSx stores the message in the standard OSx message buffer, which you can
access with any appropriate buffer access macro (for instance,
cs_event_data( ) enables you to access network messages).
SIMATIC PCS 7 OSx 4.1.1 Batch Programming Advanced BCL Programming Techniques F-5
F-6 Advanced BCL Programming Techniques SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Appendix G
BCL Application Programming Example
G.1 BCL Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Simple Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Sample Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2
Configuration Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-4
Program Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-5
Program Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-5
Event Block #1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-9
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-1
G.1 BCL Programming Example
This appendix contains a brief description and source code listings for
sample BCL application programs. As is generally the case with BCL
programs, the material in this section is intended for system integrators and
other programmers who are familiar with advanced OSx system
programming techniques.
Simple Program The following code directs the program to write the date and time stamp at
the end of the BCL trace output file.
#include <time.h>
ON EVENT trigger_spec
{
time_t time_now;
char msg[80];
time_now = time(NULL);
strftime(msg,78,”this is a time test message %D %T”,
localtime(&time_now));
print_trace_message(msg);
}
Sample Scenario The example program on the following pages implements a start-up
sequence for a simple batch process. The processing involved is limited to a
tank which processes some amount of raw material. Two tanks, designated
tank 1 and tank 4, are available for processing. The operator is responsible
for requesting that a batch be started and for entering parameters when
prompted by the system.
The control system provides a process control graphic which displays the
state of batches in progress and provides the means for the operator to start
new batches. The graphic includes an icon used as a “start” button.
Selecting this icon provides the event that initiates the processing
implemented in the BCL program.
When processing of the batch completes, the tank unit sets a bit which
triggers an event block in the BCL program that sets the batch ID into a
text tag which is used as a mailbox to communicate the ID to the batch
report. The BCL program then sets a bit which triggers execution of the
report.
G-2 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
When the report finishes, it resets a bit which triggers the BCL program’s
final clean-up block for the batch. At this point, the batch is finished and
becomes inactive.
The action blocks in the BCL program respond to and trigger batch start-up
events as shown in Figure G-1:
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-3
BCL Programming Example (continued)
Configuration The example program assumes the existence of the indicated tags and
Prerequisites action requests, the process control graphic display, and an appropriate
batch report. Configuration of these items is not covered in this example.
Refer to the following OSx user manuals for further details:
Tag Function
Numeric batch ID entered by operator in response to request BATCHID; answer tag for action
batchid
request BATCHID
batchid_rst Reset tag for action request BATCHID
charge6_1 Graphic display data: commit confirmation
charge6_2 Graphic display data: batch ID number (entered by operator)
charge6_3 Graphic display data: tank level selection
charge6_4 Graphic display data: tank selection
Charge level entered by operator in response to request CHRG_LVL; answer tag for action
chrg_lvl
request CHRG_LVL
chrg_lvl_rst Reset tag for action request CHRG_LVL
Answer tag for action request COMMIT; operator enters confirmation of batch start-up
commit
parameters
commit_rst Reset tag for action request COMMIT
Batch completion indicator for tank 1; attached to UNIT tag for tank 1; changed by unit’s
do_0 controller program or, for demonstration purposes, manually (that is, from the command line
using the database utility “menu”)
Batch completion indicator for tank 4; attached to UNIT tag for tank 4; changed by unit’s
do_4 controller program or, for demonstration purposes, manually (that is, from the command line
using the database utility “menu”)
start_00 Commanded by “start batch” button on graphic
Tank selection entered by operator in reponse to request TANK; answer tag for action request
tank
TANK
tank_rst Reset tag for action request TANK
Text tag used as mailbox to communicate batch ID to batch report; configured as non-networked
tex1 to allow changes to STATUS attribute; triggers report by setting ACTIVE bit in STATUS; report
resets ACTIVE bit which triggers BCL program to perform post-batch clean-up
G-4 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Program Events Action requests are used to prompt the operator to input the following
parameters required to start a batch. Action requests used in the example
are summarized in Table G-2.
Numeric batch ID
Charge level
Parameter confirmation
Program Source Source code for the batch charging example program consists of three files
Code as shown in Table G-3.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-5
BCL Programming Example (continued)
The following header file declares constants and variables used in the BCL
program charge.bcl.
/* ===================== */
/* Header file, charge.h */
/* ===================== */
/*
** Constants for the batch charging program, charge.bcl
*/
#define TRACE_MESSAGE_LENGTH 80
#define NEW_BATCH_VAR_HANDLE ”new_batch”
/*
** Error codes;
** Install suitable error messages in the ERR_MSGS table.
*/
G-6 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
The following pages contain the source code for the BCL program
charge.bcl. The program contains seven event blocks.
/* ============================ */
/* BCL program file, charge.bcl */
/* ============================ */
/*
** Batch charging control program
**
** This file contains blocks for events 1 through 7.
*/
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-7
BCL Programming Example (continued)
/* Event #1
**
** When the ”start” button on the graphic is pushed,
** trigger the request for the batch identifier.
*/
£ if (cmd != 0)
{
¤ if (bc_trigger_request (”BATCHID”) == ERROR)
{
¥ sprintf (msg, ”Request BATCHID trigger failed, %d\n”, errno);
print_trace_message (msg);
}
else
{
¦ print_trace_message (”Request BATCHID triggered OK.\n”);
}
}
}
G-8 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Event Block #1 Event block #1 is triggered when the operator selects the Start button icon.
Event block #1 triggers the action request for the operator to enter the
batch ID.
When the start button icon is selected on the graphic screen the tag start_00
is changed.
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-9
BCL Programming Example (continued)
/* Event #2
**
** When the batch identifier request has been answered,
** save the identifier information
** and trigger the request for the charge level.
*/
ON EVENT batchid_rst:command:0x8000 RESET
{
static CHAR var_id [] = NEW_BATCH_VAR_HANDLE;
CHAR msg [TRACE_MESSAGE_LENGTH];
print_trace_message (”Request BATCHID has been answered.\n”);
INIT_VAR h_vars, var_id;
if (h_vars == NULL)
{
print_trace_message (”h_vars allocation failed.\n”);
return (ERROR);
}
/* Get batch identification number entered by operator
*/
EXEC (&h_vars->batch_id_number) <- batchid:value;
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Batch identifier fetch failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
sprintf (msg, ”ID = %d\n”, h_vars->batch_id_number);
print_trace_message (msg);
/* Put batch identifier on display
*/
EXEC charge6_2:value <- (&h_vars->batch_id_number);
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Batch identifier display value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
G-10 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
/* Trigger charge level entry request
*/
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-11
BCL Programming Example (continued)
/* Event #3
**
** When the request for charge level has been answered,
** convert and store the level information
** and trigger the request for the tank number.
*/
if (h_vars == NULL)
{
print_trace_message (”h_vars allocation failed.\n”);
return (ERROR);
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Charge level fetch failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
switch (h_vars->level)
{
case CHOICE_1_VALUE: /* Definitions for CHOICE_n_VALUE */
h_vars->level = 1; /* are found in Action Request */
break; /* header file ac_defs.h. */
G-12 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
case CHOICE_2_VALUE:
h_vars->level = 2;
break;
case CHOICE_3_VALUE:
h_vars->level = 3;
break;
default:
XMT_ERR (”charge.bcl”, CHRG_LVL_ERR, ”Invalid level”);
print_trace_message (”Invalid level\n”);
break;
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Charge level value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Charge level display value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-13
BCL Programming Example (continued)
G-14 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
/* Event #4
**
** When the tank number request has been answered,
** convert and store the tank number information
** and trigger the commit request.
*/
if (h_vars == NULL)
{
print_trace_message (”h_vars allocation failed.\n”);
return (ERROR);
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Tank number fetch failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
switch (h_vars->tank)
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-15
BCL Programming Example (continued)
{
case CHOICE_1_VALUE: /* Definitions for CHOICE_n_VALUE */
h_vars->tank = 1; /* are found in Action Request */
break; /* header file ac_defs.h. */
case CHOICE_2_VALUE:
h_vars->tank = 4;
break;
default:
XMT_ERR (”charge.bcl”, 9999, ”Invalid tank”);
print_trace_message (”Invalid tank\n”);
break;
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Tank number value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Tank number display value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
G-16 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
/* Trigger request for parameter confirmation
*/
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-17
BCL Programming Example (continued)
/* Event #5
**
** When the commit request has been answered and confirmed,
** initiate the batch. If the request was not confirmed
** or the initiation operation fails, reset all the information
** collected for the prospective batch. In either case,
** reset the new batch request trigger.
*/
SINT16 answer;
CHAR batch_id [T_B_I_D_LENGTH];
CHAR system_id [T_B_I_D_LENGTH];
CHAR unit_name [T_TAGS_LENGTH];
CHAR msg [TRACE_MESSAGE_LENGTH];
if (h_vars == NULL)
{
print_trace_message (”h_vars allocation failed.\n”);
return (ERROR);
}
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Confirmation fetch failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
G-18 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
if (answer == CHOICE_1_VALUE)
{
/* Print batch parameters to trace file
*/
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Confirmation value replace failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
if (b_vars == NULL)
{
print_trace_message (”b_vars allocation failed.\n”);
return (ERROR);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-19
BCL Programming Example (continued)
G-20 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Charge initiator reset failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
return (NO_ERROR);
}
/* This example does not include processing
** associated with the batch once it’s been initiated.
** Event blocks to support that part of the operation
** can be coded here or in a second BCL program file.
*/
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-21
BCL Programming Example (continued)
/* Event #6
**
** When a batch completion button is activated,
** determine which batch is completing and get it’s ID.
** Put the ID in the report mailbox.
** Set the trigger for the batch completion report.
**
** Note: Tag do_0 is part of the UNIT for tank 1.
** Tag do_4 is part of the UNIT for tank 4.
*/
ON EVENT do_0:command:0x0001
OR do_4:command:0x0001
{
static CHAR tag_do_0 [] = ”do_0”;
static CHAR tag_do_4 [] = ”do_4”;
SINT16 reset = 0;
CHAR custom_batch_id [T_B_I_D_LENGTH];
CHAR msg [TRACE_MESSAGE_LENGTH];
CHAR *tag_name;
switch (BCL_block_event_id)
{
case 0:
tag_name = tag_do_0;
break;
case 1:
tag_name = tag_do_4;
break;
default:
(VOID) sprintf (msg, ”Invalid block_event_id, %d\n”,
BCL_block_event_id);
tag_name = NULL;
break;
}
if (tag_name != NULL)
{
(VOID) sprintf (msg, ”Terminating tag is %s\n\n”, tag_name);
print_trace_message (msg);
G-22 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
/* Get the current batch ID
** for the tag that triggered this block.
** The tag’s batch ID was initialized
** when the unit was assigned to the batch.
*/
return (ERROR);
}
else
{
/* Store batch ID in ”mailbox” so report can get it.
*/
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Batch ID mailbox replace failed, %d\n”, errno);
print_trace_message (msg);
}
LATCH tex1:status:active;
if (BCL_error == ERROR)
{
(VOID) sprintf (msg,
”Report trigger latch operation failed, %d\n”, errno);
print_trace_message (msg);
}
else
{
print_trace_message (”Report trigger set.\n”);
}
}
}
return (NO_ERROR);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-23
BCL Programming Example (continued)
/* Event #7
**
** When the report finishes executing,
** clean up and terminate the batch.
** The report is responsible for resetting
** the ”active” bit of tag tex1’s STATUS attribute.
*/
ON EVENT tex1:status:active RESET
{
CHAR custom_batch_id [T_TEXT_TEXT_1_LENGTH];
CHAR system_id [T_B_I_D_LENGTH];
CHAR msg [TRACE_MESSAGE_LENGTH];
SINT16 reset = 0;
print_trace_message (”Report completion signal received.\n”);
if (BCL_error == ERROR)
{
(VOID) sprintf (msg, ”Batch ID fetch failed, %d\n”, errno);
print_trace_message (msg);
return (ERROR);
}
G-24 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
if (bc_release_all (system_id) == ERROR)
{
(VOID) sprintf (msg, ”bc_get_system_id failed, %d\n”,
errno);
print_trace_message (msg);
}
else
{
/* Command batch to completed state;
** Definitions for batch commands (i.e. B_CMD_*)
** are found in enum_types/b_cmd.t
*/
return (NO_ERROR);
}
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-25
BCL Programming Example (continued)
The following pages contain the C source code for creating unit and batch
tags required to initiate a new batch. This program is called from Event
Block #5 of the charge.bcl program.
/* =========================================== */
/* Source for C function, initiate_new_batch() */
/* Source file == inb.c */
/* =========================================== */
/*
**initiate_new_batch
**
**.DESCRIPTION
** This function performs the operations necessary to establish a new
batch.
**
**.METHOD
** Validate input parameters.
** Allocate a batch tag.
** Generate custom batch ID string.
** Assign custom ID to batch.
** Make unit name from tank number.
** Assign unit to batch.
** Set unit start time.
**
**.NOTES
** Compile this file using:
** cc -c -O -I/usr/tistar/include -I/usr/tistar/hist/batch/include inb.c
** Archive object file for BCL link using: usrbcl inb.o
*/
/* ======================================================= */
/* In addition to the header files listed in Section 3.5, */
/* which are inserted automatically when you compile, */
/* this program needs the following #include statements: */
/* ======================================================= */
#include <err_base.h>
#include <enum_types/tag_xref.r>
G-26 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
SINT16 id; /* IN: Numeric batch identifier */
SINT16 tank; /* IN: Tank ID number */
CHAR *sys_id; /* OUT: Internal (system) batch identifier */
CHAR *batch_id; /* OUT: Custom batch ID */
CHAR *unit_name; /* OUT: Unit (tag) name */
{
CHAR desc [T_T_DESC_LENGTH];
/* Generate ID string
**
** Algorithms for generating custom batch ID strings
** are usually application-specific.
** In this case, the custom ID is generated
** by appending the suffix ”-87”
** to the ID number entered by the operator.
*/
SIMATIC PCS 7 OSx 4.1.1 Batch Programming BCL Application Programming Example G-27
BCL Programming Example (continued)
return (NO_ERROR);
}
G-28 BCL Application Programming Example SIMATIC PCS 7 OSx 4.1.1 Batch Programming
Index
components
A BCL, 1-4
Accessing controller-requested commands, 1-4, 5-2
batch directory, 7-8 logs and reports, 1-5
batch logs/reports, 6-3 prerequisites, 1-8
batch unit display, 7-20 responsibilities, 1-2
BCL Program Administration dialog box, 4-2 releasing units, 7-13
unit faceplate, 7-26 security privilege, E-2
unit tag detail (batch), 7-22 database tables, F-2
splitting, 7-17
Active batch starting, 7-14
directory, 7-8 tag detail, viewing, 7-10
tags, 7-9 tracking, 5-2
Assigning unit faceplate, displaying, 7-26
batch tag attributes, A-2 unit tag detail, displaying, 7-22
batch unit tags, A-7 unit tag groups, displaying, 7-18
batch units, 7-12 Batch control language (BCL), 1-4, 3-2
security privileges, batch control, E-2 control functions, C-4
bc_activate_autolog, C-6
bc_add_batch_list_entry, C-7
B bc_allocate_batch, C-8
bc_assign, C-9
Batch bc_assign_graphic, C-10
assigning units, 7-12 bc_assign_id, C-11
changing mode, 7-16 bc_batch_list_entry_exists, C-12
changing state, 7-14 bc_clear_unit_elements, C-13
changing unit mode, 7-25 bc_copy, C-14
changing unit state, 7-24 bc_create_batch_list, C-15
configuration bc_deactivate_autolog, C-16
committing, 7-7 bc_destroy_all_batch_lists, C-17
prerequisites, 2-2, 7-2 bc_destroy_batch_list, C-18
using batch ID, 7-4 bc_exit, C-19
data, hierarchy, 1-3 bc_get_batch_id, C-20
displaying active batch tag group, 7-9 bc_get_batch_id_entry, C-21
displaying active batches, 7-8 bc_get_batch_mode, C-22
ending, 7-18 bc_get_batch_state, C-23
graphic, viewing, 7-10 bc_get_custom_id, C-24
log destination, 2-5 bc_get_printer_mask, C-25
logs and reports, 1-5, 6-2 bc_get_system_id, C-26
operation, viewing, 7-10 bc_get_unit_mode, C-27
OSx database tables, F-3 bc_get_unit_state, C-28
processing bc_load, C-29
component interaction, 1-6
Index-1
Batch control language (BCL) Batch control language (BCL)
control functions (continued) program control functions
bc_lock_batch_id, C-30 bcl_enable_auto_append, D-7
bc_log_comment, C-31 bcl_enable_error_on_empty_delete, D-8
bc_log_operation, C-32 bcl_enable_error_on_not_found, D-9
bc_log_value, C-33 bcl_error_on_empty_delete, D-10
bc_print_batch_list, C-34 bcl_error_on_not_found, D-11
bc_release, C-35 print_trace_message, D-12
bc_release_all, C-36 programming
bc_release_graphic, C-37 avoiding invalid bit names, 3-31, 3-35
bc_remove_batch_list_entry, C-38 compiling, 4-4, 4-14
bc_request_batch_mode, C-40 defining variables, 3-13
bc_request_batch_state, C-42 example, G-2
bc_request_unit_mode, C-44 installing, 4-8, 4-16
bc_request_unit_state, C-46 mapping tag names, 3-14
bc_scale_recipe, C-48 modifying, 4-6
bc_select, C-49 prerequisites, 3-4
bc_set_batch_end, C-50 removing, 4-11, 4-12, 4-13, 4-22
bc_set_batch_operation, C-51 reserved keywords, 3-10
bc_set_batch_product, C-52 runtime options, 4-6
bc_set_batch_start, C-53 starting/halting, 4-9, 4-19
bc_set_first_batch_list_entry, C-54 steps, 3-9
bc_set_log_destination, C-55 translating to C language, 3-12
bc_set_next_batch_list_entry, C-56 triggering event blocks, 3-20
bc_set_unit_end, C-58 UNIX command line options, 4-7, 4-20
bc_set_unit_operation, C-59 reports
bc_set_unit_start, C-60 editor functions, 6-4
bc_split_batch, C-61 generating, 6-4
bc_trigger_request, C-62 running program
bc_unlock_batch_id, C-63 automatically, 4-9
database, accessing tables, F-2 control functions, 3-34, D-2
errors, 3-31 manually, 4-9
error handling code, 3-35 statements
invalid bit names, 3-31 #include, 3-12
event block instructions, user_msg, F-4 define, 3-13
halting program, 4-10 on event, trigger_spec options, 3-20
library functions, controlling batch unit map, 3-14
operations, 3-32 user_msg, F-4
multiple-station systems, 3-7
Batch ID, 6-2, C-4
networked tag:attributes, 3-6
assigning, 7-5
program components, 3-3
log destination, 7-6
program control functions
bcl_auto_append, D-3 Batch request commands, 5-2, 5-3
bcl_disable_auto_append, D-4 Batch tag (BCH), A-2
bcl_disable_error_on_empty_delete, D-5
bcl_disable_error_on_not_found, D-6 BCL. See Batch control language
Index-2
C E
Cascaded menu, 1-11 Error, batch control language (BCL)
error handling code, 3-35
Changing
invalid bit names, 3-31
batch mode, 7-16
batch state, 7-14 Event block
batch unit mode, 7-25 available instructions, 3-24
batch unit state, 7-24 example, 3-30
BCL program, 4-6 syntax, 3-16
trigger_spec options, 3-20
Compiling, BCL program, 4-4
from UNIX command line, 4-14 Executing, BCL program, from UNIX command
line, 4-17
Configuration
batch, 2-2
committing, 7-7
prerequisites, 7-2 F
using batch ID, 7-4
planning sheets, B-1 Faceplate
unit tag, 2-6 active batch tags, 7-9
batch unit, 7-26
Controlling
batch operation, C-4
with library functions, 3-32
BCL program, 3-34, D-2
H
from UNIX command line, 4-17 Halting, BCL program, 4-10
Creating
batch requests, 5-2
BCL program, 3-9 I
event blocks, BCL program, 3-16, F-4
ID. See Batch ID
Include statement, batch control language
D (BCL), 3-12
Index-3
Linking
APT extension to unit tag, 2-7
R
unit tags to process I/O tags, 2-7 Radio button, 1-10
Log destination, batch, 2-5, 7-6 Releasing, units from a batch, 7-13
Logging batch information, 6-2 Removing
batch, 7-20
BCL program, 4-11, 4-22
M Report, batch control language (BCL), 6-4
Mapping units, BCL program, 3-14 Running BCL program from UNIX command
line, 4-17
N
S
Navigational tools, 1-10
cascaded menu, 1-11 Save pushbutton, 1-11
pushbutton, 1-10
Saving
radio button, 1-10
ok pushbutton, 1-11
slider, 1-10
save pushbutton, 1-11
text browser, 1-10
toggle button, 1-10 Security privilege, functions
batch commands, E-2
batch modes, E-2, E-3
batch unit commands, E-3
O database tables, F-2
OK pushbutton, 1-11 Slider, 1-10
On event statement, batch control language Special event block identifiers, 3-18
(BCL), trigger_spec options, 3-20
Splitting a batch, 7-17
Starting/halting, BCL program, 4-9
P from UNIX command line, 4-19
Starting/stopping, batch, 7-14, 7-18
Planning
batch program, 2-2
BCL program, 3-4
Planning sheets, configuration, B-1
T
PLC. See Controller models Tag detail, display
batch (BCH), 7-10
Primary, new primary command, and BCL unit (UNIT), 7-22
program, 4-3
Tag group
Printer, log destination, batch, 7-6 active batch, displaying, 7-9
Process control, batch, 1-2 batch units, displaying, 7-20
Pushbutton, 1-10 Text browser, 1-10
Index-4
Toggle button, 1-10 Updating, BCL program, 4-13
Troubleshooting
BCL errors, 3-35
halting BCL program, 4-10 W
WHERE clause
delete format, 3-29
U replace format, 3-28
retrieve format, 3-27
Unit map statement, batch control language
(BCL), 3-14 WHERE clauses, referencing controller-resident
data, 3-19
Unit tag (UNIT), A-7
APT extensions, 2-7
configuration, 2-6
Index-5
Index-6
Customer Response
We would like to know what you think about our user manuals so that we can serve you better.
How would you rate the quality of our manuals?
Would you be interested in giving us more detailed comments about our manuals?
Your Name:
Title:
Telephone Number: ( )
Company Name:
Company Address:
Manual Name: SIMATIC PCS 7 OSx 4.1.1 Batch Programming Manual Edition: Original
Manual Assembly Number: 2806854-0001 Date: 1/01
Order Number: 6ES7 6550XX048BC4
FOLD
FOLD