Links
🔩

Using Simulation Configuration Settings

Getting you familiar with the simulation configuration settings

Simulation Duration

  • Simulation stop time: numerical value, Default = 10
    • Specifies the end point of simulation in time

Solver Settings

There are 2 types of solvers: continuous and discrete. Continuous solver are further divided into fixed step and variable step. Currently Collimator uses the RK45 (Runge-Kutta 45) solver for all model types.

Continuous Solver

Common settings

  • Solver type: Variable step | Fixed step, Default = Variable Step
    • Variable step solver uses a variable time step bounded by the solver settings such as min/max step size and error tolerances. See next section for details.
    • Fixed Step solver uses a fixed time step for computation regardless of integration error
  • Events handling: None | Normal, Default = Normal.
    • None disables all events handling code. For models that include blocks that can have events associated with them (e.g. comparator), but events are not required for the model, this will be the most efficient selection.
    • Normal enables event handling such that discontinuities in the ODEs are handled correctly. This mode does also handles events that exhibit zeno behavior.

Variable step solver settings

  • Absolute error tolerance: numerical value, Default = 1.0e-6
    • Specifies the limit on the absolute error tolerance for a successful integration step.
    • See Global Error Calculation below
  • Relative error tolerance: numerical value, Default = 1.0e-3
    • Specifies the limit on the relative error tolerance for a successful integration step.
    • See Global Error Calculation below
  • Initial step size: numerical value, Default = Auto
    • Specifies the initial step size for the variable step solver
    • Allows users to specify the size of the first step taken which is important since the first step cannot be determined very well by solver, so the user should provide some scale of the first step. When in doubt, make this very small.
  • Minimum step size: numerical value, Default = Auto
    • Specifies the minimum step size for the variable step solver.
  • Maximum step size: numerical value, Default = Auto
    • Specifies the maximum step size for the variable step solver.
  • Interpolation: numerical value, Default = Auto
    • Specifies the maximum interval at which results are computed by higher-order interpolation. Results are always provided for solver steps, but when solver steps are larger than this interval, results will be interpolated such that this maximum interval is respected. It is technically possible to achieve a similar effect by setting the Maximum step size, but it may be faster to use interpolation.
    • The Interpolation method depends on the solver being used. For example, when using Rk45, the interpolation method is described in L. W. Shampine, "Some Practical Runge-Kutta Formulas", Mathematics of Computation,, Vol. 46, No. 173, pp. 135-150, 1986.

Fixed step solver settings

  • Absolute error tolerance:
    • Same as variable step.
    • Used by the solver to provide accuracy estimation feedback so the user is warned when fixed step solver accuracy is poor.
    • See Global Error Calculation below
  • Relative error tolerance:
    • Same as variable step.
    • Used by the solver to provide accuracy estimation feedback so the user is warned when fixed step solver accuracy is poor.
    • See Global Error Calculation below
  • Fixed step size: numerical value, Default = Auto
    • This setting specifies a fixed interval the solver computes the result.
    • Auto means a default of 0.01 is used.

Global Error Estimation, Fixed and Variable Step

This section is informative only. The intent is to provide some context for what the tolerance setting mean.
  • For each state in the set of ODEs, the solver estimates the error magnitude of the approximated state value. This error is then normalized using the Absolute and Relative tolerance settings. The set of normalized errors are then used to compute the root-mean-square error for the system of ODEs.
  • The normalizing scale for each state is computed as follows:
    • scale[i] = atol + fmax(fabs(y_prev[i]),fabs(y_new[i]))*rtol;
  • The error tolerance is used to optimize the step size of the variable solver. If the RMS error is above 1.0, the step size needs to be decreased. If the error is below 1.0 , the step size can be increased.
  • Smaller tolerances produce more accurate solutions. Smaller tolerances also require more computation time.

Discrete Solver

Currently Collimator uses a single rate (i.e. one discrete step, or sample time) which applies to all discrete blocks in a model. In the future, users will be able to define discrete step for individual blocks of the same model for multi-rate systems.

Discrete Solver settings

  • Discrete Step: text field, Default = 0.1
    • Specifies the time step the discrete solver will apply to all discrete blocks in the model (similar to the “sample time” concepts in other simulation tools).