LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrent Wait Time Issue to Generate Rate of Change Measurements

Solved!
Go to solution

Jeff,

Thank you. This is an approach I had not considered so again, thanks.

 

All else,

Thanks for the help and knowledge sharing.


0 Kudos
Message 11 of 19
(1,008 Views)

Those Queue pt by pt VI's are pretty good.  I've also used ones I found somewhere in an example that were called Circular Buffer.

 

I've used arrays with 10's to 100's of thousands of points without a problem.  Overall, it is not the amount of time that you need to look back that is a problem, but also what rate you are acquiring the data.  Acquiring a million samples per second, you'll have problems looking back a couple minutes.  Acquiring 1 to a few samples per second, you can hold days worth of data and not have an issue.  Do the math and keep your sample rate reasonable for the type of data you are collecting.  Then if it seems questionable, test it out in a simple VI to see if it has a chance of working okay.

Message 12 of 19
(1,005 Views)

Thank you. I will redesign this to use arrays. Based on others experience, what size and quantity of 1D arrays typically start burdening the computer system running LabView (assume average processing power and RAM).



The only time I ran into issues with that ptbypt data queue was my own darned fault!

<Sea Story=True>

I needed an nZ transform based on the timing or an RT target so I of course did some testing of the code.  Forgeting that I was not updating the Tick Count variable.  Do you know how many points you need to simulate 200mSec when the time between cycles is 0?  

 

Spoiler
There ain't a faster way to get a run out of memory error and crashSmiley Very Happy

"Should be" isn't "Is" -Jay
Message 13 of 19
(1,001 Views)
 Do you know how many points you need to simulate 200mSec when the time between cycles is 0?  

 

Spoiler
There ain't a faster way to get a run out of memory error and crashSmiley Very Happy

Hilarious! It took me a second but I got there in the end....

 

Message 14 of 19
(989 Views)

@dclalonde wrote:

@RavensFan wrote:

Do you want your "30 minutes ago" to always be 30 minutes ago from now?, or every 30 minutes it stores a value and then updates that after another 30 minutes has passed.

 

If the former, then you will need to store arrays of data.  What you are doing is called a circular buffer where you continually add new data and discard the oldest, and the size of the buffer determines how far back in time you can look.

 

You need your data acquisition to run continuously at whatever data rate makes sense.  You don't want your analysis of that data to be delayed by arbitrary "wait until next msec" functions.


Thank you. I will redesign this to use arrays. Based on others experience, what size and quantity of 1D arrays typically start burdening the computer system running LabView (assume average processing power and RAM).


This is what I came up with as a solution for the task using arrays. I would appreciate any feedback on how to do this more effectively or general programming tips since I am still quite fresh when it comes to LabView. Thanks!

Rate of Change VI.PNG

0 Kudos
Message 15 of 19
(968 Views)

@dclalonde wrote:


Rate of Change VI.PNG

Here are two tips that will simplify the code you have.

 

1.  You are using two different index array functions on the same array.  Delete one.  Drag down the bottom border of the other.  You'll get another output from the same array.  If you leave the index input unwired, you get the next item in line.  If you wire in something, then you'll get that index value you asked for.

2.  You are using Insert Into array at position "i".  Normally that means you are just adding to the end of the array.  In that case, using Build Array in concatenate mode makes much more sense.  Why worry about wiring in the Insert point if you know it is always at the end.  But your implementation has a larger problem.  How many elements are in that 1-D array you are "inserting" in?  If it is more than 1, then you are scrambling your data.  For the sake of argument, I'm going to say that array as 3 elements, and I'm going to give them letters.

 

Start of loop, array is empty, i=0.  Insert 3 A's at 0 and  you'll have AAA

Next iteration, i=1, Insert 3 B's at 1.  You'll get ABBBAA.

Next, i=2,  Inset 3 C's at 2, You'll get ABCCCBBAA

Next i=3, Insert 3 D's at 3 You'll get ABCDDDCCBBAA

 

Do you see the problem?

 

If you used Build array, you'd have AAABBBCCCDDD, all the elements in order, no matter how many there were in each 1-D array when they were captured.

0 Kudos
Message 16 of 19
(963 Views)


@RavensFan wrote:

@dclalonde wrote:


Rate of Change VI.PNG

Here are two tips that will simplify the code you have.

 

1.  You are using two different index array functions on the same array.  Delete one.  Drag down the bottom border of the other.  You'll get another output from the same array.  If you leave the index input unwired, you get the next item in line.  If you wire in something, then you'll get that index value you asked for.

2.  You are using Insert Into array at position "i".  Normally that means you are just adding to the end of the array.  In that case, using Build Array in concatenate mode makes much more sense.  Why worry about wiring in the Insert point if you know it is always at the end.  But your implementation has a larger problem.  How many elements are in that 1-D array you are "inserting" in?  If it is more than 1, then you are scrambling your data.  For the sake of argument, I'm going to say that array as 3 elements, and I'm going to give them letters.

 

Start of loop, array is empty, i=0.  Insert 3 A's at 0 and  you'll have AAA

Next iteration, i=1, Insert 3 B's at 1.  You'll get ABBBAA.

Next, i=2,  Inset 3 C's at 2, You'll get ABCCCBBAA

Next i=3, Insert 3 D's at 3 You'll get ABCDDDCCBBAA

 

Do you see the problem?

 

If you used Build array, you'd have AAABBBCCCDDD, all the elements in order, no matter how many there were in each 1-D array when they were captured.


I appreciate this. I will make these changes and let you know if anything problematic occurs because of my inexperience. My array is only receiving one element per iteration so that is why I did not notice the larger problem. Would "Split Signal" to another similar arrangement work as well should I decide to add additional channels and inputs to help keep them separated for my purposes?
0 Kudos
Message 17 of 19
(960 Views)

@dclalonde wrote:




I appreciate this. I will make these changes and let you know if anything problematic occurs because of my inexperience. My array is only receiving one element per iteration so that is why I did not notice the larger problem. Would "Split Signal" to another similar arrangement work as well should I decide to add additional channels and inputs to help keep them separated for my purposes?

Modify the From DDT express VI so it outputs a scalar value rather than an array since it is only a single element.

 

If you add more channels, you can use the Split Signal to break it into the individual signals.  But You would then need to duplicate all of your array handling stuff to handle each of those signals.  Though if you start working with 2-D arrays, you can keep the data so that one dimension represents the different channels and the other dimension represents the passage of time.  But either way,  I would avoid the DAQ Assistant and start using the regular DAQmx functions.

0 Kudos
Message 18 of 19
(952 Views)

I will try these fixes out and see if I can't figure out a new way to confuse myself. Thanks again for all the help!

0 Kudos
Message 19 of 19
(945 Views)