Digital - HMI European Competence Center s Level 3 Support Contents Review Written By (Name, Date): I-Shen Leong / Chris Fakhri - July 18, 2006 Title: DRAM Memory Issue on XBTG and XBTGT1000 Series for V4.4 Procedure to optimize a Vijeo-Designer V4.4 application. Summary: Running the same application for Vijeo-Designer 4.4 requires about 800 KB more DRAM memory than 4.3 on XBTGT1000 and all XBTG Series targets. The increase is due to new features being added to the runtime system for 4.4. This could be a problem for customers using XBTG in 4.4 because the runtime could crash with a Memory Allocation Error at some point. XBTGT2000 Series targets and up should not experience this problem because their DRAM memory is at least twice the size of that on XBTG Series targets. R&D is currently working to have the memory requirement for running 4.4 reduced to what was needed for 4.3. The fix should be available in the next patch release (Vijeo-Designer 4.4 patch A). However, before the fix is available, a short-term solution for customers wanting to upgrade to 4.4 is required. The procedure for doing this is as follows: 1. We need to go to the Configuration menu when running the project. To make it easier to access this menu, add a switch that allows you to go to the Configuration menu onto the initial panel of the project. 2. Build the application in a patched version of 4.3 (patch A or later) that has memory feedback warning. If a warning message pops up, proceed with the download anyway, but note that there may be possible problems during runtime. 3. Download it to an XBTG panel. We are going to check the memory usage on the target for the project. 4. On the target, go into the Configuration menu using the switch added in Step 1 or using the “3 corner” touch method. When in the Configuration menu, go to the “System” tab, press the “Memory” button and look at the value for DRAM usage. Add 800 KB to this DRAM usage value. This will give you an idea of how much memory will be used in 4.4: If the amount of DRAM usage after adding 800 KB exceeds 13 MB, the application needs to be optimized. It is important to note that memory usage will increase depending on the project configuration. As bitmaps, panels, etc…, would be cached, the amount of DRAM usage would further increase. If the amount of DRAM usage after adding 800 KB does not exceed 13 MB, the project should run properly. HMI ECC – Product Support 533558044 Page 1/3 Project optimization: Here are several ways to optimize a Vijeo-Designer application: 1. Delete unused variables. Objects that are not required by the application occupy valuable space in memory. The most-often abused object is the variable. To delete unused variables, here is the procedure to follow: 1. Validate or build the user application. 2. Display the Navigator window's Variables tab, right-click the Variables List node (above the Target node), point to “Filter by” and select “Unreferenced Variables”. 3. Click the Target node to display the variables that are not used by any object in the application. 4. Delete these variables. 2. Reduce the size of large bitmaps You can save valuable memory space by reducing the size and number of bitmap images in your application. Here are some tips about using bitmap objects: If you are using a bitmap as a background to cover the whole panel or a large portion of the panel, you should use one of the drawing tools (rectangle, ellipse, etc…) available in VijeoDesigner instead. To make sure that the object color matches the background color in the bitmap, see the online help of Vijeo-Designer 4.4, Section 7.3.1.2 (Copying Colors on your PC). If a bitmap includes a section that contains an image and the rest is a background, you should replace the bitmap with two objects: a smaller bitmap with only the image, placed on top of a rectangle for the background. 3. Use the exact same image object for bitmaps When you use the same bitmap image in multiple locations, the dimensions of the image objects drawn on the panel should be exactly the same in each instance. Even though the image object may be referencing the same bitmap image file, if the width or height of the image object varies by even a single pixel, Vijeo-Designer will generate a different bitmap. Wherever possible, use the Copy and Paste commands to make sure you use the exact same image object throughout your project. 4. Use Text Block Display for large text files There are two Toolchest objects for displaying text files: Text Display and Text Block Display. Here are some tips about using text files: When working with large text files, you should use the Text Block Display. The main difference with the Text Display is that the Text Display loads the entire text file into memory when it needs to be displayed, and a Text Block Display loads only the block currently displayed. When a text file is large, such as 500KB, the Text Display becomes cumbersome and slow to use. Whereas, the Text Block Display consumes only the memory required to display a single block within the text file. For more details on the Text Display Toolchest object, see the online help of Vijeo-Designer 4.4, Section 11.7.2 (Using a Text Display part). For more details on the Text Block Display Toolchest object, see the online help of VijeoDesigner 4.4, Section 11.7.3 (Using a Text Block Display part). 5. Reduce the number of alarms stored in memory Each alarm group has two properties (“Num Of History Alarms” and “Num Of Log Alarms”) that define how many History alarm events and how many Log alarm events to store in memory. You can reduce these values to reduce the amount of memory required by your application. HMI ECC - Product Support 533558044 Page 2/3 6. Optimize memory usage in scripts Here are some tips about memory usage in scripts: Java primitive arrays: do not create Java primitive arrays that occupy huge amounts of space in memory. For example, if you write the following script, a lot of space in memory will become occupied and could cause Vijeo-Designer Runtime to halt operations. int a[ ] = new int[30000]; // Allocates 120 KB in DRAM String or StringBuffer objects: String and StringBuffer objects are character arrays. Similar to other Java arrays, be careful when using them. Vijeo-Designer takes advantage of Java's String and StringBuffer classes. When using these objects, use the same memory optimization techniques as you would with any Java program. Script frequency and how memory is used: when the application includes periodic scripts with a fast frequency rate (less than 1 second), consider whether the scripts need to run that fast. If possible, reduce the frequency of scripts. In addition to its frequency, be careful on how much memory is allocated inside the script. Products: Vijeo-Designer V4.4 Category: Technical Note Keywords: DRAM Runtime Increase XBTG XBTGT1000 Attachments: N/A Products: Applies To: Fixed In (plan): Reference: Vijeo-Designer Vijeo-Designer 4.4 Vijeo-Designer 4.4 Patch A N/A HMI ECC - Product Support 533558044 Page 3/3