“drivewait” Designation
6. Process Management ▼ Process Management
6.4 Built-In Functions with Batch ID
The following explains how to access common block data and how to manipulate unit recipes using built-in functions with batch ID specification. In the unit monitoring operation, the built-in functions lcmread(), dcmread(), ccmread(), cmwrite(), urload() and urassign() cannot be used.
n
Reading Common Block Data (Batch ID Specification)
Use the built-in functions lcmreadbid(), dcmreadbid() and ccmreadbid() to read common block data with batch ID specification. The built-in functions lcmreadbid(), dcmreadbid() and
ccmreadbid() behave in the same manner as lcmread(), dcmread() and ccmread() except that the batch ID and recipe group number are specified for the first three.
• Simple variable
lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>) dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>) ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>) One-dimensional array element
lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>)
dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>)
ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>)
• Two-dimensional array element
lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) <recipe group number>
Specify the recipe group number using a variable or constant.
<batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID.
<common block name>
Specify the common block name using a character-string variable or
character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or
character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript>
Specify the array subscript(s) using a variable or constant. An expression comprising two or more terms such as “i + 1” cannot be specified.
Figure 6.4-1 The format of the built-in functions "lcmreadbid()", "dcmreadbid()" and "ccmreadbid()"
lcmreadbid() is a built-in function of long type, dcmreadbid() of double type and ccmreadbid() of char*n type.
To read numeric data from a common block, use lcmreadbid() or dcmreadbid(). If the type of the common block data is different from that of the built-in function, the common block data is converted to the type of the built-in function.
It is recommended that lcmreadbid() be used when reading integer-type and long-type com- mon block data, while dcmreadbid() be used when reading float-type and double-type com- mon block data.
Use ccmreadbid() when reading character-string type common block data.
<6.4 Built-In Functions with Batch ID >
6-14
Table 6.4-1 Reading Common Block Data
Function name Type Return value at normal execution
lcmreadbid long Common block data other than of long type are converted to long type. dcmreadbid double Common block data other than of double type are converted to doubletype. ccmreadbid char*n A character string of the string length of the common block data will bereturned.
n
Writing Common Block Data (Batch ID Specification)
Use the built-in function cmwritebid() to write common block data with batch ID specification. The built-in function cmwritebid() behaves in the same manner as cmwrite() except that the batch ID and recipe group number are specified for the former.
• Simple variable
cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <data>)
• One-dimensional array element
cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <data>)
• Two-dimensional array element
cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>, <data>)
<recipe group number>
Specify the recipe group number using a variable or constant.
<batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID.
<common block name>
Specify the common block name using a character-string variable or
character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or
character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript>
Specify the array subscript(s) using a variable or constant.
<data> Specify the data to be set as common block data using a variable or constant.
Figure 6.4-2 The format of the built-in function "cmwritebid()"
cmwritebid() sets <data> as common block data. If the type of the <data> specified as an ar- gument of the built-in function is different from that of the common block data, <data> is con- verted to the type of the common block data. However, if <data> is of numeric type and the common block data is of character-string type, or if <data> is of character-string type and the common block data is of numeric type, a run-time error occurs and data will not be set.
Table 6.4-2 Setting Common Block Data
In the FCS where the common block data is downloaded, the data can be accessed if the recipe status is either READY or ACTIVE.
• Condition (B)
In the FCS where the common block data is not downloaded, the data can be accessed if there is a unit recipe of the specified batch ID within the FCS and if the status of the unit recipe is either READY or ACTIVE. If one of the unit recipes in a recipe is READY or AC- TIVE, the recipe status will be READY or ACTIVE.
In the FCS that satisfies either of the two conditions above, common block data can be ac- cessed from any SFC block or operation by specifying a batch ID. Access is also possible from an SFC block started independently or from an operation not related to the recipe. An example of a recipe comprising two unit recipes is shown below. Unit Recipe 1 is executed by the unit instrument UNIT101 at FCS 1. Unit Recipe 2 is executed by the unit instrument UNIT201 at FCS 2. The common block data is downloaded to FCS 1 in which Unit Recipe 1 exists.
Control Station 1 satisfies Condition (A). At FCS 1, the common block data can be accessed using a built-in function with batch ID specification if the recipe status is either READY or AC- TIVE.
FCS 2 satisfies Condition (B). At FCS 2, the common block data can be accessed using a built-in function with batch ID specification only while the unit recipe status of Unit Recipe 2 is either READY or ACTIVE
Common block data
Unit Recipe 1 Unit Recipe 2 Recipe UNIT201 UNIT101 Download Download Download Unit Recipe 2
Common block data
Note: The common block data must be downloaded to the unit recipe 1 and the same FCS. Unit Recipe 1
Accessible
FCS1 FCS2
Figure 6.4-3 Conditions for Accessing Common Block Data
While a unit recipe is being executed by a unit instrument, the monitoring operation that be- longs to that unit can obtain a batch ID and recipe group number from the unit instrument data items BATCHID and RECIPEGR and access common block data using a built-in function with batch ID specification.
While a unit recipe is being executed, the executing unit instrument data items BATCHID and RECIPEGR store the corresponding batch ID and recipe group number.
• Unless the unit instrument data item BATCHID contains a null character string (character string of length 0), the unit instrument is executing a unit recipe. The data items BATCHID and RECIPEGR store the corresponding batch ID and recipe group number.
<6.4 Built-In Functions with Batch ID >
6-16
• If the unit instrument data item BATCHID contains a null character string, the unit is not executing a unit recipe.
The following example shows how a monitoring operation obtains the batch ID and recipe group number from the unit instrument data items BATCHID and RECIPEGR and read User Code 1 (USER1) and User Code 2 (USER2) from the system-fixed common block SYSRCM:
integer grp_no ! variable that stores the recipe group number char*16 batch_id ! variable that stores the batch ID
char*16 user1 ! variable that stores User Code 1 char*16 user1 ! variable that stores User Code 2
if (%%.BATCHID == " ") then
! processing when no unit recipe is being executed ...
else
grp_no = %%.RECIPEGR ! obtains the recipe group number batch_id = %%.BATCHID ! obtains the batch ID
! "SYSRCM" is a system-fixed common block name
user1 = 1cmreadbid (grp_no,batch_id,"SYSRCM","USER1") user2 = 1cmreadbid (grp_no,batch_id,"SYSRCM","USER2") ...
end if
...
n
Manipulating Unit Recipes (Batch ID Specification)
Unit recipes can be manipulated using built-in functions with batch ID specification. urassignbid() assigns a unit recipe to a unit instrument. The urassignbid() behaves in the same manner as urassign() except that the batch ID and recipe group number are specified for the former.
urloadbid() downloads a unit recipe already assigned to a unit instrument, from the HIS to the control station. The urloadbid() behaves in the same manner as urload() except that the batch ID and recipe group number are specified for the former.
urassignbid (<recipe group number>, <batch ID>, <unit recipe number>, <unit name>) urloadbid (<recipe group number>, <batch ID>, <unit recipe number>)
Table 6.4-3 Manipulating Unit Recipes
Function name Manipulating rec-ipe Type normal executionReturn value at Return value at er-ror
urassignbid Dynamic assign-ment of units integer 0 -1
urloadbid Download integer 0 -1
Executing urassignbid() or urloadbid() to manipulate a unit recipe and the built-in function be- ing completed without generating an error means the process management functions ac- knowledged the manipulation directive. It does not mean the operation has been completed. For example, urassignbid() and urloadbid() do not generate an error even when a batch ID that does not exist is specified.
• The dynamic assignment of units can be performed for a unit recipe using urassignbid() only while the status of the unit recipe is either NOASSIGN, ASSIGNED or READY. • When the dynamic assignment of units is performed for a unit recipe using urassignbid(),
the request message for dynamic assignment of units shows a blank space instead of the recipe name.
• A system error occurs when the dynamic assignment of units fails. The main causes of system alarms are shown below:
• The specified batch ID does not exist.
• The status of the specified unit recipe is neither NOASSIGN, ASSIGNED nor READY. • The downloading of units can be performed for a unit recipe using urloadbid() only while
the status of the unit recipe is ASSIGNED.
• When downloading of units is performed for a unit recipe using urloadbid(), the request message for unit recipe download shows a blank space instead of the recipe name. • A system error occurs when the download fails. The main causes of system alarms are
shown below:
• The specified batch ID does not exist.
• The status of the specified unit recipe is not ASSIGNED.
• A sufficient area to which the unit recipe is downloaded cannot be allocated in the FCS.
A unit recipe can be started, aborted, deleted or canceled by setting a corresponding status change directive with cmwritebid() in the common block data status of the system-fixed com- mon block for each unit recipe. However, when cmwritebid() has been executed without gen- erating an error, it means that the manipulation directive was acknowledged by the process management functions; it does not mean the operation has been completed.
<6.4 Built-In Functions with Batch ID >