Creating Sysmac Studio Trace Data with RecSSConvert (2/4)
Record settings
Here the following data is traced, output to files and then imported into Sysmac Studio data trace
| Data to trace | 16 bits, plus one each of INT, DINT, LINT, REAL and LREAL |
|---|---|
| Number of buffer elements | 10,000 |
| Number of buffers | 2 |
| Trace period | 2ms |
The record start flag accumulates data in the first buffer
When data reaches the end of the buffer, it switches to the second buffer and accumulates data
When the buffer switches, the buffer is written to SD with the FileWriteVar instruction
Step 1: Create the Buffers
1-1. Create the buffer structure
Create the sData structure to hold the data you want to trace
Put the Data structure into a double-buffer structure and set the array to the size needed for buffering
The number of array elements is the buffer size
| Name | Data type | Description | |
|---|---|---|---|
| sData | STRUCT | Buffer | |
| RecTime | DATE_AND_TIME | Time of day | |
| SamplingNo | UINT | Sampling No. | |
| Idx | UINT | Index | |
| B | BOOL[16] | 16 BOOLs | |
| INT16 | INT | Integer 16-bit | |
| INT32 | DINT | Integer 32-bit | |
| INT64 | LINT | Integer 64-bit | |
| R | REAL | Real types | |
| LR | LREAL | Real, double precision | |
1-2. Create the buffers
Create the buffer variables named Data0 and Data1
Each is an array of sData structures with 10,000 elements
Step 2: Create the PLC Program
2-1. Add data to the buffer
Create a single sData variable named RecData
Turning ON the record start flag (Rec) sets the data to trace into RecData
and the RecData with data set is added to the buffer with the RingBufPut function
Here global variables named Dummy... are used as the data to trace
2-2. When the buffer is full
When the buffer is full, a file name is created and a command is issued to write the buffer to SD with the FileWriteVar instruction
At the same time the buffer is switched, so recording continues in the other buffer even while the file is being written
Switching and writing are repeated whenever the buffer is full
On the next page
Convert the output files to data trace CSV files with SSConvert
