Determine iteration requirement when transitioning to fixed cost
returns a structure array with the fields
s = simscape.getLocalSolverFixedCostInfo(
MaxIterations, which report the network path to the Solver Configuration block and the optimal value to enter in the
Nonlinear iterations parameter of the Solver
-1 if the simulation fails to converge.
Transition a Model to Fixed Step, Fixed Cost
This example uses the model from the Permanent Magnet DC Motor example to demonstrate how to use the
simscape.getLocalSolverFixedCostInfo function. The function returns
the number of iterations to enter in the Nonlinear iterations
parameter of the Solver Configuration block.
myModel = 'ssc_dcmotor'; open_system(myModel)
Once the model opens, double-click the Solver Configuration block. Check the Use local solver check box, and uncheck the Use fixed-cost runtime consistency iterations check box. Then click OK.
If you leave Use fixed-cost runtime consistency iterations checked, the function only tries the number of iterations specified in the Nonlinear iterations parameter, otherwise it tries 100 iterations.
Return to the Command Window.
s = simscape.getLocalSolverFixedCostInfo(myModel)
s = struct with fields: SolverPath: 'ssc_dcmotor/Solver↵Configuration' MaxIterations: 2
MaxIterations field reports that this model requires
2 iterations per step to run as a fixed step, fixed cost
Open the model, and check the Use fixed-cost runtime consistency
iterations parameter box for the Solver
Configuration block. Enter the value from the
MaxIterations field for the Nonlinear
iterations parameter, and click OK. The model is now
optimized for a fixed-step, fixed-cost solver.
modelName — Model name
character vector | string scalar
Model name as a character vector or string scalar. If the model is not on the MATLAB® path, the model name must include the full path.
Assumptions and Limitations
The function does not support Simscape™ Multibody™ networks.
The function does not support rapid accelerator mode.
The function does not support fast restart.
Introduced in R2021b