Difference between revisions of "T-VEC Tablular Modeler Examples"

From T-VEC Wiki
Jump to: navigation, search
(Arrays)
 
Line 37: Line 37:
  
 
===Structures===
 
===Structures===
 +
====Structure Type Definition====
  
===Structure Types===
+
Structure types are represented hierarchically. Structure field names must be associated with a scalar or predefined structure type as shown below.
 
+
Structure types are represented hierarchically. Structure field names and types must be provided as shown below
+
 
+
  
 
[[Image:Structure type.png|center|Structure Type]]
 
[[Image:Structure type.png|center|Structure Type]]
  
===Structure Usage===
+
====Structure Condition Usage====
  
Output assignments for structures assign a value to one or more field elements terminated by a semicolon. In a condition table reference structure fields are referenced using a dot notation.
+
In a condition or event expression a structure variable can be related to another structure variable using the "=" or "!=" operators. Structure field elements are referenced using a dot notation and the relationship must correspond to the type of the field element.
  
 
  structure_name.field1 = scalar
 
  structure_name.field1 = scalar
Line 53: Line 51:
 
  structure1 = structure2
 
  structure1 = structure2
 
  structure_name.field1 = function(param,…);
 
  structure_name.field1 = function(param,…);
 +
structure1.field_integer < structure2.field_integer
  
===Assignment Usage===
+
====Structure Assignment Usage====
  
For outputs or terms, such as the vertical tracker3 example that is provided as part of the installation, an output that is a structure type such as trackingStateStrType with two fields is referenced as follow:
+
For outputs, terms or functions that are structures, a field element can be assigned a value to one or more field elements where each assignment is terminated by a semicolon. For example, the vertical tracker3 example that is provided as part of the TTM installation illustrates the use of an assignment to a structure type with two fields (tState and tStatus):
  
 
  tState = FAIL;
 
  tState = FAIL;
 
  tStatus = currentStatus;
 
  tStatus = currentStatus;
  
Note that only the field elements need to be used on the left side of the assignment. Individual field elements of an inputs such as sensorData.trk1 shown in the example with functions below, can be fully qualified.  
+
Only the field elements need to be used on the left side of the assignment. For inputs each field elements must be fully qualified such as sensorData.trk1 shown in the example below.  
  
 
===Functions===
 
===Functions===
Functions are parameterized condition tables. For example the tracking avoidance example provides several uses of functions such as:
+
Functions are parameterized condition tables. For example the tracking avoidance example provides several uses of function usage such as:
 
*trackAttributes(sensorData.trk1)
 
*trackAttributes(sensorData.trk1)
 
*advisoryStatus(sensorData)
 
*advisoryStatus(sensorData)
Line 71: Line 70:
  
 
Note, the return value associated with the reference to advisoryStatus is associated with an intermediate values called an INTERM. An  
 
Note, the return value associated with the reference to advisoryStatus is associated with an intermediate values called an INTERM. An  
INTERM variable are local temporary variables that can be assigned from the return of a function. Reference to that INTERM variable can be made in an Assignment or Condition Reference form such as:
+
INTERM variable is a local temporary variables that can be assigned from the return of a function. References to that INTERM variable can be made in an Assignment or Condition Reference form such as:
  
 
  INTERM_x := function(a, b, c)
 
  INTERM_x := function(a, b, c)
  
Note INTERM assignment operator is := as opposed to equality relational operator =
+
Note the INTERM assignment operator is ":=" as opposed to equality relational operator "=:". INTERM variables can be constrained in condition, but must be assigned from the function before additional constraints are applied as shown in the example above. INTERM variables can be assigned to output variable associated with table.
 
+
*INTERM variables can be constrained in condition, but must be assigned from function before additional constraints are applied as shown in the example.  
+
*INTERM variables can be assigned to output variable associated with table
+
  
 
===Arrays===
 
===Arrays===
Single dimensional arrays are supported for structures and scalars.
+
The following provides a look at how single dimensional arrays is to be supported for structures and scalars. The following provides an example for defining an array. Provide a name and select a data types and check the box indicating that the type is an array. Finally, supply a positive integer indicating the size of the array.
 +
 
 +
[[Image:Array_type_declaration.png|center|Array Types]]
 +
 
 +
Arrays are referenced similar to structures or scalars, but using square brackets if a particular array element is to be referenced. An array of size 4 has four elements, starting at location zero (0):
 +
 
 +
  a[0], a[1], a[2] and a[3]
 +
 
 +
An entire array or array elements can be referenced in a condition or an assignment. If a variable is used to index an array, then the range of the variable must be constrained to the size of the array. The following example shows three different ways to assign array information to an array of structures.
 +
* Row 1 shows that the output array is assigned the input array inArray
 +
* Row 2 shows that the zeroth element of the array is assigned two different field values, one for status and another for value
 +
* Row 3 shows that the output array associated with index is assigned to the index of inArray
 +
 
 +
[[Image:Array_reference.png|center|Array Reference]]
  
 
==Modular Organization==
 
==Modular Organization==

Latest revision as of 11:03, 27 October 2008