Not only integer-valued state variables can be used in TANGRAM-II. This example
shows how we can use a . The vector variable is used as
a state variable and the behavior is identical to the C language. When a vector
variable is used we must pay attention to the following:
- The first index of the vector is zero (If we declare a vector with five
elements, the indices of these elements are (0,1,2,3,4)).
- An integer variable, for example , has to be used as an index of the
vector state variable ()
- We can initialize the vector state variable as follows :
- N[] = 1 (all positions of the vector are equal to 1).
- N = [1,2,3,4,5] (each position receives a specific value).
- Note that all entries must be initialized.
- When we want to copy a state var vector to a auxiliary variable, we must
use the get_st function. The syntax is:
get_st(auxiliary_var,state_var) .
- We can specify the using a
Integer constant type. In this case, we must specify the Const part before
the Var part in the Declaration attribute of the object. In the
Initialization attribute, we must specify the dimension of the vector before
the initialization of the vector variable. If we initialize each position
with a specific value, it is not necessary to follow this order. See figure
for more details.
- To generate the mathematical model, we must specify the maximum value of
the variables (in State Space Generation Module). In the case of the vector
variable, this parameter is the maximum value considering the value in each
vector's position.
- During the simulation, we are able to see the evolution of the state
vector variable. For example, if we have a vector with positions and we
want to see all positions between and , we have to do specify in the
Watches attribute
name_vector_variable[0:10]. If we
want to see another interval, we have to do the same:
name_vector_variable[20:50].
Subsections
Guilherme Dutra Gonzaga Jaime
2010-10-27