Modelica

About the development of the FEM module/workbench.

Moderator: bernd

Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Modelica

Post by Jee-Bee »

that's what i said twice ... let him start!
ChrisRackauckas
Posts: 1
Joined: Sun Feb 09, 2020 10:24 pm

Re: Modelica

Post by ChrisRackauckas »

Hey,
This is Chris Rackauckas, developer of DifferentialEquations.jl and author of StochasticLifestyle.com. Wordpress stats led me over to this community and I found there's some fun discussion. Let me know what your community would need out of differential equation solvers and modeling tools to best support your activities. We'll soon be releasing a bunch of blog posts on PDE-constrained optimization and automated learning of partial differential equations with universal differential equations (showing more of the sparsity techniques to go beyond https://arxiv.org/abs/2001.04385). I'm not much of a CAD guy but if you let me know what you guys need we can work it into our development roadmap and research! Indeed, a lot of our DAE work started because Hilding Elmqvist (inventor of Modelica) transitioned fully to Julia (Modia.jl) and he had a lot of questions to support tooling for his next gen Modelica. If you let us know what FreeCAD needs, we can work it into the Julia Lab's research and our next round of GSoCs :D .
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Modelica

Post by vocx »

ChrisRackauckas wrote: Sun Feb 09, 2020 10:31 pm ...If you let us know what FreeCAD needs, we can work it into the Julia Lab's research and our next round of GSoCs :D .
You can see previous posts about Julia topics.

preCICE, DifferentialEquations.jl, DiffEqFlux.jl, SUNDIALS, CasADi, Modia
Julia

As you can see, those topics have received very few replies. It's not that we aren't interested in Modelica and efficiently solving mechanical and optimization problems, the issue is that currently there is no concrete implementation done in this aspect. Saso has posted this topic of Modelica and Julia more or less to spark interest, but so far nobody in our community has written the code to interface our CAD software with those tools. We need somebody to do this first, and then we can see what else can be done.

How can we connect FreeCAD with Modelica and Julia libraries? If you tell us how, then we can advance this further.

What does FreeCAD need? We need to know how to start because currently we have done nothing.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Modelica

Post by saso »

ChrisRackauckas wrote: Sun Feb 09, 2020 10:31 pm This is Chris Rackauckas, developer of DifferentialEquations.jl and author of StochasticLifestyle.com. Wordpress stats led me over to this community...
Chris, Wow! So good to see you here :) those wordpress stats were probably mostly me reading and re reading all of your posts in the past weeks :roll:

It is true that both Modelica and OpenModelica projects are adding support for Julia (or maybe even moving to it), as said before Modia.jl and here are some slides from a recent OpenModelica presentation https://www.openmodelica.org/images/M_i ... mpiler.pdf also https://ep.liu.se/ecp/174/017/ecp2020174017.pdf

But for FreeCAD the potential for collaboration is IMO much bigger, on many different levels and I would even not put Modelica (and related/similar development to it) on the first place, so it would probably also be better to continue this discussion under the Julia topic https://forum.freecadweb.org/viewtopic.php?t=42400
Last edited by saso on Tue Nov 03, 2020 10:34 pm, edited 1 time in total.
ppenguin
Posts: 5
Joined: Fri Mar 23, 2018 11:49 am

Re: Modelica

Post by ppenguin »

Really nice to see this topic discussed!
Being mainly experienced in CAE for mechanical, control, and some hydraulics (OpenModelica, Adams, Simulink, "raw python"), I've read this with great interest.

I don't want to limit the discussion, but my take is that if such a thing has a chance it would need to "pick the low hanging fruits" first.
Since FreeCAD is first and foremost the tool to take care of geometric definition of systems (i.e. mechanical and dimensional properties), a primary focus on that would probably yield the fastest results. In that respect I feel that @looo seems on to something with the topic "node editor".

