Solver Arrays

Use the Arrays tool to create solver arrays and set solver array data. Solver array types include X array, Y array, U array, IC array, Plant Input array, and Plant Output array.

Create Solver Arrays

  1. From the Project Browser, select the system to which the solver array is to be added.
  2. Right-click on a system in the Project Browser and select Add > Control Entity > Solver Array from the context menu.
    OR
    Right-click on a solver differential equation folder in the Project Browser and select Add Solver Array from the context menu.
    OR
    From the Model ribbon, click the arrow next to the References tool set name, then select Arrays icon.
    The Add Solver Array dialog is displayed.
  3. Specify a label for the solver array.
    The label can be changed at any time.
  4. Specify a variable name for the solver array.
    By default, variables names of entities in MotionView follow a certain convention. For example, all solver array entities have a variable name starting with “sa_”. This is the recommended convention to follow when building models in MotionView since it has many advantages in model editing and model manipulation.
  5. Click OK to close the window or Apply to continue creating entities.
    Once a solver array entity has been added to the model, the panel for the array will automatically be displayed in the panel area.

Edit Solver Arrays

Use the Solver Arrays panel to edit the type of array and any array values.

There are six types of solver arrays:
Type Description
X Used as the state variable array for systems modeling elements of Control_StateEqn (MotionSolve), GSE and LSE (ADAMS), and TFSISO. See notes below.
Y A type Y solver array defines the output array for system modeling elements of LSE, GSE, and TFSISO. See notes below.
Plant Input Describes the signals that the mechanical system receives from the controller.
Plant Output Describes the signals that the mechanical system sends to the controller.
U Groups sets of variables. Generally used as an Input Array for Control_StateEqn (MotionSolve)/GSE (ADAMS).
IC A type IC solver array can be used as a general array in order to pass data into user subroutines. Arrays of type IC are also used to set the initial conditions for the Control_StateEqn (MotionSolve)/GSE (ADAMS) and LSE statements.
Note:
  • Control_StateEqn for MotionSolve or GSE for ADAMS can now be modeled using the Control State Equation entity.
  • This entity implicitly creates the X and Y solver arrays. There is no need to define these arrays separately if using the Control State Equation entity.

Define the Properties of Solver Arrays

From the Properties tab, you can select the array type.

  1. If the Solver Arrays panel is not currently displayed, select the desired solver array by clicking on it in the Project Browser or in the modeling window.
    The Solver Arrays panel is automatically displayed.
  2. Select an option from the Array type drop-down menu.
    If you select the X, Y, or IC, you do not need to enter any additional information. However, if you select the U, Plant Input, or Plant Output, additional options are available.
  3. Double-click the SolverVariable collector and select the solver variable assigned to the array from the Model Tree.
  4. Add additional arrays by entering a number in the Append text box and click Append.
    Clicking Append adds a new array to the bottom of the list.
    Tip:
    • Select the check box next to any of the solver variables and click Insert to add an array directly above the selected entity.
    • To delete an array, select any array from the list and click Delete.
  5. Use the SolverVariable collector to define any added arrays.
  6. For array types of Plant Input and Plant Output, define the additional options provided.
    1. Choose a hold order of 0, 1, or 2 from the drop-down menu.
      The hold order specifies the order of interpolation applied to the control signal propogating out of the solver array.
    2. Activate the Use sampling time option and enter a value in the text box.
      This parameter can be activated when the solver array is used for simulation with discrete systems, such as co-simulation with Simulink. It specifies the sample time of an input port. If not specified, a value of 0.0 is considered for continuous sampling while any other non-zero value specifies discrete sampling. This value cannot be negative.
    3. Activate the Use offset time option and enter a value in the text box.
      This parameter can be activated along with Use sampling time when the solver array is used for simulation with discrete systems, such as co-simulation with Simulink. It specifies the sample time offset for each input port and must be less than the sampling time if the latter is non-zero. If the sampling time is 0.0 (continuous), then offset time defaults to 0.0 as well.
    4. Check the User-defined properties option to use a user subroutine to define the arrays.
      Tip: An option called Use in linearization also becomes available for array types of Plant Input and Plant Output. Activate this option to use Plant Input and Plant Output arrays to represent the A, B, C, and D matrices during a linear analysis. Refer to the <Param_Linear MotionSolve statement for more details.

Define the Values of Solver Arrays

The Values tab only becomes available if you select IC as the array type in the Properties tab.

From the drop-down menu on the Values tab, select File, Math, or Values as the data source for the IC solver array type.
If File is chosen:
  1. Click the file browser to select the data file for the array
  2. Define the Type, Request, and Component options for each array.
    Depending on the file chosen, the options may already be filled in.
  3. Enter a value in the Start Index field to specify the index number of the first data point in the subrange.
    The default is 1.
  4. Enter a value in the End Index field to specify the index number of the last data point in the subrange.
    The word "last" can be used to specify the last data value in the file without knowing how many data points are in the file.
  5. Enter a value in the Increment field to specify the number of points to advance when reading the subrange.
    For example, to read every data point in the file, enter an Increment value of 1; to read every other data point, enter a value of 2. The default is 1.
If Math is chosen, enter a math or Templex expression to define the array mathematically.
If Values is chosen, enter data values for each IC array.
Note: Activating the check box in the upper right corner of the panel will allow you to insert, cut, copy, and paste data point values to the table.
Tip: Click to view the Data Values dialog containing all data points.

Use User-Defined Properties for a Solver Array

If desired, define the solver array using the User-Defined tab, which will allow you to specify the properties of the array using user subroutines.

Note: This option is only available for array types of Plant Input and Plant Output.
  1. From the Properties tab, click the User-defined properties check box.
  2. Click the newly added User-Defined tab.
  3. Define the user subroutine.
    1. Provide an expression with the USER solver function with parameters being passed to the user subroutine.
    2. Alternatively, activate the Use local file and function name check box to specify a local file where the subroutine code can be accessed by the solver.
      If this option is not specified, MotionSolve will search for a subroutine following its user subroutine loading rules.
    3. Select a function type from the drop-down menu.
    4. Select the local file for the subroutine.
      The type of file to be specified will depend on the selected function type. For example, if DLL/SO is selected, you can specify a file with a .dll extension (for Windows) or an .so extension (for Linux).
    5. Specify the function name in the subroutine that defines the entity, or accept the default name provided by HyperWorks.