Dataflow problem, queuing in subvi dequeuing in main vi

ive stuck on a very simple data flow problem here, I'd like to pass data being enqueue in the subvi and dequeue in the main vi consumer loop. Ive attached the vi, since im already stuck on this problem, i was hoping i could learn a few things, specially implementing action engine in this situation  
thanks.
Solved!
Go to Solution.
Attachments:
Counter Main.vi ‏16 KB
counter subvi.vi ‏11 KB

Your subVI doesn't make any sense since your loop will always exit after the first iteration and you always initialize your counter to 0 every time you execute it. That is one issue.
Your code also suffers from multiple places that are dequeueing data from the queue. You will get undeterministic behavior since you don't know which dequeue will get the data first. Generally for a producer/consumer architecture using queues one or more loops loops should be enqueueing data to the queue. One and only one loop should be dequeueing data. These loops shuold run in parallel to each other. In your code you will only run your subVI whenever you press the start button and as stated you will always post a value of 1 to the queue. What you would need to do is have your subVI run independently once it is started. Use the "Start Asychronous CAll" to start your subVI when the Start button is presed and then let it simply run. Have it post the counter to the queue. Your lower loop in the main VI should dequeue the values and display them. You do not need the Wait in that lower loop since that is the purpose of the dequeue. That loop will be idle if there is no data present and will only run when data is in the queue.
In the upper loop of your main VI remove the dequeue and enqueue. You don't need them since the subVI is all that is needed to post the data to the queue.
Try this:
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • Open differents subvis on own main vi.... is it possible?

    Hi Guys,
    I have a litle dude.
    I have a very good application and works well,  i have main vi, it takes differents bottoms to open subvis with differents options or applications, but the problem is when i do the executable file, on xp open 2 files on the tab. One of them is named like exe file, and the another is the name of main file vi. And when i open any subvi, i can see the 2 windows openned.
    I am asking myself if is it possible open the differents subvis on the main vi. Therefore, will open the differents subvis and when close the subvi, will come back to the main vi with the bottoms...
    Only improving... I hope to see any example to do it...
    Regards and thanks for the advises, Fonsi.

    I'm not sure I understand your question perfectly, but if you want to open a window so that you can't access other LV windows at the same time, go to File>>VI Properties>>Window Appearance>>Custom and make it modal. That way, it will stay on top until you close it.
    Another option of having all of them in the same window is calling all the VIs dynamically in a subpanel, but that will probably be more complicated than you like. You can search the LV user manual or help for "subpanel" to find out more.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Stream data from a subvi to the main vi - path refnum

    hello everyone
    sorry my english
    http://forums.ni.com/t5/LabVIEW/stream-data-from-a-subvi-to-the-main-vi/m-p/2205150/highlight/true#M...
    - refnum boolean worked
    - refnum graph worked
    - refnum numeric worked
    how to create a  path refnum? stream data from a subvi to the main vi
    where do I start?
    thank
    Solved!
    Go to Solution.

    Bom Dia Saille,
    Eu acredito que o que você tenha hoje seja isso aqui (Desenho bem simplificado):
    Hoje o que você tem é o Aplicativo do Medidor + USB Driver controlando o seu medidor. Basicamente, sua aplciação está dividida em três camadas:
    Aplicação - Onde estão as funcionalidades principais do programa (interface com o usuário, apresentação de dados, geração de arquivos, etc.)
    VISA - Uma arquitetura de Software para controle de instrumentos. Basicamente, ele se comunica com o Driver USB para poder enviar e receber pacotes de dados através do barramento USB.
    Device Driver - Intruções de SW de baixo nível para controlar um periférico através de um barramento.
    No desenho, eu aponto duas camadas onde você pode tentar atuar para automatizar suas medições:
    Aplicação - Você pode usar o VI Server para controlar o Aplicativo do Medidor (Se este aplicativo tiver sido desenvolvido em LabVIEW, o que eu suponho ser verdade). No entanto é necessário saber se o desenvolvedor do produto permitiu isso (Veja Using VI Server to Pass Data Between a VI and a LabVIEW Executable). Outra alternativa é conversar com o fabricante para ver se ele desenvolveu alguma API (Application Programming Interface) para que você consiga controlar o instrumento diretamente.
    VISA - O LabVIEW Fornece uma API chamada NI-VISA para poder enviar e receber informações através de diversos barramentos (Veja Serial Instrument Control Tutorial)
    É possível acessar o Driver diretamente também, mas eu não recomendo. O resultado não compensa o esfroço!
    Espero ter esclarecido suas dúvidas e espero que você tenha sucesso na sua aplicação!!
    Atenciosamente.
    Felipe Flores
    Engenharia de Aplicações
    National Instruments Brasil

  • Show graph that is created in a subVI in the main vi

    Hi Everyone
    I can not, show graph that is created in a subVI in the main vi.
    help!
    Thank you
    Solved!
    Go to Solution.
    Attachments:
    Sub VI.jpg ‏58 KB

    Thank you very much
    Where am I going wrong?
    Is this possible?
    http://forums.ni.com/t5/LabVIEW/show-graph-that-is-created-in-a-subvi/td-p/672249 - solution
    Thank you again, and sorry my english
    Attachments:
    Sub VI.jpg ‏237 KB
    Main VI.jpg ‏177 KB

  • Generating Event with Subvi Control on Main Vi

    We are creating a code in which on pressing set up button( present on main vi front panel ) we are calling one subvi as pop up window which further contains some boolean controls and every boolean control has further one subvi associated with it, when we press on that button a window comes that has several numeric and string control, what we want is after entering all values on numeric and string control and after pressing ok button, these val;ues should get updated to the sequence list present on main vi front panel, i have tried to do this using queue but what we want is that on pressing ok button( present inside subvi) we need to generate a event on main vi that it should dequeue elements to the list only when that ok button is pressed, i have tried to do it using value signalling property node but this is not working, i am not getting how to do this or there if there is any other better way to do this
    I have attached the code for reference.
    Attachments:
    Automation.lvproj ‏9 KB

    A better way to do this would be to enqueue the state that the event case is calling from the instrument state.  Then you don't have to poll the global variable and worry about signaling the event.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    queue up state.PNG ‏9 KB

  • SubVI's in Main VI

    I am new to this group and relatively new to labview, so forgive me if this
    is a repeat post.
    My question is sort of similar to the "duplication of controls" post
    5/9/200. I have two kinds of subVI's that I want to use in a third main VI.
    The two subVI's are for analog input and output and have associated
    indicators and controls respectively. I want to use these in a third main
    VI. My problem is this. I want the controls and indicators that I have
    fashioned for the subVI's to appear in the main VI front panel and as of yet
    I have not been able to get this to happen. Futher, the only way that I can
    get the VI to work is to wire a "duplicate" control on the main VI diagram
    (but this does not take the form that I have fashioned for it in
    the subVI.
    Also, I was using the AO or AI single point aquistion VI with a while loop
    and global logical variable to start/stop all subVI's in the main VI. It is
    hoped that we can do this to avoid using a while loop in the main VI to
    start stop the main vi and the associated subVI's. Is this the most logical
    way to go about his or should I use continuous AO and AI blocks in the
    subVI's.
    I hope that this has not been too confusing. Thanks in advance for any help.
    Jeffrey Nesiba
    NESAC/Bio Assistant
    Chemical Engineering
    Work (206) 543-8073
    Home (206) 324-2472 (206) 320-0401
    [email protected]

    Thanks for all the help. As far as the second part of the question goes:
    "Also, I was using the AO or AI single point aquistion VI with a while loop
    and global logical variable to start/stop all subVI's in the main VI. It is
    hoped that we can do this to avoid using a while loop in the main VI to
    start stop the main vi and the associated subVI's. Is this the most logical
    way to go about his or should I use continuous AO and AI blocks in the
    subVI's."
    I was still wondering if the route I have taken (AO or AI single point
    aquistion VI within a while loop
    and global logical variable to start/stop all subVI's in the main VI) is the
    most logical. Or should I use a continuos AO/AI blocks. The end use is for a
    simple process control mockup for a chemical engineering process control
    class, so computing cycles are not a big issue if that may be concern.
    Finally, I have in the past I have done what Kevin Kent suggested. The
    problem with this is that the controls and indicators that I have fashioned
    for the subVIs don't show up on the front panel on the main VI, rather it is
    the control and indicators that I have just created by following KBK's
    procedure. I/my professor would rather the student be able to use these
    subVIs on a blank diagram and be able to connect them and use them without
    having to delve to deep in to Labview (as they will have little or no prior
    experience using labview). Having the VI/subVI use a preararnged
    control/indicator would allow them to get started a little quicker with
    process control rather than tackle labviews learning curve. Is there a way
    of doing this that I have not discovered? Thanks again for suggestions and
    help.
    Jeff
    Kevin B. Kent wrote in message
    news:[email protected]...
    > "Jeffrey L. Nesiba" wrote:
    >
    > > I am new to this group and relatively new to labview, so forgive me if
    this
    > > is a repeat post.
    > >
    > > My question is sort of similar to the "duplication of controls" post
    > > 5/9/200. I have two kinds of subVI's that I want to use in a third main
    VI.
    > > The two subVI's are for analog input and output and have associated
    > > indicators and controls respectively. I want to use these in a third
    main
    > > VI. My problem is this. I want the controls and indicators that I have
    > > fashioned for the subVI's to appear in the main VI front panel and as of
    yet
    > > I have not been able to get this to happen. Futher, the only way that I
    can
    > > get the VI to work is to wire a "duplicate" control on the main VI
    diagram
    > > (but this does not take the form that I have fashioned for it in the
    subVI.
    >
    > Create your 2 SubVIs (as you already have) , make sure you wire the
    > controls and indicators to the terminals (right click on the icon of the
    > front panel, select show connector, use the wire tool, click on the
    > control / indictor, click on the terminal to use). Open a new vi
    > drop the 2 subvis on the diagram. Right click on the terminals of the
    > subvi and select Create control (or indicator) . This will create a
    duplicate
    > of the control / indicator on the front panel of the main VI .
    >
    > You will have to move them around to suit your needs.
    > Kevin Kent
    >

  • Problem with activation subVI

    Hello everybody!!!
    Who tells me, why the subVi doesn't start pushing  ok botton??
    Thanks a lot!!!!
    Solved!
    Go to Solution.
    Attachments:
    problem.jpg ‏187 KB

    Because the VI isn't running.
    What are you trying to do here?  Is that VI a main VI?  If so, then the OK button makes no sense at all.  I would also highly recommend hitting the diagram cleanup since it is really hard to tell what is wired to what.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • JMS and advanced Queues - how to dequeue?

    Hi,
    I've recently built a MDB that listens to an Oracle Queue (9.0.4) via JMS . Everything works fine, the only thing is that the rows that have been enqueued are not deleted (dequeued) from the queue table once the MDB has picked them up.
    This only causes a problem when the database re-starts as the MDB picks up all the messages again. And also is a problem as the table will keep growing with all the messages.
    Can you tell me what I should do to dequeue the messages? Should this be a trigger of some sort or is there something I can do from within the bean to dequeue the message once it has been consumed? Or is there another way of handling this?
    Appreciate your help.
    Cheers.

    Hello,
    Great! I need that solution :)
    Can you point out how you connected the MDB to the AQ? What software or adapter did you use?
    I have the vice versa problem.
    The MDB always deletes the message in the queue table, but a rollback never works.
    Did you enable transactions by the following settings in ejb-jar.xml:
    <container-transaction >
    <method >
    <ejb-name>MyMdb</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    I use BEA to deploy the MDB and Dips xa-compliant StartupClass package to register the AQ Connection Factory to in the JNDI tree.
    Regards
    Thomas

  • Multiple subvi's in main front panel

    Hello and welcome (it is my first post here),
    sorry if such subject was already risen, however I don't know how to specify it exactly in terms of LV nomenclature (I'm a beginner in LV) what makes it quite difficult to search the forum.
    I need to create an interface with user specified number of input channels (specified during application work, so dynamic loading is necessary). Each channel is to be controlled by subVI. I'd like to load panels of all running input subVI's into some container in a main front panel (similarly to subpanel, but loading multiple VI, not single one). Is there a container capable of this? Is it at all possible in LV?
    Regards,
    kaolpr
    Solved!
    Go to Solution.

    You can use multiple subpanels. Unfortunately the number of subpanels must be set during development. You could create a method of cycling through your various channels. This would involve loading and unloading the multiple subpanels that you do include in the UI.
    Another alternative would be to use a table or something similar. Have your subVIs post updates to the UI code via queues, notifiers or user events. Tables are much easier to manage when your number of elements varies. If you need to have the UI pass information to the subVIs it can also use queues, notifiers or user events.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Multiple SubVI display onto main VI

    Hi everyone,
    Probably a really simple solution to this problem:
    I have 6 SubVI's that I want to use on one main VI, no problem, but I would like to display all 6 SubVI front panel display onto this one main VI. Hope this makes sense!
    I looked at SubPanels and tried to add more VI's to it but it only displayed a single one.
    Any help would be great
    Thanks

    Hi Intel;
    My application had similar GUI requirements, but unfortunately, there is only so much GUI space!  Here are a couple of options that you can use:
    (1) Break up the GUI using splitter bars (if you are using LabVIEW 8.0 or later) and place several subpanels, or forget the splitter bar and simply place several subpanels on the same GUI; or...
    (2) Use a TAB structure, and place a different subpanel in each tab (i.e. if you have 6 subpanels, then use 6 tabs each containing a subpanel); or...
    (3) You can use a single subpanel, and depending on which sub-vi is required to be active, you can write some code to "unload" the existing sub-VI and then "load" the new one.  This is the only way (I am aware of) to have a single subpanel reference multiple VIs.
    Hope this gives you some ideas.  I make use of all three methods in a single program, for example.
    DJH

  • Advanced Queuing for Oracle / Dequeue failed

    Hi *,
    I'm using Oracle Advanced Queuing and OC4J with some MDBs. Unfortunately sometimes I have following exception:
    03-05-21 10:29 Error listening to 'USER_QUEUE'
    oracle.jms.AQjmsException: JMS-120: Dequeue failed
         at oracle.jms.AQjmsError.throwEx(AQjmsError.java:283)
         at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:2034)
         at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:981)
         at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:918)
         at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:834)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:905)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
         at java.lang.Thread.run(Thread.java:479)
    All messages hang in my queue with READY state. I really don't know what is happening.
    I have observed that when I run my MDB, but on the different machine, one message is consumed and the same exception arises.
    Why Oracle cannot run dequeue process correctly?
    best regards
    Maciek

    We had similar problems. Mostly the cause was incorrect message type (other than AQ$_JMS..., i. e. ancestor of "message" class) or incorrectly filled body of a message. For example, there seems to be a bug in AQ$_JMS_TEXT_MESSAGE object: you have to set at least one of varchar2 or CLOB in body of message. Otherwise, dequeue will fail, JMS assumes there is some text inside.
    We are using 8i and 9i databases and messages are created using plain constructors (not methods from 9i, since code has to run on either version). I cannot recall any troubles using methods from 9i during researching, but there might be a bug somewhere.
    Myrra

  • Clear chart in subvi from the main vi

    Hi all,
    im not sure if this has been solved before but my problem is, is there a easier method if i create a subvi containing a waveform chart and i want to clear the data in the chart after each run so that new values from the main vi can be plotted without the previous data plot. I placed the "history data" property node and wired it to an empty array in the subvi but when i ran the program, the graph doesnt plot at all..
    Regards
    Adrian

    hmm ii'll try using the invoke property method.
    Appreciate and thanks for the help guys!
    Attachments:
    Computerscreen.vi ‏18 KB
    trialanderror2.vi ‏35 KB

  • Problem running duplicate SubVIs

    I have a SubVI that I want the user to be able to launch (up to) 4 separate instances of.  It's a small grouping of indicators that represent possible error conditions for 4 separate but identical sections of the hardware being monitored.
    To accomplish this, I set up the following code:
    I need the indicators that are in the SubVI to be updated even when the user isn't looking at them (because there is separate history tracking going on), so as you can see above, I make 4 (nearly) identical calls to run the VI, then in an event structure, when the user clicks on the control associated with each section, it executes the FP.Open command for that particular VI's reference.
    When I executed this, the only one that will open is the first one (vertically), the one that's set to the base address of 10000.  I presume this is because it's the fist reference that runs when the main program executes.
    So then I went and edited the properties for the SubVI to set its reentrant execution to "preallocated clone reentrant execution", but this made no difference.
    Any thoughts on how to solve this problem?  thanks in advance

    I thought I was pretty clear by calling the function the Open VI Reference.  That is its name after all.
    Here's what I am suggesting.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Initalize Reentrant Calls.png ‏24 KB

  • Subvi Loading when Main application is opened

    Hello, I have a main application which I would like to sometimes launch a subvi which adds some additional calculations. My problem is that when I load the main application, the subvi loads aswell. I can close it and then it works fine to open and close etc. I have unchecked all the subvinode setup attributes as well as the vi proporties but this does not seem to change things. I have attached a pic of the vi hierarchy and the subroutine shows a red highlighted thread from the main application, not sure what this means. Any help would be appreciated!!
    Attachments:
    Hierarchy.jpg ‏270 KB

    Hi, I have attached a back panel view of the Vi and it's properties, the subvi which I am trying to load is in the case structure. These are the current settings I am using and now it seems to not open the subi when it loads but now another problem. If I use the boolean control to open the vi it trys to open but sits underneath the main vi and does not respond to any actions. Everything works great until I build the application then it goes wonky!!
    Attachments:
    Vi and Properties.jpg ‏449 KB

  • Problem with 2 tables nodes in MAIN window in smartforms...

    Hello Experts,
    I have created 2 table nodes in my MAIN window to display data coming from different internal tables.
    Now, the problem is that whenever the 1st table node page breaks, the 2nd table node gets affected
    and it also page breaks. What I want is that the 2nd table must finish displaying certain number of records
    before the page break of the 1st table node takes effect.
    For example, I want to display 10 records for both table nodes 1 and 2. So I created an event in
    table node 1 that if it is 10 records or more, then it will go to the next page. So in effect, my table
    2 node did not print any records at all in the 1st page and it only started printing its first record in page 2.
    How do I print 10 records also in table node 2 before it page breaks?

    Hi,
    It's simple,
    Pre- U should had declared a second page for the same window with header, main & footer.
    now
    First when u r looping the internal table provide no of rows eg Row 1 TO 10. in the Loop ( Data Tab)
    or
    when defing TEXT Go to PC Editor and mention all the fields Under  PROTECT -  ENDPROTECT.
    This would solve the issue.
    Thanks
    Ravi

Maybe you are looking for