TCP/IP save to file

Post Reply
adam_roberts
Posts: 3
Joined: Mon Aug 15, 2005 5:20 pm
Location: University of Oxford, UK

TCP/IP save to file

Post by adam_roberts »

Hi, I've just started using Actiview.

I'm using the TCP/IP client on a second computer and I'm wanting to be able to save to file there. Can I just take the string information directly from the TCP/IP and write to file if I want it to be in the same format as the original BDF file on the first machine or will I have to use the 2D array and convert it somehow?

Thanks

Adam

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Post by Coen »

If you want to work with the BDF format (http://www.biosemi.com/faq/file_format.htm), it is best to use the 2D array. You will have to collect blocks of 1 second of data, and stream these to file. I recommend to copy the double buffered method used in ActiView (copy and paste the relevant sections of the diagram). In addition, you will have to build the BDF header. Again, you can use the code and subvi's from ActiView.

Best regards, Coen (BioSemi)

jrs
Posts: 8
Joined: Wed Jul 27, 2005 3:30 am

Post by jrs »

Where in actiview is the code to buffer one second of data?

I've traced it as far as Act_save_Jazz.vi which as far as I can figure just selects the relevant data thats needs saving and converts it to a format for saving - putting it in the BDF out buffer.

I've also found the case where data is written to the file and I understand the writting of the header etc - but I'm lost when trying to understand how 1 sec of data is selected, I see where the BDF buffer out is accessed to select which data to write, but it seems to me that the index used is always the blocksize?

And what is this concept of second helf?

thanks - James

jrs
Posts: 8
Joined: Wed Jul 27, 2005 3:30 am

Post by jrs »

Also being new to labview is there any easy way to select everything related to the buffering - it seems everything is spread all over the place and that it will be pretty tricky to select it all, or do I just have to go piece by piece?

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Post by Coen »

The BDF buffer is initialized with a length of exactly 2 seconds (e.g. 4096 columns when working on a sample rate of 2048 Hz). ActiView fills this buffer with data, in variable blocks (see viewtopic.php?t=29), while the index variable is used to keep track on where the most recent data is written in the BDF buffer. When the index reaches the end of the 2 sec buffer, storing of new data proceeds at the beginning of the buffer.

ActiView detects when the buffer index passes the zero (0 sec) and half-full (1 sec) points of the 2 second buffer. After such a pass, the relevant half of the buffer (1 second of data) is written to file. The first-half/second-half toggle ensures that the relevant half of the buffer is selected.

This "double-buffered" method ensures that no data points are lost: the program stores new data in the second half while the first half is written to file, and vise versa.

The function calls concerning writing of data in the ringbuffer are coupled by the "driver handle" variable (the process is visualized by the red pointer in the buffer clock). The subvi's concerning the reading of data from the ringbuffer are coupled by the "total buffered" and total displayed" variables (the process is visualized by the green pointer in the buffer clock). Following the data flow reveals the setup of the basic acquisition.

Best regards, Coen (BioSemi)

Post Reply