Scan Classes
What is a Scan Class?
Scan classes dictate the rate of execution of Tags, and therefore play a crucial role in the design of large and high-performance systems. It is beneficial to have multiple scan classes so you can set groups of Tags to run at different rates. Since it takes up computer resources to constantly fetch new Tag values, this frees up a lot of resources if many of the Tags are running slower. Some Tags you may wish to see updated at 250-500ms, while others may not be so crucial and may only need an update every 10-30 seconds.
Creating different scan classes allows you to organize your Tags into groups that subscribe (continually poll) at different rates. It is good practice to put some forethought and planning into the organization of your Tags and scan classes.
Tag Execution by Scan Class
Tags are executed by scan classes inside of a Tag Provider. In a typical system, there are a number of scan classes and one or more Tag Providers. Tag Providers can be either internal or external.
Internal provider stores the Tag configuration and values inside Ignition. Tags inside Internal Providers are available to other Ignition Gateways that use the Remote provider type.
External provider stores Tag configuration and values in a database. Tags stored in an external provider are available to all Ignition installations that have access to that database. One of the installations must be specified as the Tag's driver. The driving system has a copy of the scan class that it executes, which in turn evaluates the Tag. The value is stored to the database and all of the other installations are notified of the new value.
When referring to scan classes, we often use the words scan class "type" and "mode" interchangeably throughout this manual. Ignition has three scan class modes (i.e., Direct, Driven, and Leased), but there can be different variations of these modes that can change their behavior. For example, the Driven scan class has "one-shot" and "any change" options that you can set, and we often refer to these as different "types" of scan classes as well. When you create a new scan class, you will select one of the three "modes" and any properties you need to build your scan class.
Types of Scan Classes
Types of Scan Classes
Watch the videoTags are assigned a scan class that determine how often they update. For example, how often an OPC value is polled from the PLC, how often an Expression Tag calculates its expression, and how often a Query Tag runs its query. It's easy to create scan classes in Ignition for just about any scenario you can think of. Scan classes are extremely powerful and flexible, and you can create them based entirely on your individual business requirements.
There are three different scan class modes in Ignition that you can use to build your own, each with a different options:
Direct - executes at a fixed rate. Every Tag that uses a direct scan class will poll the PLC at the slow rate setting at all times (24x7x365). Ignition provides two Direct scan classes to help you get started, but you can change them however you'd like. It is recommended to adjust the "Default" scan class to a slower rate as all new tags are automatically added to this scan class.
- Default - runs at a rate of 1 second.
- Default Historical - runs at a rate of 10 seconds.
Driven - executes fast or slow based on a condition. The rate of the Driven scan class is determined by a condition based on the value of the selected Driving Tag. This condition is a simple comparison between a driving Tag's value and a static number (equal to, greater than, etc.). While the condition is true, the scan class executes at the fast rate. If false, it runs at the slow rate. (It's useful to keep in mind that the driving Tag can also be an Expression Tag that performs complex calculations and references other Tags. In this way, it's possible to create robust scan class triggering).
- Driven One-shot - If you want to read Tag values only once on certain conditions (instead of polling), there are two properties that change the behavior of the Driven mode: the One-shot property, and the Any Change Operator option. Using either of these, the scan class does not run at either the fast or slow rate. Instead, it will be triggered once each time your condition is met. Any Change will execute each time the driving Tag value changes, and one-shot will execute once when the comparison condition is true and not again until the condition becomes false and subsequently true.
Leased - executes as on-demand polling. It works similar to the Driven class except there is no driving Tag. Instead, the driving mechanism is whether a Tag is being used on an open window. That is, if a user is looking at a Tag, it runs at the fast rate, and if the Tag is not being shown, it is moved to the slow rate.
When using scan classes with both the fast and slow rates (Driven or Leased), a 0 poll rate can be specified. This means the Tags in this scan class will not poll at all. Do not set a 0 poll rate on Tags that are storing history or need other regular updates.
Scan classes are created and edited in the Designer, and described in detail in Editing Scan Classes.