File Logger Init
Block to initialize the File Logger module
Description
The 'File Logger Init' block instructs the code generator to enable support for the
File Logger module. This module allows the logging of Simulink signals (at a fixed
time interval) into a file that is written to the SD-card.
All signals in the ASCII log-file are separated by a semicolon. This data format allows the
log-files to be opened by any tool that can read CSV files, such as Microsoft Excel.
Remarks
- Place the FAT32 formatted SD-card into the slot on the system before starting the software program.
- The File Logger Close block must be present and called explicitly to stop logging, otherwise no
file will be written to the SD-card. Ideally, this block is called during software shutdown for example
when the ignition signal goes low in automotive applications. An external trigger can also be used such
as a button press event or CAN message reception.
Parameters
- Filename
- Name of the log-file, including file extension. It will be written to the root directory on the SD-card.
A 3-digit sequence number will be added to the log-file and automatically increment it
when a new logfile is created. So if the filename is specified as 'mylog.txt', then the first time the
software program is started, the log-file will be called 'mylog001.txt', the next time the software program
is started, it will be called 'mylog002.txt', etc.
- Logging interval (ms)
- This detemins the delta time as which the data signals are sampled and written to the log-file. Specify
the time in milliseconds. Note that a short logging interval will increase the CPU load. It is recommended
to specify a value >= 5ms.
- Maximum log file size
- With this setting you can indicate the maximum size of the log file in kilobytes. A new log file will be automatically created
when this size is reached. In case the file logger close block is not called only the last file will not be saved and the
data will be lost. Depending on the CPU load it is possible that some data points will be missed between two log files.
- Automatically start logging
- Select if logging should automatically start after reset or wait until it is triggered by the trigger input.
- Use dot-character as decimal seperator (comma otherwise)
- After sampling data signals, the signal valus are converted to a string in order to be able to write them to
the log-file. This configurable instructs the File Logger module to use either a '.'-character or ','-character
as a decimal separator.
Examples
Given is the following configuration:
- Filename: 'mylog.txt'
- Logging interval (ms): 100
- Maximum log file size: 20
- Automatically start logging; No
- Use dot-character as decimal seperator (comma otherwise): No
After running the software program, the log-file 'mylog001.txt' will appear on the SD-card with the following contents:
time;signalName1;signalName2
0,100;1;100
0,200;2;101
0,300;3;102
0,400;4;103
0,500;5;104
0,600;6;105
0,700;7;106
0,800;8;107
0,900;9;108
1,000;10;109
1,100;11;110
....etc....