Running subVI in parallel with itself using producer-consumer pattern

I'm using the procuder-consumer pattern to create what I call threads in response to various events much like in Producer Consumer with Event Structure and Queues
I have several physical instruments, and would like to run the exact
same test in parallel on each of the instruments.  I have a subVI
that takes as inputs a VISA resource and a few control references among
other things and then performs the desired experiment.  I have a
separate consumer loop for each physical instrument, with this subVI
inside each consumer loop.
My test VI worked great; each consumer loop was a simple while loop
incrementing a numeric indicator (not using my real subVI above). 
However, my real program can only run one consumer loop at a time much
to my dismay.  Reworking my simple test VI to use a subVI to
increment the indicator rather than just explicitly coding everything
resulted in the same problem: only a single consumer loop ran at a time
(and as I stopped the running loop, another would get a chance to
begin). The subVI in this case was extremely
simple taking only a ref to the indicator and a ref to a boolean to
stop, and incrementing the indicator in a while-loop.
Is there a way around this?  Now that I've spent the time making a
nice subVI to do the entire experiment on on the physical instrument, I
thought it would be fairly trivial to extend this to control multiple
instruments performing the same experiment in parallel.  It seems
only one instance of a given subVI may run at one time.  Is this
true?  If it is indeed true, what other options do I have?  I
have little desire to recode my subVI to manually handle multiple
physical instruments; this would also result in a loss of functionality
as all parallel experiments would run more or less in lock step without
much more complexity.
Thank you.

You need to make your subvi reentrant.  Then it can run several instances at any time with each instance occupying its own unique memory space.  Click on File - VI Properties - Execution, and check the reentry execution checkbox.  Then save the vi.
- tbob
Inventor of the WORM Global

