SDK Question oapiGetGlobalPos frame

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
In the file "API_Reference.pdf" I read that oapiGetGlobalPos "Returns the position of an object in the global reference frame" and that the global reference frame "is the heliocentric ecliptic system at ecliptic and equinox of J2000", but I get {-493478083; 18642718; -806901763} for the Sun.
Please, just to be sure, could someone confirm that the origin of the global reference frame is the Solar System's Barycentre?

Thank you
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Please, just to be sure, could someone confirm that the origin of the global reference frame is the Solar System's Barycentre?

Confirmed - is also mentioned that way in the API reference somewhere.
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
Not so long ago I was wondering about this as well.

So I carried out a little test: I set all of the masses of all gravitating bodies to zero and placed a ship at an arbitrary point in space with an arbitrary velocity. I then let Orbiter fast forward a hundred years or so and checked that velocity hadn't changed. Indeed, the ship's velocity had not changed.

From this little test, I concluded that the global reference frame was an an inertial reference frame.

At the same time, I calculated the position of all of the planets and weighted them by their true masses to calculate Orbiter's view of the Solar System's centre of mass. On this occasion, I noted that there was a small discrepancy between the location of the centre of mass and the origin of the global reference frame. However, the separation was (to within rounding error) constant over time.

From this test, I concluded that the origin of global reference frame was close to the Solar System barycentre - but that I could not guarantee that the two points would necessarily coincide.
 
Last edited:

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
From this test, I concluded that the origin of global reference frame was close to the Solar System barycentre - but that I could not guarantee that the two points would necessarily coincide.

Do you mean that the SSB in Orbiter is not coincident with the real SSB, right?
But oapiGetGlobalPos origin is exactly in the Orbiter SSB, right?
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
But oapiGetGlobalPos origin is exactly in the Orbiter SSB, right?

No, I don't recall finding that that was the case when I performed the test.

But I did the test some time ago and I may not remember correctly (or did it correctly). When I have a moment, I will re-run the test and let you know what I find.

The test was done via a lua script which calculated the location of the SSB in Orbiter's global reference frame. I don't think it will be hard to repeat it.
 
Last edited:

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
When I have a moment, I will re-run the test and let you know what I find.

Thanks a lot.

The test was done via a lua script which calculated the location of the SSB in Orbiter's global reference frame. I don't think it will be hard to repeat it.

Meanwhile, I did my test.
I wrote a DLL to simulate the motion of Pluto. The DLL calculate the Pluto position and velocity wrt the SSB.

I also wrote a MFD that saves in a file the state read with oapiGetGlobalPos.

The differences between my DLL and oapiGetGlobalPos are negligible (mainly round-off errors).
Hence I must conclude that the origin of oapiGetGlobalPos is the SSB. Am I right?
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
I'm not sure exactly what your Pluto DLL does, so I can't really comment. But Pluto is a long, long way from the Solar System Barycentre.

When I calculated that the offset between the origin of Orbiter's global reference frame and my calculation of the Solar System Barycentre was only of the order of 10 km or so. But Pluto orbits the Sun at a distance of circa 30 AU - or circa 5 x 10^9 km, and since the change in gravity field due to an offset from the centre falls of as the cube of the distance, I wouldn't expect you to see much difference.

And for the inner planets, does a 10 km offset matter? Yes, noticeably so - bit whether you want to worry about depends on the sort of accuracy you are interested in.

I think the cleaner test is just to use the Orbiter API and simply calculate the position of the Solar System Barycentre (SSB) using the information generated via the information interface.

After all, the only information that one needs is:

1. a list of the gravitating bodies
2. their masses
3. their positions in the Orbitar global reference frame

From their on simply calculates:

[MATH](\frac{\sum _{i=1}^n m_i \, x_i}{\sum _{i=1}^n m_i},\frac{\sum _{i=1}^n m_i \, y_i}{\sum _{i=1}^n m_i},\frac{\sum _{i=1}^n m_i \, z_i}{\sum _{i=1}^n m_i})[/MATH]
Not a difficult task. Don't assume - calculate.
 
Last edited:

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
I have put your code in my MFD (thank you) and I get values around 1304 km.

Then I replaced the original DLLs with my DDLs that calculate the positions of the bodies (including the Sun and some major satellites) using the most recent JPL's ephemerides.
In this "new" Solar System, the SSB position is around
{29924; 53; -37782} = 48196.6 m (48 km) and it is almost constant.

I guess that the masses written in the configuration files are not compatible with the bodies position.

It makes one wonder how Orbiter calculates oapiGetGlobalPos.

Cristiano
 

Chode

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 21, 2008
Messages
107
Reaction score
1
Points
0
By my calculation, a 48 km difference in the calculation of the position
of the solar system barycenter can be entirely accounted for by differences
in the masses used for the giant planets and the Sun. Jupiter alone
moves the solar system barycenter by about 750,000 km from the center of the sun.
An error of about 1 part in 16000 in the ratio of the mass of Jupiter to that of
the sun would result in about a 50 km error in that distance. It turns out that if
you take that mass ratio from the Orbiter config files and compare to the mass ratio
that you get from Horizons (for exmaple), there is a difference of about 1 part in 16000.
So I would conclude that there is nothing wrong with the way Orbiter calclulates positions,
just a difference in the masses Orbiter uses when compared to what JPL uses.
 

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
The problem is not 48, 1000 or 100000 km of distance from the Orbiter SSB and the true SSB.
The problem is that I need to be sure that oapiGetGlobalPos returns the coordinates wrt the SSB.
Why I need to know what exactly oapiGetGlobalPos is? Because I'm replacing most of the celbody DLLs (with a sub-meter precision) and I want to double check their accuracy.

