Commit 7be62121 authored by Luc Maisonobe's avatar Luc Maisonobe

Put the propagators back into the generator.

Having a single propagator in the Scheduler does not fulfills
the need for inter satellites measurements.
parent 43c4545c
......@@ -58,6 +58,8 @@
end note
class Generator {
+int addPropagator(Propagator)
+Propagator getPropagator(index)
+addScheduler(Scheduler)
+SortedSet<ObservedMeasurements> generate(startDate, endDate)
}
......@@ -70,7 +72,6 @@
class "ContinuousScheduler<T>" as ContinuousScheduler_T_
interface "Scheduler<T>" as Scheduler_T_ {
+Propagator getPropagator()
+SortedSet<T> generate(interpolators)
}
......@@ -95,7 +96,7 @@
end note
EstimationModifier_T_ "*" <-left-* ObservedMeasurement_T_
EstimationModifier_T_ "*" <-left-* ObservedMeasurement_T_
ObservedMeasurement_T_ <|.. XXXMeasurement
XXXMeasurementBuilder --> XXXMeasurement
EstimationModifier_T_ "*" <--* XXXMeasurementBuilder
......@@ -109,8 +110,8 @@
propagate()
}
Generator --> PropagatorsParallelizer
Scheduler_T_ *--> "1" Propagator
Propagator <-- PropagatorsParallelizer
Generator *--> "*" Propagator
Propagator <-left- PropagatorsParallelizer
}
package time #DDEBD8 {
......
......@@ -17,7 +17,6 @@
package org.orekit.estimation.measurements.generation;
import org.orekit.estimation.measurements.ObservedMeasurement;
import org.orekit.propagation.Propagator;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.DatesSelector;
......@@ -35,20 +34,14 @@ public abstract class AbstractScheduler<T extends ObservedMeasurement<T>> implem
/** Selector for dates. */
private final DatesSelector selector;
/** Propagator associated with this scheduler. */
private final Propagator propagator;
/** Simple constructor.
* @param builder builder for individual measurements
* @param selector selector for dates
* @param propagator propagator associated with this scheduler
*/
protected AbstractScheduler(final MeasurementBuilder<T> builder,
final DatesSelector selector,
final Propagator propagator) {
this.builder = builder;
this.selector = selector;
this.propagator = propagator;
final DatesSelector selector) {
this.builder = builder;
this.selector = selector;
}
/** {@inheritDoc}
......@@ -75,10 +68,4 @@ public abstract class AbstractScheduler<T extends ObservedMeasurement<T>> implem
return selector;
}
/** {@inheritDoc} */
@Override
public Propagator getPropagator() {
return propagator;
}
}
......@@ -21,7 +21,6 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.orekit.estimation.measurements.ObservedMeasurement;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.sampling.OrekitStepInterpolator;
import org.orekit.time.AbsoluteDate;
......@@ -45,11 +44,9 @@ public class ContinuousScheduler<T extends ObservedMeasurement<T>> extends Abstr
/** Simple constructor.
* @param builder builder for individual measurements
* @param selector selector for dates
* @param propagator propagator associated with this scheduler
*/
public ContinuousScheduler(final MeasurementBuilder<T> builder, final DatesSelector selector,
final Propagator propagator) {
super(builder, selector, propagator);
public ContinuousScheduler(final MeasurementBuilder<T> builder, final DatesSelector selector) {
super(builder, selector);
}
/** {@inheritDoc} */
......
......@@ -85,7 +85,7 @@ public class EventBasedScheduler<T extends ObservedMeasurement<T>> extends Abstr
public EventBasedScheduler(final MeasurementBuilder<T> builder, final DatesSelector selector,
final Propagator propagator,
final EventDetector detector, final SignSemantic signSemantic) {
super(builder, selector, propagator);
super(builder, selector);
this.signSemantic = signSemantic;
this.feasibility = new TimeSpanMap<Boolean>(Boolean.FALSE);
this.forward = true;
......
......@@ -36,13 +36,34 @@ import org.orekit.time.AbsoluteDate;
*/
public class Generator {
/** Propagators. */
private final List<Propagator> propagators;
/** Sequences generators. */
private final List<Scheduler<?>> schedulers;
/** Build a generator with no sequences generator.
*/
public Generator() {
this.schedulers = new ArrayList<>();
this.propagators = new ArrayList<>();
this.schedulers = new ArrayList<>();
}
/** Add a propagator.
* @param propagator to add
* @return index of the propagator
*/
public int addPropagator(final Propagator propagator) {
propagators.add(propagator);
return propagators.size() - 1;
}
/** Get a registered propagator.
* @param index index of the propagator, as returned by {@link #addPropagator(Propagator)}
* @return propagator at index
*/
public Propagator getPropagator(final int index) {
return propagators.get(index);
}
/** Add a sequences generator for a specific measurement type.
......@@ -66,10 +87,6 @@ public class Generator {
}
// set up parallelized propagators
final List<Propagator> propagators = new ArrayList<>(schedulers.size());
for (final Scheduler<?> scheduler : schedulers) {
propagators.add(scheduler.getPropagator());
}
final GeneratorHandler handler = new GeneratorHandler(schedulers);
final PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(propagators, handler);
......
......@@ -20,7 +20,6 @@ import java.util.List;
import java.util.SortedSet;
import org.orekit.estimation.measurements.ObservedMeasurement;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.sampling.OrekitStepInterpolator;
import org.orekit.time.AbsoluteDate;
......@@ -44,11 +43,6 @@ public interface Scheduler<T extends ObservedMeasurement<T>> {
*/
void init(AbsoluteDate start, AbsoluteDate end);
/** Get the propagator associated with this scheduler.
* @return propagator associated with this scheduler
*/
Propagator getPropagator();
/** Generate a sequence of measurements.
* @param interpolators interpolators for spacecraft states
* @return generated measurements
......
......@@ -42,7 +42,8 @@ import org.orekit.time.TimeScalesFactory;
public abstract class AbstractGroundMeasurementBuilderTest<T extends ObservedMeasurement<T>> {
protected abstract MeasurementBuilder<T> getBuilder(RandomGenerator random,
GroundStation groundStation);
GroundStation groundStation,
int propagatorIndex);
private Propagator buildPropagator() {
return EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
......@@ -51,9 +52,10 @@ public abstract class AbstractGroundMeasurementBuilderTest<T extends ObservedMea
protected void doTest(long seed, double startPeriod, double endPeriod, int expectedMeasurements, double tolerance) {
Generator generator = new Generator();
final double step = 60.0;
generator.addScheduler(new EventBasedScheduler<>(getBuilder(new Well19937a(seed), context.stations.get(0)),
final int propagatorIndex = generator.addPropagator(buildPropagator());
generator.addScheduler(new EventBasedScheduler<>(getBuilder(new Well19937a(seed), context.stations.get(0), propagatorIndex),
new FixedStepSelector(step, TimeScalesFactory.getUTC()),
buildPropagator(),
generator.getPropagator(propagatorIndex),
new ElevationDetector(context.stations.get(0).getBaseFrame()).
withConstantElevation(FastMath.toRadians(5.0)).
withHandler(new ContinueOnEvent<>()),
......
......@@ -33,13 +33,15 @@ public class AngularAzElBuilderTest extends AbstractGroundMeasurementBuilderTest
private static final double BIAS = 1.0e-4;
protected MeasurementBuilder<AngularAzEl> getBuilder(final RandomGenerator random,
final GroundStation groundStation) {
final GroundStation groundStation,
final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { SIGMA * SIGMA, SIGMA * SIGMA });
MeasurementBuilder<AngularAzEl> ab =
new AngularAzElBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
groundStation, new double[] { SIGMA, SIGMA}, new double[] { 1.0, 1.0 }, 0);
groundStation, new double[] { SIGMA, SIGMA}, new double[] { 1.0, 1.0 },
propagatorIndex);
ab.addModifier(new Bias<>(new String[] { "aBias", "eBias" },
new double[] { BIAS, BIAS },
new double[] { 1.0, 1.0 },
......
......@@ -34,14 +34,16 @@ public class AngularRaDecBuilderTest extends AbstractGroundMeasurementBuilderTes
private static final double BIAS = 1.0e-4;
protected MeasurementBuilder<AngularRaDec> getBuilder(final RandomGenerator random,
final GroundStation groundStation) {
final GroundStation groundStation,
final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { SIGMA * SIGMA, SIGMA * SIGMA });
MeasurementBuilder<AngularRaDec> ab =
new AngularRaDecBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
groundStation, FramesFactory.getEME2000(),
new double[] { SIGMA, SIGMA}, new double[] { 1.0, 1.0 }, 0);
new double[] { SIGMA, SIGMA}, new double[] { 1.0, 1.0 },
propagatorIndex);
ab.addModifier(new Bias<>(new String[] { "aBias", "eBias" },
new double[] { BIAS, BIAS },
new double[] { 1.0, 1.0 },
......
......@@ -50,7 +50,7 @@ public class PVBuilderTest {
private static final double BIAS_P = 5.0;
private static final double BIAS_V = -0.003;
private MeasurementBuilder<PV> getBuilder(final RandomGenerator random) {
private MeasurementBuilder<PV> getBuilder(final RandomGenerator random, final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] {
SIGMA_P * SIGMA_P, SIGMA_P * SIGMA_P, SIGMA_P * SIGMA_P,
SIGMA_V * SIGMA_V, SIGMA_V * SIGMA_V, SIGMA_V * SIGMA_V,
......@@ -59,7 +59,7 @@ public class PVBuilderTest {
new PVBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
SIGMA_P, SIGMA_V, 1.0, 0);
SIGMA_P, SIGMA_V, 1.0, propagatorIndex);
pvb.addModifier(new Bias<>(new String[] { "pxBias", "pyBias", "pzBias", "vxBias", "vyBias", "vzBias" },
new double[] { BIAS_P, BIAS_P, BIAS_P, BIAS_V, BIAS_V, BIAS_V },
new double[] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 },
......@@ -90,10 +90,10 @@ public class PVBuilderTest {
final double highRateStep = 5.0;
final double burstPeriod = 300.0;
generator.addScheduler(new ContinuousScheduler<>(getBuilder(new Well19937a(seed)),
final int propagatorIndex = generator.addPropagator(buildPropagator());
generator.addScheduler(new ContinuousScheduler<>(getBuilder(new Well19937a(seed), propagatorIndex),
new BurstSelector(maxBurstSize, highRateStep, burstPeriod,
TimeScalesFactory.getUTC()),
buildPropagator()));
TimeScalesFactory.getUTC())));
final double period = context.initialOrbit.getKeplerianPeriod();
AbsoluteDate t0 = context.initialOrbit.getDate().shiftedBy(startPeriod * period);
AbsoluteDate t1 = context.initialOrbit.getDate().shiftedBy(endPeriod * period);
......
......@@ -48,7 +48,7 @@ public class PositionBuilderTest {
private static final double SIGMA = 10.0;
private static final double BIAS = 5.0;
private MeasurementBuilder<Position> getBuilder(final RandomGenerator random) {
private MeasurementBuilder<Position> getBuilder(final RandomGenerator random, final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] {
SIGMA * SIGMA, SIGMA * SIGMA, SIGMA * SIGMA
});
......@@ -56,7 +56,7 @@ public class PositionBuilderTest {
new PositionBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
SIGMA, 1.0, 0);
SIGMA, 1.0, propagatorIndex);
pb.addModifier(new Bias<>(new String[] { "pxBias", "pyBias", "pzBias" },
new double[] { BIAS, BIAS, BIAS },
new double[] { 1.0, 1.0, 1.0 },
......@@ -85,10 +85,10 @@ public class PositionBuilderTest {
final double highRateStep = 5.0;
final double burstPeriod = 300.0;
generator.addScheduler(new ContinuousScheduler<>(getBuilder(new Well19937a(seed)),
final int propagatorIndex = generator.addPropagator(buildPropagator());
generator.addScheduler(new ContinuousScheduler<>(getBuilder(new Well19937a(seed), propagatorIndex),
new BurstSelector(maxBurstSize, highRateStep, burstPeriod,
TimeScalesFactory.getUTC()),
buildPropagator()));
TimeScalesFactory.getUTC())));
final double period = context.initialOrbit.getKeplerianPeriod();
AbsoluteDate t0 = context.initialOrbit.getDate().shiftedBy(startPeriod * period);
AbsoluteDate t1 = context.initialOrbit.getDate().shiftedBy(endPeriod * period);
......
......@@ -32,13 +32,14 @@ public class RangeBuilderTest extends AbstractGroundMeasurementBuilderTest<Range
private static final double BIAS = 3.0;
protected MeasurementBuilder<Range> getBuilder(final RandomGenerator random,
final GroundStation groundStation) {
final GroundStation groundStation,
final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { SIGMA * SIGMA });
MeasurementBuilder<Range> rb =
new RangeBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
groundStation, true, SIGMA, 1.0, 0);
groundStation, true, SIGMA, 1.0, propagatorIndex);
rb.addModifier(new Bias<>(new String[] { "bias" },
new double[] { BIAS },
new double[] { 1.0 },
......
......@@ -32,13 +32,14 @@ public class RangeRateBuilderTest extends AbstractGroundMeasurementBuilderTest<R
private static final double BIAS = 0.002;
protected MeasurementBuilder<RangeRate> getBuilder(final RandomGenerator random,
final GroundStation groundStation) {
final GroundStation groundStation,
final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { SIGMA * SIGMA });
MeasurementBuilder<RangeRate> rrb =
new RangeRateBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
groundStation, true, SIGMA, 1.0, 0);
groundStation, true, SIGMA, 1.0, propagatorIndex);
rrb.addModifier(new Bias<>(new String[] { "bias" },
new double[] { BIAS },
new double[] { 1.0 },
......
......@@ -54,13 +54,14 @@ public class TurnAroundRangeBuilderTest {
private MeasurementBuilder<TurnAroundRange> getBuilder(final RandomGenerator random,
final GroundStation master,
final GroundStation slave) {
final GroundStation slave,
final int propagatorIndex) {
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { SIGMA * SIGMA });
MeasurementBuilder<TurnAroundRange> rb =
new TurnAroundRangeBuilder(random == null ? null : new CorrelatedRandomVectorGenerator(covariance,
1.0e-10,
new GaussianRandomGenerator(random)),
master, slave, SIGMA, 1.0, 0);
master, slave, SIGMA, 1.0, propagatorIndex);
rb.addModifier(new Bias<>(new String[] { "bias" },
new double[] { BIAS },
new double[] { 1.0 },
......@@ -89,9 +90,10 @@ public class TurnAroundRangeBuilderTest {
final Map.Entry<GroundStation, GroundStation> entry = context.TARstations.entrySet().iterator().next();
final GroundStation master = entry.getKey();
final GroundStation slave = entry.getValue();
generator.addScheduler(new EventBasedScheduler<>(getBuilder(new Well19937a(seed), master, slave),
final int propagatorIndex = generator.addPropagator(buildPropagator());
generator.addScheduler(new EventBasedScheduler<>(getBuilder(new Well19937a(seed), master, slave, propagatorIndex),
new FixedStepSelector(step, TimeScalesFactory.getUTC()),
buildPropagator(),
generator.getPropagator(propagatorIndex),
BooleanDetector.andCombine(new ElevationDetector(master.getBaseFrame()).
withConstantElevation(FastMath.toRadians(5.0)),
new ElevationDetector(slave.getBaseFrame()).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment