REPLY Open Source Simulation Software for SD (SD6786)

SDMAIL Bill Harris bill_harris at facilitatedsystems.com
Thu Mar 6 06:19:43 CST 2008


Posted by  Bill Harris <bill_harris at facilitatedsystems.com>

Stefano,

I think I've mentioned it here before, but, in case I haven't, I've been
using MCSim, a GPL'd simulator, for I think about (actually, almost
exactly) 3 years now.  It comes from the PBPK (physiologically-based
pharmacokinetic) world, so it may look a bit different, but it does the
same thing.  You can find some information at
http://facilitatedsystems.com/links.html#sd; you can also find MCSim on
Savannah.

It doesn't solve all the problems you mention.  For example, few would
probably call its files universal exchange formats (Anastassios
Perdicoulis was once driving an XML effort; I don't know its current
status), but they are in easy-to-read text.  MCSim doesn't sort
equations into the proper order, but I've found that less of a problem
than I imagined.  It doesn't really have any discrete functions,
although you can program pretty much whatever you can figure out how to
program.

Is it a good solution?  I think so.  I find it helps me think better
about problems, for reasons I documented in a talk I gave on it in 2006,
and I have the impression that it helps me go faster overall.  While we
know Euler integration is usually good enough, at least if you set DT or
TIME STEP appropriately, I find it nice not to have to worry about that
anymore except in quite rare instances (then again, I like driving cars
with manual transmission -- go figure).

Perhaps the biggest benefit is that it separates the processes of
problem definition, problem modeling, design of experiments, analysis,
and communication more than the other tools I've used.  I find that
helps me, for I find that those phases require different types of
thinking, and I find benefit in being able to concentrate on one or the
other at a time.

http://www.facilitatedsystems.com/weblog/2007/01/scientific-thinking-modern-way.html
explains further the "Aha!" that made me think more seriously about
MCSim.  I think I did a factorial experiment with my very first MCSim
model without even thinking about it, and then I sat back in amazement:
why hadn't I been doing that all along in cases where it was
appropriate?

You can see a simple example of a model done with MCSim at
http://www.adaptistration.com/adaptistration/2007/04/tafto-2007-co-5.html.

Is it for everybody?  Probably not.  When I use MCSim, I create the
models (which look a bit like C code) in my favorite text editor (Emacs,
if it matters), I compile them using gcc, and I analyze the output using
J or perhaps gnuplot.  I typically use Dia to create accompanying
diagrams (after starting with that other CAD [carbon-assisted drawing]
tool: the mechanical pencil and paper).  Others could, of course, use
different tools, but J offers a few benefits that have really helped,
and the MCSim manual is integrated with Emacs.

Tabular nonlinearities seem particularly arcane to the newcomer (as if J
doesn't :-), as you can see in the reference card I've posted at that
first link.  Once you've done a few, they're not so bad, and they offer
more flexibility than I think I've found in commercial tools, at the
expense of having to learn some of the GSL (GNU Scientific Library).

Does it replace the commercial alternatives?  Unlikely.  I still use
others from time to time (I'm teaching a graduate course in which we're
using Vensim, and I'm enjoying that immensely).  If you like GUIs, you
won't like MCSim (unless you also like writing GUIs, but I find working
in text helpful).  If you like creating animated learning environments,
you won't like MCSim.  If you like integrated environments, you won't
like MCSim.  There are lots of reasons to stick with Vensim, ithink,
Powersim, or the like.  

You can find a bit more by searching for MCSim on my blog
(http://www.facilitatedsystems.com/weblog/).  I've been toying with
offering a course in the use of MCSim for system dynamics, but I'm not
sure if there would be enough interest.  I am open to feedback on that
question.

> > Is it for everybody?  Probably not.  

Stefano,

One other GPL fact of life to mention: sharing MCSim models comes with
certain constraints.  While I can send you the model itself (the text
files) under any restrictions (or lack of restrictions) I wish, I can't
do the same with the compiled executable.  That executable is linked
with GPL'd components (MCSim itself plus GSL and perhaps other bits),
and so my executable models automatically fall under the GPL.  That's
not a bad thing: I don't /have/ to distribute the executable, and the
claims of the GPL only apply to distributed code.

If I were to distribute (i.e., send you) a compiled model executable,
then I would have to make available all the associated GPL'd source,
which includes at a minimum MCSim and GSL source.  That's a big enough
task so that I'd likely tell you how to install MCSim on your system
instead.  It should work on anything with gcc and GSL, so Windows, OS X,
Linux, and perhaps many others should do just fine -- it's the typical
configure, make, make install process.


One final thought, if you don't want something as full-featured as
MCSim: about 4 years ago, Pegasus published my "System Dynamics on a
Shoestring," which walks through the process to use Paul Fishwick's
SimPack, another GPL'd simulator, for SD work.  If you put SimPack
together with a C compiler (cygwin provides gcc on Windows, and gcc is
likely automatically a part of OS X and your favorite Linux distro) and
your favorite graphing program (Gnuplot is good, easy, free, and cross
platform), you have another complete solution that's pretty easy to use.

SimPack handles both Euler and RK integration.  The source to the entire
simulator fits on one piece of paper, as I recall, which is a reminder
how simple the fundamental technology is that underlies our art
(admittedly the major commercial offerings provide a /lot/ more in the
way of features).  You'll still have to sort your equations and code
your own table functions, but that's not too hard, and table functions
don't look as complex in SimPack's C as they do in MCSim, even though it
is -- or can be -- really the same thing.

You can find the link at
<http://www.thesystemsthinker.com/nldatafolder/detail.asp?ItemID=590>.

Does anyone else here use MCSim or SimPack?  (I confess that I probably
haven't used SimPack since shortly after writing the article.)  Does
anyone have any other GPL'd or FLOSS alternatives?

Bill
- -- 
Bill Harris  
Posted by  Bill Harris <bill_harris at facilitatedsystems.com>
posting date  Wed, 05 Mar 2008 08:42:42 -0800


More information about the SDMail mailing list