Simulation and Simulation Programming Language

I work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of these models have been converted to C ++, but the current trend is to create these models using MATLAB / SIMULINK. From the point of view of computer science, I always felt that MATLAB / SIMULINK was not a good solution. What language do you use to create models and simulations and why?

+4
source share
6 answers

I also work with a lot of legacy codes, most of them in Fortran. I really don't mind using Fortran - all modern compilers allow variable names more than the old and silly 6 character restrictions. In addition, with Fortran 95, you can even do OOP if you feel that your changes to the existing code base will be useful.

In addition, Fortran has very good code editors, which is not always the case for more specialized script languages.

C ++ has a big flaw in memory considerations. I have been programming C / C ++ for another 20 years, and I still forget to delete objects and populate destructors correctly.

In conclusion, if you use Windows, there is a Fortran.NET compiler (I think from Lahey-Fujitsu?) If you want to move Fortran to a managed environment.

Good luck

+4
source

I always tried to use the language provided by the best modeling and modeling tool (or library, if you want) to do the job for me.

And this question can only be answered, taking into account which models you want to implement. Continuous (e.g. ODE), discrete (e.g. StateCharts, Petri Nets), or a combination (e.g. a hybrid model that can be implemented using Simulink + StateFlow)? There are various tools for each type of model.

Another important aspect is the domain in which you work. Simulink has quite extensive libraries for electrical engineering, finance or computational biology (most of them are included in additional packages) - if you work in one of these fields, there may simply not be a better (that is, complete, reliable) library of components. applies to other commercial modeling packages such as AnyLogic , Arena , etc. Depending on your modeling problem, there may be some open source modeling tools.

Finally, you may prefer a particular programming language over another, and you may have additional requirements, for example. support

  • Optimization (model parameters)
  • Check
  • Output analysis (statistics, graphs, statistical tests)
  • Support for parallel and distributed modeling
  • Model check
  • ...

So, I'm currently working with Java with well-known advantages - fast enough, good multithreading support, relatively easy to use, etc. But if "fast enough" is not fast enough, but going down one level of abstraction :-)

+7
source

SIMULA, of course !:-)

+4
source

What I got from MATLAB is the ability to let me quickly prototype the algorithm. I can really get a good idea of ​​the data by building it and using the built-in statistics functions. When you try something new, I can do something quickly and dirty to get the initial results, and then go back and clean things up to improve my results. With compiled languages, I have much more to do to run the simulation. With MATLAB, I spend more time thinking about the real problem and less about compiling, linking, managing memory, etc.

However, there are many problems that MATLAB is simply not able to solve. For large datasets, a compiled language with certain data structures is almost certainly needed.

+2
source

Particle physics has moved to C ++ and python. This is not universal and probably would not even be close if not for the ubiquity of the ROOT .

The root use of cint means you need to worry about memory management when you think about a new idea, its ability to compile allows you to have speed, it is very useful to combine modes, and bindings for python and other RAD languages ​​provide more flexibility.

In a very real sense, it comes down to the approval of the roland point .

+1
source

you can use s-funcuin block to bind fortran (c, C ++) to matlab.

0
source

Source: https://habr.com/ru/post/1285686/


All Articles