10-06-2015 11:26 AM
I'm trying to accumulate time that a condition is true. The attached vi only works with a button switch and not as needed from the pattern match loop above. The event structure never run and the Match Indicator never gets updated. I've left the Switch connected as a debug tool, but the real goal is to accumulate timebased on when the Match Indicator is True.
How can this be accomplished?
Thanks,
sc
10-06-2015 11:36 AM - edited 10-06-2015 11:37 AM
Your code is completely constipated.
Your upper loop queues up elements as fast as the computer allows. The lower loop can only proceed to the next iteration if the timeout is not negative, which is often not the case. Even if it is 50ms, it can never keep up with the enqueuing rate above. Ultimately, the queue will fill all available memory.
Why are thre so many stop buttons? Once is enough!
Why is the switch not connected to the case structure? A local variable seems clumsy.
You can trigger associated value change events by writing to a signaling value property of the control.
In any case, your code is inside-out and needs a complete overhaul to work correctly.
10-06-2015 11:41 AM
I was trying to implement suggestions from NI helpdesk. I've not used a signaling value property before so I'll do some more investigation.
I may have some follow on questions if you don't mind.
Thanks
10-06-2015 12:31 PM
@scott312 wrote:
I was trying to implement suggestions from NI helpdesk.
What were the exact suggestions?
To just measure the accumulated true time of a boolean, you don't need all that code. What time resolution do you need?
10-14-2015 07:40 AM
Attached is what I put together that works. Please feel free to point to a different method. Resolution is not critical. The switch array is for testing purposes and is replaced by a boolean array in the real application.
Thanks for all your suggestions. I am moving in the dirrection of better coding practices and methods but the pace is slow.
sc