Live data from Hacker News

Modelica

modelica.org

21–30 of 118 posts

Re: Modelica

#21
post #5

Obligatory mention to Openmodelica[1] which is an open source implementation based on the Modelica language. While I haven't used it yet, I was planning on exploring some of the features this holiday. [1] https://openmodelica.org/

Together with colleagues, I have been developing the dynamical systems modeling language "NESTML" for hybrid dynamical systems, that is, systems that contain continuous-time dynamics (expressed as ordinary differential equations) as well as being able to emit and receive discrete events that happen instantaneously in time. We strive for a minimal syntax, so you can write a model really concisely, for example:

  model lorenz_attractor:

  state:
    x real = 1
    y real = 1
    z real = 1

  equations:
    x' = sigma * (y - x) / s
    y' = (x * (rho - z) - y) / s
    z' = (x * y - beta * z) / s

  update:
    integrate_odes()

  parameters:
    sigma real = 10
    beta real = 8/3
    rho real = 28
For events, there are constructs like "onReceive(in_port_name)" and "emit_spike()" (nomenclature there being clearly somewhat influenced from our neuroscience application domain).

It's still a work in progress, but we already have some cool applications, like a spiking neural network that learns and then replays sequences (https://nestml.readthedocs.io/en/latest/tutorials/sequence_l...).

I was frankly surprised that something like this did not already exist when I started development on NESTML. Modelica is similar, but does not seem to have support for discrete events. I realise all of this is a shameless plug ;) but in actuality we are of course very happy to receive comments and feedback! All development is out in the open on GitHub and it is GPL licensed. If someone knows of similar DSLs, I would be very happy to read your comments. Cheers!

Re: Modelica

#22
post #15
post #3

As someone who has no idea what this is about bar the landing page explanation, and isn't in this space -- it would be great if the front page had examples, or links to examples. 30 seconds of clicking around and I've failed to find sth compelling.

As someone who is a curious outsider to Modelica, it piqued my interest a few years ago when I found out that this language lets you write equations more directly than most other programming languages. Take the ideal gas law, for example, PV = nRT, which has 5 identifiers. In most programming languages, you'd have to keep only one variable to the left, that is assigned to, e.g. T=PV/nR, and a similar set of equations…

This is generally referred to as an acausal modeling environment - you don't need to bring the causality of mathematical relationships, just bring the relationships.

There are several other tools in this space, not the least prevalent of which is Mathworks' Simscape product line [1]. Wolfram has a solution that is also very similar to Modelica [2]. Finally, I believe that you will find ModelingToolkit.jl [3] worth a look (along with Julia in general) if your interest is piqued here by Modelica. I believe MTK is a big slice of the future of acausal modeling tools.

[1] https://www.mathworks.com/products/simscape.html

[2] https://www.wolfram.com/system-modeler/

[3] https://docs.sciml.ai/ModelingToolkit/stable/examples/spring...

Re: Modelica

#23
post #18
post #5

Obligatory mention to Openmodelica[1] which is an open source implementation based on the Modelica language. While I haven't used it yet, I was planning on exploring some of the features this holiday. [1] https://openmodelica.org/

Having used it in the work. My 2 cts about the not free version: KEEP AWAY. RUN! Cannot do much more than any free SPICE, complex licensing, buggy. Is just like the LabVIEW of simulations. I haven't used the free Version though.

One of the advantages Dymola had a few years ago was an extremely advanced vehicle dynamics toolbox, to the point where it is considered a standard for NASCAR [1]. This is one of the tool's originating claims to fame circa 2015-19 when I was bringing it into a previous employer in the automotive industry. For some applications that are "first class", you will have a great experience with Dymola. Where they have filled in the blanks in toolboxes, however, you are likely not a cut above other tools.

[1] https://www.claytex.com/applications/motorsport/

Re: Modelica

#24
post #3

As someone who has no idea what this is about bar the landing page explanation, and isn't in this space -- it would be great if the front page had examples, or links to examples. 30 seconds of clicking around and I've failed to find sth compelling.

I wonder if anyone is keeping a list of the new languages that come out every year.

Re: Modelica

#25

I am now using Modelica with OpenModelica at work to describe electromagnetic systems and it is an excellent language and, with OpenModelica, a excellent graphical user environment. Sometimes I think of it like SPICE but for multi-physics systems. 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…

Modelica is an excellent way to perform these simulations. Exporting a functional mock-up unit (FMU) according to the FMI standard is a first-class capability [1] that is another huge source of value, especially for systems integrators. You are able to have reasonably obfuscated models of your system in untrusted hands, and they get the full benefit of your system model. This is one area where OpenModelica is ahead of competitors including the open-source ModelingToolkit.jl [2] and related library FMIExport.jl [3].

[1] https://openmodelica.org/doc/OpenModelicaUsersGuide/v1.11.0/...

[2] https://docs.sciml.ai/ModelingToolkit/stable/

[3] https://github.com/ThummeTo/FMIExport.jl

Re: Modelica

#26

AFAICT the docs don't seem to be directly searchable: 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: https://mbe.modelica.university/

You could use it to model a CNC machine, but you'd probably need to make new components. It would also be difficult to model the changing load as the spinning tool plunges into metal, but you could model dynamic deformation and response of the machine given the loads. It is difficult to model changing 3D contacts in modelica, although a new approach to solving newton's equations, dialectic mechanics may fix this problem

NEMA isn't a type of motor, it's a connection standard used for motors. You might be able to model stepper motors with some of the components in the modelica standard library for magnetic modeling.

Re: Modelica

#27
This is a pretty niche acausal language, and is used extensively in Motorsports (F1, NASCAR) for real-time simulation on the driver simulator.

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.

Re: Modelica

#29
post #5

Obligatory mention to Openmodelica[1] which is an open source implementation based on the Modelica language. While I haven't used it yet, I was planning on exploring some of the features this holiday. [1] https://openmodelica.org/

If you intend to explore OpenModelica you may also like ModelingToolkit.jl: https://docs.sciml.ai/ModelingToolkit/dev/ There is also a project by Hilding Elmqvist, who worked for Dassault on Dymola (the leading commercial implementation of Modelica). His project is Modia.jl: https://github.com/ModiaSim/Modia.jl I can personally feel the Julia community settling on MTK, but Modia was ahead in the early stages of dynam…

Hilding Elmqvist not only worked on Dymola, he is the original creator of modelica
Post reply on HN