Main Content

Model Simulation

SimBiology® lets you simulate the dynamic behavior of a model. Before and during simulation, SimBiology performs a series of steps including converting the model reactions and rate rules into a set of ordinary differential equations (ODEs) that mathematically describe the model dynamics.

Specifically, before simulation begins, SimBiology:

  1. Verifies the model. For details, see Model Verification.

  2. Determines the initial conditions, that is, the quantity values at the beginning of simulation. In particular, SimBiology first initializes the quantity values based on the values specified in the model. Second, it updates the values by replacing them with the corresponding alternate values from variants if any. Then it updates the values based on the initial assignments and repeated assignments. SimBiology evaluates initial assignments and repeated assignments as a set of simultaneous constraints, and their order do not affect the final quantity values. For details, see Evaluation Order of Rules.

  3. Constructs the ODEs based on model reactions and rate rules. Specifically, the left-hand-side (LHS) of each ODE represents the time-derivative of a model quantity. The right-hand-side (RHS) is defined using reaction fluxes that are derived from reaction rates. For details, see Derive ODEs from SimBiology Reactions.

  4. Converts doses to state transitions that occur at specific simulation times.

  5. Converts event functions to state transitions that depend on the conditions specified in the event triggers.

When the simulation begins, that is, at simulation time = 0, SimBiology:

  1. Updates values based on initial assignments and repeated assignments.

  2. Applies any state transitions due to dosing specified at simulation time = 0.

  3. Logs the updated quantity values.


Events cannot cause transitions at time = 0 since events only apply when a trigger changes from false to true. If a trigger is true at simulation time = 0, then no transition has occurred and the event is not triggered.

During the simulation, SimBiology uses a solver to compute solutions for ODEs at different times. Specifically, the solver determines appropriate time steps and performs the following at each step.

  1. Updates values for any repeated assignments.

  2. Checks each event’s trigger condition. If it switches from false to true at this time step, then it applies the state transitions according to the event functions, and updates values for any repeated assignments.

  3. Logs the updated quantity values.

To see the system of ODEs of a model, use getequations at the command line or follow instructions in Show Model Equations and Initial Conditions for the SimBiology Model Builder app.


If a model has algebraic equations, you must specify one of the following differential-algebraic-equation (DAE) solvers: sundials, ode15s, ode23t. SimBiology converts the algebraic equations to algebraic constraints and solves them along with the rest of ODEs. For details about available solvers, see Choosing a Simulation Solver.

See Also

Related Examples

More About