<< Click to Display Table of Contents >> Example: Automatic Log Report |
![]() ![]() ![]() |
This example will show the steps for a simple log report. A more complex example that incorporates some extra features is described later in this section.
To use the Strategy Controller you must first plan the steps needed and define any SpecView variables that will be required. In this example we want to watch a programmer controller to see when it starts a program and note the time it starts. When the program is complete we want to note that time and create a log report that covers the duration of the run.
These steps are required:
1 Create two SpecView Date/Time User Variables, one for the start time and one for the stop time
2 In Runtime Mode, define the log report format that you want to use
3 Define the first Strategy Controller event that watches for the start of the program
4 Define an action to time stamp the program start
5 Define the second Strategy Controller event that watches for the end of the program
6 Define an action to time stamp the program end
7 Define another action to generate the log report
Step 1:
Create two SpecView DateTime User Variables, one for the start time and one for the stop time
Open the Variables List by clicking the tool and choose 'New DateTime User Var' from the New menu:
Enter the name: 'Program Start Time'
Click OK to create the User Variable.
|
Repeat the above steps to create a second User Variable called 'Program Stop Time'.
(Note: To see the values of these DateTime User Variables when in Runtime Mode drag and drop them onto the screen (GDW), or add them to the Quick List.)
Step 2:
Define the log report format that you want to use for the file.
Click the Save tool to save the changes and click Run
Create the Log Report Format to be used for the automatic report.
Choose 'Convert Log File' from the Logging menu:
Click the 'Create...' button on the Log Report Setup box:
Select the variables from the list on the left to put into the report and click Add.
Then for the Start Time and Stop Time click Var and choose the variable from the drop-down-list:
Ensure that the 'Start Time' and 'Stop Time' fields use the same SpecView User Variables that you created in Step1.
Step 3:
Define the first Strategy Controller event that watches for the start of the program
Go back into Edit Mode (offline) and choose Strategy Controller from the Setup menu.
Note: Ensure Strategy is 'Offline' on the Online Features menu while editing the Strategy. |
|
The Strategy Engine box is displayed:
Click the Add button to add a new Event.
(The left side of the Strategy Engine setup box is for the Events and the right side is for the Actions associated with those Events.)
|
Click the Value based button |
The Value Based Event box is displayed:
In the Description field enter: 010 Watch Program Start
Events are listed in alphabetical order so it is a good idea to use a numeric prefix so that related events may be grouped together in the list. (this is for convenience - list order has no impact on how events are triggered).
Then click the Choose button to select the variable that the Strategy Controller will monitor
The Variables List will appear. Find the variable that you want to monitor to determine the start of the log report.
In this case, the parameter is 'Program Status'. The type of instrument that you are using will determine which parameter you want. If in doubt, please contact the instrument manufacturer.
Click the arrow to drop down the list for 'Test to Perform' In this case we want '= (Equal To)' |
|
Next Click the Set Value button. The type of parameter that you selected to watch will determine the type of box that appears. In this case it is an 'enumerated' variable, which gives you a list to choose from. Double click the one you want, in this case 'Run' |
The Value Based Event box should now look like this:
Click OK to close the 'Variable Based Event' box
As of SpecView version 3.1.253, it is possible to enter notes for Events.
Notes can aid in leaving descriptions for users who will be programming Strategy Controller in the future.
Events with notes will appear with a star at the end of it in the Events list.
The Strategy Engine Setup box should now look like this:
Step 4:
Define an Action to time stamp the program start
Click the Add button on the Action side of the box. The Action box is displayed:
Enter a description, such as 'Time Stamp Program Start'.
(Actions will remain in the same order, so no additional numbering is required. To change the order use the 'Up' and 'Down' buttons.)
The default action is 'Download Specific Value' and that is the one needed now.
In the Variables List click the plus sign by 'User Variables', the plus sign by DateTime.
Click and drag 'Program Start Time' into the Action box.
We want SpecView to copy the current time to this variable so click the Current Time checkbox:
Click OK. |
|
The box should now look like this:
Step 5:
Define the second Strategy Controller event that watches for the end of the program
Click the Add button on the Event side of the box. Enter a description. Click the Choose button and select the variable to watch that will tell SpecView that the program is complete. Select '= (Equal To)' for the Test to perform. Click the Set Value button and choose the appropriate value. The box should look something like this, depending on the variables you have chosen.
Step 6:
Define an action to time stamp the program end
Click the Add button on the Action side of the box. Enter a description, such as 'Time Stamp Program End'.
The default action of 'Download Specific Value' is the one that is needed now.
In the Variables List click the plus sign by 'User Variables', the plus sign by DateTime.
Click and drag 'Program Stop Time' into the Action box and check the 'Current Time' box:
Step 7:
Define another action to generate the log report
Click the Add button again on the Action side of the box. Enter a description and select 'Logging: Convert Specific Log File Format' as the action type.
Choose the log format you defined in Step 2.
Click OK
The Strategy Engine Setup box should now look like this:
The setup is now complete. Click OK to save the Strategy.
Strategy events in SpecView are 'Edge Triggered'. This means that the Event is triggered when SpecView sees that occurrence of the Event conditions. When SpecView is started (either by starting the program or by going into Runtime Mode from Edit Mode) all the events are checked. If an event is true, the Strategy Controller will execute the actions associated with that event.
In this example, if the program is already running when SpecView is started '010 Watch Program Start' will trigger and the time stamp will be done. If this is a problem extra Strategy steps and intermediate boolean variables must be used to prevent the unwanted triggering of the event. An example of this is shown later in this section.
NOTE: This 'Edge Triggering' is such that once an Event has triggered, for example, Process Value > 200, then the Event will not be triggered again until the value has gone below 200 and then above 200 again.