Similar Messages

  • How to change the transmissi​on rate of data flow in producer/ consumer pattern

    Hi All
    I am new to labview and trying to design a application to transfer image data in different rates, that means I can change the transfer rate in the transmission process. In fact,I refer to the the Queue Basic.vi to achieve this function by Changing the delay value of dequeue and enqueue.The program is divided into three parts:
    The first part is the sender in vc used to split and send image data.Data size is 226kb and each time we send a 1kb packet;
    The second is labview rate-change part,use producer/ consumer pattern and queue to transfer data;
    The third one is the receiver in vc,receive data in sequence and synthetic images.
    The entire transfer process is: image data was sent from the sender to producer loop through DLL, then enqueue--dequeue in consumer loop--DLL--receiver.The sleep time in vc sender is equal to the delay value in producer loop and this makes it look like the data generated as in the loop.
    Now this is where my dilemma is:
    When transferring data, if the producer loop and consumer loop delay value are equal(both 20ms), I can see image synthesis at a constant speed and no data lose; if I change the consumer loop delay value and make it greater than the producer delay(one is still 20ms and another is 50ms),that means receive in a lower rate and store data in queue. I can see Elements in Queue
    increase but the image data randomly lost, and the image synthesis speed is not reduced.
    My question is why image data loss and I can't see the image synthesis speed reduced when change the delay value in consumer loop?
    Do anyone know how to solve the problem? Are there any examples I can refer to? Any suggestions are greatly appreciated!
    Attachments:
    image1.JPG ‏56 KB

    thisoldman,
    I don't have '/usr/lib/modules/3.17.3-1-ARCH/build/Documentation/VGA-softcursor.txt' on my file system. Does it contain the info about changing the blinking speed?
    P.S. The other two links I found yet before starting this thread. I only found in them the recommendations about changing "the color and shape of the cursor and turning blinking on/off" (as I mentioned in the original question). Did I miss the info about the blinking speed?
    PPS: I found the vga-softcursor.txt here: https://www.kernel.org/doc/Documentatio … cursor.txt
    But that file doesn't tell about changing the blink rate either.
    Last edited by nbd (2014-11-23 20:55:41)

  • How do I call the subvi in parallel with main VI. Main vi should not wait for the subvi

    I have a subvi which takes the parameters like port name, transmit rate, message to transmit over serial port and Start/stop flag. This subvi calls VISA write vi in a loop continuously, till the Start/Stop flag is false, to write a message to serial port at a mentioned transmit rate. This subvi will be called from another VI. Actual intension is to transmit different messages to different ports continuously and stop them when required. In this senario, please provide solution for below points:
    1. How do I call the subvi in parallel with main VI. Main vi should not wait for the subvi.
    2. How does main vi can control already running subvi in parallel to it. In the above example I would like to start the subvi from main vi when start\stop flag is true and would like to stop it when the flag is false.
    3. How do I call the subVI with one set of parameters from main vi, when same subVI is running with other set of parameters already from main vi(subvi being called in a case with different set of parameters each time when the case is called). Means, how do I keep track of reentrant subvi (different calls to same vi)from the same main vi.

    Hi Dharani24,
    Try if these are helpful,
    http://digital.ni.com/public.nsf/allkb/DB92C44E7D4D8A1B862577CB007D9C45
    http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/asynchronous_vi_calls/
    http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/reentrancy/
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • )How can we schedule the info package daily run at 6 AM, with out useing in

    Hi
       Can any one explain 1) what is information broadcasting &how can we use this.
    2)What are the settings we have to do when we use the charts in WAD's
    3)How can we schedule the info package daily run at 6 AM, with out useing in process chains
    Thanks
    Bharath

    Hi,
      Information broadcaster :
          you can precalculate and distribute(thru mail) the query, workbook and webtemplate through online link or html file to the receipents (users).
    have a look at the below link.
         http://help.sap.com/saphelp_nw04/helpdata/en/3a/0e044017355c0ce10000000a1550b0/frameset.htm
    Infopackage scheduling:
         you can schedule the infopackage daily at your desired time .In the schedule tab ,select the start later in background and in the scheduling option give the date and time and give the period values as daily.
    Regards,
    Siva.

  • Chat between multiple users using producer/consumer

    Hi All,
    I'm working on a chat application between multiple users using producer/consumer in flex(pure flex). But i found that this was basically a broadcast service. How do i make sure that i maintain a private chat between any two users using producer/consumer scenario?

    hi,below i write a code,bold lines are properties to use.
    //producer component
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.messaging.*;
    import mx.messaging.messages.*;
    import mx.messaging.events.*;
    private function sendMessage():void {
    var message:AsyncMessage = new AsyncMessage();
    message.headers = new Array();
    message.headers["prop1"] = 5;
    message.body = input.text;
    producer.send(message);
    ]]>
    </mx:Script>
    <mx:Producer id="producer"
    destination="chat"/>
    <mx:TextInput id="userName"/>
    <mx:TextInput id="input"/>
    <mx:Button label="Send"
    click="sendMessage();"/>
    </mx:Application>
    //consumer component
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="logon();">
    <mx:Script>
    <![CDATA[
    import mx.messaging.*;
    import mx.messaging.messages.*;
    import mx.messaging.events.*;
    private function logon():void {
    consumer.subscribe();
    private function messageHandler(event:MessageEvent):void {
    ta.text += event.message.body + "\n";
    ]]>
    </mx:Script>
    <mx:Consumer id="consumer"
    destination="chat"
    selector="prop1 > 4"
    message="messageHandler(event);"/>
    <mx:TextArea id="ta" width="100%" height="100%"/>
    </mx:Application>

  • Running 2 stepper motors with LabVIEW using RMV ST400-NT controller and driver

    Hello, I am new to programming as well as motors in general so please bare with me in my attempt to explain myself. I have a project involving laser therapy and I am attempting to control two stepper motors from Falhauber, Type AM2224-R3-AV-4.8. I will be using a RMV ST400-NT controller and driver. Original plan was to use 3 stepper motors for control in 3 axis but realized 2 axis is complicated enough. My power source is an Agilent E3630A. I am new to this whole thing and from what I have read form examples and other posts is that NI drivers seem to work best for these applications. I've written simple programs from examples, reading and watching videos. I want to know whether it's possible for these to work together using LabVIEW and also a nudge to help me get started would be much appreciated. Can someone please help guide me in the right direction, I feel a bit lost when it comes to all this. Thank you for your time and consideration.  Also, I will be using Windows 8 laptop with Labview 8.5. I have attached pics of components I will be using.
    Justo T.
    Attachments:
    photo 1.JPG ‏1150 KB
    photo 2.JPG ‏987 KB
    photo 3.JPG ‏1085 KB

    Hi jtarula,
    I want to preface this response by saying that I am mre familiar with NI controller and driver rather than the one that you have. I am assuming that you are using the dll provided by the manufacturer here:
    http://www.rmv.com/download.htm
    With these, you should be able to interface with LabVIEW using the call library function node. What the controller is capable I am uncertain of. I am certain that you should be able to since another user has commented on the use in LabVIEW before in another forum post.
    I also want to let you know that LabVIEW 8.5 is not supported on Windows 8, which means that you may run into some compatibility issues. Here is the compatibility chart.
    Paolo F.
    National Instruments
    Applications Engineer

  • Is it possible to run a subVI in parallel with the caller VI?

    I have a front panel VI which calls numerous subVIs, one or two of which I would like to execute simultaneously with the calling VI. The front panel has time-dependant operations which are being prevented from running because it is waiting for the subVIs to finish, even though no data is required from them.
    Is it possible to call these subVIs such that they run silently in the background allowing the front panel to execute unhindered?
    I've looked at the Synchronisation features but is this what I need?

    shoneill wrote:
    > It's also very important to mention that the whole multi-threaded
    > execution CANNOT be reliably observed in highlighting mode in the
    > LabVIEW development environment. You need to let the VI run
    > full-speed to see this.
    >
    > Highlighting (to the best of my knowledge) forces single-threading, or
    > acts like it does.
    This is simply a convinience by LabVIEW since humans are inherently
    non-multi treaded. What you will see in parallel loops and which can
    still be distracting is that LabVIEW seems to randomly switch between
    different parts of your diagram. In fact this is also what is happening
    in normal execution but the execution switch is so fast (each individual
    operation typically taking microseconds it
    seems they execute in parallel.
    The nice part of LabVIEW since version 2.0 somewhere around 1988 already
    is, that it provides this seemless multithreading on every single
    platform even if the underlaying OS is not multithreading capable at all
    (Win3.1, MacOS).
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Unix master shell script to run jobs in parallel with dependency

    I need a master shell script which would call the following shell scripts as per below order. Kindly note that if any shell script fails then the master shell script should abort.
    Level 1     PRODUCTS
         SP_ROST_DLY_STG_lD
         SP_ROST_DLY_ITG_lD
    After Level 1 completes run below two shell scripts in parallel:
    Level 2     SP_IDL_EDGE_CON_POSTN_STG_Ld ,     SP_IDL_EDGE_ACCT_POSTN_STG_LD
    After Level 2 completes run below shell scripts as per the seqeunce and in parallel:
    Level 3     SP_IDL_EDGE_ACCT_STG_LD ,     SP_IDL_EDGE_CONT_STG_LD
         SP_IDL_EDGE_ACCT_STG_VAL ,     SP_IDL_EDGE_CONT_STG_VAL
         SP_IDL_EDGE_ACCT_ITG_Ld ,     SP_IDL_EDGE_CON_ITG_Ld
    After Level 3 completes run below shell scripts as per the seqeunce and in parallel:
    Level 4     SP_IDL_EDGE_CONT_POSTN_ITG_LD ,     SP_IDL_EDGE_VISITS_LD
         SP_IDL_EDGE_ACCT_POSTN_ITG_LD ,     SP_IDL_EDGE_VISITS_DTL_LD

    can i avoid using set -e and use some other method so that if there is an error in previous job then the next job is not triggered.Sure, but it is ugly.
    The below is not the only way to do this...
    Wrap every place you start another script with:
    $ if ! MYSCRIPT; then
        echo Script MYSCRIPT failed. >&2
        exit 1
    fibut the wrapper for parallel scripts is even worse:
    $ MYSCRIPT &
    $ MYSCRIPT_JOBNO=$!
    $ MYSCRIPT2 &
    $ MYSCRIPT2_JOBNO=$!
    $ MYSCRIPT_STATUS=`wait ${MYSCRIPT_JOBNO}`
    $ if [ ${MYSCRIPT_STATUS} -ne 0 ]; then
        echo Script MYSCRIPT failed. >&2
        exit 1
    fi
    $ MYSCRIPT2_STATUS=`wait ${MYSCRIPT2_JOBNO}`
    $ if [ ${MYSCRIPT2_STATUS} -ne 0 ]; then
        echo Script MYSCRIPT2 failed. >&2
        exit 1
    fi
    ...Now, doesn't a simple 'set -e' look much better?

  • Why does LabView crash when I run it in parallel with a temp/ RH logging probe?

    I am running LabView 6.1 on windows 95. Up till now I have had no problems. However, we recently acquired a Temperature / Humidity probe which plugs into the Com1 port of the computer and logs the data using it's own software. Since then, when the two programs are used together, eventually LabView crashes with the following error message: Failure, 'image.cpp, line 5793.
    Can you tell me why this occurs and what the solution is?

    Taking a shot at this. It could be because the two programs are trying to access the same type of logging program(excel??). Only one link can be active at a time or they crash. Try running it without saving the data and see if it crashes.

  • CPU runs 100% when logging with DAQmx using card 6229

    Hi!
    When I start a logging using DAQmx Analog Input  the computer CPU runs 100%. This causes the problem that the computer locks and the subsequent steps in the program are left without computer CPU recourse. After the logging is compleet, 1750 samples/10 channels at 250Hz, the program runs on, but the loggfile is at that point useles.
    I have instaled LV 7.1.1 and am using DAQ 7.4.
    Anyone that recognizes this problem?
    Regards,
    Idriz 
    Idriz "Minnet" Zogaj, M.Sc. Engineering Physics
    Memory Profesional
    direct: +46 (0) - 734 32 00 10
    http://www.zogaj.se

    Hello Idriz!
    I just wanted to respond here as well so you know that we have read your post on this very forum. Still waiting for an answer from the US and after that I will forward that information to you.
    Regards,
    Jimmie A.
    Applications Engineer, National Instruments
    Regards,
    Jimmie Adolph
    Systems Engineer Manager, National Instruments Northern Region
    Bring Me The Horizon - Sempiternal

  • Whats recommended? Running CSS in parallel with or independent of LD?

    In migrating from Local Directors to CSS, is it recommended to deplot the CSS to be independent of the local directors? We have a proposed design that maintains the Local Directors as part of the solution, and I feel that may not be the best way, and I wanted to post this here and see what the consensus is.

    CSS is a superset of LD. CSS does what LD does and much more. CSS strengths lay in L5-L7 ie. NBAR, Flash Crowd insurance with WebNS, Cookie and URL inspection, and TCP intercetpt & splicing of connections to the best server in the server farm. Yes it can do L2, L3, L4 but there are other Cisco products to do this.
    I agree the inclusion of LD in your new solution limits you to L4 functionality. My own opinion is that a solution is only as good as the "weakest" component. I would go independant of the LD. Perhaps you can redeploy the LD in another part of the LAN?

  • LCDS error when using Producer/Consumer messaging to exchange objects between clients. Please help!!

    Hello,
    I decided to test this with the  publish/subscribe messaging. Something I thought would work is not. Here  is the simple example;
                     var btn:Button = new Button();
                     btn.label = "My Button ";
                     msg = new AsyncMessage();
                    msg.body = btn;
                     producer.send(msg);              
    Simple right? Well, this generates a fault;
    1/21/2011  10:37:55.462 [ERROR] mx.messaging.Producer  'D7094E2F-2CA1-39C0-1EC6-A9DE3171E836' producer fault for  'A11AE369-8349-8970-0C10-A9DE5113DA2E'.
    The LCDS log gets into more detail, AMF Deserialization ERROR....
    Please notice the use of Amf0 and Amf3 methods... I thought Amf0 was a thing of the past...
    Any ideas? Please help....
    [LCDS]01/21/2011 10:37:55.039 [ERROR] [Endpoint.RTMP] Deserialization failed for incoming data: Unknown AMF type '15'.
    flex.messaging.io.UnknownTypeException: Unknown AMF type '15'.
         at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:217)
         at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
         at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:437)
         at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:152)
         at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
         at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:437)
         at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:152)
         at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
         at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:437)
         at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:152)
         at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
         at flex.messaging.messages.AbstractMessage.readExternalBody(AbstractMessage.java:654)
         at flex.messaging.messages.AbstractMessage.readExternal(AbstractMessage.java:324)
         at flex.messaging.messages.AsyncMessage.readExternal(AsyncMessage.java:98)
         at flex.messaging.io.amf.Amf3Input.readExternalizable(Amf3Input.java:491)
         at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:420)
         at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:152)
         at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
         at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:123)
         at flex.messaging.io.amf.Amf0Input.readObject(Amf0Input.java:94)
         at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:227)
         at flex.messaging.io.tcchunk.TCCommand.readMessage(TCCommand.java:191)
         at flex.messaging.endpoints.RTMPConnection.serviceTCMessage(RTMPConnection.java:1024)
         at flex.messaging.endpoints.RTMPConnection.doRead(RTMPConnection.java:610)
         at flex.messaging.endpoints.RTMPProtocolHandler.doRead(RTMPProtocolHandler.java:125)
         at flex.messaging.socketserver.Connection$ConnectionReader.run(Connection.java:864)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
    Thanks,
    Oscar

    See my response in the other thread.

  • Producer consumer loop only execute once?

    Hello here,
    In my VI, the producer loop seems working continuously, but the consumer loop only execute once.
    I haven't used producer/consumer pattern before, could someone give me some ideas why this happens?
    My code is in attachment.
    Thank you in advance.
    Yaqiong
    Solved!
    Go to Solution.
    Attachments:
    parallel - Copy.vi ‏72 KB

    That would be the poor choice of using an event structure in the consumer loop.  As set up you must generate a mouse Leave or mouse enter event on Waveform Graph for the consumer loop to finish its first iteration. 
    Delete the event structure.  you don't need it to update a graph.
    Jeff

  • Error while reporting in parallel with ETL run!!!

    Hi All,
    It has been observed that when report is run in parallel with ETL, Report fails with following error:
    Error during SQL execution: (DA0003)
    Exception: DBD, ORA-12842: Cursor invalidated during parallel execution State: N/A
    Please let know if we can run report in parallel with ETL.

    Hi,
    thats correct. You should first load your DWH via ETL and then report off it.
    Regards
    -Seb.

  • Timed loop running parallel with Queues

    I was wondering if it is possible to have a Producer/Consumer Pattern with a timed loop that is not just executed when it is called by the queue or from the Producer Loop, but also executes the timeout after a given time.
    Thanks in advance, Oliver
    Attachments:
    example.png ‏42 KB

    lol
    thank you Norbert great advice
    I was so focused on wanting to use a Timed Loop that I totally forgot about the dequeue TimeOut
    cheers Olli

Maybe you are looking for

  • How to store word document in SAP

    Hi Friends,      How to store and retrive word document in SAP? Thanks & Regards, Vallamuthu.M

  • How to invert order of images in CS4?

    hello I got a range of frames, starting -130 to zero . When played, its like my animation plays backwards. How to invert the order of the images? zero to 160 plays fine. thanks for your time.

  • Student license for commercial use?

    Hi, Can i use Creative Cloud with student license for commercial work?

  • IPhone 6 Health App not tracking anything

    I was hoping 8.1 would fix the Health app, but it's still not working for me. It doesn't track any steps.  When I restart the app my dashboard is reset to empty and I have to add things back on the Dashboard. Is anyone else experiencing similar issue

  • Deleting Server Cache in Oracle Weblogic Integration...

    Hi All, I just hope I am posting at the right place. If not, please redirect me... I am using Weblogic Integration and now I need to deploy all my work on por production environment. While working in the local env, I used to delete .wlnotdelete and o