In some circumstances, it might be useful to retrieve data from a previous acquisition. Hence, it is possible to store the acquired data from a live acquisition in a local file and then to import this local file later in a chart.
1. Activating the data log
The log can be activated from "processing" node configuration panel by using the "Log option" parameter.
This parameter supports various options:
- No log: (default) the values are not logged
- Log all values: All the values read from the MCU target are logged
- Log only changes: Only the changes for each variable are logged. This option reduces the size of the resulting file.
The log format can be "stcm", "csv (one column)" or "csv (multiple columns)".
A new Log file is created each time an acquisition is started on a specific variable group. The file is made available under a predefined directory path. The directory path can be configured in settings.js file, and the resulting log file names use the following convention: "Log_groupname_timestamp.stcm" or "Log_groupname_timestamp.csv".
2. Importing the data log
After logging some acquisition data in stcm format, it is possible to import any of the resulting files in the chart node provided in the STMicroelectronics palette category.
In dashboard view, clicking the IMPORT DATA button of the chart causes a modal window to pop up, from which a specific file can be selected. All the files with an stcm extension are displayed in alphabetical order. After a specific file is selected and the IMPORT button clicked, the chart is filled with the data from the selected file.
3. Data log csv format
The csv format and processing flows are described on a dedicated page : STM32CubeMonitor:How_to_log_data_in_a_.csv_file
4. Data log stcm format
The stcm file is a text file containing several lines, each line representing a set of consecutive values for one variable.
Each line uses the followng template (json object):
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":36045,"x":1578586445609}{"y":39170,"x":1578586445634}],"variablename":"g_counter1"}
It contains 3 different keys/values:
- groupname: the name of the variables node on which the acquisition has been started
- variabledata: an array of duplets (x:timestamp, y:value). The number of elements in the array depends on the sampling frequency set in the variables node configuration panel. For snapshot & trigger acquisitions, the first duplet does not contain a 'y' value. This mechanism memorizes the moment when the end user starts the acquisition, which might not correspond to the real start of the acquisition. This information is also used by the chart to initialize the timeline.
- variablename: the variable name.
Moreover, if N variables are logged in the the processing nodes, the resulting file contains several "groups" of N lines with one line per variable.
For instance, for the following list of variables (including expression and statistic) defined in processing node:
The log file contains several groups of 8 lines (1 line for each of the 8 variables):
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":36045,"x":1578586445609},{"y":39170,"x":1578586445634}],"variablename":"g_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":554562,"x":1578586445609},{"y":554568,"x":1578586445634}],"variablename":"g_counter2"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":27655.75,"x":1578586445609},{"y":32343.25,"x":1578586445634}],"variablename":"g_counterDouble"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":27655.75,"x":1578586445609},{"y":32343.25,"x":1578586445634}],"variablename":"g_counterFloat"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":-58839,"x":1578586445609},{"y":-55713,"x":1578586445634}],"variablename":"g_counterLong"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445584},{"y":50,"x":1578586445609},{"y":56,"x":1578586445634}],"variablename":"g_counterShort"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445609,"y":35435},{"x":1578586445634,"y":36186.2}],"variablename":"stat_avg_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445609,"y":590607},{"x":1578586445634,"y":593738}],"variablename":"expression1"}
{"groupname":"Snapshot","variabledata":[{"y":42296,"x":1578586445659},{"y":45422,"x":1578586445684}],"variablename":"g_counter1"}
{"groupname":"Snapshot","variabledata":[{"y":554574,"x":1578586445659},{"y":554580,"x":1578586445684}],"variablename":"g_counter2"}
{"groupname":"Snapshot","variabledata":[{"y":37032.25,"x":1578586445659},{"y":41721.25,"x":1578586445684}],"variablename":"g_counterDouble"}
{"groupname":"Snapshot","variabledata":[{"y":37032.25,"x":1578586445659},{"y":41721.25,"x":1578586445684}],"variablename":"g_counterFloat"}
{"groupname":"Snapshot","variabledata":[{"y":-52587,"x":1578586445659},{"y":-49462,"x":1578586445684}],"variablename":"g_counterLong"}
{"groupname":"Snapshot","variabledata":[{"y":62,"x":1578586445659},{"y":68,"x":1578586445684}],"variablename":"g_counterShort"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445659,"y":36945.1},{"x":1578586445684,"y":38016.6}],"variablename":"stat_avg_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445659,"y":596870},{"x":1578586445684,"y":600002}],"variablename":"expression1"}
{"groupname":"Snapshot","variabledata":[{"y":45422,"x":1578586445684},{"y":1669,"x":1578586445734}],"variablename":"g_counter1"}
{"groupname":"Snapshot","variabledata":[{"y":554580,"x":1578586445684},{"y":554594,"x":1578586445734}],"variablename":"g_counter2"}
{"groupname":"Snapshot","variabledata":[{"y":41721.25,"x":1578586445684},{"y":-8909.75,"x":1578586445734}],"variablename":"g_counterDouble"}
{"groupname":"Snapshot","variabledata":[{"y":41721.25,"x":1578586445684},{"y":-8909.75,"x":1578586445734}],"variablename":"g_counterFloat"}
{"groupname":"Snapshot","variabledata":[{"y":-49462,"x":1578586445684},{"y":-43214,"x":1578586445734}],"variablename":"g_counterLong"}
{"groupname":"Snapshot","variabledata":[{"y":68,"x":1578586445684},{"y":82,"x":1578586445734}],"variablename":"g_counterShort"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445684,"y":38782.2},{"x":1578586445734,"y":34860}],"variablename":"stat_avg_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445684,"y":600002},{"x":1578586445734,"y":556263}],"variablename":"expression1"}
{"groupname":"Snapshot","variabledata":[{"y":4733,"x":1578586445759},{"y":7786,"x":1578586445784}],"variablename":"g_counter1"}
{"groupname":"Snapshot","variabledata":[{"y":554600,"x":1578586445759},{"y":554606,"x":1578586445784}],"variablename":"g_counter2"}
{"groupname":"Snapshot","variabledata":[{"y":-4313.75,"x":1578586445759},{"y":267.25,"x":1578586445784}],"variablename":"g_counterDouble"}
{"groupname":"Snapshot","variabledata":[{"y":-4312.25,"x":1578586445759},{"y":267.25,"x":1578586445784}],"variablename":"g_counterFloat"}
{"groupname":"Snapshot","variabledata":[{"y":-40150,"x":1578586445759},{"y":-37096,"x":1578586445784}],"variablename":"g_counterLong"}
{"groupname":"Snapshot","variabledata":[{"y":88,"x":1578586445759},{"y":94,"x":1578586445784}],"variablename":"g_counterShort"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445759,"y":30931.6},{"x":1578586445784,"y":26995.9}],"variablename":"stat_avg_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445759,"y":559333},{"x":1578586445784,"y":562392}],"variablename":"expression1"}
{"groupname":"Snapshot","variabledata":[{"y":10912,"x":1578586445809},{"y":14038,"x":1578586445834}],"variablename":"g_counter1"}
{"groupname":"Snapshot","variabledata":[{"y":554612,"x":1578586445809},{"y":554619,"x":1578586445834}],"variablename":"g_counter2"}
{"groupname":"Snapshot","variabledata":[{"y":4956.25,"x":1578586445809},{"y":9645.25,"x":1578586445834}],"variablename":"g_counterDouble"}
{"groupname":"Snapshot","variabledata":[{"y":4956.25,"x":1578586445809},{"y":9645.25,"x":1578586445834}],"variablename":"g_counterFloat"}
{"groupname":"Snapshot","variabledata":[{"y":-33970,"x":1578586445809},{"y":-30844,"x":1578586445834}],"variablename":"g_counterLong"}
{"groupname":"Snapshot","variabledata":[{"y":100,"x":1578586445809},{"y":-94,"x":1578586445834}],"variablename":"g_counterShort"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445809,"y":23372.8},{"x":1578586445834,"y":24749.3}],"variablename":"stat_avg_counter1"}
{"groupname":"Snapshot","variabledata":[{"x":1578586445809,"y":565524},{"x":1578586445834,"y":568657}],"variablename":"expression1"}