I am interested in creating an orrery, ideally with SystemModeler. I have been experimenting with the MultiBody library since that allows you to do animations.
The most relevant example seems to be Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravity, but the problem is that it has a single point of gravity. You can change the gravity from the earth's gravity to something else, but for my orrery I would think each body needs to have gravity/mass. The bodies do have a settable mass, though, so does this mean I can just create one body for each planet, set the mass correctly and it will work?
So, in other words one way to set up the model would seem to be to make the "world" have the gravity of the sun and gravity type of PointGravity, then have the planets as bodies moving around it. However, I don't think this will work right because the "world" object's gravity is constant, but in the solar system the force of gravity is a function of the distance.
Another idea I had was to make the "world" object have type NoGravity, but then how do I constrain the planets? If I add in the sun as a body, and give the planets and the sun appropriate masses and distances and velocities will the simulator compute the instantaneous gravity between them, ie, solve the N-body problem automatically?
Afterthought: is there a way to customize the look of the "bodies"? In the example they are just blue spheres and you can change their color and size but that is it.
In a typical Modelica model, a component (like a planet) would know about and interact with other components via its connections, and each object is connected with a small number of "nearby" objects. For an orrery where each body interact with every other body, this is a poor fit.
What you can always do is to manually gather all relevant equations into one big model, and just connect it with visualization from the MultiBody library.
To get a fancier look of the bodies, you may use a CAD shape for visualization. Here is an example:
I have been considering since last spring how to go about something similar. I would like to try to provide a simulation environment suitable to testing interplanetary spacecraft platforms. I ran into the same problem you did with the inability to extend point gravity.
After hacking at the problem for a while I realized a more accurate approach that did not reinvent the wheel would to use
the ephemerides from JPL to provide precalculated orbits for the planets, major moons and a variety of other objects. This would
eliminate the problems associated with solving the n-body problem. Simply calculate the positions based on the jpl then calculate a
set of accelerations on craft due to gravity of each body close enough to have a significant effect.
Since then I have simply not had time to dig into the data sets to set it up here.
To me though data sets DE430 and DE431 look like good options. 430 is more accurate but 431 covers a longer time frame.
I forgot to mention another idea that has a great deal of appeal to me. The last several decades have given
an incredible amount of insight into the Antikythera Mechanism. A model based upon the gearing of the mechanism
but providing a modernized 3d display would be absolutely fascinating and fun to build. If I understand correctly
you would have to extend the gear class to add such complications as slotted gear catches etc.
It might make a nice community project!