public class ParameterDriver extends Object
This class is typically used as a bridge between an estimation
algorithm (typically orbit determination or optimizer) and an
internal parameter in a physical model that needs to be tuned,
or a bridge between a finite differences algorithm and an
internal parameter in a physical model that needs to be slightly
offset. The physical model will expose to the algorithm a
set of instances of this class so the algorithm can call the
setValue(double)
method to update the
parameter value. Each time the value is set, the physical model
will be notified as it will register a ParameterObserver
for this purpose.
This design has two major goals. First, it allows an external algorithm to drive internal parameters almost anonymously, as it only needs to get a list of instances of this class, without knowing what they really drive. Second, it allows the physical model to not expose directly setters methods for its parameters. In order to be able to modify the parameter value, the algorithm must retrieve a parameter driver.
ParameterObserver
Constructor and Description |
---|
ParameterDriver(String name,
double referenceValue,
double scale,
double minValue,
double maxValue)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(ParameterObserver observer)
Add an observer for this driver.
|
double |
getMaxValue()
Get maximum parameter value.
|
double |
getMinValue()
Get minimum parameter value.
|
String |
getName()
Get name.
|
double |
getNormalizedValue()
Get normalized value.
|
List<ParameterObserver> |
getObservers()
Get the observers for this driver.
|
AbsoluteDate |
getReferenceDate()
Get current reference date.
|
double |
getReferenceValue()
Get reference parameter value.
|
double |
getScale()
Get scale.
|
double |
getValue()
Get current parameter value.
|
Gradient |
getValue(int freeParameters,
Map<String,Integer> indices)
Get the value as a gradient.
|
boolean |
isSelected()
Check if parameter is selected.
|
void |
removeObserver(ParameterObserver observer)
Remove an observer.
|
void |
replaceObserver(ParameterObserver oldObserver,
ParameterObserver newObserver)
Replace an observer.
|
void |
setMaxValue(double maxValue)
Set maximum parameter value.
|
void |
setMinValue(double minValue)
Set minimum parameter value.
|
void |
setName(String name)
Change the name of this parameter driver.
|
void |
setNormalizedValue(double normalized)
Set normalized value.
|
void |
setReferenceDate(AbsoluteDate newReferenceDate)
Set reference date.
|
void |
setReferenceValue(double referenceValue)
Set reference parameter value.
|
void |
setScale(double scale)
Set scale.
|
void |
setSelected(boolean selected)
Configure a parameter selection status.
|
void |
setValue(double newValue)
Set parameter value.
|
String |
toString()
Get a text representation of the parameter.
|
public ParameterDriver(String name, double referenceValue, double scale, double minValue, double maxValue)
At construction, the parameter is configured as not selected,
the reference date is set to null
and the value is set to the
referenceValue
.
name
- name of the parameterreferenceValue
- reference value of the parameterscale
- scaling factor to convert the parameters value to
non-dimensional (typically set to the expected standard deviation of the
parameter), it must be non-zerominValue
- minimum valuemaxValue
- maximum valuepublic void addObserver(ParameterObserver observer)
The observer valueChanged
method is called once automatically when the
observer is added, and then called at each value change.
observer
- observer to add
while being updatedpublic void removeObserver(ParameterObserver observer)
observer
- observer to removepublic void replaceObserver(ParameterObserver oldObserver, ParameterObserver newObserver)
oldObserver
- observer to replacenewObserver
- new observer to usepublic List<ParameterObserver> getObservers()
public void setName(String name)
name
- new namepublic String getName()
public double getReferenceValue()
public void setReferenceValue(double referenceValue)
referenceValue
- the reference value to set.public double getMinValue()
public void setMinValue(double minValue)
minValue
- the minimum value to set.public double getMaxValue()
public void setMaxValue(double maxValue)
maxValue
- the maximum value to set.public double getScale()
public void setScale(double scale)
scale
- the scale to set.public double getNormalizedValue()
The normalized value is a non-dimensional value
suitable for use as part of a vector in an optimization
process. It is computed as (current - reference)/scale
.
public void setNormalizedValue(double normalized)
The normalized value is a non-dimensional value
suitable for use as part of a vector in an optimization
process. It is computed as (current - reference)/scale
.
normalized
- valuepublic AbsoluteDate getReferenceDate()
public void setReferenceDate(AbsoluteDate newReferenceDate)
newReferenceDate
- new reference datepublic double getValue()
public Gradient getValue(int freeParameters, Map<String,Integer> indices)
freeParameters
- total number of free parameters in the gradientindices
- indices of the differentiation parameters in derivatives computationspublic void setValue(double newValue)
If newValue
is below getMinValue()
, it will
be silently set to getMinValue()
. If newValue
is
above getMaxValue()
, it will be silently set to getMaxValue()
.
newValue
- new valuepublic void setSelected(boolean selected)
Selection is used for estimated parameters in orbit determination, or to compute the Jacobian matrix in partial derivatives computation.
selected
- if true the parameter is selected,
otherwise it will be fixedpublic boolean isSelected()
Selection is used for estimated parameters in orbit determination, or to compute the Jacobian matrix in partial derivatives computation.
Copyright © 2002-2021 CS GROUP. All rights reserved.