Architecture feature producer consumer

I was wondering if the loop of consumer in a producer consumer architecture works only when the loop of producer send him something, or he still works, even if it receives nothing from the loop of the producer?

It depends on how you put in place. If you do not have a timeout on the dequeue, he'll sleep until he gets a message. If you have a time-out, it will run if the value of timeout is reached.

Tags: NI Software

Similar Questions

  • Programmatically change the number of producers in an architecture of producer/consumer

    Hi all

    I've got 3 momo SoMat I am streaming of data to 10 Hz. I plan on 3 producer loops and loop a consumer to treat.

    I am pretty sure when I show my customer that they want to increase the number of devices. This scuppers then the producer/consumer model unless I change by programming the number of producers and the rest of the architecture associated.

    Is there a way to do this or a better architecture?

    Phil

    As long as there is an ID any in your command of the queue, I do not see why your consumer cannot handle the producers as much as you need.  I would turn the producer code in a Subvi.  Make sure reentrant Subvi.  Then, you can call dynamically that VI as many times as you need, one for each instrument.

  • Is the reference of the register of necessary shift in architecture of producer/consumer?

    Hi guys,.

    I was just wondering if the producer/consumer architecture is necessary register wired shift to the reference of the queue or the notifier. Is this necessary?

    I think that it isn't, because it's quite a tunnel but could anyone who thinks that the shift register is necessary, explain to me why it is necessary?

    In each of the samples I found the reference to the queue or the Notifier is connected to a shift register, I tried to wire it to a tunnel and it works well, then, what is the best implementation?

    Thank you in advance.

    Thank you guys for your quick responses...

  • trigger several events to user in an architecture of producer/consumer

    Hi all

    I use a producer/consumer architecture, where the case within the property are selected with enums sent via a queue.

    Enums are queued in the producer, which is a Structure of the event inside a While loop. Then each of the events in the producer is associated with a case in the well (to make it easier).

    Now I would like to run several events in the producer, programmatically in a given sequence. The events involved in the sequence are basically all triggered by changing the value of a Boolean value (button).

    Please find attached a schematic representation of the sequence, I would like to implement.

    I heard of 2 solutions:

    -"Writing to the node (Sgnl) Value property of the variable [I] want change."

    -Dynamic user events

    In any case, I don't know how to make sure this is done for several events in a specific sequence?

    Thank you.

    Florian


  • Error of timing architecture producer/consumer

    Hello

    I use architecture of producer/consumer for the acquisition of measures of constraint by using several channels. Also, I am interested to write data all 1 minute given that the program should be run for a month. Currently, I get a 200279 error whenever I increase the time of 10 sec. To control the execution of the loop of producer, I use 'weight up to the next multiple ms' function. According to the error message, I tried to fix the samples to read without increasing the frequency of data acquisition, but I still get the same error.

    Thank you

    Piyush

    Your test3.vi was not included, so we do not know what is happening there.

    What is the rate of acquisition for your data acquisition task?  DAQ hardware do you use?

    Have you tried to increase the size of the buffer?  There is a property node that can define it.

  • Instead of using the structure of the event with the producer consumer?

    I used the architecture of producer-consumer in the past to control a state machine with the structures of the event.  I'm working now with the basic version of LV that does not include the structure of the event.  Can anyone recommend alternatives to the use of the same architecture in this case?  Thank you, David

    Before the introduction of the structure of the event, the only option was the election.  Control terminals are in a time loop (the producer) with shift registers and a wait, usually about 100ms.  At each iteration of the loop, the control's current value is compared to the previous value.  If it has changed, and then take appropriate action.  Andrey suggested, queues are a good way to pass information between the loops.

    It works for the equivalent of the value change events.  Things like mouse to top or filter events were much more difficult or not possible.

    Lynn

  • First try the producer consumer Architecture: continuous play and dynamically update settings.

    Hello

    I am currently working with two instruments; an Agilent E3646A and a NI 6212 BNC. My goal is to have the 6212 continuously take measures according to predefined parameters while the E3646A parameters can be continuously updated. This combination simple instrument aims to help me learn the manual architecture; continuous measurement, output dynamic controls and instruments more will be added in the future.

    I've already posted on a similar, but more complicated configuration (http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Split-second-lag-when-controlling-two-instrum... and was advised to try the producer consumer Architecture.) I found the documentation on the website (http://www.ni.com/white-paper/3023/en/, https://decibel.ni.com/content/docs/DOC-2431), searched the forums and built my own VI. While my first attempt at a producer consumer Architecture has solved some of the problems I had when I posted on the subject, however, new questions have been raised regarding the reading and adoption of the VI.

    I am currently able to run the VI and update the settings on the device. Previously, I'd get a freeze while the instrument has been updated and could not switch settings until it was done. This has been resolved, although that reading updates only when a parameter has been updated, although it is outside the structure of the event. In addition, the Stop button does not in any context. I also got occasional mistakes on the part of Deqeue, but the major part of the sentence is error-200279 'A tried to read samples that are no longer available' to DAQmx Read. I realize that there is a problem in my loop of producer but have not been able to find a way to solve it.

    This is my first attempt at a producer consumer Architecture and already I can see that it is a powerful tool. I read as much as I could and looked at examples, but should have some problems at the beginning. Would be very grateful of any advice so I can take full advantage of the architecture.

    Hope to hear from you,

    Yusif Nurizade

    You're going to overflow this buffer, unless the events are generated faster than "sample rate/number of samples.   Period.  Nothing could be simpler.

    You don't need a local to stop your curls.

    Try something like this attachment.  I simply moved the structure of the event in its own loop dedicated since it had nothing to do with acquiring data at all.

    Data acquisition loop stops very well when you destroy the task and destrying the stops of power queue (sending the default values of the queue for the power control) for EXAMPLE, to ADD a group of setting 'Safe shutdown' to a 'package' and it wire to the Center terminal (Prototype).

  • Trigger consumer in a producer consumer architecture

    I want to trigger the loop of consumer in a producer consumer architecture, so that it can do what it should do, until he receives something new producer loop.

    Can someone tell me please how to do this?

    Thanks in advance!

    If the Dequeue-1 item timeout entry turns off the timeout.  That means he'll stay there forever until the data is available in the queue.

  • error 1 to queue in a producer/consumer architecture

    Hi all

    I use an architecture-based on producer/consumer queue, as shown in the screenshot below (which is a simplified diagram of what I want to do).

    As you can see:

    1 / in the producer of the loop, I read data from two LV2: map Wafer and HAD current

    2 / in the loop of producer, these LV2 are used as output of a sub - VI, called 'Wafer map change. The Subvi, allows the user to change the 'Wafer map' picture indicator located in the loop of consumption, by double clicking it.

    3 / when the Subvi has run, it displays the picture indicator updated (Wafer card) and the new 'Course DUT' coordinates.

    4 / the two variables are grouped and transformed into a Variant.

    5 / the variant is then enqueud in the queue of the 'hand '.

    6 / this variant is converted from inside the loop of consumption, and photo indicator is unbundled.

    7 / Finally, the map LV2 Wafer is written and the modified photo indicator.

    This type of data flow worked earlier, but now I am facing the following error (it's my french translation):

    Error 1 occurred: Add an element at the end of the queue in GUI.vi of automatic Test Bench

    Possible reasons:

    LabVIEW: An input parameter is not valid. For example, if an entry is a path, it may contain a character that is prohibited by the operating system, as? or @.

    NOR-488: The command requires a PDC GPIB controller.

    I have no idea how it appeared. But now I'm stuck, and I would be grateful if someone can help me with it.

    Thank you.

    Kind regards

    Florian

    Your method to allow the judgment seems suspicious.  Say that there is an error in the loop of consumption.  This stops the loop of consumption and the stop button set to TRUE.  But the value of the stop button will not be read until the next iteration of the loop of producer.  So if you decide to hit the button on the Insert, the queue was already destroyed, then you will get your error.  And all these local variables just shouts "RACE CONDITION" for me.

    Get a mechanical action of the Stop button latch when out.  It is the default setting for a button.  Then place the terminal inside the event (which you already have).  A REAL outside this case, wire OR with wire error to stop the loop of the producer.

    You need to do is create a command to stop the loop of the consumer.  This order will be sent in the case of changing value of stop button.  You should probably send this command after the loop of producer, just in case where the loop of producer created an error.

    You can also use a node property of the button stop to set the Value property (signs).  This will cause the structure of the event to raise.  This will cause the producer loop stop if the consumer has an error.

  • events producer consumer with notifiers

    Dear users of LabView,

    I would like to ask your advice on my project (see the attachment of files). For the beginning, I did only the "backbone" of my project, that's what you can see in my VI. My project will have the following features:

    -Start and stop action possibly (and also plot data to the chart and saving the data to the file)--> here is some time a loop to record data ranging from DAQmx (USB6009) and another while loop with rates of different loop to rise in voltage output amplifier of the magnet.

    -During the measurement, or if the system is idle, the user is able to read files of measured data and evaluate the measured data, etc... (so there will be more features...)

    I decided to use producer consumer structure with events and the authors of notifications, and I also use the dynamic user event to be able to communicate to the consumer with the producer (where I have my machine of the State as in a shift register).

    Please comment on my VI, what do you think? Maybe I should use the state machine (the shift with the pole of the State Register) in the lower loop? I could also use up queues of the notifier, but since I send only orders and the values of the parameters (not streaming broadband data) I guess that the declarant is fine?

    Thanks for the tips!

    The code you posted looks like a good start.  The architecture is very similar to the measurement sample continuous project comes with LabVIEW 2012.

    A few things I noticed:

    1. I would usually use queues instead of filers (unless you want to manage only the last command and not all orders in the order they are received).
    2. You don't need the registry change in the top loop (structure of the event).  You inadvertently send a length of measure and other commands parameter since you replace only the command.  Probably, this is no problem for now but could be a problem later.
    3. I think the user events are a great way to manage cases of judgment where the consumer is able to report to the producer that the application must exit loop (this is how we do in the sample project).
    4. Your case 'Init' confuses me a little.  It is read length control measure and send a user event in the event that, in the structure turn immediately place a measure command. Once I see a control in a loop of consumer as it hurts a bit uncomfortable. Why not have the value "start_measurement" to change event read the length of measure command and send it as part of his message to the consumption loop. Then the loop of the consumer can Init and self talk to start the measurement.
    5. You may need to rethink your strategy mistake in the case of the measure. Currently you do not stop a loop if an error occurs, and allows you to keep the error between iterations of the loop information shift registers.  Therefore, if an error occurs in one of these loops you can never hear about it.
    6. In general, using the error state as the main way to stop a loop from consumers is a bad practice. I'd rather see a "Shutdown" command which causes the consumer to stop loop. It is more scalable and less likely to be triggered by the accident.

    Good luck with the rest of your application.

    ~ Simon

  • Master/slave producer/consumer Feeback?

    We know that in the models of master/slave and producer/consumer can send information of the master loop or a producer to the loop of the slave or the consumer.  But what to get information of the loop of the slave/consumer back to the master/producer loop?  I think it may return some sort of output or a message saying something like "I finished my work successfully.  This can be done with local variables, but is it really a good idea?  Is there another better way?   In addition, in this case can I just use a sub - vi?    I don't know that I always get the PARALLEL treatment offerred by master/slave and producer/consumer with a sub - vi.

    You can use a notifier to send a return message.  You can use a local variable, but unless you know what you are doing, you might encounter problems with race conditions.

    Sub - VI have nothing to do with producer/consumer architectures.  You can do a p/c with or without sub - VI.  Sub - VI is a way to break the code in significant functional blocks.

  • IMAQ Vision: Is not an Image error when using producer/consumer

    Hi any person

    I used the Vision Express to solve the problem of Patern Machine.

    I want to put Assistant and Aquistion in 2 loop parallel. So I used the producer/consumer to transfer data

    After running VI, I pressed the Stop button and I encountered this error

    I think that getting the queue has a problem. I changed Image to Contant control and connect it to the data type of element. I think that this path is correct.

    So, in case of error, it addressed to Coppy IMAQ in Assistant. So I think that I used the Comunication of the queue is not correct.

    How can I solve this problem

    Thank you

    You can see more detail in the following video: https://www.youtube.com/watch?v=i6FOQ2jypXc&feature=youtu.be

    Try this:

    You should put the image process in the loop of the consumer and release it properly.

  • export to spreadsheet - data 2 channels appear in alternation with loop of producer/consumer

    Hello

    I'm having trouble with the function "Export the waveform to the worksheet" - but it is not clear to me if the problem is with how I use the export feature or if I am wrong concatenating two waveforms of different modules of the series prior to export, or if my queue is wired incorrectly for producer-consumer loops.

    I use a hunts SMU-1073 with SMU-6361 and 4330 modules (tension and strain). I tried to change the example of the "entry analog cross synch" for use with a structure of producer-consumer (see VI below).

    The output of the worksheet contains a large part of the data in the string tension, followed by a smaller piece of data (with timestamp) strain, after which the alternate output data between data of tension and strain.

    Can anyone suggest where I could go wrong, or how I could solve this?

    Attachments do not work, so I'll try to post in an empty message directly after this post.

    Thank you

    Claire.

    That's what I thought.

    A number of wire.  -1 gives all the samples available in the buffer (which can be zero for some reason any).  A number will expect that there are many examples.  If the two readings can wait until they have both the amount of data requested.  This way, they will also have the same number of samples and be better aligned in the text file.

    Your loop will continue to run until you press stop or get an error.

  • 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

  • best way to handle this situation of producer-consumer

    It is, I know a common thing, however, I never really thought about before. I can't post my VI so a description will have to do. It goes without saying, but again, it's producer-consumer architecture. Let's say you have a generator of signals and all the controls that are in a cluster. A value is changed, an event in the loop producer and you compare the old and new values to determine which button has changed the lights. Cool, all good. While I have the tail a State front reading in my loop prodcuer who is corresponding in my loop of consumer. The State of reading front load all the new values in a cluster that is then introduced into a shift register be accessible from anywhere in my code (see here).

    Now my question is, what would my next state that I have the tail? If I have a single "send commands to the gen GIS", in my loop of consumer I have again to determine the value that has changed in order to know what order to be sent (because the initial determination of what has changed in the loop of the producer). However, if I have an individual for each order state that I want to send, my business structure will get very large, very fast.

    Last option is to have a send order status and just write all the data on the only value of a control change, whether it is new or not (which seems an exaggeration).

    Suggestions please?

    For situations of this kind, I would not send a 'State' to the consumer.  I send a '' command. ''   When the consumer receives a command, it determines if this command is executed immediately, or if he completes the task of process and then manages the new command.

    With the command I send one or the parameters.  For your signal generator parameters would probably be something like a bunch of 'control ID' and 'value '.  Control ID would probably be a typedefed enum and value a DBL.

    What ever you decide, think, plan and document before code you.

    Lynn

Maybe you are looking for