The easiest solution to save csv data is to use the "log option" in the processing node. If the log format is not convenient for user, it is possible to regenerate a CSV file with a flow. This wiki explains the different options to generate CSV :
- Save in csv format from the processing node, in raw format or data organized with columns.
- Process a .stcm raw data file with a flow
- Modify your flow to export directly in csv format.
1. Directly save in csv format from the processing node
The easiest solution to export csv data is to use the "Log option" in the processing node and to select csv for "Log Format".
The data are stored in a csv file in the log folder.
The csv raw data export has been introduced in version 1.4.0 and the format has been improved in 1.6.0.
The version of STM32CubeMonitor 1.7.0 adds the csv sorted by column.
1.1. Raw format
Select the format csv (one column) to have the full raw data in csv format. (Need STM32CubeMonitor minimum version 1.4.0)
groupname;variablename;x;y
myVariables;g_counter1;0;5000
myVariables;g_counter1;0,003;5086
myVariables;g_counter1;0,004;5214
myVariables;g_counter1;0,006;5336
myVariables;g_counter1;0,008;5456
myVariables;g_counter2;0;1748
myVariables;g_counter2;0,003;1748
myVariables;g_counter2;0,004;1748
myVariables;g_counter2;0,006;1748
myVariables;g_counter2;0,008;1748
Each variable acquisition generates one line. The columns contain: group name, variable name, the timestamp (x) and variable value (y).
The time is in seconds and starts at beginning of acquisition. The separator depends of the computer locale configuration : if the digit separator is dot, the column separator is coma. If digit separator is coma, the column separator is semicolon.
- Dot digit separator :
groupname,variablename,x,y
myVariables,g_counter1,0.001,5000
- Coma digit separator :
groupname;variablename;x;y
myVariables;g_counter1;0,001;5000
Note : before version 1.6.0 of STM32CubeMonitor, column separator was always coma, the order was y x, and the time was in ms and not starting at 0.
The data are stored by packets for each variable. It may be necessary to sort the csv file by time to have the acquisition in the chronological order.
1.2. Variables organized in column
Select the format csv (multiple columns) to have a improved csv formatting. (Need STM32CubeMonitor minimum version 1.7.0)
time;g_counter1;g_counter2;
0,3838,1240,
0.097,9627,1288,
0.196,15662,1336,
0.296,21695,1384,
0.397,27845,1432,
0.495,33841,1480,
The first column provides the timestamp of data acquisition, and after there is one column for each variable of the variable group. The timestamp is the accurate time of acquisition of the first variable. The accurate timestamp of other variables is not included to make the file smaller, easier to read and easier to open in spreadsheet programs. The separator are adjusted with the computer locale configuration.
2. Convert a .stcm log file into a .csv file
It is possible to convert a .stcm log file into a .csv file with a flow. This solution allows to format the data to match user needs.
2.1. Import the flow
Import the following flow into the STM32CubeMonitor workspace:
[{"id":"5442c1fe.bae16","type":"subflow","name":"Group variables in a .csv file","info":"","category":"STMicroelectronics","in":[{"x":60,"y":80,"wires":[{"id":"76ed82a.aeea47c"}]}],"out":[{"x":840,"y":360,"wires":[{"id":"e2840a46.67f638","port":0}]}],"env":[{"name":"nbVar","type":"num","value":"","ui":{"icon":"font-awesome/fa-cogs","label":{"en-US":"Number of Variables"},"type":"input","opts":{"types":["num"]}}},{"name":"delete_time","type":"bool","value":"false","ui":{"icon":"font-awesome/fa-clock-o","label":{"en-US":"Single Time"},"type":"input","opts":{"types":["bool"]}}}],"color":"#3CB4E6","icon":"node-red/join.svg"},{"id":"4eb816e2.08f228","type":"function","z":"5442c1fe.bae16","name":"Associate values with same timestamp","func":"let i = 0;\nlet j = 0;\nlet n = 0;\nlet msg1; \nlet msgArray = new Array();\nlet nbVar = msg.payload.length;\n//node.error(\"test\" + nbVar)\n//node.error(msg.payload);\n\nfor(i = 0; i < nbVar; i++){\n \n let underArrayLength = msg.payload[i].length;\n \n for(j = 0; j < underArrayLength; j++){\n \n for(n = 0; n < nbVar; n++){\n msg1 = msg.payload[n][j];\n msgArray.push(msg1);\n }\n }\n msg.payload = msgArray;\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":80,"wires":[["3090a095.2eb79"]]},{"id":"3090a095.2eb79","type":"split","z":"5442c1fe.bae16","name":"","splt":"\\n","spltType":"str","arraySplt":"${nbVar}","arraySpltType":"len","stream":false,"addname":"","x":870,"y":80,"wires":[["9d83ccf1.3555"]]},{"id":"f131f71e.41cae8","type":"function","z":"5442c1fe.bae16","name":"Format data","func":"let output=\"\";\n\nif(typeof msg.payload == 'number') {\n output = msg.payload;\n \n}else if(typeof msg.payload == 'string'){\n output = msg.payload;\n}else{\n output = msg.payload.x + \";\"+ msg.payload.y;\n}\n\nmsg.payload = output ;\n\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":200,"wires":[["e2840a46.67f638"]]},{"id":"e2840a46.67f638","type":"join","z":"5442c1fe.bae16","name":"Join consecutive messages from the number of monitored variables","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":";","joinerType":"str","accumulate":false,"timeout":"","count":"${nbVariables}","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":380,"y":360,"wires":[[]]},{"id":"76ed82a.aeea47c","type":"join","z":"5442c1fe.bae16","name":"Join [nbVar] consecutives messages","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":";","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":290,"y":80,"wires":[["4eb816e2.08f228","31884232.12fbbe"]]},{"id":"9d83ccf1.3555","type":"function","z":"5442c1fe.bae16","name":"Delete duplicate timestamps if user wants","func":"let i;\nlet delDup = env.get(\"delete_time\");\nlet nbVar = env.get(\"nbVar\");\nlet msgArray = new Array();\n\nif(delDup === false){\n return msg;\n}else{\n \n msgArray.push(msg.payload[0]);\n \n for(i=1; i < nbVar; i++){\n if (msg.payload[i].y!==undefined) {\n msgArray.push(msg.payload[i].y);\n } else {\n msgArray.push(\" \");\n }\n \n }\n \n msg.payload = msgArray;\n return msg;\n \n}\n\n\n","outputs":1,"noerr":0,"x":260,"y":200,"wires":[["f8ba82c4.b6fc1"]]},{"id":"f8ba82c4.b6fc1","type":"split","z":"5442c1fe.bae16","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":570,"y":200,"wires":[["f131f71e.41cae8"]]},{"id":"31884232.12fbbe","type":"debug","z":"5442c1fe.bae16","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":40,"wires":[]},{"id":"34072f28.a29b6","type":"tab","label":"Convert .stcm to .csv ","disabled":false,"info":"This flow is used to convert stcm file in csv file\n\nThe file name must be entered in the \"set file name\" node\n\nThe csv output format is variable Name, x, y\nNote : the data may be processed by group, so the x value may not be in time order. The csv file may be sorted on the x value to ensure order coherency. "},{"id":"4c64fe53.6ea08","type":"file in","z":"34072f28.a29b6","name":"Read file","filename":"","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":140,"y":360,"wires":[["ca9d918c8c2d291f"]]},{"id":"a30d1a30.036c68","type":"inject","z":"34072f28.a29b6","name":"Start","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":160,"wires":[["d126afb4.cd9c5"]]},{"id":"9f1676e1.60b388","type":"json","z":"34072f28.a29b6","name":"Parse each line","property":"payload","action":"","pretty":false,"x":520,"y":360,"wires":[["fc5b68a9.d4a3b8"]]},{"id":"6605dcb4.d756c4","type":"function","z":"34072f28.a29b6","name":"add a line escape after each payload","func":"let output=\"\";\n\noutput= msg.payload + \"\\n\";\n\nmsg.payload = output ;\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":540,"wires":[["51f5a040.55bc5"]]},{"id":"6d6c1729.9217b8","type":"file","z":"34072f28.a29b6","name":"Write csv","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"false","encoding":"none","x":960,"y":540,"wires":[[]]},{"id":"d126afb4.cd9c5","type":"change","z":"34072f28.a29b6","name":"Set file name","rules":[{"t":"set","p":"filename","pt":"msg","to":"C:\\Users\\frq09421\\log\\Log_myVariables_2022-11-04_12h00m52s.stcm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":160,"wires":[["4c64fe53.6ea08","907372c9.774d7"]]},{"id":"9f00f046.f52ca","type":"comment","z":"34072f28.a29b6","name":"Enter your filename here","info":"","x":330,"y":120,"wires":[]},{"id":"51f5a040.55bc5","type":"change","z":"34072f28.a29b6","name":"Set csv extension in filename","rules":[{"t":"change","p":"filename","pt":"msg","from":"stcm","fromt":"str","to":"csv","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":540,"wires":[["6d6c1729.9217b8"]]},{"id":"a50548d8.3bfa38","type":"file","z":"34072f28.a29b6","name":"Eraze csv","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":780,"y":160,"wires":[[]]},{"id":"907372c9.774d7","type":"change","z":"34072f28.a29b6","name":"Format csv header ","rules":[{"t":"change","p":"filename","pt":"msg","from":"stcm","fromt":"str","to":"csv","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Timestamp_g_counter1; g_counter1; Timestamp_Data2; Data2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":160,"wires":[["a50548d8.3bfa38"]]},{"id":"bc597112.a249b","type":"comment","z":"34072f28.a29b6","name":"Process the stcm file","info":"","x":510,"y":280,"wires":[]},{"id":"14ea3272.6b64ee","type":"comment","z":"34072f28.a29b6","name":"Write the csv file","info":"","x":1000,"y":460,"wires":[]},{"id":"fc5b68a9.d4a3b8","type":"change","z":"34072f28.a29b6","name":"Keep only values","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.variabledata","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":360,"wires":[["c3b7abf6.a39f38"]]},{"id":"c4df7459.17d648","type":"comment","z":"34072f28.a29b6","name":"Enter your column names here","info":"","x":610,"y":120,"wires":[]},{"id":"c3b7abf6.a39f38","type":"subflow:5442c1fe.bae16","z":"34072f28.a29b6","name":"Group variables in a .csv file","env":[{"name":"nbVar","value":"2","type":"num"},{"name":"delete_time","value":"true","type":"bool"}],"x":1000,"y":360,"wires":[["6605dcb4.d756c4"]]},{"id":"23b9924a.7ee32e","type":"comment","z":"34072f28.a29b6","name":"Enter the number of monitored var & boolean condition","info":"","x":1000,"y":320,"wires":[]},{"id":"ca9d918c8c2d291f","type":"function","z":"34072f28.a29b6","name":"filter json data","func":"\nif (msg.payload != \"[\\r\" && msg.payload != \"]\") {\n msg.payload=msg.payload.slice(0,-2);\n return msg;\n}\nreturn null\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":360,"wires":[["9f1676e1.60b388"]]}]
Menu > Import > Clipboard and Copy/Paste the .json formatted flow in the area, click on Import. The flow is now imported into the STM32CubeMonitor workspace.
2.2. Configure the flow
Before the first file conversion, the flow must be configured:
- "Set file name" : in the "Set msg.filename to ..." set to [STCM_File_Absolute_Path]. Here is a configuration example:
- "Format CSV Header" : this node is used to define the .csv file column names. Fill the "Set msg.payload to ..." field by putting the .csv column names in the "to" field. The user must choose to display one timestamp for all variables monitored at the same time, or to display each timestamp for each variable. The data are acquired like this:
Time_Data1, Value_Data1, Time_Data2, Value_Data2 ...
Configuration example:
- To display one timestamp for all variables monitored at the same time:
- To display the timestamp of each variable:
- "Group variables parameters": To configure this node, two parameters are needed:
- Number of Variables: the number of monitored variables
- Single Time: a boolean value to define if the user wants to display (or not) the timestamp for each variable (default value set to False) :
- True: Only one timestamp
- False: One timestamp for each variable
2.3. Convert the file into a .csv file
When everything is configured, press the square button of the "Start" node to launch the conversion.
To find the .csv file, go in the same folder as the .stcm one. In this folder, a new .csv file (with the same name as the .stcm one) has been created.
2.4. How does the flow work?
The conversion is started on the press of the Start button. The read file node parses each line of the log file and sends it to the "Group variables" subflow. Then the subflow formats the data in a ".csv way" and sends it to the file node. This file node creates a new file: the .csv file corresponding to its .stcm.
How does the "Group variables" subflow work? This subflow associates the values with the same timestamp and then lets the choice to the user to display the duplicated timestamp or not. Ultimately, it formats the data in a ".csv way".
3. Log data directly in a .csv file
This method allows the user to generate a .csv file directly without using an intermediate .stcm file.
3.1. Import the flow
To perform this, import the following flow in the STM32CubeMonitor workspace:
[{"id":"7e9c50ed.2ab67","type":"subflow","name":"Group variables in a .csv file","info":"","category":"STMicroelectronics","in":[{"x":60,"y":80,"wires":[{"id":"c7f149ae.894818"}]}],"out":[{"x":840,"y":360,"wires":[{"id":"802c75f2.9f7898","port":0}]}],"env":[{"name":"nbVar","type":"num","value":"","ui":{"icon":"font-awesome/fa-cogs","label":{"en-US":"Number of Variables"},"type":"input","opts":{"types":["num"]}}},{"name":"delete_time","type":"bool","value":"false","ui":{"icon":"font-awesome/fa-clock-o","label":{"en-US":"Single Time"},"type":"input","opts":{"types":["bool"]}}}],"color":"#3CB4E6","icon":"node-red/join.svg"},{"id":"7b54efc3.0009e","type":"function","z":"7e9c50ed.2ab67","name":"Associate values with same timestamp","func":"let i = 0;\nlet j = 0;\nlet n = 0;\nlet msg1; \nlet msgArray = new Array();\nlet nbVar = msg.payload.length;\n\nfor(i = 0; i < nbVar; i++){\n \n let underArrayLength = msg.payload[i].length;\n \n for(j = 0; j < underArrayLength; j++){\n \n for(n = 0; n < nbVar; n++){\n msg1 = msg.payload[n][j];\n msgArray.push(msg1);\n }\n }\n msg.payload = msgArray;\n return msg;\n}","outputs":1,"noerr":0,"x":650,"y":80,"wires":[["b3b24fdd.b01b9"]]},{"id":"b3b24fdd.b01b9","type":"split","z":"7e9c50ed.2ab67","name":"","splt":"\\n","spltType":"str","arraySplt":"${nbVar}","arraySpltType":"len","stream":false,"addname":"","x":870,"y":80,"wires":[["cf754130.7de2a"]]},{"id":"ca91d405.238ea8","type":"function","z":"7e9c50ed.2ab67","name":"Format data","func":"let output=\"\";\n\nif(typeof msg.payload == 'number') {\n output = msg.payload;\n \n}else if(typeof msg.payload == 'string'){\n output = msg.payload;\n}else{\n output = msg.payload.x + \";\"+ msg.payload.y;\n}\n\nmsg.payload = output ;\n\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":200,"wires":[["802c75f2.9f7898"]]},{"id":"802c75f2.9f7898","type":"join","z":"7e9c50ed.2ab67","name":"Join consecutive messages from the number of monitored variables","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":";","joinerType":"str","accumulate":false,"timeout":"","count":"${nbVar}","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":380,"y":360,"wires":[[]]},{"id":"c7f149ae.894818","type":"join","z":"7e9c50ed.2ab67","name":"Join [nbVar] consecutives messages","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":";","joinerType":"str","accumulate":false,"timeout":"","count":"${nbVar}","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":290,"y":80,"wires":[["7b54efc3.0009e"]]},{"id":"cf754130.7de2a","type":"function","z":"7e9c50ed.2ab67","name":"Delete duplicate timestamps if user wants","func":"let i;\nlet delDup = env.get(\"delete_time\");\nlet nbVar = env.get(\"nbVar\");\nlet msgArray = new Array();\n\nif(delDup === false){\n return msg;\n}else{\n \n msgArray.push(msg.payload[0]);\n \n for(i=1; i < nbVar; i++){\n \n msgArray.push(msg.payload[i].y);\n \n }\n \n msg.payload = msgArray;\n return msg;\n \n}\n\n\n","outputs":1,"noerr":0,"x":260,"y":200,"wires":[["91613227.a8eb8"]]},{"id":"91613227.a8eb8","type":"split","z":"7e9c50ed.2ab67","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":570,"y":200,"wires":[["ca91d405.238ea8"]]},{"id":"91d68244.047e7","type":"subflow","name":"Select .csv variable","info":"","category":"STMicroelectronics","in":[{"x":220,"y":120,"wires":[{"id":"e9aa15c3.2c15f8"}]}],"out":[{"x":1180,"y":120,"wires":[{"id":"d287b70e.45b4c8","port":0}]}],"env":[{"name":"varfilter","type":"str","value":"","ui":{"icon":"font-awesome/fa-cog","label":{"en-US":"Variable name"},"type":"input","opts":{"types":["str"]}}}],"color":"#3CB4E6","icon":"node-red/arrow-in.svg"},{"id":"d287b70e.45b4c8","type":"change","z":"91d68244.047e7","name":"keep only table of duplets","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.variabledata","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":120,"wires":[[]]},{"id":"e9aa15c3.2c15f8","type":"switch","z":"91d68244.047e7","name":"filter variable","property":"payload.variablename","propertyType":"msg","rules":[{"t":"eq","v":"varfilter","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":120,"wires":[["c88ffe31.b60d9"]]},{"id":"c88ffe31.b60d9","type":"function","z":"91d68244.047e7","name":"define the .csv header ","func":"if(msg.payload.variabledata[0].y === undefined){\n msg.payload.variabledata[0].x = 'timestamp' + \"_\" + msg.payload.variablename;\n msg.payload.variabledata[0].y = msg.payload.variablename;\n return msg;\n}else{\n return msg;\n}\n","outputs":1,"noerr":0,"x":660,"y":120,"wires":[["d287b70e.45b4c8"]]},{"id":"b724a6a7.177628","type":"tab","label":"Create .csv log file","disabled":false,"info":""},{"id":"f474eca8.7b351","type":"ui_chartst","z":"b724a6a7.177628","group":"1b8f9f84.b59fb","name":"myChart","order":4,"width":15,"height":9,"chartType":"line","curveType":"linear","duration":"10","ymin":"","ymax":"","x":620,"y":300,"wires":[]},{"id":"af306ec4.f0fad","type":"acquisition out","z":"b724a6a7.177628","name":"myProbe_Out","probeconfig":"3ab5d867.e37ba8","x":680,"y":140,"wires":[]},{"id":"be311bcb.2d3738","type":"acquisition in","z":"b724a6a7.177628","name":"myProbe_In","probeconfig":"3ab5d867.e37ba8","x":230,"y":380,"wires":[["d42b7c5c.e9b9"],[]]},{"id":"672c629e.55c89c","type":"ui_button","z":"b724a6a7.177628","name":"","group":"1b8f9f84.b59fb","order":3,"width":5,"height":1,"passthru":false,"label":"Clear Graphs","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"clear","x":410,"y":300,"wires":[["f474eca8.7b351"]]},{"id":"fddfae1a.63681","type":"ui_button","z":"b724a6a7.177628","name":"","group":"1b8f9f84.b59fb","order":1,"width":5,"height":1,"passthru":false,"label":"START Acquisition","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"start","x":250,"y":100,"wires":[["9767ad34.f46fd"]]},{"id":"7aa5d3b.ac0f92c","type":"ui_button","z":"b724a6a7.177628","name":"","group":"1b8f9f84.b59fb","order":2,"width":5,"height":1,"passthru":true,"label":"STOP Acquisition","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"stop","x":250,"y":180,"wires":[["9767ad34.f46fd"]]},{"id":"d42b7c5c.e9b9","type":"processing","z":"b724a6a7.177628","groupname":"MyVariables","groupid":"9767ad34.f46fd","expressions":[],"statistics":[],"logmode":"no","x":490,"y":400,"wires":[["f474eca8.7b351","fdcd4a27.d79ec8","c6e46d72.82fc5"],[]]},{"id":"b8f3a432.74d7e8","type":"file","z":"b724a6a7.177628","name":"","filename":"c:\\Temp\\Log_File.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1300,"y":420,"wires":[[]]},{"id":"3c143b95.1aabb4","type":"comment","z":"b724a6a7.177628","name":"link the subflows in the .exe variables order","info":"","x":720,"y":480,"wires":[]},{"id":"c83e71e8.a4d32","type":"comment","z":"b724a6a7.177628","name":"Enter the number of variables connected","info":"","x":1020,"y":380,"wires":[]},{"id":"fdcd4a27.d79ec8","type":"subflow:91d68244.047e7","z":"b724a6a7.177628","name":"Data1","env":[{"name":"varfilter","value":"data1","type":"str"}],"x":690,"y":380,"wires":[["3f392198.19ae2e"]]},{"id":"c6e46d72.82fc5","type":"subflow:91d68244.047e7","z":"b724a6a7.177628","name":"Data2","env":[{"name":"varfilter","value":"data2","type":"str"}],"x":690,"y":440,"wires":[["3f392198.19ae2e"]]},{"id":"3f392198.19ae2e","type":"subflow:7e9c50ed.2ab67","z":"b724a6a7.177628","name":"Group variables in a .csv file","env":[{"name":"nbVar","value":"2","type":"num"},{"name":"nbVar","value":"4","type":"num"}],"x":1000,"y":420,"wires":[["b8f3a432.74d7e8"]]},{"id":"93517461.eeea38","type":"comment","z":"b724a6a7.177628","name":"Enter absolute path of the file","info":"","x":1320,"y":460,"wires":[]},{"id":"9767ad34.f46fd","type":"variables","z":"b724a6a7.177628","groupname":"MyVariables","accesspoint":0,"execonfig":"","variablelist":[],"triggerstartmode":"manual","triggername":"","triggerthreshold":"","frequency":"","frequencyType":"0","snapshotheader":"","mode":"direct","lastImportedTime":-1,"openStatus":false,"x":490,"y":140,"wires":[["af306ec4.f0fad"]]},{"id":"1b8f9f84.b59fb","type":"ui_group","z":"","name":"Chart","tab":"e4a22138.efd5b","order":1,"disp":true,"width":15,"collapse":false},{"id":"3ab5d867.e37ba8","type":"probe","z":"","probeid":"066FFF485457725187092531","probename":"ST-Link v2-1B (...92531)","protocol":"SWD","frequency":"1.8 MHz - Default","probeproperty":"{\"SWD\":[\"4.6 MHz\",\"1.8 MHz - Default\",\"950 kHz\",\"400 kHz\",\"150 kHz\"],\"JTAG\":[\"18 MHz\",\"9 MHz\",\"4.5 MHz\",\"2.25 MHz\",\"1.12 MHz - Default\",\"560 kHz\",\"280 kHz\",\"140 kHz\"]}","probeversion":"ST Link firmware version V2.J36","connectionType":"p2p"},{"id":"e4a22138.efd5b","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
Menu > Import > Clipboard and Copy/Paste the .json formatted flow in the area, click on Import. The flow is now imported into the STM32CubeMonitor workspace. The flow attached is a complete flow: you may need to merge it with your existing flow or to configure it for your acquisition (set probes, variables and others).
3.2. Configure the flow
Configure the “Select .csv variables” subflows
For each monitored variable, add a “select .csv variables” subflow connected to the processing node output.
To configure each subflow, only one parameter is needed: the name of the variable to filter. One subflow is needed for each variable you want to log. In the “Variable name” field put the exact name of the filtered variable.
Configure the “Group variables” subflow
To configure this subflow two parameters are needed:
- Number of Variables: the number of monitored variables
- Single Time: a boolean value to define if the user wants to display (or not) the timestamp for each variable (default value set to False):
- True: Only one timestamp
- False: One timestamp for each variable
Configure the "File" node
In the “file node”, set the absolute path of the .csv file you want to create.
3.3. Generate the .csv file
The .csv file is updated during the acquisition process.
To find the .csv file, go into the folder defined in the “file node”. In this folder, a new .csv file has been created.
3.4. How does the flow work?
The data sent at the output of the processing node are then sent to the "select .csv variables" subflow (one subflow per monitored variable). This subflow filters each variable and sends it to another subflow: "Group variables". The latter groups, sorts and formats the data to create the .csv file.
3.4.1. “Select .csv variables” subflow
This subflow has several roles:
- Filters each variables by its name
- Formats the header of the .csv file
- Ultimately, sends all the data to the “Group variables” subflow
3.4.2. “Group variables” subflow
This subflow associates the values with the same timestamp and then deletes timestamp duplicates depending on the user's choice. Ultimately,
it formats the data in a ".csv way".