Main Content

Evaluation of Model Component Names in Expressions

SimBiology模型组件include quantities and expressions. You can refer to model quantities (compartments, species, and parameters) and observables by their names in an expression, such as a reaction or an assignment equation. Follow these guidelines when you name model components or referencing their names in expressions. When evaluating a name that matches different quantities, SimBiology resolves it by following precedence rules.

Guidelines for Naming Model Components

  • Model, parameter, and observable names cannot contain brackets[ ]and cannot be empty, the wordtime, or all whitespace.

  • Compartment, species, and observable names cannot contain the characters->,<->,[or]and cannot be empty, the wordnull,或e wordtime. However, a name can contain the wordsnullandtimewithin the name, such asnullDrug.

  • Reaction, event, and rule names cannot contain brackets[ ]and cannot be the wordtime.

  • You cannot set a reaction name to an empty character vector ('') or empty string ("").

Note

SimBiology removes any leading or trailing whitespaces from model component names.

Guidelines for Referencing Names in Expressions

  • If the quantity name is not a valid MATLAB®variable name, you must enclose the name in brackets when referring to it in an expression. For example, if the name of a species isDNA polymerase+,写[DNA polymerase+].

  • If you have multiple species with the same name in different compartments, you must qualify the name by referring to the name of the compartment that contains the species. For example, the qualified namenucleus.[DNA polymerase+]refers to theDNA polymerase+species that resides in thenucleuscompartment.

Precedence Rules for Evaluating Quantity Names

If a name referenced in an expression matches multiple quantities orobservable使用对象,SimBiology评估表达式precedence rules. The rules depend on whether the name is referenced in a reaction or other expressions that are not reactions.

For Reactions

When a reaction refers to a name that matches different quantities, SimBiology evaluates the name as the first quantity with a matching name in this order: species, parameter scoped to the reaction, compartment, or parameter scoped to the model.

For Other Expressions

There are different types of expressions that are not reactions, namely rules, events, and observables. Rules include initial and repeated assignment equations, algebraic equations, and differential rate equations. An event contains expressions that represent an event trigger and one or more event functions to model discrete transitions in the values of quantities or expressions in the model. Anobservableobject is a mathematical expression that lets you perform post-simulation calculations.

When a nonreaction expression refers to a name that matches different quantities, SimBiology evaluates the name as the first quantity with a matching name in this order: species, compartment, or parameter scoped to the model. An active observable expression can reference another active observable object by its name as long as there are no circular dependencies (or algebraic loops).

See Also

Related Topics