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 theVisual Basiccontrol. In the area model, the tags must be configured as integers for theFactoryTalk BatchServer 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 inFactoryTalk Batch Equipment Editor, theFactoryTalk BatchServer 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 inFactoryTalk Batch Equipment Editormust 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.
- TheNamein theFactoryTalk Batch Equipment EditorEdit Equipment Moduledialog box must agree exactly with theNameproperty of the phase.
- Phase controls can be added toVisual Basicforms 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 correspondingVisual BasicPhase Control name created as part of a control array is CHARGE(1). The 1 is theIndexproperty of the control. The programmer must decide when to use a control array or individual names for phase controls.
- The phase control sets theStepIndexproperty to theStepIndexInitialValueupon entering the control event (OnRun,OnStop, and so on.). Use this value to reference the first step in theOnRunevent 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 theIntervalproperty. For example, if theIntervalvalue 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 theOnRunevent. This approach ensures that the download is only issued once. The next step should wait until the request register is reset to zero byFactoryTalk Batchbefore 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 aVisual Basicphase, make an executable file (.exe). Start theVisual Basicphase, start theFactoryTalk BatchServer, check that the communication between the two is good (tag verification should also be done at this point until all tags verify successfully). TheVisual Basicphase is now ready to have a recipe run against it.
Provide Feedback