Signal Logging Buffer Size

Your real-time application sets aside a buffer for data logging. You specify the buffer size in the Code Generation > Simulink Real-Time Options pane of the Configuration Parameters dialog box. Set Signal logging buffer size in doubles to a value large enough to accommodate the logged signals.

The default buffer size is 100000 units (800000 bytes). Specify only the number of units that you need. Memory dedicated to data logging is not available for scopes and other Simulink® Real-Time™ features.

The Simulink Real-Time software calculates the number of samples N for a signal using this formula:

N = Buffer size in doubles / Logged signals

In this equation, Logged signals, the number of logged signals, breaks down as follows:

  • 1 for time

  • 1 for task execution time

  • 1 for each logged output

  • 1 for each logged state

The scopes copy the last N samples from the log buffer to the target object logs (tg.TimeLog, tg.OutputLog, tg.StateLog, and tg.TETLog).