[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orekit Users] Converting a State Vector to a TLE
Hi Matt,
matthew.darden@solers.com a écrit :
Thank you,
You're welcome
I think I have it working properly now, though I might need to tweak some
parameters. Here is what I have at the moment: (sorry, I do not know how to
post it nicely)
//setup initial osculating orbit, where posVelTeme is
the position
and velocity in TEME and epoch is the time of posVelTeme
KeplerianOrbit initialOrbit = new KeplerianOrbit(posVelTeme,
FramesFactory.getTEME(), epoch,
Constants.WGS84_EARTH_MU);
SpacecraftState initialState = new SpacecraftState(initialOrbit);
Frame teme = FramesFactory.getTEME();
final double minStep = 0.001;
final double maxStep = 500;
final double positionTolerance = 1;
final OrbitType type = OrbitType.KEPLERIAN;
final double stepSize = 600; //600 sec == 10 min
final double duration = 345600; // 345600 sec == 4 days
You can use duration = Constants.JULIAN_DAY * 4 here, it will be more
explicit.
final double threshold = 0.0001;
final boolean positionOnly = false;
final int maxIterations = 10000;
This max number of iterations is really large. I would suggest to set
it to something like 100 or so, and get an early error if it fails.
//setup numerical propagator
double[][] tol =
NumericalPropagator.tolerances(positionTolerance,
initialOrbit, type);
AdaptiveStepsizeIntegrator integrator =
new DormandPrince853Integrator(minStep, maxStep, tol[0],
tol[1]);
NumericalPropagator numericalPropagator = new
NumericalPropagator(integrator);
numericalPropagator.setOrbitType(type);
numericalPropagator.setInitialState(initialState);
OneAxisEllipsoid earth = new
OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING, teme);
There is a problem in the line above. Your Earth is always aligned to
a quasi-inertial frame, so it doesn't rotate. As you use some tesseral
terms in your gravity field setting below (you select a 8x8 gravity
field), the Earth orientation is used but is wrong. You should use an
ITRF frame as the Earth frame when building the ellipsoid.
ForceModel gravityField = new
HolmesFeatherstoneAttractionModel(earth.getBodyFrame(),
GravityFieldFactory.getNormalizedProvider(8, 8));
numericalPropagator.addForceModel(gravityField);
Perhaps you should add more force models for a better fit. The SGP4
model used for TLE propagation uses 3rd body attraction (Moon and Sun)
for orbits with period greater than 225 minutes, and uses atmospheric
drag for low orbits.
//take samples of propagation
List<SpacecraftState> sample = new ArrayList<SpacecraftState>();
for (double dt = 0; dt < duration; dt += stepSize) {
sample.add(numericalPropagator.propagate(epoch.shiftedBy(dt)));
}
Instead of building the sample and providing it to the convertor, you
can also directly pass the numerical propagator to the converter, it
will create the sample by itself and this will simplify your code.
//fit TLE to the samples.
PropagatorBuilder builder = new TLEPropagatorBuilder(0,
'U', 0, 0,
"A", 0, 0);
FiniteDifferencePropagatorConverter fitter = new
FiniteDifferencePropagatorConverter(builder, threshold, maxIterations);
Collection<String> freeParameters =
fitter.getAvailableParameters();
fitter.convert(sample, positionOnly, freeParameters);
TLEPropagator prop =
(TLEPropagator)fitter.getAdaptedPropagator();
//The final TLE
TLE fitted = prop.getTLE();
From what I have tested so far, it does better with more circular orbits. Let
me know if you see anything wrong, if not then this can serve as an
example in
case someone else has the same question later on.
Sure. If you want to contribute a wiki page on this topic, you're welcome.
best regards,
Luc
Thanks again,
Matt
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.