LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab control: Graph automatically resets when I switch between tabs

Solved!
Go to solution

Hi everbody,

 

I am having a problem with a UI. :mansad:

I am using a tab control with two tabs to switch between two graphs. One graph shows the data of a manufacturing machine (tab 1), the other one data from a measurement probe (tab 2). Now, when I switch from tab 1 to tab 2 and back, the graph in tab 1 is empty and starts to display data from the moment of going back too tab 1. The data in tab 2 is not reset but is constantly updated even when tab 1 is open. I would like tab 1 to behave the same as tab 2. It should be constantly updated even when tab 2 is open and the data should not be reset after switching tabs. 

 

The manufacturing machine is connected via an OPC server (tab 1 data, image 1), the data from the probe is written an queue and retrieved from it (tab 2 data, image 2). All this is part of the main VI. This part is shown in image 3. There, the history data is reset when the program ends. But I can't figure out, why it doesn't work the way I want. 

Can anyone help?

Thanks!

 

 

Manufacturing data.PNGMeasurement probe data.PNGMain program.PNG

0 Kudos
Message 1 of 9
(4,785 Views)

Instead of embedding a (non-executable) picture of (part of) the Block Diagram of the VI in your post, if you attached the VI itself to the Post, we could examine it carefully (and fully), make sure we understood if you were using a Graph or a Chart, and actually test it (and possibly fix it).

 

Please re-post, attaching your VI!

 

Bob Schor

0 Kudos
Message 2 of 9
(4,761 Views)

Hello Bob,

 

you find the project attached. I didn't upload it in the beginning because it is a fairly large project with several subvis retrieving data via an opc client or drivers provided by the probe manufacturer. I am not sure, whether you can run it at all.

If it doesn't work, give me a heads up what the issue is and I will try to fix it either before I leave work (quite soon) or on monday morning.

 

Thanks again!

0 Kudos
Message 3 of 9
(4,730 Views)
  • You could make your attachment significantly smaller my seperating the compiled code.
  • Your project has a strange hierarchy and none of the VIs can be openend from within the project.
0 Kudos
Message 4 of 9
(4,717 Views)
Concerning your original problem, don't use tab controls. Rather than switching between two graphs, have one graph and simply select which data you pass it.

Alternatively you could have two VIs running in parallel and each displaying data to its own front panel. For the GUI, use a subpanel to display the one you want.

Check my blog for more details. Start at the beginning and work your way forward.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 9
(4,659 Views)

Did you do a "Save for Previous Version"?  It looks like the Zip file that you sent contains multiple files from your C: Drive, particularly from the LabVIEW installation folders, while the Project "points to" the files that exist on your own Hard Drive.  It makes it extremely difficult to load anything, as the files referenced in the Project are not in the "correct" folders in the Zip file.

 

I'm going to let you try to fix this ...

 

Bob Schor

0 Kudos
Message 6 of 9
(4,629 Views)

Good morning,

 

sorry for not writing sooner.

I guess I really saved a copy for older versions. I now did a normal save. That means that you have to click yourself to the GPCG1_MHL.lvproj in the user file. The hierarchy might seem a little strange. But when I copy the files to the a different location, it cannot find any. From that you see that I am not a practiced LabVIEW programmer but that this is my first project on which I am working on for a long time now. And unfortunately not continuously. The driver package for the probe I am using is in the Program files directory referenced.

 

In the project, run the main.vi.

The Subvis I am having trouble with are the two in the while loops at the bottom. "Read process data.vi, labeled "Read data" with a gray image in the background and "View parsum data.vi", also labeled "Read data" with a green/gray image in the background.

I hope, now you can take a look at it.

I am thankful for any suggestions!

 

0 Kudos
Message 7 of 9
(4,593 Views)
Solution
Accepted by topic author Qbach

OK, there are some very strange things going on here, besides the problem you are facing (which, I must confess, I don't yet see why you are having a problem).

 

First, I've never encountered such a strange, deeply-nested directory structure for LabVIEW code as what you posted:  Users\AB\BC\CD\DE\EF\FG\GH\HI\IJ\<Project files and folders>.  Why in the world do you have a meaningless stack of folders and directories to traverse?  Very, very strange.

 

You are displaying multiple graphs using Waveform Charts.  You do, indeed, assemble an array of Waveforms to display on the Chart, but the Waveform consists of a single point, "built" into an array, with a current TimeStamp as t0.  Rather than go to all that effort, you can simply bundle your data points into a Cluster and display that.  Your X axis won't display "Current Date/Time", but if you know the sampling rate, you can adjust the X Scale so it displays "Time" in convenient units (like seconds) since the start of the sampling.  Note that you already have such a Cluster (at least in Read Process Data -- the output value Process Data -- that can be directly wired to the Fluid Bed Diagramm without needing the Signalverlaufsdiagramm).  This might, in fact, "fix" your problem (but I'll let you test this).  You'll have to do a similar Cluster Bundle in View Parsum Data and output the Cluster instead of the Chart to test this idea.

 

Bob Schor

0 Kudos
Message 8 of 9
(4,567 Views)

Hello Bob,

 

thank you for your answer. First to the weird folder structure. I know this is a confusing folder structure. I renamed them before uploading the file, as the folder names originally contain my name and other details that I don't want to share on the net 😉

First I copied the files to another folder after saving it, but than the programm wouldn't work anymore. Before finding out how to fix that (this is still my first LabVIEW project), renaming was the quicker alternative. However, I know that it is deeply nested, but that way I find everything as I have to deal with a lot of different things in my job.

 

To the important part:

Your suggestion to discard the "build waveform" is pretty elegant and simple. And most important: it works! The graph is not reset anymore. I use a "wait until next ms multiple" to get a sampling rate of 1 Hz.

 

Now I only need to figure out, how to display the current time and not the time/date from 1904.

 

Thank you for your help!

0 Kudos
Message 9 of 9
(4,552 Views)