Reaction continues even after the concentration is below zero in Simbiology

4 次查看(过去 30 天)
Hello,
I am trying to simulate a simple reaction model in Simbiology but met a problem that the system would let concentration reach negative.
As reagent (A) is consumed in the reaction, its concentration would decrease with time, however with enough time, Simbiology would let this concentration go negative. Is there a way that reaction could be stopped after all reagent is used up? In anothoer word, once A=0 the reaction won't go beyond from that point as time continues (all the reagent and product will reach balance and not change any more).
The idea is similar to add an "if (A<=0) A=0" judgement but I do not know how to do it in simbiology. I tried to add "A=max(A,0)" in repeated assignment but it won't work. Thinking about event trigger too but it seems Event could only work at the first time of triggering.
Thank you in advance

采纳的回答

Arthur Goldsipe
Arthur Goldsipe 2022-5-2
I answered a similar question here. As I mention there, there's currently no way to completely prevent negative numbers in all cases. But it's generally safe to ignore small negative values small (relative to your specified solver tolerances). If the magnitude of the negative numbers is large, it could indicate a modeling error and/or a problem with solver tolerances. If you see such negative numbers, you should try to understand what is causing them and make an appropriate change to your model. If there is some sort of feedback that causes negative numbers to get mangified, you may need to modify the expression for the reaction rate. For example, if X is a species that is negative, you might want to replace occurences of X in rate expression with max(0,X). I would recommend this over trying to use an event or repeated assignment rule.
  3 个评论
W Y
W Y 2022-5-3
编辑:W Y 2022-5-3
Thanks Arthur! I have read that link before posting this question and understood it was about the tolerance to deal with a tiny calculated amount less than 0. For my question, your suggestion regarding editing the rate expression is very helpful. Now the model is working.

请先登录,再进行评论。

更多回答(2 个)

Achal Mahajan
Achal Mahajan 2022-5-2
Hi,
This post might be useful https://www.mathworks.com/matlabcentral/answers/78266-non-negative-values-for-species-in-simbiology. The same problem has been discussed in detail. Feel free to reach out again if it does not work for you!
  1 个评论
W Y
W Y 2022-5-3
Thank you for your timely reply. Before I posted this question, I have read that post seveal times. It mainly deals with the problem when there is a calculation result close to Zero (tiny amount less than 0). In that case, we can set tolerances to let the program know when that should be treated as Zero, which is not my question here. The other solution solves the problem but I really appreacite your input.

请先登录,再进行评论。


Torsten
Torsten 2022-5-2
If the reaction rate of A is proportional to A (as it should be), you usually don't get problems with negative concentrations.

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Extend Modeling Environment 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by