LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with chart problem

I have built the attached vi to read a binary file. It has two problems which I have not been able to figure out. The way it works is as follows: Reads the entire file, and grabs the trace names from the file. Populates the list box with these names. Select the traces you want to see and then the legend display will size itself and populate with the selected names. The selected traces will also display on the chart.
 
1. Sometimes, when picking a SINGLE trace it won't display on the chart. Instead I see a blank chart and the X-Axis shows Dec. 31 1903 @ 7pm. Usually If I select more than one it displays correctly. A probe shows me the data is in the wire going to the chart, but the chart doesn't seem to update.
 
2. Presently I am using a loop to read the file in its entirety. However the chart only displays 1 second worth of data. This is one segment of the original file. By reading the whole file I am seeing the LAST second of my data. Previously I removed the loop and then I only see the first second of data. Is there an easy way to select a different segment of the file to display?
 
I have been fighting with these two issues for several days now and I don't seem to be any closer....
 
Here is my vi and a sample binary file. (Note that I couldn't attach it as .bin so it needs to be re-named back to .bin from .txt)
 
technomage
 
 
Download All
0 Kudos
Message 1 of 12
(3,779 Views)
If your time is equal to zero you will get 12/31/1903 6:00:00 PM.  So it sounds to me that the time stamp is set to zero.
Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Message 2 of 12
(3,760 Views)
I don't have time to do a detailed inspection of the code but the LegPlots I would not be placed inside the loop.  I would update the number of plots first then update the charts.  It may or may not help.
Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Message 3 of 12
(3,750 Views)
There are some issues to resolve.

Close the file after reading it (after the first while loop) this will make the program better.
I don't know how to read a part of such a file (i've never used waveforms in this way to save data) But i think their is no way to read a part of the data, or you should write an advanced parses.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 12
(3,733 Views)

Thanks for your replies. I am still playing with it. Now I have added the "file close.vi" just to clean things up. I re-arranged my operations so now I am updating the LegPlots to size the Legend, then updating the ActPlot/PlotName to populate the legend. Lastly I am updating the actual chart. All of this has made no difference to the way it works. The two problems still exist. More tomorrow....

 

0 Kudos
Message 5 of 12
(3,723 Views)
I agree there is something not right with the X-axis. All waveforms have the same x0, but if you select some of them, the x-axis does not correctly adjust. Disabling "autoscale X" seems to cure the problem, though.
 
I took the liberty to cleanup your code a bit and it seems to work fine now. You do a lot of things that are not necessary, e.g. placing the file read inside a loop, yet using a plain output tunnel. Since you read an array of waveforms, you get all signals with a single read operation anyway.
 
Instead of polling for selection changes, use an event structure. Why are you writing the "legPlots" property inside the loop, this needs to be done only once, right?
 
Attached is your modified example. I removed all the unecessary buildup and streamlined the code a little bit. It seems to work OK. I places some green comments on the diagram. Let me know if you have any questions or spot an error.
 
 

Message Edited by altenbach on 09-11-2006 02:19 PM

Message 6 of 12
(3,694 Views)
I tried your program in LabVIEW 8.20 and the axis error no longer occurs! 😄
 
Clearly, there is something buggy the way x0 is handled in LabVIEW 8.0 if the x axis is set to autoscale.
 
Apparently, NI fixed the problem in the new version. Time to upgrade. 😉
Message 7 of 12
(3,692 Views)


@technomage wrote:
2. Presently I am using a loop to read the file in its entirety. However the chart only displays 1 second worth of data. This is one segment of the original file. By reading the whole file I am seeing the LAST second of my data. Previously I removed the loop and then I only see the first second of data. Is there an easy way to select a different segment of the file to display?


Just to clarify, you're not reading the entire file, since you are using only a plain output tunnel. You only get the last dataset, read in the last loop iteration. Everything else is thrown away. An output tunnel does not magically accumulate data from previous iterations. If you want to keep everything you need to reassemble the signals as you read each set.

It is not clear to me how you write the datafile and thus how the data is arranged inside the file. Can you show us that code?

Message Edited by altenbach on 09-11-2006 02:40 PM

Message 8 of 12
(3,685 Views)

altenbach, Thanks a ton for your assistance. I have gained serious insight by examining how you approached this. I am able to see how my thinking was somewhat flawed. Here is the vi I used to write the file. I have also included another sample .bin file (which needs to be renamed to .bin), and a subvi I built to generate filenames based on time stamps.

This is part of a system we are trying to build to monitor some of our equipment 24/7. The plan is to use this data to monitor long term degradation of the equipment in order to perform preventive maintenance, before problems occur. I work in a Nuclear plant, so problems can be serious...

In the final application the "Trigger" will be set by a physical input. For example, when a fuelling machine component is commanded to move we will start the data acquisition and when the machine is commanded to stop, the acqusition stops. The plan is to archive all of the data, and any analysis would be done by the system engineers later.

We would like to able to examine the entire data file which would be captured. A typical movement of our machine might last for as long as 2 minutes. We want to capture all of this time period, but we might need to examine only a couple of seconds anywhere within this window.

Thanks again for your insight. 5 Stars across the board....

 

technomage

Download All
0 Kudos
Message 9 of 12
(3,651 Views)
technomage,

I took a quick look at your write.vi file and I think there are a few issues you should consider addressing:

  1. You write to and close a file that is not necessarily open (i.e. you create the file inside a case structure).  This is not a good programming practice.

  2. Inside the case structure you effectively have a true constant wired to the stop input of the DAQ Assistant.  Why not just setup the DAQ Assistant to acquire N Samples instead of setting it for continuous acquisition?

  3. Is it your intention to have a new file for every second of data acquired?  Also note that because of the way your write follows the DAQ Assistant you aren't guaranteed that there won't be gaps between the 1-second chunks of data you are reading.  Based on my understanding of your application I would write all of the data from each movement into one file.

  4. I would also add a wait VI in the false case of your case structure to ensure your while loop doesn't monopolize your processor time by running needlessly fast.
These are just a few suggestions.  If you have any more questions please do post them.

Regards,

Simon H
Applications Engineer
National Instruments

Message 10 of 12
(3,610 Views)