Here you go:
Code: Select all
"Atlantis (STS-30)" "Sol/Earth"
{
Class "spacecraft"
Mesh "atlantis.3ds"
Radius 0.02
EllipticalOrbit {
Epoch 2447652.55324085 # 1989 Jan 1 + 125.05324085
Period 0.063070452 # inverse of mean motion = 1/15.85528504
SemiMajorAxis 6693 # cube root(Period squared * 7.5371e13)
Inclination 28.8886
AscendingNode 338.8795
ArgOfPericenter 198.0201
MeanAnomaly 341.7885
}
Orientation [90 0 0 1]
Obliquity 28.8886 # same as Inclination
EquatorAscendingNode 338.8795 # same as AscendingNode
RotationOffset 36.9735 # MeanAnomaly+ArgOfPericenter+[360*FRAC({2451545-Epoch}/Period)]-90
}
"Magellan" "Sol/Earth/Atlantis (STS-30)"
{
Class "spacecraft"
Mesh "magellan_ius.3ds"
Radius 0.0055
EllipticalOrbit {
Period 0.063070452 # same as shuttle
SemiMajorAxis 0.02 # whatever you like
MeanAnomaly 126.9735 # shuttle RotationOffset + 90
}
RotationPeriod 0.005 # whatever you like
Obliquity 90 # always the same
EquatorAscendingNode 36.9735 # same as shuttle RotationOffset
PrecessionRate 5707.902614 # mean motion * 360
}
Not sure where you got your Period from - the NORAD two-line element set gives you mean motion in revolutions per day, so you just take the inverse of that to get the Period. Since PrecessionRate needs degrees/day, you multiply mean motion by 360.
To make Celestia correspond the real world, you need to extract an Epoch from the NORAD elements. Their format is a little awkward - it's a fourteen character string, the first two characters giving the last two digits of the year, and the remainder being the day of the year, with trailing decimals.
The relevant string for the elements you've used is
89125.05324085, so that's day 125.05324085 of 1989. I looked up the Julian Day for 1989 Jan 1 00:00:00, and then added 125.05324085 to get the correct Epoch.
Because of the business with the Epoch, deriving the RotationOffset gets a little wearisome. You have to allow for the rotations between the chosen Epoch and Celestia's default epoch. (In the formula I've given, "FRAC" indicates that you need to take just the fractional part of the number.)
As to the SemiMajorAxis: period-squared varies as radius-cubed, with a constant of proportionality involving the mass of the central body and the gravitational constant. I've lumped all that stuff together, along with some conversion factors, to produce the simple formula I've given - it converts periods in days to distances in kilometres. (It isn't quite right for an oblate object like the Earth, but the difference is too small to notice in Celestia.)
Added later: Just to state the bleedin' obvious so there's no chance of a mistake - the condensed formula above, used to convert period to semimajor axis, only works for satellites orbiting the
Earth. The full equation, applicable anywhere, is:
P?= 4*pi?*a?/(GM)
where P is the period, a is the semimajor axis, G is the universal gravitational constant (6.67e-11) and M is the combined mass of primary and satellite - all in SI units.
Grant