LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading TDMS Viewer into Subpanel

So I've been tasked with adding a new feature to a program that uses TDMS files heavily.  Essentially what we want is to be able to view the contents of a TDMS file generated by other software that we use for data acquisition and waveform conditioning.  One of the requirements for the feature and to keep things streamlined is to build the feature into a tab on the front panel of this VI.  The most obvious thing that comes to mind is to simply use the TDMS file viewer and load it into a subpanel.  I've used subpanels before without issue and find the process straightforward, but this one has me stumped.

 

At first when I called the TDMS viewer VI it would popup in its own window and not the subpanel.  This was easy enough to stop, but the problem I am having now is that the viewer VI does not appear in the subpanel window.  I know the viewer is running because if I do not specify a file path I get the usual file selection prompt.  Even if I select a file to view, nothing appears in the subpanel window.  I put together a simple test VI with a subpanel frame.  Even if I resize the subpanel frame I can't get any part of the viewer to show up.  I changed the window appearance to "default" for both the test VI and for the file viewer.  Still nothing.

 

Attached is a copy of the VI block diagram which should be loading the TDMS viewer into the subpanel.  Let me know if you need to see the TDMS Viewer code.

 

Any ideas what's up?

0 Kudos
Message 1 of 16
(3,550 Views)

Nothing??  Anyone?  *bump*

0 Kudos
Message 2 of 16
(3,490 Views)

If you attached your actual VIs (or some simplified ones just to reproduce the problem), you would have already got help. Instead of bumping the thread, I really advice to do so 🙂

0 Kudos
Message 3 of 16
(3,478 Views)

As you have it written, the viewer has to stop running before it can be loaded into the subpanel (Call By Reference is almost just like calling the VI directly).  Try using the Start Asynchronous Call with the 0x80 option on the Open VI Reference.  That will start the VI and allow it to run in parallel with the rest of your code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 16
(3,465 Views)

My "code" is attached.  The TDMS Viewer is standard code included in LabVIEW for several years now.  I'm not a n00b here, I worked at National Instruments just like you probably.  Your "hazing" response is NOT appreciated.  I have a CLA and a CTD too but I don't need to brag about it.

 

Using the start asynchronously option makes no difference.  I've run VIs in subpanels before and there's no need to use the asynchronous option to allow code to run in parallel.  I've done it before, I just don't understand why it doesn't work in this case.  As I said, the code *IS* running, but you cannot see the front panel in the subpanel pane.

 

Anyone else have any (useful) thoughts?

0 Kudos
Message 5 of 16
(3,451 Views)

Using an asynchronous call worked but was only part of the solution.  In the code I linked I was using "Call by reference" to pass the file path into the VI and then manually start the VI.  This worked but the front panel of the VI was not visible in the subpanel pane.  Instead, I had to use the "Start asynchronous call" VI to pass in the argument (and start the VI at the same time).

 

All of this has helped but there is now some odd behavior.  When you stop the file viewer (click the quit button), it does 1 of 2 things: 1) Automatically restart the file viewer or 2) Freeze up the main VI.

 

Very odd behavior from LabVIEW.  Disappointing.

0 Kudos
Message 6 of 16
(3,438 Views)

@jeffl3001 wrote:

My "code" is attached.  The TDMS Viewer is standard code included in LabVIEW for several years now.  I'm not a n00b here, I worked at National Instruments just like you probably.  Your "hazing" response is NOT appreciated.  I have a CLA and a CTD too but I don't need to brag about it.

 

Using the start asynchronously option makes no difference.  I've run VIs in subpanels before and there's no need to use the asynchronous option to allow code to run in parallel.  I've done it before, I just don't understand why it doesn't work in this case.  As I said, the code *IS* running, but you cannot see the front panel in the subpanel pane.

 

Anyone else have any (useful) thoughts?


Well, I have never worked for NI, I have no CLA and CTD. I only have a CLD, a PhD and some nasty OCD 😄

Anyway, back to the relevant:

I am able to load the TDMS viewer into my subpanel, see the attached VIs. I only changed two setttings for the TDMS viewer: I enabled "Show front panel when loaded", and disabled the "Run when Opened". It works, my "MAIN.vi" can load the subVI into its subPanel. I did not program the path input yet.

 

This all I could help you, since you still did not attach your real VIs, so people cannot have a look at them...

 

subpanel1.png

 

subpanel1.png

 

TDMSviwer.png

 

no_runwhenopened.png

Download All
0 Kudos
Message 7 of 16
(3,434 Views)

With the path. The trick is to load the VI into the subPanel, and then run it (the code needs some clean up, stopping mechanism and error handling):

 

Edit: in your original post you call twice in two ways the subVI.

 

MAIN2_BD.png

0 Kudos
Message 8 of 16
(3,422 Views)

hanks for the feedback.  It is interesting the difference between a synchronous call and an asynchronous one.  I understand the difference between the theory of each but practically it's not translating the way I would have thought so.  I've never had a reason to use an asynchronous call before and I'm not sure the reason.  Perhaps it was because I've never had to pass an argument to a VI running in a subpanel?

 

I've changed up the code again some to streamline it a bit more.

 

SubPanel Caller 3.PNG 

Things are more reliable now in that the behavior is predictable.  However, if I click "quit" in the file viewer and then, say, click the one of the tabs, both the file viewer and the main VI freeze.  There's nothing in the code that I can tell should be causing this.  I'll attach the file viewer since people want to see it, but the changes are minimal at best.  Ideally, there would be no changes.

0 Kudos
Message 9 of 16
(3,416 Views)

I opened your subVI, and it started to run. I realized you did not make those two changes which I did for my version:

  • Enable "Show front panel when loaded.
  • Disable "Run when loaded"

I am not 100% sure about the reason of the freeze up when you try to stop the subVI with the "Quit" button, but it is just easy to avoid such problems:

do not stop that subVI running, from inside of it, but use the MAIN VI to control its running. So for example in your main code when you need such window, you load it into a subpanel, and when you do not need it anymore, you remove it from the subpanel, and Abort it. In this way there is no deadlock, try it!

 

subpanel.png

 

0 Kudos
Message 10 of 16
(3,405 Views)