Switching a species between an ode evaluation and a specified function (repeat assignments)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Jim Bosley
il 12 Mar 2018
Modificato: Jim Bosley
il 14 Mar 2018
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 Commenti
Risposta accettata
Arthur Goldsipe
il 12 Mar 2018
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 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Perform Sensitivity Analysis in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!