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

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



MAISONOBE Luc <luc.maisonobe@c-s.fr> a écrit :

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

locOrbFrm object is referenced to another object.

My main function code is:

[snip]

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

[snip]


           propS.addEventDetector(new CWAxisYDetector(initialOrbit,
lof, initialDate));

[snip]


               SpacecraftState targ = prop.propagate(extrapDate);
               SpacecraftState inter = propS.propagate(extrapDate);
               PVCoordinates relst = inter.getPVCoordinates(lof);

It seems the numerical propagator "prop" is called simultaneously from various places:

  - directly from your code to compute targ
  - somewhere from the other "propS" propagator through CWAxisYDetector
    which in turn uses lof, which is based on "prop"
  - somewhere in lof to compute relst

As this propagator is a numerical one, it stores the final state after each call, so it is probably not safe to have it driven by so many different callers which will use it back and forth in time, and sometimes with zero size steps.

In order to compute relative position in a two-propagators setup, I would suggest to not use LocalOrbitalFrame but instead to compute directly the canonical vectors along the following lines (it is only a rough guess, I did not check if the vectors I compute here are the good ones):

 PVCoordinates relInert = new PVCoordinates(inter.getPVCoordinates(),
                                            targ.getPVCoordinates());
 Vector3D q = inter.getPVCoordinates().getPosition().normalize();
 Vector3D w = inter.getPVCoordinates().getMomentum().normalize();
 Vector3D s  = Vector3D.crossProduct(w, q);
 PVCoordinates relst =
new PVCoordinates(new Vector3D(Vector3D.dotProduct(relInert.getPosition(), q), Vector3D.dotProduct(relInert.getPosition(), s), Vector3D.dotProduct(relInert.getPosition(), w)), new Vector3D(Vector3D.dotProduct(relInert.getPosition(), q), Vector3D.dotProduct(relInert.getPosition(), s), Vector3D.dotProduct(relInert.getPosition(), w)));

In fact, an even more elegant solution would be to use the SpacecraftState.toTransform method.

Luc



Luc


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





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