Types of Arrays
There are four types of arrays:
■General/Initial Conditions - Define an array of constants used as initial conditions for a system element or
User-written subroutine.
■States (X) and
Outputs (Y) - Designate the state or output variable arrays for a system element, such as a linear state equation, general state equation, or transfer function.
Adams Solver computes these values during a
Simulation.
To use the arrays, you reference them in
function expressions. You can reference the array as the state or output variable array of only one
system element in a model (for example, only one linear state equation or one general state equation).
■Inputs (U) - An array that groups together a set of variables used to define the inputs for a system element. Adams View computes variable values from the specified variable data elements.
The inputs (U) and the initial conditions arrays can exist independently, and do not need to be referenced by another system element.
Both function expressions and user-written subroutines can access the array values. Function expressions use the function ARYVAL (ARRAY_NAME, COMPONENT) to access the values. ARRAY_NAME specifies the name of the array, and COMPONENT specifies the position of the desired value in the array definition.
You should note that you can only access states (X), outputs (Y), and inputs (U) arrays in functions because the initial condition array is not accessible in the model definition. You can access the initial condition array in a user-written subroutine. To access all the elements of an array, call the subroutine SYSARY. To access one element of an array in a subroutine, call the subroutine SYSFNC. See the Subroutines section of the
Adams Solver online help.
Determining Array Size
For the states (X) and outputs (Y)
arrays, the
system element in which the arrays are referenced automatically determines the size of the array and checks it against the array size, if you specify one. For initial conditions and general arrays, Adams View determines the actual size of the array during parsing, as it counts the number of values. When you provide an array size, Adams View checks the count for consistency if you request size checking.
If you specify the size of an array, it should match the number of values or variables in the array or the size needed for the associated element. The following table lists the sizes for arrays used in different system element equations.
For arrays used in: | The array size is: |
|---|
Linear state equation (LSE) | ■States (X) array size must be the same size as the row dimension of the matrix used to define the state transition matrix for the linear system. ■Outputs (Y) size must be the same size as the row dimension of the matrix used to define the output matrix for the linear system or the matrix used to define the feed forward matrix for the linear system. |
Transfer functions (TFSISO) | ■States (X) size is determined by the transformation from polynomial ratio type to canonical state-space form, which is a set of coupled, linear, constant-coefficient differential equations and a single algebraic equation. ■Outputs (Y) size is always 1. |
General state equations (GSE) | ■States (X) size is the same as the number defined in the matching general state equation definition. ■Outputs (Y) size is the same as the number of output equations, as defined in the same general state equation definition. |
To create or modify an array data element:
1. Click the
Elements tab. From the
Data Elements container, click the
Array tool
.
or
(Classic interface) From the Build menu, point to Data Elements, point to Array, and then select either New or Modify.
2. If you selected:
3. If creating the array, accept the default name or assign a new name.
Tip: | You might find it easier to track which array element goes with which system element if you name the array elements and the corresponding system elements with like names. For example, the states (X) array that goes with general state equation GSE_100 would be ARRAY_100; the inputs (U) array would be ARRAY_101; and the outputs (Y) array would be ARRAY_102. |
4. Select the type of array that you want to define. Learn about the
Types of Arrays. The dialog box changes depending on the selection you make.
5. Depending on the type of array you are creating or modifying, enter or change the values in the dialog box as explained in the next table, and then select OK.
To create/modify: | Do the following: |
|---|
General and initial conditions array | In the Numbers text box, enter the values to be stored in the array. |
States (X) | In the Size text box, enter the size of the array. |
Outputs (Y) | In the Size text box, enter the size of the array. |
Inputs (U) | In the Variables text box, enter the variables to be stored. If the array is used as input to a transfer function, then you can enter only one variable. |