Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 9 Data Logging and Exporting

9.8 Logging / Export Set Functions

Scroll Prev Top Next More

Logging and export sets have variables and functions that allow programmatic access.  Most of the variables match directly with parameters in the logging set and export set views.  All are accessed using either Logging.LoggingSetName. or Export.ExportSetName. .  You can optionally specify a connection name in front of this, ConnectionName.Logging.LoggingSetName. . If the logging or export set is running, changing most parameters will take immediate effect.

Variables:

strLoggingMethod: a string, either "ASCII Delimited", "ODBC Database", "Binary - 64 bit floating point", "Binary - 32 bit floating point", or "Binary - 32 bit unsigned integers".  This should not be changed while the set is running or unpredictable results will occur.

strFileName: changing the file name while the logging or export set is running will close the current file and open the new file.

Application: if you are logging batch data and wish to start logging to a different file, simply set this variable to your new file name.  For example: Logging.LoggingSetName.FileName = "c:\newfile"

strTableName: changing the table name while the logging or export set is running will switch logging to the new table, creating it if necessary.

AlignMismatchEmpty: 0 or 1

AlignThreshold: numeric in seconds

AutoSplit: 0 or 1

DataFileSize: numeric in rows

ExcelTime: 0 or 1

IncludeAllTime: 0 or 1

IncludeHeaders: 0 or 1

strDelimiter: a string

LoggingAllValues: 0 or 1

OverwriteExisting: 0 or 1.  Not an option in the logging set view, but can be forced to 1 programmatically for logging sets.

RefreshRate: numeric in seconds.  Determines how often the set writes buffered data.  This should be 0 for export sets otherwise the export set will repeat the export at the given rate.  For logging sets this defaults to 1.

Snapshot: 0 or 1

TimeOffset: this value is added to the time columns in the logging set.  This is used when working with some versions of MS SQL databases.  DAQFactory can use the time standard of Excel and Access, and for some reason, when using this format with MS SQL the time is offset by two days.  Apparently a bug in MS SQL.  You can therefore use this parameter to correct this bug.

TimeSigFigs: numeric

CreateHeaderFile: 0 or 1

LogUnconverted: 0 or 1

AutoStart: 0 or 1

Running: 0 or 1, read only.

Logging and Export Functions:

Start(): starts the set.  If the set is already started, nothing happens.

StartStop(): if the set is stopped, the set is started.  If the set is started, the set is stopped.

Stop(): stops the set.  If the set is already stopped, nothing happens

AddValue(name, value): this function is used to manually add data to the logging set.  First you must manually add the column using the functions below or by clicking the Manual button in the logging set view.  Then you can add data to this column by calling this function with that column name and the desired data.  The data must have time associated with it as the time is used to determine which row the new data applies to.  The time of the data points must be within the RefreshRate (1 second by default) of the current time or the data will appear in your file out of order.  

Application: The addvalue() function is used to add calculated data to your logging set.  For example, let us assume that you have a channel X and a channel Y and you want to log X/Y in a column called Ratio in your logging set.  To do this:

1. In your logging set, hit the Manual button, and enter Ratio.

2. Create a sequence:

 

while (1)

  Logging.MyLoggingSet.AddValue("Ratio", X[0] / Y[0])

  delay(1)

endwhile

3. Now, when you run the sequence and the logging set, the ratio of X/Y will also be logged.

Application: The problem with the above technique is that the time of the logging of the ratio is determined by the sequence, not the time X or Y was acquired.  To make things more event driven, replace your sequence in step 2 above with an event assigned to either the X or Y channel:

  Logging.MyLoggingSet.AddValue("Ratio", X[0] / Y[0])

Now, the logging set gets the new value every time the channel that you applied the event to gets new data.

Logging Set Functions:

These functions are not applicable or available for export sets, and only apply to logging sets:

ClearChannelList(): clears the list of channels to be logged.  Usually you will call this and then the AddChannel() function to programmatically create a list of channels on the fly.

AddChannel(name, [sigfigs]): adds a channel to the list of channels to be logged. Name is a string. Sigfigs is optional and defaults to 6.

RemoveChannel(name): removes the given channel from the list of channels to be logged.

Application: The above three functions can be used to programmatically create a logging set.  You could pretty easily create a way for the user to enter in channels to log at runtime.  We do not recommend using these functions while the logging set is running.

Export Set Functions:

These functions are not applicable or available for logging sets, and only apply to export sets:

ClearExpressionList(): clears the list of expressions to be exported.  Usually you will call this and then the AddExpression() function to programmatically create a list of channels on the fly.

AddExpression(Name, Expression, [sigfigs]): adds an expression to the list of expressions to be logged. Name and Expression are strings. Sigfigs is optional and defaults to 6.

RemoveExpression(Name): removes the given expression from the list of expressions to be logged.

Application: The above three functions can be used to programmatically create a export set.  You could pretty easily create a way for the user to enter in channels to log at runtime.  We do not recommend using these functions while the logging set is running.