10
votes

This question has two main aspects actually. Right at the beginning, I have to admit that I am totally new to physical modeling and would be glad to be corrected as well, not only be answered. For those who find it too long to read, I can give a brief summary:

1) Simulink vs Modelica

2) Simscape vs Modelica

1) The first one is the comparison of modeling approaches. Conventionally, there are different names for the two main approaches I want to compare:

# Signal flow approach / block-based modeling / causal modeling ...: The typical models in Simulink. There are boxes with inputs and outputs and transfer functions in between.

vs

# Network Approach / component-based modeling / acausal(noncausal) modeling... : There are physical ports instead of signal I/O and the flow entities(current, heat etc) can flow in both directions.

In this comparison, I have read some opinions in the web and searched for some papers. It comes down to the comparison of Modelica based development environments and Simulink (for example), as far as I get. Disadvantages and advantages of these two are more clear to me than the other point I want to ask.

2) After reading much on the first comparison, it was more preferable for me to go with component-based modeling. However, Modelica isn't the only option here. There is also Simscape, using which you can combine physical ports (as in Modelica) with block-based modeling of Simulink.

I would like to know the advantages and disadvantages of this Simscape vs Modelica comparison. To avoid misunderstanding, I need to underline that Modelica is a language. Therefore, it would be more meaningful to compare any Modelica environment with Simscape, let's say, OpenModelica vs Simscape

3
What is the domain you are interested in? Mechanical, electrical, chemical? Physiology? Have you read the publications listed here: physiolibrary.org Maybe they did comment on the advantages/disadvatages of different modelling approaches!?matth
I am mostly interested in physiology and electrical. Not in that list but this paper, which I also added to the question, is from the creator of Physiolibrary. But it is mostly about my first question comparing causal-acausal approaches.Falsterbo
IMHO it is better to compare SimScape to Modelica language and SIMULINK to OpenModelica.Foad
the difference between causal visual programing environments like SIMULINK and LabVIEW and noncausal languages/environments line Modelica and SimScape, is comparable to the difference between imperative/scripting programing languages like python and compiled languages like C++. The former suffer from the same issues when a system of nonlinear algebraic and differential equations need to be implemented. They can't handle bi-directional non-causal relations.Foad
@Foad : If compared to programming langages, I would propose : imperative vs declarative languages. Non-causal modeling relies on simply declaring sets of equations, while causal modeling needs to describe a procedure to simulate the system. Acausal is compositionnal while causal is not.JCLL

3 Answers

16
votes

Well, since nobody seems to be answering this, I will take a shot at it.

It seems that you seem to have figured out the question to your first question. The basic answer is that causal modeling involves lots of upfront work by you that could otherwise be done by the compiler. Even worse, if you ever want to support different causalities, you need to either re-implement your component and/or have multiple versions supporting different causalities. Modeling complex physics that mix continuous and discrete behavior is tricky enough without having to do all this tedious, time-consuming and error prone work sorting out the causalities.

So that brings me to your second question of SimScape vs. Modelica. SimScape seems to be a recognition of the issues I mentioned in the previous paragraph. Honestly, it will be difficult for a third party to provide you with an analysis of SimScape vs. Modelica since so much depends on factors that may be different for you vs. other people.

Furthermore, I really haven't used SimScape much so I cannot really comment on so much there. But I can certainly tell you Modelica's strength. Modelica was developed by a design group composed in approximately equal parts of developers, users and academics. I think this is actually its great hidden strength of Modelica. As such, new features had to have support from all groups to be successful. Too much influence by one group is, in my opinion, detrimental.

The openness of Modelica means you can get Modelica support from lots of different tools (free and commercial). This, in turn, means that there are lots of different libraries out there. This openness is not just about the specification itself but about the eco-system (open tools, open libraries, etc).

Finally, the proof is really seeing all the various types of problems people are solving. Modelica is used in a wide range of engineering domains to solve really diverse problems. This is, in my opinion, a testament to the soundness of the design of the language and libraries. That success is not the result of lots of marketing dollars but rather a consequence of the fact that the technology is fundamentally powerful and that people around the world have recognized this and used it to solve real world problems...over and over again.

I would encourage you to look through the papers from past Modelica conferences. Every paper is available, for free, online at modelica.org.

Shameless plug: if you want to learn Modelica via examples from a wide range of engineering disciplines, you might want to check out the free, interactive and online book Modelica by Example.

5
votes

For this comparison, a clash point can be FMI Import/Export ability.

Functional Mock-Up Interface is a very promising solution for model transfer and sharing between different modeling environments. Extracted functional mock-up units (FMUs) can be imported into another environment or can be numerically simulated using third party tools.

Most of the Modelica platforms offer adequate FMI Import/Export functionality. I can, at least, say for OpenModelica, JModelica.org and MapleSim. For further information of availability, please see here.

How supportive is Matlab/Simulink? They are said to offer this availability but there is no official package one can download from MathWorks. There are third party packages like FMI Toolbox and FMI Target for Simulink Coder but they seem to be commercial. I tried demo version of Modelon's package, FMI Toolbox, but using demo version one can only work on models given with the demo version.

There is actually another official FMI package for Simulink according to this link. I reached and asked them if I can have a look and try it for a research project (no lie, it was a research project). The tool can only be acquired by emailing with the team mentioned in the link and there is only the function of FMI Import (no Export). Simulink being a commercial tool doesn't want to let models flee to the other environments. Important note, as can be seen in the comments, this package can now be found in the offical release of Simulink R2017b which was released on 20.09.2017.

In general, Modelica platforms are much more supportive for FMI which can solve a great deal of problem in the future. Although I should explicitly say that I haven't had great experiences using FMI for solving my models so far. It is sometimes extremely slow and there are discrepancies between the results of OpenModelica and the solution using FMU extracted from the same model. The solver options are limited for Model Exchange. As for the Co-Simulation, maybe I did something wrong. However, it is a very promising tool requiring improvements, in my humble opinion.

A study on the problems FMI standard used to have in 2012 can be found here. Following release of FMI 2.0, most of these problems are said to be solved. I thank here Christian Bertsch for correcting me on the possibly misdirecting information I posted. In general, FMI is a great tool becoming much more important in the industry. Its advantages and the tools supporting FMI can be found in its website.

3
votes

My personal experience as co-author of Physiolobrary and currently Physiolibrary.models.

  1. In our group we concluded that combination of acausal and signal oriented approaches are appropriate in Modelica. Acausal approach is appropriate for combining components modeling basic physical laws of a modeled system - such components are more reusable. Signal approach is appropriate to add proprietary components to the modeled system where causality is known or hypothesized (controling heart rate etc.) We discussed details at https://doi.org/10.1016/j.compbiomed.2014.08.025 or recently at https://doi.org/10.1016/j.bbe.2017.08.001

  2. One disadvantage in Simscape is libraries, or lack of it. To model e.g. cardiovascular system, you may need to use analogy of electrical circuit. While this simplification is usually accepted in research or industry you may loose preciseness and increase probability of errors. This was problem in Modelica too until third party library Physiolibrary is available.

  3. However, it's much easier to reproduce (reimplement) Simscape model in Modelica as we did e.g. within paper http://mj.mefanet.cz/mj-04140914 than any block oriented model - doesn't matter if in Modelica or Simulink.