How to coordinate DAQmx sampling with TDMS in while loop?

I tried to connect the functions DAQmx data to the conventional method of flow TDMS a while loop. The problem is that I can never synchronize the sampling frequency of DAQmx data and the function of the elapsed time. In fact, change the sampling clock service rate does not affect the sample rate in the PDM. The data saved in the TDMS file remain at a constant speed.

This causes me a massive problem when come to process the data.

I join the labview code and one of the data.

Can someone tell me what I did wrong here?

tonger wrote:

Thanks for the reply, Norbert.

Reading in the 1 d waveform can save only 1 channel data. Potentially, I would like to save the data of multi and accelerometer strain gauges at the same time.

Also, I can not always change the sampling frequency...  I think that it is still in 0.000620, which is not good for the subsequent analysis of the data.

Is there another way to solve this problem?

This statement on the record only one channel is absurd. And your solution two loop is just as wrong. A 1 d waveform contains so many channels that you specify and it has a current timestamp inside - not number asychronous since a different loop.

Tags: NI Software

Similar Questions

  • How to add the unique element (inside the while loop) to itself

    I have only digital output element that is in the while loop. Its value changes in each time the loop iteration. If lets say I want to adds the values of the ten first in iterations of the loop of this variable.  How can I do that.

    See attach image for more precision.

    Thank you

    JK

    Hi Joseph,.

    THINK THE STREAM!

    As the values are stored in the son and the shift registers (and NOT in any kind of variables), you must use these fundamentals of LabVIEW:

  • How can I update the values out of while loop

    The LabView waveform chart updates every 0.1 sec.

    When a user clicks on a button, I want to LabVIEW to wait 5 sec and beep for 5 sec.

    Meanwhile, it should be to update permanently the wavefrorm graph.

    When I have the structure case inside the while loop, it interferes with the updates of the waveform graph.

    When I structure case outside the while loop, the structure of the case is never executed.

    What can I do?

    I thought about it using the example of design of producer/consumer model.

    http://decibel.NI.com/content/docs/doc-5404

    It allows a variable that is updated in a while loop to update outside the while loop while the loop is running.

  • How to use count imaq objects in a while loop?

    Hello, I am using objects IMAQ County and works well, but when I use a loop and I want to change the picture that I analyze to see results instantly, the search box, and the locations of the remains of the objects in the picture, even if I return to the original (for example at the threshold) values, objects of the location and the green rectangle remains there as the next image :

    This is the pattern I use:

    I used this same setup with the 3D IMAQ view and it works well, I change the values and changes in 3D view so do I.

    I use unduly the IMAQ dispose?

    Thank you very much for your help and comments.

    Bene

    The problem is due to the way works IMAQ Vision: the thread of the image contains a reference (handle), to the image, not the image itself. Means that once an image has been changed somewhere, the mods are propagated worldwide.

    The solution is simple: just add an IMAQ clear Overlay immediately upon entering the while loop (and add a small timer inside the loop).

    As an example, see the vi attached.

  • How do the DAQmx sync with multiple devices

    Hi, I'm new in Labview. I need help for:

    1 change a program multi-function in order to record the data of three cards daq (devices 1-3) and output through the map (1 unit). The current program was created to record and output signal of one of the card (device). I tried to choose multiple devices when I run the program, but there is an error 200558 shows "a task cannot contain multiple independent devices. Create a task for each independent device.

    2. change the duration record for a longer period, for example: 0.1 s. Currently, the recording time is s 0.009971.

    I joined the multi - funtion.lld. AI des_v2_Multi-Funtion_Synch - AO.vi is the program that I need to change. I've also attached a file of input for runing the program signal.

    Thank you very much.

    Sincerely,

    Jie

    You have a cable RTSI connecting PCIe cards? In order for them at the time of sharing and triggers, you must install a RTSI cable like the one below.

    http://sine.NI.com/NIPs/CDs/view/p/lang/en/NID/12631

    What are the exact synchronization requirements you need for your tasks?

  • Using asynchronous calls in a while loop. How 'Skip' node and only retrieve data as it is treated

    Maybe I'm not understand asynchronous calls... but I thought I should be able to call one another VI and essentially 'jump' it is the node and only receive data as the called VI treats.  In other words, similar to the Run of VI, I can wire a wait until done? with a fake and the main VI will not wait for the other VI end of race.  The main VI continues to function, and when it passes the called node of the VI, it will receive data if it happens to be there.

    How can I call a VI in a while loop and do not wait so he could spit out the results?  Data flow is my enemy on this one...

    The first VI treats its own figures (using the iteration count) and displays them on the PC.  Other indicators are the data of the called VI.  I want to be able to work around the blue circle node and receive data only that it will be available.

    Any help is appreciated.  Thank you.

    What I said OR the 'Start asynchronous call' is the preferred method for starting background tasks. This call is usually used to run background tasks. For example, you have a process of journal. When your application starts it would use the "asynchronous call Start" to start the process of journal and then move on to the other stuf. The process of the journal would then happily run in the background and the main application is free to do other things. Of course when implementing these types of systems you need a way to coordinate things like exit. This is where the queues and stuff come it.

  • How to write data in mode intertwined with TDMS C DLL 2.0?

    Hello

    How to write data in mode intertwined with TDMS C DLL 2.0?

    I use DAQmx features in Visual Studio C++ without Measurment Studio.

    This function returns the data in interlaced mode.

    How can I configure the functions of DLL C TDMS to store this data in the tdms files?

    I see that it is not possible with the PDM version 2.0 with 1.0.

    Thank you

    -TDM C Dll is not able to do

    -TDM header writer may be usable for this but is not able to be used for tdms files.

  • How to drive the sample photos featured news Widget with my own?

    Almost ready to publish my site and I would like to know the best method to replace the thumbnails of the sample (different flowers) in the Composition > News widget featured with my own photos. My site does not have photo albums or slideshows.

    I look at the active panel and see the sample images, but it is not clear to me how to make a simple replacement with my own picture which I want to be a miniature size exactly as sample.

    Thank you!

    Hello Westina,

    Please check this little video that I created to show you how to replace the image with one of your own (please listen to the audio as well): http://jingsite.businesscatalyst.com/jing/2013-11-01_0020.swf

    I hope this helps.

    See you soon

    Parikshit

  • How to write multiple entries with KHz sampling frequency in a file outside the loop?

    Hello

    I am able several entries of string tension using the wizard DAQ (1 sample on request) and it is placed inside a timed loop of frequency 1 KHz.

    This timed loop is placed inside an another while loop.

    Problem is with writing data to a file, although I can see 100 samples of 100 ms in the graphics cable to the out of the way, but the extent of writing to output file stores either only from 19 to 20 samples per second (when he wrote inside the timed loop) or does not store any (if placed outside the timed inner loop).

    I tried to set up producer consumer structure but in the loop of the consumer, I can't write the data in queue to a file saying data type mismatch. I placed the loop starting queue item and consumer out both loops and the element of queue inside the timed loop exit DAQ fed to the queue item.

    Can you please help me solve this problem file writing?

    I haven't looked so writing code from the top of the head, but access to the files is slow, and if you open and close the file, it is quite slow. What do you usually do it write to the file at a slower pace, for example once per second and write all the 1 k samples at a time. Try and also keep Ref file open during the test.

    /Y

  • acquisition of continuous sample with multiple channels

    Hello! Please tell me what I'm doing wrong here, I'm confused about how the acquisition of continuous sample with several channels (using NI USB-6215 boxes).

    Following code is python code, but I don't know who confuse you (and it's only a part of my code in order to not try, it won't work

    buffer_size = 2000 #samples to read
    sampling_rate_hz = 20000
    channels = "Dev1/ai0 ai1/Dev1" #this can be a string or a large number...

    CHK (nidaq. DAQmxCreateTask ("", ctypes.byref (taskHandle)))

    CHK (nidaq. DAQmxCreateAIVoltageChan (taskHandle, channels,"", DAQmx_Val_Cfg_Default, float64(-10.0), float64 (10.0), DAQmx_Val_Volts, None "))

    CHK (nidaq. DAQmxCfgSampClkTiming (taskHandle,"", float64 (sampling_rate_hz), DAQmx_Val_Rising, DAQmx_Val_ContSamps, uInt64 (buffer_size) "))

    CHK (nidaq. DAQmxRegisterEveryNSamplesEvent (taskHandle, DAQmx_Val_Acquired_Into_Buffer, uInt32 (1000), uInt32 (0), EveryNCallback_func, None))

    CHK (nidaq. DAQmxRegisterDoneEvent (taskHandle, uInt32 (0), DoneCallback_func, None))

    the callback function #and

    def py_EveryNCallback_func (self, taskHandle, event_type, nSamples):
    data = numpy.zeros ((self.channel_amount,buffer_size,), dtype = numpy.float64)
    read = int32()
    CHK (nidaq. DAQmxReadAnalogF64 (taskHandle, buffer_size, float64 (10.0), DAQmx_Val_GroupByScanNumber, data.ctypes.data, buffer_size * number_of_channels, ctypes.byref (read), None))

    With only one channel, everything's fine, and tension diagram looks like this:

    buffer_size = 2000, sampling_rate_hz = 20000

    But if I use two channels, voltage diagram looks like this

    buffer_size = 2000, sampling_rate_hz = 20000

    It looks like the sampling rate is higher or there are fewer values?, but with two channels with the results table is 2000 * 2 long and with a single result is 2000 * 1 long is not smaller

    most of the settings important (?) in my code:

    DAQmxCfgSampClkTiming "float64 rate": 20000 (sampling_rate_hz)
    'UInt64 sampsPerChanToAcquire' DAQmxCfgSampClkTiming: 2000 (buffer_size)
    DAQmxRegisterEveryNSamplesEvent "uInt32 nSamples": 1000 (?)
    'Int32 numSampsPerChan' DAQmxReadAnalogF64: 2000 (buffer_size)
    DAQmxReadAnalogF64 "float64 [] readArray": [[buffer_size] * number_of_channels]
    'UInt32 arraySizeInSamps' DAQmxReadAnalogF64: buffer_size * number_of_channels

    as you can see nSamples is a big question mark, but the problem still exists if I set variable buffer_size y (2000)

    Hi Dazzler,

    It is not a multi-channel example that ships with the driver, but after a quick look at the code that you use in your third post, everything seems to be configured correctly. The only thing I was thing I got a question about your plots. Looks like you draw each time the same number of points. If you draw just the table of data directly from the playback feature, you need to draw (buffer_size * number_of_channels) number of channels since the data returned is as an interlaced array. You can also choose to deinterleave samples. More information about this lie in the NOR-DAQmx C reference help, which is installed with the NOR-DAQmx driver.

    Kind regards

    Kent

    Technical sales engineer

  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

  • How to stop the acquisition with a relaxation with the NI PCIe-6323

    Hi all

    I wonder if it is possible to stop data acquisition or pcie-6323 with a trigger pulse the same way that I begin to acquire samples with a finished sample mode trigger pulse.

    Thanks in advance

    M.

    The samplesPerChannel that you can show what the sample clock configuration defines the total number of samples for the acquisition of finishes.  In your case, you will read the data previously triggered so permanently in force this setting really only sets the size of the buffer.  If you want to just be large enough to avoid overtaking (although...) If the window you buy is potentially very short, you might want to explicitly configure the size of the buffer to something bigger and maintain the value of samplesPerChannel down so that the reference trigger can be accepted earlier).

    The numberOfSamples you specify when you start the player defines the number of samples for the next call for reading.  If you can read the small windows of streaming data to avoid having a blocking with a large timeout call.  If you do not want to change the time-out period, it is a property of the DAQStream class.

    The "continuous" examples (e.g. this one) should show how you can read back data asynchronous as it is acquired.  Your configuration looks more like a "continuous" example

    Since you want to start and stop using the same line as the trigger, perhaps an alternative to the evolution of the default read pointer would be to set up a central task of analog input with a relaxing break.  The caveat to this is that the break does not stop at the task and as soon as the line goes back to you will begin to acquire the data again - I would say using a meter to separate groups of samples in the buffer zone continued.  If you wish to purchase multiple windows of data in short succession well, then I would go with that instead to avoid having to restart the task (and potentially Miss samples during the restart of the task).

    Best regards

  • How to exit while loop with delay schedule?

    I have a pretty heavy program that iteratively takes a series of measures from a number of channels using a variety OR-Switch and OR-DMM screws that I assembled as a result of various examples and several help pages. Each channel is sampled once during each iteration with data to be saved in a text file for later analysis, after it is imported into Excel. I added to the screen 'real time' indicators and charts to see what looks like running data.

    Each iteration is performed using a While loop with a delay timer, even if a previous version, I used a timed loop. Measures for the series of channels are collected with a loop For inside the While loop. The loop For includes screws which:

    1 cut the channel and wait as debounce.

    2 Initializes the DMM and passes the configuration information.

    3. wait for a while to make sure that the DMM is set.

    4. measure.

    5. close the DMM.

    6 disconnect all the switches.

    The terms of the election of the channels is ends in 15-20 seconds and I am currently collecting data every two minutes, so he spends "wait" time "collection". Each iteration of the loop For initializes and closes the DMM to avoid the hot switch.

    Other components of the program are configuration setting controls, etc. (in front of the While loop), a "current measurement" indicator and a writing-text inside the loop file operation For, several indicators of the iteration (inside the While loop, but outside the loop For) and a bunch of operations related to the grouping and table that provide graphics of groups of time vs measures.

    I don't know there are more elegant ways to perform many functions that I do and I'm not posting the VI here because I want to concentrate on what I know, it's a big problem with my program (for now!) - I can't figure out how to get out of the While loop. I tried the combinations of Boolean control, its conditions of latch and Stop / continuous if true to nothing does not.

    I want a 'Stop' button that ends the While loop, at the next opportunity, but it is not working properly, I think, because the stop button does not play with good timing, because the program runs either the loop For or the time delay at the beginning of the While loop. 'Next opportunity' can mean 'Immediately', 'at the end of the next iteration of the loop,"or"at the end of the next delay schedule." I think that if I get one of these scenarios to work, I can get an any of them to work!

    Help, please!


  • How to set the sampling interval using DAQ hardware?

    Now I have a sensor capability and hardware DAQ 24 bit (http://www.mccdaq.com/usb-data-acquisition/USB-2404-10.aspx).

    The DAQ hardware has the 50kS/s maximum sampling rate. My question is how to define the range of data collection. For example, if I set the sampling rate of 2000, continuous sample mode, I use read.vi DAQmx in a while loop and set the "number of samples per channel" to 100. I want to plot these data over time using a XY Chart and also save this data. So I add a 'Medium' function to get the average of 100 samples per each loop (medium, there are 20 release of data per second). But when I put a 'number of samples per channel' much more small (for more data per second), there are a few problems. It seems that the program cannot read the data as much and get the average at a higher frequency. I don't know where is the problem. Overall, the collection of data more frequently? Maybe I didn't articulate my question. I'll upload a simple program later if necessary. Thank you.


  • Problems with tdms built executable; memory.cpp write error

    Hello

    I have a problem with writing tdms files in bed which executable, that I created with the Builder application in LabView 8.2.1.

    I created a small requesting readings some channels in the DAQmx. This schould results written in a PDM file. All this happens within a while loop, even the steps open-entry-closing-PDM.

    This test in the development environment everything is fine. But if I create an executable file and try this on the same and other computer, I received an error warning.

    The error that says: error on line 342, memory.cpp

    Is there anyone who has any idea what is the problem? What I have to insert something in the creation of PDM application designer?

    best looks, T.Malec

    The problem of TDMS is special to 8.20. However, you cannot run the executable with a new runtime, because the compiled code is not compatible between major releases (example: code compiled with 8.5.0 will run on 8.5.1, but not on 8.6.x).)

    Herbert

Maybe you are looking for