Hi!
A while ago, I wrote some code for satellite detection from another satellite (Observations from satellite). Now, I want to take it a step further and simulate my own satellite (using Keplerian Orbit). I figured it would be as easy as replacing TLEPropagator with KeplerianPropagator, but I can’t get it to work. What I need as an output is PVCoordinates in EME of every satellite from my catalog that passes through the simulated primary satellite’s field of view and PVCoordinates in EME of the primary satellite whenever detection happens. Here are snippets from my code:
public class SatelliteProp {
private static final double SEMI_MAJOR_AXIS = 6378137.0 + 630000;
private static final double ECCENTRICITY = 0.001;
private static final double INCLINATION = Math.toRadians(51.9);
private static final double PERIGEE_ARGUMENT = 0.0;
private static final double RIGHT_ASCENSION = Math.toRadians(0);
private static final double MEAN_ANOMALY = 0.0;
private static final double MU = 3.986004415e+14;
private static final Frame EME = FramesFactory.getEME2000();
public Orbit CreateOrbit(AbsoluteDate t0) {
return new KeplerianOrbit(this.SEMI_MAJOR_AXIS, this.ECCENTRICITY, this.INCLINATION, this.PERIGEE_ARGUMENT,
this.RIGHT_ASCENSION, this.MEAN_ANOMALY, PositionAngle.TRUE, this.EME, t0, this.MU);
}
}
//OTHER CODE HERE
Orbit initialOrbit = new SatelliteProp().CreateOrbit(t0);
KeplerianPropagator PmPropagator;
AttitudeProvider attProv;
// TLEs is an ArrayList with TLEs of satellites to detect
for (TLE myTle : this.TLEs) {
PmPropagator = new KeplerianPropagator(initialOrbit);
attProv = new LofOffset(EME, LOFType.TNW);
PmPropagator.setAttitudeProvider(attProv);
TLEPropagator propagator = TLEPropagator.selectExtrapolator(myTle);
TLEPropagator propagator2 = TLEPropagator.selectExtrapolator(myTle);
propagator.setAttitudeProvider(attProv);
propagator2.setAttitudeProvider(attProv);
// This method creates double dihedral field of view detector that is aligned with velocity, and has 10x15 degrees dimensions
FieldOfViewDetector fovd = addDetector(propagator2, 0., 90., 10., 15.);
EclipseDetector2 ecd = new EclipseDetector2(
propagator2, sun, Constants.SUN_RADIUS, earth
).withPenumbra().withHandler(new ContinueOnEvent<>());
InterSatDirectViewDetector isdvd = new InterSatDirectViewDetector(earth, propagat
BooleanDetector newDetector = BooleanDetector.andCombine(
BooleanDetector.notCombine(fovd), isdvd, ecd
);
final Generator generator = new Generator();
ObservableSatellite sat1 = generator.addPropagator(PmPropagator);
ObservableSatellite sat2 = generator.addPropagator(propagator);
PVBuilder PBuilder = new PVBuilder(null, 0, 0, 1, s
EventBasedScheduler<PV> scheduler = new EventBasedS
PBuilder, new FixedStepSelector(this.step,
PmPropagator, newDetector,
SignSemantic.FEASIBLE_MEASUREMENT_WHEN_POSI
);
generator.addScheduler(scheduler);
SortedSet<ObservedMeasurement<?>> data = generator.generate(t0, t1);
for (final ObservedMeasurement<?> meas : data) {
final PV pos = (PV) meas;
Vector3D new_pos = pos.getPosition();
Vector3D new_vel = pos.getVelocity();
AbsoluteDate date = pos.getDate();
// Program stops here without any errors - the only way I got it to work is to create new propagator from initial orbit but that seems wrong to me
PVCoordinates PmCoords = PmPropagator.getPVCoordinates(date, EME);
// SOME OTHER CODE HERE
Any suggestions on how to make it work, and how to make it better and faster, are appreciated.