Rockwell Automation FactoryTalk Batch Original Instructions

Reference Manual

FactoryTalk Batch PC-Based Phase Programming

Reference Manual
FactoryTalk Batch Components 14.00
Rockwell Automation Publication BATCH-RM008A-EN-D - October 2020
Original Instructions
personal injury or death, property damage, or economic loss.
Identifies information about practices or circumstances that can lead to personal injury or death, property damage, or economic loss.
Attentions help you identify a hazard, avoid a hazard, and recognize the consequence.
IMPORTANT
Identifies information that is critical for successful application and understanding of the product.
Labels may be on or inside the equipment, for example, a drive or motor, to alert people that surfaces may reach dangerous
temperatures.
Labels may be on or inside the equipment, for example, a motor control center, to alert people to potential Arc Flash. Arc Flash
for Personal Protective Equipment (PPE).

Important User Information

Read this document and the documents listed in the additional resources section about installation, configuration, and operation of this equipment before you install, configure, operate, or maintain this product. Users are required to familiarize themselves with installation and wiring instructions in addition to requirements of all applicable codes, laws, and standards.
Activities including installation, adjustments, putting into service, use, assembly, disassembly, and maintenance are required to be carried out by suitably trained personnel in accordance with applicable code of practice.
If this equipment is used in a manner not specified by the manufacturer, the protection provided by the equipment may be impaired.
In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of this equipment.
The examples and diagrams in this manual are included solely for illustrative purposes. Because of the many variables and requirements associated with any particular installation, Rockwell Automation, Inc. cannot assume responsibility or liability for actual use based on the examples and diagrams.
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or software described in this manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to
ATTENTION:
Labels may also be on or inside the equipment to provide specific precautions.
SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that dangerous voltage may be present.
BURN HAZARD:
ARC FLASH HAZARD:
will cause severe injury or death. Wear proper Personal Protective Equipment (PPE). Follow ALL Regulatory requirements for safe work practices and
2
Preface
PC-based phases
Create a PC-based phase
Use a PC-based phase

Table of Contents

About this manual ....................................................................................... 5
Legal Notices ............................................................................................... 5
Additional resources ................................................................................... 6
Chapter 1
PC-based phase overview .......................................................................... 11
PC-based phases......................................................................................... 12
PC-based phase execution ................................................................... 12
Chapter 2
Add the Batch Phase Execution control to a Visual Basic project .......... 15
Place the Batch Phase Execution control on a form .......................... 16
Set the PC-based phase properties ..................................................... 16
Set custom properties in the Property Pages dialog box ............ 16
Program the PC-based phase .............................................................. 17
Methods ................................................................................................ 18
Events .................................................................................................... 19
Event example using OnRestart event ......................................... 19
Create the executable ........................................................................... 19
Add the phase execution control to a Visual C++ project ....................... 20
Create a new project ........................................................................... 20
Add the control to the project ............................................................. 20
Add the control to the dialog .............................................................. 20
Access control properties from Visual C++ ....................................... 20
Configure the BaseTagName property............................................... 21
Add control events................................................................................ 21
Add a member variable derived from the Phase Control Class ........ 21
Add phase logic to event handlers....................................................... 21
General usage signature requests ............................................................. 21
Parameter and report parameter limits .................................................. 22
Distribute PC-based phase applications .................................................. 22
3
Chapter 3
Update the area model ...............................................................................23
Change the default tag separators for a PC-based phase................. 24
Set tag items to default names ........................................................... 25
Add the new phase to a recipe .................................................................. 26
Run a recipe with a PC-based phase ........................................................ 26
Appendix A
Table of Contents
Properties, methods, and
Application notes and example Index
events
phase
Properties .................................................................................................. 27
Methods ......................................................................................................32
Events ......................................................................................................... 34
Appendix B
Application notes ....................................................................................... 35
PC-based phase example ........................................................................... 37
Create a new PC-based phase ................................................................... 39
Add a new data server definition to an area model ........................... 39
Use limit tags on a PC-based phase ................................................... 40
Add limit tags to a PC-based phase ..................................................... 41
4

About this manual

Legal Notices

Preface

This manual provides usage instructions for the FactoryTalk Batch PC-Based Phase programming. It is one of a set of related manuals that describe
installing, programming, and operating the FactoryTalk Batch system.
To review FactoryTalk Batch release notes and latest information regarding product compatibility refer to the
Center (PCDC).
Rockwell Automation publishes legal notices, such as privacy policies, license agreements, trademark disclosures, and other terms and conditions on the
Legal Notices
page of the Rockwell Automation website.
End User License Agreement (EULA)
You can view the Rockwell Automation End User License Agreement (EULA) by opening the license.rtf file located in your product's install folder on your hard drive.
Product Compatibility and Download
The default location of this file is:
C:\Program Files (x86)\Common Files\Rockwell\license.rtf
Open Source Software Licenses
The software included in this product contains copyrighted software that is licensed under one or more open source licenses.
You can view a full list of all open source software used in this product and their corresponding licenses by opening the oss_license.txt file located your product's OPENSOURCE folder on your hard drive. This file is divided into these sections:
Components
Includes the name of the open source component, its version number, and the type of license.
Copyright Text
Includes the name of the open source component, its version number, and the copyright declaration.
Licenses
Includes the name of the license, the list of open source components citing the license, and the terms of the license.
5
Preface
Resource
Description
FactoryTalk Batch eProcedure® Getting Results
Explains the basics of FactoryTalk Batch eProcedure.
Resource
Description
FactoryTalk Batch ActiveX Controls User Guide
Provides information and instructions for using the

Additional resources

