Detecting Product Change Events

Model 803 can be configured to detect product change events. When the PCodeTag tag changes, a new product change event is created with the product code coming from the value of the tag.

  • If the product does not exist in the database, it will be created and mapped to the unit the event is on.

  • If the product exists in the database, but it is not mapped to the unit, then it will be mapped to the unit.

  • If the product exists and it is mapped to the unit, then a simple product change event will occur.

  • If the unit is a schedule point and the Path Flag is true and the product does not exit on the path, the product will be created.

Product Change Model 803 rounds a numeric string to an integer and also trims leading zeros from strings containing all numeric characters. It uses whatever string it gets from an historian, numeric characters or otherwise.

To configure Model 803

  1. In the Plant Model, right-click the production unit where you want to detect events and select Configure Events on <production unit>. The Event Detection wizard appears.

  2. On the Configured Models tab, select Product Change from the Model Type list and click Add New Model.

  3. Click the General tab and do the following:

  1. optional: In the Maximum Run Time (Seconds) box, type the number of seconds you want the model to run. The default is 0 (zero), which means the model will not time out. Typically, you will want to limit the run time of the model only if troubleshooting the model (for example, one of the stored procedures is in an infinite loop).

  2. optional: Type the group number in the Model Processing Group box. The Model Processing Group number can be up to six digits.

  3. optional: In the Extended Information box, type additional information that may be useful. This is not used on any reports or displays.

  4. optional: In the Exclusions box, type the values this model is to ignore and not use to trigger the model.

  5. Select Automatically Create Missing Products to create the product if the product does not exist.

  6. optional: Select Automatically Add Products To Paths to add the product to the production execution path, if the unit is a schedule point. By default, the option is not selected and the product will not be assigned to any path.

  7. optional: Select a default product family from the Default Product Family list. Products that were automatically created will be assigned to the selected product family. For more information, see Product Families.

  1. Click the Identify Input(s) tab to identify and select the historian tags used for input.

  1. If the tag is to be set as a trigger, select the Trigger check box. A minimum of one trigger tag is required.

  2. Click the Browse button beside the Tag box. The Tag Search dialog box appears. Click Search (you can enter search criteria prior to clicking the button if necessary). Select the tag and click OK.

  3. From the Attribute list, select either Value or Timestamp, depending on whether you want the value or time of the tag to be passed.

  4. From the Sampling Type list, select the type of sampling that is applied to the tag. For more information on sampling types, see Sampling Types.

  5. In the Time Offset box, enter the number of seconds backward from the trigger time that the next value will be retrieved.

For example: If you have trigger tag A in the list and you also have another tag B that is used as an input in the VB Script, you can specify what the time offset will be for tag B. This would be the amount of time backward from the trigger time that the EventMgr would attempt to get the ’Last Good Value’ for tag B. So if tag A changed at 9/28/07 7:00, and you specified a 10 second offset for tag B, then the EventMgr would attempt to retrieve the Last Good Value for tag B starting at 9/28/07 6:59:50.

  1. In the Precision box, enter the number of digits to the right of the decimal point to use. This applies to numeric tag values only.

NOTE: If the tag value contains only numeric values, it is interpreted as a number. Any digits after the decimal point are rounded to the specified precision, and any leading zeros are trimmed. If this is not desirable, the use the Product Code script to manipulate the parsing of numeric Product Codes. If the tag value contains alpha characters or otherwise cannot be parsed as a number, it is interpreted as a string.

  1. Click the Scripts tab to edit sample scripts or write script logic.

    The following functionality is available on each tab.

  2. Click . The Script Builder dialog box appears where you can edit the existing script or to write script logic.

  3. In the Script Builder dialog box:

  • Click . The Select Alias dialog box appears. Select the Alias and click OK. The Alias letter appears in the Script box.

  • Click Check Syntax to ensure you have entered the VB Script correctly.

  1. Click the Define Product Code Script tab to edit the VB Script. "ProductCode" is the required keyword. The script will be used to generate the product change event when the model is triggered. It will support the expression: ”ProductCode = Null” which will signify that there is no event to process and will prevent the model from firing.

  1. Click to activate the model.

See Also