Could Simbiology simulations have a preload function?

1 view (last 30 days)
Jim Bosley
Jim Bosley on 16 Aug 2018
Edited: Jim Bosley on 17 Aug 2018
In Simulink, one can write preload scripts that run upon opening a model or upon any number of other actions.
In Simbiology we have the option to have many tasks associated with a model, but (to my knowledge) we do not have preload functions. We DO have variants that we can apply to a Simulation, but Variants cannot turn rules on or off.
This is a huge gap. If I have a model that I run under two scenarios (for example, autonomous/ODE-calculated blood sugar, and blood sugar that is forced to follow a dataset, perhaps using splines) and those two scenarios are determined by rules (either the ODE rule is active and the forced rule is inactive, or vice versa), and I want to compare runs under both scenarios, I have to manually switch the flags on the model. And if I forget, the model results are wrong - with no error flag.
I'd very much like to see either Variants have control over rules being active AND/OR simulation tasks having a preload function (a postload wouldn't be bad either, to allow plotting of values calculated outside of the model).
Any plans for these functions? Or are they in the app, and I'm just missing them.

Answers (1)

Arthur Goldsipe
Arthur Goldsipe on 17 Aug 2018
Edited: Arthur Goldsipe on 17 Aug 2018
Hi Jim,
You're not overlooking any functionality. I agree that these would be useful enhancements. I work primarily from functions and scripts at the command line. I had the same challenges remembering to activate and deactivate rules when running different scenarios for the insulin demo I created.
Rest assured that this is on the team's radar. I don't know how soon you will see a solution though. Would you consider this one of the highest priorities for you? Or are there other things you can think of that would be a higher priority?
  1 Comment
Jim Bosley
Jim Bosley on 17 Aug 2018
Thanks for your response. To answer your question...
Right now, Simbiology is touted as having a Dashboard interface for direct user interaction. Also, one has the power of Matlab scripting that can be used to manipulate and exercise the model.
Obviously, if one is scripting stuff, one can include a call to any preload function one wants. You pointed out that this is the mode you use, and I do, too, mostly.
But I occasionally want to run the model manually to do a quick check. If one is using the dashboard, and calls up a simulation task and runs it, there is a big danger that some of the key modeling elements are not set as the user intended. And there's no warning or indication that this is so. So your modeling task may say "Forced Glucose" and the results are "ODE Glucose", or vice versa. In a big model, one might have to check dozens of rules before any manual simulation.
There's a reason that Simulink has all those preload and postload functions! Quite useful, especially if I.C.s depend upon parameters that vary (for example, if you want a species initial condition to be the steady-state value, and you are varying the first-order clearance term).
To sum this up, I'd say that yes, preloads would be one of my "most desirable" feature adds. I'd also like to see the rule active/inactive state be settable in variants.
Hope this helps. As always, thanks for your useful, cogent response to my question.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!