Creating a Crew and Shift
Model 801 creates crew and shift records from tags. When the shift tag value changes, Model 801 retrieves the new value from the shift tag and crew tag and checks for an existing record for the current time. If no record exists, then a new record is created. If any records exist between the start time and end time of the new record, the existing records are deleted and replaced with the new record.
If gaps are allowed between shifts (the Chain Shifts option is selected), then the start time is the time of the tag change and the end time is the start time plus the value of the shift time parameters.
NOTE: There is no crew message for the Message Bus.
To create a crew and shift schedule from tags
-
In the
Plant Model, right-click the production unit where you want to create a crew and shift schedule and click Detect Events on <production unit>. The Event Detection wizard appears.
-
On the Configured Models tab, select Crew Schedule from the Model Type list and click Add New Model. Three new tabbed pages appear: General, Identify Input(s), and Scripts.
-
On the General tab, do the following:
-
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).
-
optional: Type the group number in the Model Processing Group box. The Model Processing Group number can be up to six digits.
-
optional: In the Extended Information box, type additional information that may be useful. This is not used on any reports or displays.
-
optional: In the Exclusions box, type the values this model is to ignore and not use to trigger the model. Use a comma to separate values.
-
If gaps in the shift are allowed, select Chain Shift Times.
-
Click the Identify Input(s) tab to select tags as inputs.
-
If the tag is to be set as a trigger, select the Trigger check box. A minimum of one trigger tag is required.
-
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.
-
From the Attribute list, select either Value or Timestamp, depending on whether you want the value or time of the tag to be passed.
-
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.
-
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. -
Click the Scripts tab to edit sample scripts or write script logic. On each tab, a sample script is provided, which you can use or you can click to write script logic.
The following functionality is available on each tab. -
Click
. The Script Builder dialog box appears where you can edit the existing script or to write script logic.
-
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.
-
Click the Define Crew Logic tab to edit the script that generates the crew name when the event is triggered. It will support the expression ”Crew=Null” which will signify that there is no record in the Crew/Shift table and will prevent the model from firing.
-
Click the Define Shift Logic tab to edit the script that generates the shift name when the event is triggered. It will support the expression ”Shift=Null” which will signify that there is no record in the Crew/Shift table.
-
Click the Define Duration Logic tab to edit the script that generates duration when the event is triggered. It will support the expression ”Duration=0” which will signify that there is no record in the Crew/Shift table. The default is 8.
-
Click
to activate the model.