LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Erroneous time in graphs in output cluster

I have an application that reads a binary file and then displays, analyzes and presents the data in charts and indicators. The 'main' application is "06_ATP_Read and Analyze SubVIs.vi" with the "04_ATP_Read.vi" and "05_ATP_Analyze & Present Data.vi" subvis.
The application with the problem is called "05_ATP_Analyze & Present Data.vi" and it is in the attached file. It was built on the LabView Basics II example.
Everything works fine except in the graphs from the output cluster the time values are 5000 times bigger than the real ones displayed or selected in data graphs at the left of the cluster. The 5000 times value is exactly the sampling rate I am using (5kHz) but I am not sure if this is related because I am not sure where is the problem coming for. My feeling is that the feedback node is causing the problem but, again, I'm not sure.
What could I do to make things right? Any suggestions/examples anybody?

Thank you.
0 Kudos
Message 1 of 9
(2,586 Views)
Hello.

I tried downloading your VIs, but I could not get them to run because there is a VI missing ("ATP Save Data To File.vi")

However, from your description, it sounds like the problem is just a matter of setting the correct multiplier value for the x-axis of the graphs you are complaining about.

Right-click on the graph, go to "Properties", go to the "Scales" tab, make sure you have the X-axis selected (make sure!), and set the multiplier to 0.0002. The multiplier of a graph specifies how much is between each sample of the graph.

Alejandro
0 Kudos
Message 2 of 9
(2,575 Views)
The vi runs.
You just have to replace "ATP Save Data To File.vi" with 07_ATP_Save Data To File.vi"

Anyway, I do not think the problem can be solved that easily. I believe your solution will only make the time axis look right but the overall might be wrong. Plus, how about the FFT graphs where on x axis is "frequency": if the time data is comming erroneous (and it looks like this is happenning) it will be of no help to change x-axis values just into the final chart displaying the output... ("garbage in - garbage out")

Also, If I am not inputting the values in the 'bundle by name' and then the cluster but I input them in charts and indicators the output looks just right...

Any other ideas?
0 Kudos
Message 3 of 9
(2,568 Views)
Hello.

You must be aware that the waveform data type includes information about the sampling rate (or multiplier) of the waveform it contains. You can use the "Get Waveform Components" node (from Functions >> Waveform) to see what the waveform data type contains.

When you wire this type of data to an FFT vi, it contains the multiplier info, so the FFT would be correctly computed, accounting for the sampling rate.

However, when you bundle the data into the output cluster, you are only wiring the raw numeric array data, loosing the sampling rate data.

So, if you want the graphs from the output cluster to have the correct x-axis scaling, you must either include the sampling rate in the cluster, or set the multiplier property as described in my past message.

If you put a waveform graph in the front panel of a VI, then go to the block diagram, and place the mouse over the graph's terminal, you can see in the context help window (press CTRL-H if it is not open) how to create clusters to include the multiplier info for a waveform graph (as well as the initial time).

I hope this helps.

Alejandro
0 Kudos
Message 4 of 9
(2,556 Views)
Alejandro,

Your suggestions sounded good to me. However, I could not put them in practice because:
1. The multiplication factor would work for the time axis but I am not so sure it will work for frequency axis (I do not know multiplication factor for frequency); then, if I change the sampling rate I will have to change the multiplication factor for the charts and I'm afraid it all becomes too complicated and cumbersome.
2. I did not really understand from the context help window how should I create clusters to include the multiplier info for the waveform graph; well, at least for my case. What I can do is to add an indicator in the cluster and connect there the sampling rate but, again, would this work for the FFT? Once I apply the FFT for the incoming "Acceleration versus time" how do I know the same 'sampling rate' factor will now apply to the FFT?

Maybe I'm just not getting it. If you can explain in a little bit more detail or have other suggestions, I would appreciate...
0 Kudos
Message 5 of 9
(2,537 Views)
Hi RPJ,

I can clarify Alejandro's second point. A waveform datatype actually has three components. A start time, delta t, and array of Y values. The Waveform graph starts at the "start time" and plots each point with a spacing of "delta t." Therefore, if you sample at 5000 Hz, your delta t should be 1/5000 or .0002. The VI attached below might give you a better idea of what I am talking about.

Hope this helps!

Travis H.
National Instruments
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 6 of 9
(2,518 Views)
Thank you Travs,

I think I got the idea but how would I implement this in my vi? I tried a couple of connections and the attached file presents some of them. Look in 05_ATP_Analyze & Present Data.vi, in case structure 0.

Another problem is that the sampling rate might vary from file to file and I will not know it before opening the file. I need some kind of automatic reading of sampling rate rather than manual insertion.

This vi is very similar to the exercise from LabView Basics II and there I did not have to put any additional 'build waveform' components to make it work; probably because there was a chart and not graphs, I don't remember right now... Any way, the idea with the cluster is that it helps me to easily save processed data in one file. I'd like to stay with this solution only if there is nothing better that you or somebody else can suggest.

Could you show me how would I implement the 'build waveform' in my vi?
0 Kudos
Message 7 of 9
(2,510 Views)
Hi RPJ,

All I was showing in my example VI was that by using the Get Waveform Components.vi and Build Waveform.vi you can modify your waveform data. I don't know how you are sampling your data, but if you know that it was sampled at 5000 Hz (and for some reason it is not showing that way in the waveform data), then you can programmatically change the dt to .0002 using the two VIs mentioned above. The dt of your waveform is obviously going to change the FFT of the data.

It's difficult to just say "this is what you want to do in your VI" because we don't know what you are trying to do in your VI, and we don't know everything about your specific application. Hopefully these general suggestions will help you in debugging your application.

Travis H.
National Instruments
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 8 of 9
(2,490 Views)
Thank you Travs.
I appreciate you had another look at my messages.
Fortunately I just found out the solution today after getting NI advice (through e-mail) and doing some trials of my own.

Thanks to all who spent time to help me.

Radu
0 Kudos
Message 9 of 9
(2,487 Views)