Array

Model ElementThe Array model statement specifies a list of variables (which are used by other MotionSolve modeling elements) or constants.

Class Name

Array

Description

To specify a list of variables, choose from one of the following types:
  • X: This type is used to store the state vector corresponding to the GSE and TFSISO elements.
  • Y: This type is used to store the output vector corresponding to the GSE and TFSISO.
  • U: This type is used to store the input vector corresponding to the GSE, TFSISO and PINPUT elements. The data stored in this type is a list of IDs for VARIABLE elements that specify the inputs to the modeling elements.
To specify a list of constants, choose the following type:
  • IC: This type is used to store a set of numbers primarily to specify initial conditions for GSE and TFSISO elements. You may also use this type to define a set of numbers in the model file and access them from a user-written subroutine.

Attribute Summary

Name Property Modifiable by Command? Designable?
id Int()   NO
label Str() Yes  
type Enum("Y X IC U")    
size Int()    
numbers Double(count=0) Yes FD Only
variables Reference("Variable",count=0)   Yes
function Function    
routine Routine    
script Script    
active Bool() Yes  

Usage

# Array of type X
Array (type="X", optional_attributes)

# Array of type Y
Array (type="Y", optional_attributes)

# Array of type U
Array (type="U", variables=list, optional_attributes)

# Array of type IC
Array (type="IC", numbers=list, optional_attributes)

Attributes

Array of type X
type
String
Specifies the type of the ARRAY being created. Set type="X".

The type attribute is mandatory.

Array of type Y
type
String
Specifies the type of the ARRAY being created. Set type="Y".
The type attribute is mandatory.
Array of type U
type
String
Specifies the type of the ARRAY being created. Set type="U".

The type attribute is mandatory.

variables
List of references to existing Variables.
Specifies the Variable objects used to define the array of type="U".
The variables attribute is mandatory for an Array of type="U".
Array of type IC
type
String
Specifies the type of the ARRAY being created. Set type="IC".

The type attribute is mandatory.

numbers
List of numeric values
A list of numeric values that the Array provides to whomever asks for it.
The numbers attribute is mandatory for an Array of type="IC".
Optional attributes - Available to all variants
id
Integer
Specifies the element identification number. This number must be unique among all the Array objects in the model.
This attribute is optional. MotionSolve automatically creates an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Array object.
This attribute is optional. When not specified, MotionSolve creates a label for you.
size
Integer
The number of items in Array.
This attribute is optional.

Example

1: Compare XML vs. Python input for the examples in the XML section of the document.
XML Python interface
<Reference_Array id="101" type="X"

num_element="4" />

x = Array (type="X")
<Reference_Array id="101" type="Y"

num_element="1" />

y = Array (type="Y")
<Reference_Array id="103" type="U"

num_element="4"

variable_id="8, 2, 9, 11" />

varlist = [var8, var2, var9, var11]

u = Array (type="U", variables=varlist)

<Reference_Array type="IC"

num_element="4">

0.0 0.0 0.0 0.0

</Reference_Array>

numlist=[0,0,0,0]

ic = Array (type="IC", numbers=numlist)

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  2. For a more detailed explanation about Array, see the Comments in Reference: Array.