12
$\begingroup$

Wolfram's SystemModeler provides access to a large amount of components from the standard Modelica language, as is mentioned on this page. It can also be extended with Modelica libraries built by third parties, such as those listed here).

I wanted to ask about creating custom components using Modelica and importing these to SystemModeler.

Question:

Does SystemModeler provide a means to code in Modelica directly, or do custom components have to be created outside of SystemModeler?

$\endgroup$
1

3 Answers 3

13
$\begingroup$

SystemModeler does support creating and editing custom components, with tools for both writing directly in Modelica, as well as extensive graphical tools to create, edit and explore hierarchies and components.

To add to that, you can also use CreateSystemModel and ConnectSystemModelComponents in Mathematica (from 11.3) to create models from Wolfram Language.

Additionally, if you want to write text-based Modelica directly, you can use ImportString["modelica code here", "MO"] to create (or update) models from Wolfram Language.

$\endgroup$
5
$\begingroup$

I think that writing Modelica code and generating Modelica models is the basic and main purpose of SystemModeler, so yes, that is possible and it also provides support of building systems from building blocks graphically.

The problem is rather the opposite: every implementation of the Modelica language has developed its own peculiarities and extensions, so unless the author(s) have taken care to stick to the standard it not always is possible or trivial to transfer Modelica models optimized for one implementation to another. What any of the available implementations do support is the standard modelica library, AFAIK. You should check which version of Modelica the different environments do support, though.

$\endgroup$
3
  • 1
    $\begingroup$ I think calling the different tool implementations of Modelica "dialects" is a bit harsh. The general statement that there are many Modelica models out there not following the standard but still happening to work in one tool is certainly true though. $\endgroup$
    – Malte Lenz
    Mar 20, 2018 at 8:47
  • 1
    $\begingroup$ @MalteLenz: do you like that formulation better? I did not even realize that the former formulation could be considered "harsh" :-). I think if you take the point of view of a user the difference between a dialect and the possibility to use non-standard extensions in (almost?) every implementation is not as relevant as for someone who needs to convince a community that there is a standard and that it mostly is observed by the implementations... $\endgroup$ Mar 20, 2018 at 14:23
  • 1
    $\begingroup$ I understand the frustration users can encounter with non-standard models. In my mind a "dialect" is a stronger and more targeted diversion from a standard than what we are seeing in the Modelica world. It's mostly nitpicking though, I agree with your answer in general. $\endgroup$
    – Malte Lenz
    Mar 20, 2018 at 14:35
5
$\begingroup$

Yes you can write in "pure" Modelica by switching to the Modelica Text View.

Modelica Text View editing in Wolfram SystemModeler

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.