[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Users] My EventDetector class can't correct detecting event?



beowulf zhang <beowulf.zhang@gmail.com> a écrit :

I finded that the integrator called the class CombinedEventsManager
and EventState of the common-math, not those in the orekit5. why?

The NumericalPropagator in Orekit delegates everything to Apache Commons Math, including events and step handling. It only add wrappers to convert between the low level double arrays Apache Commons Math uses and the higher level SpacecraftState and AbsoluteDate Orekit uses.

The EventState class from Orekit is used by the non-numerical (i.e. analytical) propagtors, since they do not rely on any service provided by Apache Commons Math. The CombinedEventsDetectorsManager class is obsolete and is not used anymore, we should remove it.

Luc


2011/5/31, beowulf zhang <beowulf.zhang@gmail.com>:
I find recursive in debug, stack is:

ClassicalRungeKuttaIntegrator(RungeKuttaIntegrator).integrate(FirstOrderDifferentialEquations,
double, double[], double, double[]) line: 172
NumericalPropagator.propagate(AbsoluteDate) line: 419
NumericalPropagator.getPVCoordinates(AbsoluteDate, Frame) line: 462
LocalOrbitalFrame.updateFrame(AbsoluteDate) line: 81
EME2000Frame(Frame).getTransformTo(Frame, AbsoluteDate) line: 201
EquinoctialOrbit(Orbit).getPVCoordinates(Frame) line: 240
SpacecraftState.getPVCoordinates(Frame) line: 361
CWAxisYDetector.g(SpacecraftState) line: 37
AdaptedEventDetector.g(double, double[]) line: 74
EventState.reinitializeBegin(double, double[]) line: 152
CombinedEventsManager.evaluateStep(StepInterpolator) line: 142
ClassicalRungeKuttaIntegrator(RungeKuttaIntegrator).integrate(FirstOrderDifferentialEquations,
double, double[], double, double[]) line: 172
NumericalPropagator.propagate(AbsoluteDate) line: 419
SlaveMode.main(String[]) line: 138

Maybe this is a debug!

2011/5/31, beowulf zhang <beowulf.zhang@gmail.com>:
locOrbFrm object is referenced to another object.

My main function code is:

            // configure Orekit
            Autoconfiguration.configureOrekit();

            // Initial orbit parameters
            double a = 7396159; // semi major axis in meters
            double e = 0.001; // eccentricity
            double i = Math.toRadians(7); // inclination
            double omega = Math.toRadians(180); // perigee argument
            double raan = Math.toRadians(261); // right ascension of
ascending node
            double lM = 0; // mean anomaly

            // Inertial frame
            Frame inertialFrame = FramesFactory.getEME2000();

            // Initial date in UTC time scale
            TimeScale utc = TimeScalesFactory.getUTC();
            AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01,
23, 30, 00.000, utc);

            // gravitation coefficient
            double mu =  3.986004415e+14;


//////////////////////////////////////////////////////////////////////////////////
            // Orbit construction as Keplerian
            Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan,
lM,

KeplerianOrbit.MEAN_ANOMALY,
                                                    inertialFrame,
initialDate, mu);

            // Simple extrapolation with Keplerian motion
            //KeplerianPropagator kepler = new
KeplerianPropagator(initialOrbit);
            double stepSize = 9;  // the step is ten seconds
            FirstOrderIntegrator integrator = new
ClassicalRungeKuttaIntegrator(stepSize);
            NumericalPropagator prop = new
NumericalPropagator(integrator);
            SpacecraftState initialState = new
SpacecraftState(initialOrbit);
            prop.setInitialState(initialState);

            // Set the propagator to slave mode (could be omitted as
it is the default mode)
            prop.setSlaveMode();

            // 生成目标当地轨道系
            LocalOrbitalFrame lof = new
LocalOrbitalFrame(inertialFrame, LOFType.QSW, prop, "LOF");


//////////////////////////////////////////////////////////////////////////////////
            // 根据相对状态构造追踪星
            PVCoordinates relSt = new PVCoordinates(new
Vector3D(0.0,0.0,0.0),
            										new Vector3D(0.0,1.0,0.0));
            PVCoordinates initPV = lof.getTransformTo(inertialFrame,
            										  initialDate).transformPVCoordinates(relSt);

            // Simple extrapolation with Keplerian motion
            //KeplerianPropagator kepler = new
