Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Modify CR1000 output


MarkV Mar 16, 2009 02:07 PM

Is there a way to mimic the old Array based format on the CR1000 so I will have one table with Mutple lines of output for each time stamp.

I am sampling 12 separate chambers and instead of having 12 Tables or all the data on one line I would like to have one table with 12 seperate lines of data. With the older dataloggers this was possible by giving each chamber its own output and arrayID.

Instead of something like this

101,2007,283,1004,4.125,13.97,26.16,77.9,23.61,77.7,.215
101,2007,283,1005,5.125,13.97,26.16,77.9,23.27,77.6,.223

I would like to do this

101,2007,283,1004,4.125
102,2007,283,1004,13.97
103,2007,283,1004,26.16
104,2007,283,1004,77.9
105,2007,283,1004,.215
101,2007,283,1005,5.125
102,2007,283,1005,...

Thanks,

Mark


jra Mar 17, 2009 03:43 PM

Hello Mark,

I was hoping someone else would step in with an elegant solution but I don't think there is one.

I'd say that what you want to do is possible but involves a number of steps. First you'll need a complex TriggerVar in your DataTable instruction. Include a sample of a chamber ID in each data record. Use LoggerNet to collect data in CSV format. Then.... use Split to rearrange the columns so your unique chamber ID is the first column.

Or... you could probably do the whole shebang in Split or a spreadsheet or database application. Use the file format you described as "instead of" and manipulate it to give you what you want.

Good luck.
Janet

* Last updated by: Janet on 3/17/2009 @ 9:43 AM *


Dana Mar 17, 2009 03:51 PM

Hmm... I think you could create a file like this by post-processing it with Split.

If you haven't saved the files using the LoggerNet output format of "array compatible CSV", then you'll want to look at the date() function that can be used to convert the table-based timestamp to look like an array-based timestamp (on the Select line in Split, press F1 and then click the Special Functions link.).

Next, create a PAR file in Split that has multiple Input Files (one for each of the table-data files you have). By default, Split has a tab for the first file -- add more files using Edit | Add Data File.

When you run Split, you would actually see the output for all of the files in one continuous record/line across the page. However, Split will allow you to put in some special characters on the select line, including a carriage return (see the Special Functions help again). So... after specifying the elements for the data on each file's Select line, you would enter a "crlf". For instance,

Input file 1's Select line (assuming there are 5 elements in each record):

1..5, crlf

Input file 2's Select line:

1..5, crlf

etc.

You can also format the select line as:

1,2,3,4,5,crlf

or

1,2,5, crlf (if you wanted to omit some of the data)

Once you've got the PAR file all set up, the execution of the PAR file can be automated by setting it up as a Task in LoggerNet's Task Manager (from the Toolbar's File Menu, choose Open | Tasks). Open the Help for the task master for a topic that provides information on setting up a Split task in the Task Master (toward the bottom of the topic, Example #1).

In your automated tasks, if you want Split to start reading the data files where it last left off processing (so you are processing only new data in the file), press the Offsets/Options button on the Input file tab and choose Last Count. Note that this works by seeking into the file to the last known byte position that was written to, so if the file size changes then it will just start from the top of the file (for instance, if you decided for some reason to delete some records from the top of the file so the file is now smaller than the last known write position). On the output tab you can choose to Overwrite the existing file, Append, or Create a New file name. You can also do some formatting to get a written report, or just choose the Comma file format for a comma delimited file.

Oh, you will also want to use the Time Syncing option on the Start condition so that if one of your data files is missing a record, or if they all do not start on the same date/time, blanks are inserted for the missing data rather than Split just melding the files together as is. Once again, check the Help :) Press F1 on the Start Condition line, and select Time-Sync Function | Synchronizing Two or More Data files.

I hope this helps point you in the right direction. I know it is a lot to set up, and the Split syntax can be challenging, but once the PAR file and Task are set up, you never have to think about it again :)

Dana W


MarkV Mar 19, 2009 01:54 PM

Thanks Janet and Dana. I was also hoping for and easy way do do it in the datalogger.

Oh, well I guess the database people can figure it out post processing part with Split or what ever they use:)

Thanks again. I like the Forum.

Mark


Dana Mar 19, 2009 10:16 PM

Hi Mark,

There are other ways to do it (probably several if you think about it). You could store all the data into one table, use the TableName.FieldName syntax (see help) to pull the data out of the first table for each chamber and concatenate it all into one string, and then sample each string back into a different table. For instance,

StringC1 = "101" + "," + Mytable.TimeStamp(1,1) + "," + Mytable.Chamber1Field1(1,1) + "," + MyTable.Chamber1Field2(1,1) + ...

(create a string for all 12 tables)

And then in a second data table, sample each string:

DataTable (Table,True,1000)
Sample (1,StringC1,String)
Sample (1,StringC2,String)
etc.

EndTable


This would result in the data table's standard quoted timestamp, plus the remaining values in a string. I don't know if your ingest program could deal with the string or not...

And yet another way -- use the tablename.fieldname syntax, and use the FileOpen/FileWrite functions to write the string to a file stored on the datalogger's USR drive (read help about USR drive, and on the File functions). This would eliminate the timestamp caused by storing the data into the second table.

Hope this helps. Oh, wait... Did you say easy? ;)

Dana

Log in or register to post/reply in the forum.