Main Content

Model Verification

What is Model Verification?

SimBiology® has functionality that helps you find and fix warnings that you might need to be aware of, and errors that would prevent you from simulating and analyzing your model.

Model verification checks many aspects of the model including:

  • Model structure

  • Validity of mathematical expressions

  • Dimensional analysis

  • Unit conversion issues

When to Verify a Model

You can check your model for warnings and errors at any time when constructing or working with your model. For example:

  • Verify your model during construction to ensure that the model is complete.

  • Verify the model after changing simulation settings, dimensional analysis settings, or unit conversion settings.

Analyses such as simulation, scanning, and parameter fitting automatically verify a model.

Tip

Repeatedly running a task using a different variant or setting a different value for the InitialAmount property of a species, the Capacity property of a compartment, or the Value property of a parameter, generates warnings only the first time you simulate a model. Use the verification functionality described in this section to display warnings again.

Verifying That a Model Has No Warnings or Errors

Use the verify method to see a list of warnings and errors in your model.

Use the sbiolastwarning and sbiolasterror functions to return the last warning and last error encountered during verification.

Model Verification Example

  1. Create a model with a reaction that references K1, an undefined parameter:

    % Create a model named example
    model = sbiomodel('example');
    % Add a compartment named cell to model
    compartment = addcompartment(model, 'cell');
    % Add two species, A and B, to the cell compartment
    species_1 = addspecies(compartment, 'A');
    species_2 = addspecies(compartment, 'B');
    % Add the reaction A -> B to the model
    reaction = addreaction(model, 'A -> B', 'ReactionRate', 'K1');
  2. Verify the model to check for warnings and errors:

    verify(model)
    ??? --> Error reported from Expression Validation:
    The name 'K1' in reaction 'A -> B' does not refer to any in-scope species,
    parameters, or compartments.
  3. Address the error by defining the parameter K1:

    % Add a parameter, K1, to the model with a value of 3
    parameter = addparameter(model, 'K1', 3);
    
  4. Verify the model again:

    verify(model)

View Model Equations

As you verify the model, you can view the underlying system of equations of the model. Viewing model equations is useful for:

  • Publishing purposes

  • Model debugging

For details, see getequations or Show Model Equations and Initial Conditions.