KeplerianPropagator(initialOrbit);
            FirstOrderIntegrator integratorS = new
ClassicalRungeKuttaIntegrator(stepSize);
            NumericalPropagator propS = new
NumericalPropagator(integratorS);
            SpacecraftState initialStateS = new SpacecraftState(new
CartesianOrbit(initPV,
            		inertialFrame, initialDate, mu));
            propS.setInitialState(initialStateS);

            // Set the propagator to slave mode (could be omitted as
it is the default mode)
            propS.setSlaveMode();
            propS.addEventDetector(new CWAxisYDetector(initialOrbit,
lof, initialDate));


//////////////////////////////////////////////////////////////////////////////////
            // Overall duration in seconds for extrapolation
            double duration = initialOrbit.getKeplerianPeriod() * 2.0;

            PrintWriter relFile = null;
            try {
				relFile = new PrintWriter("relst.txt");
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}

            // Stop date
            final AbsoluteDate finalDate =  new
AbsoluteDate(initialDate, duration, utc);

            // Extrapolation loop
            boolean first = true;
            AbsoluteDate extrapDate = initialDate;
            while (extrapDate.compareTo(finalDate) <= 0)  {

                SpacecraftState targ = prop.propagate(extrapDate);
                SpacecraftState inter = propS.propagate(extrapDate);
                PVCoordinates relst = inter.getPVCoordinates(lof);
                double tm = extrapDate.durationFrom(initialDate);
                relFile.printf("%f %f %f %f\n",
                		tm, relst.getPosition().getX(),
relst.getPosition().getY(), relst.getPosition().getZ());

                extrapDate = new AbsoluteDate(extrapDate, stepSize, utc);
            }

            relFile.close();
            System.out.println("The End");


2011/5/31, MAISONOBE Luc <luc.maisonobe@c-s.fr>:
beowulf zhang <beowulf.zhang@gmail.com> a écrit :

I write a class CWAxisYDetector derived from AbstractDetector, the code
is:

public class CWAxisYDetector extends AbstractDetector {

	private LocalOrbitalFrame locOrbFrm;

	private AbsoluteDate initDate;

	protected CWAxisYDetector(Orbit targOrb, LocalOrbitalFrame lof,
AbsoluteDate iDate) {
		super(targOrb.getKeplerianPeriod() / 3, 1.0e-13 *
targOrb.getKeplerianPeriod());
		this.locOrbFrm = lof;
		this.initDate = iDate;
	}

	public int eventOccurred(SpacecraftState s, boolean increasing)
			throws OrekitException {
		System.out.println(s.getDate().durationFrom(initDate));
		return CONTINUE;
	}

	public double g(SpacecraftState s) throws OrekitException {
		return s.getPVCoordinates(locOrbFrm).getPosition().getX();
	}

If the local orbital frame here is linked to the same spacecraft whose
orbit is propagated, then
s.getPVCoordinates(locOrbFrm).getPosition().getX() should always be 0
(as well as Y and Z since the spacecraft defines the origin of this
frame).
So the function is essentially an observation of numerical errors in
interpolation polynomials, it is not a function that clearly crosses
the zero axis at one precise time.

Are you sure about the frame ? Shouldn't it be related to another
spacecraft (for relative motion observation for example) ?

Luc


}

but this class can't correct detecting event, and in some integrate
step getinig error information:

Exception in thread "main"
org.apache.commons.math.MathRuntimeException$4: function values at
endpoints do not have different signs.  Endpoints: [0.539, 0.539],
Values: [0, 0]
	at
org.apache.commons.math.MathRuntimeException.createIllegalArgumentException(MathRuntimeException.java:305)
	at
org.apache.commons.math.analysis.solvers.BrentSolver.solve(BrentSolver.java:219)
	at
org.apache.commons.math.ode.events.EventState.evaluateStep(EventState.java:229)
	at
org.apache.commons.math.ode.events.CombinedEventsManager.evaluateStep(CombinedEventsManager.java:152)
	at
org.apache.commons.math.ode.nonstiff.RungeKuttaIntegrator.integrate(RungeKuttaIntegrator.java:172)
	at
org.orekit.propagation.numerical.NumericalPropagator.propagate(NumericalPropagator.java:419)
	at fr.cs.examples.propagation.SlaveMode.main(SlaveMode.java:136)

why?





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.










----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.