# Model/Simulate

## Usage

simulate (type="DYNAMICS", start=0.0, end=None, duration=None,
dtout=None, steps=None, dsa="", start=None, print_increment=None, constraint_tol=None,
implicit_diff_tol=None, onOutputStep =None, returnResults=False, output="on")

## Attributes

type
String
Defines the type of analysis to be performed. You must select one from:
• "Static"
• "Dynamics"
• "Linear"
• "Assembly"
type is optional. When not specified, type is set to "DYNAMICS"
start
Double
Defines the starting time value for a simulation.
This attribute is optional. start defaults to 0.0 when not specified.
end
Defines the end time for a simulation.
duration and end are mutually exclusive. Only one of these must always be specified.
0 ≤ start < end
duration
Double
Specifies the duration of the analysis. Thus end = start + duration
duration and end are mutually exclusive. Only one of these must always be specified.
duration > 0
dtout
Double
Defines the time interval between consecutive output steps for plotting and animation output.
dtout is optional. Defaults to 0.01 when not specified.
When specified, dtout > 0
Note that the maximum integrator step size (HMAX) is set to the dtout if dtout is smaller than HMAX.
steps
Integer
Defines the number of output steps to take between start and end.
steps and dtout are mutually exclusive. Only one of these must always be specified.
When specified, steps > 0.
dtout will be determined as (end-start)/steps.
Note that the maximum integrator step size (HMAX) is set to the dtout if dtout is smaller than HMAX.
dsa
String
Defines the type of design sensitivity analysis to perform in conjunction with the analysis. When specified you must select one of:
• "Auto": MotionSolve will determine the best algorithm to use for computing design sensitivities
• "Adjoint": MotionSolve will use the Adjoint method for computing design sensitivities. This method is recommended when there a lot of design variables and only a few responses.
• "Direct": MotionSolve will use the Direct Differentiation method for computing design sensitivities. This method is recommended when there a few design variables and but many responses.
dsa is optional. When it is not specified, no design sensitivity analysis is done. Design sensitivity analysis can be expensive. So you should specify dsa only when you need it.
start
Double
Currently unsupported.
print_increment
Double
Specifies the frequency of output in terms of the integrator steps that have been taken. An output is performed when the function:

mod (integration_step_number, print_increment) = 0.

print_increment is optional.
• When specified, print_increment > 0
• print_increment = 1 generates outputs at every integration step
• print_increment = n generates outputs at every nth integration step
constraint_tol
Double
Specifies the accuracy to which the simulation is required to satisfy the constraints (Joints, Jprims, Motions, etc.) in the model.
constraint_tol is optional.
• When specified, constraint_tol > 0
• When not specified, constraint_tol = 1.0e-4

Be careful when using constraint_tol.

• If the value is too small, simulations may take a significantly longer time. Simulations may even fail because they cannot satisfy the value you provided
• If the value is too large, results will become noisy and inaccurate.
• Change the default value only when you see that the results are noisy with the default value. Decrease it by successive factors between 2-5, see the effect of the change and then finalize a value. Do not decrease it by a large factor such as 100.
implicit_diff_tol
Double
Specifies the accuracy to which the implicit differential equations in your model are satisfied. These are the DIFFs in your model that have implicit = True.
The argument implicit_diff_tol is optional. When not specified, implicit_diff_tol = 1.0E-5.
onOutputstep
Python function
This is a callback function that will be invoked when the solver hits an output step. It can be used for animation, live plots etc..
returnResults
Boolean
returnResults is a boolean that, if True, causes the simulate command to return a data structure filled with results.

## Examples

# Create a model
m = CreateStewartPlatform (output="Stewart-Platform")

# Do a static analysis first
m.simulate (type="Statics", returnResults=True)

# Then do a dynamic analysis
run=m.simulate (type="DYNAMICS", end=1.77, dtout=0.01, returnResults=True)

Having defined returnResults to True causes the run object to be populated with output data from the simulation. By default, Bodies transformations, Request and Response Variables generate the output that populates the run object.