Live data from Hacker News

All about Modelica: An equation-based language for modeling physical systems

marcobonvini.com

41–47 of 47 posts

Re: All about Modelica: An equation-based language for modeling physical systems

#41
post #17

There's a project to create a language similar to Modelica as a DSL in Julia, Modia[1]. I'm not currently a user of either language, but saw a presentation at JuliaCon about it[2] and thought it looked interesting. [1] https://github.com/ModiaSim/Modia.jl [2] https://youtu.be/hVg1eL1Qkws

FYI, it is by the same people who initiated the Modelica effort (Hilding Elmqvist and Martin Otter). I think part of the goal was to shed having to maintain a whole language (and the need to specify all the semantics details of such) and simply leverage a language that had macros.

I haven't really heard many updates on this in some time. I don't think it is necessarily a bad idea. But any effort along these lines takes a lot of dedicated people quite a while to make progress (as was the case with Modelica).

Re: All about Modelica: An equation-based language for modeling physical systems

#42

I have been used modelica and modelica-like languages for the past few months, and I have completely been blown away by the experience. I think the solvers are fantastic and produce better results, in terms of speed and scale, than any other method I had used previously, I was solving the DEs using either wolfram or Julia's Differential equations. OpenModelica is a wonderful piece of software, I just wish it had a be…

The secret to Modelica's results here isn't the numerics but the symbolics: they always preprocess the equations to something much simpler to simulate. With Julia we have the https://github.com/SciML/ModelingToolkit.jl to bring the same kind of symbolic-numerics approaches to practice.

Chris, I agree that the symbolic processing is quite important. I've often made the argument that a purely numerical approach just can't compete because of the optimizations and insights that come out of the symbolic analysis will always put it on a better footing (curious to know if you agree). But I'd say another factor in the success of Modelica is the ability to make it approachable by non-programmers. All the graphical aspects, acausal semantics, etc. make it easy to understand for non-programmer engineers as well. This has nothing to do with the results, per se, but is I think a factor in its success.

Re: All about Modelica: An equation-based language for modeling physical systems

#43

a quick intro for programmers - Modelica is basically the equivalent of Haskell for engineers - the compiler does most of the work for you and produces highly performant code. You can compose a very complex system from individually modeled elements. The Modelica compiler will check constraints and basically come up with a system of equations. If it compiles, it is probably correct. The model wont compile if a particu…

That's an interesting way of framing it. I tend to agree. It isn't so much the presence of the type system so much as the fact that the compiler is given sufficient information (much of it symbolic) to aggressively optimize the generated code. So it seems to share that with Haskell, yes.

Re: All about Modelica: An equation-based language for modeling physical systems

#44
I've been using Modelica for about 15 years now as an engineer. Mainly 3 different interpreter front ends: Dymola, OpenModelica, and SystemModeler.

At first I was mainly interested in it's ability to symbolically manipulate equations for me. With complex physical systems and interconnections it can become a tremendous chore rearranging systems to provide certain inputs and certain outputs. Modelica and the above compilers allowed me to specify the equations, and in fact automatically generate and interconnect larger and larger systems as one model. Specifying what were inputs and what were outputs became a simple few lines of code. For example, forward and inverse kinematics are the same equations in Modelica, you just specify different input/outputs, and the compiler determines what's the best way to do this. This can have significant challenges sometimes, when things don't easily work, but on the whole the process has been more often than not straightforward.

Interconnection of the models to other simulations has also become more and more a delight. Initially we had to depend on specific interfaces being built, either on the modelica interpreter side, or on the external application side (for example, Mathworks or Dymola), but fortunately the growth in such use prompted the modelica community to partner with industry to foster an open specification (like modelica is) for model exchange, called FMI. Integrating my models with external software is now a relatively straightforward task, still with challenges, but not expensive ones.

I'd highly recommend modelica and the various compilers as a means of creating very effective models; easily readable and therefore maintainable, re-usable, and now more and more deployable.

I, myself, have used them in the truck industry, CNC machine controls, flight systems, and in underwater vehicles and power systems. I routinely interact with people who use modelica in a much wider domain than this, and more and more in on-board systems, such as controllers. For example, I believe northern Germany uses modelica for its power controls for a significant portion of their country's energy supply.

Re: All about Modelica: An equation-based language for modeling physical systems

#45
post #17

There's a project to create a language similar to Modelica as a DSL in Julia, Modia[1]. I'm not currently a user of either language, but saw a presentation at JuliaCon about it[2] and thought it looked interesting. [1] https://github.com/ModiaSim/Modia.jl [2] https://youtu.be/hVg1eL1Qkws

FYI, it is by the same people who initiated the Modelica effort (Hilding Elmqvist and Martin Otter). I think part of the goal was to shed having to maintain a whole language (and the need to specify all the semantics details of such) and simply leverage a language that had macros. I haven't really heard many updates on this in some time. I don't think it is necessarily a bad idea. But any effort along these lines tak…

> by the same people who initiated the Modelica effort

Thanks for pointing this out, I hadn't realized! I knew they were somehow involved in the Modelica community but not that they initiated it.

Post reply on HN