How do I use a static reference to keep a VI in memory but then call it in parallel?

Hello all,
I have a MainVI and I want to call from it a SubVI in parallel so that I can have both windows open and responsive at the same time.  The SubVI may be closed and reopened any number of times, but only one in existance at a time.  I know how to do this using Open VI Reference, providing a relative path to my SubVI, checking its state to see if its already running, and if so bring the window to the front (using Front Panel: Open method with True/Standard inputs), and if not run it using the Invoke:Run method (and optionally opening its front panel programmatically).  This method was working fine.
Now I have added functional global variables in my SubVI, and I want to keep them in memory inbetween opening the SubVI window.  I can do this by putting a copy of the functional global in my MainVI, even though I don't use it there for anything.  This works fine.
By accident, I have come across a reference to a Static VI Reference, which sounded like a vast improvement to my methodology, for the following reasons:
1) Keeps SubVI in memory all the time, eliminating the need to put the functional global in MainVI when it is not used there.
2) Tells LabVIEW to include SubVI when I build my executable, rather than me having to specifically mark it as Always Include in the build specification.
3) Eliminates the need to keep the path and SubVI name updated in a string constant in my code, in order to use the Open VI Reference.
However, trying to implement this solution, I have run into the problem that once you put a strictly-typed static VI reference (strict typing is required to keep it in memory) onto the block diagram, that VI is reserved for execution.  That means I cannot run it using the Invoke:Run method.  I haven't tried just putting it on the diagram directly as a subVI because I need it to run in parallel to the MainVI.  I have searched through these forums extensively, and although there are several references to a static VI reference, none of them say explicitly how to actually run the darn thing!  :-P
I very much appreciate any insight into my problem.  If I have to go back to the old way it will work fine, but I really like the seeming elegance of this solution.  I hope that it is technically feasible and I'm not misunderstanding something.
Thank you for your help,
-Joe
Solved!
Go to Solution.

> If I understand you correctly, they can only really be used for re-entrant VIs. 
No, a static VI reference can be used anywhere a regular VI reference (property nodes etc.) The reason for the hoop-jumping above is that we are really opening a reference to a CLONE (copy) of the VI identified by the static VI reference.
> Okay, I tried it, and got the code shown below... Any idea why it isn't working?
The VI you want to clone can't be on the diagram as a "normal" subVI. When you run your application you should be able to open that VI and see it just sitting there with a run arrow waiting to run. See attached example (LV2009SP1).
"share clones" vs "preallocate" has to do with whether you want each clone to preserve state (such as in an uninitialized shift register). Generally you use share clones. Occasionally it is useful to have multiple copies on a diagram that each remember some data, like "timestamp of last execution" in a shift register.
Other VIs in your spawned process don't have to be re-entrant unless they are functions that "wait forever". All the built-in G functions are re-entrant. It's pretty common to use a queue to feed data to a spawned process.
Spawning a process is more difficult than just running two parallel loops. It's useful because once you've made 1 copy, you can make 50. If you just want to do two things (vs n things) at once, I would just use two loops.
Attachments:
SpawnProcess.zip ‏20 KB

