next up previous contents index
Next: 9.2 The Clock Component Up: 9.1 Simple Data Types Previous: 9.1.2 Integer Counter   Contents   Index

9.1.3 Integer

The integer model [26] is similar to the counter. However, it allows the user to directly set its value to an arbitrary number. It also has an upper bound and a lower bound. At any time during a simulation, any number between the lower bound (inclusively) and the upper bound (exclusively) are accepted as an event. The value of the cell is set accordingly.

The integer model is saved in Integer.des in the DataTypes/ subdirectory of SVM.

Integer.des

By default, the lower bound ([MIN]) of the cell is 0, and the upper bound ([MAX]) is 10. The idea is to structure all the possibilities in a bi-tree. Valid states in a model execution include LEFT.LEFT.RIGHT...STABLE and RIGHT.LEFT.LEFT.RIGHT.LEFT.RIGHT...STABLE. (There are 11 levels in total, with the last one named STABLE.) The rightmost RIGHT represents the current value. Suppose the name components in ``...'' are all LEFT, then the first state represents integer 2, and the second represents 5.

When initiated, the model nests deep enough so that the transitions at the first level are duplicated (with only the event names changed) 10 times. When the innermost STABLE state is reached, events of all those states are accepted. For the get event to return the current value from the deepest RIGHT state, the transitions in this model must be inner-first ordered.

Having nested deep enough ([MIN]>[MAX]) and the model is being initialized ([FIRST]=1), the state changes to TEMP - a dummy state, and at the same time event [INIT] is broadcast. The cell immediately changes to the initial value. Whenever the first RIGHT state is entered, the model is no longer being initialized and is able to accept events from the user (possibly input from the SVM graphical interface). The [FIRST] is then set to 0.

When an event between 0 (the [MIN] value) and 9 (the [MAX] value minus 1) is received, the state in the appropriate level changes to RIGHT. If it is already in RIGHT, a self-loop is triggered. The self-loop eliminates the RIGHT states at all the lower levels, so it becomes the deepest RIGHT state.


next up previous contents index
Next: 9.2 The Clock Component Up: 9.1 Simple Data Types Previous: 9.1.2 Integer Counter   Contents   Index
Thomas Huining Feng 2004-04-28