Model Element |
|||||||||
Description |
|||||||||
The Reference_Array model statement specifies a list of variables (which are used by other MotionSolve modeling elements) or constants.To specify a list of variables, choose from one of the following types:
To specify a list of constants, choose the following type:
|
|||||||||
Format |
|||||||||
<Reference_Array id = "integer" [ label = "string" ] { type = "U" num_element = "integer" [ variable_id = "integer integer ... integer"> | usrsub_dll_name = valid_path_name usrsub_param_string = "USER( [[par_1 [, ...][,par_n]] )" usrsub_fnc_name = "custom_fnc_name" > | script_name = valid_path_name interpreter = "PYTHON" | "MATLAB" usrsub_param_string = "USER( [[par_1 [, ...][,par_n]] )" usrsub_fnc_name = "custom_fnc_name" > ] | type = "X" num_element = "integer" >
| type = "Y" num_element = "integer" >
| type = "IC" num_element = "integer" > } ! ! The data ! real real real real real real ... ... ... ... ... ... real real real real real real
</Reference_Array> |
|||||||||
Attributes |
|||||||||
id |
Element identification number (integer>0). This number is unique among all the Reference_Array elements. |
||||||||
label |
The name of the Reference_Array element. |
||||||||
type |
Specifies the type of the Reference_Array being created. Select one from the following:
|
||||||||
num_element |
The number of input variables being specified when the Reference_Array type is U. |
||||||||
variable_id |
List of IDs of the Reference_Variable elements used to define the input array (U). |
||||||||
num_element |
The number of elements being specified when the Reference_Array is of type X (state), Y(output), or ic (initial conditions). |
||||||||
usrsub_param_string |
The list of parameters that are passed from the data file to the user defined subroutine. Use this keyword only when type = U is selected. This attribute is common to all types of user subroutines/scripts. |
||||||||
usrsub_dll_name |
Specifies the path and name of the DLL or shared library containing the user subroutine. MotionSolve uses this information to load the user subroutine ARYSUB in the DLL at run time. Use this keyword only when type = U. |
||||||||
usrsub_fnc_name |
Specifies an alternative name for the user subroutine ARYSUB. |
||||||||
script_name |
Specifies the path and name of the user written script that contains the routine specified by usrsub_fnc_name. |
||||||||
interpreter |
Specifies the interpreted language that the user script is written in. Valid choices are MATLAB or PYTHON. |
||||||||
Comments |
|||||||||
|
|||||||||
Example |
|||||||||
A ball placed on a tabletop is allowed to roll with one degree of freedom along the length of the tabletop (no slipping allowed). A motor controls the angle of the beam (alpha). When the angle is changed from the horizontal position, gravity causes the ball to roll along the beam. A full state feedback controller is used to maintain the ball on the beam. See the image below for a schematic of the system. Ball rolling on a flat table top Linearizing the equations about , the equations governing the ball and controller (shown in red) are:
The parameter c is a function of the mass and inertia properties of the ball, whereas k1, k2, k3, and k4 are properties (gains) of the controller that has been designed. The system has four states: . denote the velocity of the ball and the rate of change of the table angle, respectively. There is one input to the system: a disturbance u to the angular acceleration of the tabletop. There is one output that is being measured: the location of the ball on the tabletop. Assume c=-7 and k1, k2, k3, and k4 are respectively 1.8E3, 1.0E3, 2.0E3 and 1.0E3. We want to specify the Reference_Arrays associated with this example. Assume that all four states start at zero. Specifying the initial conditions array: <Reference_Array id = "102" type = "IC" num_element = "4"> 0.0 0.0 0.0 0.0 </Reference_Array> Specifying the X array: <Reference_Array id = "103" type = "X" num_element = "4" </Reference_Array> Specifying the Y array: <Reference_Array id = "104" type = "Y" num_element = "1" </Reference_Array> Specifying the U array: <Reference_Array id = "104" type = "U" num_element = "4" variable_id = "1, 2, 3, 4" > </Reference_Array> Note that four Reference_Variable elements with IDs 1, 2, 3, and 4 are required to be created somewhere else in the model to define the four inputs. In this example, the first three are set to zero. The fourth represents disturbance due to the tabletop acceleration. |
Model Element |
|||||||||
Description |
|||||||||
The ARRAY model statement specifies a list of variables (which are used by other MotionSolve modeling elements) or constants. To specify a list of variables, choose from one of the following types:
To specify a list of constants, choose the following type:
|
|||||||||
Declaration |
|||||||||
def ARRAY(id, LABEL="", TYPE="", SIZE=0, VARIABLES=[], NUMBERS=[], FUNCTION="", ROUTINE="", SCRIPT=""): |
|||||||||
Attributes |
|||||||||
id |
Element identification number (integer>0). This number is unique among all the ARRAY elements. |
||||||||
LABEL |
The name of the ARRAY element. |
||||||||
TYPE |
Specifies the type of the ARRAY being created. Select one from the following:
|
||||||||
SIZE |
The number of input variables being specified when the ARRAY type is U, or elements being specified when the ARRAY is of type X (state), Y(output), or IC (initial conditions). |
||||||||
VARIABLES |
List of IDs of the VARIABLE elements used to define the input array (U). |
||||||||
NUMBERS |
The list of values that when the ARRAY is of type IC (initial conditions). |
||||||||
FUNCTION |
Specifies the list of parameters that are passed from the data file to the user defined subroutine, ARYSUB. This attribute is common to all types of user subroutines and scripts. |
||||||||
ROUTINE |
Specifies an alternative name for the user subroutine ARYSUB. |
||||||||
SCRIPT |
Specifies the path and name of the user written script that contains the routine. |
||||||||
CommentsSee Reference_Array |
|||||||||
ExampleThe following statements illustrate the use of the ARRAY statement to create an array of different types and sizes. ARRAY(1,TYPE="U",SIZE=2,VARIABLES=[100,101]) ARRAY(2,TYPE="X",SIZE=9) ARRAY(3,TYPE="Y",SIZE=1) ARRAY(4,LABEL="BldGagNd_A",TYPE="IC",SIZE=5,NUMBERS=[1,3,5,7,9]) |
See Also:
The following MDL Model statements: