Producer / consumer set loop of dynamic data item type

Hey all,.

I do a simple exercise of producer / consumer in a loop. In my loop of producer I audio Aqcuerir and in the loop of consumer I'm projecting on a chart

Everything works as I had in mind, the only thing that bothers me is the way that I had to set the type of the element to the block "Get the tail" at the beginning.

I knew no better way to get the kind of data that I used to just take an another "acquire its" Express VI and which hang. But that may not be the only way to get there, right?

Note: I know that I might not need to use a producer / consumer design tend to do, but I need to get hold of technology for school work so I came with this exercise just to get a hang of it.

Thanks in advance,



You just need to feed the correct data type in this entry, which you did by getting the output of a second acquire its Express VI.

You can also use the "Convert to Dynamic Data" function to do this.  When you drop to the bottom of the function, you will be asked to give the input type.  Tests I've done, it seems not to matter, but for example if you chose the entry to a single scalar type, you need to feed a digital constant (change to double type) in the entrance and use the output of dynamic data such as line item data.

I don't like the dynamic data type because it is not very clear as to what it is.  Another thing you could do would be to use the "Convert from Dynamic Data" function to change the output of the VI of its acquisition to a different data type for more or less to avoid the original problem all together.

Tags: NI Software

Similar Questions

  • Producer/consumer vs Master/Slave of data loss

    Hello users of Labview,.

    I did experiment with vs p / M/S lately in the context of data aquistion. Many messages did appear (correct me if I'm wrong) that p/c is the correct architecture to if the data retention is desired, so that's what I tried to implement.

    In the loop of producer, I've included 3 Assistant DAQ VIs (2AO, 1 HAVE), which generates data actively and which is being queued. I have 3 other loops of consumers, two of which are consumer 1) written loops of 2) outputs TDMS data of a chart 3) no producer: structure of the event, monitors changes to the user interface.

    When I run data acquisition, the generated file are always half either acquire the half of the sample that I've specified regardless of the sampling rate. I also have a strange displayed graph (see image).


    If I replace with a master/slave architecture, this seems to solve the problem.

    So question is: anyone met with this kind of problems? Are there disadvantages to stick with M/S instead of p/c in terms of data loss?

    Thank you

    johnji wrote:

    I think I'm well done

    You are not.  Once an article is removed, he went.  Since you have three loops made of the same queue, each loop will get ~1/3 of the data.  If all the loops are to treat everything, then you want another line for each loop and meet the producer, write to each queue.  You can also use a user event.

  • 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 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


    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.

  • VISA SERIES termination character producer consumer model


    I'm developing a HMI to receive data from a sensor.
    Material sensor is built in my company and I have no flexibility with her. Only 2 RX & GND wires, no possibility of
    hardware handshake.

    The sensor send to an RS232 com port a string hex each 1 s, 10 s, 60 years or more and I can not know the frequency.
    So, I scan each data bytes to the serial port and serial port with VISA Read 20ms. At the end of the string hex sent by the sensor
    There is a stop character but I don't how to use it.

    I use the model producer/consumer do not lose any data.

    In fact, I read and concatain received data (with VISA READ) until I got the right number of bytes (because I know the size of)
    the sent hexastring is 495 bytes).
    But in the real work, I don't know the size of the data to be received by the sensor. (<500>

    So, I want to use the character of endpoint to stop the loop of producer that contain VISA READ.

    Should what special function or the property node I use to do this?

    I've attached a screenshot of JPEG of my code.

    PS: for the development of the VI, I simulate the sensor data with another PC that sent the hex string in loop
    with the stop character.

    CHRI = s = nour wrote:

    But in the real work, I don't know the size of the data to be received by the sensor. (<500>

    A method to read an unknown number of bytes: put just the bytes to the Port in the whole loop (not read). Place the output of bytes to the Port into a shift register and compare the latest iteration with the current. When the number stops change (current loop = last loop) then all bytes have arrived. Bail out of the loop so directly while reading VISA.

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


    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


    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.

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


    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 ( and was advised to try the producer consumer Architecture.) I found the documentation on the website (,, 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).

  • producer-consumer: optimize data acquisition rates

    I have a type of producer-consumer of application in which a single loop continuous waiting there and reads data from the card and another loop readings/backups of data. But besides a loop more trace data. The number of channels and real-time scanning is set by the user, the time it would take to save, view, and analyze each data block (an iteration of analog-to-digital reading) may vary according to different parameters.

    I'm putting 'number of samples to get' big enough on analog/digital playback to the beginning so I don't get the overflow of queue. Now I would like to adjust automatically when the program is running so I understand any overflow from the queue and at the same time the data are not exposed in the huge chunks at a time. Someone did he do this kind of thing before? For now, the only idea I have is to read the number of items in the queue at all times and use a mathematical formula to increase or decrease the number of samples.


    The number of items in the queue of streaming and using a mathematical formula to increase or decrease the number of samples is a good method. You can also use the decimate 1 D table function to display a smaller grouping your data if your problem is that you do not want to display huge chunks of data at the time.

  • Timed loop in loop of producer/consumer


    I have a loop of producer/consumer LabVIEW program configuration to allow me to properly capture the images that are large enough (8MP) at about 14 frames per second (FPS). The program works very well when the consumer loop is a while 'loop' (recorded at 14fps without problem), but I wanted to do a loop timed, so that I can vary the FPS as requires it. A curiosity arises when I do that. Anywhere under 12 fps, the loop works very well and the data is saved correctly. However, when I bump it up to 13fps, the calculated consumer FPS goes haywire and starts to jump between 9 ~ and ~ 13fps (processing of data gets bogged down?). When I set the FPS at 14, the loop runs at a constant maximum 7 fps. Is there something I can do to remedy this situation?

    I have attached my .VI

    Thanks in advance!


    Are you using LabVIEW Real-time? Loops clocked to a windows OS do really increase determinism more than a while loop with a wait until the next timer multiple. Before you change the loop of producer-consumer in order to include a while loop was programming works correctly? You can also vUtiliser the VI analyizer to see how long things take to run. I let the loop of consumer to the producer in the traditional game upward and change the FPS by controlling the timer to wait, after benchmarking your code, it should be done in the same way as you did for the timed loop

  • Producer/consumer problem: several loops/queues


    Please refer to my previous post ... > for more on the subject. I was told to try a producer/consumer architecture, so I decided to go and do it.

    After doing much research, I come back to ask for help.  I decided to try to implement three loops. The reason for this is because I thought that the length of each loop synchronization can be controlled independently as it should. A single loop treats all user interactions.  A single loop treats data acquisition.  A single loop about the transformation.  I hope that this would help, but obviously made things much more complex.  I created a queue for each loop.  I didn't get the full project, but it seems that everything has run very well where I stopped.  However, one of my States I did not queue receive queue and I have no idea why or where coming.  There is an error in the variant data that says

    'status'-> TRUE
    'source'-> ' error: Invalid Args.

    However there is no error in wiring.  Also when this error is displayed, the random State fell through.

    The other weird thing is the number of items in the queue jumps very quickly when I do almost anything.  I don't know if it's common.

    Before I post pictures or whatever it is, I would have an idea about this error.

    Also, I think I saw this in a previous post about the BAU, but I would like to ask a question.  Attached are two photos.  Queue 1 is the way I put things in place.  Queue 2 is the way I saw things in place.  Can someone tell me if the queue 1 is the wrong approach and why?

    I realized what happened.  The other loop was not handled properly and sent the random State of the main loop.

  • Set the attributes for dynamic data waveform t0 zeros?

    HI -.

    A beginner to labview here, so please be nice ;-)

    I have a simple setup with mainly express screws where I follow the steps below in a while loop

    (1) collect signals with the DAQ Assistant, that generates dynamic data. It is the collection of samples of N

    (2) changing the attributes of the dynamic data using the express VI 'Set the Dynamic Data attributes'

    (3) storing dynamic data revised to a file by using the writing to the file of the measurement.

    The problem I was see is that whenever I have insert the express VI 'Set the Dynamic Data attributes' in the data flow, I find myself with a file where synchronization of the signal (i.e., the waveform t0) was cancelled. This seems to happen any dynamic data attributes, I edit. For example, even if I try to set the name of signal I find myself with out having a nulled-out t0

    FYI, I'm using Labview 2009 9.0f3, 32-bit

    I have attached a code simplified showing what looks like a bug to me. Any help would be appreciated!

    It looks like a bug to me as well. Also, unlike other screw Express, you do a right click on it and select open the face before seeing what the problem is. It's pretty simple to find a work around. I converted to a waveform, has obtained the t0 and handed that back as the timestamp for the signal of slected.

  • Producer/consumer or master/slave, acquisition, control, analysis and recording of data

    Hi all

    I have NEITHER cDaq-9188 and its modules NI 9214 (thermocouple), NI 9203 (HAVE current) and NI 9263 (AO tension). I need to measure the temperature and pressure, and according to these data, I need a frequency converter to drive a compressor control. I've developed acquisition, analysis and recording program by the use of the state machine, the design of producer/consumer model and I have no doubt about their. They all work very well. Now, I need to add a control program in their. The problem is that I need to check the compressor with feedback from temperature data permanently, but I do not necessarily all the data acquired and permanently from the results of the analyses. For example, I need to record data once in 30 seconds. Which model desing should I use for this task?

    Edit: I was not able to find examples of advanced program relevant to the design of master-slave model. If you know where to find them, could you write in this thread please?

    The declarant buffer not data.  Do only the queues.  A new notification replaces the old value if she is ever read or not.  You would be loss of data with the notifiers if the loop of consumers with a notification utility cannot keep up with the data that they fade.

    What I show all the data buffers through the queue in the loop of the producer.  The queue of the consumer removes all data and do stuff with him (such as logging) if the elapsed time is over.  What is the problem with that? That is what for (imstuck) described in his message.

    The other alternative is that you put the timer into the loop of the producer.  Have the Boolean value TimehasElapsed drive a deal structure this place only the data if the time is over.  In this case, only some data gets queued, and consumer loop removes all data as it gets and it opens a session.

  • Cannot terminate everything in a loop to the producer/consumer

    I have attached a simple vi which was built from the producer/consumer (events) model.  In vi I set up a counter.  I want to be able to complete the meter when you press the stop button.  This does not work as expected.  The meter goes to its full count before the program stops.  The vi works as expected when run in execution to highlight mode.  Cannot understand it.

    Thanks in advance.

    Race condition.  No matter what time something behaves differently with that highlight run it at full speed, and suspect it is a problem of synchronization due to a race condition.

    As soon as your producer loop has the command queued up, she is ready to handle the next event.  If you press the stop button, it is ready to deal quickly and the stem while the ends of the loop and Stop immediately gets back to false.  This probably happens before the loop of consumer has the opportunity to read the local variable of the button stop in the moment, it's true.  Have your consumer while loop redefine the Stop button to false instead ensuring consumer loop has a chance to see if it is true.

  • acquisition and recording of analog data with producer consumer model

    Someone on this forum, in a separate last week discussion, suggested that I use the producer model consumer data acq.  My ultimate goal is to acquire analog channels 1-4 continuous data, display graphical band style and save the data on the boot disk when the user presses the 'Start Saving' button (and will continue to display recorder cards).  Economy will stop when the user presses the button "Stop Saving" but strip map will continue to operate.

    My attempt to use the producer-consumer model is attached (LV 8.5 only).  It does not work.  I have not tried to implement for recording user controls - just trying to make simple continuous display and save (1 channel) at this stage, using this model.  VI runs, but the graphic Strip is never updated with the actual data, and the data file that is saved has zero byte inside.

    Thank you.


    Looked at your code, and you are right.  It won't work.

    Take a look at this example:

    The VI of the acquisition must be inserted in the loop of the producer.  In addition, you must tell him how many samples for (otherwise, it will get 0).

  • Write to the file of measurement with a loop For using the value of the dynamic data attributes

    I looked and looked, but couldn't find a solution for this.

    I currently have 15 points of different data that I try to write in an Excel file.  I have all combined in a table and lie with the function "write into a file position.  However, the column names are always "Untitled", "Untitled 1" etc.  I then used the function 'Set the Dynamic Data attributes'; but for this I have to do 15 different functions "set data dynamic attributes.  It was suggested to use a loop with the function 'Set the Dynamic Data attributes' inside of her, but I can't find how do.

    I have several arrays consisting of 15 different values for 'Signal Index' 'Name of Signal' and 'Unit', but also a unique 'get Date/Time In Seconds' related to 'Timestamp '.  The problem is that the error I get when I try to connect the output with Scripture at the entrance to measure file:

    The source type is dynamic data table 1 d.  The type of sink is Dynamic Data.

    How can I fix it?  I have attached a picture of my installation; Sorry if this is gross (I'm new on this!).  Thank you!

    It will get rid of the error, but it is not quite correct. What you need to do after that is to click on the output or the tunnel entry and select 'replace with the shift register. In addition, the array of values that you have wired to the Signal Index is wrong. Arrays are 0 based. Just wire the iteration Terminal here. And, finally, take the size of the table and this connection to the N terminal are stupid. Don't wire nothing to this.

  • producer consumer loop run only once?

    Hello here

    In my VI, the loop of the producer seems to operate continuously, but the loop of consumer only run once.

    I did not use producer/consumer patterns before, could someone give me some ideas why this is happening?

    My code is attached.

    Thank you in advance.


    It would be the wrong choice to use a structure of the event into the loop of the consumer.  As it is configured, you must generate a leave mouse or mouse event enter on the graph of waveform for the loop of consumer to complete its first iteration.

    Remove the structure of the event.  you don't need to update a chart.

Maybe you are looking for

  • How to get help from Mozilla and not volunteer professionals?

    Thanks to all the volunteers who help the people here. Are there own support workers of Mozilla that could be contacted? How can I contact them?

  • I have a new iPhone 6s Im trying to build / restore.

    I have a new iPhone 6s Im trying to build / restore from iTunes backup.  I get an error message tells me that impossible to use the phone because it requires a newer version of iTunes but all the software on the phone is up to date... any ideas?

  • Qosmio G20: How do you get TV to work?

    Hi, I recently bought a laptop Toshiba Qosmio G20. I want to watch a Divx on my TV using the laptop as the player. But, I can't get anything to display on my TV, my TV remains empty. I tried pressing on now the keys Fn and F5 and this doen't seem to

  • MacBook Pro slow and stop, memory or HARD drive or motherboard?

    These last few months my Macbook Pro medio 2012 begins to slow down. I was thinking of a resettlement but has not had the time yet. Last month, he really slow started to freeze and stops instantly. It reboots and then I get a gray screen saying with

  • Windows 7 and Deskjet 895cxi drivers

    I just installrd Windows 7 (64-bit) and can't get my HP 895cxi printer at work. It is supposed to be compatible. I think I downloaded a driver for 895cxesomehow. I removed the device from my computer several times, but when I plug in the USB slot, it