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).

Tags: NI Software

Similar Questions

  • My laptop suddenly stopped opening my Hotmail emails. I can connect to Hotmail and records are regularly updated with new emails, but nothing happens when I try to read an email.

    My laptop suddenly stopped opening my Hotmail emails.  I can connect to Hotmail and records are regularly updated with new emails, but nothing happens when I try to read an email.  The cursor will just highlight the particular word on what it is and do nothing.  As far as I know, nothing else was done on my computer.  This could be the cause?

    original title: cannot open emails.


    The best place to ask your question of Windows Live is inside Windows Live help forums. Experts specialize in all things, Windows Live, and would be delighted to help you with your questions. Please choose a product below to be redirected to the appropriate community:


    Windows Live Mail

    Windows Live Hotmail

    Windows Live Messenger


    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums to

  • Data types in the design for the producer consumer model

    Is it possible for me to use any type of data in a model of design producer consumer, without specifying specific data type?

    what I mean is if there is a way to connect to a data type with which I can use any other type of data, not to mention that one that I have connected, and if not, how can I specify the data type for a number or any other data type, for use in a design of producer-consumer model?

    You can make a part of your cluster of data a Variant.  It will take any type of data.  A common architecture for the producer/consumer is a cluster which is an enum and a Variant.  The enum contains all possible "orders", you might want to send.  The variant contains data that could be of any type.

    Ungroup you in the consumer and get the enum and Variant.  Attach the enum to a case structure.  In the specific case, convert the variant type in a data type of regular LabVIEW and with it as you please.

  • Buffer could replace the queue in the design of producer/consumer model


    I have a question to which the task of buffer to store the data and the queue is also of the same thing so we could use the inplace queue buffer in a design of producer/consumer model.

    No, these examples of buffer not almost equal to a queue, and never "replaces" queue at the producer/consumer.

    The advantage the most important of the queues for the producers/consumers (which none of the other mechanics buffer sharing), it is that it works activities to warn the reader that the data is available. So if you would simply replace the queue by mechanics of tampon too developed that you have attached to your last post, you will lose a large part of the object using producer/consumer.

    Thus, to compare the two mechanics:

    -Tail works activities, while the example of the buffer is not.

    -Tail must allocate memory during execution if several items are written in that corresponding queue. This also applies to the buffer (must be resized).

    -Given that the buffer is actually simply a table with overhead, memory management becomes slow and messy with the increase in fragmentation of memory. Queues to play much better here (but have their limitations, there also).

    -Overload of the buffer (the table manipulation) must be implemented manually. The queue functions encapsulate all the necessary features that you will need. So the queues have a simple API, while the buffer is not.

    -Given that the buffer is simply a table, you will have a hard time sharing the content in two parallel running loops. You will need to implement an additional charge using data value references to manage the buffer or lose a lot of memory using mechanics as variables. Lose the memory, you will probably encounter racing conditions so don't think not even on this subject.

    This led to four '+' for the queue and only a single point where 'buffer' is equal to the queue.

    Hopefully, this clears things up a bit.


  • Should I use the design of producer/consumer model (Instead of Globals)?

    Hello everyone.

    I have a request including several loops in it. A loop reading data series and he analyses for use in the other loops, another loop acquires via DAQmx data and performs calculations on it for use in other loops, the other formats the data from two loops and poster and one last test data. I was wondering if this is a good candidate for the design of producer/consumer model.

    For now, I use global variables to send data from the series and DAQmx loops to other loops. I use motors of the action for the different parts of the program that should be used everywhere, as the serial port. The test loop needs than the most recent data to run his test.

    Thanks for your suggestions!

    The short answer is Yes. If nothing else using queues to pass data will allow your various loops inactive if no data is present. By using globals your curls must continuously survey to see if the data has changed. You always are beter off if you can make your request, driven by events rather than to use the polling stations.

  • How to record measured analog data on the PC?


    I am a beginner in the real-time hardware. I have the cRIO-9024 controller and the cRIO-9112 chassis. I have a few questions:

    (1) I can't see the examples because Labview 2009 shows that The NI Service Locator is not running. I just installed Labview 2009. How can I solve it?

    (2) what is the best way to filter the measured analog data? There are hardware module filtering or I have to use Labview tools as filters pint? I would like to read data to the time step 1 Ms.

    (3) how can I save measured analog data on the PC? I tried to use 'write to file measured', but he did my program slower and I couldn't get my 1 mS of a cycle. Can I use cRIO-9024 memory somehow and after when the programme is complete to save the files to the hard drive? Maybe it would be faster?

    Thanks for any help and examples, whether it would be possible.

    Hello Rodzynek,

    If you do not have the FPGA module (or just for now) the solution you gave with the filter would be OK. Place a second loop for file IO (and possible your communication to the user Windows interface) would be a good idea. Do not forget that you are using on the function of file create the file path represents the drive of the controller cRIO (which is mostly a c drive). You can send via FTP to the RIO DC (using the IP address) and have a look at the files.

    A suggestion to get this file programattically is that the cRIO controller sends the file name of the Windows user interface (after the closing of the record), with the Windows user interface, you can use the FTP functions in Labview to get the measures file.

    Best regards

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

  • Acquire analog data with 16-bit accuracy

    I use PCI 6259 DAQ, which only supports 16 - bit ADC. Analog 2D NChan DBL NSamp vi gives an output of 64-bit double data. Since I lose most of the bits and memory, is possible to get the number to decimal floating get a 16 bit? Otherwise, what about 32-bit single-point accuracy? I know that you can convert numbers between data types but to convert a series of data in a loop in real time will probably cause a decrease in performance of the system.

    Typo, sorry should read polymorphic.

  • Data Center migration of virtual machines and records from one data center to another.

    So, I found an online script that migrates your inventory during one vCenter to another.  I broke the script into two pieces that export (path of the folder path of the VM folder, permissions of folder and notes and custom attributes) and the other to import (create folders, move the virtual machines in the original folder, reset the permissions and set notes and custom attributes).

    The export script works very well.  I have problems with the import script.  If I have the name of the duplicate folder in the tree view of the structure of the tree will get duplicated under each similar folder.  i.e.

    Exported folder structure

    Portuagal-> football

    Spain> football> football

    Any folder structure

    Portugal> football> football

    Spain> football> football

    I guess I should somehow figure out the ID of file but don't have a clue where to start.

    I rewrote the section import of files of the script to avoid the problem of duplicated folder. The new script detects the parent folder by starting to look at the record of the root instead of just the folder above where it should be created. Because the full path is in the .csv file it is possible. The following script should now work correctly:

    $vmfolder = Import-Csv "c:\Folders-with-FolderPath-$($datacenter).csv" | Sort-Object -Property Path 
    foreach($folder in $VMfolder){
         $Path = $folder.Path.split("\")
         $PathLength = $Path.Length
         $SubFolder = Get-Datacenter $datacenter | Get-Folder vm
         For ($i= 1; $i -lt $PathLength-1; $i++) {
            $SubFolder = Get-Folder -Location $Subfolder -Name $Path[$i]
         New-Folder -Name $folder.Name -Location $SubFolder

    Because the forum software has problem with hooks and contains the script, I have attached the vCenter_migration_import.ps1 script has changed.

    Best regards, Robert

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

  • Syncronize to acquisition of data with the generation of signals

    Hello everyone,

    My request is generate pulses on the output of two different to drive two LEDs and acquire detected pulse signal amplified photodiode.

    Actually pulses are generated by starting the writing on the analog output, and then start the acquisition (I need 200ms on average), stop the acquisition, turn off the driving LED and develop the acquisition and record the results.

    All this in a cycle it takes about 1.5 seconds to run.

    Next step would be to drive the outputs with a waveform (duty cycle of 50% of width of 250 ms) and acquire the signal of the photodiode in synchronization with the edge of the pulse.

    I tried to use the trigger function, but the examples are not clear on how to do it.

    I use NI 9205 or 9215 to acquire signals.

    Is there a particular entry to be used as a trigger?

    Thank you very much for your attention


    I found that NI 9205 has inputto that one be used as trigger signal, i.e. AI0.

    At latest


  • digital triggering of stop/start of analog data acquisition

    I want to use a signal from a digital line to start and stop analog data acquisition. The signal can change levels several times during a race of the VI so I have to start and stop several times data acquisition and store each session data in a different file.

    I tried to play with the following screw: digital triggering of break, DigitalStartandStopTrigger and ContAcq_DigTrig. None of them doesn't seem to work for my configuration. I also do continuous data acquisition so I can't use a reference. I use PCI 6259 DAQ.

    I used the "P0" pins rather than PFI pin on the grid BNC-2090. I know... stupid enough.

  • acquisition of wireless signals and record the signal as text at the same time for 5 minutes


    I'm wireless ECG signal and the display in waveform graph. And at the same time, I need to save it as text for 5 minutes. The problem I faced is for record of the signal, I use scripture to the extent file that saves the file as text... but everything by saving the trace speed decreases.

    I'm very new to labview so please can someone me if Miss me something in it... Please help...

    Why people always post photos of their screws rather than the screws themselves or at least excerpts?  We can't tell from the picture what Version of LabVIEW, you use (so if we post code, you will not be able to open it), and we can not 'play' with your code and try without, ourselves, by hand, trying to recreate your diagram (sometimes very small).  Please, help us help you!

    This is in any case helps to familiarize yourself with the design of producer/consumer model.

    1. Open LabVIEW.
    2. Click on 'File', choose 'new '.... "(no new VI), then (in models) producer/consumer Design Pattern (data).
    3. Study the model and adapt it to your problem.

    The producer would be anything that generates data.  Once you have the data, you put on the queue and send to the consumer for the entire treatment.  The idea is that the producer has an inherent calendar that he must answer, otherwise you lose data points.  The consumer, on the other hand, just need to follow 'more or less' (in fact, the queue may / will develop, if the amount of data is not megabytes, so the consumer can really be quite slow, if you usually want to consumers, on average, to be at least as fast as the producer).

    Bob Schor

  • Calendar and the problems of data collection with the DAQ Assistant

    Hello NOR Developer area,

    I am a Novice of LabVIEW and have seen how helpful you all can be, and if I come to ask for your help.

    I'm having some trouble with a VI I built that specifies an input voltage, a SCB - 100 connected to a PCI-6031E and converts this tension in a temperature displayed on a waveform table. The goal is to give a constant reading of the temperature and display it in a chart for as long that the VI is running (and to reset the chart the next time the tracks of VI).

    The problems I've encountered currently are:

    -After a few minutes of the VI running, I get an error message 200279: tried to read samples that are no longer available. The requested sample was already available, but has since been replaced. (to the DAQ Assistant express VI).

    -I don't know how to change my chart so that the minimum value X is both during which the VI was launched and have the maximum X value increases with each iteration of the loop. Currently, I have the VI get the time system and contributing to the property node X scale. This worked for the graph of the voltage, but not for the temperature chart

    I appreciate those of you who took the time to read my post.

    Thank you all for your help.


    Ethan A. Klein

    SB candidate in Chemistry & Physics

    Massachusetts Institute of Technology

    Class of 2015

    PS I enclose my VI to give you a better understanding of my current situation.

    E A Klein wrote:

    Thanks for writing.

    What property node is talking?
    I do not understand that many different data types. How can I go on the treatment of all the data?

    (Did you mean I should wire 'blue' data for mathematical functions rather than using the node property tension?)


    In fact, one of the nodes property.  I mean specifically the tension property node.  But in reviewing, I noticed the other nodes in property for the chart.  Just set auto-scaling to the X scale and that should take care of two of the nodes property (right click on the graph, X scale-> AutoScale X Scale).  I also recommend placing your mathematical functions in a Subvi to make things easier to read.  Attached, that's what I think you're after.

    I hope that these small tweaks will speed things up enough to avoid your error.  If this isn't the case, then we should begin to look at the design of producer/consumer model or take readings at the same time.  It might also be worth looking away the DAQ Assistant and DAQmx real screws.  But one step at a time.

  • Producer-consumer mode, PDM and Acquisition journal continues

    I created a VI based on events to control the parameters of data acquisition. I created a queue of producer-consumer in TDMS file in the loop of the consumer.

    Question 1: Why should I get DAQmx TASK through each defined event? If I don't, I get error task DAQmx.

    Question 2: I need the QUEUE of each event? If I don't I get error in the file close TDMS (consumer loop)

    Question 3: When I look at the data file, I get manily in the near TDMS file loop of consumer-related. Since there is no element in the QUEUE why should - I get this error.

    Please advice.

    Thank you

    This is certainly not how I would like to start to create a Soft Front Panel for a task to HAVE.  Leave to file logging asside for now (appearing, it is actually very easy to add later.)

    As food for thought - and because that create a FPS really involves a slightly different thought where you started I whip a 'start' of a FPS.  It also shows how to create a simple API around a 'resource Module.   (Just a natural extension of a "motor action - if you haven read the nugget of community is always a good read.")

    What I compressed is not complete - but you should get an idea of what to expand and where.  You could even have there more faster here than when you are now.

    An approach like that can really help when you go to unwind the problems as you mentioned in your code when you are unable to move around the information that the GUI can't really do use anyway and not IS NOT NECESSARY at this level.  the guys from 'Computer Science' will use terms such as 'Hide data', "Functional Abstraction" and "Encapsulation".

    The capture below is meant to tease the project so that others can get the idea of code - (sorry no LAVA TDC today! )

Maybe you are looking for