Considerations for writing material phase logic

Writing phase logic for a material phase requires some additional consideration. The
FactoryTalk Batch
Server requires that a simple protocol be followed by the phase logic programmer to ensure that inventory levels are properly maintained within the material database and that the
FactoryTalk Batch
Event Journal contains entries identifying the inventory that was produced or consumed.
Protocol:
  • The phase logic must request a download of the AMOUNT parameter.
  • Before entering a terminal state (COMPLETE, STOPPED or ABORTED), the phase logic must upload the ACTUAL_AMOUNT and FEED_COMPLETE report parameters. The sign of the value in the ACTUAL_AMOUNT report parameter must match the configured feed type: Additions are positive or zero; Distributions are negative or zero. Deviating from this results in an error and the batch being HELD.
  • The Automatic Upload/Download functionality can be used to meet this protocol requirement. When used, the AMOUNT parameter downloads by the
    FactoryTalk Batch
    Server before the phase starts and the ACTUAL_AMOUNT and FEED_COMPLETE report parameters uploads after the phase logic runs to a terminal state. This simplifies the writing of phase logic.
    IMPORTANT:
    Uploading data into the material database has two constraints:
    • Some fields are only editable at configuration time. Only fields that may be changed at runtime will support uploading values.
    • Security may limit the set of users allowed to modify the database. The
      FactoryTalk Batch
      Server service must have adequate permissions to store to the material database.
TIP:
When the Automatic Upload function is enabled, the
FactoryTalk Batch
Server automatically uploads the appropriate report values when the batch transitions to a terminal state. If the
FactoryTalk Batch
Server stops while a material enabled phase uploads its report parameters, these report parameters upload again during a Warm or Warm All Batch Server Restart. This also occurs when a material enabled phase transitions to External while the report parameters are being uploaded. When the material enabled phase transitions back to Program mode, the report parameters are uploaded a second time. Sometimes this generates an error that puts the batch in Hold. Issue a clear failures command, restart the batch, and execution will proceed normally. To avoid this, disable the Automatic Upload function and perform report parameter uploads using phase logic requests.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal