Clear Filters
Clear Filters

Simbiology in app model simulation

3 views (last 30 days)
Hello team and community,
I am currently working on a pharmacokinetic project that involves using a transit compartment model (DOI: 10.1007/s10928-007-9066-0) to describe drug absorption.
I have constructed the model using the Simbiology app and have written a script for a specific function usede in the model (attached in the files).
For the solver type, I have selected Sundials.
However, I have encountered some strange results when carrying out simulations using the in-app model simulation functionality.
I noticed that when I set the stop time from 1 to 7 hours, the simulation results appear to be fine.
However, when I set the stop time to 8 hours or above, the simulation results show some unexpected behavior that I cannot comprehend.
[stop time = 7 hour]
[stop time = 8 hour]
[stop time = 48 hour]
I would greatly appreciate it if you could provide me with some insights into this problem.
Thank you very much.
Jesse

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 12 Jul 2023
I think the problem comes down to the way that calculate_KTC depends on time. This function has a maximum around a time of 1. If you are not careful with the solver options, the initial time steps result in a KTC that is so small that the solver might take a large time step that overshoots the large values in KTC and instead once again results in KTC values that are very small. So the solver never steps through a time range where KTC is large enough to cause a significant change.
There are several solver options you could change to fix this. But for this specific situation I would probably set MaxStep to something like 0.1 or 1. The exact value probably doesn't matter too much, but I wanted to pick something that would ensure the solver steps to to a time where KTC is significantly large. As with many of these solver options, you should be caeful not to set it to too extreme of a value. If you constrain the solver too much, simulations may take much longer than necessary. But if you don't constrain the solver enough, your results will be inaccurate. So in general you may need to use a bit of trial and error.
I also want to point you to a couple of other resources that can be useful when you have simulation errors:
-Arthur (he/him/his)
  1 Comment
Jesse Chao
Jesse Chao on 15 Jul 2023
Hello Arthur,
Thank you for your response and all the other resources!
It is just as you said. I genuinely appreciate your clear explanation.
Have a great day!
Jesse

Sign in to comment.

More Answers (0)

Communities

More Answers in the  SimBiology Community

Categories

Find more on Scan Parameter Ranges in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!