LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of clusters does not updates properly



@dan07 wrote:
Because of this I take the size of the array and let the while loop runs until it found a value greater than the number of values in the array, in the sequence, the while loop stops and send to the for loop the N.
....
I think you devide the length of the array by half the length of the segment?

The Lenght of the array is not divided by half the lenght of segment. Due the 50 % overlap, the array is not logically divided by the lenght of segments, some values are show in two different segments graphs, because the segments are 50 % overlapped.


Really what you do in this code is dividing the length of your file by half of the segment length. (this makes sense).

The main problem with your code is that you have 1 event handler for basically three different events:
  1. File contents change (triggered by Timeout)
  2. Segment length change
  3. Array change (Triggered by a click on the boolean)
In the third case you most likely only want to react on the change of the boolean, what you do is that you recalculate the whole array, resetting all booleans to false.

You should make a clear distinction between these three events.

Ton
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 11 of 15
(654 Views)
The main problem with your code is that you have 1 event handler for basically three different events:
  1. File contents change (triggered by Timeout)
  2. Segment length change
  3. Array change (Triggered by a click on the boolean)
In the third case you most likely only want to react on the change of the boolean, what you do is that you recalculate the whole array, resetting all booleans to false.


You should make a clear distinction between these three events.

The event 1 (file contents change), determine that the event case number 1 is fired after the file is loaded, and shows me a result based on default settings. After that, I can perform  modifications in the booleans state (ON or OFF) and in the length of segment, and verify the new results.

The main problem concerns the event 2 (segment length) and 3 (array change - boolean). 
I don't know how to make a distinction between these events, since that I need to leave both of them firing the event case with the code, because when any boolean changes or the length of segment changes, the result is affected, and this is not running well in my code. Do you have any suggestion to fix this issue?

Thanks in advance for help

Dan07


Message Edited by dan07 on 07-27-2008 01:34 AM
0 Kudos
Message 12 of 15
(649 Views)
Event 2 should trigger event 3!
In event 2 you recalculate the whole array with all booleans to false.
Then you create an event 3 for the 'Array' value change.
There you do a recalculate of the Sum. In the code you have the distinction allready (the local and terminal split is the best place).

Ton
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 13 of 15
(632 Views)
TonP wrote:

Event 2 should trigger event 3!
In event 2 you recalculate the whole array with all booleans to false.
Then you create an event 3 for the 'Array' value change.
There you do a recalculate of the Sum. In the code you have the distinction allready (the local and terminal split is the best place).

I made some modifications in the VI: there is a 0 constant wired to the SR of the small while loop, a feedback node to ensure that after the length of segment had been changed all the booleans will be setted to true (Led ON). But after these alterations the code is not yet running properly. I turned on the highlight execution and analyzed all the steps and I verified a problem that is messing my results:

In the Picture 1 (attached) there is the constant that initializes the array, it has a graph, a numeric indicator and a boolean. If the boolean in this constant is setted to true, after I click on the Generate button, all the leds are ON (due the feedback node), when I click on any one of the Leds, the Leds just blink but the state does not change, all Leds keep ON. But, if the boolean is setted to False in the constant of Picture 1, after I click on Generate, all the leds are ON (due the feedback node), when I click on any one of them, all Leds change to OFF and keep OFF.

The problem is when data is written to Array Local Variable, represented in Picture 2. At the momment that this local variable is written, the array read the boolean state from the constant of picture 1, if the boolean is true it will change all booleans to true, if is false it will change all booleans to false. I need the constant to initialize the array, but I don't know how to proceed to avoid that all booleans follows the default state of the boolean of the constant. I need to be able to let some booleans ON and some OFF.

I don't know what I can do to solve this issue.

Thanks in advance

Dan07
Download All
0 Kudos
Message 14 of 15
(607 Views)
I don't have much time to open up the code but here are some pointers:
  • Split the code into several events
    You only need the constant in the case of the segment length change
  • In the case of a boolean click you have a new event!
    Do this
    In the new event you use the 'New Value' to recalculate the whole outcome
You can trigger the recalculate event from the segment length event by writing the array via a 'Value Signaling'  property.

Ton
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 15 of 15
(594 Views)