SimBiology.Compartment
Object containing compartment information
Description
The SimBiology.Compartment
object represents a container for species in a
model. The compartment size can vary or remain constant during a simulation. All models must
have at least one compartment and all species in a model must be assigned to a compartment.
Compartment names must be unique within a model.
Compartments allow you to define the size (Capacity
) of physically
isolated regions that may affect simulation, and associate pools of species within those
regions. You can specify or change Capacity
using rules, events, and
variants, similar to species amounts or parameter values.
The model object stores compartments as a flat list. Each compartment stores information
on its own organization; in other words a compartment has information on which compartment it
lives within (Owner
) and who it contains
(Compartments
).
The flat list of compartments in the model object lets you vary the way compartments are organized in your model without invalidating any expressions.
To add species that participate in reactions, add the reaction to the model using the
addreaction
method. When you define a
reaction with a new species:
If no compartment objects exist in the model, the
addreaction
method creates a compartment object (called unnamed) in the model and adds the newly created species to that compartment.If only one compartment object exists in the model, the method creates a species object in that compartment.
If there is more than one compartment object in the model, you must qualify the species name with the compartment name.
For example, cell.glucose denotes that you want to put the species named glucose into a compartment named cell. Additionally, if the compartment named cell does not exist, the process of adding the reaction creates the compartment and names it cell.
Alternatively, create and add a species object to a compartment object, using the
addspecies
method at the command line.
When you use SimBiology Model Builder to create a new model, it adds an empty compartment (unnamed), to which you can add species.
You can specify reactions that cross compartments using the syntax
compartment1Name.species1Name
–> compartment2Name.species2Name
.
If you add a reaction that contains species from different compartments, and the reaction rate
dimensions are concentration/time, all reactants should be from the same compartment.
In addition, if the reaction is reversible then there are two cases:
If the kinetic law is
MassAction
, and the reaction rate reaction rate dimensions are concentration/time, then the products must be from the same compartment.If the kinetic law is not
MassAction
, then both reactants and products must be in the same compartment.
Use dot notation to query the object properties or change properties that are not
read-only. You can also use the get
and set
commands.
The SimBiology Model Builder app also enables you to add compartments, reactions, and other model components to your model and edit them. For an example, see Incorporate SGLT2 Inhibition into Physiologically Based Glucose-Insulin Model Using SimBiology Model Builder.
Creation
Use addcompartment
to create and add a compartment
to a SimBiology model.