Saturday, March 08, 2008

C++SIM/JavaSim

Back in 1990 my friend Dan McCue and I were doing work on replica management and a way to compute the optimum number and location of replicas to achieve a desired level of availability. (Yes, availability is not necessarily proportional to the number of replicas.) We needed to do some simulation work and started out with Simula, which is a nice language but which neither of us had much experience at the time. Both of us were (are?) C++ die-hards, so we decided that the best way would be to build out own simulation toolkit in C++, and C++SIM was born.

C++SIM was very successful for us (thanks to Isi for helping with some of the statistical functions). It has been used in a number of academic and industrial settings. It was probably one of the early open source offerings too, since it was made freely available by the University. I learnt a lot from developing it, not least of which was multi-threaded programming: this was the age before the general availability of thread-aware languages and operating systems. Sun's Lightweight Process package in SunOS had been around for a few years and Posix Threads was still in its infancy. But when you want to run simulations on different operating systems, it was impossible to target the same thread package. So I wrote a thread abstraction layer for C++SIM, as well as a couple of threading packages (ah, setjmp/longjmp were my best friends back then).

In 1996 I ported C++SIM to Java, and JavaSim was born (I've never been that good with sexy names!) Because of the massive adoption around Java, JavaSim saw more uptake than C++SIM. It was also easier to implement and maintain than C++SIM. Again, over the intervening years it's had a lot of use and I'm still getting feedback from people asking for updates or just reporting how they are using it (them).

Now the problem was that their current homes were limiting. The source code repository changed several times and I didn't have direct access to maintain it. The web site was also outside of my control once I left the University. So I finally got agreement from them to move it outside and change the licence to something a bit more modern. I've been working on this shift for about 9 months (though it's really only taken me a couple of weeks to do), but JavaSim/C++SIM now have a new home in Codehaus. The move isn't quite complete (I still need to find the source for the docs), but it's a start.

15 comments:

Anonymous said...

Hi Mark,

first of all, let me thank you for the great Job with C++Sim and JavaSim.

I'm working on a paper which has a section on a simulation study based on Javasim and I'd like to include a reference in bibliography to the JavaSim framework.

Is there any paper in particular I could cite?

Paolo

Mark Little said...

Hi Paolo. Thanks for the feedback. Probably the reference you want is:

Construction and Use of a Simulation Package in C++
Little, M.C. and McCue, D.L.
C User's Journal Vol. 12, Issue 3,
CMP Media/Miller Freeman Inc., 1994 ISSN 1075-2838

Hope that helps.

Anonymous said...

Thank you!

Merry Xmas!!

Filipi Vianna said...

Hi Mark,

I had just graduated in Control and Automation Engineering and my undergraduate work was a web based application to create simulation models using JavaSim.

The Application I wrote generates the classes that use the arjuna classes.

There is any plan for a new JavaSim release?

My application is on-line at
http://www.em.pucrs.br/~filipi/websim

I would like to exchange some ideas on simulation and JavaSim, my personal e-mail is fvianna@gmail.com.

Regards,
Filipi Vianna

Mark Little said...

Hi Filipi. Yes, there are plans to produce an updated version of JavaSim. That was one of the reasons it was moved to Codehaus. If you're interested in getting involved, why not join the JavaSim community?

Neill said...

Hi Mark,
A very interesting article, I came accross JavaSim whilst researching for a paper about open source discrete event simulaiton packages. Could you comment on whether JavaSim is still in development and if there are any other resources/forums I could take some learnings from.

Mark Little said...

Hi Neill. The Codehaus project is where everything happens now. If you're interested in helping to develop it then you could always become a contributor.

Anonymous said...

Hi Mark
The SIM framework you developed is still great, even all these years later. It's got a great, logical implementation. Are there any examples that use the histogram (or stats recording objects?) I'm a bit unclear where to add them in the example for starters (I'm using the JavaSim version). Any brief hints or pointers much appreciated. Thanks again - the framework is great because IMHO it balances the functionality with the complexity. Some of the other frameworks are over the top, this one's just right - on a par with SimPy, but of course in Java which makes it easier for us old-skool coders to manager.
Pete

ipek said...

Hello

I am using JavaSim in my PhD thesis and I find it quite easy to use, thanks for it.

At the moment I have a problem while resetting my simulation to enable the multiple runs for further analysis. I am working on it for a while and still could not solve. I have already checked the example in the users guide but I will be glad if you can provide some additional information/ example for me.

Anonymous said...

I would also like to know if it's actually possible at all to reset JavaSim for simulation replications... I've been unable to find any examples or usable documentation and after fighting with it for a long time I'm starting to think that it's fundamentally broken and I'm just wasting my time...

Mark Little said...

@anonymous why not raise an issue request on the github site https://github.com/nmcl/JavaSim and I'll take a look?

Anonymous said...

A simple (the simplest possible) working code example of how to reset the scheduler and how to run simulation loops with a simple model of one source generating jobs to one queue, and one or more servers taking jobs from the queue would be enough.

Can at least this be added to JavaSim examples? The MachineShop example is not enough and the documentation is not clear enough to figure out how to implement this correctly.

Mark Little said...

As I said in an earlier comment, please raise a github issue.

https://github.com/nmcl/JavaSim/issues

Abed MAATALLA said...

Hello,

I was trying for last days to understand more about how javasim works and how to use it on custom code.

But I didn't find much documentation. send me documentation or contact me to talk about it in hangout or something.
abedmaatalla@gmail.com

Mark Little said...

This is a really old posting. Anyone interested in C++SIM or JavaSim updates, docs, issues etc. should raise an issue on github.