I am a little confused by the epoch and the reference tle in the tle generation. For the stateToTLE method the epoch is taken from the state (and not from the reference tle). It seems like this is different for the fitted version, where I seem to get the epoch from the reference tle? the following code gives same epoch (that of reference tle) regardless of state. I think this behaviour should be explicitly written, and I would prefer to add a separate epoch somewhere, but maybe there is some way to do that?
builder = TLEPropagatorBuilder(ref_tle_obj, PositionAngle.MEAN, 1.0)
fitter = FiniteDifferencePropagatorConverter(builder, 1.0, 10000)
fitter.convert(states_list, True, "BSTAR")
prop = TLEPropagator.cast_(fitter.getAdaptedPropagator())
fitted_tle = prop.getTLE()
print("tle date:", fitted_tle.getDate())
I think that’s because these two methods have two different objectives.
The purpose of the
stateToTLE() method is to give the exact TLE corresponding to the input spacecraft state. That’s why it is expected to have the generated TLE at the same epoch as the input state.
The purpose of the fitted version is to give the best TLE that fits the fitting interval. As a result, the method needs an epoch of generation to generate the TLE. Because there is not a single spacecraft state here, the best solution is to use the epoch of the template TLE. But I agree, this should be written somewhere in the documentation. Probably the best place is to write this information in the documentation of the
FiniteDifferencePropagatorConverter class. An interesting solution could be to enhance the documentation with a small example showing how to generate a TLE using the class. What do you think?
Thanks for your reply and I see your point. We were using the template TLE from a previous TLE to get a starting point for the orbit fitting and thus the epoch would be relevant to those old parameters. In the end we regenerated the template TLE orbit parameters from the keplerian orbit of the first state in the list of statevectors to be fitted and the preferred epoch and it seems to be working well.
Yes I think examples of TLE fitting is a good thing, it is a common operation that is not available in so many other software packages, but it has a bit of threshold to get it right. The examples I have are in Python, I could share some of these but for the official documentation it is probably better to have them in java.
As a related sidenote - It indeed seems like the fitter is performing better if one also converts the statevectors from being based on PV coordinates to being based on Orbit class (as suggested in another thread).
Ok, I understand your issue. I think the only solution is to improve the documentation… Unfortunately, I don’t see an easy implementation, or an API to update, where the user can define both a template TLE and a target epoch for the fitted TLE. The only solution I see is to manually update the epoch of the template TLE.
Maybe somebody has a solution?
Meanwhile, could you open an issue on Gitlab in order to think about improving the documentation?