When modelling a 3D mechanical system in OpenModelica (i.e. chiefly using the Mechanics libraries Multibody, Translational, Rotational) the main benefit of FreeCAD would be to define coordinates, body types, joint types. In fact, especially bodies with non-trivial geometries are almost impossible to model in OpenModelica directly, so FreeCAD would be a big win there, even if it were only in a simplified manner with lumped masses and inertias for a start. Then of course animation of the results is what we are doing it for, but this should be "the least difficult", since the difficult topic of kinematics would be taken care of entirely by OpenModelica (the simulation result) in this case, so you would "just" need to force result coordinates and attitudes on the single CAD parts for every time step during animation.

Another topic (which was mentioned here as well) could be for geometrical properties of hydraulic piping, but there I suppose it will be more of a pre-processor use case.

Then again, for multi-body problems the approach @josegegas has taken with MBDyn seems to have taken a great head start, and come to think of it the things MBDyn needs as an input are quite comparable to the things OpenModelica would need, so synergies would be promising there I suspect. I have been wanting to find the time to take his toolbox for a spin...
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Modelica

Post by RatonLaveur »

I'm sure developers like adamLange would be interested too, his n-axis inverse kinematics solver in modelica, he has been using it to generate FreeCAD Path G-code for his 5 axis machine...https://forum.freecadweb.org/viewtopic.php?f=15&t=43224

He today released a very detailed step by step tutorial from FreeCAD to Modelica and back, showing that at the moment the process is still very manual, but clearly showing a potential for some integration.
adamLange wrote: Sat Feb 08, 2020 9:27 pmping
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Modelica

Post by saso »

New version OpenModelica v1.16.0 released
https://trac.openmodelica.org/OpenModel ... tes/1.16.0
https://www.openmodelica.org/

see also presentations from the OpenModelica Annual Workshop 2020
https://www.openmodelica.org/events/ope ... ogram-2020 (see links to pdf's)

and proceedings of the 13th MODPROD Workshop 2019
https://wcc.ep.liu.se/index.php/MODPROD/issue/view/13

and the book of abstracts and proceedings from the American Modelica Conference 2020
https://2020.american.conference.modeli ... tracts.pdf
https://2020.american.conference.modeli ... gs_v2C.pdf
https://www.modelica.org/events/modelica2020Americas

American Modelica Conference 2020
https://www.youtube.com/playlist?list=P ... zGm1ucrMDD

Cyber-physical System Modeling using Modelica for Smart and Sustainable Communities
https://www.colorado.edu/lab/sbs/americ ... rkshop-c-2
https://vimeo.com/462683847

Modelica Buildings Library training
https://simulationresearch.lbl.gov/mode ... rence.html
https://vimeo.com/462638936

and proceedings of Asian Modelica Conference 2020
https://ep.liu.se/ecp/174/ecp2020174.pdf

The OpenModelica Integrated Environment for Modeling, Simulation, and Model-Based Development
https://www.mic-journal.no/ABS/MIC-2020-4-1.asp/
https://www.mic-journal.no/PDF/2020/MIC-2020-4-1.pdf

and on the future of Modelica with Julia
https://youtu.be/XI-iHixmGgg?t=3944
https://ep.liu.se/ecp/174/017/ecp2020174017.pdf

ModelingToolkit, Modelica, and Modia: The Composable Modeling Future in Julia
http://www.stochasticlifestyle.com/mode ... -in-julia/

ModelingToolkit: A Composable Graph Transformation System For Equation-Based Modeling
https://arxiv.org/abs/2103.05244
Last edited by saso on Mon Dec 12, 2022 11:58 am, edited 6 times in total.
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: Modelica

Post by josegegas »

Hi. I come back to this forum after a while working on integrating FreeCAD and MBDyn to simulate multibody systems. By now my workbench is capable of creating some of the key joints (revolute pins, revolute hinges, spherical joints, prismatic joints, axial rotation joints, drive-hinge joints...) and of animating and plotting the results of the simulations. As someone mentioned earlier, FreeCAD provides the advantage of providing the physical properties (inertia and volume) of complex bodies, not just the trivial ones one can model with Openmodelica or MBDyn. I have modelled simple mechanisms such as pendulums, crank-slider, etc, many times with my workbench, and I feel that my approach is slowly getting close to something usable.

