Data streaming

Hi, I'm trying to use labview to work with data in a very specific way.  I use a USB-6009 case import a continuous analogue signal in labview.  Then, I want to take this signal and jailbroken it down to perform calculations on.  Basically break it in a second segment 5, average of all the data, store the average, then repeat for 5-10 seconds, 10-15 and so on, to store all these averages (everything always seizes in the continuous signal).  I tried initially using the moving average smoothing function, but that was more than a moving average then taking the blocks.  I'm just starting to learn to labview, and I know that my data are acquired in a while loop and I am fairly certain that I'll have to write another loop within this segment and average data. I'm just wrong to put it all together.

Any help is very appreciated.

Kim,

The simple and direct way is to register offset on the while loop with playback. Use analog playback with output rather than waveform output array.  Add the new data table to the old array of data and it lead the shift register.  This works but requires LV to frequently re - allocate memory for the table space.  The licensing process can cause programs slow down or even crash because the table becomes very large.

A better way is to use the array to initialize to allocate space for diversity, you will use, and then use subset of table to replace inside the loop to put the data in the table.  The image below illustrates two methods. I used a model sinuses rather than the DAQmx Read VI because I do not have available DAQmx.

Lynn

Tags: NI Software

Similar Questions

  • Remove the first 5 blocks in a data stream

    Hi all

    I have a problem to remove the first 5 blocks in the data stream. My sampling rate is 1 s, block size is 1 and the entrance is the module «the ddf file read»

    I use the following modules for an average analysis 30 years running.

    [read the folder]---> [Formule1] -> [set variable] -> [formula2]

    |                 ^

    --> [time]-|

    module parameter

    ======                =========

    delay of 30

    Formula1 ${var_1} + in (0) - in (1)

    the value of variable ${var_1}

    Formula2 in (0) / 30

    This configuration is used for channels 13 and one of these channels is used for purposes of triggering. Due to the nature of the variable defined and read in the underlinedmodules, the trigger sequence is delayed for 2 sec. Since I used the trigger to collect the last returns average of each channel, it is now mixed with 2 sec for the next round.

    My question is: is there a way to reduce say 5 blocks of data from the stream? Please help and have a nice day

    Look at the SEPARATE module in the Group of data reduction.

    It allows you to set up an initial leap, then a current break.

    To do this, you want to jump 5 blocks once, does through go zero blocks... who spends the first five and then release all the data blocks of subsequence.

  • Digital acquisition of data streams

    Hello

    I tried (unsuccessfully) to acquire digital data of a sensor laboratory.  The Guide from the manufacturer:

    "When the excitement of voltage, DTC Decagon sensor makes a measurement.  Three measurement values are passed for about 140 ms of excitement to the data logger as a character of flow series of ASCII.  The series is 1200 asynchronous baud with 8 data bits, no parity and one stop bit.  The voltage levels are 0-3, 6V and logical levels are (low active) TTL.  The power must be removed and repeated his request for a new set of values to pass.  The ASCII data stream contains three numbers separated by spaces.  The first number is the depth of the water in mm, the second number is the temperature in degrees Celsius, with a resolution of 0.1 degree C, and the third number is the electrical conductivity in dS/m, with a resolution of 1 dS/m.  A carriage return follows the three digits, then the character ' t "", which indicates that it is a sensor DTC, and then a control character, and finally a carriage return and supply line. ' "

    My attached VI is a little dubious-it probably looks like something that someone used for analog signals may create.  However, I was hoping it would be enough of a starting point for a more wise to work with LabVIEWer.

    Thank you very much

    Lacksagoo

    The guide said in reality as a data acquisition card OR is the same as a data logger. I've never associated the two as being the same. What I think about a data logger is an autonomous instrument.

    Looking for a more details in your original post, the voltage levels are not standard. You may need a shifter level or need to find a USB-RS232 adapter for TTL levels.

  • network data stream

    Good afternoon

    I need to send the data generated in the vi, by network data stream.

    The problem is that I found no example that does something similar, and this is my first time using Activex with Labview. Can someone explain me how to send Activex data via the network stream please and if possible help me find a solution to the attached vi.

    I think I need to convert the data somehow after control of the room before using the writing and reading items, I tried with strings and arrays unsucessfully, I really think I'm missing something.

    Thank you in advance!

    Erika

    Erika,

    What do you think?  You try to play an .avi file, a .mpg or what?  IMAQdx has functions that can play video and output files 'images', and you can deliver these images via TCP/IP on another computer using network flow.  Indeed, there are cameras that capture video and output via TCP/IP - IMAQdx is used to capture the image directly from the camera and can view or save a file from .avi (for example).

    You have the Vision Module installed on your system?  In your Palette of block diagram, it will appear under the Vision and movement and should include IMAQ (or IMAQdx) and utilities of Vision (which contains the Palette under files to make the reads and writes of video files).  See if you can use this to display your video...

    Bob Schor

  • Create a data streaming from C++ stream and read it in LabView

    Hi all.

    I'm working on a project that is to connect to a tracker of movement and reading data of position and orientation of this in real time. The code to get the data is in c ++, so I decided that the best way to do it would be to create a c++ DLL that contains all the functions necessary to first connect to the device and it reads the data and use the node to call a library function to power the Labview data.

    I have a problem, because, ideally, I would like a continuous flow of data from the code c ++ in Labview, and I don't know how to do this. Put the node function of library call for a while loop seems like an obvious solution, but if I do it this way I'd have to reconnect to the device whenever I get the data, which is quite a bit too slow.

    So my question is, if I created c ++ function that creates a data stream, could I read that in Labview without continually having to call a function? I would rather have only to call a function once, and then read the data stream until a stop command is given.

    I'm using Labview 2010, version 10.0.

    Apologies if the question is badly worded, thank you very much for your help.

    Dave

    dr8086 wrote:

    This method resembles an excellent suggestion, but I have a few questions where I don't think I understood fully.

    I understand the basic principle is to use a call library function node to access a DLL that creates an instance of the device object and passes a pointer too in labview. Then a separate call library function node would pass this pointer to another DLL that could access the device object, update and read the data. This part could be in a while loop, then continue on reading the data until a stop command is given.

    That's all. I'm including some skeleton for example code. I am also including the code because I don't know how you experience multi threading so I show how you can use critical sections to avoid interactions between threads so that they do not lead to questions.

    // exported function to access the devices
    extern "C"  __declspec(dllexport) int __stdcall init(uintptr_t *ptrOut)
    {
        *ptrOut= (uintptr_t)new CDevice();
        return 0;
    }
    
    extern "C"  __declspec(dllexport) int __stdcall get_data(uintptr_t ptr, double vals[], int size)
    {
        return ((CDevice*)ptr)->get_data(vals, size);
    }
    
    extern "C"  __declspec(dllexport) int __stdcall close(uintptr_t ptr, double last_vals[], int size)
    {
        int r= ((CDevice*)ptr)->close();
        ((CDevice*)ptr)->get_data(last_vals, size);
        delete (CDevice*)ptr;
        return r;
    }
    
    // h file
    // Represents a device
    class CDevice
    {
    public:
        virtual ~CDevice();
        int init();
        int get_data(double vals[], int size);
        int close();
    
        // only called by new thread
        int ThreadProc();
    
    private:
        CRITICAL_SECTION    rBufferSafe;    // Needed for thread saftey
        vhtTrackerEmulator *tracker;
        HANDLE              hThread;
        double              buffer[500];
        int                 buffer_used;
        bool                done;       // this HAS to be protected by critical section since 2 threads access it. Use a get/set method with critical sections inside
    }
    
    //cpp file
    
    DWORD WINAPI DeviceProc(LPVOID lpParam)
    {
        ((CDevice*)lpParam)->ThreadProc();      // Call the function to do the work
        return 0;
    }
    
    CDevice::~CDevice()
    {
        DeleteCriticalSection(&rBufferSafe);
    }
    
    int CDevice::init()
    {
        tracker = new vhtTrackerEmulator();
        InitializeCriticalSection(&rBufferSafe);
        buffer_used= 0;
        done= false;
        hThread = CreateThread(NULL, 0, DeviceProc, this, 0, NULL); // this thread will now be saving data to an internal buffer
        return 0;
    }
    
    int CDevice::get_data(double vals[], int size)
    {
        EnterCriticalSection(&rBufferSafe);
        if (vals)   // provides a way to get the current used buffer size
        {
            memcpy(vals, buffer, min(size, buffer_used));
            int len= min(size, buffer_used);
            buffer_used= 0;                 // Whatever wasn't read is erased
        } else  // just return the buffer size
            int len= buffer_used;
        LeaveCriticalSection(&rBufferSafe);
        return len;
    }
    
    int CDevice::close()
    {
        done= true;
        WaitForSingleObject(hThread, INFINITE); // handle timeouts etc.
        delete tracker;
        tracker= NULL;
        return 0;
    }
    
    int CDevice::ThreadProc()
    {
        while (!bdone)
        {
            tracker->update();
            EnterCriticalSection(&rBufferSafe);
            if (buffer_used<500)
                buffer[buffer_used++]= tracker->getRawData(0);
            LeaveCriticalSection(&rBufferSafe);
            Sleep(100);
        }
        return 0;
    }
    

    dr8086 wrote:

    My main concern is that the object can get out of memory or be deallocated since it would not take place to any namespace or whatever it is.

    As you create the object with the new, the object expire not until the dll is unloaded or the process (LabVIEW) closes. If the object will remain valid between condition LabVIEW dll calls not a not unload the dll (who does if the screws are closed). When that happens, I don't know exactly what happens to the active objects (that is, if you forgot to call close), I guess the system recovers the memory, but the device could still be opened.

    What to do to make sure that everything is closed when the dll before I could call unloads close and remove the object is whenever I create a new object in the dll that I add to a list when the dll is unloaded, if the object is still on the list, that I'm deleting it.

    dr8086 wrote:

    I also have a more general question of programming on the purpose of the buffer. The buffer would essentially be a large table of position values, which are stored until they can be read in the rest of the VI?

    Yes, see the code example.

    However, according to the frequency with which you need to collect data from the device you have this buffer at all. That is, if take you a sample on every 100ms, then you can remove all threads and buffer related functions and instead to read data from the read feature itself like this:

    double CDevice::get_data()
    {
        tracker->update();
        return tracker->getRawData(0);
    }
    

    Because you need only a buffer and a separate if thread you collect data at a high frequency and you can not lose any data.

    Matt

  • Unable to read the security descriptors data stream

    Whenever I start my computer runs CHKDSK - it says checking file system on E: and then he said that it should be checked for consistency. It works until stage 3 when he says 'impossible to read the security descriptors data stream' how to fix this?

    I tried chkdsk e:/r and it runs before step 3 when I get the "unable to read the security descriptors data stream" and it goes no further.

    I also tried fsutil dirty query e:- but it says something about a parameter incorrect and not if the volume is dirty or clean.

    Then I tried chkdsk e:/f/x - that always gives me the same mistake about it being an incorrect setting.

    As far as I know there is absolutely nothing on E:, I didn't even know that there was an additional drive. Right now I have it turned off so that I can use my computer. It seems to work fine without it. I read an article that said that if I can't fix e: with chkdsk which I have to do a low-level format of the reader? What's my next step? And I can do without the XP disc?

    The syntax

    fsutil dirty query e:

    is correct (except, of course, you try to use from the Recovery Console, where the fsutil command is not available).  Are you logged on as a user with administrative rights when you use fsutil?

    Similarly, the switches /f and/x are not available for chkdsk in the Recovery Console.

    See Recovery Console controls.

    Click on desktop then right-click on E: drive icon and select Properties.  What is indicated for:

    • File system
    • Space used
    • Free space
    • Capacity

    Now double click the icon for E: are shown files?  If not, click Tools > Folder Options > view and select the radio button "Show hidden files and folders" and uncheck "Hide protected files (recommended) operating system.  Now that you see all the files?

    Everything you read 'low level of shaped' is nonsense.  Any modern PC drive cannot be low level formatted by end users.  You can read this, but there is really no necessary even to "zero fill" your drive E: http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=203931 (I have not checked to see if the WD tools rescuer has similar characteristics to SeaTools for DOS).

    If you are convinced that there is nothing of value on E (for example, installation of backup or restore), you can either format by right-clicking on the drive icon in my computer and selecting "format" or you can start disk management as described previously and use either in electronic format or delete the partition completely.  If you delete the partition, space becomes "unallocated".

    Because I guess C is your system drive (where Windows is), you may be able to use the diskpart tool to extend the partition F to use the unallocated space left if you decide to remove E well it's much easier (and safer) to do with disk management third-party tools such as Easeus Partition Manager free : http://www.partition-tool.com/personal.htm

  • Example of reference for PCIe Data Streaming double 6537 s disc

    Hello world

    I have successfully changed the example of reference for streaming ( http://zone.ni.com/devzone/cda/epd/p/id/5315 ) for the card PCIe-6537 UNIQUE and able to write to the clock speed of 20 M (at end of initial test) without any error.

    However, I don't know how to view the *.bin file to check whether I wrote the right data. I saw an example VI called 'read the binary '. However, it is said "File already open" and gives a GPIB controller error (very odd). Should I try using MatLab? I doubt that this will help because it seems that the file write VI does not close the file correctly.

    I have attached the updated UNIQUE PCIe-6537 source code and the file with this post error. There are file support as well for writing file window live

    I'm the kind of new acquisition continuously and at high speed. Please let me know if I'm missing something. Thanks in advance.

    See you soon,.

    YK

    I have a few links you can go to more resources continuous here and here.

    The original question, you have posted using binary VI reading won't be able to because of the memory.  You can read more small segments of the file and keep the file intact.  There are a number entry that indicates the number of data items are returned by the function.  If you want to save multiple files, you can use any looping function to make it work, just set the condition to find out how much time and when to stop.  I don't know of a quick example that does this.  You read again all the data, but given that the readings are in small pieces, it will help the issue given that the data are not need a large space contiguous memory to reside in during playback.

    Data compression would be more than a post processing step rather than a step continuously, and it can slow down your stream if you were writing at the same time after your reading.  In producer/consumer architecture, you could read in the data and compress it before the record in a file, which would not affect the performance of your reading, it forms the data and create a file that is smaller and takes less space in memory.

  • NTFS alternate data stream

    Hello:

    I am trying to write a code that works with other data in NTSF streams. Similar to this Microsoft makes This example . The attached VI is a simple example of code - open the second stream "metadata" and write something. However, open them VI LabVIEW (2009 SP1) always returns error when I try to open the stream.

    So, he knows that LabVIEW (at least 2009) does not work with NTFS streams? If possible, please tell me how.

    Thank you

    -Ilya.

    Ilya,

    I agree - ADS is tantalizing close to a very elegant solution.  I hadn't really looked at their use for something useful - I always considered them a breach of security and a hold-over of formerly Mac resource fork.

    Another suggestion that may or may not work for you:

    Have you looked into the TDMS files?  They were designed to be a solution to this type of problem - if you don't have to sacrifice performance for convenience to keep everything together metadata is stored with the binary data.  I think that how LabVIEW implements TDMS read and write is faster that in general, you would be able to achieve since we are able to bypass some of the regular windows caching etc.  TDMS is not specific to LabVIEW but to be able to open files in Excel or offline like DIAdem analysis tools.

    You can find more info about TDMS here if you're interested - http://zone.ni.com/devzone/cda/tut/p/id/3727

    In any case, good luck.

    ~ Simon

  • Removal of Alternate data stream (ADS) does not update the time stamp of the file.

    I use the standard CL program stream.exe for the operation of the ads on file.

    If I add your ADS in a file, data\time file will be changed.

    F:\>dir
    23/07/2014 test.txt 32 768 18:43

    F:\>stream cr test.txt:0 important_info
    SUCCESS: tf1.txt:0 is created.

    RC = 0

    F:\>dir
    30/07/2014 tf1.txt 32 768 19:11

    If I remove ADS from file, the data\time file will be unchanged.

    F:\>dir
    30/07/2014 tf1.txt 32 768 19:11

    Tf1.txt:0 F:\>stream
    SUCCESS: tf1.txt:0 is deleted.

    RC = 0

    F:\>dir
    30/07/2014 tf1.txt 32 768 19:11

    Is this a normal behavior? I suspect a defect of stream.exe.

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • 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 build a table using incoming data stream?

    I'm programming in VBAI but use LV as my Interface of Inspection. The VBAI program will go into a finite loop (x 1000) and the digital indicator with dbl vaule of food in front of the LV Panel if the value double is in order.

    In LV, how to build a table (index 0-999) with this stream?


  • creating a table 1 d of data streaming

    I have 1 item read 10 times per second and I'm trying to figure out how I can make a table 1 d of these data to data from 5 min and once it is full, I would like to than the old data to be replaced by new data.

    Can I get some ideas on how to do this? I'm relatively new to labview.

    Thanks for the help.

    Use a queue. Set the length of the queue to 3000, then use the function of the element of queue with loss to put the latest data at the end. The oldest item is removed, so "service" of the queue is faster that data arrives.

    Maintenance is a fancy way to say use "Élément Dequeue" and do something with the data; write to a file, add a chart, do any calcluation, etc...

    Depending on the item of queue with loss

  • Input data streams API, readFully()

    Hi all

    I was going through the javadoc for the API for the DataInput stream 4.5 in the Java.io package.

    Looking at the readFully methods, they claim that:

    See the general contract of the readFully  method of DataInput.
    

    I want to know what this means because I am currently using this method to read a DataInputStream in a byteArray and get an EOFException.

    I want to know how to use this method, what are its contractual agreement which the

    «See the general contract of the method of DataInput readFully "means.»

    Anyhelp would be appreciated here,

    Thank you

    Dan

    No problem.. It turns out that the DataInput was in fact an Interface within a single package

    If the contract methods readFully is clearly stated in the DataInput interface.

    Thanks for any answers that were typed!

  • Two discounts on the same data stream

    I have two cuts (average and stdev). I can one of them passes over a stream. But if I need to run two discounts on the same stream, how can it be done?

    You cannot use a collector downstream with collectingAndThen()?

  • OSMF with HTTP data stream search resets the starting index...

    Hello

    I built an OSMF player that allows users to get to where they were during the recovery, but also to rub at the beginning.

    FOR EXAMPLE:

    A flow is 1 minute.

    The user starts playing in 25 seconds.

    The user can rub-5 seconds or transmit to 55 seconds.

    It works perfectly with RTMP - TimeTrait reports correctly and video is displayed correctly.

    FOR EXAMPLE:

    Start at 25 seconds, TimeTrait reports: duration = 60, current position = 25 and video display is 25.

    Seek to rewinds 5 seconds to the current duration = 60, position = 5, video display is 5.

    But...

    With the HTTP stream...

    Start at 25 seconds. TimeTrait reports: duration = 60, current position = 25 and video display is 50.

    Search rewinds 5 seconds before the beginning of the stream and give me a media full... end of the stream.

    Start at 30 seconds, TimeTrait reports length = 60, current position = 30 and the video display is 60 Yes give me a media full... end of the stream.

    It is quite clear that what is happening is that search HTTP stream reset my starting index to the point of looking as if I had started to play with:

    NetStream.play (seekPoint);

    Rather than:

    NetStream.play();

    NetStream.seek (seekPoint);

    This, I hasten to add, is a terrible problem from the point of view of my client because it means actually I can't resume content.

    Does anyone have ideas, workarounds?

    G

    After digging in OSMF code I found a SOLUTION:

    First of all, make sure you have the latest OSMF source inside your project.

    For now it is 2.0.71 (org.osmf.utils.Version).

    Go to org.osmf.net.httpstreaming.HTTPNetStream

    and make a few changes:

    1 change the line # 1441

    _initialTime = _dvrInfo! = null? _dvrInfo.StartTime: currentTime;

    TO

    _initialTime = _dvrInfo! = null? _dvrInfo.StartTime: (_seekTime > 0? _playStart: currentTime);

    2. change the line # 1496

    _initialTime = currentTime

    TO

    _initialTime = _seekTime > 0? _playStart: currentTime

    That's all!

    Now you can listen to MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE event

    and immediately.

    By the way: If you're going to find all the bugs related to this change feel free to post them here!

Maybe you are looking for

  • Cannot access internet on my Toshiba laptop

    Hi can someone help. I can't access the internet on my laptop.This happened recently that I was working online when my battery was flat. Severance pay I was not able to get access. I can still receive updates.I even tried using another browser, nothi

  • Wireless does not. model wndr3700v2

    We have this router and this is the kind of old... 2011 model wndr3700v2. We have never had any problems with it until tonight. It says 'unavailable internet for netgear' my phone connects to the internet, but a few seconds later, it says not availab

  • Properties of display-activating a second monitor

    Display properties show two adapters present as '1 '.  How can I get my laptop monitor showing as only and my external display 2?  Actaully 2 shows, but "is not enabled.  I do not have the correct driver installed for the second monitor and system ac

  • Can I add narration to a slide show?

    I have Vista Home Premium. I burned a disc of photos and to add narration to a slide show. Can I do it?

  • Desktop Pavilion a6750f does not recognize Realtek NIC card in Vista 64

    I have a Pavilion a6750f desktop that had a hard drive failure. I bought a new drive and installed Vista 64, but I can't get internet connection! It does not recognize Realtek RTL 8111 (I think, memory - I'm at work) NETWORK adapter in Device Manager