LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make my program run faster ? (changing colour indicators quicker)

Solved!
Go to solution
Hi everyone, I have a program with 100 indicator colour backgrounds that change according to 100 temperatures. A case structure (with 100 cases) sets the background colours one after the other and runs in a while loop with no timing (as fast as possible). The temperatures are loaded up from an array that is initialized at the beginning of the program. The idea is to have an overall view of the change of temperatures (just by looking at the change of colours). Everything works fine except that it doesn’t run fast enough... The change of colours is not smooth at all ... you can really see the increments. It works fine with 20 temperatures for instance. 1) Would anybody have a solution to improve this? I was wondering if Labview perhaps actualises all of the values each time one changes (just like with the excel cells: an option that you can desactivate and make things run quicker when you use a macro) which would make a big loss of time....

 

There is no data saving this is just a post treatment program. So My my program isn't doing anything else.

 2) I have attached a screen print of a problem a faced when making up the VI I attached. Why can’t I wire directly to the Index Array that is in the For Loop in my VI… I had to go throw a shift register to make up the example. When going back to my original program I couldn’t use the index array a second time (screen shot). Thanks a lot for any help, Regards, User  
Download All
0 Kudos
Message 1 of 10
(3,946 Views)
You cannot wire to index array because you will not get a array from the loop after you have enabled indexing. You will get one element / iteration .
0 Kudos
Message 2 of 10
(3,945 Views)
Solution
Accepted by topic author User_1979

You can use the Defer Panel Updates property. Set it to T before the loop and to F after the loop (using the wires to determine the order of execution).

 

 

Also, as muks suggests, the wire going into the Index Array primitive is not an array, but a single element, because of auto-indexing. It's actually better to iterate over the array this way, because it simplifies your code (no need to wire a value into N and to use Index Array). Also, I wouldn't be surprised if you find out you have a bug in your code. All those +1 functions are bound to create a mess.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.


___________________
Try to take over the world!
Message 3 of 10
(3,938 Views)

Here's a possible solution:

 

 

 

 

Ton

Message Edited by TCPlomp on 11-03-2010 11:16 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 10
(3,936 Views)

Hi Tst and Muks,

 Thanks for your time.  

Tst, I tried doing what you were saying concerning the PNL property node but I get a message error n° 1055 and I don’t know why…. Do you have an idea? But it seems to be exactly what I was looking for.

 

I still don’t understand why the first index array could be wired and not the second one (screen shot)?

 Concerning all my +1 functions, what do you mean … that it is a complicated way of doing this (and consequently easy to make an error) or that this method is unstable and could lead to some bugs? Thanks again, User
0 Kudos
Message 5 of 10
(3,913 Views)
Do you get any error descriptions? you cannot wire a non-array value to a index array. wire and see what is meant by indexing and enabling/disabling in a loop.
0 Kudos
Message 6 of 10
(3,907 Views)
Yes, as the previous poster stated, you are not able to index the array at that point because it isn't an array at that point. Where it crosses into the FOR loop the existing array is being auto index, meaning that one element of the array is "popped off" the array on each iteration of the FOR loop, meaning that what is being passed into the "index array" is a single element. Right click on the place where it comes in to the FOR loop and deselect "autoindex" and you will have an array again. Now, since I don't have the image open I don't remember whether you have an index value connected to the index square on the upper left corner of the FOR loop, but you will need to wire a number to it if you don't, and don't have any other autoindexed arrays. Remember that if you do have a number wired there and an autoindexed array the smaller of the two numbers (array size or wired number) will determine the number of iterations of the loop.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 10
(3,903 Views)

User_1979 wrote:

Tst, I tried doing what you were saying concerning the PNL property node but I get a message error n° 1055 and I don’t know why….


You're probably not feeding the panel reference into the property node. Do a search to see how others used the property.


___________________
Try to take over the world!
0 Kudos
Message 8 of 10
(3,884 Views)

Hi Tst,

 

You solution is fine and it works efficiently enough with my original program. The difference is really incredible. Thanks again.

 

I have attached the solution for the example I posted.

 

Regards,

 

User

0 Kudos
Message 9 of 10
(3,798 Views)

Hi User_1979,

 

I'd really like to see the final solution implemented - but I only have LV 8.2.

Could you please post an 8.2 version of your vi?

 

Regards,

Xeldon

0 Kudos
Message 10 of 10
(3,538 Views)