The Buffer block cannot be used in an enabled subsystem under the following
conditions:
In a multirate, multitasking environment
When the Buffer overlap parameter is set to a
negative value
The Buffer block has an internal reservoir that temporarily stores data. When
the Buffer block is used in an enabled subsystem, there is the possibility that
the reservoir can overrun or underrun. The block implements safeguards against
these occurrences.
Overrun occurs when more data enters the buffer than what it can hold. For
example, consider buffering a scalar input to a frame of size three with a
buffer that accepts an input every second and outputs every three seconds. If
you place this buffer inside an enabled subsystem that is disabled every three
seconds at t = 3s, t = 6s, and so on, the
buffer accumulates data in its internal reservoir without being able to empty
it. This condition results in an overrun.
Underrun occurs when the buffer runs out of data to output. For example, again
consider buffering a scalar input to a frame size of three with a buffer that
accepts an input every second and outputs every three seconds. If you place this
buffer inside an enabled subsystem that is disabled at t =
10s, t = 11s, t = 13s,
t = 14s, t = 16s, and
t = 17s, its internal reservoir becomes drained, and
there is no data to output at t = 18s. This condition results
in an underrun.
To protect from an overrun or an underrun, the Buffer block keeps a record of
the amount of data in its internal reservoir. When the Buffer block reads data,
the amount of data in its reservoir goes up. When the Buffer
block outputs the data, the amount of data in its reservoir goes down. To
protect from overrun, the oldest samples in the reservoir are discarded whenever
the amount of data in the reservoir is larger than the actual buffer size. To
protect from underrun, the most recent samples are repeated whenever an output
is due and there is no data in the reservoir.