14 ms·
All about Modelica: An equation-based language for modeling physical systems
- dang 6y agoIf curious see also (from 2017): https://news.ycombinator.com/item?id=16013179 https://news.ycombinator.com/item?id=16013179
- amatic 6y agoIs there a graphical interface, like Simulink, for Modelica?
- vsskanth 6y agoOpenModelica is free. There are many commercial IDEs like Dymola from Dassault, Wolfram System Modeler etc.
- choeger 6y agoMany. Dymola is probably the go-to solution, but also openmodelica, simulationX and wolfram, I think. Here is a list: https://www.modelica.org/tools https://www.modelica.org/tools
- ptrott2017 6y agoThere are commercial ones like ones like Altair SolidThinking, Wolfram System Modeller, ESI's SimulationX and there are open source ones such as OMedit. Which meets your needs will be partly budget / workflow / toolbox support based. If your new to Modelica - then OpenModelica and OMEdit (OMEdit comes as part of the OpenModelica download) are great starting points. To get an idea of the available commercial and open source options see: https://www.modelica.org/tools https://www.modelica.org/tools and https://openmodelica.org/openmodelicaworld/tools https://openmodelica.org/openmodelicaworld/tools
- ptrott2017 6y agoThis is a great overview of Modelica. For those looking to get started - check out OpenModelica (https://openmodelica.org/ https://openmodelica.org/) and if you are curious how to approach deploying and using Modelica in web services the article's author as a rather awesome open source project called LambdaSim see(https://github.com/mbonvini/LambdaSim https://github.com/mbonvini/LambdaSim)
- vsskanth 6y agoBeen working in Modelica for a couple of years. Modelica compilers generate C code since they're heavily used in the embedded and real-time space. Kinda amazing to see systems with hundreds of thousands of equations simulate faster than real time.
- budadre75 6y agowhat Modelica software do you use?
- choeger 6y agoOne thing about Modelica is quite important and might confuse newcomers: the language specification mostly only covers the model, not the equations. That is, when you evaluate your model under, e.g., Dymola and Openmodelica you will (most of the time) end up with equal (or rather similar) systems of equations. The meaning of these equations, i.e., the actual simulation can easily differ, though (except for the most trivial models). The reason for this is that the equations are extremely powerful (you can express pretty much anything computable inside an equation) and their numerical solution is often driven by heuristics (e.g., finding initial values). This makes it extremely difficult to come up with a common standard for the solution of Midelica's hybrid DAEs. Hence you will find little written information about what exactly happens during a simulation that applies to more than one implementation.
- lutorm 6y agoAnother thing that we discovered when testing out using Modelica for some stuff is that it is very easy to design yourself a model that can't be solved. The whole premise of the "object orientation" is that you can just compose models without knowing how to solve the entire system. Once the solver fails, though, all that abstraction comes crashing down and you're left with trying to look at a 500-variable Jacobian and figure out what's making the solver choke. One particular issue with the circuit model example in the article, for example, is that when you add switching elements you often end up with disconnected sub-diagrams and then the solver chokes trying to determine what the potential of the floating circuit is, even though it has no effect on anything you care about. So then you have to start adding stray capacitances and stray resistances to make the solver happy, etc.
- vsskanth 6y ago"Error: Model is singular" is pretty frustrating to debug
- rhodin 6y agoYes this is an art form in itself. I've been planning to do a series on debugging Modelica and the different failure modes that come up, and what tools can be used. It is a known limitation in the Modelica community, but it is also really hard to address in an automatic fashion. See [1] and [2] for some ideas. [1] https://reference.wolfram.com/system-modeler/UserGuide/SimulationCenterEquationBrowser.html https://reference.wolfram.com/system-modeler/UserGuide/Simul... [2] https://liu.diva-portal.org/smash/get/diva2:801004/FULLTEXT01.pdf https://liu.diva-portal.org/smash/get/diva2:801004/FULLTEXT0...
- zokier 6y agookay, its neat and all, but I missed seeing any output from the models, or examples how you use the models you built to analyze something? How do you interact with it, what sort visualizations you get etc etc??
- ptrott2017 6y agoYou can plot variable outputs in 2D and 3D plots, use values to drive simulation based animations (2D and 3D) and via Functional Mockup interface standard (fmi-standard.org) you can interconnect external simulations and interactive visualizations (2D, 3D, VR etc). For examples of these in OpenModelica see the user guide here: https://www.openmodelica.org/doc/OpenModelicaUsersGuide/OpenModelicaUsersGuide-latest.pdf https://www.openmodelica.org/doc/OpenModelicaUsersGuide/Open... There is also a notebook UI that lets you do a lot of Ipython/Jupyter style dev with feedback plots and visualizations, in addition to code tools and visual authoring.
- budadre75 6y agodoes anyone know any industry usage of Modelica?
- vsskanth 6y agoenergy companies (powerplants, building systems etc.), aerospace, automotive, motorsports, robotics
- JPLeRouzic 6y agoMaybe also in physiology (BTW I would be happy if someone could point out similar or better resources) https://www.physiolibrary.org/doc/Physiolibrary.html#Physiolibrary https://www.physiolibrary.org/doc/Physiolibrary.html#Physiol...
- rhodin 6y agoCheck the vendors user stories: https://www.wolfram.com/system-modeler/customer-stories/ https://www.wolfram.com/system-modeler/customer-stories/ Check the Modelica conferences (https://modelica.org/events/modelica2019/proceedings/html/Modelica2019Program.pdf https://modelica.org/events/modelica2019/proceedings/html/Mo...) and you'll see a lot of automotive companies (Toyota, Volvo, Bosch, etc)
- john_a 6y agoSome more industry case sturdies here: https://www.modelon.com/industries/ https://www.modelon.com/industries/
- vsskanth 6y agoa 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 particular variable is being modified in two places. Models have full introspection where you can observe any variable you choose.
- michaeltiller 6y agoThat'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.
- dang 6y agoIs Modelica used for economic modeling as well?
- dongping 6y agoI don't know enough about economic modeling, but if the models can somehow be expressed as driven by a "potential" and a "flow" variable (like electric voltage and electric currents), then it would definitely make sense to try that out in Modelica.
- 082349872349872 6y agohistorical stock and flow economic modelling: https://en.wikipedia.org/wiki/MONIAC https://en.wikipedia.org/wiki/MONIAC (and then there's Cybersyn. It's difficult to evaluate how effective or ineffective it may have been, as the copper drop in value relative to gold by 5x in the early 1970's must've been a serious exogenous shock to the Chilean economy)
- ptrott2017 6y agoWhile most Modelica's applications are primarily engineering related, it is used for stock and flow models and there are some folks digging into use it for economic modeling (as there are others using it for environmental and biological systems modelling). If you are looking to get started using Modelica for economics modeling these might be of interest: https://openmodelica.org/images/M_images/Moses206/moses2016-01-PeterFritzson-MOSES-Intro-Welcome.pdf https://openmodelica.org/images/M_images/Moses206/moses2016-... https://openmodelica.org/images/M_images/Moses206/moses2016-20-LarsOlert-Economic-flows-and-flow-constrained-modeling-with-ECF.pdf https://openmodelica.org/images/M_images/Moses206/moses2016-... https://ep.liu.se/ecp/157/037/ecp19157037.pdf https://ep.liu.se/ecp/157/037/ecp19157037.pdf
- pflanze 6y agoThere'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 https://github.com/ModiaSim/Modia.jl [2] https://youtu.be/hVg1eL1Qkws https://youtu.be/hVg1eL1Qkws
- jpfr 6y agoThat looks really promising. But development seems to have completely stopped earlier this year. Anybody knows what's going on there?
- john_a 6y agoThe two main contributors are just busy in their "real" jobs. https://github.com/ModiaSim/Modia.jl/graphs/contributors https://github.com/ModiaSim/Modia.jl/graphs/contributors
- michaeltiller 6y agoFYI, 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).
- pflanze 6y ago> 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.
- jwilber 6y agoStellar example of naming gone right in software.
- chadcmulligan 6y agoAre there Modelica programmers? Or is it a tool engineers use? Like could you become a Modelica developer and do that as a living?
- vsskanth 6y agoIt's a domain specific language mainly for Modeling dynamic systems. Typically engineers focusing on simulation use it along with a commercial IDE and paid libraries with a lot of prebuilt components.
- john_a 6y agoI work as a full time Modelica programmer :-) And I do have colleagues. Not fully up to date, but a starting point: https://modelica.org/jobs https://modelica.org/jobs
- chadcmulligan 6y agoVery cool - what sort of education do you have / need?
- NotPhysicsPhd 6y agoI 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 better UI, UX and error messages. Wolfram's system modeler offers an excellent experience but it is very expensive. Recently I have been using Mathworks take on model-based languages, Simscape[1], which is great for my use case, as it integrates the whole MATLAB and simulink ecosystem. It is not modelica compatible, but it is possible to import FMUs created with modelica. As a final note, I truly wished that Modelica was taught more in engineering and physics degrees. [1] https://www.mathworks.com/products/simscape.html https://www.mathworks.com/products/simscape.html
- ChrisRackauckas 6y agoThe 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 https://github.com/SciML/ModelingToolkit.jl to bring the same kind of symbolic-numerics approaches to practice.
- michaeltiller 6y agoChris, 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.
- scorecard 6y agoIn my experience Modelica is a good fit for sustainability engineering, as it works well across engineering disciplines. Simulation of hybrid gas/electric engines was one of Modelica's first major applications, power plants was another. As others have noted Modelica is both more abstract and more performant than a lot of other ways of describing multiphysics systems; it got its start in out-of-the-way places, which may explain it's relative obscurity, but there's an opportunity for it to become pervasive in engineering, both in the academy and industry.
- curlyfrond 6y agoI'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.
- deleted 6y ago[deleted]
- LQChen 6y agoIt is painful to deal with the nonlinear equation system: https://stackoverflow.com/questions/62752728/how-to-deal-with-failure-to-solve-nonlinear-equations-during-simulation-in-dymol https://stackoverflow.com/questions/62752728/how-to-deal-wit...