Skip to content
Snippets Groups Projects
Commit 8db8150a authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Merge branch 'master' of ssh://git@www.orekit.org/rugged-main.git

parents 9c2ad6e1 4d6fbc05
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,7 @@ import org.orekit.utils.ParameterDriver;
/** Replayer for Rugged debug dumps.
* @author Luc Maisonobe
* @author Guylaine Prat
* @see DumpManager
* @see Dump
*/
......@@ -1268,6 +1269,33 @@ public class DumpReplayer {
}
/** {@inheritDoc} */
@Override
public double getLine(final AbsoluteDate date) {
if (datation.size() < 2) {
return datation.get(0).getFirst();
}
// find entries bracketing the date
int sup = 0;
while (sup < datation.size() - 1) {
if (datation.get(sup).getSecond().compareTo(date) >= 0) {
break;
}
++sup;
}
final int inf = (sup == 0) ? sup++ : (sup - 1);
final double lInf = datation.get(inf).getFirst();
final AbsoluteDate dInf = datation.get(inf).getSecond();
final double lSup = datation.get(sup).getFirst();
final AbsoluteDate dSup = datation.get(sup).getSecond();
final double alpha = date.durationFrom(dInf) / dSup.durationFrom(dInf);
return alpha * lSup + (1 - alpha) * lInf;
}
/** Set a rate.
* @param lineNumber line number
* @param rate lines rate
......
......@@ -21,6 +21,7 @@ import org.orekit.time.AbsoluteDate;
/** Interface representing line datation model.
* @see LinearLineDatation
* @author Luc Maisonobe
* @author Guylaine Prat
*/
public interface LineDatation {
......@@ -30,6 +31,12 @@ public interface LineDatation {
*/
AbsoluteDate getDate(double lineNumber);
/** Get the line for a given date.
* @param date date
* @return line number
*/
double getLine(AbsoluteDate date);
/** Get the rate of lines scanning.
* @param lineNumber line number
* @return rate of lines scanning (lines / seconds)
......
......@@ -30,6 +30,7 @@ import org.orekit.utils.ParameterDriver;
/** Line sensor model.
* @author Luc Maisonobe
* @author Guylaine Prat
*/
public class LineSensor {
......@@ -121,6 +122,18 @@ public class LineSensor {
return date;
}
/** Get the line number.
* @param date date
* @return line number corresponding to date
* @exception RuggedException if date cannot be handled
*/
public double getLine(final AbsoluteDate date)
throws RuggedException {
final double lineNumber = datationModel.getLine(date);
DumpManager.dumpSensorDatation(this, lineNumber, date);
return lineNumber;
}
/** Get the rate of lines scanning.
* @param lineNumber line number
* @return rate of lines scanning (lines / seconds)
......
......@@ -24,6 +24,8 @@ import org.orekit.time.AbsoluteDate;
* Instances of this class are guaranteed to be immutable.
* </p>
* @author Luc Maisonobe
* @author Guylaine Prat
*/
public class LinearLineDatation implements LineDatation {
......@@ -54,6 +56,12 @@ public class LinearLineDatation implements LineDatation {
return referenceDate.shiftedBy((lineNumber - referenceLine) / rate);
}
/** {@inheritDoc} */
@Override
public double getLine(final AbsoluteDate date) {
return referenceLine + rate * date.durationFrom(referenceDate);
}
/** {@inheritDoc} */
@Override
public double getRate(final double lineNumber) {
......
......@@ -688,6 +688,14 @@ public class RuggedTest {
checkDateLocation(2000, true, false, 8.0e-7);
checkDateLocation(2000, true, true, 3.0e-6);
}
@Test
public void testLineDatation()
throws RuggedException, OrekitException, URISyntaxException {
checkLineDatation(2000, 7.0e-7);
checkLineDatation(10000, 8.0e-7);
}
@Test
public void testInverseLocNearLineEnd() throws OrekitException, RuggedException, URISyntaxException {
......@@ -1537,8 +1545,41 @@ public class RuggedTest {
-20 * gp2[dimension / 2].getLatitude() + 21 * gp3[dimension / 2].getLatitude(),
-20 * gp2[dimension / 2].getLongitude() + 21 * gp3[dimension / 2].getLongitude(),
0, dimension));
}
private void checkLineDatation(int dimension, double maxLineError)
throws RuggedException, OrekitException, URISyntaxException {
String path = getClass().getClassLoader().getResource("orekit-data").toURI().getPath();
DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(new File(path)));
AbsoluteDate crossing = new AbsoluteDate("2012-01-01T12:30:00.000", TimeScalesFactory.getUTC());
// one line sensor
// position: 1.5m in front (+X) and 20 cm above (-Z) of the S/C center of mass
// los: swath in the (YZ) plane, looking at 50° roll, 2.6" per pixel
Vector3D position = new Vector3D(1.5, 0, -0.2);
TimeDependentLOS los = TestUtils.createLOSPerfectLine(new Rotation(Vector3D.PLUS_I,
FastMath.toRadians(50.0),
RotationConvention.VECTOR_OPERATOR).applyTo(Vector3D.PLUS_K),
Vector3D.PLUS_I,
FastMath.toRadians(dimension * 2.6 / 3600.0), dimension).build();
// linear datation model: at reference time we get the middle line, and the rate is one line every 1.5ms
LineDatation lineDatation = new LinearLineDatation(crossing, dimension / 2, 1.0 / 1.5e-3);
int firstLine = 0;
int lastLine = dimension;
LineSensor lineSensor = new LineSensor("line", lineDatation, position, los);
AbsoluteDate minDate = lineSensor.getDate(firstLine).shiftedBy(-1.0);
AbsoluteDate maxDate = lineSensor.getDate(lastLine).shiftedBy(+1.0);
// Recompute the lines from the date with the appropriate shift of date
double recomputedFirstLine = lineSensor.getLine(minDate.shiftedBy(+1.0));
double recomputedLastLine = lineSensor.getLine(maxDate.shiftedBy(-1.0));
Assert.assertEquals(firstLine, recomputedFirstLine, maxLineError);
Assert.assertEquals(lastLine, recomputedLastLine, maxLineError);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment