Update initial assignment rules to remove order dependencies
the active initial assignment rules in a SimBiology
recover the same simulation results at time = 0, as in R2017a or earlier when the
initial assignment rules were evaluated according to the order appeared in the
model. As of R2017b, the order in which the initial assignment rules appear in the
model has no effect on the simulation results. For details, see Evaluation Order of Rules.
returns a boolean indicating whether the model is updated,
modelBackup] = updateInitialAssignments(
tfUpdated, a table of changes made to the rules,
ruleChanges, a vector of newly added parameters,
newParameters, and a backup copy of the original model,
appending the text "
(copy)" to the original model name.
Remove Rule Order Dependencies in SimBiology Model
Load a sample model.
Show the list of species and their initial amounts.
ans = SimBiology Species Array Index: Compartment: Name: Value: Units: 1 unnamed x 1 2 unnamed y1 900 3 unnamed y2 900 4 unnamed z 0
Add two initial assignment rules that can result in different outcomes depending on the order of the rules that appear in the model.
addrule(m1,'x = z','initialAssignment'); addrule(m1,'z = 100','initialAssignment');
Display the rules.
ans = SimBiology Rule Array Index: RuleType: Rule: 1 initialAssignment x = z 2 initialAssignment z = 100
Remove the rule order dependencies from the model.
tf is a boolean indicating whether the model was updated,
ruleChanges is a summary table of changes made to the rules, and
newParas is a vector of newly added parameter objects.
backup is the copy of the original (unchanged) model.
[tf,ruleChanges,newParas,backup] = updateInitialAssignments(m1)
tf = logical 1
ruleChanges=1×3 table UpdatedRule OldAssignment NewAssignment ___________________ _____________ _____________ 1x1 SimBiology.Rule "x = z" "x = z0"
newParas = SimBiology Parameter Array Index: Name: Value: Units: 1 z0 0
backup = SimBiology Model - lotka (copy) Model Components: Compartments: 1 Events: 0 Parameters: 3 Reactions: 3 Rules: 2 Species: 4 Observables: 0
In order to remove order dependencies, SimBiology updated the initial assignment expression
x = z to
x = z0, where
z0 is a newly added parameter.
tfUpdated — Whether model is updated
Whether the model is updated, returned as
ruleChanges — Table of changes made to rules
Table of changes made to initial assignment rules, returned as a table with one row per rule. The table contains the following columns.
|Vector of the updated rule objects in the model.|
|String vector of the original |
|String vector of the new |
newParameters — Newly added parameters
Newly added parameters, returned as a vector of Parameter objects that are referenced in the updated rules.
modelBackup — Backup copy of original model
Backup copy of the original model, returned as a model object.
Introduced in R2017b