Model Object#
- class Model(**kwds)#
Model class is a container for all objects of a simulation.
- Parameters:
output – A string that defines the root name for all output files.
comment – A string that specifies a comment associated with the model.
- control(function, routine=None, script=None)#
Defines a control command for one or more simulations. The execution of the command is deferred to CONSUB.
- Parameters:
function (str) – The list of parameters that are passed to the user-defined subroutine.
routine (str) –
String containing the path of the DLL, followed by ‘::’ and the name of the Consub function.
A callable python function.
script (str) – Points to a file that contains the consub function defined in routine.
- generateOutput(visualize=False, timeout=None, verbosity_level=0, **kwds)#
Creates plt and animation h3d files.
- Parameters:
visualize (bool) – If visualize argument is set to True, HyperView player is invoked and the h3d file of the model is loaded.
timeout (float) – A number indicating the time in seconds allowed for the execution.
verbosity_level (int) –
0 - No output is printed to the screen.
1 - Print only warnings to the screen.
2 - Print all messages to the screen
**kwds –
Additional keyword arguments to control the output generation. Supported keywords are listed below. If these are unspecified, the behavior will be determined by the type of analysis performed.
”frf” - If True, a file ending in ‘_frf.h3d’ file is generated.
”lin” - If True, a file ending in ‘_linz.h3d’ file is generated.
The frf h3d file contains frequency response results, and it can be opened in HyperGraph. In HyperView it shows the nodal deformations for each frequency. The linz h3d file contains the nodal deformations for linear analysis.
- generate_abcd(pinput=None, poutput=None, returnResults=False)#
Generate a state space representation of the model in the form of state matrices A, B, C, and D in the desired format.
- Parameters:
- Returns:
A dict of matrix names to values (‘a’, ‘b’, ‘c’, ‘d’, ‘e’) if returnResults is True.
- generate_eigensolution(nodamping=False, kinetic=False, returnResults=False)#
Perform eigen-analysis of the model, generate eigenvalues and mode shapes.
- Parameters:
nodamping (bool) – Ignores damping for all forces during the eigenvalue solution.
kinetic (bool) – Specifies whether the modal kinetic energy distribution is written out.
returnResults (bool) – Flag to indicate that EigenValue data is to be returned to the caller.
- Returns:
A dict of vectors where the key is the name of the component [‘real’, ‘imag’, ‘freq’, ‘cratio’, ‘nat_freq’] and the value is a list of components for each mode.
Example
eigenInfo = model.simulate(type="LINEAR", returnResults=True) print(eigenInfo['freq']) # mode 0 mode 1 mode 2 mode 3 mode 4 mode 5 >> (1591.5494309, 1591.5494309, 1591.54989555, 5032.92486205, 5032.9448705, 5032.928844)
- realtime_empowered#
Type=Bool, Default=False
- reset(restart=True)#
Reset the model. Subsequent simulation commands will start at time = 0.
- runSimulationEvents(events=None)#
Run SimulationEvent objects sequentially. In the case where the time sequence of the events is invalid, the method return nothing and urges the user to check the events list.
- Parameters:
events (list(SimulationEvent), default=None) – The SimulationEvents that will run sequentially. If None, the model.events are used. IMPORTANT! The sequence in which the events lie in the list determines the execution sequence.
- save_model(file)#
Saves a snapshot of the model.
- Parameters:
file – A string corresponding to the file being created on your filesystem. The file is created by the pickle module.
- simulate(type='DYNAMICS', end=None, dtout=None, duration=None, steps=None, dsa=None, start=None, print_increment=None, constraint_tol=None, implicit_diff_tol=None, onOutputStep=None, returnResults=False, output='on', validate=True, active_contact_iteration=False, numThread=-99999, acusolve_cosim=False, save_increment=None, save_inc_overwrite=False, store=False, frequency_input=None, increment_type='LINEAR', **kwds)#
Sends the model to the solver and runs the simulation.
- Parameters:
type (Enum) –
The type of simulation. Valid choices are:
”ASSEMBLY”
”DYNAMICS”
”TRANSIENT”
”KINEMATICS”
”STATICS”
”FREQUENCYRESPONSE”
”LINEAR”
end (float) – The end time of the analysis for time based domain, or the end frequency in case of FREQUENCYRESPONSE
type
.dtout (float) – The print interval.
duration (float) – The duration of the analysis.
steps (int) – The number of output steps to take between start and end.
dsa (Enum) –
The type of design sensitivity analysis. Valid choices are:
”NONE”
”AUTO”
”DIRECT”
”ADJOINT”
”FD”
”FD_SERIAL”
start (float) – The start time of the analysis, or the start frequency in case of FREQUENCYRESPONSE
type
print_increment (float) – The frequency of output in terms of the integrator steps that have been taken.
constraint_tol (float) – The tolerance on all algebraic constraint equations that the corrector must satisfy at convergence.
implicit_diff_tol (float) – Modifies the accuracy to which implicit differential equations are to be satisfied.
onOutputStep (callable function) – Supply a callable UPOST function that you want to be called at every output step.
returnResults (bool) – Specifies if run data will be returned to the caller.
output (Enum) –
Specifies protocol of standard output. Valid choices are:
”on”
”off”
”fileonly”
validate (bool) – Specifies if the model will be validated before submission (default True).
numThread (int) – Specifies the number of threads for Open MP multithreaded contact simulation.
active_contact_iteration (bool) – Specifies whether the contact residual is being updated during the corrector step of the implicit solver and an analytical Jacobian is provided or not. A value of True means that the residual is being updated.
acusolve_cosim (bool) – Specifies if this simulation is a MotionSolve-AcuSolve co-simulation.
save_increment (int) – Dumps the XML file every save_increment multiple of print interval.
save_inc_overwrite (bool) – Overwrite the XML file each time or create a new one every save_increment with time stamp added to the file name.
store (bool) – Stores the simulation results in a list on the model.
frequency_input (list(Reference)) – Select one or more frequency excitations defined in the model. If no frequency_input is defined, all frequency_input instances in the model will be used. Used if type is ‘FREQUENCYRESPONSE’.
increment_type (Enum) –
The increment type for the Frequency Response Simulation. Valid choices are:
”LOG”
”LINEAR”
- Returns:
- SimulationResults
Output states for Bodies, Requests and Rvs.
- simulate_frequencyResponse(start, end, steps, frequency_input=None, increment_type='LINEAR', validate=False, returnResults=False, output='on', store=False)#
Performs a frequency response analysis of the model
- Parameters:
start (float) – The start frequency of the analysis.
end (float) – The end frequency of the analysis.
frequency_input (list(Reference)) – Select one or more frequency excitations defined in the model. If no frequency_input is defined, all frequency_input instances in the model will be used.
increment_type (Enum) –
The increment type for the Frequency Response Simulation. Valid choices are:
”LOG”
”LINEAR”
onOutputStep (callable function) – Supply a callable UPOST function that you want to be called at every output step.
returnResults (bool) – Specifies if run data will be returned to the caller.
output (Enum) –
Specifies protocol of standard output. Valid choices are:
”on”
”off”
”fileonly”
steps (int) – The number of output steps to take between start and end.
- verify(validate=True, **kwds)#
Sends the model to solver and performs a verification analysis. Validation of the model can be optionally skipped.
- Parameters:
validate (bool) – Specifies if model validation is to be performed.
- Returns:
- count (int)
Total number of kinematic independent coordinates computed by MotionSolve.