Jump to content
Manudelavega

LV Dialog box holds Open VI Reference

Recommended Posts

Hi,

 

I am facing a weird situation and would like to get your insights. My application is quite large (>1000 VIs). When I run it, an initialization phase takes place, and around 10 or 20 objects are created (LVOOP). Most of these objects start their engine using the Open VI Reference and then the Run method. If they encounter any warning during that phase, they enqueue a message to display, and a dedicated VI keeps checking this queue and opens a LV Dialog (with just a OK button) when it finds an element. The purpose is to allow the initialization phase to continue instead of waiting for the user to acknowledge the window. Then when the init phase is complete, the user can just acknowledge all the dialogs one after another. (usually there is like 1 or 2, not much more).

 

I ran my code this morning and was surprised to see that the init phase would still wait for me to acknowledge the dialog. A few probes showed me that the application was stuck in one of the Open VI Reference call. After I acknowledge the window, it would process normally.

 

I am wondering what is causing this behavior and whether it is a known issue. Could it be related to the fact that the Dialog is modal and somehow holds the thread in which the Open VI Reference executes? This is weird, because other complex operations (connecting to a database,...) manage to execute while the dialog is open...

 

Thank you very much for your help

 

Emmanuel

Share this post


Link to post
Share on other sites

I would suspect it is a “Root Loop” issue.  I know that Open VI Ref can require LabVIEW’s Root Loop, and this loop is blocked by the User opening a menu.  Perhaps a LV dialog also blocks root loop?  



BTW, if it is Root Loop, then a method used to get around this problem is to use a single reference to a pool of clones to do all asynchronous running of VIs.  Then the ref is only acquired once, before any action that blocks root loop can happen.  The latest Actor Framework’s “Actor.vi” is an example of this.

  • Like 1

Share this post


Link to post
Share on other sites

A quick google search led me to this article: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Change-one-and-two-button-dialog-windows-do-they-do-not-block/idi-p/983941

 

You're right, the 1-button and 2-button dialog box uses the root loop, but the 3-button does not, so I could work around the issue by replacing my dialogs with the 3-button version. It works great now.

 

Thank you for pointing me to this "root loop", I had never heard of it before, and wouldn't have found that article that easily without this keyword!

 

Regards

Emmanuel

Share this post


Link to post
Share on other sites

As a word of warning to anyone reading this, be aware of the issue of Root Loop blocking by things such as the User opening a menu.  Safety-critical code must never be dependent on Root-Loop blocking functions, such as “Open VI ref” or “Run VI”; the User can open a menu then walk away.  If in doubt, test it by opening a menu and leaving it open just before your critical code executes.  If it doesn’t execute until you dismiss the menu then you have the problem.  The simplest fix is to open necessary references once at the start of the program, and use the ACBR node instead of the “Run VI” method.

  • Like 1

Share this post


Link to post
Share on other sites

An example of how to safely set up the ACBR call is in

  vi.libActorFrameworkActorLaunch Actor.vi

in LV 2013 and later. Thanks to drjdpowell for catching that one -- myself and the rest of the AF community missed it.

Share this post


Link to post
Share on other sites

That is an interesting tidbit. I've so far thought that the only way to avoid getting blocked by the root loop was to populate the asynchronous call pool (and hope that the pool is large enough to meet the demand during a blocking event...).  Populating the call pool is only required for a speed gain then, or?

Share this post


Link to post
Share on other sites

Populating the call pool is required if you're making synchronous subVI calls and not going through the asynch call by reference node. The synchronous subVI call has better performance (because LV knows ahead of time exactly what subVI to prepare to call and all it needs is the memory instance, whereas there's a lot more unknowns around any of the call by ref nodes).

Share this post


Link to post
Share on other sites
 I've so far thought that the only way to avoid getting blocked by the root loop was to populate the asynchronous call pool (and hope that the pool is large enough to meet the demand during a blocking event...).  Populating the call pool is only required for a speed gain then, or?

Getting the ref with “Open VI Ref” is blocking, but increasing the size of the pool when needed does not, so there isn’t a need to prepopulate the clone pool.  

 

On my benchmarks adding an extra clone is about 1000us, while reuse of a clone in the pool is about 100us (LabVIEW 2011).  

Share this post


