Overview
The data log function of WMX3 collects data after each communication cycle to be output to file. The cyclic data handled by the engine can be observed for any deviation from expectation.
The log operation requires several functions to be called to configure the log parameters, and then the StartLog function is called to initiate logging. Logging will end when the specified time or file size has been reached, when the StopLog function is called, or when an error occurs while logging.
The following figure illustrates the available log parameters and the function used to configure each type of parameter.

-
This function specifies the data to log. Each type of data that may be logged is associated with a module. This function must be called once for each module containing data to be logged. For example, if axis data from the CoreMotion module and I/O data from the IO module will be logged, this function must be called twice. By default, no log data will be collected except for the cycle counter.
-
This function specifies the options for logging. For example, the time to collect log data can be specified. The default log options are listed in LogChannelOptions.
-
This function specifies the file path to save the log file. By default, the log file will be saved to “C:\wmx3_logfile.txt”.
-
This function specifies the header that is appended to the beginning of the log file. By default, no header is appended to the beginning of the log file, and the first line of the log file lists the type of data collected for each column.
Log Example Code
The following code executes a simple log operation that logs the position command data of axis 0 for 1 second.
CoreMotionLogInput in;
LogChannelOptions opt;
LogFilePathW path;
unsigned int chnl = 0;
//Set the CoreMotion module to log the position command data of axis 0
in.axisSelection.axisCount = 1;
in.axisSelection.axis[0] = 0;
in.axisOptions.commandPos = 1;
wmxlib_Log->SetLog(chnl, &in);
//Set the log options
opt.samplingTimeMilliseconds = 1000;
opt.stopLoggingOnBufferOverflow = 1;
wmxlib_Log->SetLogOption(chnl, &opt);
//Set the log output file path
swprintf(path.dirPath, L"C:");
swprintf(path.fileName, L"wmxlog.txt");
wmxlib_Log->SetLogFilePath(chnl, &path);
//Start log operation
wmxlib_Log->StartLog(chnl);
Contents of a Log File
A log file consists of an optional header, a line listing the type of log data in each column, and one or more lines of data.
The following shows the first few lines of an example log file containing log data for the position command of axis 0 and the outputs at addresses 0.0 and 0.1.
CYCLE CMDPOS0 out_0.0 out_0.1
10000 0.001250000 0 0
10001 0.005000000 0 0
10002 0.011250000 0 0
10003 0.020000000 0 0
10004 0.031250000 0 0
10005 0.045000000 0 0
This log file does not have any header lines at the beginning of the file.
The first line of the file lists the type of log data in each column. Each type of data is separated by the delimiter, which is a space character by default. The delimiter can be changed by calling SetLogOption passing in the delimiter of choice to the delimiter.
The remaining lines of the file contains the log data. Each line contains data taken from a different communication cycle.
The first column of the log data is typically the “CYCLE” column, which shows the number of communication cycles that have elapsed since communication was started with the StartCommunication function.
Log Channels
Log operations are executed in channels numbered between 0 and maxLogChannel - 1.
Each log channel holds its own log parameters and executes log operations independent of other channels.