| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (7 out of 12)

Specifying a History of Values to Maintain

Many blocks can store their past input values and let you operate on this history of values. With the Moving Average block, for example, you can compute the average of the past 25 input values or of all the input values received in the last minute.

This section describes the attributes that let you set the size of the history, and how the block uses the history.

Specifying the Size of the History

To specify the size of the history:

For example, if Sample Type is points and Sample Size is 60, the block operates on the last 60 points. If Sample Type is time and Sample Size is 60, the block operates on the points received in the last 60 seconds. The block always uses seconds when the type is time. If Sample Type is fixed, the block operates on all the points the block has received since the application was started or the block was last reset.


Caution: Avoid setting Sample Type to fixed. When Sample Type is fixed, the block never discards any data from its history, and the history could quickly overflow your memory limits.

Specifying When to Propagate Data

To specify when to pass data:

For example, if Update Type is points and Update Size is 10, the block passes one value after it has received 10 points, another value after it has received 20, and so. If Sample Type is time and Sample Size is 60 seconds, the block waits a minute, and passes a value the next time it receives a value. The block then waits another minute, starting from the time it passed a value.

It is frequently useful to set the attributes Sample Type and Update Type and the attributes Sample Size and Update Size to the same values. For example, if Sample Type and Update Type are both points, and Sample Size and Update Size are both 10, the block receives 10 points and then passes their average. If Sample Type and Update Type are both time and Sample Size and Update Size are both 60 seconds, the block collects input values for a minute and then passes the average of the minute's values.

Specifying What Happens to History Upon Reset

To specify what happens to a block's history when you reset the block:

Specifying What to Do With Partial History

To specify whether a block computes a value with a partial history:

For example, suppose a block needs a history of 10 points (Sample Type is points and Sample Size is 10) and the block passes a value every minute (Update Type is time and Update Size is 1 minute). After a minute passes, the block only has 2 points. If Require Full History is yes, the block does not pass a value. If Require Full History is no, the block passes a value using only those two points.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (7 out of 12)

Copyright © 1996, Gensym Corporation, Inc.