Driven Scan Class
Driven scan classes set the polling rate (Fast Rate and Slow Rate) dynamically for tags based on a given condition, which is actually a logical comparison. In simple cases, when the logic comparison is true, the Fast Rate applies, otherwise the Slow Rate applies. Below, we have examples of three common ways to run a driven scan class. By Machine State, by a Manual Trigger, and by Time of Day
Driven Scan Class - Machine State
Machine states being tied to a Boolean tag, as described below, is one example of a condition where the logic comparison is true when the machine state is ON.
To add a driven scan class based on the machine state
Lets add a driven scan class that updates the tags based on when the machine is ON.
-
In the Scan Class Editor, create a new scan class by clicking on the green + icon on the lower-left of the window.
-
Name the scan class, for example, you can name it Driven Machine State, and set the Mode to Driven.
This scan class executes based on the condition you set on the Driving Tag. -
Click on the tag icon next to the Driving Tag box, and choose the tag you want to set the condition on.
-
Set Operator to = and the Value to 1.
-
Set the Slow Rate to 10,000 (10sec) and the Fast Rate to 1000 (1sec).
When the machine is ON it will use the Fast Rate, when the machine is OFF it will use the Slow Rate. -
Click OK.
Now in the Tag Browser you will see a check box next to the tag for which you have set the machine state of ON and OFF on it.
Driven Scan Class - Manual Trigger
Driven scan classes can be used to allow operators to speed up or slow down polling rates on demand based on another trigger value.
To add a driven scan class based on a trigger value
First we need to create the Trigger tag.
-
In the Tag Browser, right-click on the Tags folder, then go to New Tag > Memory Tag to create a memory tag.
The Tag Editor window is displayed. -
In Tag Editor, enter:
Name: Trigger
Value: false
Data Type: Boolean
-
Click OK to add the Trigger tag to the Tag Browser.
Now lets add a driven scan class that updates the tags based on the value of the Trigger tag we just created.
-
In the Scan Class Editor, create a new scan class by clicking on the green + icon on the lower-left of the window.
-
Name the scan class, for example, you can name it Driven Manual, and set the Mode to Driven.
This scan class executes based on the condition you set on the Driving Tag. -
Click on the tag icon next to the Driving Tag box, and select the Trigger tag you want to set the condition on.
-
Set Operator to = and the Value to 1.
-
Set the Slow Rate to 4000 (4sec) and the Fast Rate to 500 (1/2sec, a very fast rate).
When the Trigger is equal to 1, it will use the Fast Rate and you can see the values changing very fast. When the Trigger is equal to 0, it will use the Slow Rate.
-
Click OK.
Now in the Tag Browser you will see a check box next to the Trigger tag for which you have set the on/off condition on it.
Driven Scan Class - Time of Day
Driven scan classes can be used as the polling rate for tags to trigger at different rates at different times of the day. They can also be used as a one-shot event at a specific time.
To add a driven scan class
Let's add a driven scan class that updates the tags based on a time of day (using an expression). You can also use other tag values to drive the condition, for example when a machine is on.
First, we need a tag that provides the condition.
-
Create an Expression Tag in the root folder of Tags and call it Poll Time that is a Boolean with the following expression:
dateExtract(now(0), "hour") >= 8 &&
dateExtract(now(0), "hour") <= 17
The value will be true when the time is between 8am and 5pm and false otherwise. So with that tag we can poll the PLC values during that time. -
Click on the Timer icon in the Tag Browser to open the Scan Class Editor.
-
Click on the green + icon to add a new scan class and set the following:
Scan Class Name: Time Driven
Mode: Driven
Slow Rate (ms): 0 so we don't poll when the condition is false. If you set
the value to 10 seconds it simply would just poll slower when the condition
is false.
Fast Rate (ms): 1000
Driving Tag: Poll Time expression tag and set the condition Operator:= and Value: 1.0.
-
Click OK to save.
Set the scan class on any tag to this one to update on this condition. If you use this scan class for history, the tag will only store history during those times.