Main Content


Simulation time criteria to stop simulation


StopTime is a property of a Configset object. This property sets the maximum simulation time criteria to stop a simulation. Time units are specified by the TimeUnits property of the Configset object.

A simulation stops when it meets any of the criteria specified by StopTime, MaximumNumberOfLogs, or MaximumWallClock. However, if you specify the OutputTimes property of the SolverOptions property of the Configset object, then StopTime and MaximumNumberOfLogs are ignored. Instead, the last value in OutputTimes is used as the StopTime criteria, and the length of OutputTimes is used as the MaximumNumberOfLogs criteria.


Applies toObject: Configset
Data typedouble
Data valuesNonnegative scalar. Default is 10.


Set Simulation Time Criteria to Stop Simulation

  1. Create a model object named cell and save it in a variable named modelObj. Retrieve the configuration set from modelObj and save it in a variable named configsetObj.

    modelObj  = sbiomodel('cell');
    configsetObj = getconfigset(modelObj);
  2. Configure the simulation stop criteria by setting the StopTime property to 20 seconds. Leave the MaximumNumberOfLogsand MaximumWallClock properties at their default values of Inf.

    set(configsetObj, 'StopTime', 20)
                            Active: 1
                    CompileOptions: [1x1 SimBiology.CompileOptions]
                              Name: 'default'
                             Notes: ''
                    RuntimeOptions: [1x1 SimBiology.RuntimeOptions]
        SensitivityAnalysisOptions: [1x1 SimBiology.SensitivityAnalysisOptions]
                     SolverOptions: [1x1 SimBiology.ODESolverOptions]
                        SolverType: 'ode15s'
                          StopTime: 20
               MaximumNumberOfLogs: Inf
                  MaximumWallClock: Inf
                         TimeUnits: 'second'
                              Type: 'configset'

    When you simulate modelObj, the simulation stops when the simulation time reaches 20 seconds.