How to reference compartment value? (Volume)

2 ビュー (過去 30 日間)
Felix
Felix 2022 年 9 月 23 日
コメント済み: Jeremy Huard 2022 年 9 月 29 日
How do I reference the volume of a compartment in a mathematical expression?
For example, I can reference species "S" in compartment "C" via:
C.S
But none of these works to reference C's volume, even though they are the properties of compartments according to the documentation :
C
C.capacity
C.value
I can't seem to find an answer in the documentation.

採用された回答

Jeremy Huard
Jeremy Huard 2022 年 9 月 23 日
Hi Felix,
you can refer to the volume of a compartment by the name of the compartment in any expression: C in your case.
Here is a quick example:
modelObj = sbiomodel('model');
compObj = addcompartment(modelObj,'C',1,Units='liter');
addspecies(compObj,'S',0,Units='milligram/liter');
addparameter(modelObj,'ke',0,Units='1/hour');
addparameter(modelObj,'CL',2,Units='liter/hour');
addrule(modelObj,'ke = CL/C','initialAssignment');
reacObj = addreaction(modelObj,'C.S -> null');
kObj = addkineticlaw(reacObj,"MassAction");
kObj.ParameterVariableNames = {'ke'};
cs = getconfigset(modelObj);
cs.CompileOptions.UnitConversion = true;
modelObj.Rules
ans =
SimBiology Rule Array Index: RuleType: Rule: 1 initialAssignment ke = CL/C
Best regards,
Jérémy
  2 件のコメント
Felix
Felix 2022 年 9 月 23 日
It seems I can't reference the compartment volume as a stoichiometric coefficient in the model builder. Any idea how I can do that?
Since my original question has been answered I will accept this answer, thank you!
Jeremy Huard
Jeremy Huard 2022 年 9 月 29 日
Hi Felix,
stoichiometric coefficients must be numbers (double) and they can't be parametrized. Which means that a reaction like is fine but is not.
One way to achieve this woud be with a script that modifies the stoichiometric coefficient. For example:
modelObj = sbiomodel('cell');
compObj = addcompartment(modelObj,'Central',10,Units='liter');
reactionObj = addreaction(modelObj, '2 a + b -> c');
modelObj.Reactions
ans =
SimBiology Reaction Array Index: Reaction: 1 2 a + b -> c
reactionObj.Stoichiometry(2) = -compObj.Value;
modelObj.Reactions
ans =
SimBiology Reaction Array Index: Reaction: 1 2 a + 10 b -> c
I am curious about your use case though.
Can you tell me more about the what you are trying to achieve?
Best regards,
Jérémy

サインインしてコメントする。

その他の回答 (0 件)

コミュニティ

その他の回答  SimBiology コミュニティ

カテゴリ

Help Center および File ExchangeExtend Modeling Environment についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by