Similar Messages

  • How can I use Adobe Reader on a MacBook Pr?  It downloads but then doesn't let me into the program

    How do I successfully and fully download Adobe Reader on a Macbook Pro?

    After downloading, you also need to install it.
    What exactly means "doesn't let me"?

  • How do I use tether with droid ultra, keep getting message to call verizon. Do Verizon charge or have to somehow change my account?

    How do I use tether with droid ultra, keep getting message to call verizon. Do Verizon charge or have to somehow change my account?

    Verizon Wireless Customer Support wrote:
    Hi there JByrd,
    Let's take a closer look into this. What plan are you currently on? If you are on the More Everything plan, then you shouldn't have to do anything additional. If you are on the Nationwide plan it is an additional $20 a month for 2 GB of data. Let us know what plan you have. Thanks!
    ErinW_VZW
    Follow us on Twitter @VZWSupport
    Hey Erin how about you confirm to Elector and others that you HAVE to pay for tethering on Nationwide plans and that if you are using a 3rd tethering app to bypass paying you are violating the terms of service. They don't seem to believe me.

  • I used this iphone wire for a bit, it worked perfectly but then suddenly i couldnt charge my phone and it stopped working completely. ive tried many other wires but they dont seem to work as well. im starting to get really frustrated

    i used this iphone wire for a bit, it worked perfectly but then suddenly i couldnt charge my iphone 5  and it stopped working completely. ive tried many other wires but they dont seem to work as well. im starting to get really frustrated and im really unsure of whats the case. i really really need help with this. please help asap!!

    Presuming you are using a wall charger - it would seem that your battery needs to be looked at in an Apple store

  • How do you make a static reference to a method?  I've included code.

    I'm sorry but this is a cross post. This should be here but it is also in the 100% pure Java forum. It won't happen again.
    Now...
    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{   
        static String sString = "TESTING";   
        public int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;      
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );   
    }Again, I apologize for the cross post.

    hi,
    this seems to be pretty easy, isn't it?
    Oh c'mon! You try to invoke a non-static method from within a static method. Solution: Create a specific instance of class testClass:
    testClass test=new testClass();
    test.add(3,4);best regards, Michael

  • How do I make a static reference to a method?  Sample Code Included

    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{
        static String sString = "TESTING";
        int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;  
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );
    }

    Why doesn't this work?Because you can't call a non-static method like add (which operates on the object called this) from a static method like main (for which there is no this).
    There are two ways to fix this:
    (1) In main, create a TestClass object, and call add() for that object:
    class TestClass implements TestInterface {
       public int add(int a, int b) {
          return a+b;
       public static void main(String[] args) {
          TestClass testObject = new TestClass();
          int sum = testObject.add(3, 4);
          System.out.println("test");
          System.out.println(sum);
    }(2) Make add() static. This is the preferred approach, because add() doesn't really need a TestClass object.
    class TestClass implements TestInterface {
       public static int add(int a, int b) {
          return a+b;
       // main is same as the original
    }

  • How can I use installed applications that just keep bumping on my dock?

    Hi,
    I have an earlier 13'' 2011 Macbook Pro with Mountain Lion up to date. Everything works fine except for 2 different things:
    1st- The Apps problem:
    Well, I installed and used dropbox for a long time but someday, for no reason I can discover, it became a normal folder and the dropbox app icon was no more on my menu bar.
    I tried opening, reeinstalling, everything.Now, even having it installed, I start the app and it doesn't show up, not even the icon nor the folder, but in the activity monitor, "she's" there. How can I solve this?
    Another problem was the Skype App, that one I never came to use in this MacBook because I install it and then everytime I try to run it it simply bumps on my dock and stays bumping as long as the computer's on, so..no skype, ever (a headache I must say).
    The same happened to vlc, that bumps too (and nothing more) and flutter, that doens't open too.
    2nd- The so much talked ML battery issues that I honestly can't solve and really annoy me:
    I heard a lot about the Mountain Lion battery issues but after hearing it was solved with some upgrade I went for it.
    I must say I regret it many times because the battery life droped from 8h (7,5h wireless and one or two apps opened) to 2 hours (TWO!).
    I was in panic until I found what I thought beign the solution, some "killall" command for the terminal that removed the desktop background, which in fact made the battery return to 5,5 to 7,5 hours with wirelless on.It worked for a few days and then it came back to normal. I continued doing it very regularly to keep the battery running fine but it started making no difference, so, crappy battery life now (the curious thing is when I leave it unplugged and turned off for a night, he wakes up with the good battery life again, but one on each 3 times maybe)
    Hope you can help me!
    Kind regards

    iPhoto for iOS definitley seems to have its own idea of how to arrange the photos in an event or album. Many users are frustrated by this. Even when the photos are arranged in the correct order in the Photo app they are in a different order in iPhoto for iOS. So far there is no way to correct this. At least, after numerous posts on this forum, no one has posted a method or fix.

  • I need to know how do i get a date on the printed paper it always did but then i had my pc upgraded

    Please can you tell me how does one get a date printed will printing a document

    Please read this post then provide some details.  What printer model? What operating system? What program are you printing from?
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • How can I use non-static  func in  a static func?

    Hello guys,
    I have a func processFiles which is static, i wanna use a func from another class FileData in processFile func and i dnt wanna make processFile non-static, what should i do?
    my code:
    public class Library {
         private FileData file = new FileData();
         public static void main(String[] args){
            try{
                 Library lib = new Library();
                  lib.processFiles(args);
            catch(IOException e)
                 System.err.println("IOException occurred in main.");
                   System.exit(0);
         @SuppressWarnings("unchecked")
         public  static void processFiles(String[] fileNames) throws IOException {
              file.getMaterial();// I get error here;
    class FileData{
        getMaterila() {}
    }

    1) it's not "func", it's "method".
    2) Create a FileData instance and call the method on that
    3) Read the basic tutorials about what "static" means, and put the error message into Google.

  • How can I use my external hard drive on both pc and mac, but also being able to use it to back up my mac data?

    I want to be able to transfer some of my files from my laptop to my macbook, but not all of them. I have a NTFS external hard drive and I have heard about reformatting it so that it can read/write across both systems, but can I still use this hard drive to back up the data on my macbook? If I can, how should I go about reformatting the hard drive?

    FORMAT TYPES
    FAT32 (File Allocation Table)
    Read/Write FAT32 from both native Windows and native Mac OS X.
    Maximum file size: 4GB.
    Maximum volume size: 2TB
    You can use this format if you share the drive between Mac OS X and Windows computers and have no files larger than 4GB.
    NTFS (Windows NT File System)
    Read/Write NTFS from native Windows.
    Read only NTFS from native Mac OS X
    To Read/Write/Format NTFS from Mac OS X, here are some alternatives:
    For Mac OS X 10.4 or later (32 or 64-bit), install Paragon (approx $20) (Best Choice for Lion)
    Native NTFS support can be enabled in Snow Leopard and Lion, but is not advisable, due to instability.
    AirPort Extreme (802.11n) and Time Capsule do not support NTFS
    Maximum file size: 16 TB
    Maximum volume size: 256TB
    You can use this format if you routinely share a drive with multiple Windows systems.
    HFS+ ((((MAC FORMAT)))) (Hierarchical File System, a.k.a. Mac OS Extended (Journaled) Don't use case-sensitive)
    Read/Write HFS+ from native Mac OS X
    Required for Time Machine or Carbon Copy Cloner or SuperDuper! backups of Mac internal hard drive.
    To Read HFS+ (but not Write) from Windows, Install HFSExplorer
    Maximum file size: 8EiB
    Maximum volume size: 8EiB
    You can use this format if you only use the drive with Mac OS X, or use it for backups of your Mac OS X internal drive, or if you only share it with one Windows PC (with MacDrive installed on the PC)
    EXFAT (FAT64)
    Supported in Mac OS X only in 10.6.5 or later.
    Not all Windows versions support exFAT. 
    exFAT (Extended File Allocation Table)
    AirPort Extreme (802.11n) and Time Capsule do not support exFAT
    Maximum file size: 16 EiB
    Maximum volume size: 64 ZiB
    You can use this format if it is supported by all computers with which you intend to share the drive.  See "disadvantages" for details.

  • How do I use Get-ADUser to get just the Managers attribute? And then get rid of duplicates in my array/hash table?

    Hello,
          I am trying to just get the Managers of my users in Active Directory. I have gotten it down to the user and their manager, but I don't need the user. Here is my code so far:
    Get-ADUser-filter*-searchbase"OU=REDACTED,
    OU=Enterprise Users, DC=REDACTED, DC=REDACTED"-PropertiesManager|SelectName,@{N='Manager';E={(Get-ADUser$_.Manager).Name}}
    |export-csvc:\managers.csv-append 
    Also, I need to get rid of the duplicate values in my hash table. I tried playing around with -sort unique, but couldn't find a place it would work. Any help would be awesome.
    Thanks,
    Matt

    I would caution that, although it is not likely, managers can also be contact, group, or computer objects. If this is possible in your situation, use Get-ADObject in place of Get-ADUser inside the curly braces.
    Also, if you only want users that have a manager assigned, you can use -LDAPFilter "(manager=*)" in the first Get-ADUser.
    Finally, if you want all users that have been assigned the manager for at least one user, you can use:
    Get-ADUser
    -LDAPFilter "(directReports=*)" |
    Select @{N='Manager';E={ (Get-ADUser
    $_.sAMAccountName).Name }}
    -Unique | Sort Manager |
    Export-Csv .\managerList.csv -NoTypeInformation
    This works because when you assign the manager attribute of a user, this assigns the user to the directReports attribute of the manager. The directReports atttribute is multi-valued (an array in essence).
    Again, if managers can be groups or some other class of object (not likely), then use Get-ADObect throughout and identify by distinguishedName instead of sAMAccountName (since contacts don't have sAMAccountName).
    Richard Mueller - MVP Directory Services

  • How do I use my iTunes cards money which is in my account but the payment information won't allow me to use the money

    The payment information i put was none but won't allow me to access the iTunes gift cards money

    As far as I know, your registered location and your credit card information must match... but,
    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • HT3960 My iPhone will not update. it keeps asking me to restore but then says there's an internal error -1. At first it wouldn't update saying there was no SIM Card. This was a used phone that i had the SIM Card replaced

    Got a used iPhone4 to replace my lost one, had the screen replaced and then had the SIM card replaced by Best Buy.
    They had issues in the store connecting to iTunes but the Geek Squad where they wiped it and said all was good.
    Got home to update it and all was good up to the point where i needed to have the phone to work.
    Then it wouldn't recognize there was a SIM card and to restore my phone.
    it comes up now with unable to restore, unknown error -1
    Help please

    Perhaps try the Error 1 or -1 advice from the following document:
    iTunes: Specific update-and-restore error messages and advanced troubleshooting

  • How do I allow an alarm to be set based on a comparison but then NOT aloow the alarm to clear until a button is pressed?

    I have a program that compares DAQ values to a threshold value. If the value surpasses the threshold, an led blinks. The problem is, if the value then goes back below threshold the blinking will stop, as a result of the comparison being False. What I want is to allow the alarm to begin the blinking but not allow it to stop until I press another button, essentially clearing the alarms. I am just flabbergasted at how to accomplish this. Any ideas?

    Attached is an example of what I described.
    If you turn the dial past 5 the LED will turn ON.
    If you turn the dial down (even to 0) the LED will remain ON until you reset the alarm (RESET button).
    If you press RESET while the alarm is active, it will only turn OFF the LED when the value is below 5.
    You can stop the vi by pressing STOP.
    Hope this is what you were looking for..
    enjoy..
    JLV
    Attachments:
    Alarm_Example.vi ‏28 KB

  • Does Firefox use Internet Explorer in any way? When I go to CCleaner to delete history, there are always IE files as well as Firefox, my default browser and I don't use IE. It doesn't make sense to me, but then, I don't know much.

    I don't know what I can add... thanks for any help.

    Firefox itself does not use the IE temporary internet files location, but some plugins will save data to the same place as IE.

Maybe you are looking for

  • I can't open my library

    I get the message 'can't open library because it was created with an older version if iTunes"

  • What version of flash is best for an older xp system with a P4 processor running 1.6 Ghz?

    The system requirements for the current flashplayer is a 2.33 Ghz CPU, I have an older xp system with a P4 processor running 1.6 Ghz? What version of flash should I be running? I am using both IE and Firefox (various versions).

  • Material Despatched Report

    Hi, Is there any Standard Report for Material Des patched on day wise and month wise. Rgs, Priya.

  • External Authentication failed with new key

    I have a card using SCP 01 05. There is 1 keyset(3 keys) with version 01. I have added a new keyset(3 keys as well) with version 02. I run external authentication with keyset version 01 and it passed. I run external authentication with keyset version

  • Safari is going nuts in mavericks

    Since I loaded Mavericks,  Safari has become unuseable.. WIll not load correctly, freezes screens, wont allow form fill in... IN other words, a complete mess. Having to use Chrome to do business... This is a HORRIBLE release of code....