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

Tags: NI Software

Similar Questions

  • First Audio interpretation is a track with multiple channels.

    We have 4 audio channels, sometimes 5 or 6 channels (component of integrated audio system, LAV, ramps, etc.). All these channels are in a wav file.

    I want that first pro to interpret these data so that it uses only ONE piece on the timeline, with all the channels that have been heard in this track.

    I watched this tutorial, thinking that it would:

    http://TV.Adobe.com/watch/short-and-suite/mapping-audio-channels-in-premier...

    However, for some reason I can't find an option to do what I want. Did I miss something in the window change Audio channels? I can set the number of tracks to 1, however, it does not allow several channels...

    Now, if this IS possible... Can I still change each channel individually in first?

    I appreciate your response and your knowledge.

    Thank you.


    Sorry, I couldn't find a post edit...

    But this post saved my life, for all who have had the same question!

    Dealing with multiple audio channels in a track: Adobe Premiere Pro

  • Sampling of multiple channels on the same frequency

    I have some problems to understand how to configure my cDAQ chassis.  I have a work labview program that should (I guess it doesn't!) sample 5 channels at 5 Hz each channel.  When I got the system data each analog channel (all in the same spot) resembles a ~1.xx Hz sampling.

    I created my task to taste 3 analogue to 5 Hz, 1 sample per channel.  It gives me a sample rate effectiveness of sample of 1,666 Hz per channel?  That's what seem to tell me my data.

    If the above is true, change my task to make a sample 3 channels at 15 Hz, 1 sample per channel will give me a sampling rate of efficiency of 5 Hz per channel?

    The other 2 channels are digital and on another task and appear to be working (fingers crossed!)

    Thank you and happy holidays.

    Kyle

    I can post code if this confusing issue.


  • create file csv with multiple channels

    I am writing a program that uses the Keithley 705 scaner and 580 ohms meter. What I have to do is to create an excel file that contains a timestamp to MM/DD/YYYY HH: mmS as a column, then a new column for each channel (1 to 10 in the case of the keithley 705). Each channel column will contain reading the resistance of this specific at the parking meter channel. The timastamp should do when the first analysis was performed; for example if one scans the channels 1 and 2, their resistance values will be associated with the same timestamp.

    My question is how can I format it as an excel file.

    Answer your original query
    Set the number of channels (1-10)
    Organize your table value to it form the first column with timestamp and treatment of channel values, then write in the chain of worksheet
    You can include the header for your nominale1

  • Multi-channel acquisition - simultaneous Acquisition of sampling 1 & 2-channel single sample in a task

    I am able to get a multichannel simultaneous sampling on my acquisition of data (USB-6363) without problem. But what I want to do is make multi-channel acquisition in a single task where sampling requirements are different for each channel. For example, I want I want to acquire a total of 1000 samples on 3 channels in a single task with DAQmx as follows the characteristics of sample:

    • AI0: Analog Wfm 1Chan NSamp (998 samples)
    • AI1 + ai2: 1 d analog NChan DBL 1Samp (1 + 1 sample/channel)

    I know I could do just a regular multiple sampling multi-channel acquisition through all three channels then average down from channels 1 + 2, but I don't have that several samples to spare. AI0 is a bandwidth hog in my application and consumes all the samples of data acquisition (2. MECH / s), but I can save a few samples to make analog measurements further (for example, temperature, pressure).

    Ai0 takes place also permanently so additional analog measures on ai1 + ai2 need to be included in the same task.

    I don't know how to go on this matter or if it is still possible. Any ideas or thoughts would be greatly appreciated.

    Currently I use a second DAQ to read these additional channels at a lower rate but I need to pass a single data acquisition.

    How should continuous ai0 really be?  You of course can enjoy on ai0, and one of the other entries at the same time, then there would be some gap in your data.  In addition, if you want to go to the full 2 MHz, you may sample ai1 ai2 twice in order to allow entry to set (the maximum specified multi-channel rate is only 1 MHz due to compaction of the constraints on the MUX I believe).

    DAQmx sort of you lets set something up like that, if you "cheat" it by configuring each sample as a single channel in your task (see an example similar here).  If your 998 + 1 + 1 (or 996 + 2 + 2) becomes a task of channel 1000 (takes a bit more memory, but should still be feasible).

    I would consider a 2nd DAQ card a better option if ai0 really needs to be continuous.  You can go with a (9174 or 9178) cDAQ chassis a 9223 (only 1 MHz if) for quick entry and your choice of module for the slower entries.  On the cDAQ chassis a module can run a separate task of AI from other modules (up to 3 tasks HAVE by chassis) at different speeds.

    Best regards

  • Replace negative values in multiple channels with "0'.

    Hello

    I'm calculating and then by creating a cumulative channel, multiple channels. Negative values in these channels aren't necessary, and I need a nice way to replace each negative value in these channels with a value of '0'.

    My current code is:

    Do
    Do
    If Data.Root.ChannelGroups (2). Channels (i). Values (II)< 0="" then="" data.root.channelgroups(2).channels(i).values(ii)="0    ">
    II = ii + 1
    Loop until the second > Data.Root.ChannelGroups (2). Channels (i). Properties ("length"). Value
    II = 1
    i = i + 1
    Loop until I > Data.Root.ChannelGroups (2). Channels.Count

    It works, but I don't like. He adds a few seconds when running my script, which was almost instantly. Is there a better way to do it?

    Thank you.

    Hello Kevin,

    The fastest way to go through a channel and check the values less than or equal to 0 is through the canal's calculator. The code below takes all the channel first channel group (with the exception of the first string that is be the weather channel in my example data set) and replaces the values<0 with="" 0="" through="" the="" iif="">

    Set Group = Data.Root.ChannelGroups (1)
    iMax = Group.Channels.Count
    FOR i = 2 to iMax
    Adjust the strings = Group.Channels (i)
    Formula = "= IIF (y '.<0, 0,="">
    Call to calculate (formula, Array("y"), Array (Channel))
    NEXT ' I

    In this example we overwrite the existing values of data channel with 0, but you can also copy the channels to make sure that your raw data is available.

    The calculator of channel is extremely fast for this type of operation because it does not create a loop to go if each line separately and check the values he...

    I hope this is useful,

    Otmar

  • TDMS multiple channels, frequencies of different sampling

    I'm developing an application c ++ under Windows 7, which must record the sensor data acquired on the disc. The data consists of approximately 1 500 channels sampled at rates that vary between 100 samples/s and 1 sample/s with data types which could include the floating, whole, decimal point fixed and boolean. We need log on without interruption for hours at a time. In the past, my company has used LabWindows/CVI to write TDMS files for this kind of application, but the number of channels has always been much lower and all channels, we sampled at the same rate. I was instructed to use the LabWindows/CVI/PDM solution for this new effort, but I have concerns about the way in which it will occur in the conditions I described above. My questions:

    * It OR application notes dealing with best practices for recording several channels of data sampled at different rates for TDMS with LabWindows/CVI files?

    * Are there performance indicators which show the capablities and the limitations of LabWindows/CVI/PDM in conditions similar to those I describe?

    * Someone here any experience – positive or negative – with TDMS in a similar application which they can share?

    TIA

    Hugh

    I had an Exchange offline with Technical Support OR on this subject and received the following guidelines, which I consider the Gospel:

    You should be able to connect to TDMS in CVI for your strings from 1500 to different rhythms without problem provided that your computer has enough memory.  You can set up groups and with 1500 channels you should probably, in the interest of the Organization, but it is not necessary to create groups to limit the number of different sampling frequencies.  Alternatively, you can generate different files to separate data, which are also recommended, but not necssary, based on your preference for the organization rather than the need for the maintenance of sampling together in the same file.  TDMS supports asynchronous writing, so you should be able to connect different channels at different rates for the same file without errors in access to the files or something like that.   One thing, you might encounter is slowing a lot of simultaneous writing.  I found this example of community which shows how to write data to disk faster using the advanced TDMS API.  Please visit the following link: LabWindows/CVI Tip: write data to the disk faster with TDMS Advanced API https://decibel.ni.com/content/docs/DOC-33401

  • Dedicated for each channel from multiple channels in a single task task disadvantage

    Hello

    My current acquisition software (C + c++ / GCC) encapsulates the methods rather clumsy niDAQmx C to interface with the data acquisition equipment in a class that represents a task of acquisition. This way I can create several instances, for example counter input, analog input, analog output, their terminals and the class supports all work low level as ensuring input analog fake internal is started if there are only counter entries such as the sample clock starts, or configure reminders N-sample, etc.

    It seems to work very well, and also the time seems to be good, because first of all the tasks on multiple instances of my wrapper. For triggered early, that I use

    DAQmxCfgDigEdgeStartTrig(mTask,mTriggerTerminal.toAscii().constData(),DAQmx_Val_Rising)

    in-house.

    Now my real question: what is the advantage of multiple channels, when everything seems to work fine with multiple tasks and only one channel per task? I don't see the disadvantage, it would first classify necessary acquisitions in types (I, ao,...) because several strings in a single task must be of the same type. With my approach I need not care because each channel still gets its own task.

    I don't know I'm missing something here. Maybe someone can explain it to me, maybe some limitation of multi-tasking, I have not yet read.

    Hey!

    Unless you specified for managing the it (simultaneous sampling) or modular instruments and hardware devices (see link )

    You cannot perform two tasks at the same time that access to the analog inputs, for example, because the

    ADC is a shared resource that is connected to a multiplexer, and that only one task can work in it at a time given. (see here )

    Similar restrictions often apply to other types of operations.

    I'm not aware of any performance issues, perhaps a little more memory could be used.

    So as long as your hardware supports what you are doing, you should be ok, I think,

    and it is only a question of clarity and intelligibility, ease of use and structure.

    As you use classes, I'm sure you've heard about encapsulation - so it is a

    question of how you want to design your application.

    In addition, when you work in LabVIEW, tasks feel more natural to the principle of data flow, because you have a thread for your data acquisition,

    and it works very well with our modes of standard design.

    So, if it is better for you (and works with the hardware), you can give all the channels its own task.

    Hopefully this might clarify some things,

    Kind regards

    Rome

    OR Germany

  • DAQmx showing not readings to multiple channels

    Hello

    I am trying to acquire values of temperature of 3 consecutive using a task DAQmx channel as shown in the attached photo.

    I have a loop of producer-consumer for fast reading and writing samples in a file.

    To specify the channels, I typed in the box connected to a terminal of "physical channel" (not shown in picture) as follows:-SC1Mod2 / ai2:4.  This is to acquire a reading of analog channels 2, 3 and 4. The program must then write a file reading on channel 3.

    The code works perfectly if I purchase samples of 1 channel only.

    When I try to acquire multiple channels, I don't see readings on one of the task of acquiring Wired Digital indicators.

    I would appreciate your input on what might be wrong with the code.

    Thank you.

    kumv10 wrote:

    The broken wire seen in the photo is the result of adding more channels to the task of acquiring.  I managed to get around this by specifying a different, but even with an intact wire data type, the program is not displayed readings since the 2 remaining channels.

    Instead of use for dynamic data Type, then the channels Split, just use an array of Index to get your three values.

  • Generation of series in multiple channels

    Hi forum, I need to ask a few questions. Any help is appreciated.

    (1) I need help with the generation dynamic series in several channels. Here, we can see how the dynamic data set generated by a single channel. But I can't find anywhere, how to generate several series signals in multiple channels.

    (2) what is the limit for this generation series? I think it depends on the material, but I don't know, what is the limit. My hardware is SMU-6544.

    (3) it is possible to generate different signals in different channels using scripts? and to start the production in these channels at the same time? the example given in the script generation labview is unfortunately only for the generation of a channel.

    Thanks in advance,

    Kind regards

    Yan.

    Hi Yan,

    Produce on several channels with multiple data is difficult without a tool to view the data, or series of each channel bitstream concatenated into a software ADE and transposed before be downloaded into memory.  To make Visual things here, I'll assume that you want to generate a pattern of 3 bits on sample of channels 0, 1 and 2 is 8 wide.  Assume the following models of the series bit for each channel:

    ch 0: 0101 1010

    CH 1: 0000 1111

    CH 2:0100 1101

    So the question now is, how do you load this in the SMU-6544(or any other HSDIO hardware)?  Of the two options, you can use Digital Waveform Editor (NEWS) to create visually and save to a file type HWS then load a DJ using the API HSDIO.  It is the easiest in my opinion.

    The second way is construction examples of data based on a basic example.  I want to say is you take it all binary streams and built a 2D table so that it looks like:

    01011010

    00001111

    01001101

    An array of 3 x 8 and then transpose the table that turns into:

    000

    101

    000

    100

    111

    011

    110

    011

    Here you can see we have 8 lines, each line is a sample, and in the form of U32 read in decimal, you get 0, 5, 0, 4, 7, 3, 6, 3.  That's what you can load into our niHSDIO U32 function write a waveform.  I hope you can see how this translation occurs and how it looks like in terms of load on the jury.  Each sample usually contains data for all channels, where each bit in the U32 is one of the 32 channels available on your device.  So if you want to write a '1' on Channel 5, you would load a value of 0000 0000 0000 0000 0000 0000 0010 0000 in the form of sample, where the 5th bit is 1 and all the other bits 0.  In decimal, you would write '32' value.

    With regard to the limitation of the size of series, if your flow rate is slow enough you can disseminate and make an almost endless stream, but assuming that you are running at the maximum rate, your series of waveform size is limited by the size of your on-board memory.  Since each sample generation is 32-bit, which is 4 bytes for example, if a memory size of 32 MB will correspond to 8MS bitstream series max.

    For any questions or comments are welcome.  Thank you.

  • Effectively change the continuous sample mode sample mode finished

    9188 chassis, modules (HAVE them), 9 of Labview

    I want to acquire continually (and display) given at a fast rate to date, and then when a 'trigger arms' State is detected, the switch to finished hardware, triggered task with pre-trigger samples with a minimum loss of perceived as update rate.

    What is the best way to do

    Thank you

    Collin

    I started my answer a long time ago while waiting for a reboot and am just finally getting back to it.  I see that you got another another answer in the meantime.  On the outbreak of reference, here is another link that might help some: Acq suite w / Ref Trig

    I did have not tinkered with reference trigger a lot, so not sure what is meant in the link above about the task being an acquisition over 'the end'.  Maybe the task continues to fill the buffer just before there about to overwrite the first sample of pre-trigger?

    In any case, my original thought the whole thing was on another track.  If the trigger Ref works for you, it'll be easier.   But if Ref trigger causes the acquisition of stop * and * you really need to keep it going permanently, then consider the things below:

    -------------------------------------------------------------------------------------------

    Passage of the continuous sampling done will require the judgment and the reprogramming of your task, and you will have a 'blind spot' of data loss, while what is happening.

    An approach that I think is to stick to a sampling WAS continuous, but also set up a counter task that can count it HAVE examples of clock and capture on the trigger signal.  The captured value of count will be HAVE it taste # when the trigger has occurred, and then easily post-process you your data HAVE to find the subset that represents your data before and after the desired trigger.

    Here is an excerpt of what I mean 2012:

    -Kevin P

  • Problem of continuous sampling

    I'm having a problem when showing my rate for samples using Labview with an accelerometer (acquisition mode: continuous). For example: I indicate a rate of 1000 hz that should output 1000 samples per second. However, when I export to excel, the number of samples per second is 2000. It seems that the data is collected twice faster. Also, my reading rate is configured to be the same as my rate. Any advice would be much appreciated. Thank you!

    Now, I see that you use cDAQ. If it's the 9234, sampling frequency minimum as you can see in the specs is 1.652 kech. / s.

  • How do switch you between multiple channels to indicate which channel to acquire the data from?

    I'm trying to builld a VI where I can have an option to enable or DISABLE multiple channels depending on the modules plugged into the chassis and then acquires the data of the channels which are turned on and where other acquisition parameters do not change. Is there any specific/switch where can I do this? Please answer as soon as possible. Its quite urgent. Thank you

    You use DAQmx?  To change the assignment of the data acquisition channels, you must close the currently open session and then create a new session with the new channel definition.  So the order of execution:

    Create task or virtual channel - read - clear task of triggering and synchronization of the configuration - set new channel list and to create a task - read - clear task, etc...

  • Selective sampling of multiple thermocouples

    I am using a chassis cRIO 4 to sample and record up to 64 thermocouples.  Right now I can only sample the whole 64 channel set, but my desired product is a program that can taste and record any subset of thermocouples, selected by the user from the front panel.  The best with what I came is using controls Boolean to enable the output of the unselected channels '0' and a series of LED next to the chart legend to indicate which channels record the true values and recording '0 '.  I want to use Boolean controls to avoid that the registration to all deselected channels program.  I have attached a few photos of my program.  The first is part of my function of data acquisition, which takes the value of each thermocouple and places it in a table to draw on the graph and save. PDM file.  The second is a part of the chain of function name, which combines the names in a table for the. TDMS file and sends each name to an indicator beside the chart legend.  The third shows the chart, with all channels unchecked and without name.  Does anyone have any ideas how I can do this more easily extensible program from the front panel?

    I'd work with arrays and clusters instead of use explicitly each channel name, etc..

    See my sample code attached.  It is very simple, but should give you some ideas.

  • Continuous sampling method get unreasonable values

    Here to measure the amplitude of a signal as Attaché of the 'Ori.jpg' file, if you use the method of samples N (1 k samples, rate of 239kHz) for the acquisition of data, the result was perfect in the file '1k_N.jpg '. But the speed was too slow.

    Although the method of sampling performed much more quickly, continuous values were not usable. As files "1k_continuous.jpg". Do not know what is causing these outliers, and he only appeared occasionally. The 10.5537 should be the maxmum reading value of NI 6361.

    BTW, is - this impossible to accelerate the sampling method N? Even tried 20 samples instead of 1000, the loop still cost of similar duration. Data acquisition was not stopped in each loop.

    Helps decrease the time of N sampling or taking good readings from continuous sampling method are greatly appreciated.

    PEM

    In the version N-samples the DAQ Assistant acquires only 200 samples whenever it is called and it returns oll of them. In the continuous version samples sample are acquired in the 59000 per second, they are returned to the main program or read or not. Yes, at a rate of 20 ms per iteration about loop 900 new samples are acquired than read at each iteration.

    When an error occurs the DAQ Assistant, stops the task and Unreserves it. The next time the loop runs through the DAQ hardware to reconfigure. I have no way of knowing with certainty, but it is possible that some false values enter the buffer during the shutdown process / reconfigure.

    Lynn

Maybe you are looking for

  • Can't steam photos

    I set up iTunes to share House and selected a file photo for dissemination. Have configured Apple TV for home sharing. When I click on the computer icon Apple TV it says "access iTunes library, activate sharing home on your computer and use the ID (e

  • How can I get the history feature to show the story today?

    When I open the history window, it shows yesterday and beyond, but never the story todayI'm using version 34.0.5 on a new computer with windows 8.1

  • HP Officejet Pro 8500: Pro 8500 has only scan full page

    Hello, for some reason, my scanner is missing at the bottom 2 inches of the page when I scann sheet A4.

  • I can't install the drivers in Windows 8

    I installed Windows 8 Developer preview but I can't install the drivers, even in compatibility mode. They were fully compatible with Windows 7. It's really disturbing, because I can not connect to the Internet and to develop applications.

  • Sansa Fuze and Fedora 11 and Banshee (linux)

    OK I use Fedora 11, I loaded the Banshee on my system I can convert songs on my player. I can't convert videos on my player so I can watch videos and movies?  What can I use to coincide with the Sansa fuze using Fedora 11? or would that be a wrong fo