The text of a manual · part 36 of 45
Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Appendix C - Maximizing System Performance
Pages 287 to 300 of 388, from Enhanced and Ethernet PLC-5 Programmable Controllers User Manual
The original document is the PDF (5.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1785-L20B and Allen-Bradley 1785-L40B
Page 287
Appendix
C
Maximizing System Performance
Using This Chapter For Information About
Go to Page
Program scan
C-1
Calculating throughput
C-5
Input and output modules delay
C-6
I/O backplane transfer
C-6
Remote I/O scan time
C-6
Controller time
C-11
Example calculation
C-12
Performance effects of online operations
C-12
Inserting ladder rungs at the 56K-word limit C-13 Using program control instructions
C-14
For information about the time that it takes the controller to execute a specific instruction, see Appendix D.
Program Scan
Since the program scan is comprised of the logic scan and housekeeping, any event that impacts the time of one segment affects the program scan. You can monitor the scan time by using the controller status screen in your programming software. If no change in input status occurs and the controller continues to execute the same ladder logic instructions, the program scan cycle is consistent. In real systems, however, the program scan cycle fluctuates due to the following factors: • false logic executes faster than true logic • different instructions execute at different rates • different input states cause different sections of logic to be executed • interrupt programs affect program scan times • editing programs while online affects housekeeping times
1
Publication 1785-UM012D-EN-P - July 2005
Page 288
C-2
Maximizing System Performance
Effects of False Logic versus True Logic on Logic Scan Time The rung below - which changes states from one program scan to the next - will change your scan time by about 400 µs. I:000
LN NATURAL LOG Source
00
Dest
N7:0 5 F8:20 1.609438
If I:000/00 is
Then the Rung is
On
True, and the controller calculates the natural log. A natural log instruction takes 409 µs to execute.
Off
False, and the controller scans the rung but does not execute it. It takes only 1.4 µs to only scan the rung.
Other instructions may have a greater or lesser effect.
Effects of Different Input States on Logic Scan Time You can write your logic so that it executes different rungs at different times, based on input conditions. The amount of logic executed in logic scans causes differences in program scan times. For example, the simple differences in rung execution in the following example cause the program scan to vary. I:000 02
Publication 1785-UM012D-EN-P - July 2005
20 JMP rung 1 rung 2
MVM
B3:0 rung 3
MVM
00 20 LBL rung 4
If I:000/02 is
Rungs 2 and 3 are
On
Skipped
Off
Executed
O:013 JMP 02
Page 289
Maximizing System Performance
C-3
If you use subroutines, program scan times can vary by the scan time of entire logic files.
Effects of Different Instructions on Logic Scan Time Some instructions have a much greater effect on logic scan time than others based on the time that it takes to execute each instruction. Program scan time is also affected by the construction of your ladder rungs. The size of the rung and the number of branches can cause the scan time to fluctuate greatly.
Effects of Using Interrupts on Logic Scan Time Program scan time is also affected by interrupt programs. An interrupt is a special situation that causes a separate program to run independently from the normal program scan. You define the special event and the type of interrupt that is to occur. For more information on interrupt programs, see chapters 18 and 19. For example, a selectable timed interrupt (STI) is a program file that you define to execute once every time period. The example shown below has these parameters: • you configure an STI to execute every 20 ms • the STI program takes 3 ms to execute • the logic scan is 21.8 ms • housekeeping takes 3.2 ms The first program scan in this example lasts a total of 28 ms. The program scans look like: Program Scan 1
Program Scan 2
3.2 + Housekeeping
Time = 20 ms STI
21.8 + 3 Logic STI Scan Scan
Logic Scan Housekeeping Time = 0
The STI occurred 20 ms into the first program scan.
= 28 ms
Time = 40 ms STI Time = 40 ms (20 ms + 20 ms) but program scan 1 = 28 ms, meaning that the STI interrupts 12 ms into the second Logic Scan program scan. Housekeeping Time = 0
Publication 1785-UM012D-EN-P - July 2005
Page 290
C-4
Maximizing System Performance
Because the first program scan takes 28 ms, the STI actually occurs 12 ms into the second program scan (28 + 12 = 40, which is the time for the second STI to occur). This example points out that when the STI time period is different than the program scan time, the STI occurs in different places in the program scan. Also note that, due to fluctuations in program-scan times, multiple STIs may be executed during one scan and no STIs during other scans.
Effects of Housekeeping Time In PLC-5 controllers, basic housekeeping takes 3.5 ms. If it takes the controller 21.8 ms to execute a ladder program, the overall program scan time is 25.3 ms. Any increase in housekeeping affects your program scan. The following activities can increase housekeeping time: • editing while in remote run mode • putting block-transfer modules in the controller-resident chassis • using the global status flag files
Editing While in Remote Run Mode The online editing times for ladder programs are as follows: For this Editing Operation
And this Type of Program
The Times are
Accept Rung (after inserting, modifying, or deleting a rung edit)
other than the edited file
0.35 ms per 1000 words no labels
3 ms + 0.35 ms per 1000 words with labels
3.5 ms + 0.35 ms per 1000 words
Test Edits of the program (impacts one program scan) Assemble Edits
IMPORTANT
Publication 1785-UM012D-EN-P - July 2005
0.2 ms to change the status of edits from TEST to UNTEST or UNTEST to TEST no edits pending
0.35 ms per 1000 words edits pending, no labels
2.0 ms + 1.5 ms per 1000 words edits pending, with labels
2.0 ms + 1.9 ms per 1000 words
Editing programs online also delays the execution of PIIs and STIs.
Page 291
Maximizing System Performance
C-5
Putting Block-Transfer Modules in Controller-Resident Chassis Because controller-resident racks cannot be updated until after active block-transfers are completed, putting block-transfer modules in the controller-resident chassis can affect housekeeping by a worst-case time of approximately 100 µs per one word of block-transfer data. Note that this estimate is based on a worst-case scenario. Typically, the effect, if any, on housekeeping will be minimal.
Using Global Status Flag Files The global status flag files are updated during housekeeping. This increases housekeeping time as follows: • each global status flag file on a channel (for example, channel 1A or 1B) adds 3ms • housekeeping time does not increase more than 6ms, even if there are more than two global status flag files If you need two global status flag files, split them across two channels.
Calculating Throughput Throughput is the time that it takes for an output to be energized after its associated input has been energized. You need to consider the following components when evaluating throughput: • input and output module delay • I/O backplane transfer • remote I/O scan time • controller time To calculate throughput, use the following equation: Input Card Delay
+
I/O Backplane
+
Worst-Case Remote I/O Scan Time
+
Worst-Case + Processor Time
Worst-Case Remote I/O Scan Time
+
I/O Backplane
+
Output Card Delay
Publication 1785-UM012D-EN-P - July 2005
Page 292
C-6
Maximizing System Performance
All input and output modules have a “delay time,” which is the time that it takes the module to transfer information to/from the I/O backplane through the I/O module to/from the field device.
Input and Output Modules Delay
Depending on the type of modules you are using, these delay times vary; but, the times must be taken into account when calculating system throughput. Choose modules that perform the function that you need with the lowest possible delay times.
The I/O backplane transfer time is the time it takes for the 1771-ASB adapter module to exchange data with the I/O modules in the same chassis, generally 1-2 ms for a full I/O rack.
I/O Backplane Transfer
This time is fairly insignificant compared to total system throughput, but can be optimized in situations where empty slots or modules that use only backplane power in the chassis exist. For example, if the last four slots of a rack contain a 1785-KA module and power supply (with two empty slots), the 1771-ASB can be configured to ignore those last four slots. For more information about configuring adapter modules, see the 1771 Remote I/O Adapter Module User Manual, publication 1771-UM001.
The remote I/O scan time is the time it takes for the scanner to communicate with each device in the remote I/O system.
Remote I/O Scan Time
Program Scan Loop x y
Remote I/O Buffer
Immediate I/O a b
Data Exchange
I/O Image Table
Update I/O image
Rack 1
Adapter
Data Exchange
Publication 1785-UM012D-EN-P - July 2005 x y
ProcessorResident Rack
Housekeeping
Rack 2
Adapter
Rack 3
Adapter
Remote I/O Scan Loop a write outputs b read inputs Logic Scan
IOT (x) IIN (y)
Page 293
Maximizing System Performance
C-7
These three factors affect the remote I/O scan time: • communication rate • number of rack entries • block-transfers
Communication Rate The communication rate determines the time it takes for the scanner to communicate with each individual entry in its scan list. The following table lists the amount of time required to communicate to a device at each communication rate. Communication Rate (kbps):
Time (ms):
57.6
10
115.2
7
230.4
3
Note that these are full rack times. Smaller racks will decrease this time.
If four full-rack entries are in the scan list, the I/O scan for that channel at 57.6 kbps is 4 x 10 = 40 ms. If you change the communication rate to 230.4 kbps, the I/O scan decreases to 4 x 3 = 12 ms.
Number of Rack Entries You determine the total remote I/O scan time in the remote I/O system by this formula: total remote I/O scan time = # of rack entries X time per rack-entries in the scan list (see on page 7)
If one channel has twice as many racks as another, for example, the scan time for the first channel is twice as long. To optimize this scan time, divide your I/O racks between multiple channels. Place your most time-critical I/O on one channel, and non- time-critical I/O on the other channel. Since all I/O channels are independent, a long remote I/O scan on one channel will not affect the remote I/O scan on another channel.
Publication 1785-UM012D-EN-P - July 2005
Page 294
C-8
Maximizing System Performance
Block-Transfers A block-transfer is an interruption of the normal remote I/O scan in order to transfer a block of data to a specific I/O module. Most of the time that the controller spends in performing the block-transfer is for the handshaking that occurs between the controller and the block-transfer module. This handshaking is embedded in the discrete I/O transfer and has no effect on the remote I/O scan. The remote I/O scan is affected when the actual data transfer occurs. The amount of time that the block-transfer interrupts the remote I/O scan depends on the number of words being transferred, the communication rate, and associated overhead: Use this formula and the table below to calculate block-transfer time: block-transfer time = (number of words being transferred ms/word based on the communication rate) + overhead for the communication rate Communication ms/Word Rate (kbps)
Overhead (ms)
57.6
.28
3
115.2
.14
2.5
230.4
.07
2
For example, if the communication rate is 115.2 kbps and you want to block-transfer 10 words, the interruption of the remote I/O scan is: (10 x .14) + 2.5 = 1.4 + 2.5 = 3.9 ms For the particular remote I/O scan in which the block-transfer takes place, 3.9 ms will be added to the remote I/O scan time. IMPORTANT
Publication 1785-UM012D-EN-P - July 2005
If you select the baud rate as 230.4 kbps, and you are using the serial port or a PLC-5 coprocessor, use channel 2 for better overall system performance.
Page 295
Maximizing System Performance
C-9
Calculating Worst-Case Remote I/O Scan Time Since it is impossible to predict within which remote I/O scan a block-transfer will occur, you only can calculate the worst-case remote I/O scan time. To calculate the worst case time: 1. Determine the normal I/O time (without block-transfers) 2. Add the time of the longest block-transfer to each entry in the scan list. (The controller can only perform one block-transfer per entry in the scan list per I/O scan.) For example, if your system is: Rack 1 BT 10 words
PLC
115.2 kbps
Rack 2 No BTs
Rack 3
BT 20 words
Worst-case I/O scan: (3 x 6)
3 racks at 115.2 kbps*normal I/O scan
+ (20 x .14) + 2.5 longest BT in rack 1
+ 0 no BTs in rack 2
+ (30 x .14) + 2.5 longest BT in rack 3
18 + 5.3 + 0 + 6.7 = 30 ms
BT 30 words
Optimizing Remote I/O Scan Time The best way to optimize your scan time is to place your most time-critical I/O on a separate channel from non-critical I/O. If you have only one channel available for I/O, however, you can still optimize the scanning by using the controller’s configurable scan list. In a normal 4-rack system, the scan list would be: rack 1 rack 2 rack 3 rack 4 If you are using 57.6 kbps, the normal I/O scan is 4 racks x 10 ms = 40 ms. Each entry is of equal priority, so each rack is scanned every 40 ms.
Publication 1785-UM012D-EN-P - July 2005
Page 296
C-10
Maximizing System Performance
However, if rack 2 has the most time-critical I/O, use the configurable scan list to specify: rack 1 rack 2 rack 3 rack 2 rack 4 rack 2 Using this scan list, rack 2 is scanned every other rack. The list has 6 entries, so the normal I/O scan time is 6 x 10 ms = 60 ms. Since rack 2 is scanned every other rack, however, the rack 2 effective scan time is 2 x 10 ms = 20 ms. The remaining racks are scanned every 60 ms. Thus, the tradeoff for the more frequent scanning of rack 2 (every 20 ms) means that the other racks are scanned only every 60 ms. You can also optimize block-transfers within the channel. You block-transfer to only one block-transfer module per entry in the scan list per I/O scan. If you have three block-transfer modules in one I/O rack, it takes a minimum of three I/O scans to complete the block-transfers to all of the modules: System Optimized for Discrete-Data Transfer
Adapter
Adapter
PLC
Adapter
With this arrangement, only one block-transfer can occur to each BT module for every 3 discrete I/O scans. BT
BT BT
Maximum scan time
= 3 discrete scans + 1 block-transfer = 3D + 1BT
Minimum time to complete a block-transfer to all modules
= 3 (3D + 1BT) = 9D + 3BT
If you place the three block-transfer modules in different racks, however, you can block-transfer to all three modules in one I/O scan.
Publication 1785-UM012D-EN-P - July 2005
Page 297
Maximizing System Performance
C-11
To optimize your system layout for block-data transfers, use an arrangement similar to the following: System Optimized for Block-Data Transfer
Adapter
BT
BT
Adapter
PLC
Adapter
With this arrangement, a block-transfer to each BT module can occur in a single discrete I/O scan. Maximum scan time
= 3 discrete scans + 3 block-transfers = 3D + 3BT
Minimum time to complete a block-transfer to all modules
= 1 (3D + 3BT)
BT
= 3D + 3BT
The controller time is the time needed to process the inputs and set the corresponding outputs. This controller time varies for different controllers and is based on input buffering, program scan, etc.
Controller Time
In a PLC-5 system, inputs are buffered between the I/O image table and the remote I/O buffer. The movement of inputs from the remote I/O buffer to the input buffer is asynchronous to the movement of data from the input buffer to the input image table.
Immediate I/O 1 a b
Input Buffer Remote I/O Buffer
Data Exchange
I/O Image Table
Update I/O image from input buffer
Rack 1
Adapter
Data Exchange x y
ProcessorResident Rack
Housekeeping
Rack 2
Adapter
Rack 3
Program Scan Loop
Adapter
Remote I/O Scan Loop
IOT (x) IIN (y)
a write outputs b read inputs Logic Scan
Publication 1785-UM012D-EN-P - July 2005
Page 298
C-12
Maximizing System Performance
The worst-case controller time is: Variable
Value periodic input buffer update from remote I/O buffer
10 ms one program scan to guarantee inputs received xx ms one program scan to guarantee outputs received xx ms 0.18 ms times number of racks xx ms total
For a 3-rack system with a 20 ms program scan, the worst-case controller time is: 10 + 20 + 20 + (0.18 ∗ 3) = 50.54 ms.
Example Calculation
Performance Effects of Online Operations
Based on the results of each throughput component calculation presented within the chapter, an example of a worst-case update time calculation is: Variable
Value input card delay
10 ms typical
I/O backplane
1 ms worst-case remote I/O scan time
30 ms worst-case controller time
50.54 ms worst-case remote I/O scan time
30 ms
I/O backplane
1 ms output card delay
1 ms typical total
123.54 ms
The performance of the PLC-5 controller is affected when you perform online operations via a DH+ link to your program files while in Run mode. Affected activities are: • DH+ messages • serial port messages • channel 3A messages • remote block-transfers
Publication 1785-UM012D-EN-P - July 2005
Page 299
Maximizing System Performance
C-13
The amount of time that the messaging and block-transfers can be delayed is proportional to the size (K words) of the ladder file. The following table lists the performance effects (when using any of the 6200 Series PLC-5 Programming Software releases that support the controller you are using). Effected Data Transfers
Online Operations via any DH+ Channel:
Remote block-transfers
20 ms/K words
50 ms/Kwords
DH+ messages
20 ms/K words
50 ms/Kwords
Serial port messages
200 ms/K words
50 ms/Kwords
Channel 3A messages no impact
50 ms/Kwords
Perform a Page Up/Page Insert/Delete Ladder Down at the End of a Rungs Program File
You should re-design your programs to avoid possible communication pauses if you currently: • use large ladder logic program files • have time critical remote block-transfers and/or serial, DH+, and channel 3A messages • must edit the program online during run mode For best controller performance, segment your program files by using modular programming design practices, such as main control programs (MCPs), sequential function charts (SFCs), and the jump to subroutine (JSR) instruction.
Effect of Inserting Ladder Rungs at the 56K-word Limit
Performing run-time or program-mode editing of ladder files that approach the maximum program file size of 57,344 words could:
This consideration applies to PLC-5/60, -5/60L, -5/80, and -5/80E controllers when you are editing a program file that approaches the maximum file limit of 57,344 words.
To avoid or correct this problem, segment your program file using modular programming, such as main control programs (MCPs), sequential function charts (SFCs), and the jump to subroutine (JSR) instruction.
• prevent the rung from being inserted • cause suspension of the operation by 6200 Series PLC-5 Programming Software (release 4.3 and later)
If you cannot segment your program file, save the file often while editing it. If you encounter the error Memory Unavailable for Attempted Operation, then clear controller memory.
Publication 1785-UM012D-EN-P - July 2005
Page 300
C-14
Maximizing System Performance
Using Program Control Instructions
Scan time can increase based on how you use JMP/LBL instructions and FOR/NXT instructions.
Using JMP/LBL Instructions Keep in mind these issues when programming JMP/LBL instructions: Instruction
Consideration
JMP
The execution time required for a JMP instruction depends on the program file that contains the JMP instruction. The estimated execution time for a JMP instruction is: 8.9 + (file_number − 2) ∗ 0.96 The greater the program file number, the longer it takes to complete a scan of the JMP instruction.
LBL
Each LBL instruction uses 2 words of memory in the program file plus additional memory, depending on the label number itself. Each label number is placed in a label table. Each entry in the label table uses 2 words of memory, starting from label 0. For example, LBL 10 uses 22 (2 words ∗ 11th entry) words of memory in the label table. If you later delete LBL 10, the label table does not deallocate previously used space. The only way to recover this space is to upload and then re-download the program.
Using FOR/NXT Instructions The FOR/NXT instructions have the same impact on execution time as the JMP instruction. The execution for a FOR/NXT loop depends on the program file that contains the instructions. The estimated execution time for a FOR/NXT loop is: 8.1 + (number_of_loops ∗ 15.9) + (file_number − 2) ∗ 0.96 The greater the program file number, the longer it takes to complete the FOR/NXT loops.
Publication 1785-UM012D-EN-P - July 2005