Several producers an consumers

Hello, I am developing an application where they are drawn at different speeds and different processes, but I want to store it in a file, to store this data I can, if I have several producers and a consumer?

Seems easy enough-if you use a queue!

There is a pretty good example called queue multiplexer provided with LabVIEW and collect data from several producers.

Tags: NI Software

Similar Questions

  • Several producers response queue

    In my application, I'm working on an API that is the queue of conduit. Several different parts of the code can send a 'command' and wait for a response.  Obviously if two separate sections of code send a different command roughly at the same time, we have a race condition for the response queue.

    I have many ideas on how to solve this problem (action engine response, get an overview of the queue and search data appropriate, semaphores), but I wonder if there is a ' standard method / best practices "to do.  I have not run into this problem before.  So far, I'm leaning towards semaphores - it seems the simplest solution.  Here's a mockup I did as a proof of concept.

    BowenM wrote:

    Certainly, there is nothing to say that the response must be a queue. I could use a variable overall, functional overall, etc.  The queue was just for the convention, and I freely admit that it is a 'bad' use of a queue. The problem is always the same: how to make data from a producer for many consumers without having a convoluted solution heavy.

    Well, if you do not want to incorporate the queue back into the message and then use a non-reentrant VI is the only access to send commands to your consumers.  This VI would send the command and wait for an answer.  Since the VI is not reentrant, it blocks the other loops until the answer is back.  It's much cleaner and probably faster, than the use of the semaphore.

  • is it possible to run several producers of film at a time?

    I use movie maker to restore and snap together large amounts of clips in a single movie that I then post on youtube.

    Do walkthroughs of games so I have a lot of work to do there, and I was wondering if I have a video editing or is it being published can run another instance of Movie maker and work on another video to increase my ability to output videos?

    I don't think you can have two of the same movie maker, but on my Win7 machine, I have Windows Live Movie Maker and Windows Movie Maker 2.6 installed.

    Windows Live Movie Maker 2011
    http://explore.live.com/Windows-Live-Movie-Maker?OS=other

    Windows Movie Maker 2.6
    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=d6ba5972-328e-4df7-8f9d-068fc0f80cfc&displaylang=en

  • JSR 286 Interop: open the producers and consumers of Weblogic Portal

    Hello

    I'm trying to consume Open Portal 2.0 (JSR 286) producer on Weblogic 10.3.2 consumer.

    Question: On the consumer, the images are broken.


    Here's what I have on the producer:

    JSR 286 Portlet on Open portlet
    ---------------------
    public class InvoicePortlet extends GenericPortlet {
    
         public void doView(RenderRequest request, RenderResponse response)
                   throws PortletException, IOException {
    
              response.setContentType("text/html");
              PortletRequestDispatcher dispatcher = getPortletContext()
                        .getRequestDispatcher("/WEB-INF/jsp/sample.jsp");
              dispatcher.include(request, response);
    
         }
    }
    Sample.jsp
    --------------------
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.portlet.*"%>
    <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
    <portlet:defineObjects />
    
    Image 1: <img src='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/ico_normal.jpg")%>'/>
    <br/>
    
    <%
    ResourceURL resURL = renderResponse.createResourceURL();
    resURL.setResourceID("ico_normal.jpg");
    %>
    
    Image 2:<img src='<%= resURL.toString()%>'/>
    Please note the image in jsp sitting directly under WebContent and gets rendered as straight as a local portlet.
    Image1: http://localhost:7001/SecureProducer/resource/cs__pageLabel%3Dtest_portal_page_2_page_3%26_portlet.portalUrl%3D%252FSecureProducer%252Fconsumer%252Ftest.portal%26_st%3D%26_windowLabel%3DhelloWorldPortletInvoicePortletMINE_1/u_http%3A%2F%2Flocalhost%3A8080%2FhelloWorldPortlet%2Fico_normal.jpg/id_/rr_false/po_/rs_/rc_/iu_{oracle:immutableURI}/*wsrp*separator{oracle:mutableURI};jsessionid=Y1lnM27Zk68ZQ86sBvG19Js9vcncmGTR8s5WStcLQtS448nZ2fQT!-1164873313?{oracle:mutableParameters}
    Image2:
    http://localhost:7001/SecureProducer/resource/cs__pageLabel%3Dtest_portal_page_2_page_3%26_portlet.portalUrl%3D%252FSecureProducer%252Fconsumer%252Ftest.portal%26_st%3D%26_windowLabel%3DhelloWorldPortletInvoicePortletMINE_1/u_/id_ico_normal.jpg/rr_/po_/rs_/rc_cacheLevelPage/iu_{oracle:immutableURI}/*wsrp*separator{oracle:mutableURI};jsessionid=Y1lnM27Zk68ZQ86sBvG19Js9vcncmGTR8s5WStcLQtS448nZ2fQT!-1164873313?{oracle:mutableParameters}
    Image1 reports directly on the producer. But none of these images go directly on to the consumer.

    Of course, this looks more like encoding problem. In particular, the section "oracle: mutal."

    Here's the disclaimer on the console:
    <Dec 1, 2010 11:45:03 AM EST> <Warning> <WSRP-Consumer> <BEA-420727> <The requested URL [{oracle:immutableURI}%7Boracle:mutableURI%7D?{oracle:mutableParameters}] is malformed.>

    Hello

    The only thing I can see wrong with the URL probably still after you change models, is that the URL of the image on the producer is also simply stated ' / id_ico_normal.jpg '-there is no context path / webapp on the URL path. Are always explicitly including the path of the context during the generation of the URL?

    In the generated URL, the path of the resource on the producer is everything after the "/ u_" and before the "/ rr_"-If you can get that to be the correct relative path on the producer, I bet it will work. If the image of the full path to the producer is really "/ id_ico_normal.jpg" then I don't see what else could be wrong at the moment.

    Kevin

  • execution/multithreading helps

    I'm analyzing a data under labview professional 2d table updates data at 20 Hz or more.  I'd like to run both a 'short' (operations of addition may be 500) calculation and a long (maybe 0, 5-1 sec processing time?) calculation, with the short a update ~ 10 Hz and the update has been done for a long time a whenever it ends.  What is the best way to get this kind of thing in labview?

    ... of calibration routines that both loops of consumer depend on for their calculations.  These routines must be performed when the user pushes a button in the user interface.  What is the best way to coordinate access to these?

    Use several producers, one to add data to consumers, one to insert the calibration information.

    You will need make the data type for the queue a cluster. One of the elements to set the type of function, the other to add information given or cal.

    Attached example...

  • A time-out of the finite queue of wiring allows parallelism?

    I have several loops (11) all running in parallel, set up with a producer--> several consumer-> multiple consumer architecture.

    In each of the loops of consumer, I wired the values of time-out on the order of 1 second each of the vi "remove item" which feed on each loop. However, the overall performance of all vi is very slugish.  I have no expectation s vi in the loops of consumer, I guess the time queue supports this feature and allows labview to work its magic of parallelism. This hypothesis is correct?

    For what it's worth, the loop of the producer bed synchronously large shared memory double paintings representing the acquired data and post processed in RT through virtualization (hypervisor). The loop of producer implements an element of expectation. This loop of producer distributes the data to the various queues, depending on the data type meta code embedded in the data of recevied. Then, first consumer level loops review data, update some PLC tags accordingly (via the datasocket connection) and, under certain conditions, send signals well formatted the next level consumer loops that manages storage PDM.

    Each consumer has a dedicated queue and each of them are powered by several producers to the top of the pipe. I put vi waiting in each loop of consumer with a value of about half of the time waiting for data to arrive, and it did not help at all. However, the problem has been resolved by configuring the properties of execution of almost all under vi as priority of subroutine, returning with dedicated allocation of memory. I know it's basic stuff that I should have checked before hand, but everything works fine now.

    Thanks for the help anyway!

  • What is the fastest method producer consumer. Queue, RT-FIFO, event

    Hi all

    Another question completed for the pro:

    I recently inherited the labview code that uses RT-FIFO for the transfer mechanism in the architecture of the producer consumer.

    The code was first written in 3-4 years and is currently in LV8.6. It is possible that the reasons for the architectural decision no longer exists.

    I am qualified using a producer consumer queued architecture,

    I understand the RT-FIFO Architecture.

    I started using an architecture based on events from the user.

    (I have attached samples of each)

    I also see the existence of a priority queue

    Each method has its own capabilities and gaps, that hand, nobody knows the relative performance of each method.

    (Assuming that the only process)

    I would expect RT-FIFO to be faster, there seems to be a version of low characteristic of a standard queue.

    What is the perfornace hit to use a coding user-friendly queue more

    RT-FIFO description talks about commications between the time-critical and lower priority threads.

    Until today, I thought that the queues had the same capacity.

    I've included an event method that I commonly use for review by peers and help from other users...

    It allows to:

    1. several producers with different types of data

    2. process 37 production order.

    3 allows asynchronous verification of functional notifiers such as stop, start and abort.

    4. in a system not real-time, it can include interactions of façade.

    What I do not understand on this subject, that's what are overhead or thread priority changes that may occur using this architecture (it solves a lot of problems for me).

    Thanks in advance,

    Hi Timmar,

    Here's a KB article on some frequently asked questions about the RT FIFO: http://digital.ni.com/public.nsf/allkb/7AE7075AF1B2C58486256AED006A029F?OpenDocument

    The more relevant question is #4, I posted below.

    What is the difference between RT FIFO and queues? 
    Functionally, RT FIFO and LabVIEW queues are two pads of first in, first out. However, here are the main differences between them:

    • RT FIFOs run deterministically in LabVIEW and evanescent code queues are not. This comes from the fact that queues use block calls during read/write to the resource shared, while RT FIFOs use non-blocking calls.
    • RT FIFO are fixed size while queues develop when items are added to them.
    • RT FIFOs will execute the code, even if there are input errors. They can (and will) produce new errors and spread the existing errors.
    • Queues work with any type of data, while the data types that can be used with RT FIFOs are limited. Generally any type of data involving allocations of extra memory can be used with RT FIFOs to preserve determinism.

    Let us know if you have persistent questions!

    Ryan

  • How to change the frequency of sampling DAQmx during execution?

    Hello guys. I'm using LabVIEW in the measures of the frequency response function. My application requires the sampling rate to change according to the frequency of the signal during execution.

    I tried to do it with a "structure of the event" and it works well when I change the rate manually via the front control but it backs do not work when I set up the sampling frequency to vary automatically (just a frequency sweep). Photos below:

    Why not the structure of the event feels the change in the value of "rate"?

    Thanks in advance for your help.

    Lucas

    Hello

    In "automatic mode" to change the sampling rate, the calculated rate is written in the local variable (as illustrated in the code).  Structure of the event does not change value in the local variable as an event.

    In order to make the structure of the event to recognize the change in value of an indicator such as event: write the new value to the property "Value (Sgnl)" corrosponding node to rate indicator (see figure below).  This will make the structure of the event accept the value change in the indicator as event.

    Note: Use architectures such as producers and consumers for such applications, which makes the application readable and expandable.

    See rear queries if any.

  • Multiple copies of the functional global using vi references

    I have several producers acquisition in a global operation (a functional overall by the producer). These functional overall are identical except for the name. He would work to have only one functional global VI and get a separate reference for each producer? The corresponding consumer would have also used the appropriate reference to consume the data.

    The functional global contains an array of data that must be analyzed by the consumer. It is possible that the data table does not contain a complete set of data on a unique "store" by the producer operation. Of course, the consumer, is written to search for a complete data record before completing the processing of the file.

    Les__Bartel wrote:

    TST wrote:

    No matter that there is a better way, the answer to the question is Yes. The FGV must be reentrant and the reference you open must be re-entrant too and then you can use the CBR node to run the specific copy of the FGV.

    I thought that a reentrant vi would not maintain the State of the shift register not initialized by one call to the other.

    A reentrant VI will maintain the State of its shift uninitialized registers.  However, you must be very careful, how to do this.  You first need to make sure that it is set to allocate Clones.  What will happen in this situation, it is that each different place call you this sub - VI each will be a different clone.  This means that each call will have its own data.  The problem with this is that you cannot share the data between multiple instances and therefore multiple loops.  If you don't believe me, go play with mean it Point by Point VI.

    So what happens if you assign shared clones?  A big freakin mess '.  You will have no control over which clone called where, and there will be a major data corruption.

    This is why FGVs are almost always not reentrant.

  • Execution of sequential operations to parallel groups of Threads

    I have the following scenario, which must be changed as soon as possible:
    1. a group of sequential threads runs (contains 3-wire)
    2. a sequential group of other threads is running (contains 2-wire)
    3. a group of parallel threads is running (contains 9 wires such as producers and consumers of threads applied properly)

    Why I created this scenario?
    To run a particular thread first (point-1: containing 3-wire), after their treatment is done I needed to run another 2-wire (point-2: containing 2 wires). If and only if 1 and 2 points are covered, I required to deal with-3 points.

    Initially, I required to run all threads for parallel operations, but I left this idea that parallel threads are run simultaneously.

    For the situation described above everything works smoothly until there was a problem.

    Why do I need to change the above scenario?
    Sometimes, I get an Exception that can be handled well in the case of parallel threads. While the same Exception if I get in the sequential threads that becomes unmanageable. Since then, all other sequential treatments of threads comes under condition of waiting until the end of the first.


    So, I need to take advantage of the parallel threads, but I chose this path to be easy which became difficult to handle the situation for the application.
    So, I need to create such a scenario, in which I need to run different parallel threads for a fixed order. For example:
    Order-1 = process the first 3 parallel threads
    Order-2e = process 2 parallel threads
    Order-3e = process the next 9 parallel threads

    Also, the above case is somewhat limited, although I need a generic solution for this. As if in the future, I want to add more than 2-wire command-1 or if I remove still some discussions for any order must be execution of the sequence of groups as you want.
    Is it possible in java through which we can make a group of parallel threads that can be executed to order we can specify?

    I have the code snippet following, if you can help me to change:

    Level-1

    [] Thread = Thread [list1.size (new)];
    int j = 0;
    {for (List1.Size ())}
    Object delegator1 = new Object("Level-1");
    Thread th = new Thread (delegator1);
    discussions [j] = th;
    Th.Start ();

    j ++ ;
    }
    for (thread Threading: thread) {}
    thread. Join();
    }

    Level-2

    son = new Thread [list2.size ()];
    j = 0;
    {for (List2.Size ())}
    Object delegator2 = new Object("Level-2");
    Thread th = new Thread (delegator2);
    discussions [j] = th;
    Th.Start ();

    j ++ ;
    }
    for (thread Threading: thread) {}
    thread. Join();
    }

    Level 3 & 4-> producer-consumer applied using wait-notify works very well.

    {for(list3.) Size())}
    Object delegator3 = new Object ("level 3 & 4")
    Thread th = new Thread (delegator3);
    Th.Start ();
    }

    I want these different levels to run at the same time but if first level finishes off the second level must eventually runs.

    Published by: 990484 on February 26, 2013 09:45

    If you just want to wait for a set of threads end, for example, use a CountDownLatch in the main thread, initialized to the number of threads. The main thread waits then each thread to complete and to warn the latch.

    Repeat for the next series.

  • Moving Consumer and Producer to the test environment.

    Hello

    Move when the consumer and the producer WLP 9.2.1 applications from DEV environment for the test environment what are the steps that we must do in order to get all the Federated pages/books/portlets of consumption of the test environment? We using the same hostname in dev and test environment, simply by changing the ip address of the host in the backend.

    Is that all we have to takecare specifically when we spread?

    Thanks in advance
    Rajesh

    Hello Renon,

    For option 2, I believe that the steps would be:

    1. Consuming portlets from the producer of staging environment

    2. Set preferences in the portlet Federated on the consumer and the test, keep track of what preferences have been on portlets for step 5.

    3. Propagate from the intermediate producer to the producer if necessary production - as long as the same ears and wars are deployed on the production and staging of producers, spread may not be necessary if it is used only as a producer.

    4. Spread all the portlets intermediate consumer to the producer of the production. The propagation tool will spread Federated portlets, but when it installs them to the producer of the production, the spread of WLP 9.2 tool is to assume that it points to same instance of producer than intermediate consumers. Since this is not the case for your installation, all of the custom federated portlets will be broken on the consumer of the production. If you have configured the consumer of production with the same producer handle that you used in the staging environment, Federated portlets that have never custom should work after propagation.

    5. By using the administration tools, remove these custom federated portlets broken consumer of production and re-create them, adding the preferences of step 2 and add them in the appropriate pages.

    Unfortunately, this is not a single task. Whenever you do not want to propagate staging to production, all custom federated portlet must be re-created on the production environment with appropriate preferences. This includes the portlets that you had changed a preference on and portlets that you had not changed the values preferably on since the last time that multiply you, because the propagation tool will overwrite these instances of portlet on the consumer of production with invalid portlet CCP handles.

    WLP 10.0 and later, the steps are much easier - you would just run the tool in spreading on the producers, while consumers and any customizations would be automatically transferred from the staging to the production.

    Kevin

  • What happens if several consumers - whose architecture SW should I use?

    There are several models of VI and documentation on the producers/consumers type aqrchitectures

    I have some experience with LV, but limited experience with multi-threading programs and events.

    My question is what happens if the consumer also produced data? ... the tutorials do not really extend to it.

    In my application, I have 3 USB CAN transmitters and a NOR-DAQ.

    I intend to have loops or threads for each multiple hardware device at the lower level.

    There will be a loop of the UI (producer) and a "test step sequencer" interpret the activity of the façade and send commands to the hardware devices to take action or perform a measurement.

    My main problem is what is the best method/practice of transmission of data to the 'test step sequencer' material once the acquisition is completed?

    Do you use the same queue to pass data back (for evaluation of success/failure analysis and test) or any other method.

    This might work.

    A difference between the Registrant and the queues is that with queues, you can be sure that the loop of consumer gets the message (assuming that there is no problem with the producer generating and sending).  Even if the consumer is busy doing other things, the message waits in "inbox" of the consumer until he is ready to read.

    A notifier, there is no guarantee that every piece of code that expects a notification will get all messages.  Think that the declarant is a whiteboard.  A message to put out there for anyone interested to read.  But when a new message to be sent, the sender is declined, clears the Board and writes the new message.  If someone who is interested in messages has been busy and you can't go to the Commission while the first message is there, it will never see the message.

    If you want to ensure that each loop gets all their messages, then just a queue for each loop that behaves like an Inbox.  If you need to send the same message to several loops, then queue the data in multiple queues.  If you get a message back, enqueue sending loops reference to queue in the data (self-addressed stamped envelope).  (you can also put a Boolean value in the cluster that could be an indicator as to whether the 2nd loop should send something again or not.)  If you need the first loop to wait for the return data before you go, then he's waiting in the queue.  But you can use the time-out function so that it is not wait forever for something that never comes back and integrate logic into your program so that it can handle this situation (doing nothing, resend the message, open a session, or displays an error message...)

  • What is a good way to use the queues for the model of consumers/producers?

    Hi all

    I am following the model of consumers/producers to use the queue to synchronize the following process: the producer is a loop to produce a number N, I will put each number generated in a table and after each 5 numbers generated, I put the table in the queue and pass it on to the consumer. I have to wait the use by consumers of the data and it will then remove the item from queue so that producers will have the chance to produce another 5 numbers. As I put the maximum size of the queue one, I expect that the producer and the consumer turns to produce / consume all five numbers and the opportunity to another. Here is my code

    When the checkbox is false, the code will be

    For the first 5 numbers, product will generate every thing right and put it in the table, and it's going to pass the array to the quere so that the consumer will have the chance to loop through the table. I except the procude loop will continue only when the queue is available (i.e. all items are deleted), but it seems that once the consumer starts the loop loop of the product will continue (if the indicator x + 1 and x 2 will be changed to numbers). But this isn't what I want, I know there must be something wrong, but I can't say it is.

    dragondriver wrote:

    As you say in 1, sequency structure to enforce the order of execution, that's why I put it here, in this example, the simple question, I replace the complete code with increase in the number, in the real case, the first markers + 1 and + 2 must be performed in this order.

    Mikeporter says:
    1. get rid of all the structures of the sequence. None of them are nothing but apply a work order which would have been the same without them.

    So even if you delete the sequence structure, there will be a fixed & defined order and it is because LabVIEW follows the MODEL of FLOW OF DATA.

    Data flow model (more precisely in the context of LabVIEW): a block diagram node runs when it receives the required inputs. When a node is running, it produces output data and transmits data to the next node in the path of the data stream. The flow of data on the nodes determines the order of execution of the VIs and functions on the block diagram (click here for reference).

    Now in your code, just remove the sequence structure will not make you order will be going to stay the same, but you need to do some very minor changes (as thread of the error in loop, before that he go to the node "Élément Dequeue").

    Come to the main point: it's a good way to use the queue for the consumer/pmodel that?
    The model you are using (and qualifying as consumer/pmodel) is much too deviated from the original consumer/pmodel which model.

    dragondriver wrote:

    For the second, Yes, it's my fault for delete, though. I'm actually the example of model of producer/consumer design pattern, but I do not pay attention to the while loop in the part of the consumer.

    While loops (two producers & consumers) are the essential part of this architecture and cannot be deleted. You can start your code using standard model.

  • Microphones capture multiple producers/consumers

    I was getting buffer overflow problems when I used foolishly multiple "Capture sound" Express VIs to listen to several pickups and treat them.

    I then created a structure of producer/consumer where I realized 2 signals (2 producer loops) and loop them into 1. It was working fine!

    I developed this idea today to 3 microphones (and hoped for later). The problem is that I get the errors again. I can't quite explain the errors, so I have attached the images (in sequence). By highlighting the execution, it seems that the error occurs on the SECOND iteration of the "Sound Input read" in each 3 loops "producer".

    I hope someone can shed some light on this issue. Seems strange that it would work for 2 microphones, but not for the 3.

    I tried briefly to play with the sampling rates high with no apparent result.

    Try to double the number of samples to get into configuration VI while leaving many points before reading VI the same.  The configure VI defines the size of the buffer.  The VI read the entry defines how many points is read at each iteration.  The buffer must be always bigger than the number of points, read so the computer has between the buffer time for enough points to read and read the real no overflow (which seems to be your problem).  Adding another entry added more charge processing, maintenance if the bed is now produce not fast enough (the computer unless a sampling period unique answer to avoid an overflow).  I made that mistake myself more than once.

  • Consumers-producers - acquisition image but loop run only producer

    Hi all

    I try to acquire and store the image of camera Basler L301kc and framegrabber OR PCe 1427. I have create a producer / consumer loop because save him more time than the acquisition and if I do both in the same loop I lose frames. But I have problem: producer loop only run.

    I've read all the threads, but I does not solve my problem.

    I have attached a VI code how I tried to do. I'm using LabView 2011.

    Please, comments or help is deeply appreciated.

    I thank in advance

    XuanThuy

    Hi XuanThuy,

    The location of the VI have in your program is attached.  It is currently located in the loop of the producer.  I think it would be useful to move this to the consumption loop, so that you do not delete the image of the memory before you save it in jpeg format.  Please let me know if that helps with your program.  Thank you.

    Kind regards

    Kira T

