Switching a species between an ode evaluation and a specified function (repeat assignments)
1 次查看(过去 30 天)
显示 更早的评论
Most of the models in Simbiology will be based upon interacting ODEs. Insulin and glucose, in diabetes models, for example. Insulin affects glucose disposal, and glucose stimulates insulin secretion. In creating, debugging, and fitting such models it is often convenient to "break the loop" and force one of the states to follow a function (of time, for example), to accurately check and calibrate the other system(s). So, one might start by creating the ode model structure in which glucose and insulin are determined by a dynamic mass-balance and rate laws (that is, ODEs). But in some scenarios, it would useful to "switch" the model so that insulin or glucose could be specified as a function over time.
One way to do this would be to create a node that is specified by repeat assignment using a function. In the diabetes example, this would be "functional_glucose". The actual ODE node would be "ode_glucose". One could have a parameter "glucose_switch" that the user would specify (0 for ODE, 1 for functional form). And then, in every rate law that uses glucose, you'd have glucose_switch*functional_glucose + (1-glucose_switch)* ode_glucose. In big models, this would be rather convoluted.
Alternately, you can hook up a repeat assignment rule to the ODE species directly. This avoids extra nodes, and works as long as the "boundary value" box is checked. This is certainly a cleaner way to do this. But if one unchecks the box and runs a simulation, there is an "overspecified model" error thrown because the system is trying to solve the node as an ode, and the repeat assignment rule is fighting the integrator. One could disconnect the repeat assignment rule and uncheck the boundary value box. Is this combination (repeat assignment/boundary value for functional form, and disconnect the assignment rule and uncheck the box for ODE) the best way to have both the ODE and functional form in the model?
In reality, I suspect one would write scripts to hook up the functional form, or to disconnect and let the ODE solver work.
0 个评论
采纳的回答
Arthur Goldsipe
2018-3-12
Hi,
I would take the approach of adding a repeated assignment rule and setting the BoundaryCondition property to true. In some cases, you might just be able to switch between 2 different repeated assignment rules. That's what I did in the following example: Simulating the Glucose-Insulin Response
-Arthur
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Perform Sensitivity Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!