Vector Variable Model

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:

  1. 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)).
  2. An integer variable, for example $i$, has to be used as an index of the vector state variable ($N[i]=\ldots$)
  3. We can initialize the vector state variable as follows :
    1. N[] = 1 (all positions of the vector are equal to 1).
    2. N = [1,2,3,4,5] (each position receives a specific value).
  4. Note that all entries must be initialized.
  5. 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) .
  6. 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.
  7. 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.
  8. During the simulation, we are able to see the evolution of the state vector variable. For example, if we have a vector with $100$ positions and we want to see all positions between $0$ and $10$, 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