04-16-2015 02:46 PM - edited 04-16-2015 02:48 PM
Why are they consuming so much processing power in the false case? Most of them aren't doing anything in that situation.
Sorry I didn't see your response but I hit send on this
04-16-2015 02:50 PM - edited 04-16-2015 02:51 PM
@endlessOranges wrote:
Why are they consuming so much processing power in the false case? Most of them aren't doing anything in that situation.
Yes, they are doing something!!!!
Since there is no small wait, they spin as fast as the computer hardware allows, millions of times per second! Constantly polling the buttons values and local variables.
Even a 1ms wait would reduce the CPU consumption by many orders of magnitude.
04-16-2015 02:54 PM
What is a more efficient way to handle all of my conditional statements then?
04-16-2015 03:23 PM - edited 04-16-2015 03:39 PM
Well, I don't know your system enough to give detailed advice, but as a first step you should chose a suitable code architecture and eliminate some glaring programming mistakes and inefficiencies. Here is some general advice:
04-16-2015 03:29 PM
So I started putting your ideas together and threw a five second timer on my bottom loop so it stops sampling so quickly and taking up processing speed and the code runs smoothly.
04-16-2015 03:38 PM
I'll take a look at some of these other problems to improve the code. Thank you so much for the advice!
04-16-2015 03:38 PM
Five seconds seems excessive. Did you mean five milliseconds?
04-17-2015 10:14 AM
I just set it to five seconds because that was still pretty small compared to the ten minute cycles I have it set to for the actual system but if I can drop it much lower I will try that.
04-17-2015 12:02 PM
What is it that makes the array method superior to the queueing? Is it something behind the scenes in how labview handles these nodes because otherwise they look pretty similar other than the fact that the queue requires I tell it to make it a length of 1 first.
04-17-2015 12:24 PM - edited 04-17-2015 12:34 PM
Built array is a labview primitive and highly optimized.
The queue ptbypt is a subVI with lots of code (you can double-click it and inspect it). Firstly, you have the subVI call overhead, then you are invoking a huge queue machinery for basically nothing. It also retains old data until it gets overwritten or exceeds the configured size. It has four inputs and produces five outputs, but you only use one of them. It is like using an industrial robot to remove the toast from the toaster or use the supercomputer cluster ant the National Atmosperic Reasearch Center in Boulder to solve 1+1=2. Definitely possible, but there are easier ways.
Built array works with (almost) any datatype (strings, paths, numeric, references, etc.) while the queue ptbypt works exclusively with DBL. (There is a second version in the palette that works with complex double). This means that if you next time work with integers, you would need to re-learn from scratch.
And no, they don't look similar!