The default location of this file is:
C:\Program Files (x86)\Common Files\Rockwell\Help\<product name>\Release Notes\OPENSOURCE\oss_licenses.txt
You may obtain Corresponding Source code for open source packages included in this product from their respective project web site(s). Alternatively, you may obtain complete Corresponding Source code by contacting Rockwell Automation via the Contact form on the Rockwell Automation website:
http://www.rockwellautomation.com/global/about­us/contact/contact.page. Please include "Open Source" as part of the request
text.
F
ollowing is a comprehensive list of documentation for the FactoryTalk®
Batch products from Rockwell Automation.
Installation, Quick Start, and Getting Results Guides
FactoryTalk Batch Components Installation and Upgrade Guide
(BATCH-IN002)
FactoryTalk Batch View Quick Start Guide (FTBVS-QS001)
FactoryTalk Batch View HMI Controls Quick Start Guide (BATCH-QS001D)
Guide (BWEPRO-GR011)
FactoryTalk Batch Getting Results Guide (BATCH-GR011)
FactoryTalk Batch Material Manager Getting Results Guide (BWMTR-GR011)
Provides information and procedures for FactoryTalk Batch system installation. Includes information for FactoryTalk Batch Material Manager, FactoryTalk Event Archiver, and associated FactoryTalk Batch Client and Server components.
Provides information about using FactoryTalk Batch View to create, view, and command control recipes, acknowledge prompts and signatures, view equipment phases and diagnostic information, and view profile information.
Provides a general overview of FactoryTalk Batch View HMI Controls.
Introduces the basics of automated batch manufacturing and the FactoryTalk Batch product components.
Introduces the basics of FactoryTalk Batch Material Manager.
6
User Guides
(BATCH-UM013)
FactoryTalk Batch ActiveX Custom Controls.
Resource
Description
FactoryTalk Batch Material Editor User Guide
Provides access to information and procedural
reference for the formulator.
FactoryTalk Batch PhaseManager™ User Guide
Describes the integration of the FactoryTalk Batch
your Logix 5000 controller.
FactoryTalk Batch Recipe Editor User Guide
Provides instructions on using FactoryTalk Batch Recipe
FactoryTalk Batch View HMI Controls User Manual
Provides details about using FactoryTalk Batch View HMI
FactoryTalk Batch Server.
reference information by the operator.
FactoryTalk Batch View User Guide (legacy)
Provides information and instructions on how to use
Preface
(BWMTR-UM001)
FactoryTalk Batch Equipment Editor User Guide (BATCH-UM004)
(BATCHX-UM011)
(BATCH-UM006)
instructions required to configure materials and the containers to hold them. The material data is stored in the material database, which is used to create material­based recipes. This information is intended as a
Provides information on creating and maintaining an equipment database (area model). The area model is stored in a file with a .cfg file extension and is available to all other FactoryTalk Batch programs, including the Recipe Editor, View, and Phase Simulator.
software with the Studio 5000 Logix Designer® application and the Logix 5000™ family of controllers. The integration simplifies the configuration and maintenance of the FactoryTalk Batch automation system, provides better communication between the FactoryTalk Batch Server and the Logix 5000 controller, and significantly reduces the programming effort required to develop the phase logic code that resides in
Editor to create and configure master recipes for use in batch automation. The interface is based on IEC 61131-3 sequential function charts to graphically organize recipes into procedures, unit procedures, operations, and phases. Build recipes using either the SFC format or a table-based format.
(FTBVS-UM003)
FactoryTalk Batch View User Manual (FTBVS-UM002)
FactoryTalk eProcedure Client User Guide (BWEPRO-UM001)
FactoryTalk Event Archiver User Guide (BATCH­UM012)
(FTBVS-UM001)
Controls to monitor and interact with the production process within a FactoryTalk View SE Display Client.
Provides information and procedural instructions for using FactoryTalk Batch View in a modern and intuitive portal into a comprehensive batching solution for effective operations, leveraging its own web server using HTML5 technology to provide native connectivity into a
Provides information and procedural instructions required to create and command batches using the FactoryTalk eProcedure Client, and can be used as a
Provides information and instructions specific to the FactoryTalk Event Archiver. Intended for use by the system administrator and production supervisor.
FactoryTalk Batch View to initiate and execute FactoryTalk Batch automation processing. FactoryTalk Batch View secured objects are located in the FactoryTalk Diagnostics and are modified using the FactoryTalk Administration Console. A system administrator can customize FactoryTalk Batch View security to meet the needs of the facility. FactoryTalk Batch View is used in conjunction with a Human-Machine Interface (HMI).
7
Preface
Resource
Description
FactoryTalk Batch eProcedure Administrator Guide
Provides procedures specific to FactoryTalk Batch
(BWEPRO-UM011)
Resource
Description
(BATCH-RM001)
(BATCH-RM004)
FactoryTalk Batch System Files Reference Manual
Provides the technical information for configuration and
engineers and the system administrator.
reference by the instruction file author.
Administrator Guides
FactoryTalk Batch Administrator Guide (BATCH-UM003)
(BWEPRO-UM011)
FactoryTalk Batch Material Manager Administrator Guide
Reference Guides
FactoryTalk Batch ActiveX Controls Library Reference Guide
FactoryTalk Batch Material Server API Technical Reference (BWMTR-RM001)
FactoryTalk Batch PCD Programming Reference Manual
FactoryTalk Batch Server API Reference Manual (BATCH-RM003)
Provides instructions for configuring security and services, and implementation and use of components not typically accessed or used by batch operators, such as the FactoryTalk Batch Server.
eProcedure, such as implementing security and configuring the user-defined area Active Server Page. Included are instructions for tasks specific to FactoryTalk Batch, such as configuring security and services to support FactoryTalk Batch eProcedure. Provides instructions on the implementation and use of components not typically accessed or used by batch operators, such as the FactoryTalk Batch Server.
Provides information and instructions specific to FactoryTalk Batch Material Manager. Intended for use by the system administrator and database administrator.
Provides reference information and procedural instructions for the FactoryTalk Batch ActiveX Custom Controls.
Provides access to information regarding the interface between the FactoryTalk Batch Material Server and the FactoryTalk Batch Material Editor and FactoryTalk Batch. It is intended to be used as a reference information by those who want to develop custom interfaces.
Provides information and instructions about the FactoryTalk Batch PCD interface design. It is intended to be used as a reference guide.
Provides information regarding the interface between the FactoryTalk Batch Server and FactoryTalk Batch View — the Server Application Programming Interface (API). It is intended to be used as a reference guide by those who want to develop custom interfaces.
8
(BATCH-RM005)
FactoryTalk Batch eProcedure Instruction File Design Reference Manual (BWEPRO-RM001)
maintenance of a FactoryTalk Batch system. It can be used as a reference information for implementation
Includes information about the building of instruction files for use in equipment database creation and recipe development. This information is intended to be used as a
View or download publications at
http://www.rockwellautomation.com/literature. To order paper copies of
technical documentation, contact your local Allen-Bradley® distributor or sales representative.
Preface
9
IMPORTANT
the batcheqp.ini file.
to a Visual Basic project.)

PC-based phase overview

