Creates a user subroutine based general state equation entity.


*GeneralStateEquation(varname,"label" ,num_outputs [,u_array_ref] [,ic_array_ref] [,icd_array_ref])


The variable name of the general state equation.
Data type: varname
The descriptive label for the state equation.
Data type: string
The number of outputs returned by the state equation subroutine.
Data type: integer
The reference to the input array that is used by the state equation.
Data type: Solver Array
The initial condition for the continuous states of the state equation.
Data type: Solver Array
The initial condition array for the discrete states of the state equation. This is applicable for the ADAMS solver only.
Data type: Solver Array


 *SolverVariable( sv_1, "Input 1" )
 *SetSolverVariable( sv_1, EXPR, `VX(1, 2, 3)`, OFF )
 *SolverVariable( sv_2, "Input 2" )
 *SetSolverVariable( sv_2, EXPR, `STEP(TIME, 0, 1, 5, 200)`, OFF )
 *SolverVariable( sv_3, "Input 3" )
 *SetSolverVariable( sv_3, LIN, 1+1, OFF )
 *SolverArray( u_array, "Input Array", U, sv_1, sv_2, sv_3 )
 *SolverArray( ic_array, "IC Array", IC )
 *SetSolverArray( ic_array, VALUE, 4, 0.0, 
                                       b_0.Izz ) 
*GeneralStateEquation( gse_0, "My Controller", 3, 
                                                 u_array, ic_array )
 *SetGeneralStateEquation( gse_0, USER, "USER(500, 301, 201)" )
  *SetContinuousStates( gse_0, 4, STATIC_HOLD )
 *SetLocalUserDLL( gse_0, "mygsesubdll", "dll_xx", 
                                          "dll_yu" )
 *ActionReactionForce(frc_cont, "Control Force", LOA, 
                                                  P_Global_Origin )
 *SetForce( frc_cont, EXPR, ARYVAL({gse_0.y_array.idstring}, 2)` )
Note: The example above shows the creation of a general state equation for continuous states.







Table 1.
Property Returns Data Type Description
varname varname The variable name of the state equation.
label string The descriptive label for the state equation.
state Boolean Returns true if the entity is active, otherwise false.
id integer The numeric ID assigned to the entity.
num integer The last digit of the ID.
idstring string The assigned ID in string format.
num_output integer The number of outputs from the state equation.
num_states integer The number of continuous states.
ic_array_ref Array The initial condition array for continuous states.
icd_array_ref Array The initial condition array for discrete states.
u_array_ref Array The input array for the state equation.
x_array Array The continuous states array.
xd_array Array The discrete states array.
y_array Array The output array of the state equation.
num_discrete_states integer The number of discrete states.
static_hold Boolean Boolean to specify static hold (or not).
use_ic Boolean Returns true if the initial condition array for continuous states is used, otherwise false.
use_discrete_ic Boolean Returns true if the initial condition array for discrete states is used, otherwise false.
sample_offset real The offset time to be used while sampling for discrete states.
sample_period_expr Expression The expression for the sampling period. This property has child attributes (lin, crv, expr) indicating the sampling period can either take a linear value, a curve, or a solver expression.
sample_period_user Boolean Returns true or false. If true, a user subroutine is used to determine the sampling period for discrete states. If false, the expression specified using sample_period_expr is used.
sample_period_usr_type keyword Returns USER. Used in conjunction with sample_period_usrsub.
sample_period_usrsub Expression The expression that calls the sampling subroutine.


A general state equation is one of the forms of representation of a nonlinear dynamic system through a user subroutine. This statement is written as Control_StateEqn for MotionSolve and GSE statement for ADAMS. This entity supports a state equation with both continuous and discrete states for ADAMS, while supporting only a continuous state for MotionSolve. If the state equation is other than continuous, MotionView will error out.

The num_outputs and u_array_ref arguments are mandatory fields. The u_array_ref should be a Solver Array entity of type U.

Initial condition arrays can be specified through arguments ic_array_ref for continuous state, and icd_array_ref for discrete states. Both these arrays should be Solver Array entities of type IC, and the number of elements in these arrays should match number of states for continuous and discrete states specified using *SetContinuousStates() and *SetDiscreteStates(), respectively.

The definition of this entity is not yet supported through MotionView graphical user interface.

The local user subroutine files and functions can be provided through *SetLocalUserDLL and its associated statements for continuous states only (applicable for MotionSolve and ADAMS) and *SetLocalInterfaceDLL and associated statements (applicable for ADAMS only) for continuous, discrete, or sampled states (a state equation that has both continuous and discrete states).

The X array and Y array (states array and output array) are implicitly defined and their corresponding solver statements are automatically written to the solver deck upon export.