|
|
Topic: P190 |
Scan Interval and Use of the Maximum Scan Interval Tag |
|
CPU's continuously Scan the ladder logic to evaluate it. The Scan Interval or Scan Time refers to the amount of Time it takes the Programmable Controller to evaluate a ladder logic program one time. The Scan Interval is typically in the low-millisecond range.
The Maximum Scan Interval setting is a timer used to help avoid excessive Scan Times that could result from abnormally heavy communications activity. This setting is located on the Hardware Configuration Panel of the CPU as shown below.
Before understanding the use of the Maximum Scan Interval setting, take a moment to understand the nature of the events that make up a single Scan in the CPU. Within this document, the word Task refers to a given function the CPU must perform. For example, writing to Local Base Group outputs is a Task. Writing Retentive Tags to SRAM is a Task. Do not confuse it with tasks that comprise a Ladder Logic program.
In the course of One Scan, the CPU works on many Tasks. Some Tasks must be handled on every Scan cycle. These Tasks are called Critical Tasks. For example, solving Ladder Logic and updating the I/O of the Local Base Group are Critical Tasks.
Tasks that do not need to be handled for the Scan to finish are called Non-critical Tasks. The CPU may delay processing Non-critical Tasks until the next Scan cycle if the Scan Time has reached the Maximum Scan Interval time setting for the current Scan.
Some examples of Tasksthe CPU performs are:
- Logic Scan: Solving Ladder logic
- Data Logging*: Saving a Data Log File to the USB Out Port
- SRAM Backup*: Saving Retentive Tags to the battery-backed SRAM
- Write Local Outputs: Updating Outputs of the Local Base Group
- Write remote Outputs: Updating Outputs of a Remote Base Group (one Remote Base Group is updated per scan)
- Read Local Inputs: Reading Inputs of the Local Base Group
- Service Communications: Handling Communications on various ports, like RS-232, RS-485 and Ethernet
- Read Remote Base Group Inputs: Reading Inputs of a Remote Base Group (the Messages received from the Remote Base Group are the replies to the Write Message sent to that Group)
- Various Internal Housekeeping Items
* Although SRAM Backup and Data Logging are critical tasks, all the Tags that are logged or Retentive may not be serviced on every Scan. If they are serviced, the action must complete before the Scan may be considered complete.
The Maximum Scan Interval field sets the Maximum Time allowed for One Scan to complete. The default value for Maximum Scan Interval is 500ms with a valid range of 1 to 1000mS.
This setting can be used to ensure the Scan Interval will not exceed a length of time appropriate for a given application. For example, a longer Scan Time may occur due to excessive communications events on One Scan.
If a shorter Scan Interval is considerably more important than communications, the Maximum Scan Interval may be set lower. If completing communications Tasks is considerably more important than consistent Scan Times, the value should be adjusted higher to allow more time for communications during each Scan Interval.
These are possible conditions involving the Maximum Scan Interval:
-> The Scan is interrupted.
-> A test is run to see if all Critical Scan Tasks have completed.
- If all Critical Scan Tasks are complete, the next Scan begins.
- If all Critical Scan Tasks are not complete, the system goes to Stop.
Note: The system goes to Stop based on the assumption that the Scan Time was excessively long due to improper operation.
Note: There is no right value for a given application. Use caution in setting the Maximum Scan Interval too low to avoid unnecessarily kicking the system to Stop mode.
The I/O in the Local Base Group in a Productivity Suite system is scan-synchronous. That is, all Input points will be read and all Output points will be written once per program scan.
With the P Series (P3 & P2) CPUs, the I/O in Remote Base Groups may or may not be scan synchronous based on several factors, including:
Considering all the factors that affect the turnaround time for Ethernet messages to and from Remote Base Groups, the following management scheme is in place with built-in tolerance for less than ideal network configurations. In very basic terms, the P Series CPU just sends messages to write outputs of a Remote Base Group. The Remote Base Group simply responds to each message with the corresponding hardware’s Input status.
Notes: Each HSO and HSI module typically adds 1 to 2 ms per scan per module, regardless of whether it is in a local base or Remote base. An HSI/HSO in a Remote Base will make the CPU treat that Remote Base as if it's Local (i.e. it will wait for replies from the modules before going to the next scan).
In a Remote Base Group, each Base with Discrete I/O installed will require one message. Each intelligent I/O module will require a message. So, writing the Remote Base Group Outputs may involve the sending of between 1 and 55 Ethernet Messages to the Remote Base Group. For example, a Base Group with any number of discrete I/O modules and one intelligent I/O module will require two messages: one to update the discrete I/O and one just for the intelligent I/O module. During the Write Outputs event in the scan, all of the messages that a Remote Base Group requires are sent as quickly as the network will allow. The scan will not finish until all are sent.
This will involve the same number of messages that were required to update outputs. In the example above, two messages were sent to Write Outputs. Upon receiving a Write Output Message, the Remote Base Group will immediately work to respond with the corresponding InputStatus Messages. With an efficient dedicated Ethernet network, it is typical to receive all Input updates from that Remote Base Group within the same scan. After receiving all InputStatus Messages, the P Series CPU will consider that Base Group ready for another set of Write OutputsMessages.
With a slow network, or due to other variables as mentioned before, there can be instances where the responses from a Remote Base Group could be relatively slow compared to Scan Times. Therefore, the P Series CPU does not sit idle and wait for all InputMessages to return from the Remote Base Group before ending the Scan and beginning the next logic Scan.
Even though the P Series CPU does not need to receive all the responses from a Remote Base Group on the same Scan as they were sent, it must receive them within the time specified in the P Series CPUHardware Configuration field: Timeout between data query and response. If a response is not received in time, the Remote Base Group is considered missing. Depending on the Hot Swap setting for that Remote Base Group hardware, this fault could be Critical or Non-critical.
The Remote Base Group Update Order is configured in the Px-Rs or Px-RX. The Remote Base Group scan interval can be set to Remote I/O, Local I/O or Custom. With the Remote I/O update rate selected, the Remote Base GroupOutputs are scheduled sequentially, one group per scan. The chart below shows four Remote Base Groups, with their addresses set 01-04. (If Remote Base Group 04 were set for 12 instead, there would be no change in behavior.)
The Write Outputs messages are only sent if the Remote Base Group is ready for an update. A Remote Base is considered ready for an update if it has responded to all of the messages from its last Write Outputs messages.
If a Remote Base Group is not ready to receive an update during its time slot, it is skipped and no update is made on that Scan. The update order does not change, and the P Series CPU moves on to the next Remote Base Group on the next Scan. If a Remote Base Group is taken offline during operation (Hot Swap would need to be Enabled), the P Series CPU will update the next Base Group instead.
With the RemoteModule I/O Update Rate set to Local I/O, the Remote Base GroupOutputs will update synchronously with the CPU scan. In the chart below, Remote Group 4 is configured with a Local I/O update rate. The chart shows that the CPU scans Remote Group 4 on every scan as it does with the Local Group.
The Remote I/O Module Update Rate can also be configured with a Custom scan interval. The scan rate can be set to either a scan based or time based interval. The charts below show how the I/O will be updated when using a scan based interval. In the first chart, Remote Group 4 is configured with a Custom interval set to update every 3 scans with no offset. The second chart shows Remote Group 3 with a Custom scan of every 3 scans and Remote Group 4 configured with a Custom scan of every 3 scans plus an offset of 1.