Examine model for performance analysis
res = solverprofiler.profileModel(model)
res = solverprofiler.profileModel(model, Name,Value)
Examine the model
f14 using the default
model = 'f14'; res = solverprofiler.profileModel(model);
You can see a summary of the results by calling
struct with fields: solver: 'ode45' tStart: 0 tStop: 60 absTol: 1.0000e-06 relTol: 1.0000e-04 hMax: 0.1000 hAverage: 0.0444 steps: 1352 profileTime: 0.9974 zcNumber: 0 resetNumber: 600 jacobianNumber: 0 exceptionNumber: 195
Open the results in the Solver Profiler dialog to visualize them. This
step is equivalent to enabling
OpenSP when calling the
Examine the model
ssc_actuator_custom_pneumatic with a fully specified
model = 'ssc_actuator_custom_pneumatic'; res = solverprofiler.profileModel(model, ... 'SaveStates' , 'on', ... 'SaveSimscapeStates' , 'On', ... 'SaveJacobian' , 'On', ... 'StartTime' , 5, ... 'StopTime' , 50, ... 'BufferSize', 10000,... 'TimeOut', 5,... 'OpenSP', 'On',... 'DataFullFile', fullfile(pwd, 'ssc_profiling_result.mat'));
model— Model to examine
Name of model to be profiled, specified as a character vector.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside single quotes (
' '). You can
specify several name and value pair arguments in any order as
'SaveStates'— Save model states to file
By default, the profiler does not save the states of the model. Enabling this parameter configures the profiler to save the states to a MAT-file.
'SaveSimscapeStates'— Save states to file
Enable this parameter to save states to a MAT-file.
'SaveJacobian'— Save model Jacobian
Option to log the solver Jacobian matrices to memory. This option is useful for simulations that use implicit solvers. For a comparison of solvers, see Solver Classification Criteria.
'StartTime'— Profiler start time
Time, in seconds, of the simulation that the profiler starts analyzing the model. This is not the same as the start time of the simulation.
'StopTime'— Profiler stop time
Time, in seconds, of the simulation to which the profiler should profile the model. By default, the analysis continues until the end of the simulation. Changing this parameter does not change the stop time of the model which you specify in the Model Configuration Parameters.
A value less than the configured stop time of the model stops the
profiling and simulation at
'BufferSize'— Memory impact of logging
Maximum number of events that are logged. If the number of logged
events reaches this value and memory is available, increase
BufferSize. If memory is limited, consider
lowering the value.
'TimeOut'— Maximum time to wait for solver to resume
Time, in seconds, to wait before the profiler stops running. This option is useful in situations where the simulation is unable to proceed. The profiler waits for the specified time and quits if no progress has been made.
'OpenSP'— Open the Solver Profiler dialog box
Choice to open the Solver Profiler dialog box after profiling has completed.
'DataFullFile'— Path and name of saved results
By default, the profiling results are saved in a MAT-file named
model_@_dd_Month_yyyy_hh_mm_ss.mat in the current
working folder. You can specify a different file name by which to save
the results in the current working folder. To save the file in a
different location, specify the full path of the file, including the
res— High-level summary of profiling results
Profiling results, returned as a structure with the fields:
file— Full path and name of saved results
Path and name of the MAT-file where the results of the
profiling operation are stored as MAT file. By default, they are
stored in the current working folder with a file name having the
To store them in a different location or by a different name,
DataFullFile when calling
summary— Summary of profiling results
A high-level summary of the results of the profiling operation, returned as a structure. The summary provides an overview of the performance of the simulation and health of the model.
summary structure contains these
|Solver used by simulation||any of the solvers supported by Solver Profiler||Solver used by the simulation as configured in the Configuration Parameters for the model. For a list of all the solvers, see Solver. The Solver Profiler does not support models without any continuous states.|
|Start time of simulation||scalar||Start time, in seconds, for the simulation of the model during the profiling operation.|
|Stop time of simulation||scalar||Stop time, in seconds, of the simulation
during the profiling operation. If
|Absolute tolerance of the solver||positive scalar||Absolute tolerance of the solver as specified in the configuration settings for the model. For more information, see Absolute tolerance|
|Relative tolerance of the solver||positive scalar||Relative tolerance of the solver as specified in the configuration settings of the model. For more information, see Relative tolerance|
|Maximum step size||positive scalar||Largest time step that the solver can take. See Max step size.|
|Average step size||positive scalar||Average size of the time step taken by the solver.|
|Total steps taken||positive scalar||Total number of time steps taken by the solver.|
|Time to profile||positive scalar||Time, in seconds, taken by the Solver Profiler to examine the model.|
|Total number of zero crossings||nonnegative scalar||Number of times zero crossings occur during the simulation of the model. The detection of these zero crossings incurs computational cost and can slow down the simulation. For information on zero-crossing detection, see Zero-Crossing Detection.|
|Number of solver resets||nonnegative scalar||Number of times the solver has to reset its parameters.|
|Number of Jacobian updates||nonnegative scalar||Number of times the solver Jacobian matrix is updated during a simulation. For more information, see Explicit Versus Implicit Continuous Solvers.|
|Number of solver exceptions||nonnegative scalar||Total number of solver exceptions encountered during a simulation. These exceptions are events where the solver is unable to solve the model states to the specified accuracy. As a result, the solver runs adjusted trials which increase computational cost.|