Commit fabfad12 authored by Luc Maisonobe's avatar Luc Maisonobe

Changed initial value -> reference value in parameters drivers.

parent 647ee9f9
......@@ -38,7 +38,7 @@
+getBaseWeight()
+addModifier(modifier)
+getModifiers()
+evaluate(iteration, state)
+evaluate(iteration, count, state)
}
class Evaluation {
......
......@@ -49,9 +49,17 @@
class BatchLSEstimator {
+addMeasurement(measurement)
+getParametersDrivers()
+estimate(initialGuess)
+getOrbitalParametersDrivers()
+getPropagatorsParametersDrivers()
+getMeasurementsParametersDrivers()
+setObserver(observer)
+estimate()
}
interface BatchLSObserver {
+iterationPerformed()
}
class ODProblem
class MeasurementHandler
......@@ -62,6 +70,7 @@
BatchLSEstimator *-right-> ODProblem
LeastSquaresProblem <|-- ODProblem
LeastSquaresOptimizer <-- BatchLSEstimator : run
BatchLSEstimator *--> BatchLSObserver
}
package measurements #CEEBD8 {
......
......@@ -33,13 +33,21 @@
}
package utils #DDEBD8 {
abstract class ParametersDriver {
interface ParameterObserver {
+valueChanged(previousValue, driver)
}
class ParametersDriver {
+getName()
+getDimension()
+getReferenceValue()
+geMinValue()
+geMaxValue()
+geScale()
+[is|set]Estimated()
+[get|set]NormalizedValue()
+[get|set]Value()
#valueChanged()
+addObserver()
}
ParameterObserver <--o ParametersDriver : observers
}
package estimation #DDEBD8 {
......@@ -48,19 +56,17 @@
class BatchLSEstimator
}
ParametersDriver <-- BatchLSEstimator : change value
ParametersDriver <-- BatchLSEstimator : change normalized value
package measurement #CEEBD8 {
interface Measurement {
+getParametersDrivers()
}
class GroundStation {
#valueChanged()
}
class GroundStation
Range ..|> Measurement
RangeRate ..|> Measurement
GroundStation "1" <--o Range
GroundStation "1" <--o RangeRate
ParametersDriver <..* GroundStation : position offset
ParameterObserver <..* GroundStation : East/North/Zenith offsets
TopocentricFrame <--* GroundStation : updated on parameter change
}
......
......@@ -142,7 +142,7 @@ public class BatchLSEstimator {
* @return orbital parameters supported by this estimator
* @exception OrekitException if different parameters have the same name
*/
public ParameterDriversList getOrbitalParameters(final boolean estimatedOnly)
public ParameterDriversList getOrbitalParametersDrivers(final boolean estimatedOnly)
throws OrekitException {
if (estimatedOnly) {
......@@ -166,7 +166,7 @@ public class BatchLSEstimator {
* @return propagator parameters supported by this estimator
* @exception OrekitException if different parameters have the same name
*/
public ParameterDriversList getPropagatorParameters(final boolean estimatedOnly)
public ParameterDriversList getPropagatorParametersDrivers(final boolean estimatedOnly)
throws OrekitException {
if (estimatedOnly) {
......@@ -190,7 +190,7 @@ public class BatchLSEstimator {
* @return measurements parameters supported by this estimator
* @exception OrekitException if different parameters have the same name
*/
public ParameterDriversList getMeasurementsParameters(final boolean estimatedOnly)
public ParameterDriversList getMeasurementsParametersDrivers(final boolean estimatedOnly)
throws OrekitException {
final ParameterDriversList parameters = new ParameterDriversList();
......@@ -226,7 +226,7 @@ public class BatchLSEstimator {
* for all parameters since they are normalized and hence dimensionless.
* </p>
* <p>
* Normalized values are computed as {@code (current - initial)/scale},
* Normalized values are computed as {@code (current - reference)/scale},
* so convergence is reached when the following condition holds for
* all estimated parameters:
* {@code |current[i] - previous[i]| <= threshold * scale[i]}
......@@ -249,14 +249,14 @@ public class BatchLSEstimator {
/** Estimate the orbit and the parameters.
* <p>
* The initial guess for all parameters must have been set before calling this method
* using {@link #getOrbitalParameters(boolean)}, {@link #getPropagatorParameters(boolean)},
* and {@link #getMeasurementsParameters(boolean)} and then {@link ParameterDriver#setValue(double)
* using {@link #getOrbitalParametersDrivers(boolean)}, {@link #getPropagatorParametersDrivers(boolean)},
* and {@link #getMeasurementsParametersDrivers(boolean)} and then {@link ParameterDriver#setValue(double)
* setting the values} of the parameters.
* </p>
* <p>
* After this method returns, the estimated parameters can be retrieved using
* {@link #getOrbitalParameters(boolean)}, {@link #getPropagatorParameters(boolean)},
* and {@link #getMeasurementsParameters(boolean)} and then {@link ParameterDriver#getValue()
* {@link #getOrbitalParametersDrivers(boolean)}, {@link #getPropagatorParametersDrivers(boolean)},
* and {@link #getMeasurementsParametersDrivers(boolean)} and then {@link ParameterDriver#getValue()
* getting the values} of the parameters.
* </p>
* <p>
......@@ -271,9 +271,9 @@ public class BatchLSEstimator {
public NumericalPropagator estimate() throws OrekitException {
// get all estimated parameters
final ParameterDriversList estimatedOrbitalParameters = getOrbitalParameters(true);
final ParameterDriversList estimatedPropagatorParameters = getPropagatorParameters(true);
final ParameterDriversList estimatedMeasurementsParameters = getMeasurementsParameters(true);
final ParameterDriversList estimatedOrbitalParameters = getOrbitalParametersDrivers(true);
final ParameterDriversList estimatedPropagatorParameters = getPropagatorParametersDrivers(true);
final ParameterDriversList estimatedMeasurementsParameters = getMeasurementsParametersDrivers(true);
// create start point
final double[] start = new double[estimatedOrbitalParameters.getNbParams() +
......
......@@ -38,11 +38,11 @@ public class Bias<T extends Measurement<T>> implements EvaluationModifier<T> {
/** Simple constructor.
* @param name name of the bias
* @param bias initial value of the bias
* @param bias reference value of the bias
* @param scale scale of the bias, for normalization
* @param min minimum value of the bias
* @param max maximum value of the bias
* @exception OrekitException if initial value cannot be set
* @exception OrekitException if reference value cannot be set
*/
public Bias(final String[] name, final double[] bias, final double[] scale,
final double[] min, final double[] max)
......
......@@ -34,8 +34,8 @@ import org.orekit.errors.OrekitException;
* set of instances of this class so the algorithm can call the
* {@link #setValue(double[]) setValue} method to update the
* parameter value. Each time the value is set, the physical model
* will be notified as it will implement a specialized version of
* the {@link #valueChanged(double, double[]) valueChanged} method.
* will be notified as it will register a {@link ParameterObserver
* ParameterObserver} for this purpose.
* </p>
* <p>
* This design has two major goals. First, it allows an external
......@@ -55,8 +55,8 @@ public class ParameterDriver {
/** Name of the parameter. */
private final String name;
/** Initial value. */
private final double initialValue;
/** Reference value. */
private final double referenceValue;
/** Scaling factor. */
private final double scale;
......@@ -64,7 +64,7 @@ public class ParameterDriver {
/** Minimum value. */
private final double minValue;
/** MAximum value. */
/** Maximum value. */
private final double maxValue;
/** Current value. */
......@@ -83,27 +83,28 @@ public class ParameterDriver {
/** Simple constructor.
* <p>
* At construction, the parameter is configured as <em>not</em> selected.
* At construction, the parameter is configured as <em>not</em> selected,
* and the value is set to the {@code referenceValue}.
* </p>
* @param name name of the parameter
* @param initialValue initial value of the parameter
* @param referenceValue reference value of the parameter
* @param scale scaling factor to convert the parameters value to
* non-dimensional (typically set to the expected standard deviation of the
* parameter)
* @param minValue minimum value
* @param maxValue maximum value
*/
public ParameterDriver(final String name, final double initialValue,
public ParameterDriver(final String name, final double referenceValue,
final double scale, final double minValue,
final double maxValue) {
this.name = name;
this.initialValue = initialValue;
this.scale = scale;
this.minValue = minValue;
this.maxValue = maxValue;
this.value = initialValue;
this.selected = false;
this.observers = new ArrayList<ParameterObserver>();
this.name = name;
this.referenceValue = referenceValue;
this.scale = scale;
this.minValue = minValue;
this.maxValue = maxValue;
this.value = referenceValue;
this.selected = false;
this.observers = new ArrayList<ParameterObserver>();
}
......@@ -130,11 +131,11 @@ public class ParameterDriver {
return name;
}
/** Get initial parameter value.
* @return initial parameter value
/** Get reference parameter value.
* @return reference parameter value
*/
public double getInitialValue() {
return initialValue;
public double getReferenceValue() {
return referenceValue;
}
/** Get minimum parameter value.
......@@ -162,25 +163,25 @@ public class ParameterDriver {
* <p>
* The normalized value is a non-dimensional value
* suitable for use as part of a vector in an optimization
* process. It is computed as {@code (current - initial)/scale}.
* process. It is computed as {@code (current - reference)/scale}.
* </p>
* @return normalized value
*/
public double getNormalizedValue() {
return (value - initialValue) / scale;
return (value - referenceValue) / scale;
}
/** Set normalized value.
* <p>
* The normalized value is a non-dimensional value
* suitable for use as part of a vector in an optimization
* process. It is computed as {@code (current - initial)/scale}.
* process. It is computed as {@code (current - reference)/scale}.
* </p>
* @param normalized value
* @exception OrekitException if an observer throws one
*/
public void setNormalizedValue(final double normalized) throws OrekitException {
setValue(initialValue + scale * normalized);
setValue(referenceValue + scale * normalized);
}
/** Get current parameter value.
......
......@@ -137,7 +137,7 @@ public class ParameterDriversList {
* @exception OrekitException if first drivers throws one
*/
DelegatingDriver(final ParameterDriver driver) throws OrekitException {
super(driver.getName(), driver.getInitialValue(),
super(driver.getName(), driver.getReferenceValue(),
driver.getScale(), driver.getMinValue(), driver.getMaxValue());
drivers = new ArrayList<ParameterDriver>();
drivers.add(driver);
......
......@@ -435,8 +435,8 @@ public class OrbitDeterminationTest {
}
// parmaters and measurements.
final ParameterDriversList propagatorParameters = estimator.getPropagatorParameters(true);
final ParameterDriversList measurementsParameters = estimator.getMeasurementsParameters(true);
final ParameterDriversList propagatorParameters = estimator.getPropagatorParametersDrivers(true);
final ParameterDriversList measurementsParameters = estimator.getMeasurementsParametersDrivers(true);
//instation of results
return new ResultOD(propagatorParameters, measurementsParameters,
......
......@@ -152,14 +152,14 @@ public class NumericalConverterTest {
if (DragSensitive.DRAG_COEFFICIENT.equals(param)) {
// we want to adjust drag coefficient, we need to start from a wrong value
ParameterDriver driver = drag.getParameterDriver(param);
double coeff = driver.getInitialValue() - driver.getScale();
double coeff = driver.getReferenceValue() - driver.getScale();
guessedDrag = new DragForce(atmosphere, new IsotropicDrag(crossSection, coeff));
} else if (NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT.equals(param)) {
// we want to adjust mu, we need to start from a wrong value
guessedGravity = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true),
GravityFieldFactory.getNormalizedProvider(2, 0));
ParameterDriver driver = guessedGravity.getParameterDriver(param);
driver.setValue(driver.getInitialValue() + driver.getScale());
driver.setValue(driver.getReferenceValue() + driver.getScale());
}
}
builder.addForceModel(guessedDrag);
......
......@@ -113,7 +113,7 @@ public class PartialDerivativesTest {
propagator.setMu(provider.getMu());
for (final ForceModel forceModel : propagator.getAllForceModels()) {
for (final ParameterDriver driver : forceModel.getParametersDrivers()) {
driver.setValue(driver.getInitialValue());
driver.setValue(driver.getReferenceValue());
driver.setSelected(driver.getName().equals(parameterName));
}
}
......@@ -145,7 +145,7 @@ public class PartialDerivativesTest {
}
}
ParameterDriver selected = bound.getDrivers().get(0);
double p0 = selected.getInitialValue();
double p0 = selected.getReferenceValue();
double h = selected.getScale();
selected.setValue(p0 - 4 * h);
propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true),
......
......@@ -324,9 +324,9 @@ public class OrbitDetermination {
logStream.println("Estimated orbit: " + estimated);
}
final ParameterDriversList orbitalParameters = estimator.getOrbitalParameters(true);
final ParameterDriversList propagatorParameters = estimator.getPropagatorParameters(true);
final ParameterDriversList measurementsParameters = estimator.getMeasurementsParameters(true);
final ParameterDriversList orbitalParameters = estimator.getOrbitalParametersDrivers(true);
final ParameterDriversList propagatorParameters = estimator.getPropagatorParametersDrivers(true);
final ParameterDriversList measurementsParameters = estimator.getMeasurementsParametersDrivers(true);
int length = 0;
for (final ParameterDriver parameterDriver : orbitalParameters.getDrivers()) {
length = FastMath.max(length, parameterDriver.getName().length());
......@@ -428,7 +428,7 @@ public class OrbitDetermination {
} else {
factor = 1.0;
}
final double initial = parameter.getInitialValue();
final double initial = parameter.getReferenceValue();
final double value = parameter.getValue();
out.format(Locale.US, " %2d %s", ++index, parameter.getName());
for (int i = parameter.getName().length(); i < length; ++i) {
......
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