I work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of those models have been converted to C++, but the current trend is to create these models using MATLAB/SIMULINK. From a computer science perspective I have always felt MATLAB/SIMULINK was not a good solution. What language do you use to create models and simulations and why?
I also work with a lot of legacy code, most of it in Fortran. I really don't mind using Fortran - all the modern compilers allow variable names greater than the old and silly 6 character limit. Also, with Fortran 95, you can even do OOP if you feel that your modifications to the existing codebase would benefit.
Also, there are very good code editors for Fortran, which isn't always the case for more specialized script languages.
C++ has the great disadvantage of memory considerations. I have been programming C/C++ for 20+ years now, and I still forget to delete objects and properly fill in destructors.
On a final note, if you're using Windows, there is a Fortran.NET compiler (I think from Lahey-Fujitsu?) if you want to move your Fortran to a managed environment.
Good luck!
I would always try to use the language that is provided by the best modeling and simulation tool (or library, if you like) to do the job for me.
And this question can really only be answered by taking into account what kinds of models you want to implement. Continuous (e.g. ODEs), discrete (e.g. StateCharts, Petri Nets), or a combination (i.e. a hybrid model, as can be implemented with Simulink+StateFlow)? There are various tools for each kind of model.
Another important aspect would be the domain in which you are working. Simulink has pretty extensive libraries for electrical engineering, finance, or computational biology (most of them are included in additional packages, though) - if you work in one of those fields, there might simply be no better (i.e. complete, valid) component library. The same goes for other commercial simulation packages, such as AnyLogic, Arena, etc. There might also be some open-source simulation tools, depending on your modeling problem.
Finally, you might prefer a specific programming language over another, and you might have additional requirements, e.g. support for
- Optimization (of model parameters)
- Validation
- Output analysis (statistics, plots, statistical tests)
- Support for parallel and distributed simulation
- Model checking
- ...
So I'm currently working with Java with the well-known advantages - reasonably fast, good support for multi-threading, relatively simple to use etc. But if 'reasonably fast' is not fast enough, there might be no option but going down one level of abstraction :-)
Particle physics has been moving to C++ and python. This is not universal, and probably wouldn't even be close were it not for the ubiquity of ROOT.
Root's use of cint means you needed bother with memory management when you're dinking around with a new idea, it's capacity to run compiled allows you to have speed, the ability to mix the modes is very helpful, and the bindings for python and other RAD languages allow for great flexibility.
In a very real sense, this comes down to an endorsement of roland's point.
What I've gotten out of MATLAB is it's ability to let me quickly prototype an algorithm. I can really get a good feel for the data by plotting it and using the built in statistics functions. When trying something new out, I can do something quick and dirty to get some initial results, then go back and clean things up to refine my results. With compiled languages, there's a lot more I have to do just to get the simulation to run. With MATLAB, I spend more time thinking about the real problem, and less about compiling, linking, memory management, etc.
However, there are many problems that MATLAB is just ill-equipped to solve. For large data sets, a compiled language with user defined data structures is almost certainly necessary.
Hi,I find one free to download book about Modeling and simulation, maybe I can help you? This book collects original and innovative research studies concerning modeling and simulation of physical systems in a very wide range of applications, encompassing micro-electric-mechanical systems, measurement instrumentation, catalytic reactors, bio mechanical applications, biological and chemical sensors, magneto-sensitive materials, silicon photonic devices, electronic devices, optical fibers, electro-microfluidic systems, composite materials, fuel cells, indoor air-conditioning systems, active magnetic levitation systems and more. You can find it here: http://www.intechopen.com/books/show/title/modelling_and_simulation