05-31-2007 03:04 PM
05-31-2007 07:02 PM
06-01-2007 09:58 AM
Hi Caz
Thanks for replying to my earlier post. We are going on a field where we will be measuring firing of bullets from Helicopter, and we are not sure when it will begin, So we have made a program with trigger level, if above level start to write the data for so many seconds. So once the trigger is met it saves specified pre trigger samples based on seconds and the samples needed after the trigger based on seconds. So the engineer going in the field has asked me that if he can see all the bullets when it is being fired it would be good. He doesnt need another VI to read after it has been written, so thats the reason I need to show all the data points for as many seconds which are prescribed by the user.
I am attaching a screen shot of my VI.
Regards,
Nitin
06-01-2007 11:23 AM
Hmm, firing bullets from a helicopter. A vi named alabama. Sounds like you are doing some testing at Redstone arsenal. I've had labview down there before in June and the humidity was just about unbearable. Although, the shrimp gumbo made up for it.
Okay, I see what you're doing now, sort of. I have some ideas that might help but I have to also ask a few more questions.
1) Why not just configure a finite application using a reference trigger and setting the timeout on the read function to a high value. In this configuration the read function would only fire once and all the data would be saved and plotted. Currently, I think you are constantly reading data, in 1000 pt chunks, and using a homegrown vi called DAQmx soft. analog trigger to monitor the data to see if it should be saved or not. What you have will work, it just tends more to a Rube Goldberg machine than you need it to.
2) If, for some reason, you need to continue to use what you got, I would have to know what exactly the soft. trigger vi is doing. Best I can tell, is that it adds data to the intialized 2D array if the values meet some trigger condition. This vi then passes a true boolean to the case structure so that the data can be written and plotted. It also passes the boolean to a shift register, but I'm not sure what happens on the next loop iteration when the boolean is true and it gets passed to the soft. trigger vi. Also, I wonder about your file logging scheme. It appears that the file refnum's are the same for each loop iteration resulting in data getting written over.
If your soft. trigger vi works properly, you should be able to move the case structure outside of the loop and use the shift register 2D array which, if done properly, contains all the data you need to save. You can leave the timing functions in the loop to give the conditions of when to stop the loop. The plot would also sit ouside the loop and the 2D array would have to be reshaped with the reshape array function to plot all the data as 1 channel.
Again, if you only need to save data from a single firing sequence, what I mentioned in 1) should be the ticket. This does, however, depend on the hardware you are using. It would need to support reference analog triggering.
If you want to keep what you got, post your code so i can help you more.
regards,
Drew
06-01-2007 01:25 PM
06-01-2007
01:47 PM
- last edited on
05-02-2025
03:51 PM
by
Content Cleaner
Hi npai,
Right now the elapsed time express VI is only being incremented when your case structure is being executed. In short, you are only counting the execution time of your case structure and not accounting for your acquisition time. If you know how fast you are sampling and how many samples you are acquiring, then you can determine how many reads are needed to be executed before you stop acquisition.
I would suggest using a waveform chart instead of a waveform graph to display your data. A graph is only going to plot the data that is passed to it each iteration. A chart is going to have history and will display all the data that is passed to it through the execution of your VI. The history of chart can be increased so all of your data is displayed. There are also three different modes for displaying data on a waveform chart that are similar to the different actions of an oscilloscope.
Here is a great resource for learning about Graphs and Charts.
06-01-2007 03:12 PM
06-01-2007 03:29 PM
1 more thing.
If you stay with your current code, I would try to do the file writing after all the samples have been read. Since you know the total number of samples, you could intialize and array outside the loop and wire it to a shift register. Then in the case structure, instead of streaming to file/hard disk, use the replace array subset to add new data to the proper place in the array. That is, each time you will replace 1000 pts first starting at index 0, then the next time at index 1000 and etc. Outside the loop, all the data will be availabe from the right had side shift register and then you can write to file so it can take its jolly ol' time. This keeps you in RAM during the time critical DAQmx reading and the slower streaming to hard disk is done afterwards. Also, if you go this route, I would not graph in the loop since you won't see it update anyways. If you're loop iterates at 1 Hz or less you could graph in the loop but your loop will be going much, much faster. Put the graph outside the loop. This can be a waveform graph since you don't need the history capabilites of the chart.
peace,
drew