Chapter 1
PC-based phases
This guide was developed to provide information and procedures required to create and use PC-based phases, and is intended to be used as a reference guide.
DDE server is no longer supported. When upgrading from RSBatch 4.X or an earlier version, set all tags to use an OPC server. Also, due to a functional address change in batchphs.ocx, the tag separator has changed from an underscore (_) to a period (.). Change the FactoryTalk Batch Equipment Editor tag separator to a period by editing
The PC-Based Phase option is an ActiveX control that allows you to design
phases for use in FactoryTalk Batch recipes. Use these phases for a variety of tasks, such as operator prompts, timers and calculations. A PC-based phase communicates with the FactoryTalk Batch Server, and does not require a process-connected device. Use in place of phase logic to decrease the amount of memory required within a process-connected device.
PC-based phases use the Batch Phase Execution control, which encapsulates the FactoryTalk Batch phase logic interface and the OPC interface. The Batch Phase Execution control functions as a data server for PC-based phases and supports the full functionality of a FactoryTalk Batch phase. It is an SP88­aware component and is used to provide Level 2 control of the FactoryTalk Batch control system. The Batch Phase Execution control is a persistent component that supports automatic checkpointing. It can be accessed directly from within Visual Basic, Access, or any other Microsoft-compatible control container.
Tip: The Batch Phase Execution control is part of a group of FactoryTalk Batch ActiveX controls found in the BATCHPHS.OCX file. When distributing your application, you may install the
BATCHPHS.OCX
Microsoft Visual Basic Programmer’s Guide
file in any directory, as long as the control is properly registered. (See the
for more information on how to add an ActiveX control
See also
Create a new PC-based phase on page 39
Use a PC-based phase on page 23
Properties, methods, and events on page 27
11
Application notes and example phase on page 35
Chapter 1 PC-based phases

PC-based phases

PC-based phase execution

A PC-based phase allows you to program a phase outside of a process-
connected device (PCD). You can program the phase to meet your own unique requirements from within your Microsoft-compatible control container. The PC-based phase works the same way as any phase defined in a PCD, communicating with the FactoryTalk Batch Server through the Batch Phase Execution control. This saves your system’s memory for processes requiring interaction with hardware.
After a PC-based phase is created, the FactoryTalk Batch area model must be updated to include the new phase and the appropriate equipment module(s). Because the Batch Phase Execution control behaves as a data server, a new data server definition must be created. The data server definition is created using FactoryTalk Batch Equipment Editor, and defined using the Batch Phase Execution control’s communication parameters. The phase can then be added to your recipes. The PC-based phase must remain active during recipe execution, allowing the phase to communicate with the FactoryTalk Batch Server through the Batch Phase Execution control.
An activity log file is created for each PC-based phase when it runs. This log file, Singleton.log, is written to the WINDOWS\system32 directory.
See also
PC-based phase execution on page 12
The following is an example of a PC-based phase executing within a recipe.
The PC-based phase is created to prompt the operator to take a sample to the Quality control and then enter the results. The phase communicates with the FactoryTalk Batch Server by way of the Batch Phase Execution control. The phase can direct the server to prompt the operator, wait for results and have
12
PC-Based
Phase:
QC_Chk
Batch
Server
Operator Interface
1. Have QC take a sample
2. Enter QC Results
Electronic Batch Record
QC Results Added
Phase
Execution
Control
3
2
Temp_Ctl:1Recirc:1
Charge_X:1
Charge_X:1.State = Complete
QC_Chk:1
Dump_1:1.State = Complete
QC_Chk:1.State = Complete AND QC_Result <= 100
Recirc:1.State = Complete AND Temp_Ctl:1.State = Complete
1
4
Activity
Log File
Dump_1:1
Chapter 1 PC-based phases
the server store the result in the electronic batch record. The recipe only proceeds if the result is within the appropriate range.
13
Chapter 1 PC-based phases
1. As the batch is processed, the QC_Chk phase is executed.
2. The QC_Chk phase displays a screen to the operator, requesting that the operator have QC take an in-process sample. The QC_Chk phase does not continue processing until the operator enters the QC result.
3. When the operator enters the result, the QC_Chk phase sends the report value to the FactoryTalk Batch Server by way of the Batch Phase Execution control. The Batch Phase Execution control stores the value in the electronic batch record. While the phase is executing, an activity log file is updated with process events.
4. Control is returned to the recipe, and it continues processing the balance of the transitions and steps.
See also
PC-based phases on page 12
Application notes and example phase on page 35
14
Add the Batch Phase
Chapter 2
Create a PC-based phase
A PC-based phase is created using the Batch Phase Execution control and an OPC container application. The control is added to the container application, placed in the appropriate medium (form, spreadsheet, document, etc.), and its properties, methods, and events defined.
The instructions included in this section relate to creating a PC-based phase within Visual Basic. If you choose to implement a PC-based phase in an application other than Visual Basic, on the Control Toolbox, click More Controls to retrieve the Batch Phase Execution control.
See also
Execution control to a Visual Basic project
Add the phase execution control to a Visual C++ project on page 20
General usage signature requests on page 21
Parameter and report parameter limits on page 22
Distribute PC-based phase applications on page 22
The Batch Phase Execution control must be added to the Visual Basic toolbox in order to make it available to your project. The instructions included here define the steps for manually adding the control to the toolbox after starting a new project. However, if you choose, you may configure the control to load automatically.
To add the Batch Phase Execution control to a Visual Basic project:
1. Start Visual Basic.
2. From the Projects menu, select Components.
3. On the Components dialog box, select the Controls tab. The available Custom Controls are displayed in a list.
4. Scrolling through the list, locate and select the Batch Phase Execution control.
5. Click OK to close the dialog box. The Batch Phase Execution control is available on the Visual Basic toolbox. It is marked with a picture of a valve.
15
See also
Program the PC-based phase on page 17
Chapter 2 Create a PC-based phase
IMPORTANT
at run time, an entry is written to the activity log file.
Place the Batch Phase
Set the PC-based phase
Set custom properties in
Use Visual Basic to place the Batch Phase Execution control on a form.
Execution control on a form
properties
To place the Batch Phase Execution control on a form:
1. Select the Batch Phase Execution control in the Visual Basic toolbox.
2. Position the cursor on the form where you want the control.
3. Click and drag to draw the outline of the control on the form.
4. Release the outline to place the new Batch Phase Execution control at the location specified. The PC-based phase can now be programmed.
See also
Add the Batch Phase Execution control to a Visual Basic project on page 15
PC-based phase properties on page 16
Program the PC-based phase on page 17
Create the executable on page 19
To enable communication between a PC-based phase and the FactoryTalk Batch Server, properties can be modified in two ways:
With the phase selected, use the Properties window to locate and set the appropriate properties, or
Use the custom Property Pages dialog box.
the Property Pages dialog box
All properties specific to the Batch Phase Execution control that can be configured at design time are included in this dialog box.
See also
Add the Batch Phase Execution control to a Visual Basic project on page 15
PC-based phase properties on page 16
Program the PC-based phase on page 17
Create the executable on page 19
Use the Property Pages dialog box to set custom properties to enable communication between a PC-based phase and the FactoryTalk Batch Server.
If you attempt to configure a property at design time with an invalid entry, you are notified of the error by a message box, which includes a range of valid entries.
If you attempt to configure a property at design time that does not support configuration at design time, a message box opens. If you attempt to configure a property at runtime that does not support modification
16
Program the PC-based
Chapter 2 Create a PC-based phase
To set custom properties in the Property Pages dialog box:
1. Right-click the Batch Phase Execution control and select Properties.
The Property Pages dialog box opens with the Configuration tab selected.
2. Enter the values for the custom configuration properties.
3. Select Apply.
4. Select the Operation tab and enter the values for the custom operation properties.
phase
17
5. Select Apply, then OK.
See also
PC-based phase properties on page 16
The PC-based phase requires specific methods and events to function properly. These methods and events are predefined in the Batch Phase Execution control, and must be programmed for the specific PC-based phase being created. The following describes each of the required methods, along
with example code for the OnRestart event.
See also
Events on page 19
Chapter 2 Create a PC-based phase

Methods

The Initialize and TerminateState methods are required for the PC-based phase to function properly.
Initialize
You must invoke the Initialize method in order to create OPC tags and establish the PLI’s scan interval. This is done by calling the Initialize method, and is usually performed in the Form_Load() event. The following is an example of calling the Initialize method:
Private Sub Form_Load()
Charge.Initialize ‘Initialize the control
End Sub
TerminateState
The TerminateState method is used to terminate the active state. You must call this method if you wish the phase to complete its current state. The five active states are RUNNING, HOLDING, STOPPING, RESTARTING, and ABORTING. For example, calling TerminateState while RUNNING will transition the phase to COMPLETE. The following is an example of calling the TerminateState method: Const UploadAllReports = 2000
Select Case Agitate.StepIndex
Case 4: ‘ ensure that previous request is complete
If Agitate.Request = 0 Then
Agitate.Report(1) = txtAgitateElaspedTime.Text
If Not Agitate.Owner Then
‘ upload all report parameters Agitate.Request = UploadAllReports
End If
Agitate.StepIndex = 5
End If Exit Sub
Case 5:
‘ ensure that report upload is complete If Agitate.Request = 0 Then
Agitate.TerminateState ‘Terminates the active state
End If
Exit Sub
End Select
See also
Create a PC-based phase on page 15
Properties, methods, and events on page 27
18

Events

Event example using
OnRestart event

Create the executable

Chapter 2 Create a PC-based phase
The phase programmer must follow certain conventions when using Visual Basic and the Batch Phase Execution control:
NEVER use modal dialog boxes or other user interface that causes the program logic to wait at some point. This can prevent the PLI from responding to state changes.
NEVER use looping logic that waits at some point. This can prevent the PLI from responding to state changes. The PLI runs every X milliseconds as specified by the Interval property. Use Select Case or If Then Else logic combined with changes to the StepIndex property to advance from section to section within your code.
The phase programmer is responsible for transitioning the phase from an active state (RUNNING, STOPPING, etc.) to a finished state (COMPLETE, STOPPED, etc.) using the TerminateState method.
The PLI uses the StepIndexBuffer property to store the Step Index when the phase is HELD. The Step Index is then restored (by the TerminateState method) when the phase transitions from RESTARTING to RUNNING. Typically, the StepIndexBuffer would be checked to determine where the
phase was HELD. The RESTART logic would then determine if it’s safe for the phase to RESTART at that step, or if it should RESTART at an earlier step. The OnRUN event logic should account for all possible restart conditions.
An example of the conventions that should be used to program the events follows:
Private Sub Agitate_OnRestart
‘ Restart the phase at the beginning if it was HELD at ‘ step #2. Otherwise, it’s OK to restart where we left off.
If Agitate.StepIndexBuffer = 2 Then
Agitate.StepIndexBuffer = 1
End If
Agitate.TerminateState
‘ transition to RUNNING
End Sub
When you have defined the Batch Phase Execution control’s properties,
methods, and events, you must create the executable that runs during recipe execution. Refer to the Microsoft Visual Basic documentation for specific instructions on creating the executable file.
19
Chapter 2 Create a PC-based phase
code.
Add the phase execution

Create a new project

Add the control to the
Add the control to the
Access control properties
control to a Visual C++
We suggest that you contact Rockwell Product Support to determine which
version of the Microsoft Foundation Classes (MFC) is currently used by the
FactoryTalk Batch control product.
project
project
Any phases written with Visual C++ should use the same version.
Use Microsoft Visual C++ to add the Batch Phase Execution control to a
project.
To create a new project:
1. Start the MFC AppWizard executable.
2. Select the Dialog Based option.
3. Make sure support for ActiveX Controls is selected.
4. Use MFC as a shared DLL.
Use MFC to add the control to the project.
To add the control to the project:
1. In MFC, select Project > Add to Project.
2. Select the Components and Controls option.
3. Open the Registered ActiveX Controls folder.
4. Select the Batch Phase Execution control.
dialog
from Visual C++
Use MFC to add the control to the dialog.
To add the control to the dialog:
1. In MFC, open the Project dialog (not the About box, if there is one).
2. Add the Batch Phase Execution control to the dialog from the Control
toolbar.
Tip: Add one instance of the control for each phase! The resource ID assigned here is used to create event handlers (the framework for phase logic). The resource ID is associated with a member variable that allows access to the phase properties from within the source
Use MFC to access the control properties from Visual C++.
To access control properties from Visual C++:
1. In MFC, right-click the Batch Phase Execution control’s icon.
2. Under the Operation and Configuration tabs, find the properties that
require configuration at design time. You can view all properties by using the All tab.
20
significance and is not associated with the server.
Configure the
BaseTagName property

Add control events

Add a member variable Add phase logic to event
General usage signature
Visual C++ does not allow you to configure the Name property of the control.
Configure the BaseTagName property to allow the phase to function
properly.
Tip: Even though DDE server is no longer supported, the use of DDE in a property name has no
Chapter 2 Create a PC-based phase
To configure the BaseTagName property:
1. Set the UseDefaultDDETagName property to FALSE.
2. Set the DDEBaseTagName property to the name of the phase. This
becomes the base for all OPC tag names (example: BASENAME_ST for phase state).
Use the resource ID of the phase for each event to add control events.
To add control events:
1. Right-click the Batch Phase Execution control’s icon.
2. Select the event.
3. Double-click the event.
4. Edit the member function name as desired and click OK.
derived from the Phase Control Class
handlers
requests
Use MFC to add a member variable derived from the Phase Control Class.
Tip: The category is Control, and the variable type is the Phase Control Class. Use the appropriate resource ID as assigned to the instance of the control in the dialog.
To add a member variable derived from the Phase Control Class:
1. Using the Class Wizard, add a member variable to the project’s dialog class.
2. Repeat for each phase (each instance of the control).
Reference the Batch Phase Execution control’s properties and methods using the member variable names.
Use a Phase Logic Request to generate a signature request for a PC-based phase.
Before you can successfully use the General Signature Request, electronic signatures must be configured in the area model. Signature templates define the signature signoff information required to complete a signature request generated against a phase. Each signature can require up to three signoffs, which consist of security permissions and optional comments.
21
Chapter 2 Create a PC-based phase
Tip: Parameter limit tags and Report limit tags are created with a tag delimiter which must and must be installed on the remote computer.
Parameter and report
Distribute PC-based phase
parameter limits
The Batch Phase Execution control can be configured to obtain the
Parameter and Report Parameter Limits defined on a PC-based phase in the
area model.
The PC-based phase, like any other phase, can be assigned a Verification method and associated with verification policies in the area model. Adding additional phase parameter tags and code to the Batch Phase Execution control application allows the parameter values to be downloaded for use in the control. Assigning verification policies to a PC-based phase can generate signature requests when parameter or report parameter limit values are too high or too low.
If a PC-based phase has tag locking enabled, and limit tags enabled on the equipment module, additional limit tags are created. For example, if the phase parameter has a Verification method equal to High/Low, three additional tags are created for the equipment module as shown here:
Phasename.P01M - tag for the Verification method
Phasename.P01H - tag for the High Limit
Phasename.P01L - tag for the Low Limit
applications
be removed when used with a PC-based phase.
See also
Use limit tags on a PC-based phase on page 40
Set tag items to default names on page 25
Please read the license agreement that was shipped with this software. You
are bound by the licensing restrictions contained in the agreement. You can
use all of the files accompanying this product for development use and
redistribute the runtime version of the software in accordance with the terms of the license agreement.
Tip: The FactoryTalk Batch Server is required for the Batch Phase Execution control to function
See also
Create a PC-based phase on page 15
22
PC-based phase property
Area model
(changing one also changes the other)

Update the area model

Chapter 3
Use a PC-based phase
After creating the PC-based phase executable, you must perform the following tasks:
Update the area model in FactoryTalk Batch Equipment Editor
Add the phase to your recipes using FactoryTalk Batch Recipe Editor
The following table indicates the relationship between the PC-based phase property and the area model. You must adhere to the rules shown here to allow for proper communication.
The OPC’s Watchdog Item Access Path PC-based phase’s OPC Access Path for Tags, as defined
in Visual Basic, or other container, or the Topic property
PC-based phase Name property, as defined in Visual Basic, or other container
Equipment Module’s Tag name, as defined in FactoryTalk Batch Equipment Editor
See also
Change the default tag separators for a PC-based phase on page 24
Add the new phase to a recipe on page 26
Run a recipe with a PC-based phase on page 26
You must add a new data server definition to your area model, as well as add
the new phase and associated equipment module.
To update the area model:
1. Open the area model in which the new phase will be used.
2. From the Edit menu, select Data Server, or select the Edit Data Servers
toolbar.
3. On the Data Servers dialog box, select Add.
4. On the Add Data Server dialog box, enter the new data server definition name in the Name box.
5. From the Type list, select PC Phase OPC.
23
The default values for the data server type are displayed. The Watchdog Item Name must be WATCHDOG. Any string may be used for the Watchdog Item Access Path, but the same string must be used in the PC-based phase’s Topic property.
Chapter 3 Use a PC-based phase
the tag separator.
IMPORTANT
Change the default tag
6. Enter the following information for the new data server definition and then click OK to return to the Data Servers dialog box:
• Watchdog Item Access Path: Phase (user-definable)
Watchdog Item Name: watchdog
7. Create a phase to be used as the PC-based phase. Assign the required number of parameter, report, and request tags. Generally, these would be equal to the number assigned to the PC-based phase’s properties.
8. Create an instance of this phase in the appropriate unit(s). Be sure to use the same name for the equipment module as the Name property defined for the PC-based phase.
9. Assign the new data server definition to each of the tags in the newly defined equipment module. Do not change the Item names. These should follow standard conventions and start with the name assigned to the instance of the control in the container application.
10. Save the area model with the new changes.
See also
separators for a PC-based phase
Use a PC-based phase on page 23
Change the default tag separators and update the area model for a PC-based phase.
Tip: The tag separator used in the FactoryTalk Batch Equipment Editor must be removed for all PC­based phase parameter, report, and request data tags. By default, the tags are set up as:
[Phasename].P01 for parameters
[Phasename].R01 for report parameters
[Phasename].Q01 for request data parameters
The period (.) tag separator must be removed to use these tags. The tags should be:
[Phasename]P01 for parameters
[Phasename]R01 for report parameters
[Phasename]Q01 for request data parameters
The ten base tags need a period; the upload, download, and request tags do not require a period as
To change the default tag separators for a PC-based phase:
1. Edit the batcheqp.ini file and change the default FactoryTalk Batch
Equipment Editor tag separator to a period.
2. Save the batcheqp.ini file.
3. In FactoryTalk Batch Equipment Editor, double-click on a Visual Basic equipment module instance within a unit to display the Edit Equipment Module dialog box.
This is an irreversible action. When you select Defaults, all applicable tag items are automatically changed.
24
IMPORTANT
IMPORTANT
Set tag items to default
Chapter 3 Use a PC-based phase
4. On the Edit Equipment Module dialog box, select the Tags tab and click Defaults.
A message displays stating that all tag items have been set to their default names.
5. Click OK. This places a "." into each tag prior to the separator. To verify, double-click a tag address to open the Edit Equipment Module Tag dialog box.
Notice that the Item Name reference of CALCULATE_WEIGHT1P01 is now CALCULATE_WEIGHT1.P01. All other tags should have a "." separator in the Item Name tag addressing, such as:
CALCULATE_WEIGHT1.F
CALCULATE_WEIGHT1.W
CALCULATE_WEIGHT1.OC
CALCULATE_WEIGHT1.RQ
Tip: Parameter, report, and data request tags do not have a tag separator, as shown here:
CALCULATE_WEIGHT1P01
CALCULATE_WEIGHT1R01
CALCULATE_WEIGHT1Q01
Another way to change addressing is to export and import the area model, but this is not recommended because it can introduce errors to the area model.
Set all of the tag items in an area model to default names.
names
25
To set tag items to default names:
Use Set Default Tag Items with caution. For example, if you have removed the tag separators from the tag items in your area model, setting the default tag items puts the default tag separator back in.
1. From the Edit menu, select Set Default Tag Items.
2. Verify that you want to set all of the tags to their default names.
Chapter 3 Use a PC-based phase
Add the new phase to a
Run a recipe with a PC-
3. Select OK to continue. A message dialog box opens when the process is complete.
4. Select OK to return to the Design View area.
See also
Change the default tag separators for a PC-based phase on page 24
Update the area model on page 23
Use FactoryTalk Batch Recipe Editor to add the new phase to a recipe.
recipe
based phase
To add the new phase to a recipe:
1. Open FactoryTalk Batch Recipe Editor.
2. Open the recipe where you want to add the new phase.
3. Add the phase and associated transition to the recipe.
4. Verify and save the recipe.
See also
Update the area model on page 23
The PC-based phase executable must be active when the recipe is processed.
To run a recipe with a PC-based phase:
1. Start the PC-based phase executable.
2. Start the FactoryTalk Batch Server.
3. Open the FactoryTalk Batch View or HMI application.
4. Create a batch from the recipe containing the PC-based phase.
5. Run the batch. The recipe phase interacts with the PC-based phase and performs its pre-programmed functions.
26
The icon that represents the phase changes color based on the state of the phase. These color changes match the colors used in the FactoryTalk Batch View.
See also
Update the area model on page 23

Add the new phase to a recipe on page 26

Property
Indexed
Type
Read-
Can be changed at:
Tag Design
Runtime?
Command
No
Long — No
No
Phasename_OC
initialization
DownloadRequest
No
Boolean
Yes
No
No
None
initialization
LogFileName
No
Text
No
Yes
Yes
None
Name
No
Text
No
Yes
No
None
initialization
initialization
initialization
initialization
initialization
Properties
Appendix A
Properties, methods, and events
A PC-based phase is created using the Batch Phase Execution control and an OPC container application. The control must be added to the container application, placed in the appropriate medium (form, spreadsheet, document, etc.), and its properties, methods, and events defined. This section defines those properties, methods and events.
See also
Methods on page 32
Events on page 34
The following tables provide a summary of the properties associated with the Batch Phase Execution control and a description of each property.
Property summary
only
time?
CheckPointEnable No Boolean No Yes Yes None ClearRequest No Boolean No Yes Yes None
DDEBaseTagName No String No Yes Only before
ExternalCommand No Long No No Failure No Long No No Interval No Long No Yes Only before
None
Phasename_EC Phasename_F None
NumberOfParameters No Long No Yes Only before
NumberOfReports No Long No Yes Only before
NumberOfReqData No Long No Yes Only before
Owner No Boolean No No Only after
Parameter(N) Yes Text No No Only after
None
None
None
Phasename_W
PhasenamePnn
27
Appendix A Properties, methods, and events
Property
Indexed
Type
Read-
Can be changed at:
Tag Design
Runtime?
Pause
No
Boolean
Yes
No
No
Phasename_P
Request
No
Long
No
No
Only after
Phasename_RQ
RestoreRequest
No
Boolean
No
Yes
Yes
None
SingleStep
No
Boolean
Yes
No
No
Phasename_SS
Status
No
Long
Yes
No
No
Phasename_ST
StepIndexBuffer
No
Long
No
No
Yes
None
StepIndexInitialValue
No
Long
No
Yes
Yes
None
initialization
Unit
No
Long
Yes
No
No
Phasename_UN
Name
initialization
initialization
WatchdogStatus
No
Boolean
Yes
No
No
None
initialization
Property
Description
The default value is TRUE.
command sent by the FactoryTalk Batch Server.
only
time?
Paused No Boolean No No Only after
initialization
Report(N) Yes Text No No Only after
initialization
initialization
RequestData(N) Yes Text No No Only after
initialization
StepIndex No Long No No Only after
initialization
Topic No Text No Yes Only before
UseDefaultDDETag-
No Boolean No Yes Only before
WatchdogFailureValue No Long No Yes Only before
Phasename_PD
PhasenameRnn
PhasenameQnn
Phasename_SI
None
None
None
WatchdogTimeout No Long No Yes Only before
None
Property description
CheckPointEnable User configurable flag. When set to TRUE, a checkpoint file is updated as
needed with all pertinent runtime parameters. The checkpoint file is an internal reference file which is not user-modifiable. The file is updated after each scan if a property change is seen. This file is then loaded when the phase application is started, or when the CheckPoint method is called. When set to FALSE, a checkpoint file is not maintained.
ClearRequest User configurable flag. When set to TRUE, any pending request by the phase
logic is canceled when a change of state is initiated. This property should be used in conjunction with the RestoreRequest property. The PLI will not allow ClearRequest to be FALSE and RestoreRequest to be TRUE (the request would be issued twice in this case). The default value is TRUE.
Command Contains the command information as received from the FactoryTalk Batch
Server. The phase responds to this command register when the phase is in program control (owned by the FactoryTalk Batch Server). This parameter is reset after each PLI scan, so its contents are NOT indicative of the last
28
Property
Description
DDEBaseTagName
Used as the base for tag names when the UseDefaultDDETagName property is
UseDefaultDDETagName property is set.
The default value is FALSE.
The default value is 0.
The default value is 0.
The default value is 1000.
The default value is BATCHPHS.
The default value is 5.
The default value is 5.
The default value is FALSE.
Appendix A Properties, methods, and events
set = FALSE and DDEBaseTagName property is not null. For example, if this property is set = BOO, and the UseDefaultDDETagName property is FALSE, then the tag for the phase state is BOO_ST. If this property is empty, the Name property is used as the tag name base regardless of how the
DownloadRequest Flag set by the PLI if the FactoryTalk Batch Server has sent a DOWNLOAD
command to the phase. The Server sends a DOWNLOAD command when there is a Transfer of Control condition between two consecutive equipment modules (phase instances) based on the same phase. An example would be two consecutive agitation phases where a change in agitation speed is desired when a tank level has reached a certain point.
ExternalCommand Contains the command information as received from an external source (an
HMI, for example). The phase responds to this command register when the phase is in external control (NOT owned by the FactoryTalk Batch Server).
Failure The Failure property is set within the phase logic as desired when there is an
error condition that should cause the phase to be HELD. When this property is set to any value greater than zero, the PLI will execute the HOLDING sequence. The PLI will also set this property to the WatchdogFailureValue when the watchdog status is bad and will HOLD the phase. The valid range is 0 to 32767.
Interval Determines the execution interval (in milliseconds) of the PLI and phase logic.
(This value should be the number of seconds multiplied by 1000.)
LogFileName File name prefix (.LOG is added by the phase execution control) for the activity
log file.
Name Name of the equipment module. This property must match the name given to
the equipment module in FactoryTalk Batch Equipment Editor. Parenthesis created for control arrays are ignored.
The default value is Phase1.
NumberOfParameters Indicates the number of parameter tags that will be available to the phase.
Generally, this value will be equivalent to the number of parameter tags assigned within FactoryTalk Batch Equipment Editor. The valid range is 0 to 999.
NumberOfReports Indicates the number of report tags that will be available to the phase.
Generally, this value will be equivalent to the number of report tags assigned within FactoryTalk Batch Equipment Editor. The valid range is 0 to 999.
NumberOfRequestData Indicates the number of request data tags that will be available to the phase.
Generally, this value will be equivalent to the number of request data tags assigned within FactoryTalk Batch Equipment Editor. The valid range is 0 to10. The default value is 5.
Owner Determines phase ownership. When set to TRUE, the phase is in External
control and will respond to the contents of the ExternalCommand property. When set to FALSE, the phase is owned by the FactoryTalk Batch Server and will respond to the Command property.
29
Appendix A Properties, methods, and events
Property
Description
Parameter(N)
Phase parameters, where the total number (N) is specified in the
Programmer Technical Reference Guide
for details.)
The default value is FALSE.
The default value is 0.
PCD Programmer Technical
The default value is FALSE.
NumberOfParameters property. These are downloaded from the FactoryTalk Batch Server by placing the appropriate values into the Request property. A NULL string is returned if Initialize has not yet been called; Invalid index is returned when an illegal (out of range) index is used. (Refer to the
PCD
Pause The Pause property (pausING) is set by the PLI when the Pause command is
received, or when single-step mode is activated. (Refer to the FactoryTalk Batch
Server API Communications Language Reference Guide
for further details).
The default value is FALSE.
Paused Set within the phase logic as desired to place the phase in the Paused state. A
Resume command must be issued to continue phase execution when the Paused (pausED) property is set. (Refer to the
Reference Guide
for details).
PCD Programmer Technical
Report(N) Report parameters, where the total number (N) is specified in the
NumberOfReports property. Report parameters are set within the phase logic to upload report values to the FactoryTalk Batch Server for archiving. The phase logic must store report values to this property and then store an Upload Request to the Request property. A NULL string is returned if Initialize has not yet been called; Invalid index is returned when an illegal (out of range) index is used.
Request Used to make requests to the FactoryTalk Batch Server to accomplish a wide
range of tasks such as downloading and uploading parameter and report values. Phase logic stores a predefined request value to this property to initiate action by the Server. This property value must be equal to zero before storing a valid request into this property. This property will return to zero when the Server has completed the requested action. (Refer to the
Reference Guide
for details.) The valid range is 1000 to 2147483648.
PCD Programmer Technical
RequestData(N) Request data parameters, where the total number (N) is specified in the
NumberOfRequestData property. The RequestData property performs two functions:
1. Supplies additional arguments for a Request that is being made using the Request property.
2. Transfers data values from a sending Transfer phase to a receiving Transfer phase.
A NULL string is returned if Initialize has not yet been called; Invalid index is returned when an illegal (out of range) index is used. (Refer to the
Programmer Technical Reference Guide
for details.)
PCD
RestoreRequest User configurable flag. When the phase transitions from RESTARTING to
RUNNING, this property (when TRUE) will cause the request that was pending at the time the phase was HELD to be restored and executed. This property should be used in conjunction with the ClearRequest property. The PLI will not allow ClearRequest to be FALSE and RestoreRequest to be TRUE (the request would be issued twice in this case). The default value is TRUE.
SingleStep Flag toggled by the PLI when it receives a SingleStep command. When single-
stepping is turned ON, the Pause (pausING) property is set to TRUE if the phase has been in the free-running state. This combination is referred to as the single-step pausing state. When single-stepping is turned OFF, both the Pause (pausING) and Paused (pausED) properties are cleared (set to FALSE) and the phase return to the free-running state. (Refer to the
Reference Guide
for details).
30
Property
Description
Status
Contains a numerical value that represents the current phase state. The
The default value is 100.
The default value is 1.
UseDefaultDDETagName
User configurable flag. When set to TRUE, or when the DDEBaseTagName
then the content of the DDEBaseTagName property is used.
WatchdogFailureValue
This is the value that the Failure register is set to when the WatchdogStatus is
The default value is FALSE.
Appendix A Properties, methods, and events
following are the possible values with the corresponding state:
10 = ABORTING
20 = HOLDING
30 = STOPPING
40 = RESTARTING
50 = RUNNING
60 = HELD
70 = COMPLETE
80 = STOPPED
90 = ABORTED
100 = IDLE
StepIndex Set equal to the StepIndexInitialValue property by the PLI when the phase is
STARTed or RESET. The phase logic may use this property to control program flow. The default value is 1.
StepIndexBuffer Used by the PLI to save the StepIndex property when the phase is HELD. The
StepIndex is restored from the StepIndexBuffer when the phase is RESTARTED. The default value is 0.
StepIndexInitialValue Default value of the step index. The PLI initializes the StepIndex property to the
StepIndexInitialValue value when the START or RESET command is received.
Topic This is the Watchdog Item Access Path as defined in a OPC server within the
area model. You may define multiple OPC servers to be used with PC-based phases. They do not need to use the same topic. You may also use multiple instances of a control within one project and refer to different OPC servers. If the Topic property is set at run-time, it must be set before the Initialize method is called. The default value is BATCH.
Unit Contains the UnitID of the unit that controls the phase.
The default value is 0.
property is not null, the content of the Name property is used as the base for tag names. When set to FALSE, and the DDEBaseTagName property is not null,
bad. The value used here should then be defined within the phase_failure enumeration set in the area model. This property can be set to 0, which will turn off the hold on watchdog failure logic; the phase will not be HELD when the WatchdogStatus goes bad. The valid range is 0 to 2147483648. The default value is 13.
WatchdogStatus Current status of the watchdog between the FactoryTalk Batch Server and the
phase. A zero (FALSE) indicates that the status is bad and communications are down. The PLI will set the Failure property to 13 when the WatchdogStatus is bad.
31
Appendix A Properties, methods, and events
Property
Description
WatchdogTimeout
Interval, in seconds, between watchdog checks by the PLI. If the
Method
Return value
Description
Initialize
True = success
Used to initialize the control. The control will not
CommandRestart
True = success
Used to transition the phase to RESTARTING.
CommandStop
True = success False = failure
Used to transition the phase to STOPPING.
Methods
See also
The following section provides a summary of each method associated with the Batch Phase Execution control and a description of how each method is used.
There are no parameters associated with any of these methods.
WatchdogTimeout property is set at run-time, it must be set before the Initialize method is called. The valid range is 5 to 1800 seconds.
The default value is 20. The timeout period is configurable in the Batchsvr.ini file, entered in milliseconds. The default settings are in the [XMAN] section: WatchdogPeriod=10000 and WatchdogCycles=5. The default time period for the
FactoryTalk Batch is ten (10) seconds. The PCD timer should be set to a value slightly larger than the product of the WatchdogPeriod and the WatchdogCycles.
Events on page 34
Method summary
CheckPoint True = success
False = failure
False = failure
LogTagNames True Used to write all tag names to the activity log file. TerminateState None Your application must call this method to complete
CommandAbort True = success
False = failure
CommandHold True = success
False = failure
CommandReset True = success
False = failure
False = failure
CommandStart True = success
False = failure
Called to force an update of the checkpoint data file.
function properly if this method is not invoked.
the transition of an Active state. Used to transition the phase to ABORTING.
Used to transition the phase to HOLDING.
Used to transition the phase to IDLE.
Used to transition the phase to RUNNING.
32
Method description
Checkpoint: This method is invoked to update the checkpoint data file.
Typically, this is not needed since the checkpoints are saved as needed at the end of every PLI scan. It should only be called AFTER the Initialize method has been called and executed successfully.
Current state
Transitioned state upon call of TerminateState
ABORTING
ABORTED
HOLDING
HELD
STOPPING
STOPPED
RESTARTING
RUNNING
RUNNING
COMPLETE
Method
Phase transitions to:
Phase state must be:
CommandAbort
ABORTING
HOLDING, STOPPING, RUNNING, RESTARTING, or HELD
CommandHold
HOLDING
RUNNING or RESTARTING
CommandReset
IDLE
COMPLETE, ABORTED, or STOPPED
CommandRestart
RESTARTING
HELD (and the phase has not failed)
CommandStart
RUNNING
IDLE (and the phase has not failed)
CommandStop
STOPPING
HOLDING, RUNNING, RESTARTING, or HELD
Appendix A Properties, methods, and events
Initialize: This method performs all initialization and MUST be called
before the phase will execute properly. It only needs to be called once and in fact, will not execute again if called more than once. You should check the return value and not allow the application to continue if this method fails. Initialize does the following:
Loads checkpoint data if required (fires OnCheckPointFail if the
checkpoint read fails).
Creates and initializes all tags.
Creates the watchdog.
Creates a timer based on the Interval property.
Fires the OnPowerUp event.
LogTagNames: This method writes all tag names to the activity log file.
It is used as a tool to view the current tag names. It should only be called AFTER the Initialize method has created and initialized the tags. It will always return a value of TRUE.
TerminateState: This method is used to terminate an active state and
transition the phase to the next desired state. In other words, it will cause the phase to change state as shown in the following table:
The phase programmer must use TerminateState within the phase logic to transition the phase state at the appropriate time. Refer to the PCD Programmer Technical Reference Guide for complete instructions regarding state transition logic.
Transition command methods: The Transition Command methods
allow the phase programmer to change the state of the phase from within the source code. The state transition rules must be followed in order for the PLI within the Batch Phase Execution control to honor the command. The following table shows the command name, the state to which the phase will transition, and the state(s) that the phase must be in for the command to be honored.
33
Appendix A Properties, methods, and events
Event
Description
state. Only happens after the Initialize method is invoked.
state. Only happens after the Initialize method is invoked.
state. Only happens after the Initialize method is invoked.
RESTARTING state. Only happens after the Initialize method is invoked.
Only happens after the Initialize method is invoked.
Events
See also
The following table provides a brief description for each event associated with the Batch Phase Execution control. There are no parameters associated with
any of these events.
Properties on page 27
OnAbort Fired by the Batch Phase Execution control when the phase is in the ABORTING
OnHold Fired by the Batch Phase Execution control when the phase is in the HOLDING
OnRun Fired by the Batch Phase Execution control when the phase is in the RUNNING
OnRestart Fired by the Batch Phase Execution control when the phase is in the
OnStop Fired by the Batch Phase Execution control when the phase is in the STOPPING
state. Only happens after the Initialize method is invoked.
OnIdle Fired by the Batch Phase Execution control when the phase is in the IDLE state.
OnLoadCheckPointFail Fired by the Batch Phase Execution control during startup if there are no valid
checkpoints to load and the CheckPointEnable property is set to TRUE.
OnPowerUp Fired by the Batch Phase Execution control during execution of the Initialize
method. Only called if the Initialize method is successful.
See also
Methods on page 32
Properties on page 27
34
Application notes
Appendix B
Application notes and example phase
This section contains application notes and an example of a generic PC-based phase. The example uses the sample application (SampleDemo) that is installed with FactoryTalk Batch. For more information on the sample application, see the FactoryTalk Batch Getting Results Guide.
See also
PC-based phase example on page 36
The following are points to remember when programming PC-based phases:
There should be a data type mismatch between the request data tag(s) configured in the area model and the tags configured on the Visual Basic ActiveX control. In the area model, the tags must be configured as integers for the FactoryTalk Batch Server to work correctly; in the ActiveX control they are configured as strings. The OPC call made from the Server converts the strings to integers. All other tags should have a one-to-one mapping of tag types.
If you remove tag locking from the phase class configured in FactoryTalk Batch Equipment Editor, the FactoryTalk Batch Server will try to do the conversion from the tag type configured in the class to the type that is used in the instance. This is useful for PC-based phases because this allows you to create the phase class parameters and reports of any data type you choose. At the instance level, you can then change the actual instance tag types of the parameters and reports to strings, which are required by the PC-based phase. This is especially useful for material-enabled phases where the tag type of the AMOUNT report tag must be real, and the tag type of the FEED_COMPLETE report tag must be enumeration.
The tag separator used in FactoryTalk Batch Equipment Editor must be removed for all PC-based phase parameter, report, and request data tags. By default, the tags are set up as [Phasename].P01 for parameters, [Phasename].R01 for report parameters, and [Phasename].Q01 for request data parameters. The period (.) tag separator must be removed in order for the tags to be used. The tags should be [Phasename]P01 for parameters, [Phasename]R01 for report parameters, and [Phasename]Q01 for request data parameters.
35
Appendix B Application notes and example phase
The Name in the FactoryTalk Batch Equipment Editor Edit Equipment
Phase controls can be added to Visual Basic forms as control arrays. In
The phase control sets the StepIndex property to the
Remember that the code is executed based on the value in the Interval
If a download of parameters is required, place it in the first step, as
If assigning a value to a variable, and it is not in a case select structure
If using multiple phase controls on the same form, make sure that each
To run a Visual Basic phase, make an executable file (.exe). Start the
Module dialog box must agree exactly with the Name property of the phase.
this case, the phase control’s property index number corresponds to the number at the end of the Equipment Module’s name. For example, if CHARGE1 is the Equipment Module name, the corresponding Visual Basic Phase Control name created as part of a control array is CHARGE(1). The 1 is the Index property of the control. The programmer must decide when to use a control array or individual names for phase controls.
StepIndexInitialValue upon entering the control event (OnRun, OnStop, etc.). Use this value to reference the first step in the OnRun
event logic. The user can subsequently set the step index to any value (see the example phase).
property. For example, if the Interval value is 1000 milliseconds, the code is repeated every second.
shown in the accompanying example for the OnRun event. This approach ensures that the download is only issued once. The next step should wait until the request register is reset to zero by FactoryTalk Batch before proceeding through the remaining steps.
or some other IF statement structure, it will have the value assigned to it each time that event fires. This could lead to errors in code execution of the control event.
phase control variable is unique to the phase if declared in the general declaration section. The example program is for only one phase, but if there were other phase controls, the variables used in one could not be used in the other. This could lead to one phase overwriting values needed by another phase. It is conceivable that there could be exceptions.
Visual Basic phase, start the FactoryTalk Batch Server, check that the communication between the two is good (tag verification should also be done at this point until all tags verify successfully). The Visual Basic phase is now ready to have a recipe run against it.
36
PC-based phase example
Appendix B Application notes and example phase
This PC-based phase example provides a starting point for creating your own PC-based phases.
'========================================================= === 'This program was written using Microsoft Visual Basic 6 and 'is intended to be used as a starting point for creating your 'own PC-Based Phases. '========================================================= === 'Phase request definitions Const NO_REQUEST_PENDING = 0 Const REQUEST_ALL_PARAMETERS = 1000 Const UPLOAD_ALL_PARAMETERS = 2000 Private Sub Form_Load()
'Initialize the PC-Based Phase Control PH_CHECK_A.Initialize End Sub
Private Sub PH_CHECK_A_OnAbort()
'Terminate the current state of the phase PH_CHECK_A.TerminateState
End Sub
Private Sub PH_CHECK_A_OnHold()
'Terminate the current state of the phase PH_CHECK_A.TerminateState
End Sub
Private Sub PH_CHECK_A_OnIdle()
'Terminate the current state of the phase PH_CHECK_A.TerminateState
End Sub
Private Sub PH_CHECK_A_OnRestart()
'Terminate the current state of the phase PH_CHECK_A.TerminateState End Sub
Private Sub PH_CHECK_A_OnRun() 'The following Select Case performs the processing steps 'for the PH_CHECK_A logic. The initial step index for the 'phase is zero ("0").
Select Case PH_CHECK_A.StepIndex
37
Appendix B Application notes and example phase
Case 0: 'Wait until no requests are pending If PH_CHECK_A.Request = NO_REQUEST_PENDING Then 'Ask server to download all parameters for phase PH_CHECK_A.Request = REQUEST_ALL_PARAMETERS PH_CHECK_A.StepIndex = 10 End If
Case 10: 'Wait until parameters have been downloaded If PH_CHECK_A.Request = NO_REQUEST_PENDING Then PH_CHECK_A.StepIndex = 20 End If
Case 20: 'This case statement should contain the code required 'to perform the function of the phase PH_CHECK_A.StepIndex = 30
Case 30: 'This case statement should contain the code required 'to put report data into report registers PH_CHECK_A.Report(1) = PH_CHECK_A.Parameter(1) PH_CHECK_A.StepIndex = 40
Case 40: 'Wait until no requests are pending If PH_CHECK_A.Request = NO_REQUEST_PENDING Then 'Upload reports PH_CHECK_A.Request = UPLOAD_ALL_PARAMETERS PH_CHECK_A.StepIndex = 50 End If
Case 50: 'Wait until upload has completed If PH_CHECK_A.Request = NO_REQUEST_PENDING Then PH_CHECK_A.StepIndex = 60 End If
Case 60: PH_CHECK_A.TerminateState
Case Else PH_CHECK_A.StepIndex = PH_CHECK_A.StepIndexInitialValue End Select End Sub
Private Sub PH_CHECK_A_OnStop() 'Terminate the current state of the phase PH_CHECK_A.TerminateState
End Sub
38
Create a new PC-based
Add a new data server
Appendix B Application notes and example phase
See also
Application notes on page 35
Add a new data server definition to an area model on page 39
Use limit tags on a PC-based phase on page 40
Use Visual Basic to create a new PC-based phase.
phase
definition to an area model
To create a new PC-based phase:
1. Using Visual Basic version 6.0 or greater, create a new standard
executable and add the Batch Phase Execution control to the form.
2. Copy the text from the PC-based phase example into the code window of the project.
3. Change the Name property of the Batch Phase Execution control to PH_CHECK_A.
4. Set the CheckPointEnable property to FALSE.
5. Set the StepIndexInitialValue property to 0.
6. Create an executable file. This file must be running during batch execution.
See also
PC-based phase example on page 36
Add a new data server definition (DSDF) to your area model, as well as add a new phase and associated equipment module.
39
To add a new data server definition to an area model:
1. Open the SampleDemo area model in which the new phase will be
utilized.
2. From the Edit menu, select Data Server, or click the Edit Data Servers toolbar button. The Data Servers dialog box opens.
3. Click Add. The Add Data Server dialog box opens.
4. In Name, enter the new data server definition name.
5. From Type, select PC Phase OPC. The default values for the data server type are displayed. The Watchdog Item Name must be WATCHDOG. Any string may be used for the Watchdog Item Access Path, but the same string must be used in the PC-based phase’s Topic property.
6. Enter the following information for the new data server definition:
• Watchdog Item Access Path: Phase (user-definable)
Watchdog Item Name: watchdog
7. Click OK to return to the Data Servers dialog box.
Appendix B Application notes and example phase
Use limit tags on a PC-
8. Create a new phase named PHASE. Assign the required number of
9. Create an instance of this phase named PH_CHECK_A in the
10. Assign the new data server definition to each of the tags in the newly
11. Save the area model with the new changes.
12. Open FactoryTalk Batch Recipe Editor.
13. Open the recipe to which the new phase will be added.
14. Add the phase and associated transition to the recipe.
15. Verify and save the recipe.
parameter, report, and request tags. Generally, these would be equal to the number assigned to the PC-based phase properties.
appropriate unit(s). Be sure to use the same name for the equipment module as the Name property defined for the PC-based phase.
defined equipment module. Do not change the Item names. These should follow standard conventions and start with the name assigned to the instance of the control in the container application. (Refer to the FactoryTalk Batch Equipment Editor User Guide for information on assigning data servers.)
based phase
See also
PC-based phase example on page 36
Create a new PC-based phase on page 39
To obtain the Parameter Limits or Report Parameter Limits using a Visual Basic application, configure additional phase parameter tags in the PC-based phase to be used as addresses for the limit tags in the area model.
To use limit tags on a PC-based phase:
1. In Visual Basic, during PC-based phase configuration, specify
additional phase parameter tags on the Custom Properties dialog box of the Batch Phase Execution control. The number of phase parameter tags required is equal to the normal number of phase parameter tags plus the number of limit tags specified in the area model.
2. In FactoryTalk Batch Equipment Editor, assign a Verification method to the PC-based phase parameters or phase report parameters.
3. Select the equipment module and enable the Parameter Limit Tags or the Report Limit Tags by checking Enable Limit Tags.
4. From the Parameter or Report Limit Tags tab, double-click on a Limit Tag to open the Edit Equipment Module Tag dialog box. Change the Item Name to one of the phase parameter tag addresses (names) defined in Visual Basic. The Item Name is referenced in code to display Limit values. For example, PHASE1P01M changes to PH_CHECK_AP03.
40
Add limit tags to a PC-based
phase
Appendix B Application notes and example phase
5. At runtime, when the PC-based phase requests the Limit Tags, the FactoryTalk Batch Server loads the limit values into the additional phase parameter tags. The PC-based phase can access the value of these tags using the get_RequestData method. The set_RequestData is used to reset the value of the tag.
See also
Application notes and example phase on page 35
PC-based phase example on page 36
Use FactoryTalk Batch Equipment Editor and Visual Basic to add limit tags to a PC-based phase.
The code example below could be used to display Parameter Limit tags using a
Visual Basic application, and is an extension of the code example given in the PC-based phase example section.
To add limit tags to a PC-based phase:
1. In FactoryTalk Batch Equipment Editor, verify that the PC-based phase
has Tag Locking enabled and two parameters.
2. Assign a Verification method of High/Low to both of the parameters.
3. On the PC-based phase Parameter Limit Tags tab, check Enable Limit Tags. The following six additional tags are created:
PARMTR01H
PARMTR01L
PARMTR01M
PARMTR02H
PARMTR02L
PARMTR02M
4. On the Tags tab, double-click on one of the new limit tags.
5. On the Edit Equipment Phase Tag dialog box, change the limit tag Item Name to a phase parameter tag name. Repeat this for each limit tag. These names are referenced in code to display the limit tag values. For example:
PHASE1P01M changes to PH_CHECK_AP03
PHASE1P01L changes to PH_CHECK_AP04
PHASE1P01H changes to PH_CHECK_AP05
PHASE1P02M changes to PH_CHECK_AP06
PHASE1P02L changes to PH_CHECK_AP07
PHASE1P02H changes to PH_CHECK_AP08
41
Appendix B Application notes and example phase
6. In Visual Basic, create a form similar to the one shown here:
7. On the Custom Properties dialog box, add phase parameter tags to the Batch Phase Execution control. These tags are referenced in code to display the status of the phase, parameter values, and limit tag values.
8. Add code to map the phase parameter tags defined in the area model to the labels on the form. For example:
Private Sub Form_Load() PH_CHECK_A.Initialize lState.Caption = PH_CHECK_A.Status End Sub Private Sub PH_CHECK_A_OnRun() lState.Caption = PH_CHECK_A.Status lParameterValue(0).Caption = PH_CHECK_A.Parameter(1) lParameterValue(1).Caption = PH_CHECK_A.Parameter(2)
42
Appendix B Application notes and example phase
lParameterMethod(0).Caption = PH_CHECK_A.Parameter(3) lParameterLowLimit(0).Caption = PH_CHECK_A.Parameter(4) lParameterHighLimit(0).Caption = PH_CHECK_A.Parameter(5) lParameterMethod(1).Caption = PH_CHECK_A.Parameter(6) lParameterLowLimit(1).Caption = PH_CHECK_A.Parameter(7) lParameterHighLimit(1).Caption = PH_CHECK_A.Parameter(8) End Sub PH_CHECK_A.TerminateState lState.Caption = PH_CHECK_A.Status End Sub
9. Save the Visual Basic project and make a new executable.
Tip: No additional coding is necessary to enable signature requests on a PC-based phase. If a PC-based phase parameter or report parameter is configured with a Verification method and a signature template, the FactoryTalk Batch Server generates a signature request if the recipe parameter or report parameter limit tag values exceed their defined limits.
See also
PC-based phase example on page 36
Create a new PC-based phase on page 39
Use limit tags on a PC-based phase on page 40
43

Index

P
Index
A
ActiveX control 35 ActiveX custom control 11
add to a Visual Basic project 15 place on a form 16
add phase to a recipe 26
C
C++ project 20 Command Verification Policies 22 configure DDEBaseTagName property 21 control events 21
D
data tag
request 35
data type mismatch 35 distribute PC-based phase applications
22
PC-based phase
definition 11 distribute applications 22 executable 19 run in a recipe 26 set properties 16
Phase Execution Control
add to a Visual Basic project 15 C++ project 20 place on a form 16
program the PC-based phase 17
events 19
properties
set 16
R
recipe
add a PC-based phase 26 run with a PC-based phase 26
remove tag locking 35 request data tag 35
T
tag locking 35 tag separator 35
E
executable
create 19
execution of PC-based phase 12
L
Limit Tags 40
M
material-enabled phases 35 methods
program 17 summary 32
MFC AppWizard 20
O
OnRestart Event
program 19
U
update the area model 23, 39 upload request
warm restart 26
V
verification method 22
W
warm restart
upload requests 26
45
Rockwell Automation support
Technical Support Center
Find help with how-to videos, FAQs, chat, user forums, and product notification
rok.auto/support
Knowledgebase
Access Knowledgebase articles.
rok.auto/knowledgebase
Local Technical Support Phone Numbers Literature Library
Find installation instructions, manuals, brochures, and technical data publications.
rok.auto/literature
Product Compatibility and Download Center
Get help determining how products interact, check features and capabilities, and
rok.auto/pcdc
Use these resources to access support information.
updates.
Locate the telephone number for your country. rok.auto/phonesupport
(PCDC)
find associated firmware.
Documentation feedback
Your comments help us serve your documentation needs better. If you have any suggestions on how to improve our content, complete the form at
rok.auto/docfeedback
.
Waste Electrical and Electronic Equipment (WEEE)
At the end of life, this equipment should be collected separately from any unsorted municipal waste.
Rockwell Automation maintains current product environmental information on its website at rok.auto/pec.
Allen-Bra dley, expanding human possibility, Logix, Rockwell Automation, and R ockwell Software ar e trademarks of Rockw ell Automation, Inc.
EtherNet/IP is a trademark of ODVA, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Rockwell Otomay son Tica ret A.Ş. K ar Plaza İş Merkezi E Blok Kat :6 34752, İç erenkÖy, İs tanbul, T el: +90 ( 216) 5698 400 EEE Y Önetmeli ğine Uygundur
Rockwell Automation P
ublication# BATCH-RM006A-EN-D - October 2020
Copyright © 2020 Rockwell Automatio n Technologies, Inc. All Rights Reserved. Pri nted in the U.S.A.
Loading...