Maybe you are looking for

  • iOS 10.0.2 that WiFi don't get re - not connecting

    I use iPhone 5s, which worked absolutely fine until I upgraded to the latest version of iOS 10.0.2. At home I have a put wifi in place for broadcasting non - so it does not display when you check the list of available wifi networks. Before the upgrad

  • drivers graphics dv6-6004sa

    When released the switchable graphics drivers for dv6-6004sa? I was given to understand that all laptop computers manufactured after Jan 2011 would have drivers of Windows 8. This laptop has switchable HD4250/HD6470 GPUs.The AMD former driver for Win

  • GetControlIndexByName

    This should be very simple, but I can't seem to find it.  Could someone please explian me how to get the GetControlIndexByName method that you want to appear.  I created a node invove for method and attached to the server VI reference 'Ce VI' but whe

  • How to connect incremental encoder to NI9411?

    Hello  I need to connect an incremental encoder to a NOR-9411 digital input on a chassis cRIO module to use for high-speed triggering.  I'm having trouble to know how to connect the wires needed to the encoder until the 9411 correctly. The son of tra

  • Impossible to validate with genuine advantage

    Cannot be validated with real profit, get I get a blank page. Tried Firefox plugin, tried through IE. Tried the downloadable special thing. Nothing works. Just a blank page, lead to nothing. What's wrong? I have a XP Professional SP 3, which is new,