Dear Colleagues,

I am writing to ask for advice on propagating an orbit and getting results out from the propagator. Please bare in mind that this comes from someone quite new to Java and brand new to Orekit.

Let’s say that I am interested in calculating the semimajor axis and eccentricity of an orbit and also their respective standard deviations by propagating uncertainties with Orekit’s field methods.

Right now I use this structure together with a custom handleStep similar to the one in the Orekit FieldPropagation tutorial.

// propagation loop

for ( int i = 0; i < stepCnt; ++i ) {`System.out.printf( "step: %d%n", i ); // propagates s = prop.propagate( propDate ); semiMajHist[i] = s.getA().getReal(); eccHist[i] = s.getE().getReal(); // advances propagation time propDate = new FieldAbsoluteDate<>( startDate, (i + 1) * tStep, utc );`

} // for i

To my surprise, I found out that the PrintWriter called inside the handleStep writes the values of the standard deviation and eccentricity twice for steps 1 to stepCnt-1. I tried to find why this happened on my own by looking at the default handleStep but I couldn’t figure it out. I assumed that the handleStep is called twice, after step 0 and the workaround was to use the isLast boolean as a “fix” like so

if ( isLast ) {

PW.printf( “%f\t”, statSemiMaj.getStandardDeviation() );

PW.printf( “%f\t”, statEcc.getStandardDeviation() );

}

which worked to get results written once.

On the other hand, when I used

s = rop.propagate( startDate.shiftedBy( propParams.getDuration() ) );

the behavior of the stepHandler was the expected one and the uncertainties were written to file only once from 0 to stepCnt - 1.

Is this an expected behavior of the stepHandler? If it is, am I missing something fundamental in Java programming when I set a propagation loop as the one I pasted above?

Thank you!

BU