Main Content

RuleType

Specify type of rule for rule object

Description

The RuleType property indicates the type of rule defined by the rule object. A Rule object defines how certain species, parameters, and compartments should interact with one another. For example, a rule could state that the total number of species A and species B must be some value. Rule is a MATLAB® expression that defines the change in the species object quantity or a parameter object Value when the rule is evaluated.

You can add a rule to a model object with the addrule method and remove the rule with the delete method. For more information on rules, see addrule.

The types of rules in SimBiology® are as follows:

  • initialAssignment — Lets you specify the initial value of a parameter, species, or compartment capacity, as a function of other 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 compartment capacity.

Constraints on Varying Species Using a Rate Rule

If the model has a species defined in concentration, being varied by a rate rule, and it is in a compartment with varying volume, you can only use rate or initialAssignment rules to vary the compartment volume.

Conversely, if you are varying a compartment's volume using a repeatedAssignment or algebraic rules, then you cannot vary a species (defined in concentration) within that compartment, with a rate rule.

The reason for these constraints is that, if a species is defined in concentration and it is in a compartment with varying volume, the time derivative of that species is a function of the compartment's rate of change. For compartments varied by rate rules, the solver has that information.

Note that if you specify the species in amounts there are no constraints.

Characteristics

Applies toObject: rule
Data typeCharacter vector
Data values'initialAssignment', 'repeatedAssignment''algebraic', 'rate'. Default value is 'initialAssignment'.
AccessRead/write

Examples

  1. Create a model object, and then add a reaction object.

    modelObj = sbiomodel ('my_model');
    reactionObj = addreaction (modelObj, 'a -> b');
  2. Add a rule that specifies the quantity of a species c. In the rule expression, k is the rate constant for a -> b.

    ruleObj = addrule(modelObj, 'c = k*(a+b)')
  3. Change the RuleType from the default ('initialAssignment') to 'rate' and verify it using the get command.

    set(ruleObj, 'RuleType', 'rate');
    get(ruleObj)

    MATLAB returns all the properties for the rule object.

        Active: 1
    Annotation: ''
          Name: ''
         Notes: ''
        Parent: [1x1 SimBiology.Model]
          Rule: 'c = k*(a+b)'
      RuleType: 'rate'
           Tag: ''
          Type: 'rule'
      UserData: []