No Copy


No Right Click

Saturday, December 10, 2011

How to save Memory and Optimize Performance of a Logix Controller

How to get maximum performance from your control system?

It is important to think ahead before designing and configuring your control system. Decisions you make during the design phase of your project can directly impact system
performance. In the controller alone, there are several design considerations and guidelines that can help you improve controller performance, conserve memory space and minimize execution time for moving and accessing data. Rockwell Software has a tool called Integrated Architecture.RSLogix 5000
Consider the following tips to help save memory and optimize performance of a Logix controller:
Choose a programming language best suited for the task you’re trying to accomplish with Allen Bradley RSLogix 5000.

Rockwell software® RSLogix™ 5000 programming software supports the IEC 61131-3 compliant programming language you need to solve your discrete, process, batch, drive, safety and motion control challenges. Language editors for relay ladder logic (RLL), function block diagram (FBD), sequential function chart (SFC) and structured text (ST) programming are native to RSLogix 5000 programming software as well as ControlLogix® programmable automation controllers (PACs), CompactLogix™ PACs, softLogix™ controllers, and Powerflex® 700s drives with DriveLogix™ controllers.
Each routine in RSLogix 5000 programming software contains logic in one programming language. Choosing a programming language most suitable for the task you’re trying to accomplish will not only help reduce program complexity and troubleshooting/maintenance costs, but it also helps make the code more readable, improves the development process and improves the performance of the controller.

For example, you could use Ladder Logic for complex data handling, such as sorting algorithms. This process would work, but take weeks (and potentially hundreds of rungs of code) to program. This would be time-consuming to write and maintain, less readablemand require extra time in the controller to scan and execute.
 Using structured text for this task is more suitable, making programming a complex, bubble-sorting algorithm simple, straightforward and more efficient: 10 lines of code with less impact on controller performance.
 This is just one example of choosing the right programming language for the right task. Mixing and matching programming languages in your project to meet an application need is a key competency of  RSLogix 5000 programming software. In the same project, you can program a batch operation in Sequential Function Chart, pump station in Function Block Diagram, conveyor system in Ladder Logic and a complex mathematical algorithm in Structured Text. Making the right programming language selection for solving a task can help reduce maintenance costs, improve code readability, save memory space and improve the performance of the controller.

Use a 32-bit data type for maximum efficiency. An important factor to consider when designing your control architecture is data organization and performance. the control engine in Logix PACs is based on a 32-bit boundary, so performance and memory use are optimized by using 32-bit data types. If you use non-32-bit data types with 32-bit
CPus, each instruction can take up unnecessary memory space, and multiplied by thousands of instructions, this can quickly consume available memory. This is especially crucial to consider for smaller controllers with limited memory.
For example, using double integer (DINT) data types instead of integer (INT) data types helps reduce execution time and memory usage.
Executing a simple ADD instruction with INT data types, such as:
INT + INT = INT takes 260 bytes of memory and 3.49 μsec to execute.
If the same ADD instruction is executed with DINt data types:
DINT + DINT = DINT takes 28 bytes of memory and .26 μsec to execute.
the reason for this major difference in memory use and execution time is that the controller converts each INT to a DINT before it adds them together, and then has to convert the sum back to an INT. It takes additional execution time and memory to store the INT.

Optimize With Arrays and User-Defined Structures (UDTs)

The method used to create tags in the controller directly impacts performance in terms of execution time for accessing data. Creating individual tags in your program results in the creation of scattered tags in the memory of the controller. Scattered tags must have pointer data associated with them, which requires more time when trying to access the tags. Instead, create tags in arrays or user-defined structures in the tag database.
An array allocates a contiguous block of memory to store a specific data type as a table of values. Consolidating tags into arrays and structures helps reduce the communication overhead needed to access data in the controller (up to six times the amount of memory in the controller). Tags support arrays in one, two or three dimensions and user-defined structures (UDTs) can contain members that are single-dimensional arrays.
User-defined structures allow you to combine multiple data types (atomic, predefined structures or user defined structures) into a new data type. Organization of the members of userdefined structures can greatly influence memory use, layout and performance.All elements in UDTs are located on a byte (8 bit) boundary. Grouping like elements together when creating a UDT will help conserve memory, and reduce communication and execution time when accessing data. In the example here, notice that a
simple change such as grouping like data types (BOOLs) saves four bytes of memory. This is a simple example, but UDTs in RS Logix 5000 programming software can have as many as 500 members and take up 2MB of controller memory.
Following some basic guidelines when organizing and designing your UDT will save on memory allocation and improve performance in the controller.
For more design recommendations, please review the Rockwell Software RS Logix™ 5000 Design Considerations Manual (1756-RM094C-EN-P) from the Web site below:
http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm094_-en-p.pdf

0 Comments:

#