Modelica vs Simscape
Asked Answered
T

3

11

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

Traumatize answered 11/9, 2017 at 11:47 Comment(5)
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!?Cottrill
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.Traumatize
IMHO it is better to compare SimScape to Modelica language and SIMULINK to OpenModelica.Lastditch
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.Lastditch
@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.Taft
S
17

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.

Scalar answered 12/9, 2017 at 13:35 Comment(1)
I agree with you on this content, especially with the point of openness. I would choose Modelica over Simscape. In fact, last 5 months I have been responsible for transferring a physical model from Simscape to Modelica (I am using OpenModelica) as the two institutes in cooperation prefer different environments. In the most simplistic manner, academics don't really care much about Modelica as they happen to have Matlab license (at least they don't care the university pays a great deal of money for that). Therefore, I wanted to check if there are other technical advantages of Modelica.Traumatize
T
7

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.

Traumatize answered 13/9, 2017 at 7:21 Comment(3)
As one of the authors of the paper that you cite as a "study on its drawbacks" I can tell you that I am very much convinced of the advantages of FMI! The paper (published in 2014) describes some measures to improve the maturity of FMI implementing tools which are important for industrial usage. Many of these have been initiated within the FMI project and are effective in the meantime.Virtuoso
"Drawbacks" is the wrong choice of word, please pardon my English. I had no intention to bend or distort your words to support what I was trying to tell. I should have said, maybe, the problems one might have. As in Section 2.2 listed, there were certain problems by the time 3/2012. Although I am using FMI 2.0, I have experienced some problems which can be regarded as Type IV problem according to the paper. Other than that, I will edit what I have written in the answer to express myself more clear. I apologize again for drawing your attention in such manner.Traumatize
FMI import is now availabel in the official relesase of ML/SL 2017b, see de.mathworks.com/help/simulink/release-notes.htmlVirtuoso
N
6

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.

Noctambulous answered 2/11, 2017 at 10:43 Comment(2)
Tomas, Simscape is more than libraries, it's a language, and if you can develop a physiolibrary in Modelica language, you can just as easily develop a physiolibrary in Simscape language. You are free to use an electrical analogy if it suits you---and it may give you a quick simple model to get some preliminary results---but you can most definitely develop a super detailed physio library in Simscape.Phil
Sure, one can develop such library for Simscape. But we chose Modelica for multiple reasons. However, it's valuable for any user to compare competing languages. One may prefer Simscape with (per my quick research) lower number of libraries, but professionally supported and integrated into the whole product ecosystem of Mathworks. Another may prefer Modelica with large number of close source or opensource libraries provided by different producers. There is also other aspects like community preference, licence price, professional service available etc.Noctambulous

© 2022 - 2024 — McMap. All rights reserved.