The thing is that I would like to validate the simulation results obtained from my workbench with simulation results (for the same problem), but obtained with another package. Since I am not a student any more I do not have access to fancy software packages to do this, so I was thinking Openmodelica is an option.

My question is, is someone keen to work with me on this? The idea would be to start with something as simple as a single pendullum. I simulate it with my MBDyn + FreeCAD workbench. Someone else can simmulate the same thing with Modelica, and we compare results (kinematic curve, reaction forces...). If the results are the same or look reasonable similar, this will mean I am heading in the right direction with my approach to connect FreeCAD and MBDyn.

Also, this would give us some ideas on how to connect FreeCAD and Openmodelica, which I believe is a fantastic idea. I feel that FreeCAD has made good progress in its CAD side and also in its FEA and CFD side over the last years, but it completely lacks MBD capabilities. My attempts to connect it with MBDyn started because of this lack. Openmodelica would add to these efforts. Also, openmodelica seems capable of doing MUCH MORE than MBD systems...

Cheers!
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Modelica

Post by Jee-Bee »

You can also check what examples they have... if you did a quick search you find out that they have a pendulum example in OM...

https://github.com/OpenModelica/modelic ... endulum.mo
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Modelica

Post by saso »

New version OpenModelica v1.18.0 released
https://trac.openmodelica.org/OpenModel ... tes/1.18.0
https://www.openmodelica.org/

and release of Hopsan 2.19.1
https://github.com/Hopsan/hopsan/releases/tag/v2.19.1
https://liu.se/en/research/hopsan

see also presentations from the OpenModelica Annual Workshop 2021
https://www.openmodelica.org/events/ope ... ogram-2021 (see links to pdf's)

and proceedings of the 15th MODPROD Workshop 2021
https://modprodblog.wordpress.com/modprod-2021/
https://wcc.ep.liu.se/index.php/MODPROD/issue/view/28

and proceedings from the 14th International Modelica Conference
https://ecp.ep.liu.se/index.php/modelica/issue/view/37
https://2021.international.conference.modelica.org/

14th Modelica Conference 2021
https://www.youtube.com/playlist?list=P ... Yz1LoSEb2l

Keynote: New Horizons in Modeling and Simulation with Julia
https://www.youtube.com/watch?v=aXTLwWCKAfc

Composing Modeling and Simulation with Machine Learning in Julia
https://www.youtube.com/watch?v=loqORy9tATY

OpenModelica.jl: Modular & extens. Modelica compiler framework in Julia targeting ModelingToolkit.jl
https://www.youtube.com/watch?v=Kof2OWbwB5Y

A resume of the ways to improve connection between FEM and OpenModelica
https://www.youtube.com/watch?v=tw6wZQEd1qw

How can the Modelica community support the transition to decarbonized, grid-flexible buildings?
https://www.youtube.com/watch?v=-UtEX53dVV0

Modelica library for building and district energy systems developed within IBPSA Project 1
https://ibpsa.github.io/project1/
https://github.com/ibpsa/modelica-ibpsa

AixLib is a Modelica model library for building performance simulations
https://github.com/RWTH-EBC/AixLib

Modelica Buildings Library
https://simulationresearch.lbl.gov/modelica/

BuildingSystems Library
https://modelica-buildingsystems.de/

Modelica model environment for Integrated District Energy Assessment Simulations (IDEAS)
https://github.com/open-ideas/IDEAS

TEASER - Tool for Energy Analysis and Simulation for Efficient Retrofit
https://github.com/RWTH-EBC/TEASER

Library Award
https://2021.international.conference.m ... aries.html

The DLR Thermofluid Stream Library
https://www.youtube.com/watch?v=u0Y7z0MyKd4
https://github.com/DLR-SR/ThermofluidStream
Last edited by saso on Sun Nov 19, 2023 11:46 pm, edited 11 times in total.
Post Reply