Link to post
Share on other sites
Populating the call pool is required if you're making synchronous subVI calls and not going through the asynch call by reference node. The synchronous subVI call has better performance (because LV knows ahead of time exactly what subVI to prepare to call and all it needs is the memory instance, whereas there's a lot more unknowns around any of the call by ref nodes).

 

The *asynchronous* call pool is only required for synchronous calls? Was it not introduced with the async call by reference node in the first place?

Share this post


Link to post
Share on other sites
The *asynchronous* call pool is only required for synchronous calls? Was it not introduced with the async call by reference node in the first place?

Oh, that... sorry... I was thinking about the shared clones reentrancy pool for subVIs.

 

The prepopulation of the async pool just helps with performance -- you get all the allocation out of the way early and then start making calls. But if you run out of the pool, there's no danger of not being able to allocate more because of root loop, whereas there is with other types of allocations.

Edited by Aristos Queue

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By Francois Normandin
      View File UI Tools
      UI Tools v1.4.0
      Copyright © 2009-2016, François Normandin
      All rights reserved.
      Author:François Normandin
      Contact Info: Contact via PM on www.lavag.org
      LabVIEW Versions:
      Created and tested with LabVIEW 2012
      Dependencies:
      OpenG Application Control Library >= 4.1.0.7
      OpenG Array Library >= 4.1.1.14
      OpenG File Library >= 4.0.1.22
      OpenG LabVIEW Data Library >= 4.2.0.21
      OpenG String Library >= 4.1.0.12
      LAVA Palette >= 1.0.0.1
      Description:
      This package contains tools for designing user interfaces.
      A first palette helps create special effects using transparency of front panel. Using them allows to quickly create fade-ins or outs using linear or exponential variation of the intensity. A second palette contains VIs to calculate the position of GObjects for many purposes like alignment, snap, mouse follow, etc. A third palette contains VIs to create dialog boxes based on class instances. "Simple Error Dialog" and "Simple Selection List" are featured with or without backrground blackening effect. A fourth palette includes some VIs to move objects programmatically on the front panel, using a basic deceleration algorithm to provide an impression of a smooth movement. The packaged VIs are all namespaced using a suffix “__lava_lib_ui_tools” which should not conflict with any of your own code.
      Includes:
      Front Panel Transparency (Fade In & Fade Out) Utilities (Alignment, Snap) Dialog (OOP based, extensible) Engine (Beta) for object movement Instructions:
      This package is distributed on the LabVIEW Tools Network (version 1.3) and updates are on LAVA (1.4). It can be installed directly in the addon folder of any LabVIEW version from 2012 to now. The addon installs automatically under the LAVA palette of the addon submenu.
      License:
      Distributed under the BSD license.
      Support:
      If you have any problems with this code or want to suggest features, please go to www.lavag.org and navigate to the discussion page.
       
      Submitter Francois Normandin Submitted 09/21/2009 Category LabVIEW Tools Network Certified LabVIEW Version  
    • By Francois Normandin
      UI Tools v1.4.0
      Copyright © 2009-2016, François Normandin
      All rights reserved.
      Author:François Normandin
      Contact Info: Contact via PM on www.lavag.org
      LabVIEW Versions:
      Created and tested with LabVIEW 2012
      Dependencies:
      OpenG Application Control Library >= 4.1.0.7
      OpenG Array Library >= 4.1.1.14
      OpenG File Library >= 4.0.1.22
      OpenG LabVIEW Data Library >= 4.2.0.21
      OpenG String Library >= 4.1.0.12
      LAVA Palette >= 1.0.0.1
      Description:
      This package contains tools for designing user interfaces.
      A first palette helps create special effects using transparency of front panel. Using them allows to quickly create fade-ins or outs using linear or exponential variation of the intensity. A second palette contains VIs to calculate the position of GObjects for many purposes like alignment, snap, mouse follow, etc. A third palette contains VIs to create dialog boxes based on class instances. "Simple Error Dialog" and "Simple Selection List" are featured with or without backrground blackening effect. A fourth palette includes some VIs to move objects programmatically on the front panel, using a basic deceleration algorithm to provide an impression of a smooth movement. The packaged VIs are all namespaced using a suffix “__lava_lib_ui_tools” which should not conflict with any of your own code.
      Includes:
      Front Panel Transparency (Fade In & Fade Out) Utilities (Alignment, Snap) Dialog (OOP based, extensible) Engine (Beta) for object movement Instructions:
      This package is distributed on the LabVIEW Tools Network (version 1.3) and updates are on LAVA (1.4). It can be installed directly in the addon folder of any LabVIEW version from 2012 to now. The addon installs automatically under the LAVA palette of the addon submenu.
      License:
      Distributed under the BSD license.
      Support:
      If you have any problems with this code or want to suggest features, please go to www.lavag.org and navigate to the discussion page.
       
    • By chrisempson
      Hi, I'm writing a LabVIEW application using the Actor Framework. This is the first time that I have used the framework and I need some advice regarding application architecture. My apologies if this is a basic question!

       

      How is a settings dialog box best implemented? In the past in non-Actor Framework applications I have loaded the configuration from a functional global variable, displayed the settings dialog, then written the updated settings back to the functional global. I'm not sure this would work correctly (or optimally) within the context of the Actor Framework, though. 

       

      My application uses the template generated by Create Project -> Actor Framework. The top-level Actor manages the user interface. Two child Actors control separate pieces of hardware. The top-level actor must read a saved configuration from an INI file when the application starts, and save the final configuration back to the INI file on exit.

       

      Instinctively I think it would be best for each child actor to maintain its own settings, as a cluster in its class private data. Ideally I don't want to have to keep a separate instance of the two clusters of settings in the top-level Actor's private data in order to populate a settings dialog; this duplication seems unnecessary.

       

      The only way I can think of to make this work is as follows.

       

      At application start

      1. Top-level Actor reads settings from INI file.

      2. Send messages to both child actors with the new settings, and tell them to apply those settings to their private data.

      3. Each child Actor should respond to acknowledge that the private data has been updated.

       

      To update the settings using a dialog box

      1. Send a message from the top-level Actor to each child Actor to ask them to send their settings to the top-level Actor.

      2. Wait for both child Actors to reply.

      3. Display the dialog box.

      4. If the user clicked 'Ok' and not 'Cancel', send messages to both actors with the new settings, and tell them to apply those settings to their private data.

      5. Each child Actor should respond to acknowledge that the private data has been updated.

       

      On exit

      1. Send a message from the top-level Actor to each child Actor to ask them to send their settings to the top-level Actor.

      2. Wait for both child Actors to reply.

      3. The top-level Actor writes the settings to the INI file.

       

      This doesn't seem like a sensible approach, though. Waiting for message replies sounds like the wrong thing to do. I wouldn't know where in the block diagram to implement this scheme, either.

       

      Can anyone offer me any advice? There must be a fairly standard way of doing this that I'm missing!

       

      Thanks in advance,

      Chris

       

      ---

      Dr. Chris Empson

      Robot Screening and Instrumentation Specialist

      School of Chemistry

      University of Leeds

      UK

       

      CLD

    • By ak_nz
      Hello forum LAVA-ites,
       
      I am attempting to write a Tools Menu item to slot into the IDE. The intent of this "Tools" VI is that it determines the application instance that launched it and dynamically run a VI in that application instance so that the launched VI can access VIs in that instance. This is basically a custom Unit Testing tool that looks for particular VIs in the project that houses the application instance.
       
      I was attempting to use the App.MenuLaunchApp property in this "Tools" VI so that I could wire up an Open VI Reference node with the right application instance and the name of the VI to run dynamic VI to run. I added an extra indicator on the launched VI to show what application context it is running in.
       
      If I have a VI open from a Project and then launch the "Tools" VI from the Tools menu, then the dynamically run VI indicator shows "My Computer" (referring to the project housing the application instance). However - if I launch the "Tools" VI from the Tools Menu while Project Explorer is showing then the dynamic VI launches in the NI.LV.Dialog irrespectively (the indicator on the front panel of this VI shows this).
       
      Is this expected behaviour? Is there a way around this so that the dynamic VI gets loaded into the right application instance even if launched from Project Explorer?
       
      Thanks in advance.
    • By GregFreeman
      I have a tool I'm creating and it searches the active project for all VIs recursively. I have found if I try to use Open VI Reference to an unsaved VI it fails (I am wiring up just the VI name as a string). It gives me error 1004, VI not in memory.
      However, if I go to that specific project and create a new VI and do open VI Reference with "Untitled x" wired as a string, it opens the reference fine. Does the tools menu somehow run in a different context where it can't open a reference to an unsaved VI? Is there a way to make this work?
      I should add, there are no problems when it's saved to disk and wired up as a path (somewhat obviously).
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.