What you say is perfectly reasonable; Urwumpe confirmed the SSB coordinates; I get just 48 km of difference... We can be sure! :)

Thank you all
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
It makes one wonder how Orbiter calculates oapiGetGlobalPos.

I suspect (but need to confirm) that Orbiter inherits its global reference frame from the VSOP87 theory. In the original theory, it would have made sense to place the Solar System Barycentre at the origin of the coordinate system - and it probably was. However, in the public domain, one finds the ephemeris files for the positions of the Sun and the planets. But the values of the masses of the Sun and the planets implicit in the VSOP87 theory are not readily available.

On the other hand, Jet Propulsion Laboratory (JPL) publishes values of the masses for the Sun and the planets and Martin has elected to uses these. Since the JPL masses don't align perfectly with the those of the original VSOP87 theory, this leads to a few minor 'wrinkles' in the resulting gravitational model in Orbiter.

What I have concluded, though, is the following:

1. Orbiter treats its global reference frame, inherited presumably from VSOP87, as an inertial reference frame;

2. Orbiter's Solar System Barycentre is not located at the origin of the global reference frame and its location is not necessarily fixed in that coordinate system;

3. total linear momentum of the Solar System is not (exactly) conserved; and

4. total angular momentum of the Solar System is not (exactly) conserved.

None of these 'wrinkles' need be of much consequence - so long, that is, one is aware that they exist.
 
Last edited:

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
What I have concluded, though, is the following:

1. Orbiter treats its global reference frame, inherited presumably from VSOP87, as an inertial reference frame;

I don't think that the global reference frame is inherited from VSOP87, because in my understanding, Orbiter could calculate the SSB position in two ways: it could use the flags returned by celbody DLL (EPHEM_PARENTBARY, EPHEM_BARYISTRUE, ...) or it could use the formula you posted (or something like that).
If *all* the celbody calculate the position from a VSOP87 theory, then the reference frame is inherited from VSOP87, but if I replace one or more celbody with one that uses another reference frame, the global reference frame used in Orbiter is not well defined.

2. Orbiter's Solar System Barycentre is not located at the origin of the global reference frame and its location is not necessarily fixed in that coordinate system;

I'm not sure to understand what exactly you mean.
Consider a body that uses a DLL to calculate its state. The DLL tells Orbiter that the state of the body is {px,py,pz, vx,vy,vz} setting the appropriate flags (EPHEM_PARENTBARY, EPHEM_BARYISTRUE, ...).
If the position (and/or the mass) is wrong, Orbiter calculate a SSB that is different from the SSB of the real Solar System, but I expect that oapiGetGlobalPos() returns the position wrt the SSB of the system that Orbiter is simulating, in other words, I expect that the SSB is located at the origin of the global reference frame.

3. total linear momentum of the Solar System is not (exactly) conserved; and
4. total angular momentum of the Solar System is not (exactly) conserved.

Even when a sophisticated integration algorithm is used, "exactly" doesn't happen.
I think that the only way to do that is to use an unperturbed motion.

None of these 'wrinkles' need be of much consequence - so long, that is, one is aware that they exist.

Agreed.
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
I guess just to reiterate:

One can calculate the position of the Solar System Barycentre (centre of mass) in Orbiter's global reference frame by direct calculate of its position using information extracted from Orbiter via the API.

In my default Orbiter configuration, I calculate that with respect to Orbiter's global reference frame, the position of the Solar System Barycentre is offset from the origin of the global reference frame by around 1340 km. Moreover, with respect to Orbiter's default configuration, the position of the barycentre is not fixed - it moves but never strays more than a few thousand kilometres from the origin of the coordinate system.

Now, if you update the part of the code that returns planetary positions, it is certainly true that you could construct a version of Orbiter in which the origin of the global reference frame and the barycentre coincided. In many respects that would make a lot of sense. But it is manifestly true that the barycentre and origin of the global reference frame do not coincide in the Orbiter's default configuration.
 
Last edited:

cristiapi

New member
Joined
May 26, 2014
Messages
222
Reaction score
0
Points
0
Location
Ancona
Now, if you update the part of the code that returns planetary positions, it is certainly true that you could construct a version of Orbiter in which the origin of the global reference frame and the barycentre coincided. In many respects that would make a lot of sense.

I finished my project to replace the motion of 46 bodies (and I probably will publish it, if it is of someone's interest). I also updated the masses of those bodies; now the SSB is only 314 m away from the origin of the Orbiter's global reference frame.

But it is manifestly true that the barycentre and origin of the global reference frame do not coincide in the Orbiter's default configuration.

Agreed. You just need to change either the positions or the masses, or both. :)
 

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
If you publish, it will indeed be of interest.
 
Last edited:

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
OK, thanks. I will have a look.
 
Last edited:
Top