Documentation

File Scope Usage

  • Simulink® Real-Time™ supports eight file scopes. Each file scope can contain as many signals as the target computer resources can support.

  • You can have at most eight files open on the target computer at the same time.

  • The largest single file that you can create on the target computer is 4 GB.

  • A fully qualified folder name can have a maximum of 248 characters, including the drive letter, colon, and backslash.

  • A fully qualified file name can have a maximum of 260 characters: The file part can have at most 12 characters: eight for the file name, one for the period, and at most three for the file extension. A file name longer than eight characters is truncated to six characters followed by '~1'.

  • Do not write data to the private folder on your target computer. It is reserved for Simulink Real-Time internal use.

  • If you enter just the file name, the file appears in folder C:\. To put the file in a folder, create the folder separately using the target computer command line or the SimulinkRealTime.fileSystem.mkdir command.

  • You can configure the scope to generate multiple, dynamically named files in one session.

  • Before starting the scope, copy previously acquired data to the development computer. When the file scope starts, the software overwrites previously acquired data in files of the specified name or name pattern. A partially overwritten file or a file that is opened but left unwritten loses its original contents.

  • You cannot read a file that was written during real-time execution until execution has completed.

  • After real-time execution, the file scope software generates a signal data file on the target computer, even if it is running in Stand Alone mode. To access the contents of the signal data file that a file scope creates, use the SimulinkRealTime.fileSystem object from a development computer Command Window. To view or examine the signal data, use the SimulinkRealTime.utils.getFileScopeData utility and the plot function. Saving signal data to files lets you recover signal data from a previous run in the event of system failure.

  • The signal data file can quickly increase in size. To gauge the growth rate for the file, examine the file size between runs. If the signal data file grows beyond the available space on the disk, the signal data is corrupted.

  • The file scope acquires data and writes it to the file named in the FileName parameter. The scope writes data samples into a memory buffer of size given by the Number of Samples parameter. It copies data from the memory buffer into the file in blocks of size given by the WriteSize parameter.

    The Number of samples parameter works with the autorestart setting.

    • Autorestart is on — When the scope triggers, the scope starts collecting data into a memory buffer. A background task examines the buffer and writes data to the disk continuously, appending new data to the end of the file. When the scope reaches the number of samples that you specified, it starts collecting data again, overwriting the memory buffer. If the background task cannot keep pace with data collection, data can be lost.

    • Autorestart is off — When the scope triggers, the scope starts collecting data into a memory buffer. It stops when it has collected the number of samples that you specified. A background task examines the buffer and writes data to the disk continuously, appending the new data to the end of the file.

  • When real-time execution stops without an error, both the Lazy and Commit settings of the Mode box have the same result. Both settings cause the model to open a file, write signal data to the file, and close that file at the end of the session. The differences are in when the software updates the FAT entry for the file.

    • In Commit mode, the FAT entry and the actual file size are updated during each file write operation.

    • In Lazy mode, the FAT entry and the actual file size are updated only when the file is closed and not during each file write operation.

    Lazy mode is faster than Commit mode. However, if the target computer enters an error state, the system can stop responding before the file is closed. In Lazy mode, the actual file size can be lost, even though the file was written. You can lose an amount of data equivalent to the setting of the WriteSize parameter.

  • Select the type of trigger event in the Scope block dialog box by setting Trigger Mode to Signal Triggering, Software Triggering, or Scope Triggering.

    The number of samples N to log after triggering an event is equal to the value that you entered in the Number of Samples parameter.

See Also

| |

Related Topics

Was this topic helpful?