Skip to content
Snippets Groups Projects
Commit 4a5cc852 authored by sesteves's avatar sesteves
Browse files

resolved conflicts

parent e0488d78
No related branches found
No related tags found
No related merge requests found
Showing
with 71 additions and 26 deletions
...@@ -21,8 +21,8 @@ package org.orekit.rugged.atmosphericrefraction; ...@@ -21,8 +21,8 @@ package org.orekit.rugged.atmosphericrefraction;
* *
* @author Sergio Esteves * @author Sergio Esteves
*/ */
public class ConstantRefractionLayer { public class ConstantRefractionLayer implements Comparable<ConstantRefractionLayer> {
private double lowestAltitude; private Double lowestAltitude;
private double refractiveIndex; private double refractiveIndex;
public ConstantRefractionLayer(double lowestAltitude, double refractiveIndex) { public ConstantRefractionLayer(double lowestAltitude, double refractiveIndex) {
...@@ -37,4 +37,9 @@ public class ConstantRefractionLayer { ...@@ -37,4 +37,9 @@ public class ConstantRefractionLayer {
public double getRefractiveIndex() { public double getRefractiveIndex() {
return refractiveIndex; return refractiveIndex;
} }
@Override
public int compareTo(ConstantRefractionLayer o) {
return lowestAltitude.compareTo(o.lowestAltitude);
}
} }
...@@ -21,11 +21,13 @@ import org.apache.commons.math3.util.FastMath; ...@@ -21,11 +21,13 @@ import org.apache.commons.math3.util.FastMath;
import org.orekit.bodies.GeodeticPoint; import org.orekit.bodies.GeodeticPoint;
import org.orekit.errors.OrekitException; import org.orekit.errors.OrekitException;
import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedException;
import org.orekit.rugged.errors.RuggedMessages;
import org.orekit.rugged.intersection.IntersectionAlgorithm; import org.orekit.rugged.intersection.IntersectionAlgorithm;
import org.orekit.rugged.utils.ExtendedEllipsoid; import org.orekit.rugged.utils.ExtendedEllipsoid;
import org.orekit.rugged.utils.NormalizedGeodeticPoint; import org.orekit.rugged.utils.NormalizedGeodeticPoint;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -40,6 +42,9 @@ public class MultiLayerModel implements AtmosphericRefraction { ...@@ -40,6 +42,9 @@ public class MultiLayerModel implements AtmosphericRefraction {
/** Constant refraction layers */ /** Constant refraction layers */
private final List<ConstantRefractionLayer> refractionLayers; private final List<ConstantRefractionLayer> refractionLayers;
/** Atmosphere lowest altitude */
private final double atmosphereLowestAltitude;
public MultiLayerModel(final ExtendedEllipsoid ellipsoid) public MultiLayerModel(final ExtendedEllipsoid ellipsoid)
throws OrekitException { throws OrekitException {
this.ellipsoid = ellipsoid; this.ellipsoid = ellipsoid;
...@@ -60,14 +65,16 @@ public class MultiLayerModel implements AtmosphericRefraction { ...@@ -60,14 +65,16 @@ public class MultiLayerModel implements AtmosphericRefraction {
refractionLayers.add(new ConstantRefractionLayer( 1000.00, 1.000252)); refractionLayers.add(new ConstantRefractionLayer( 1000.00, 1.000252));
refractionLayers.add(new ConstantRefractionLayer( 0.00, 1.000278)); refractionLayers.add(new ConstantRefractionLayer( 0.00, 1.000278));
refractionLayers.add(new ConstantRefractionLayer( -1000.00, 1.000306)); refractionLayers.add(new ConstantRefractionLayer( -1000.00, 1.000306));
atmosphereLowestAltitude = refractionLayers.get(refractionLayers.size() - 1).getLowestAltitude();
} }
public MultiLayerModel(final ExtendedEllipsoid ellipsoid, final List<ConstantRefractionLayer> refractionLayers) public MultiLayerModel(final ExtendedEllipsoid ellipsoid, final List<ConstantRefractionLayer> refractionLayers)
throws OrekitException { throws OrekitException {
this.ellipsoid = ellipsoid; this.ellipsoid = ellipsoid;
// TODO guarantee that list is already ordered by altitude?
// TODO guarantee that a minimum altitude value exists?
this.refractionLayers = refractionLayers; this.refractionLayers = refractionLayers;
atmosphereLowestAltitude = refractionLayers.get(refractionLayers.size() - 1).getLowestAltitude();
Collections.sort(this.refractionLayers, Collections.<ConstantRefractionLayer>reverseOrder());
} }
@Override @Override
...@@ -77,6 +84,10 @@ public class MultiLayerModel implements AtmosphericRefraction { ...@@ -77,6 +84,10 @@ public class MultiLayerModel implements AtmosphericRefraction {
throws RuggedException { throws RuggedException {
try { try {
if(rawIntersection.getAltitude() < atmosphereLowestAltitude) {
throw new RuggedException(RuggedMessages.NO_LAYER_DATA, rawIntersection.getAltitude(),
atmosphereLowestAltitude);
}
Vector3D pos = satPos; Vector3D pos = satPos;
Vector3D los = satLos.normalize(); Vector3D los = satLos.normalize();
......
...@@ -27,6 +27,7 @@ import java.util.MissingResourceException; ...@@ -27,6 +27,7 @@ import java.util.MissingResourceException;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.apache.commons.math3.exception.util.Localizable;
/** /**
* Enumeration for localized messages formats. * Enumeration for localized messages formats.
...@@ -78,6 +79,7 @@ public enum RuggedMessages implements Localizable { ...@@ -78,6 +79,7 @@ public enum RuggedMessages implements Localizable {
NO_PARAMETERS_SELECTED("no parameters have been selected for estimation"), NO_PARAMETERS_SELECTED("no parameters have been selected for estimation"),
NO_REFERENCE_MAPPINGS("no reference mappings for parameters estimation"), NO_REFERENCE_MAPPINGS("no reference mappings for parameters estimation"),
DUPLICATED_PARAMETER_NAME("a different parameter with name {0} already exists"); DUPLICATED_PARAMETER_NAME("a different parameter with name {0} already exists");
NO_LAYER_DATA("no atmospheric layer data at altitude {0} (lowest altitude: {1})");
// CHECKSTYLE: resume JavadocVariable check // CHECKSTYLE: resume JavadocVariable check
......
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = no reference mappings for parameters estimation ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = no reference mappings for parameters estimation
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = a different parameter with name {0} already exists DUPLICATED_PARAMETER_NAME = a different parameter with name {0} already exists
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = no atmospheric layer data at altitude {0} (lowest altitude: {1})
\ No newline at end of file
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
\ No newline at end of file
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = aucune projection de référence pour l''estimation des ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = aucune projection de référence pour l''estimation des
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = il existe déjà un autre paramètre nommé {0} DUPLICATED_PARAMETER_NAME = il existe déjà un autre paramètre nommé {0}
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
\ No newline at end of file
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
\ No newline at end of file
...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION> ...@@ -81,3 +81,6 @@ NO_REFERENCE_MAPPINGS = <MISSING TRANSLATION>
# a different parameter with name {0} already exists # a different parameter with name {0} already exists
DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION> DUPLICATED_PARAMETER_NAME = <MISSING TRANSLATION>
# no atmospheric layer data at altitude {0} (lowest altitude: {1})
NO_LAYER_DATA = <MISSING TRANSLATION>
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
package org.orekit.rugged.atmosphericrefraction; package org.orekit.rugged.atmosphericrefraction;
import org.apache.commons.math3.geometry.Vector;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.FastMath;
import org.junit.Assert; import org.junit.Assert;
...@@ -30,6 +31,7 @@ import org.orekit.rugged.raster.TileUpdater; ...@@ -30,6 +31,7 @@ import org.orekit.rugged.raster.TileUpdater;
import org.orekit.rugged.utils.NormalizedGeodeticPoint; import org.orekit.rugged.utils.NormalizedGeodeticPoint;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class MultiLayerModelTest extends AbstractAlgorithmTest { public class MultiLayerModelTest extends AbstractAlgorithmTest {
...@@ -54,9 +56,9 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest { ...@@ -54,9 +56,9 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest {
// a test with indices all set to 1.0 - correction must be zero // a test with indices all set to 1.0 - correction must be zero
final int numberOfLayers = 15; final int numberOfLayers = 16;
List<ConstantRefractionLayer> refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers); List<ConstantRefractionLayer> refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
for(int i = numberOfLayers; i > 0; i--) { for(int i = numberOfLayers - 1; i >= 0; i--) {
refractionLayers.add(new ConstantRefractionLayer(i * 1.0e4, 1.0)); refractionLayers.add(new ConstantRefractionLayer(i * 1.0e4, 1.0));
} }
model = new MultiLayerModel(earth, refractionLayers); model = new MultiLayerModel(earth, refractionLayers);
...@@ -68,42 +70,43 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest { ...@@ -68,42 +70,43 @@ public class MultiLayerModelTest extends AbstractAlgorithmTest {
// an intentionally flawed atmosphere with refractive indices decreasing with altitude, // an intentionally flawed atmosphere with refractive indices decreasing with altitude,
// that should exhibit a LOS bending upwards // that should exhibit a LOS bending upwards
refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers); refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
for(int i = numberOfLayers; i > 0; i--) { for(int i = numberOfLayers - 1; i >= 0; i--) {
refractionLayers.add(new ConstantRefractionLayer(i * 1.0e4, 1.0 + i*i*1e-6)); refractionLayers.add(new ConstantRefractionLayer(i * 1.0e4, 1.0 + i*i*1e-6));
} }
model = new MultiLayerModel(earth, refractionLayers); model = new MultiLayerModel(earth, refractionLayers);
correctedIntersection = model.applyCorrection(position, los, rawIntersection, algorithm); correctedIntersection = model.applyCorrection(position, los, rawIntersection, algorithm);
distance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(correctedIntersection)); double anglePosRawIntersection = Vector3D.angle(position, earth.transform(rawIntersection));
Assert.assertEquals(0.0, distance, 0.5); double anglePosCorrectedIntersection = Vector3D.angle(position, earth.transform(correctedIntersection));
Assert.assertTrue(anglePosRawIntersection < anglePosCorrectedIntersection);
// a comparison between two atmospheres, one more dense than the other and showing correction // a comparison between two atmospheres, one more dense than the other and showing correction
// is more important with high indices // is more important with high indices
List<ConstantRefractionLayer> lessDenseRefracLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers); List<ConstantRefractionLayer> baseRefracLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
List<ConstantRefractionLayer> moreDenseRefracLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers); List<ConstantRefractionLayer> denserRefracLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
for(int i = numberOfLayers; i > 0; i--) { for(int i = numberOfLayers - 1; i >= 0; i--) {
double baseRefractiveIndex = FastMath.pow(numberOfLayers - i + 1, 2) * 1e-6; double baseRefractiveIndex = FastMath.pow(numberOfLayers - i + 1, 2) * 1e-6;
lessDenseRefracLayers.add(new ConstantRefractionLayer(i * 1.0e4, baseRefractiveIndex)); baseRefracLayers.add(new ConstantRefractionLayer(i * 1.0e4, baseRefractiveIndex));
moreDenseRefracLayers.add(new ConstantRefractionLayer(i * 1.0e4, baseRefractiveIndex + 1e-3)); denserRefracLayers.add(new ConstantRefractionLayer(i * 1.0e4, baseRefractiveIndex + 1e-3));
} }
MultiLayerModel lessDenseModel = new MultiLayerModel(earth, lessDenseRefracLayers); MultiLayerModel baseModel = new MultiLayerModel(earth, baseRefracLayers);
MultiLayerModel moreDenseModel = new MultiLayerModel(earth, moreDenseRefracLayers); MultiLayerModel denserModel = new MultiLayerModel(earth, denserRefracLayers);
GeodeticPoint lessDenseIntersection = lessDenseModel.applyCorrection(position, los, rawIntersection, algorithm); GeodeticPoint baseIntersection = baseModel.applyCorrection(position, los, rawIntersection, algorithm);
GeodeticPoint moreDenseIntersection = moreDenseModel.applyCorrection(position, los, rawIntersection, algorithm); GeodeticPoint denserIntersection = denserModel.applyCorrection(position, los, rawIntersection, algorithm);
double LDDistance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(lessDenseIntersection)); double baseDistance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(baseIntersection));
double MDDistance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(moreDenseIntersection)); double denserDistance = Vector3D.distance(earth.transform(rawIntersection),
earth.transform(denserIntersection));
// LDDistance: 2860.295484362817, MDDistance: 251.62683758334745 // denserDistance: 291.6042252928431, baseDistance: 2710.1036961651967
// Assert.assertTrue(MDDistance > LDDistance); Assert.assertTrue(denserDistance > baseDistance);
// a test with a single refraction layer // a test with a single refraction layer
refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers); refractionLayers = new ArrayList<ConstantRefractionLayer>(numberOfLayers);
refractionLayers.add(new ConstantRefractionLayer(600000, 1.2)); refractionLayers.add(new ConstantRefractionLayer(0, 1.2));
model = new MultiLayerModel(earth, refractionLayers); model = new MultiLayerModel(earth, refractionLayers);
correctedIntersection = model.applyCorrection(position, los, rawIntersection, algorithm); correctedIntersection = model.applyCorrection(position, los, rawIntersection, algorithm);
distance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(correctedIntersection)); distance = Vector3D.distance(earth.transform(rawIntersection), earth.transform(correctedIntersection));
Assert.assertEquals(0.0, distance, 0.0); Assert.assertEquals(0.0, distance, 0.0);
} }
@Override @Override
......
...@@ -30,7 +30,7 @@ public class RuggedMessagesTest { ...@@ -30,7 +30,7 @@ public class RuggedMessagesTest {
@Test @Test
public void testMessageNumber() { public void testMessageNumber() {
Assert.assertEquals(28, RuggedMessages.values().length); Assert.assertEquals(29, RuggedMessages.values().length);
} }
@Test @Test
......
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