05-22-2010 03:15 AM
Hello,
I have a case structure in a subVI which is enabled from some external event, and when enabled it must “remember” the current value of a constant stream of measured data during the first iteration of the case structure. After the first iteration the “remembered” value must be used as a reference which is subtracted from the following values of the measured data, creating an error which is used in the control. The problem is that when the case structure is disabled for a moment and then enabled again, the array I use “remember” the value from the first time it was enabled. I know it is possible to reset the array with a Boolean control, but it is important that the array is reset automatically during the first iteration of the case structure.
I hope someone can help me.
Thanks in advance.
Jeppe
Solved! Go to Solution.
05-22-2010 05:26 AM
A lot of your description and code is not very clear.
Why do you built an ever-growing array in a feedback node if all you need is a single element?
What is in the other case of the case structure?
It would really make things much easier for us if you could attach the actual VI instead of an image!
What is your LabVIEW version?
Something like in the image would work for a switch action boolean.
Using a latch action boolean would make things even easier, see attached VI.
Modify as needed. 😉
05-22-2010 06:20 AM
I am sorry for the confusion. I just thought I shuold spare you for all the details. But you are right, it is not important to me to save all the element in an array. The thing I need - no matter the code - is to save one value from a constant stream of measured data through a case structure, which is in a subVI which again is in a While-loop. The measured data goes from the While-loop to the subVI, in which one value of the measured data is saved as soon as the measured data exceeds a specific (variable) value - therefore the case structure. When this happens the saved value must the be subtracted from the still ongoing stream creating the error as described earlier. Until the measured data exceeds the specific value the stream of data must just go through to the error-indicator without any saved data.
I hope this helps understanding my problem.
05-22-2010 06:24 AM
I forgot to mension that the saved value from the stream of data must be reset either when the case structure goes from enabled to disabled state or during the first iteration of the enabled case structure, before a new value saved from the stream of data.
05-22-2010 11:41 AM - edited 05-22-2010 11:50 AM
Use a logical OR of: [i]=0 or "boolean"
You still have not attached your VI.
05-22-2010 12:45 PM
I'd connect that array to the loops borders as a shift register and then you can simply add or reset in the case structure. (if i understand the problem correctly)
05-22-2010 01:04 PM
I am not sure I understand your suggestions, but I have attached the VI so you can try it yourself.
Again, I hope this helps
05-22-2010 03:22 PM - edited 05-22-2010 03:23 PM
Jeppe Mortensen wrote:
I forgot to mension that the saved value from the stream of data must be reset either when the case structure goes from enabled to disabled state or during the first iteration of the enabled case structure, before a new value saved from the stream of data.
05-23-2010 02:22 AM
05-23-2010 10:47 AM