# Simulation settings

Select **Simulation | Simulation Settings**, click the **Simulation Settings** tool bar button or press F6 to open this window.

The simulation settings window contains four pages:

## General

Here you specify the start and the end times for the simulation and output options.

**Simulation time**

**Start Time**- This setting specifies the start time of the simulationMost often this value will be left at zero (default value), but there might be cases where another value is required.*Default value = 0***End Time**- This setting specifies the stop time of the simulation.*Default value = 100***Time unit**- Select the time unit for the simulation.

**Simulation outputs**

**Output option**– By default, the time vector returned from a simulation contains the exact time steps the ODE-solver has chosen. For difficult numerical solutions the number of time points may be very many. Also, it might be of interest to the user to get values for specific time points. The three output options are:- Produce no additional output - The time vector will only contain the time steps chosen by the ODE solver. This is the default setting.
- Produce additional output - The time vector will contain both the time steps chosen by the ODE solver and the time points given in Time Series. Use this setting when your Model contains discrete events to force the ODE solver to include those time points.
- Produce specified output only - The time vector will contain only the time points given
**Time Series**. This setting will greatly decrease memory consumtion and will improve simulation speed.

Note | For probabilistic, sensitivity analysis and simulation table simulations the output option should be Produce specified output only, otherwise only the start and end time is included in the result. A warning message will be presented in the Errors window. This is to limit the amount of data produced and to guarantee that the same time vector is returned from all simulations. |

**Time points**– This field is only available when the output option is set to either ‘Produce additional output’ or ‘Produce specified output’. To create a time series click the**Add**button. From the window that appears select the type of time series you want to create using the drop-down list. You can add as many time series as you want. However, the possibility to add more than one time series is typically only used when you wish to combine a linear/geometric time series with some custom time points. To remove a time series just click the time series to be deleted and click the**Remove**button.- If you select ‘Custom’, enter the time points in the Time point field separated with commas or blank space.
- If you select ‘Linear’ or ‘Geometric’ time series enter the first and the last time in the Min and Max box respectively. Enter the number of times points in the N box. For example: Start = 5, End = 10, N = 6, Type = Linear will give a time series with the values 5,6,7,8,9 and 10.

In the case of the Linear time series the default value for the Min time is set to the Start Time and for the Max time is set to the End Time. In the case of the ‘Geometric’ time series the default values for the Min and the Max times is set to auto. * If you select ‘Linear Increment’ time series, enter the first and the last time in the Min and Max box respectively. Enter the increment in the increment box. The default value for the Min time is set to the Start Time and for the Max time is set to the End Time. For example: Start = 5, End = 10, Increment = 2.5 will return a time series with the values 5, 7.5 and 10.

**Discrete points**- If there are time points that you wish to force the solver to include you can add these here. For instance, if you have conditions at specific time points it might be a good idea to include these time points here so that the solver does not “step over” an important phase of the simulation.**Add table points**- When selected, all time points from lookup tables are added as discrete time points.

## Outputs

Note | By default, values for all enabled blocks and parameters for all enabled materials will be returned from the simulation. To exclude materials from the simulation you must enable/disable them in the materials window. |

The output page lets you choose simulation endpoints. All blocks of the project are displayed and are organized by sub-system. By selecting/unselecting either endpoints or whole sub-system nodes, you determine which simulation outputs will be available after the simulation is finished.

By removing simulation outputs the simulation time and memory consumption decreases. Also, the list of results will be shorter which makes it easier when creating charts and tables.

As soon as a new block is added to the model, it is also added to the list of outputs.

## Solver

(ODE toolbox) The solver page lets you select numerical solver and edit it’s settings.

For more information on solver settings see Solver settings.

## Batches

(ODE toolbox) This page lets you set up simulation batches which can improve the simulation time drastically.

**Batch mode**- Select to run simulation batches**All**- Create as many batches as possible.**Independent only**- Only allow independent batches.**One batch per compartment**- Create one batch for each compartment (if possible). All materials of each compartment will be run together.**One batch per material**- Create one batch for each material (if possible). All compartments will be run together for each material.**One batch per decay chain**- Create one batch for each decay chain (if possible). All compartments will be run together for each decay chain.**Min. time between data points**- Limit the amount of data saved for each batch by entering a minimum time (in simulation time units) that must pass before another data point is saved. This might be necessary for super-stiff models, where the dt of the solver is very small. When too many data points are saved you might run out of memory, or seriously slow down remaining batches.**Preview**- Shows the batches created following the settings provided above.

## Advanced

**Cache**- When set, the results of calculations for the current time point is stored. This will cause a small overhead, and might require more memory, but will in general provide faster simulation speeds.**Internal cache**- When set, variables that used several times in the same expression will be cached locally prior to the calculation of the expression. Using an internal cache causes slighlty larger models but can give faster simulation speeds.**Re-use functions**- When a model contains many similar expressions, one function can be created which is used by all the expressions. Depending on the model this feature might give either faster or slower simulations speeds.**Report error for NaN or infinity**- Continuousely check all calculations for NaN or infinite values. When the calculations for an object returns NaN or Infinity, the simulation is aborted and an error message is displayed.**Time out**- Enter the maximum number of seconds allowed for a simulation iteration. The iteration will halt and the simulation either (see**Halt on error**) abort or continue with the next iteration. This feature is useful for probabilistic simulations where some parameter combinations might produce unrealistic conditions which take a long time to simulate.**Halt on error**- Select if, when an error occurs or the iteration times out, the simulation should be aborted or continue with the next iteration or scenario.**Display statistics**- If selected, statistics about the simulation is presented after the simulation has finished.**Output statistics**- If selected, extra simulation results are created with statistics from the simulation - such as “simulation time” and “number of errors”.