Whenever we release a large set of new features, it's always interesting to watch how those features are received and utilized by our users. Most users prefer to 'click and discover' vs. 'read the manual', and apparently the scan class button is too inconspicuous. This article aims to shed some light on scan classes and offer some tips about their advanced features.
What is a Scan Class?
A scan class defines how frequently FactorySQL will receive updates from the OPC server. The default scan class for SQLTags (appropriately named "Default") is set up for 5 seconds. This means that any tags in this scan class will update at most every 5 seconds. We say 'at most', because if the tag didn't change in the PLC, then the SQLTag won't update, of course. This is pretty slow, and we invite users to feel free to modify the default scan class. Without further ado, let's see how to modify scan class settings.
Scan Class Modes
There are three modes that a scan class can run in. The most common mode is Direct mode. In this mode, the scan class always runs at a constant Rate (the Low Rate), which is the amount of time in milliseconds between updates. All modes of scan classes also have a Stale Timeout, which is the amount of time (in milliseconds) that can elapse after a scheduled update before the tags in that scan class are considered Stale. (If you aren't already familiar with them, see the user manual's discussion of SQLTags quality codes here)
Most users will only ever use Direct scan classes. It will often make sense to have more than one scan class. For example, suppose you have some control points that you want very quick updates on, perhaps to show feedback of a momentary button or some similar control device. Maybe you have other data that doesn't need such quick updates. You could have a scan class named 'Fast' that was set to update every 500 or 250 milliseconds, and another scan class named 'Normal' that was updating every 1250 milliseconds. This way, the system knows to expend more resources updating those crucial tags quickly, but isn't bothered by the bulk of the tags that don't need such a fast update rate.
There are two other scan class modes besides Direct mode. They are Driven and Leased modes. A Driven scan class will toggle between a High Rate and a Low Rate, based upon the value of some other tag. This can be useful for tags that need very fast updates only when some condition is true. For instance, the values of an oven may need very fast update rates, but only when the oven is on. To set up a driven scan class, set up a tag that will represent the condition that drives the rate of your driven scan class. The only 'gotcha' here is that the tag that drives your scan class cannot be in that driven scan class. Other than that, setting up a driven scan class is quite easy
The last kind of scan class mode is the Leased mode. A leased scan class also toggles between a High Rate and a Low Rate. Whenever there is any active subscription for a tag in a leased scan class, the scan class will run at its high rate. If nothing has a tag from the scan class subscribed, it will run at the low rate. This is like an on-demand system. When a FactoryPMI window is opened that has bindings for tags in a leased scan class, the scan class will start running at its high rate. When all windows that deal with that scan class are closed, it will run at its low rate. If the low rate is zero, that scan class is essentially disabled or turned off. This mode is useful when bandwidth is expensive, such as a satellite connection, or any time when you don't want the PLC to be polled unless there is a need.
As you can see, scan classes offer the designer a great deal of flexibility when creating HMI/SCADA applications with FactorySQL and FactoryPMI. While the Direct scan class will suffice for the majority of users, we've seen some motivating examples of advanced situations where Driven and Leased scan classes can be useful. If after reading this article, you realize that you'd like to fine tune your scan class settings, but you've already created a few tens of thousands of tags, don't worry! It is easy to bulk-modify tags to modify which scan class they are assigned to. Simply select multiple tags and only edit their scan class property. Even better, use the Tag Search button to quickly find and sort through your tags so that re-assigning their scan classes is a snap.
About Inductive Automation
Inductive Automation pioneered the first full-featured web-launched HMI/SCADA system in the world. Its standards based, database-centric architecture receives accolades from plant managers, IT managers, and system integrators worldwide. With a commitment to software quality and technical support second to none, Inductive Automation is at the forefront of industrial software.