by v9v on 12/16/24, 2:22 PM with 112 comments
by hazrmard on 12/16/24, 3:27 PM
> Modelica is a high-level declarative language for describing mathematical behavior. It is typically applied to engineering systems...
We use Modelica quite a bit in HVAC industry. In my case (controls engineer), I can request FMUs of various components from systems engineers for optimization work. (Functional Mockup Unit (FMU)[1]: stand-alone binary representing a dynamical system that can be driven by another application). My background is in Reinforcement learning/Model predictive control/python. Having a physics-driven model written in a domain-specific language which I can embed into my python workflow [2] is convenient.
I will say, Modelica requires a different perspective from "regular" imperative programming (python/matlab). It is a declarative language: you define equations, variables, constraints for a system, regardless of order. The compiler decides how to run the simulation; which variables to solve first etc.
While OpenModelica[3] has come a long way towards making an open source implementation of the language standard, proprietary applications (Dymola) still have an edge in the industry.
[1]: https://fmi-standard.org/
by vsskanth on 12/16/24, 4:35 PM
The language spec is open source but there many commercial compilers, Dymola is the most popular.
I code in this language extensively and its acausal nature is extremely powerful. It makes your models highly composable, you can basically assemble a mechanical system like a bunch of lego blocks and the equations fall out automatically. You can also easily invert your models.
The closest analogy in the programming world is Haskell.
by sbszllr on 12/16/24, 3:09 PM
30 seconds of clicking around and I've failed to find sth compelling.
by brap on 12/17/24, 10:45 AM
There’s not a single example on the landing page. There’s not a single example on any of the main links from the landing page.
But the landing page does have a merch store so you can buy mugs and hoodies and look at huge company logos of “organizational members”, whatever that is.
You made something. Show me what you made. I’m probably not going to spend more than 30 seconds trying to figure it out unless I already know I need it.
Why make it so difficult?
by frankohn on 12/16/24, 4:02 PM
The Modelica library is quite mature and complete and the numerical solvers included with OpenModelica robust and performing.
It looks me a while to learn it but now it is paying out.
In addition the fact that Modelica is a standard implemented by several suppliers with an open source application is also great to avoid vendor lock in so that is a technology on which is safe to invest as an engineer and as a company.
by durag on 12/16/24, 5:58 PM
Can any expert in this field give me some pointers. My current belief is that understanding the theory of bond graphs will give me intuitive understanding of just about every system I work with in my field.
I find that this field is surprisingly niche, as most of my peers have never paid special attention to it, but when I found about it, it seemed to me like a magic bullet for all my problems.
[1] https://dirac.ruc.dk/~heine/paynter/analysis_and_design_of_e...
by dang on 12/16/24, 7:52 PM
All about Modelica: An equation-based language for modeling physical systems - https://news.ycombinator.com/item?id=23690788 - June 2020 (44 comments)
Modelica - https://news.ycombinator.com/item?id=16013179 - Dec 2017 (12 comments)
by Archit3ch on 12/16/24, 4:41 PM
by ur-whale on 12/16/24, 6:22 PM
This is very nice, especially if it is general enough.
However, what is even more interesting is the general methodology to actually run the time-based simulation of such a system, especially if this allows to describe arbitrarily complex diffeqs (other than brute force monte-carlo style integration/sampling).
by pkoird on 12/16/24, 3:12 PM
by JensRantil on 12/16/24, 10:47 PM
by runningmike on 12/17/24, 7:19 AM
by WillAdams on 12/16/24, 3:21 PM
https://doc.modelica.org/Modelica%204.0.0/Resources/helpDymo...
Are NEMA motors modeled? Could one use this to simulate/model a CNC machine?
EDIT:
Apparently not, given that "NEMA" doesn't show up searching:
by constantcrying on 12/17/24, 7:29 PM
There is not a single third party way to generate a Model Exchange FMU for Linux, using anything but the very badly designed C reference FMUs or some commercial project. Even Matlab has poor support for it.
by aetherspawn on 12/17/24, 3:46 AM
It is, perhaps, only a few toolboxes away (Simulink Test, Simulink Coverage, Simulink Coder).
by tpoacher on 12/17/24, 6:49 PM
Any idea if that's the case?
by jessekv on 12/16/24, 4:36 PM
https://github.com/pymoca/pymoca
It targets CasADi (and therefore C) and to a lesser extent, SymPy.
by eternauta3k on 12/16/24, 5:45 PM
by theflyinghorse on 12/16/24, 7:31 PM
by mscuttari on 12/18/24, 4:37 PM
Here’s the GitHub repo: https://github.com/marco-compiler/marco
And here’s a link to the latest published results: https://ecp.ep.liu.se/index.php/modelica/article/view/909
Would love to hear your thoughts or ideas!