[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orekit Users] My EventDetector class can't correct detecting event?
- To: orekit-users@orekit.org
- Subject: Re: [Orekit Users] My EventDetector class can't correct detecting event?
- From: beowulf zhang <beowulf.zhang@gmail.com>
- Date: Sun, 5 Jun 2011 00:32:32 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=LffGi0XmaaAYZZ7mgr9RxMHbXCiP/3wnrxXhk4ClFPI=; b=f4PXxfRoPr7f9elnkM54jJxt/W0E4RlMOz8X//uLHEbEkM4aNiQ2VDSB2M91AbTVgF Ei67aZNP48RSAAYbsxLn07dhEhW8pW8WgjYqTe7GQ5BsoK6KnVWNbEJ3qG1SzSDS9/ya Ga5lhF1g3n585foLgbwVXZfFWdFwNSx+JnN34=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Y9GLOfX7gTgCo0ThOv59kV6eD3ysk+mHb3IO89SMqIQ8QNygTSM99Z/1Z46f/3CpQk ICf8eHoDJvKhsH0LRbYqh0DUZ1RDrQDNpHs2Xi3DtL/PED7mcKF9uOoOihvaJ0Qxr6Y6 iAenmkFBxuqust2TcGES/mFygUroVATwRp90Q=
- In-reply-to: <BANLkTi=7hGX8SSxPhMwNGr_V4hOHF1sOOg@mail.gmail.com>
- References: <BANLkTinP1f3iF2ucUVSxivqNYxq5imz_4Q@mail.gmail.com> <20110530203907.16372gd8s7dqvwi3@messagerie.si.c-s.fr> <BANLkTi=+fEhmNyVJkSQpM=tiGJRHan36EQ@mail.gmail.com> <BANLkTikE5fEZYSXhJ1u0kZryFEr5XNcYDQ@mail.gmail.com> <BANLkTi=RdPhJYRAQ_YByV5X3qmTeaE_bZg@mail.gmail.com> <20110603194339.16076lqiqyb9tgej@messagerie.si.c-s.fr> <BANLkTi=7hGX8SSxPhMwNGr_V4hOHF1sOOg@mail.gmail.com>
what I finded in my app is that the EventDetector.threshold is
sensitive, if the value is improper set, and the result is error.
2011/6/4, beowulf zhang <beowulf.zhang@gmail.com>:
> I see, Thank You!
>
> 2011/6/4, MAISONOBE Luc <luc.maisonobe@c-s.fr>:
>> 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.
>>
>>
>>
>