11-12-2009 06:20 PM
Dear friends of National Instruments,
Maybe my problem is very easy to solve but I haven't been able to do it.
I need to sum the values of a 1d array of dynamyc data that are storage in the border of a cycle after this is finish.
Thanks for the help.
Juan Pablo Justiniano
11-12-2009 10:47 PM
First, you have autoindexing turned on at that tunnel. So you get a 1-D array of dynamic data, which is essentially a 2-D array of data. (Each element of the dynamic data has an underlying 1-D array of data built into it.)
So you have to figure out what you want. A sum of each segment of dynamic data so that you have a 1-D array of sums? A master sum off all the dynamic data?
What is going on with all the loops? You have an inner while loop that does nothing but simulate data until you hit the stop button. The only data that comes out is whatever it looks like on the last iteration of that while loop. Then the next level out is a For Loop that runs 3 times (which means you have to hit the stop button 3 times in order to get out of that). Now you have your 1-D arrays of dynamic data. Outside of that you have a For Loop whihc runs 4 times . So now you have to hit that stop button 12 times to get out of all of that. But the only thing your are really left with is the 1-D array of dynamic data (and your summation indicator) based on whatever happens on the 4th and final iteration of that For Loop. The previous 3 iterations are all lost to history. They might as well never even happened. You might as well get rid of the outer For Loop.
11-13-2009 01:22 AM
Hello,
I couldn't view your VI as I am using labVIEW 8 and your's is a newer version. Anyway according to me the two methods of summation in loops is given in this image.. have a look and let me know what you feel. if its not correct, please post an image of your block diagram..
Regards,
Nitzy
11-13-2009 08:35 AM
Nitzy,
I'm not sure what your top example is supposed to be. The value in sum will always be equal to the random number that is generated at the instant the stop button is pressed. No real summing going on. You are converting a random scalar to a 1 element 1-D array. Then passing that out through an ordinary tunnel, which means only the last iteration's data is kept. Then summing a 1 element 1-D array which gives you back the 1 element.
The second example is a little closer to what the OP's VI is set up like. The only problem is that he is working with the Dynamic DataType which adds layers of obscurity to the underlying data making it harder to work with.
11-13-2009 08:59 AM
11-13-2009 12:45 PM
What I really want to do It's a calibration of Pyrheliometers by comparison to a reference phyreliometer under the ISO 9059.
The idea is to take one sample every minute and collect the samples of the last 15 minutes and determinate a temporal calibration factor, do this for a few hours and then take the mean of all the temporal calibration factor of each phyreliometer under calibration, after that eliminate the samples that deviates more than 2% and recalculate the final calibration factor.
This is my temporal file:
Help is really appreciated.
Thanks.
Juan Pablo Justiniano
11-13-2009 01:41 PM
With 1 minute samples over 15 minutes, you are better off refactoring your architecture.
Get away from Express VI's and the dynamic datatype. Collect 1 point at a time and build them into an array. Every 15 samples, do the math functions you want.
Don't have a 1 minute wait inside a while loop, it will make the VI seem to freeze when you are waiting to do something like stop it. Use a state machine architecture of Collect and store data. Analyze Data, Wait (along with elapsed time timer to determine when a minute is up and go to Collect/Store)
11-14-2009 12:38 AM
Dear Ravens,
I am sorry about my example, I got your point and you said it correct. And about my first example, what i was trying to do was like this...
Was in a hurry when i posted the previous one.. so didn't check .. My apologies..
Regards,
Nitzy..