Getting Started With LI Buffered File I/O-Blockset for Simulink®

Why a Buffered File I/O-Blockset?

Simulink®'s file i/o blocks work well with most simulations, but where many signals and a long simulation time (in the sense of a large amount of simulaion steps) come together, Simulink® often slows down very much or even breaks, often with memory related error messages. The most common reason is that file i/o blocks read huge amounts of source signal data from file to RAM when the model initialises, and also store huge amounts of sink signal data to RAM while simulating. Then most of the sink data is only written to file when the simulation terminates.

To address such problems, LI Buffered File I/O-Blockset for Simulink® allocates a fixed amount of bytes for every scalar signal or signal vector element in memory to buffer the i/o stream. Even very large i/o in Simulink models with 1000 scalars in and the same number going out at an average of 4 Bytes per scalar will not consume more than 500MB RAM for i/o, and thus usually can be run on every modern desktop PC.

Additional Features of the LI Buffered File I/O-Blockset

Time Stamped Signals

Where signals do not change their values over lengthy periods of time, it makes sense to save them on-change only, along with a time stamp. This can reduce data and data processing to a minimum. To support this, LI Buffered File I/O-Blockset provides dedicated blocks for reading and writing time stamped data.

File Format

The .mat-file format supports various formats and any number of variables. Also in the way it saves matrices, streaming and thus efficicent buffering is often not possible, where signal vectors are written element over time first. For this reason a dedicated and more simple format was designed, the .liio format, that always grants streaming ability. mex-functions that can write and read these files from and to Matlab® come with this package

Compression

Both writing blocks (time stamped and equi-distant) support in-memory data compression using the free zlib compression (see zlib.net). The reading blocks do respective decompression where the files they read contain compressed signal data. With modern SSD disks this might sometimes be slower than writing or reading uncompressed data, but where data files reside on net shares or classic hard disks, using compression can speed up simulations significantly.