The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathW orks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
government’s needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Docu mentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
User’s Guide
Revision History
September 2005 O nline onlyNew for Version 1.0 ( Release 14SP3+)
March 2006Online onlyUpdated for Version 1.0.1 (Release 2006a)
May 2006Online onlyUpdated for Version 2.0 (Release 2006a+)
September 2006 O nline onlyUpdated for Version 2.0.1 (Release 2006b)
March 2007Online onlyRereleased for Version 2.1.1 (Release 2007a)
September 2007 Online onlyRereleased for Version 2.1.2 (Release 2007b)
October 2007Online onlyUpdated for Version 2.2 (Release 2007b+)
March 2008Online onlyUpdated for Version 2.3 (Release 2008a)
October 2008Online onlyUpdated for Version 2.4 (Release 2008b)
March 2009Online onlyUpdated for Version 3.0 (Release 2009a)
September 2009 O nline onlyUpdated for Version 3.1 (Release 2009b)
March 2010Online onlyUpdated for Version 3.2 (Release 2010a)
Modeling
1
SimBiology Model Components .....................1-3
Organization of SimBiology Objects
Model
Compartment
Species
Reaction
Kinetic Law
Parameters
Rules
Events
Configuration Sets
Variants
Simulation Data
...........................................1-6
....................................1-6
..........................................1-6
.........................................1-7
......................................1-7
......................................1-8
...........................................1-9
..........................................1-10
................................1-10
.........................................1-11
..................................1-12
...................1-3
Contents
Defining Reaction Rates with Mass Action Kinetics
Definition of Mass Action Kinetics
Zero-Order Reactions
First-Order Reactions
Second-Order Reactions
Reversible Mass Action
Defining Reaction Rates with Enzyme Kinetics
Simple Model for Single Substrate Catalyzed Reactions
Enzyme Reactions with Differential Rate Equations
Enzyme Reactions with Mass Action Kinetics
Enzyme Reactions with Irreversible
Definition of Constant and Boundary Properties
Changing Species Amounts with Reactions or Rules
Keeping Species Amount Unchanged
Constant = NO, Boundary = YES
Constant = YES, Boundary = YES
Model Edges
Scoping Parameters for Reactions, Rules, and
Events
Definition of Parameter Scope
Using a Parameter in Events and Rules
Changing the Scope of a Parameter
.........................................1-27
........1-27
.....1-28
.................1-28
.....................1-29
....................1-30
.....................................1-31
..........................................1-32
.......................1-32
...............1-33
...................1-33
Changing Model Component Values Using Rules
What Is a Rule?
What Is an initialAssignment Rule?
What Is a repeatedAssignment Rule?
What Is an Algebraic Rule?
What Is a Rate Rule?
Typical Uses of Rate Rules
Changing Model Component Values Using Events
What Is an Event?
How Events Are Evaluated
Evaluation of Simultaneous Events
Evaluation of Multiple Event Functions
When O n e Event Trig ge rs Another Event
Cyclical Events
Desktop Example — Changing Species Amounts Using
an Event
Overview
Prerequisites
Adding an Event to the Example Model
Simulating the Modified Model
...................................1-34
..................1-35
.................1-35
.........................1-36
..............................1-37
..........................1-37
.................................1-42
.........................1-43
...................1-48
...............1-49
..............1-49
...................................1-50
........................................1-51
........................................1-51
.....................................1-52
...............1-52
......................1-55
.....1-34
....1-42
viContents
Storing and Applying Alternate Model Values Using
Variants
What Are Variants?
Using Variants
........................................1-58
...............................1-58
...................................1-59
Applying Multiple Variants in a Model ................1-60
Desktop Example — Applying Changes to Parameter
Value Using a V ariant
Overview
Prerequisites
Applying Alternate Values Using Variants
Simulation Results for the Model of the Mutant Strain
........................................1-61
.....................................1-62
............................1-61
.............1-63
...1-63
Verifying that a Model Has No Warn ing s or Errors
Verifying a Model in the SimBiology Desktop
Verifying the Model at the Command Line
Desktop Example — Using User-Defined Functions in
Expressions
Prerequisites
Overview
Creating a Function
Calling the Function in a Rule Expression
See Also
Importing and Exporting Model Component Data
Importing Model Component Data
Exporting M odel Component Data
Performing Simulations at the Command Line
Performing Simulations in the SimBiology Desktop
.........2-2
...1-66
....1-78
.....2-2
About Simulation Solvers
How Solvers Work
Stiff Versus Nonstiff Models
Selecting a Solver
Nonstiff Determ inistic Solvers
.................................2-5
.................................2-6
..........................2-5
.........................2-5
......................2-8
vii
When to Use No nstiff Deterministic Solv ers ............2-8
ode45 (Dormand-Prince)
ode23 (Bogacki-Shampine)
ode113 (Adams)
See Also
.........................................2-9
...................................2-8
............................2-8
..........................2-8
Stiff Deterministic Solvers
When to Use Stiff Deterministic Solvers
ode15s (stiff/NDF)
ode23s (stiff/Mod. Rosenbrock)
ode23t (Mode. stiff/Trapezoidal)
ode23tb (stiff/TR-BDF2)
See Also
Stochastic Solvers
When to Use Stochastic Solvers
Stochastic Simulation Algorithm (SSA)
Explicit Tau-Leaping Algorithm
Implicit Tau-Leaping Algorithm
Ensemble Runs of Stochastic Simulations
References
Sundials Solvers
Accelerating Simulations
Prerequisites for Accelerating Simulations
When to Accelerate Simulations
Accelerating Simulations at the Command Line
Accelerating Simulations in the SimBiology Desktop
Troubleshooting
Scanning Overview
Creating a Scan Task
Setting Options to Scan Using User-Defined Values
Options For Monte Carlo Methods
................................3-2
..............................3-3
....................3-6
Analysis
.....3-3
Setting Options to Scan Using Monte C arlo Methods....3-7
Desktop Example — Scanning
Overview
Prerequisites
Setting Options to Scan with One Parameter
Results of Scanning with One Parameter
Scanning with Multiple Parameters
Results of Scanning with Multiple Parameters
References
Sensitivity Analysis
About S ensitivity Analysis
Performing Sensitivity Analysis Using the Command
Line
Performing Sensitivity Analysis Using the Desktop
Reference
Desktop E xam ple — Calculating Sensitivities
Overview
Prerequisites
Setting Options for Sensitivity Analysis
Getting Results for Sensitivity Analysis
References
........................................3-10
.....................................3-12
.......................................3-24
................................3-25
..........................................3-26
........................................3-28
........................................3-29
.....................................3-32
.......................................3-35
......................3-10
...........3-13
..............3-15
..................3-20
..........................3-25
...............3-33
...............3-34
..........3-22
......3-27
........3-29
Command-Line Example — Calculating Sensitivities
Overview
Loading and Configuring the Model for Sensitivity
Analysis
Performing Sensitivity Analysis
Extracting and Plotting Sensitivity Data
See Also
Parameter Estimation
About Parameter Estimation
SimBiology Parameter Estimation
Command-Line E x am ple — Parameter Estimation
About the Example Model
Importing Target Experimental Data
Simulating the G Protein Model
........................................3-36
.......................................3-37
......................3-38
..............3-38
.........................................3-41
............................. 3-42
........................3-42
...................3-42
..........................3-43
.................3-44
.....................3-44
..3-36
....3-43
ix
Estimating a Parameter (kGd) in the G Protein Model ...3-47
Simulating and Plotting Results U sing the Estimated
Parameter
Estimating Other Parameters in the G Protein Model
.....................................3-50
....3-51
Moiety Conservation
Introduction to Moiety C onserv ation
Algorithms for Conserved Cycle Calculations
Command-Line Examples — D eterm ining Conserved
Moieties
GProteinExample
Mitotic Oscillator Example
Desktop E xam ple — Creating Custom Analysis
About Custom Analysis
Open the Example Project
Setting Up a Custom Task
Parameter Estimation Using Custom Task
Visualizing Results Using Plot Types
AboutPlotTypes
How Plot Types Work
Summary of Built-In Plot Types
When to Use User-Defined Plot-Types
Desktop Example — Creating and Using Plot Types
Goal
Workflow
Why Use User-Defined Plot Types?
Creating a User-Defined Plot Type in the Library
Required and Recommended Software for Pharmacokinetic
Modeling
How This Product Supports Pharmacokinetic Modeling
Using the Command Line Versus the SimBiology
Desktop
Accessing a Pharmacokinetic Modeling Demo
Acknowledgements: Tobramycin Data Set
......................................4-3
..4-4
.......................................4-6
..........4-6
.............4-6
Importing Data — Supported Files and Data Types
Supported Files and Data Types
Support for Importing NONMEM Formatted Files
Creating a Data File with SimBiology Definitions
Importing D ata at the Command Line
Importing Data From NONMEM Formatted Files
Importing Data Using the dataset function
Other Resources for Importing Data
ImportingDataintotheSimBiologyDesktop
Data Import Using the SimBiology Desktop
Importing Data from a File to the SimBiology Desktop
Importing Data from the MATLAB Workspace to the
SimBiology Desktop
Column Heading Classification for NONMEM
Interpretation of Headers
Resources for Working with Imported Data
Working with Imported Data and the SimBiology
Desktop
Accessing Imported Data
Specifying Units and Identifying Group and Independent
Variables in the Data
Plotting Da ta
Excluding Rows of Data
Creating Additional Data Columns Using Derived Data
Calculating Statistics for Imported Data
Creating Dose Schedules Using Imported Data
Saving Your Work as a SimBiology Project File
........................................4-33
.....................................4-35
............................. 4-26
...........................4-33
............................4-34
............................4-37
.....................4-8
......4-8
.......4-12
...............4-14
.......4-14
............4-15
..................4-16
.........4-18
............4-18
.........................4-28
............4-31
...............4-40
.........4-41
.........4-42
...4-8
...4-19
..4-39
Creating Pharmacok inetic Models
Overview
........................................4-43
..................4-43
xi
How SimBiology Models Represent Pharmacokinetic
Models
Creating PK Models at the Command Line
Creating PK Models in the SimBiology Desktop Using a
Wizard
About Dosing Types
About Elimination Types
About Intercompartmental Clearance
Unit Conversion for Imported Data and the Model
Prerequisites for Using Custom SimBiology Models in
Parameter Fitting
........................................4-43
.............4-45
........................................4-47
............................... 4-49
...........................4-52
.................4-53
......4-54
............................... 4-55
Parameter Fitting in Pharmacokinetic Mod els
Parameter Fitting Functionality
Prerequisites for Parameter Fitting
Fitting Pharmacokinetic Model Parameters at the
Command Line
Fitting Parameters
Specifying and Classifying the Data to Fit
Setting Initial Estimates
Specifying the Covariance Pattern of Random Effects and a
Covariate Model
Specifying an Error Model
Specifying Parameter Transformations
Performing Population Fitting Using sbionlmefit or
sbionlmefitsa
Performing Individual Fitting Using sbionlinfit
About Simulation Settings and Specifying Alternate Values
for Initial Estimates
Fitting Pharmacokinetic Model Parameters in the
SimBiology Desktop
Fitting Parameters
Opening a SimBiology Project
Adding a Model Task to Fit Parameters
Performing Population Fitting
Performing Individual Fitting
About Simulation Settings and Specifying Alternate Values
for Initial Estimates
Visualizing Parameter Fitting Results and Generating
Diagnostic Plots
..................................4-62
................................4-62
...........................4-65
................................4-66
...................................4-73
............................. 4-78
............................. 4-80
................................4-80
............................. 4-91
................................4-92
.....................4-60
...................4-61
.............4-63
..........................4-71
................4-71
.......................4-81
...............4-81
.......................4-81
.......................4-89
.......4-60
.........4-77
xiiContents
Index
xiii
xivContents
Modeling
This chapter is a collection of topics
relevant to modeling in general,
but is presented in the context of
using SimBiology
biological processes.
• “SimBiology Model Components” on page 1-3
®
1
software to model
• “Defining Reaction Rates with Mass A ction Kinetics” on page 1-13
• “Defining Reaction Rates with Enzyme Kinetics” on page 1-20
• “Evaluation of Reaction Rate” on page 1-25
• “Using Constant Amount and Boundary Condition for Species” on page 1-27
• “Scoping Parameters for Reactions, Rules, and Events” on page 1-32
• “Changing Model Component Values Using Rules” on page 1-34
• “Changing Model Component Values Using Events” on page 1-42
• “Desktop Example — Changing Species Amounts Using an Event” on page
1-51
• “Storing and Applying Alternate Model Values Us in g Variants” on page
1-58
• “Desktop Example — Applying Changes to Parameter Value Using a
Variant” on page 1-61
• “Verifying that a Model Has No Warnings or Errors” on page 1-66
1 Modeling
• “Desktop Example — Using User-Defined Functions in Expressions” on
page 1-69
• “Importing and Exporting Model Component Data” on page 1-78
1-2
SimBiology Model Components
In this section...
“Organization of SimBiology Objects” on page 1-3
“Model” on page 1-6
“Compartment” on page 1-6
“Species” on page 1-6
“Reaction” on page 1-7
“Kinetic Law” on page 1-7
“Parameters” on page 1-8
“Rules” on page 1-9
“Events” on page 1-10
“Configuration Sets” on page 1-10
“Variants” on page 1-11
SimBiology®Model Components
“Simulation Data” on page 1-12
Organization of SimBiology Objects
IfyouplantoworkmainlyfromtheSimBiologydesktopGUI,youcanskip
this section and go to “Model” on page 1-6. The GUI allows you to interactively
work with SimBiology model components without having prior k nowledge of
object-oriented programming, or the object implementation thereof in the
software product.
If you plan on using the product at the command line or have workflows
that span the desktop and the command line, it is useful understand the
hierarchical organization of SimBiology objects.
SimBiology objects are organized as a hierarchical list of objects under one
root object. Models and each model component are represented as objects.
Further, there are objects to store simulation settings (
data from simulation and analysis tasks (
the command line or the SimBiology desktop are contained in the
SimData object). Objects created at
configset object) and
root obje ct.
1-3
1 Modeling
Models must contain at least one species object and one compartment object.
The hierarchy of objects in models is as follows:
Model
Compartment
Species
Parameters
Reaction
Kinetic Law
Parameters
Rules
Events
Variant
Configset
SimData
Parameters can be scoped to a kinetic law or the model.
1-4
The function
sbioreset deletes all model and simulation objects at the root
level. You should remove the objects from the workspace with the function
clear. If the SimBiology desktop is open, note that calling sbioreset at the
command line also deletes model and data objects that are open in the desktop.
All SimBiology objects are all handle objects. A handle is a reference to an
object. If you copy an object’s handle, MATLAB
®
copies only the handle and
both the original and copy refer to the same object data. If a function modifies
a handle object passed as an input argument, the modification affects the
original object. For example,
%Create a model
Mobj = sbiomodel('cell')
SimBiology Model - cell
Model Components:
Compartments:0
Events:0
Parameters:0
Reactions:0
SimBiology®Model Components
Rules:0
Species:0
%Assign the model object to another variable
newMobj = Mobj;
% Modify the new variabl
compObj = addcompartment(newMobj, 'contents');
set(newMobj, 'Name', 'newcell')
% The new variable has a compartment and a new name
newMobj
The recommended method to store your SimBiology models is to create and
store project files.
1-5
1 Modeling
Model
ASimBiologymod
events that tran
are compartmen
creating a mode
define a kinet
sform, transport, and bind species. The model components
ts, species, reactions, parameters, rules, and events. After
l, add a compartment, then you can add reactions to the model,
ic law for each reaction, and add the parameters for the reaction.
el is a collection of interrelated reactions, rules, and
Properties de
object inclu
species, par
properties i
list object
Compartme
A compartm
regions.
Since com
to compar
the mode
All mode
must be a
anothe
model.
SimBio
Speci
A spec
DNA,
(MAP
ies is a chemical or entity that participates in reactions, for example,
ATP, Pi, creatine , G-Protein,orMitogen-Activated Protein Kinase
K)
fine the characteristics of an object. For example, a reactio n
des properties for reactions, reaction rates, and links to associated
ameters, and kinetic laws. Y ou can interactively change object
n the graphical user interface. Use the
properties and change their values at the command line.
get and set commands to
nt
ent allows you to associate pools of species to physically isolated
partments define physically isolated regions, species are assigned
tments. Reactions, rules, events, and parameters are assigned to
l.
ls m ust have at least one compartment and all species in a model
ssigned to a compartment. You can create a compartment within
r compartment, but compartment names must be unique within a
For information on specifying names of compartments, see
logy Reference documentation.
es
. Species amounts can vary or remain constant during a simulation.
Name in the
1-6
nformation on specifying names of species, see
For i
erence documentation.
Ref
Name in the SimBiology
SimBiology®Model Components
Reaction
A reaction describes a transformation, transport, or binding process that
changes one or more species. Typically, the change is the amount of a species.
Examples:
Creatine + ATP <-> ADP + phosphocreatine
glucose + 2 ADP + 2 Pi -> 2 lactic acid + 2 AT
cytoplasm.A -> nucleus.A
[compartment 1].[species A] -> [compa
rtment 2].[species A]
Spaces are required before and after species names and stoichiometric values.
Stoichiometry values must be greater than zero. If the stoichiometry value is
not sp eci fi ed it is assumed to be 1. In a model with a single compartment, the
species is specified using its name. In a model with multiple compartments,
the species must be specified as
compartmentName.speciesName.Enclose
names with non-alphanumeric characters in brackets.
P+2H2O
Kinetic Law
A kinetic law pr ovides a mechanism for applying a specific rate law to
multiple reactions. It acts as a templateforthereactionrate. Thekinetic
law is defined by an expression, and the species and parameter variables
used in the expression.
The
ReactionRate is the result of defining the names of parameters and
species variables in a rate law. To get
and parameter variables that participate in the reaction rate should be clearly
assigned in the Project Settings-Reactions pane on the Kinetic Law tab.
Forexample,thekineticlaw
Henri-Michaelis-Menten is expressed in the
software as
VSK S
*/()+
mm
where Vm and Km are defined as parameters and S is defined as a species. (To
see p arameter and species definitions for a kinetic law, access the KineticLaw Manager from the Desktop menu.)
By applying the kinetic law
Henri-Michaelis-Menten to a reaction
ReactionRate, the species variables
1-7
1 Modeling
A->B
with Vm = Va and Km = Ka
andS=A
the rate equation is
Va*A/(Ka + A)
A, Va,andKa are defined in the Kinetic Law tab.
Reaction Rate Equation
The reaction rate equation is a mathematical expression that describes the
rate at which the reactants combine to form products.
For a reaction following Mass Action kinetics,
Creatine + ATP <-> ADP + phosphocreatine
1-8
the rate equation is written as
K*Creatine*ATP - Krev*ADP*phosphocreatine
Parameters
A parameter is a quantity that can change or can be constant. Parameters are
generallyusedtodefinerateconstants. But,youcouldalsouseparametersas
constants to modify model component values in rules and events.
For information on specifying names of parameters see
Reference documentation.
Scope refers to the definition of a parameter at the model (global) level or
kinetic law (local) level.
If the scope of the parameter is global in the model, it can be used by any rule,
event, or by any reaction rate in the model. If the scope of the parameter is at
the kinetic law level, it can be used only by the kinetic law in the reaction for
which it was defined.
Name in the S imBiology
SimBiology®Model Components
How to Use Scope
For reaction rate, SimBiology hierarchically uses the value of the parameter
with scope at the kinetic law level first. If there is no such parameter at
the kinetic law level, SimBiology looks for the parameter with scope at the
model level.
If there are two parameters with the same name, one at the model level and
the other at the kinetic law level, the software uses the value of the parameter
at the kinetic law level for the reaction rate. The software uses the value of
the parameter at the m o del level for any rules or events that reference the
parameter.
Rules
A rule is a mathematical expression that modifies a species amount,
compartment capacity, or a parameter value. There are four types of
SimBiology rules:
•
algebraic — Algebraic rules are evaluated continuously during a
simulation. An algebraic rule takes the form
rule is specified as the
conservation ex pression such as
Expression. For example, you could write a mass
species_total = species1 + species2
0 = Expression and the
where species_total is the independent variab le . In SimBiology, write
theruleas
initialAssignment — initialAssignment rules are evaluated
•
once at the beginning of a simulation.
expressed as
initialAssignment rule to set the amount of species1 to be proportional
to
species2.
species1 = k/species2
species1 + species2 - species_total.
initialAssignment rules are
Variable = Expression. For example, you could write an
• repeatedAssignment — repeatedAssignment rules are evaluated at every
time-step during a simulation.
as
Variable = Expression. F or example, you could use the rule to specify
the amount of
species1 = k/species2
species1 to always be proportional to species2.
repeatedAssignment rules are expressed
1-9
1 Modeling
• rate — R ate rules are evaluated continuously during a simulation. Rate
rules are determined by
in the software as
rate of change in the q uantity of
in the software as:
species3 = k * (species1 + species2)
Oneexampleofarateruleiswhenspecies1 is at the boundary of the
system, but the rate of input of
by a rate rule.
Tip Ifyouplantouseaparameterinarule,remembertosettheScope
of the parameter to
rule to vary the value of a parameter during the simulation, clear the
ConstantValue check box for the parameter in the Parameters pane,
Settings tab.
dVariable/dt = Expression, which is expressed
Variable = Expression. For example, to define the
species3 (dspecies3/dt),writetherule
species1 to the system can be determined
model. Further, if you are using an algebraic or rate
1-10
For more information, see “Changing Model Component Values Using Rules”
on page 1-34 in the SimBiology U ser’s Guide.
Events
Events are used to describe sudden changes in model behavior. An event lets
you specify discrete transitions in model component values that occur when a
user-specified condition become true. You can specify that the event occurs at
a particular time, or spe c if y a time-independent condition. For example, you
can use events to activate or deactivate ce rtain species (activator or inhibitor
species), change parameter values, change reaction rates in response to
addition or removal of species. For more inf ormation about events, evaluation
of events, and examples, see “Changing Model Component Values Using
Events” on page 1-42 in the SimBiology User’s Guide.
Configuration Sets
Configuration sets contain the options that the solver uses during simulation
of a model. To add, view or edit configuration sets associated with a model, in
SimBiology®Model Components
the Project Explorer,clickConfiguration Settings. The configuration set
contains the following options for you to choose:
• Type of solver
• Data to record (Data Logging tab)
• Stop time for the simulation
• Solver error tolerances, and for ode solvers – the maximum time step the
solver should take
• Whether to perform sensitivity analysis during simulation
• Whether to perform dimensional analysis and unit conversion during
simulation
• Species and parameter input and output factors for sensitivity analysis
For more information see “Performing Simulations” on page 2-2 in the
SimBiology User’s Guide.
Variants
Variants let you store the names and values of model components and allow
you to use the values stored in the variant as the alternate value to be applied
during a simulation. To add, view or edit variants associated with a model,
in the Project Explorer,clickVariants. You can store values for species
Using one or more variants associated with a model allows you to evaluate
model behavior during simulation, with different values for the various model
components without having to search and replace these values, or having to
create additional models with these values. If you determine that the values
in a variant accurately define your model, you ca n permanently replace the
values in your model with the values stored in the variant object by clicking
Commit.
For more information see “Storing and Applying Alternate Model Values
Using Variants” on page 1-58in the SimBiology User’s Guide.
1-11
1 Modeling
Simulation Data
The SimBiology S
holds time and st
for the logged s
more informati
imData
ate data as well as metadata, such as the types and names
tates, or the configuration set used during simulation. For
on see
object contains simulation data. The SimData object
SimData object.
1-12
Defining Reaction Rates with Mass Action Kinetics
Defining Reaction Rates with Mass Action Kinetics
In this section...
“Definition of Mass Action Kinetics” on page 1-14
“Zero-Order Reactions” on page 1-14
“First-Order Reactions” on page 1-16
“Second-Order Reactions” on page 1-17
“Reversible Mass A ction ” on page 1-19
1-13
1 Modeling
Definition of Mass Action Kinetics
Mass action describes the be havio r of reactants and products in an eleme ntary
chemical reaction . Mass a ction kinetics describes this behavior as an equation
where the velocity or rate of a chemical reaction is directly proportional to
the concentration of the reactants.
Zero-Order Reactions
With a zero-order reaction, the reaction rate does not depend on the
concentration of reactants. Ex am ples of zero-order reactions are synthesis
from a
at a specified rate.
null species, and modeling a source species that is added to the system
reaction: null -> P
reaction rate: k mole/second
species: P =0 mole
parameters: k =1 mole/second
1-14
Note When specifying a null species, the reaction rate must be defined in
units of amount per unit time not concentration per unit time.
Entering the reaction above into the software and simulating produces the
following result:
Zero-Order Mass Action Kinetics
Defining Reaction Rates with Mass Action Kinetics
Note If the amount of a reactant with zero-order kinetics reaches zero before
the end of a simulation, then the amount of reactant can go below zero
regardless of the solver or tolerances you set.
1-15
1 Modeling
First-Order Rea
With a first-ord
concentration o
radioactive de
reaction: R -> P
reaction rate: k*R mole/(liter*second)
parameters: k =1 1/second
Entering th
following r
er reaction, the reaction rate is proportional to the
f a single reactant. An example of a first-order reaction is
cay.
species: R = 10 mole/liter
e reaction above into the software and simulating produces the
esults:
ctions
P =0 mole/liter
1-16
First-Order Mass Action Kinetics
Defining Reaction Rates with Mass Action Kinetics
Second-Order Re
A second-order r
or the concentra
Notice the spac
reactant. With
reaction: 2 R -> P
reaction rate: k*R^2 mole/(liter*second)
parameters: k =1 liter/(mole*second)
Entering th
following r
eaction h as a reaction rate that is proportional to the square
tion of a single reactant or proportional to two reactants.
e between the reactant coe fficient and the name of the
out the space,
species: R = 10 mole/liter
e reaction above into the software and simulating produces the
esults:
actions
2R would be considered the name of a species.
P =0 mole/liter
Second-Order Kinetics with Single Reactant
With two reactants, the reaction rate depends on the concentration of two
of the reactants.
reaction: R1 + R2 -> P
reaction rate: k*R1*R2 mole/(liter*second)
1-17
1 Modeling
species: R1 = 10 mole/liter
R2 =8 mole/liter
P =0 mole/liter
parameters:k =1 liter/(mole*second)
Enter the reaction above into the software and simulating produces the
following results. There is a difference in the final values because the initial
amount of one of the reactants is low er than the other. After the f irst reactant
is used up, the reaction stops.
1-18
d-Order Kinetics with Two Reactants
Secon
Defining Reaction Rates with Mass Action Kinetics
Reversible Mass
You can model rev
reaction. With a
and reverse rea
brackets befor
reaction: R <-> P
reaction rate: kf*R - kr*P mole/(liter*second)
species: R = 10mole/liter
parameters: kf = 11/second
Entering th
following
the revers
results. At equilibrium when the rate of the forward reaction equals
ereaction,
single reversible reaction, the reaction rates for the forward
ctions are combined into one expression. Notice the angle
e and after the hyphen to represent a reversible reaction.
e reaction above into the software and simulating produces the
Action
ersible reactions with two s eparate reactions or with one
P =0mole/liter
kr = 0.2 1/second
v = kf*R - kr*P = 0 and P/R = kf/kr.
1-19
1 Modeling
Defining Reaction Rates with Enzyme Kinetics
In this section...
“Simple Model for Single Substrate Catalyzed Reactions” on page 1-20
“Enzyme Reactions with Differential Rate Equations” on page 1-20
“Enzyme Reactions with Mass Action Kinetics” on page 1-22
“Enzyme Reactions with Irreversible Henri-Michaelis-Menten Kinetics”
on page 1-23
Simple Model for Single Substrate Catalyzed
Reactions
A simple model for enzyme-catalyzed reactions starts a substrate S reversibly
binding with an enzyme
complex is converted to product
E. Some of the substrate in the substrate/enzyme
P w ith the release of the enzyme.
k1
⎯→⎯⎯
S + E ES E + P
←⎯⎯⎯
k1r
v = k [S][E], v = k [ES], v = k [ES]
111r1r22
This simple model can be defined with
• Differential rate equations. See “Enzyme Reactions w ith Differential Rate
Equations” on page 1-20.
• Reactions with mass action kinetics. See “Enzyme Reactions with Mass
Action Kinetics” on page 1-22.
• Reactions with H enri-Michaelis-Menten kinetics. See “Enzyme Reactions
with Irreversible Henri-Michaelis-Menten Kinetics” on page 1-23.
k2
⎯→⎯⎯
Enzyme Reactions with Differential Rate Equations
The reactions for a single-substrate enzyme reaction mechanism (see “Simple
Model for Single Substrate Catalyzed Reactions” on page 1-20) can be
described with differential rate equations. You can enter the differential rate
equations into the software as rate rules.
Remember that the rate rule dS/dt = f(x) is written in a SimBiology rate
rule expression as
S = f(x). For more information about rate rules see
“What Is a Rate Rule?” on page 1-37.
Alternatively,youcouldremovetherateruleforES,addanewspeciesEtotal
for the total amount of enzyme, and add an algebraic rule 0 = Etotal - E -
, w here the initial amounts for Etotal and E are equal.
ES
1-21
1 Modeling
reactions: none
reaction rate: none
rate rules: dS/dt = k1r*ES - k1*S*E
dE/dt = k1r*ES + k2*ES - k1*S*E
dP/dt = k2*ES
algebraic rule: 0 = Etotal - E - ES
species: S =8mole
E =4mole
ES =0mole
P =0mole
Etotal =4mole
parameters: k1 = 21/(mole*second)
k1r = 11/second
k2 = 1.5 1/second
Enzyme Reactions with Mass Action Kinetics
Determining the differential rate equations for the reactions in a model
is a time-consuming process. A better way is to enter the reactions for a
single substrate enzyme reaction mechanism directly into the software. The
following example using models an enzyme catalyzed reaction with mass
action kinetics. For a description of the reaction model, see “Simple Model for
Single Substrate Catalyzed Reactions” on page 1-20.
1-22
reaction: S + E -> ES
reaction rate: k1*S*E (binding)
reaction: ES -> S + E
reaction rate: k1r*ES (unbinding)
reaction: ES -> E + P
reaction rate: k2*ES (transformation)
species: S =8mole
E= 4 mole
ES =0mole
P= 0 mole
parameters: k1= 21/(mole*second)
k1r = 11/second
k2= 1.5 1/second
Defining Reaction Rates with Enzyme Kinetics
The results for a sim u lation using reactions are identical to the r esu lts from
using differential rate equations.
Enzyme Reactions with Irreversible
Henri-Michaelis-Menten Kinetics
Representing an enzyme-catalyzed reaction with mass action kinetics
requires you to know the rate constants
constants are rarely reported in the literature. It is more common to give
the rate constants for Henri-Michaelis-Menten kinetics with the maximum
velocity
a single substrate enzyme reaction using Henri-Michaelis-Menten kinetics is
given below. For information about the model, see “Simple Model for Single
Substrate Catalyzed Reactions” on page 1-20.
Vm=k2*E and the constant Km = (k1r + k2)/k1. The reaction rate for
Vmax[S]
v =
Km + [S]
k1, k1r,andk2. However, these rate
1-23
1 Modeling
The following example models an enzyme catalyzed reaction using
Henri-Michaelis-Menten kinetics with a single reaction and reaction rate
equation. Enter the reaction defined below into the software and simulate.
reaction: S -> P
reaction rate: Vmax*S/(Km + S)
species:S =8mole
P =0mole
parameters: Vmax =6mole/second
Km =1.25 mole
The results show a plot slightly different from the plot using mass action
kinetics. The differences are due to assumptions made when deriving the
Michaelis-Menten rate equation.
1-24
Evaluation of Reaction Rate
Reaction Rate Dimensions
When calculating species fluxes, SimBiology must determine whether you
specified reaction rates in dimensions of amount/time or concentration/time.
When all compartments in a model have a capacity of one unit, amount and
concentration are numerically equivalent.
For all other models, the numerical results of the simulation depend on
which interpretation SimBiology selects. SimBiology determines whether
a reaction rate is in dimensions of amount/time or concentration/time via
dimensional analysis of
dimensional analysis always occurs, even when
UnitConversion are off.
The
DefaultSpeciesDimension property defines the dimensions of species
appearing in a reaction rate. SimBiology infers the dimensions of parameters
appearing in a reaction rate from their
parameters appearing in a reaction rate expression do not have units,
SimBiology interprets the reaction rate in dimensions of amount/time.
Therefore, the only way to specify that a reaction rate has dimensions of
concentration/time is to assign appropriate units to all parameters.
ReactionRate expressions. This minimum level of
Evaluation of Reaction Rate
DimensionalAnalysis and
ValueUnits property. If any
Reactions Spanning Multiple Compartments
Specify reactions that span compartments using the syntax
The reaction rate dimensions must resolve to amount/time whe n:
• Species span multiple compartments.
• The reaction is reversible mass action and the products a re in multiple
compartments.
Examples
Consider a reaction a+b >c. Using mass action kinetics, the reaction rate
is
k*a*b,wherek is the rate constant of the reaction. If you specify that initial
amounts of
then the reaction rate is in concentration/time (and units of
a and b are 0.01 molarity and 0.005 molarity respectively,
molarity/second)
1-25
1 Modeling
if the units of k are 1/(molarity*second).Ifyouspecifyk with another
equivalent unit definition, for example,
1/((moles/liter)*second),
SimBiology checks whether the physical quantities match. If the physical
quantities do not match, you see an error and the model is not simulated.
If, in the previous example, you specify that initial amounts of
0.01 and 0.005 respectively, without specifying units, SimBiology checks
whether
DefaultSpeciesDimension is concentration, and you set units on the rate
DefaultSpeciesDimension is substance or concentration.If
a and b are
constant such that the reaction rate dimensions resolve to concentration/time,
SimBiology scales the species amounts for compartment capacity, and returns
the species va lues in concentration.
If you specify initial amounts of
respectively, include the volume scaling for b in the reaction rate
mole
a and b as 0.01 molarity and 0.005
expression. Include volume scaling in the rate constant, and set the units of
the rate constant accordingly (
1/(molarity*second) for amount/time).
1/(mole*second) for concentration/time, or
1-26
Using Constant Amount and Boundary Condition for Species
Using Constant Amount and Boundary Condition for
Species
In this section...
“Definition of Constant and Boundary Properties” on page 1-27
“Changing Species Amounts with Reactions or Rules ” on page 1-28
“Keeping Species Amount Unchanged” on page 1-28
“Constant = NO, Boundary = YES” on page 1-29
“Constant = YES, Boundary = YES” on page 1-30
“Model Edges” o n page 1-31
Definition of Constant and Boundary Properties
There are two properties (constant amount, boundary condition) to specify
how the amount of a species changes or does not change during a simulation.
Based on the conditions of your model you can decide how to use these
properties.
The SBML specification (Level 2, Version 1) added the property
BoundaryCondition to the model definition.
Species with BoundaryCondition = Yes — The species amount is either
constant or determined by a rule, but in either case the amount is not
determined by a chemical reaction. In other w ords, the simulation does not
create a differential rate term from the reactions for this species even if it is
in a reaction, but it can have a differential rate term created from a rule.
Species with ConstantAmount = No — The species amount is determined
by a reaction or a rule, but not both.
Species with C onstantAmount = Yes — The species amount does not
change during a simulation. The species can be in a reaction or rule, but it
cannot have a rule that changes its amount.
1-27
1 Modeling
Changing Specie
Set Constant = NO
The value of a sp
or rule, but not
Constant
NONOYESNO
NONONOYES
Example 1 —S
equation.
This is the
the specie
reaction rate: k*A
Example 2 —SpeciesE is not in the reaction, but it is in the reaction rate
equation. E varies with another reaction or rule.
reaction rate: kcat*E*S/(Km + S)
The spe cies amount or concentration is determined by the reaction.
s is created from the reactions.
reaction: A -> B
reaction: S -> P
ecies can change, and it can change with either a reaction
both
Boundary
pecies A is in a reaction, and it is in the reaction rate
most common category of a species. A differential rate equation for
s Amounts with Reactions or Rules
, Boundary = NO
Reaction
RuleChanged By
Reaction
Rule
1-28
Example 3 —SpeciesG is not in a reaction, and it is not in a rate equation.
G varies with an algebraic rule or rate rule.
rate rule: dG/dt = k
Keeping Species Amount Unchanged
Set Constant = YES, Boundary = NO
The value of a species cannot change. When a species has its
selected and BoundaryCondition not s elected, it acts like a parameter. It
cannot be in a reaction and it cannot be varied by a rule.
Constant
YESNONONO
Boundary
Reaction
RuleChanged By
Never
ConstantValue
Using Constant Amount and Boundary Condition for Species
Example —SpeciesE is not in the reaction, but it is in the reaction rate
equation. E is constant and could be replaced with the constant
reaction: S -> P
reaction rate: kcat*E*S/(Km + S)
Vm = k2*E.
Constant = NO, Boundary = YES
The value of a species can change, and it is in a reaction, but a differential
rate term from the reaction is not created. The value of the species change
with a rule and a d ifferential rate term is created from the rule.
Constant
Boundary
NOYESYESYES
Reaction
RuleChanged By
Rule
From the SBML specification (Lev el 2, Version 1), “By default, when a
species is a product or reactant of one or more reactions, its concentration is
determined by those reactions. In SBML,itispossibletoindicatethata
given species’ concentration is not determined by the set of reactions even
when that species occurs as a product or reactant; i.e., the species is on the
boundary of the reaction system but is a component of the rest of the model.”
Example 1 —SpeciesA is not changed by the rate equation, but changes
according to a rate rule. However, A could be in the rate equation that
changes other species in the reaction.
reaction: A -> B
reaction rate: k1 or k1*A
rate rule: dA/dt = k2*A (solution is
(enter in SimBiology as
A=k2*t)
A = k2*A)
Example 2 —SpeciesA is not in t he rate equation, but changes according
to an algebraic rule.
reaction: A -> B + C
reaction rate: k or k*A
algebraic rule: A =2*C
(enter in SimBiology as
2*C - A)
1-29
1 Modeling
Constant = YES, B
Thevalueofthes
rate term is not c
created from a r
Constant
pecies cannot change. It is in a reaction, but a differential
reated from the reaction. The differential rate term is
ule.
Boundary
oundary = YES
Reaction
YESYESYESNO
During simul
dSpecies/dt
Example 1 — A
increases
refers to a
reaction rate: k or k*A
Example 2
and
sink
is subtr
reaction rate: k*B
ation, a differential rate equation is not created for the species.
does not exist.
is a
infinite source and its amount does not change. B
with a zero order rate (
k and k*A are both constants). A source
species where mass is added to the system.
reaction: A -> B
— B decreases with a first-order rate, but A is an
its amount does not change. A
sink refers to a species where mass
acted from the system.
reaction: B -> A
RuleChanged By
Never
infinite
1-30
Exampl
sourc
Exa
but
e3—Thenull species is a reserved species name that can act as a
eorasink.
reaction: null -> B
reaction rate: k
reaction: B -> null
reaction rate: k*B
mple 4 — ATP and ADP are in the reaction and have constant values,
they are not in the reaction rate equation.
reaction: S + ATP -> P + ADP
reaction rate: Vm*S/(Km + S)
Model Edges
As you build comp
model that you ne
the model edges
constant or unr
concept of a mo
are located is important because a species that is initially
egulated can later vary as you add details to your model. The
del edge overlaps with SBML boundaries, but not always.
Using Constant Amount and Boundary Condition for Species
lex m odels from simpler pathways, there are edges in the
ed to define before simulating the model. Knowing where
Model edge — Sp
modeled in th
+
NAD
, ATP, an
Model edge —
For example
parameter a
remains co
v
nstant.
V[Substrate]
max*
=
K+ [Substrate]
m
You may w
the amou
adding
Mode
cons
nt of enzyme is constant, then this species is a model edge. After
the reaction(s) that change the amount of the enzyme,
k*[]*[Substrate]
=
Enzyme
v
l edge — Null or source species that synthesizes another species at a
tant rate (zero o rder reaction). M ass is added to the system.
ecieswithconstantamountsthatmightormightnotbe
e reaction and reaction rate equations. Examples are cofactors,
dDNA.
Enzymes with constant amounts that are not regulated.
, a Michaelis-Menten rate equation with
Vmax specified as a
ssumes that the amount of enzyme catalyzing the reaction
ant to temporarily model a regulated enzyme in a rate equation. If
K+ [Substrate]
m
el edge — Degradation of a species to a null or sink species (first-order
Mod
ction). Mass is taken away from the system.
rea
1-31
1 Modeling
Scoping Parameters for Reactions, Rules, and Events
In this section...
“Definition of Parameter Scope” on page 1-32
“Using a Parameter in Events and Rules” on page 1-33
“Changing the Scope of a Parameter” on page 1-33
Definition of Parameter Scope
Parameters are quantities used to define the behavior of a modeled system.
Parameters can either be constant or change over time. SimBiology
parameters are generally used to define rate constants.
A SimBiology parameter is defined either globally at the model level or locally
at the kinetic law level. Scope refers to this definition of the parameter at
the model or kinetic law level.
1-32
• If the scope of the parameter is global in the model, it can be used by any
event o r rule, or by any reaction rate expression in the model.
• If the scope of the parameter is at the kinetic law level, it can be used only
by the reaction rate expression for which it was defined.
If you create a new parameter in the Project Settings-Parameters pane,
the scope is set by default to the
define a reaction rate equation in the Project Settings-Reactions pane’sKinetic Law tab, you can choose whether to assign the parameter locally to
the kinetic law or globally to the model.
SimBiology parameters are resolved hierarchically:
• For reaction rate, the software hierarchically uses the value of the
parameter at the kinetic law level first. If no such parameter is at the
kinetic law level, the software looks fortheparameteratthemodellevel.
• If two parameters have the same name, one at the model level and the
other at the kinetic law level, the software uses the value of the parameter
at the kinetic law level for the reaction rate. The software uses the value
model. When you create a new parameter to
Scoping Parameters for Reactions, Rules, and Events
of the parameter at the model level for any rules or events that reference
the parameter.
Note Ifyouwanttovaryaparameterthatis being referenced in a reaction
rate equation, that parameter must have a unique name, and have scope at
the model level.
Using a Parameter in Events and Rules
When you want to refer to a parameter in an event or rule expression, or
inmorethanonereactionrateequation,theparameterscopemustbeat
the model level.
Ifyouwanttovaryaparameterthatisbeing referenced in a reaction rate
equation, that parameter must have a unique name, and have s cope at the
model level. See “Definition of Parameter Scope” on page 1-32 for more
information.
Note Tovaryaparameterwitharuleoranevent,cleartheConstan tValue
check box in the Project Settings-Parameters pane, Settings tab.
Changing the Scope of a Parameter
When you want to refer to a parameter in an expression for a rule, or in more
than one reaction rate equation, the parameter scope must be at the model
level.
To change the scope of a parameter in the SimBiology desktop:
1 In the Project Explorer,clickParameters,toopentheParameters
pane.
2 In the Parameters table, right-click a parameter row select Change
Parameter Scope to change the scope of the selected parameter from
kinetic law to model, or the reverse.
1-33
1 Modeling
Changing Model Component Values Using Rules
In this section...
“What Is a Rule?” on page 1-34
“What Is an initialAssignment Rule?” on page 1-35
“What Is a repeatedAssignment Rule?” on page 1-35
“What Is an Algebraic Rule?” on page 1-36
“What Is a Rate Rule?” on page 1-37
“Typical Uses of Rate Rules” on page 1-37
What Is a Rule?
A rule is a model component that specifies a mathematical relationship
between model component values during a simulation. Rules let you specify
mathematical relationships involving the following model components values:
1-34
• parameter value
• species amount
• compartment capacity
Examples of using a rule include:
• Specify values for model components that are required for comparison w ith
experimental data. For example, specify the active fraction of total protein.
• Assign values to model components based on the values of other
components in the model. For example, define a parameter’s value as being
proportional to a species or another parameter.
• Define mass balance equations.
• For species, use rate rules as an alternative to the differential rate
expression generated from reactions.
The types of rules in SimBiology are as follows:
Changing Model Component Values Using Rules
• initialAssignment — Lets you specify the initial value of a parameter,
species, or compartment capacity, as a function of othe r model component
values in the model.
•
repeatedAssignment — Lets you specify a value that holds at all times
during simulation, and is a function of other model component values in
the model.
•
algebraic — Lets you specify mathematical constraints on one or more
parameters, species, or compartments that must hold during a simulation.
•
rate — Lets you specify the time derivative of a parameter value, species
amount, or com partment capacity.
What Is an initialAssignment Rule?
initialAssignment rules are evaluated once at the beginning of a simulation.
initialAssignment rules are expressed as Variable = Expression.
Forexample,usetheruletosettheinitialamountof
proportional to
species2. This lets you change the initial conditions for both
species1 to be
species by updating the value for one.
species1 = k*species2
What Is a repeatedAssignment Rule?
repeatedAssignment rules are evaluated at every time step during a
simulation.
Expression
For example, if you want the capacity of a compartment (
change in response to a change in the concentration of a species (
rule to set the capacity of
cytoplasm = k*x
Where k is a specified constant.
repeatedAssignment rules are mathematically equivalent to algebraic
rules, but result in exact solutions, compared to algebraic rules whose
accuracy depends on the tolerance specifi ed in the configuration set used
while performing simulations.
repeatedAssignment rules are expressed as Variable =
.
cytoplasm)to
x), use the
cytoplasm to be proportional to x.
1-35
1 Modeling
Tip
• Ifyoucansolveforthevariable,usea
of an
algebraic rule.
repeatedAssignment rules the cons trained variable is explicitly defined
• In
as the lef t-hand side, whereas in algebraic rules it is inferred from the
degrees of freedom in the system of equations (see also, “Considerations
When Imposing Constraints” on page 1-36 in the SimBiology User’s Guide.
repeatedAssignment rule instea d
What Is an Algebraic Rule?
An algebraic rule is a convenient way to define mathematical relationships
between states. A model can consist of a combination of differential and
algebraic relationships.
An algebraic rule is a constraint that is enforced by the solver during
simulation. You can use algebraic rules to specify the dynamics for
parameters, species, and compartments that are not driven by one or more
reactions. The accuracy of the solution depends o n the tolerance specified in
the configuration set used while performing simulations.
An algebraic rule is defined by the equation:
f(t,x)= 0
Where t is simulation time. The variable x is species amount, parameter
value, or compartment capacity.
1-36
An example of an algebraic rule is,
x*log(x) - 3
Considerations When Imposing Constraints
Consider the mathematical constraint y = m*x - c. In the software this rule
is written as
of
y,thenm, x,andc must be variables or constants whose values are known
or determined by other equations. In general, the degree of freedom available
must match the number of constraints. Therefore, you must ensure that the
m*x-c-y. If you want to use this rule to determine the value
Changing Model Component Values Using Rules
equation is not overconstrained or underconstrained. In this example, if the
equation is underconstrained, it is unclear which variable is being determined
by the expression.
What Is a Rate Rule?
Arateruleisdefinedbytheequation:
dx/dt = f(t,W)
The variable x can be a species amount, parameter value, or compartment
capacity. The function
f(W) is an expression that can include other species
and parameters. Enter a rate rule using the form
x = f(t,W)
TypicalUsesofRateRules
WhentheRateofChangeIsConstant
You can increase or decrease the amount or concentration of a species by a
constant value using a zero order rate rule. For example, suppose species
increases by a constant rate k.
c
reaction: none
rate equation: none
rate rule: dc/dt = k
species : c = 10 mole(initial amount)
parameters: k = 1 mole/second
The analytical solution is c=kt+co,wherecois the initial amount or
concentration of the species
Enter the rule described above as
rate, enter the values for c and k, and then simulate.
c.
c=k.FromtheRuleType list, select
1-37
1 Modeling
Alternatively, you could model a constant increase in a species using Mass
Action reaction
null -> C.
1-38
When the
You can change the amount of a species similartoafirst-orderreactionusinga
first-orderraterule. Forexample,supposethespecies
The solution for the rate rule
Enter the rate rule described above and the simulate.
Rate of Change Is Exponential
dc/dt = -k*c is
c =
c decays exponentially.
-kt
.
ce
o
Changing Model Component Values Using Rules
Notice that if the amount of a species c isdeterminedbyarateruleandcis
also in a reaction,
For example, with a reaction
BoundaryCondtion for c so that a differential rate term is not created from
the reaction. The amount of
c must have itsBoundaryCondition property set to true.
a->cand a rate rule dc/dt = k*c,selectthe
c is determined solely by a differential rate term
fromtheraterule.
If the boundary condition is not selec ted, you will get the following error
message:
id rule variable 'in a reaction or another rule'.
Inval
When the Rate of Change Is Determined by Another Species
cies from one reaction can determine the rate of another reaction if it
Aspe
the s econd reaction rate equation. Similarly, a species from a reaction
is in
etermine the rate of another species if it is in the rate rule that defines
can d
t other species.
tha
reaction: a -> b
rate equation: v = -k1*a
rate rule: dc/dt = k2*a
1-39
1 Modeling
species: a = 10 mole
b =0 mole
c =5 mole
parameters: k1 = 1 1/second
k2 = 1 1/second
The solution for the species in the reaction are:
-k1t
a=a e
o
b=a (1-e)
and
With the rate rule dc/dt = k
-k1t
e
k
2(ao
c=co+k2ao/k1(1 - e
), and the solution is:
-k1t
o
*a dependent on the reaction, dc/dt =
2
-k1t
)
Enter the reaction and rule described above and simulate.
1-40
Expressing Differential Rate Equations as Rules
Many mathematical models in the literature are described with differentia l
rate equations for the species. You could manually convert the equations to
Changing Model Component Values Using Rules
reactions, or you could enter the equations as rate rules. For example, you
could enter the following differential rate equation for a species
C,
dC
= v - v X
dt
id
C
K + C
c
d
- k C
asarateruleinSimBiology:
C = vi - (vd*X*C)/(Kc + C) - kd*C
1-41
1 Modeling
Changing Model Component Values Using Events
In this section...
“What Is an Event?” on page 1-42
“How Events Are Evaluated” on page 1-43
“Evaluation of Simultaneous Events” on page 1-48
“Evaluation of Multiple Event Functions” on page 1-49
“When One Event Triggers Another Event” on page 1-49
“Cyclical Events” on page 1-50
What Is an Event?
Events are used to describe sudden changes in model behavior. An event lets
you specify discrete transitions in model component values that occur when a
user-specified condition becomes true. You can specify that the event occurs
at a particular time, or specify a time-independent condition.
1-42
For example, you can use events to activate or deactivate certain species
(activator or inhibitor species), chan g e parameter values based on external
signals, or change reaction rates i n response to addition or removal of
species. You can also use an event in a model when you want to replicate an
experimental condition, for example, to replicate the addition or removal of an
activating agent (such as a drug) to a sample. This section describes events
and how they are evaluated.
Use events to define events that occur when a condition becomes true. When
you specify a condition in the
should be executed when the condition becomes true. Typical triggers are:
• Cause an event to occur at a specific time during simulation — Specify that
the event must change the amounts or values of species or parameters. For
example, at time = 5 s, increase the amount of an inhibitor species above
the threshold to inhibit a given reaction.
• Cause an event to occur in response to state or changes in the system —
Change amounts/values of certain species/parameters in response to events
that are not tied to any specific time. For example, when species
Trigger you are specifying that the event
A reaches
Changing Model Component Values Using Events
an amount of 30 molecules, double the value of reaction rate constant k;or
when temperature reaches 42
C, inhibit a particular reaction by setting its
reaction rate to zero.
The event that is executed when the
function (
EventFcn). Event functions could range from simple to complex, for
Trigger becomes true is called an event
example, an event function might:
• Change the values of com partments, species, or parameters.
• Double the value of a reaction rate constant.
To simulate SimBiology models containing events, use the deterministic
sundials solver or the stochastic ssa solver; other solvers do not support
events. See “Sundials Solvers” on page 2-17 and “Stochastic Solvers” on page
2-12 for more information.
Procedures
• For an example using events in the SimBiology desktop, see “Desktop
Example — Changing Species Amounts Using an Event” on page 1-51 in
the SimBiology User’s Guide
• For an example of using events at the command line, see
addevent in the
SimBiology Reference
How Events Are Evaluated
Consider the example of a simple event where you specify that at 4s,youwant
to assign a value of
10 to species A.
1-43
1 Modeling
1-44
At time = 4 the trigger becomes true and the event is executed. In the figure
above assuming that 0 is false and 1 is true, when the trigger becomes true,
the amount of
event would be executed exactly at
Species A is set to 10. In theory, with a perfect solver, the
time = 4.00. In practice there is a very
minute delay (for example you might notice that the event is executed at
time = 4.00001 s). Thus, you must specify that the trigger can become true
at or after
Trigg
time
4s,whichistime >= 4.
er
>= 4
Fcn
Event
A=10
The point at which the trigger becomes true is called a rising edge.SimBiology
events execute the
The
Trigger is evaluated at every time step to check whether the condition
EventFcn only at rising e dges.
specified in the trigger tran siti on s from false to true. T he solver detects and
tracks falling edges, which is when the trigger becomes false, so if another
Changing Model Component Values Using Events
rising edge is encountered, the event is executed again. If a trigger is already
true before a simulation starts, then the event does not execute the at the
start of the simulation . The event is not executed until the solver encounters
a rising edge. Very rarely, the solver might miss a rising edge; one example of
this is when a rising edge follows very quickly after a falling edge, and the
step size results in the solver skipping over the transition p oint.
If the trigger becomes true exactly at the stop time of the simulation, the
event may or may not execute. If you want the event to execute, increase
the stop time.
Note Since the rising edge is instantaneous and changes the system state,
therearetwovaluesforthestateatthesametime.Thesimulationdatathus
contains the state before the event and after the event, but both points are
atthesametimevalue. Thisleadstomultiple values of the system state
at a single instant in time.
Specifying Event Triggers
A Trigger is a condition that must become true for an event to be executed.
Typically, the condition uses a combination of relational and logical operators
to build a trigger expression.
MATLAB uses specific operator precedence to evaluate trigger expressions.
Precedence levels determine the order in which MATLAB evaluates an
expression. Within each precedence level, operators have equal precedence
and are evaluated from left to right. To find more information on how
relational and logical operators are evaluated see “Operators” in the MATLAB
Programming Fundamentals documentation.
Some examples of triggers are:
1-45
1 Modeling
Trigger
'(time >=5) &&
(speciesA<1000)'
'(time >=5) ||
(speciesA<1000)'
'(s1 >=10.0) || (time>= 250)
&& (s2<5.0E17)'
Explanation
Execute the event when the following
condition becomes true:Time is greater
than or equal to
5,andspeciesA is less
than 1000.
Tip Using a && (instead of &)tells
the software to evaluate the first part
of the expression for wh ether the
statement is true or false, and skip
evaluating the second statement if this
statement is f alse.
Execute the event when the following
condition becomes true: Time is greater
than or equal to
5,orifspeciesA is
less than 1000.
Execute the event when the following
condition becomes true: Species,
greaterthanorequalto
10.0 or, time
is greater than or e qual to
species
s2 is less than 5.0E17.
s1 is
250 and
1-46
Because of operator precedence the
expression is treated as if it were
'(s1 >=10.0) || ((time>= 250) &&
(s2<5.0E17))'
Thus, it is always a good idea to use
parenthesis to explicitly specify the
intended precedence of the statements.
Changing Model Component Values Using Events
Trigger
'((s1 >=10.0) || (time>=
250)) && (s2<5.0E17)'
'((s1 >=5000.0) && (time>=
250)) || (s2<5.0E17)'
Explanation
Execute the event when the time
the following condition becomes true:
Species,
10 or time is greater than or e qual to
250,andspeciess2 is less than 5.0E17.
s1 isgreaterthanorequalto
Execute the event when the time
the following condition becomes true:
Species,
to
equal to
5.0E17.
s1 isgreaterthanorequal
5000 and time is greater than or
250,orspeciess2 is less than
For more information on triggers see Trigger in the SimBiology Reference
Guide.
Specifying Event Functions
The event that is executed when a Trigger condition has a rising edge is
called an event function (
the value of a species or a parameter, or you can specify complex tasks by
calling a user-defined function or script.
An event function is either a single valid MATLAB expression (without ’
the expression) or a cell-array of single valid MATLAB expressions . For more
information see also
examples of event functions include:
EventFcn). You can use an event function to change
;’in
EventFcns in the SimBiology Reference Guide. Some
EventFcn
'speciesA = speciesB'
'k = k/2'
Explanation
When the event is executed set the
amount of
speciesB.
speciesA equal to that of
When the event is executed halve
the value of the rate constant
k.
1-47
1 Modeling
EventFcn
{'speciesA = speciesB', 'k =
k/2'}
'kC = my_func(A, B, kC)'
Explanation
When the event is executed set the
amount of
speciesB, and halve the value of the
rate constant
speciesA equal to that of
k.
When the event is execute d call the
user-defined function
my_func().
This function takes 3 arguments:
Thefirsttwoargumentsarethe
current amounts o f two species (
A
and B) during simulation and the
third argument is the current value
of a parameter,
returns the modified value of
kC. The function
kC as
its output.
Evaluation of Simultaneous Events
When two or more trigger conditions simultaneously become true, the solver
executes the events in the order in which they are on the model. You can
reorder events using the
in the SimBiology desktop, arrange the rows of events in the order you
desire, then right-click and select Reorder Events as Shown in Table.
Forexample,consideracasewhere:
reorder method at the command-line. Alternatively,
1-48
Event
TriggerEventFcn
Number
1SpeciesA >= 4SpeciesB = 10
2
SpeciesC >= 15SpeciesB = 25
The solver tries to find the rising edge for these events within a certain level
of tolerance. If this results in the two events occurring simultaneously, then
the value of
be
25. If you reorder the events to reverse the event order then the value of
SpeciesB after the time step in which these two events occur will be 10.
SpeciesB after the time step in which these two events occur will
Changing Model Component Values Using Events
Consider an example in which you include event functions that change model
components in a dependent fashion. For example, the event function in Event
2 b elow , stipulates that
SpeciesB takes the value of SpeciesC.
Event
TriggerEventFcn
Number
1SpeciesA >= 4SpeciesC = 10
2
time >= 15SpeciesB = SpeciesC
Event 1 and Event 2 may or may not occur simultaneously.
• If Event 1 and E vent 2 do not occur simultaneously, when Event 2 is
triggered
SpeciesB is assigned the value that SpeciesC has at the time
of the event trigger.
• If Event 1 and Event 2 occur simultaneously, the solver store s the value of
SpeciesC at the rising edge, before any event functions are executed and
uses this stored value to assign
if
SpeciesC = 15 when the events are triggered, after the events are
executed
SpeciesB = 15,andSpeciesC = 10.
SpeciesB its value. In the above example
Evaluation of Multiple Event Functions
Consider an event function in which you specify that the value of a model
component (
(
SpeciesA), but SpeciesA also is changed by the ev ent function.
TriggerEventFcn
time >= 4{'SpeciesA = 10, SpeciesB = SpeciesA'}
SpeciesB) is dependent on the value of model component
The solver stores the value of SpeciesA at the rising edge and before any
event functions are executed and uses this stored value to assign
SpeciesB
its value. So in the above example if SpeciesA = 15 atthetimetheeventis
triggered, after the event is executed,
SpeciesA = 10 and SpeciesB = 15.
When One Event Triggers Another Event
In the example below, Event 1 includes an expression in the event function
that causes Event 2 to be triggered, (assuming that
than
5 when Event 1 is executed).
SpeciesA has amount less
1-49
1 Modeling
Event
TriggerEventFcn
Number
1time >= 5{'SpeciesA = 10, SpeciesB = 5'}
2
SpeciesA >= 5SpeciesC = SpeciesB
When Event 1 is triggered, the solver evaluates and executes Event 1 with
the result that
Event 2 becomes true (assuming that
executes the event function for E vent 2. Thus,
SpeciesA = 10,andSpeciesB = 5. Now, the trigger for
SpeciesA is be low 5)andthesolver
SpeciesC = 5 at the end of
this event execution.
You can thus have event cascades of arbitrary length, for example, Ev ent 1
triggers Event 2, which in turn triggers Event 3, and so on.
Cyclical Events
In some situations, a series of events can trigger a cascade that becomes
cyclical. Once you trigger a cyclical set of events, the only way to stop the
simulation is by pressing Ctrl+C. You lose any data acquired in the current
simulation. An example of cyclical events is shown below. This example
assumes that
Event
Number
1SpeciesA > 10{SpeciesB = 5, SpeciesC =
2
3
Species B <= 4 at the start of the cycle.
TriggerEventFcn
1'}
SpeciesB > 4{SpeciesC = 10, SpeciesA =
1'}
SpeciesC > 9{SpeciesA = 15, SpeciesB =
1'}
1-50
Desktop Example — Changing Species Amounts Using an Event
Desktop Example — Changing Species Amounts Using an
Event
In this section...
“Overview” on page 1-51
“Prerequisites” on page 1-52
“Adding a n Event to the Example Model” on page 1-52
“Simulating the Modified Model” on page 1-55
Overview
This examp
time-bas
“Changin
le shows you how to add an event to a model to trigger a
ed change. For information on events and how they are evaluated see
g M odel Component Value s Using Events” on page 1-42.
This exa
(L), thu
mple shows you how to add an event that modifies amount of ligand
s modeling a delay in the addition of α-factor to the cell culture.
About the Example Model
This ex
SimBio
This t
corre
rever
ample uses the model from “Mo deling a G Protein Cyc le” in the
logy Model Reference documentation.
able shows the reactions used to model the G protein cycle and the
sponding rate parameters (rate constants) for each reaction. For
sible reactions, the forward rate parameter is listed first.
No. Name
1
Receptor-ligand
interaction
2
Heterotrimeric G protein
formation
3
G protein activation
Reaction
L + R <-> RLkRL,kRLm
Gd + Gbg -> GkG1
RL + G -> Ga + Gbg + RLkGa
Rate
Parameters
1-51
1 Modeling
No. Name
Reaction
Rate
Parameters
4
Receptor synthesis and
R <-> nullkRdo, kRs
degradation
5
Receptor-ligand
RL -> nullkRD1
degradation
6
G protein inactivation
Ga -> GdkGd
Prerequisites
Opening and Saving the Example Model
1 Load the example project by typing the following at the command lin e:
sbioloadproject gprotein
The model is stored in a variable called m1.
2 Open the SimBiology desktop with the model loaded by typing:
simbiology(m1)
1-52
The desktop opens w ith Model Session-Heterotrimeric_G_Protein_wt.
3 Save the project.
a Select File > Save Project As. The Save SimBiology Project dialog
box opens.
b Specify a name (for example, gprotein_ex) and location for your project,
and click Save.
Adding an Event to the Example Model
1 In the Project Explorer expand SimBiology Model and click Events
to open the Events pane.
2 In the Enter Trigger box, type the following expression and press Enter:
Desktop Example — Changing Species Amounts Using an Event
time >= 100
3 In the EventFcns box, type the following expression and press Enter:
L = 6.022E17
In the Settings tab, under the SpeciesbeingusedbyEventsection,
note that the species
4 In the row containing the species L, double-click the InitialAmount
L is available.
column, type 0,andthenpressEnter.
The InitialAmount of
L is set to be 0.0 when the simulation starts.
The E vents pane should now resemble the following:
1-53
1 Modeling
1-54
5 In the Project Explorer,clickConfiguration Settings to open the pane
that contains so lver settings.
6 Click the Data Logging tab.
7 Click Select All.
8 Save the project by selecting File > Save Project.
Desktop Example — Changing Species Amounts Using an Event
Simulating the Modified Model
1 Click Run.
The simulation runs to completion and plots the result in a figure. Notice
that the plot shows that the ligand amount increases when the event
is executed.
Theplotdoesnotshowthespeciesofinterestduetoawiderangeinspecies
amounts. Follow the next steps to view the species of interest.
2 In the Project Explorer, under Simulation,right-clickData and select
Save Data. The Save Data dialog box opens.
1-55
1 Modeling
3 Specify a name for the saved data, for example, event_ex,andclickSave .
The Project Explorer shows a new item with the saved data name under
Simulation.
4 In the Project Explorer, click the saved data, for example, event_ex,to
open the Data pane for the saved data.
5 Click the Plots tab.
6 From the Plot Type list, select Time and click Add Plot Type.
7 Select the n
The Select V
8 Clear the check boxes for the species L and Gbg.
9 Click OK.
10 (Optiona
11 Click Plot. Your plot should resemble the one below. Notice the increase in
activation of G protein (species
at
time = 100 (simulation time).
ew plot (second row), and in the Arguments section, click
alues for y dialog box opens.
l) Clear the Create Plot check box for the first plo t.
Ga, shown in red) after ligand (L) is added
.
1-56
Desktop Example — Changing Species Amounts Using an Event
1-57
1 Modeling
Storing and Applying Alternate Model Values Using
Variants
In this section...
“What Are Variants?” on page 1-58
“Using Variants” on page 1-59
“Applying M ultiple Variants in a Model” on page 1-60
What Are Var
Variants a
represent
asimulati
for use of
• Store and
separat
• Store pa
several
• Store c
repres
Simul
perma
simul
• Spec
• Para
• Com
ng one or more variants associated with a model allows you to ev aluate
Usi
el behavior during simulation, with different values for the various model
mod
mponents without having to search and replace these v alues, or having to
co
eate additional models with these values. If you determine that the values
cr
llow you to apply alternate values to model components to
values for the components. The alternate values apply only during
on and do not otherwise alter the model’s values. Som e examples
variants are:
apply parameter values for yeast and mouse models using two
evariants.
rameter estimates from differe n t experimental conditions in
variants and apply them to a model.
omponent values for mutant strains and apply the values to a model
enting the wild-type.
ating using a variant does not alter the model component values
nently. The values specified in the variant temporarily apply during
ation. You can store values for:
ies
InitialAmount
meter
partment
iants?
Value
Capacity
1-58
Storing and Applying Alternate Model Values Using Variants
in a variant accurately define your model, you ca n permanently replace the
values in your model with the values stored in the variant object.
Using Variants
Creating and Using Variants at the Command Line
1 Create the variant and add it to the model using the addvariant method.
2 (Optional) Set the Active property to true if you always want the variant
to be applied before simulating the model.
3 Enter the variant object as an argument to sbiosimulate.Thisappliesthe
variant only for the current simulation and supersedes any active variant
objects on the model.
If you followed step 2, simply calling
sbiosimulate on the model object
apples the variant.
For more information, see the following sources of information in the
SimBiology Reference:
For information about...
Variant object methods and
See...
Variant object
properties
Example of creating and adding a
addvariant
variant
Appending contents to variants
Replacing model values permanently
addcontent
commit
with values from a variant
Creating and Using Variants in the SimBiology Desktop
For information about creating variants in the SimBiology desktop and
applying them during a simulation, see the following:
1-59
1 Modeling
• The context-sensitive help (SimBiology Desktop Help) in the SimBiology
desktop for procedures. To access this help:
1 In the SimBiology desktop, from the Project Explorer, select Variants.
The desktop opens the Variants pane. The SimBiology Desktop Help
updates to show you how to work with variants.
2 If the context-sensitive help is not open, select Help > SimBiology
Desktop Help.
• “Desktop Example — Applying Changes to Parameter Value Using a
Variant” on page 1-61
Applying Multiple Variants in a Model
When multiple variants are used during a simulation, and there are duplicate
specifications for a property’s value, the last occurrence for the property value
in the array of variants is used during simulation. You can find out which
variant is applied last by looking at the indices of the variant objects stored on
the model (at the command line) or the last variant created.
1-60
If you specify variants as argum ents to
variants for the current simulation in the order that they are specified, and
supersedes any active variant objects on the model.
Similarly, in th e variant contents (
specifications for a prope r ty’s value, the last occurrence for the property in the
contents is used during simulation.
If you permanently replace values in a model with values from multiple
variants using the Commit button in the desktop, the value committed in the
model is the last occurrence of the value in the variants.
sbiosimulate,thisappliesthe
Content property), if there are duplicate
Desktop Example — Applying Changes to Parameter Value Using a Variant
Desktop Example — Applying Changes to Parameter
Value Using a Var
In this section...
“Overview” on page 1-61
“Prerequisites” on page 1-62
“Applying Alternate Values Using Variants” on page 1-63
“Simulation Results for the Model of the Mutant Strain” on page 1-63
Overview
This examp
wild-typ
cycle in a
the varia
with the
iant
le shows you how to apply a variant to a model representing a
e strain. The variant represents a parameter value for a G protein
mutant strain. Thus, when the model is simulated without applying
nt, you see results for the wild-type, and when the model is simulated
variant you see results for the mutant.
About the Example Model
This ex
SimBio
This t
corre
rever
ample uses the model from “Mo deling a G Protein Cyc le” in the
logy Model Reference documentation.
able shows the reactions used to model the G protein cycle and the
sponding rate parameters (rate constants) for each reaction. For
sible reactions, the forward rate parameter is listed first.
No. Name
1
Receptor-ligand
interaction
2
Heterotrimeric G protein
formation
3
G protein activation
4
eceptor synthesis and
R
egradation
d
Reaction
L + R <-> RLkRL,kRLm
Gd + Gbg -> GkG1
RL + G -> Ga + Gbg + RLkGa
R <-> nullkRdo, kRs
Rate
Parameters
1-61
1 Modeling
No. Name
Reaction
Rate
Parameters
5
Receptor-ligand
RL -> nullkRD1
degradation
6
G protein inactivation
Ga -> GdkGd
About the Variant Created in This Example
The value of the parameter kGd is 0.11 for the wild-type and 0.004 for the
mutant. To represent the mutant, the alternate value of the parameter
stored as
0.004 in a variant and applied during simulation.
kGd is
For a description of variants, see “Storing and Applying Alternate Model
Values Using Variants” on page 1-58.
Prerequisites
Opening and Saving the Example Model
1 Load the example project at the command line by typing
sbioloadproject gprotein_norules
1-62
The model is stored in a variable called m1.
2 Open the SimBiology desktop with the model loaded by typing:
simbiology(m1)
The SimBiology desktop opens with Yeast_G_Protein_wt.
3 Save the project.
a Select File > Save Project As. The Save SimBiology Project dialog
box opens.
b Specify a name (for example, gprotein_ex) and location for your project
and click Save.
Desktop Example — Applying Changes to Parameter Value Using a Variant
Applying Altern
1 In the Project Ex
click Variants
2 In the Enter Name box, type a name for the variant, and then click Add
ate Values Using Variants
plorer,underModel Session-Yeast_G_Protein_wt,
to open the Variants pane.
or press Enter. For example:
mut_value_ex
3 Add content to the variant:
a In the Settings tab, from the Type list, select parameter.The
Property list updates to show the property available for changing.
b Double-click the Component Name cell and type the name of the
component.
Gprotein Inactivation.kGd
Tip Alternatively, double-click the Component Name cell, p ress the
down arrow, select
Gprotein Inactivation.kGd from the list, and
press Enter.
The parameter kGd is at the kinetic law level, and not the mo del
level. Thus, you must specify the parameter in the format
ReactionName.ParameterName.
c In the Value cell,typeavaluetoapplyusingthevariant.
0.004
See Also
“Storing and Applying Alternate Model Values Using Variants” on page 1-58
in the SimBiology User’s Guide.
Simulation Results for the Model of the Mutant Strain
To simulate the model of the mutant strain, apply the variant and simulate as
follows:
1-63
1 Modeling
1 If the Simulation pane is not already open, in the Project Explorer ,
in Model Session-Y east_G_Protein_wt, under Model Tasks,select
Simulation to open the pane.
2 Click the Simulation Settings tab.
3 In the Variants table, select the Use in Task check b ox for mut_value_ex.
4 Click. Your plot should resemble the following figure.
1-64
5 In the Data pane for the latest simulation, click Save to open the Save
Data dialog box.
6 Specify a name for your data, and then click Save.
Desktop Example — Applying Changes to Parameter Value Using a Variant
mut_model_run1
The desktop adds the saved data under the Simulation task in the
Project Explorer.
The simulation results for the wild-type strain are described in “Simulation
Results for the Wild-Type Strain Model”.
1-65
1 Modeling
Verifying that a Model Has No Warnings or Errors
In this section...
“Verifying a Model in the SimBiology Desktop” on page 1-66
“Verifying the Model at the Command Line” on page 1-68
The SimBiology desktop and MATLAB command line have 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.
You can check your model for errors and warnings at any time in your
workflow of building or working with your model, this check includes
dimensional analysis or unit conversion issues. For example, verify your
model during construction to ensure that the model is always complete, or
verify the model or configuration set after changing simulation settings or
settings for dimensional analysis or unit conversion.
Analysis such as simulation, scanning, and parameter fitting also causes a
model to be verified before the task runs. Repeatedly running a task using
different variants or setting different values for the
the
Capacity of compartments, a nd the Value of parameters, g enerates
warnings only the first time. Use the verification fun ction ality described in
this section to display warnings again.
InitialAmount of species,
1-66
Verifying a Model in the SimBiology Desktop
While you are building your model in the SimBiology desktop, you can click
at any time to generate a list of any errors and warnings in the
model. The errors and warnings appear in the Errors and W arnings pane.
The following is an example of the error generated when the reaction rate of a
reaction is set to a parameter that you have not defined.
Verifying that a M odel Has No Warnings or Errors
Double-click the error row to move to the location of the error.
You can interrupt and stop the verification process by clicking Stop at any
time during verification.
Troubleshooting Using Colored Indicators
Model component tables and the items in the Project Explorer have colored
indicators that let you see if the specified properties are valid. The error or
warning icons in the Project Explorer allow you to quickly assess which
model components have errors or warnings associated with them.
You can turn off these indicators by selecting File > Preferences to open the
SimBiology Preferences dialog box. Select Explorers to find this preference.
In the tables, move the mouse over the indicator to see more details about the
warning or error. This table shows the indicators and their significance.
Colored Indicator
GreenComponents have valid properties.
YellowThere are warnings in the associated rows.
RedThe
• Click Verify in the Toolbar to see if any errors are listed in the Errors
and Warnings pane. You must fix any reported errors before you can
simulate a model. Warnings m ay not need to be resolved before simulating,
but might result in unexpected answers.
Descri
ption
re are errors in the associated rows.
1-67
1 Modeling
• Click the colored square, if present, in the Settings tab to open a dialog
box with tips on how to fix the warning or error.
VerifyingtheModelattheCommandLine
Use the verify method to see a list of warnings and errors in your model. This
method checks a model or a configuration set, depending on the argument you
give to the method, and returns a list of warnings and errors encountered.
The functions
and last error encountered during verification.
sbiolastwarning and sbiolasterror return the last warning
1-68
Desktop Example — Using User-Defined Functions in Expressions
Desktop Example — Using User-Defined Functions in
Expressions
In this section...
“Prerequisites” on page 1-69
“Overview” on page 1-69
“Creating a Function” on page 1-71
“Calling the Function in a Rule Expression” on page 1-72
“See Also” on page 1-77
Prerequisites
To work through the example, these sections assume you have a working
knowledge of the following:
• MATLAB desktop
• Creating and saving MATLAB programs
• SimBiology desktop
Overview
You can use custom defined functions in reaction rate, rule, and event
expressions. W h en you use a function in a SimBiology expression, the solver
calls the function every time the expression is evaluated during simulation.
Therefore, if you have complex reaction rate expressions you can define the
reaction rate with a function.
Requirements For Using User-Defined Functions in SimBiology
Expressions
• Create a function. To find out more about functions, see function in
MATLAB Function Reference. For an example of a function to be used in a
SimBiology model, see “Creating a Function” on page 1-71 in this topic.
1-69
1 Modeling
• Chang e the current folder to the folder containing your MATLAB file using
the
cd comm and or use the Current Folder field in the MATLAB desktop
toolbar. Alternatively, add the path to the folder containing your file
using
addpath or see “Adding Folders to the Search Path”in the MATLAB
Desktop Tools and Development Environment documentation.
• Call the function in a SimBiology reaction, rule, or event expression.
The requirements do not have to be executed in any specific order, but you
might find it more convenient to start with the first two items before calling
the function from within the SimBiology expression. This is because colored
cues for model verification in the SimBiology desktop will show the expression
as invalid if the function has not yet been defined, or is not on the path or
the working directory.
The example below shows how to create and call user-defined functions in
SimBiology expressions. More specifically, the example shows how to use a
user-defined function in a rule expression. You can use user-defined functions
similarly in event functions (
property) and in reaction rate expressions (ReactionRate property). For
example, y ou can define a function that gives the reaction rate expression as
the output, and use the function in a reaction rate expression.
EventFcns property), event triggers (Trigger
1-70
About the Example Model
This example uses the model from “Modeling a G Protein Cycle” in the
SimBiology Model Reference documentation.
This table shows the reactions used to model the G protein cycle and the
corresponding rate parameters (rate constants) for each reaction. For
reversible reactions, the forward rate parameter is listed first.
No. Name
1
Receptor-ligand
interaction
2
Heterotrimeric G protein
formation
3
G protein activation
Reaction
L + R <-> RLkRL,kRLm
Gd + Gbg -> GkG1
RL + G -> Ga + Gbg + RLkGa
Rate
Parameters
Desktop Example — Using User-Defined Functions in Expressions
No. Name
Reaction
Rate
Parameters
4
Receptor synthesis and
R <-> nullkRdo, kRs
degradation
5
Receptor-ligand
RL -> nullkRD1
degradation
6
G protein inactivation
Ga -> GdkGd
Assumptions
For the purpose of this example, assume that:
• An inhibitor (
Inhib) slows the inactivation of the active G protein (reaction
6above,Ga–>Gd).
• The variation in the am ount of
• The effect on the reaction is through a change in the rate parameter
Inhib is defined in a function.
kGd.
Creating a Function
1 In the MATLAB desktop, select File > New > Script,toopenanewfilein
the MATLAB Editor.
2 Copy and paste the following function declaration:
% inhibvalex.m
function Cp = inhibvalex(t, Cpo, kel)
% This function takes the input arguments t, Cpo, and kel
% and returns the value of the inhibitor Cp.
% You can define the input arguments in a
% SimBiology rule expression.
% For example in the rule, define:
% t as time (a keyword recognized as simulation time),
% Cpo as a parameter that represents the initial
% amount of inhibitor and kel as a parameter
% that governs the amount of inhibitor.
1-71
1 Modeling
ift < 400
Cp = Cpo*exp(-kel*(t));
else
Cp = Cpo*exp(-kel*(t-400));
end
3 Savethefile(namethefileinhibvalex.m) in a directory that you can
access, or that is on the path.
4 If the location of the file is not on the path, change the working directory to
thefilelocation.
Calling the Function in a Rule Expression
• “Opening and Saving the Example Model” on page 3-65
• “Adding User-Defined Functions to the Example Model” on page 1-73
• “Defining a Rule to Affect Parameter Value” on page 1-74
• “Simulating the Modified Model” on page 1-75
1-72
Opening and Saving the Example Model
1 Load the example project by typing the following at the command lin e:
sbioloadproject gprotein
The model is stored in a variable called m1.
2 Open the SimBiology desktop with the model loaded by typing:
simbiology(m1)
The desktop opens w ith Model Session-Heterotrimeric_G_Protein_wt.
3 Save the project.
a Select File > Save Project As. The Save SimBiology Project dialog
box opens.
b Specify a name (for example, gprotein_ex) and location for your project,
and click Save.
Desktop Example — Using User-Defined Functions in Expressions
Adding User-Defined Functions to the Example Model
The previously defined function inhibvalex in “Creating a Function” on page
1-71 lets you specify how the inhibitor amount changes over time. This section
shows you how to specify the input values for the function in a rule expression.
As defined in the function, the output value is the amount of inhibitor.
Define a new rule to assign the inhibitor value.
1 In the Project Explorer,expandSimBiology Model and click Rules to
open the Rules pane.
2 In the Enter Rule box, type the following expression and press Enter:
Inhib = inhibvalex(time, Cpo, Kel)
The Rule Variables dialog box opens for you to define the rule variables.
3 From the Type list, select species for Inhib,andparameter for Cpo and
Kel. The SimBiology desktop creates the two species and the parameter.
Note If inhibvalex is on the list of undefined variables in the Rule
Variables dialog box, this means that you have not yet put the function file
on the path or changed the working directory to the location of the file.
Leave
inhibvalex undefined in the Rule Variables dialog box and click
OK. In the MATLAB desktop, change the Current Directory field to
the location of the file.
4 Click OK.
5 In the Rules pane from the RuleType list, select repeatedAssignment.
6 In the Settings tab, in ParametersbeingusedbyRule,findtherow
containing the parameter
Kel.Double-clicktheValue column, type 0.01,
and press Enter.
7 Find the row containing the parameter Cpo.Double-clicktheValue
column, type
250 and press Enter.
1-73
1 Modeling
Note YoudonothavetosetavalueforthespeciesInhib because it is
being specified by a
8 Save the project by selecting File > Save Project.
repeatedAssignment rule.
Defining a Rule to Affect Parameter Value
As described in “About the Example Model” on page 3-29 , the parameter kGd
should be affected by the amount of inhibitor present in the system. Add a
rule to describe this action, but first change the
properties of the parame ter kGd so that it can be varied by a rule.
Note Although the model has a previously defined parameter called kGd,this
parameter’s scope is currently at the kinetic law level. The parameter must
be scoped to the model for it to be varied by a rule or an event.
Scope and ConstantValue
1-74
1 In the Project Explorer,expandSimBiology Model and click
Parameters to open the Parameters pane.
2 Select the row containing the parameter kGd.
3 Right-click and select Change Parameter Scope.NoticethattheScope
column now shows the model name for this parameter.
4 In the Settings tab, clear the ConstantValue check box for kGd,asthis
parameter is being varied by a rule.
5 In the Project Explorer,clickRules to open the Rules pane.
6 In the Enter Rule box, type the following expression and press Enter:
kGd = 1/Inhib
In the Settings tab you should see a green square indicating that the
rule variables have been previously defined, and that there are no other
warnings or errors associated with this rule.
Desktop Example — Using User-Defined Functions in Expressions
7 For the new rule, in the Rules pane from the RuleType list, select
repeatedAssignment.
8 Save the project by selecting File > Save Project.
Simulating the Modified Model
1 In the Project Explorer,right-clickSimBiology Model and select Run
Simulation.
The simulation runs to completion and plots the result in a figure. The
plot does not show the species of interest due to a wide range in species
amounts/concentrations. Follow the next steps to view the species of
interest.
2 In the Project Explorer, under Simulation,clickData to open the Data
pane for the most recent simulation run.
3 Click the Plots tab.
4 In the Arguments section, click. The Select Values for y dialog box
opens.
5 Clear the check box for the following species:
RL
L
R
Gbg
Note Species names are prefixed with the name of the compartment to
which the species belongs. The default compartment is ’
6 In the Plot Type box, select Time and click Add Plot Type.
7 Select the row containing the new plot, and then in the Arguments section,
click
. The Select Values for y dialog box opens.
unnamed’.
1-75
1 Modeling
8 Click Clear All, and then select the check box for the species Inhib.
9 Click OK.
10 Click Plot. Your plots should resemble the following:
1-76
Notice the change in profile of species Ga at time = 400 seconds (simulation
time) when the inhibitor amount is changed to reflect the re-addition of
inhibitor to the model.
See Also
Desktop Example — Using User-Defined Functions in Expressions
To lea rn abo ut...
The SimBiology desktop“Getting Started in the SimBiology
Functionsfunction in the MATLAB Function
Changing the working directory to
the directory containing the function
file
Adding the directory containing
function files to the MATLAB search
path
Refer to...
Desktop” in the SimBiology Getting
Started Guide.
Reference.
cd command in the MATLAB
Function Reference.
addpath in the MATLAB Function
Reference or “Adding Folders tothe Search Path” in MATLAB
Desktop Tools and Development
Environment.
1-77
1 Modeling
Importing and Expor ting Model Component Data
In this section...
“Importing M odel Component Data” on page 1-78
“Exporting Model Component Data” on page 1-79
Importing Model Component Data
You can import lists of species, reactions, parameters, and rules to and from
the SimBiology desktop.
You can import the data from an Excel spreadsheet, or from a
comma-separated or tab-separated text file using theLoad ModelComponents from File menu item. The Excel
on the Windows
1 From the File menu, point to Load Model Components from File and
®
platform.
select the component type, for example, Reaction.TheLoadReaction
from File dialog box opens.
®
option is only supported
1-78
Note When there are multiple Model Sessions, components are im ported
into the Active model. To specify the Active model, select Task > Active
Model >
2 From the File Type list, select Excel, comma-separated text file,or
tab-separated text file.
3 In the File Name box, enter a file path and name. Alternatively browse to
e first row in the file contains header information, select the First row
tains header information check box.
con
current property values check box to preserve the values in the model.
Importing and Exporting Model Component Data
6 Select the properties to import. There are required properties based on the
component type. For example, Reaction is a required property. Specify
column order using the
andarrows. The first property selected
corresponds to the first column in the Excel spreadsheet or text file.
7 Click OK. The data from your file is entered into the model.
Note
• If you have preexisting species in the model, the software appends
nonidentical species names.
• If you want a species to remain constant throughout a simulation, you
can specify this using the BooleanoperatorTRUEinacolumnofthe
Excel file or line of text file (you do not have to specify the property
name, ConstantA mount).Whileimportingthedata,thesoftwarewill
select the ConstantAmount check box for that species. The default is
unchecked.
Exporting Model Component Data
You can export lists of species, re actions, parameters, and rules to and from
the SimBiology desktop.
You can export data to an Excel spreadsheet, or to a comma-separated or
tab-separated text file using the Export Model Components to File menu
item. The Excel option is only supported on the Windows platform.
1 From the File menu, point to Export Model Components to File and
select the component type, for example, Reaction.TheExportReactions
to File dialog box opens.
Note When there are multiple Model Sessions, components of the Active
model are exported. To specify the Active model, select Task > Active
Model >
name of m odel.
1-79
1 Modeling
2 From the File Type list, select Excel, comma-separated text file,or
tab-separated text file.
3 In the File Name box, enter a file path and name. Alternatively, if you
browse to select a file name, select the file name and click Save.
4 If the first row in the generated file should contain the property names,
select the Write property names to first row in file check box.
5 Select the properties to export. There are required properties based on the
component type. For example, Reaction is a required property. Specify
column order using the
andarrows.
The first prop erty selected corresponds to the first column in the Excel
spreadsheetortextfile.
6 Click OK.T
he data from your model is entered into the file.
1-80
Simulation
• “Performin g Simulations” on page 2-2
• “About Simulation Solvers” on page 2-5
• “Nonstiff Deterministic Solvers” on page 2-8
• “Stiff Deterministic Solvers” on page 2-10
• “Stochastic Solvers” on page 2-12
• “Sundials Solvers” on page 2-17
• “Accelerating Simulations” on page 2-18
2
2 Simulation
Performing Simulations
In this section...
“Performing Simulations at the Command Line” on page 2-2
“Performing S imulations in the SimBiology Desktop” on page 2-2
Performing Simulations at the Command Line
The function sbiosimulate allows you to perform simulations at the
command line.
At the command line, you can create a configuration set (
that contains information about:
• The type of solver to use, associated tolerances, and maximum step size for
deterministic (ODE) solvers
• The simulation stop time
• The options to use in sensitivity analysis
You can add m any configuration sets to a model, each containing a different
combination of simulation settings. To use a conf ig u ration set during a
simulation y ou can either set the object’s
theobjectasanargumentto
sbiosimulate.
Active property to true, or specify
configset object)
Performing Simulations in the SimBiology Desktop
The SimBiology integrated desktop environment provides convenient access
to the configuration settings for simulations.
To access your configuration settings:
• In the Simulation pane, on the Simulation Settings tab, next to
Configuration Settings,clickGo to.
• Alternately, in the Project Explorer,selectConfiguration Settings.
2-2
Performing Simulations
The Configuration Settings pane appears, w h ere you can set, change, and
save simulation parameters, configure data logging, and compile options.
Where to Find Configuration Settings Controls
Use the following controls on the Configuration Settings pane:
• Use the Settings tab to set the simulation solver and timing options for
the currently selected model, and compile options for unit check ing.
• Use the Data Logging tab to choose which species to log and how often.
Where to Find Simulation Controls
To set up and run your simulation, use the following controls on any model
task pane:
• Use the Simulation Settings tab to select your configuration settings, or
use the default. After you set up custom configuration sets, you can select
them by name from the Configuration Settings list.
Note Use the Run buttonintheSimulation Toolbar to run the
simulation w ith your currently selected configuration settings.
If you are using Variants or Doses, y ou can view them and apply them to
tasks on the Simulation Settings tab.
2-3
2 Simulation
• Use the Export tabtoexportsimulationdatatotheMATLABWorkspace
and/or to file every time you run a simulation.
• Use the Plots tab to configure what plots to generate when you run a
simulation.
2-4
About Simulation Solvers
In this section...
“How Solvers Work” on page 2-5
“Stiff Versus Nonstiff Models” on page 2-5
“Selecting a Solver” on page 2-6
How Solvers Work
In order to simulate a model, the model is converted to a system of differential
equations. The solver functions are used to compute solutions for those
equations at different time intervals, giving the model’s states and outputs
over a span of time. You can then plot these outputs from your simulation.
The MATLAB ODE solvers are desig n ed to handle ordinary differentialequations. An ordinary diffe rential e quation contains one or more derivatives
of a dependent variable y with respect to a single independent variable t,
usually referred to as time.
About Simulation Solvers
The solver functions implement numerical integration methods for solving
initial value problems for ordinary differential equations (ODEs). Beginning
at the initial time with initial conditions, they step through the time interval,
computing a solution at each time step. If the solution for a time step satisfies
the solver’s error tolerance criteria, it is a successful step. Otherwise, it is a
failed attempt; the solver shrinks the step size and tries again.
Stiff Versus Nonstiff Models
An o rdinary differential equation problem is stiff if the solution being sought
is varying slowly, but there are nearby solutions that vary rapidly, so the
numerical method must take small steps to obtain satisfactory results. Many
biological models are numerically stiff because they include species amounts
that are changing quickly and others that change slowly.
Stiffness is an efficiency issue. In principle, nonstiff methods can solve stiff
problems; they just take a long time to do it.
2-5
2 Simulation
As an illustration, imagine trying to find the quickest descent through a
canyon. An explicit algorithm , which is normally used for nonstiff models,
would s ample the local gradient to find the descent direction. But following
the gradient on either side of the trail will send you bouncing back and forth
from wall to wall — the descent will be found but it will take a long time. An
implicit algorithm used for stiff models can anticipate where each step is
taking you, keep you on the trail with fewer steps, and so save time. Using a
stiff solver for a stiff problem can save thousands of solver steps and function
evaluations compared to a nonstiff solver.
Methods intended to solve stiff problems efficiently do more work per step,
but can take much bigger steps. Stiff methods are implicit. At each step they
use MATLAB matrix operations to solve a system of simultaneous linear
equations that helps predict the evolution of the solution.
Not all difficult problems are stiff, but all stiff problems are difficult for
solvers not specifically designed for them. So lv ers for stiff problems can be
used exactly like the other s olvers.
2-6
For an illustrative code example you can run to plot the effects of numerical
stiffness on different solvers, see MATLAB News & Notes - May 2003 Cleve’s
Corner: Stiff Differential Equations.
Selecting a Solver
Choice of solver depends on the problem and time available for computation.
There are trade-offs to be made between speed and accuracy. In general,
sundials is the best function to apply as a "first try" for most problems. As you
find out more about the problem you can try other solvers. Experimentation
is generally required to determine the best solver for a particular model. As
a general guide:
1 Models with either all fast or all slow changing variables are nonstiff
problems:
Use “Nonstiff Deterministic Solvers” on page 2-8.
• Sundials — Best first guess.
• ode45 — Alternative best first guess. May be faster.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.