≡ Menu

03 VISV Dynamic Process VIs in LabVIEW (Part 1 of 2)

Part 2 of this video can be found here.

This is part 1 of a 2-part video series where we go into detail on how to use dynamic VIs as parallel asynchronous processes in LabVIEW. Topics covered in this video:

  • Differences between static vs dynamic VIs
  • How to build an executable with dynamic VIs
  • How to call a dynamic VI
  • How to use the Run VI method
  • How to pass data to a dynamic VI

Download Code used in this tutorial: (LabVIEW 8.2)

Do you have any questions? Is there something you want to know about in more detail? Leave a comment below, or send your questions to feedback@vishots.com

*Update*

I have gotten an excellent question in the comments in response to this video. It’s regarding how to close an idle dynamic VI front panel after it has been aborted. I created a short video response with a possible solution. Check it out here.

The basic idea is that you can check if the front panel is open (FP.Open property) after abort, and if it is, execute the FP.Open property set to False. However there is a caveat to this solution as I describe in the video.

About the author: Michael Aivaliotis has been working in the test and measurement industry since 1993 with LabVIEW 3.0. He started his career as a test engineer and quickly fell in love with the graphical programming paradigm that LabVIEW provided. Since then, he’s worked on or developed an incredible number of complex test systems in electronics, semiconductor, automotive, telecom, biomedical and other industries. He’s an Certified LabVIEW Architect and a Certified LabVIEW Instructor. He also has the distinction of being among a select few LabVIEW Champions. In 2002, he created the LAVA Forums which have now become the largest independent online LabVIEW community. Email Me

  • Pingback: Dynamic Process VIs in LabVIEW (Part 2 of 2) — VI Shots

  • Robsmi03

    Great video, I’d sort of managed to work this out myself from just playing around but its great to hear it layed out properly. I dont suppose theres a way once you’ve aborted a dynamic VI to close the front panel automatically as well (after aborting the VI aborts but the front panel stays open in edit mode) just a littl annoying having to close front panels that have exited manually all the time !

    Cheers

    Rob

    • http://vishots.com VI Shots

      Thanks for that excellent question. I created a short video response with a possible solution. Check it out here: http://www.screencast.com/t/PjdO7pAOsk

      The basic idea is that you can check if the front panel is open (FP.Open property) after abort, and if it is, execute the FP.Open property set to False. However there is a caveat to this solution as I describe in the video.

      • Robsmi03

        Many thanks for your video reply ! Armed with this new information (with some tweeking) I have been able to achieve the desired functionality. Many thanks again

        Rob

  • rockethacker

    It is extremely important to close the front panel BEFORE stopping or aborting the dynamic VI. Doing this in the wrong order will leave the dynamic VI instance in memory until your application stops. If you are opening the same VI multiple times, this will result in a memory leak.

    • http://vishots.com VI Shots

      I assume you’re referring to my follow up video? http://www.screencast.com/t/PjdO7pAOsk

      It’s nice to close the front panel before you abort since the dynamic VI looks ugly when it’s idle. However, if you are managing the reference in the caller VI then you fully control when the dynamic VI leaves memory. Simply closing the reference in the caller causes the dynamic VI to leave memory. This is provided that you set auto-dispose ref to FALSE in the Run VI method.

      If you set auto-dispose ref to TRUE, then after you abort the VI, you have no control over it. You basically end up with a zombie VI. In this case, I agree, you must definitely close the front panel before stopping or aborting the dynamic VI.

  • Fabiola

    This video is excellent! Very clear and I love how you use the hierarchy window to show the presence of the VI in memory.

    The only thing I would add is that this is a concept example, people should be looking into using these concepts in their own applications but not reusing the code as it is.

    Thanks and keep them coming :)

    • http://vishots.com VI Shots

      Thanks for your comment and support.

      • Fabiola

        Finally I got around to watching part 2. There you do show code that could be used in an application and you add suggestions on how to improve it. I think if someone watches part 1 and wants to use these concepts, they should watch part 2 before starting their code.

        Fab

  • Pingback: 006 VISV Avoiding broken executables when using dynamic VIs — VI Shots

  • CHTM

    What should we do if we have to use two hardware instruments in parallel,without changing any connections??

  • Danny

    Great clear Video and little example code to play with thank you.

    I was interested in what happens to Dynamic when, you stop or close Main.

    In the case where you have Auto Dispose Ref true, stopping / closing Main and Dynamic stays in memory I assume it also stays running. This makes sense to me.

    With Auto Dispose set to false, I had expected Dynamic to stop running & unload if you stopped or closed Main as you were in effect throwing away it reference, I notice that this is the case unless the FP is open, is the FP open the only situation where stopping /closing main will result in such a zombie process situation ?

    cheers

    Danny

    • http://vishots.com VI Shots

      When using Auto Dispose set to false, the dynamic VI *does* unload from memory when the main VI goes idle. Unless of course it is running with a for loop or something. In that case, yes, LabVIEW has a built-in cleanup mechanism that kicks-in if you have no front panels open (i assume your process is running with no front panel open).

      Feel free to send some example code to feedback@vishots.com, if you want to clarify your scenario.

  • http://www.facebook.com/joaquin.herreroherrero Joaquin Herrero Herrero

    Thank you so much for this video, it’s very clearing to me :)

  • Richard58

    Thank you so much – these videos are excellent! They are clear, concise and conprehensible, and they helped me a lot!
    Richard

    • http://vishots.com VI Shots

      Thanks! I’m glad they helped. I only wish I had time to do more. I have so many ideas for new videos.

  • Pingback: 006 VISV Avoiding broken executables when using dynamic VIs — VI Shots