EventUsingAbstractDetector 4.4
De Wiki
Révision de 3 octobre 2019 à 11:57 par Admin (discussion | contributions) (Page créée avec « public class EventUsingAbstractDetector extends AbstractDetector { private static final long serialVersionUID = 1L; private final AbsoluteDate date; /**... »)
public class EventUsingAbstractDetector extends AbstractDetector {
private static final long serialVersionUID = 1L; private final AbsoluteDate date;
/** * Constructor * @param date absolute date when event will occured. */ protected EventUsingAbstractDetector( final AbsoluteDate date ) { super(AbstractDetector.DEFAULT_MAXCHECK, AbstractDetector.DEFAULT_THRESHOLD); this.date = date; }
@Override public Action eventOccurred(SpacecraftState s, boolean increasing, boolean forward) throws PatriusException { return EventDetector.Action.STOP; }
@Override public double g(SpacecraftState s) throws PatriusException { return s.getDate().durationFrom(date); }
@Override public boolean shouldBeRemoved() { return false; } @Override public EventDetector copy() { final AbsoluteDate newDate = new AbsoluteDate(date, 0.); return new EventUsingEventDetector(newDate); }
/** * @param args * @throws PatriusException * @throws URISyntaxException * @throws IOException */ public static void main(String[] args) throws PatriusException, IOException, URISyntaxException {
// Patrius Dataset initialization (needed for example to get the UTC time) PatriusDataset.addResourcesFromPatriusDataset() ;
// Recovery of the UTC time scale using a "factory" (not to duplicate such unique object) final TimeScale TUC = TimeScalesFactory.getUTC(); // Date of the orbit (given in UTC time scale) final AbsoluteDate date = new AbsoluteDate("2010-01-01T12:00:00.000", TUC);
EventUsingAbstractDetector event = new EventUsingAbstractDetector(date); System.out.println("Max check interval of the event: " + event.getMaxCheckInterval() + " s"); System.out.println("Threshold of the event: " + event.getThreshold() + " s"); System.out.println("Remove the event after occuring: " + event.shouldBeRemoved()); }
}