Application notes

The following are points to remember when programming PC-based phases:
  • There should be a data type mismatch between the request data tags configured in the area model and the tags configured on the
    Visual Basic
    control. In the area model, the tags must be configured as integers for the
    FactoryTalk Batch
    Server to work correctly; in the 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.
  • The
    Name
    in the
    FactoryTalk Batch Equipment Editor
    Edit Equipment Module
    dialog box must agree exactly with the
    Name
    property of the phase.
  • Phase controls can be added to
    Visual Basic
    forms as control arrays. In 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.
  • The phase control sets the
    StepIndex
    property to the
    StepIndexInitialValue
    upon entering the control event (
    OnRun
    ,
    OnStop
    , and so on.). 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).
  • Remember that the code is executed based on the value in the
    Interval
    property. For example, if the
    Interval
    value is 1000 milliseconds, the code is repeated every second.
  • If a download of parameters is required, place it in the first step, as 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.
  • If assigning a value to a variable, and it is not in a case select structure 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.
  • If using multiple phase controls on the same form, make sure that each 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.
  • To run a
    Visual Basic
    phase, make an executable file (
    .exe
    ). Start the
    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.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal