Commit 81b58079 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Merge branch 'develop' into ci-checkstyle

parents 0119b9b5 7c257500
Pipeline #1352 passed with stages
in 20 minutes and 9 seconds
......@@ -108,3 +108,14 @@ deploy:site:
- master@orekit/orekit
- /^release-[.0-9]+$/@orekit/orekit
- develop@orekit/orekit
# trigger performance tests after artifacts are deployed to Nexus
# similar to Jenkins' "build after a snapshot dependency is built"
performance:
stage: deploy
needs:
- job: deploy:artifacts
artifacts: false
trigger: evanward1/orekit-performance
only:
- develop@orekit/orekit
......@@ -21,6 +21,18 @@
</properties>
<body>
<release version="11.0" date="TBD" description="TBD">
<action dev="maxime" type="fix" issue="829">
Fixed DataSourceTest.testFileName for Windows users.
</action>
<action dev="bryan" type="fix" issue="818">
Use observed solar flux instead of adjusted in DTM2000 model.
</action>
<action dev="evan" type="fix" issue="798">
Allow DSST event detection when propagating backwards.
</action>
<action dev="bryan" type="fix" issue="717" due-to="evan">
Fixed DSST orbit determination when propagating backwards.
</action>
<action dev="evan" type="remove" issue="586">
Remove InertialProvider.EME2000_ALIGNED, Propagator.DEFAULT_LAW. Use
InertialProvider.of(Frame).
......
......@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets;
......@@ -105,6 +106,14 @@ public class DataSource {
this(file.getName(), () -> new FileInputStream(file));
}
/** Build an instance from URI only.
* @param uri URI of the file
* @since 11.0
*/
public DataSource(final URI uri) {
this(Paths.get(uri).toFile());
}
/** Get the name of the data.
* @return name of the data
*/
......
......@@ -193,29 +193,17 @@ public class CssiSpaceWeatherData extends AbstractSelfFeedingLoader
return previousValue * previousWeight + nextValue * nextWeight;
}
/** {@inheritDoc}
* For the DTM2000 model, we are using the adjusted flux
*/
/** {@inheritDoc} */
public double getInstantFlux(final AbsoluteDate date) {
// Interpolating two neighboring daily fluxes
// get the neighboring dates
bracketDate(date);
return getLinearInterpolation(date, previousParam.getF107Adj(), nextParam.getF107Adj());
return getLinearInterpolation(date, previousParam.getF107Obs(), nextParam.getF107Obs());
}
/** {@inheritDoc}
* For the DTM2000 model, we are using the adjusted flux
*/
/** {@inheritDoc} */
public double getMeanFlux(final AbsoluteDate date) {
if (date.compareTo(lastDailyPredictedDate) <= 0) {
bracketDate(date);
return previousParam.getCtr81Adj();
} else {
// Only monthly data is available, better interpolate between two months
// get the neighboring dates
bracketDate(date);
return getLinearInterpolation(date, previousParam.getCtr81Adj(), nextParam.getCtr81Adj());
}
return getAverageFlux(date);
}
/** {@inheritDoc} */
......@@ -266,10 +254,9 @@ public class CssiSpaceWeatherData extends AbstractSelfFeedingLoader
/**
* Gets the daily flux on the current day.
* For the NRLMSISE00 model, we are using the observed flux
*
* @param date the current date
* @return the daily F10.7 flux (adjusted)
* @return the daily F10.7 flux (observed)
*/
private double getDailyFluxOnDay(final AbsoluteDate date) {
if (date.compareTo(lastDailyPredictedDate) <= 0) {
......@@ -284,9 +271,7 @@ public class CssiSpaceWeatherData extends AbstractSelfFeedingLoader
}
}
/** {@inheritDoc}
* For the NRLMSISE00 model, we are using the observed flux
*/
/** {@inheritDoc} */
public double getAverageFlux(final AbsoluteDate date) {
if (date.compareTo(lastDailyPredictedDate) <= 0) {
bracketDate(date);
......
......@@ -20,12 +20,8 @@ import java.util.Collection;
import java.util.List;
import org.hipparchus.CalculusFieldElement;
import org.orekit.annotation.DefaultDataContext;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.attitudes.InertialProvider;
import org.orekit.data.DataContext;
import org.orekit.frames.Frame;
import org.orekit.frames.Frames;
import org.orekit.propagation.events.FieldEventDetector;
import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
import org.orekit.propagation.sampling.FieldOrekitStepHandler;
......
......@@ -20,10 +20,8 @@ import java.util.Collection;
import java.util.List;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.orekit.annotation.DefaultDataContext;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.attitudes.InertialProvider;
import org.orekit.data.DataContext;
import org.orekit.frames.Frame;
import org.orekit.frames.Frames;
import org.orekit.propagation.events.EventDetector;
......
......@@ -27,6 +27,12 @@ import org.orekit.utils.PVCoordinatesProvider;
/** Finder for target entry/exit events with respect to a satellite sensor
* {@link FieldOfView Field Of View}.
* <p>Beware that this detector is unaware of any bodies occluding line-of-sight to
* the target. It can be therefore used for many contexts from Earth Observation to
* interplanetary mission design. For instance, in an Earth Observation context,
* it can be easily combined to an {@link ElevationDetector} using
* {@link BooleanDetector#andCombine(java.util.Collection)} to calculate station
* visibility opportunities within the satellite's field of view.
* <p>The default implementation behavior is to {@link Action#CONTINUE continue}
* propagation at FOV entry and to {@link Action#STOP stop} propagation
* at FOV exit. This can be changed by calling
......
......@@ -1820,10 +1820,14 @@ public abstract class AbstractGaussianContribution implements DSSTForceModel {
final Slot slot = new Slot(jMax, interpolationPoints);
final AbsoluteDate first = meanStates[0].getDate();
final AbsoluteDate last = meanStates[meanStates.length - 1].getDate();
if (first.compareTo(last) <= 0) {
final int compare = first.compareTo(last);
if (compare < 0) {
slots.addValidAfter(slot, first);
} else {
} else if (compare > 0) {
slots.addValidBefore(slot, first);
} else {
// single date, valid for all time
slots.addValidAfter(slot, AbsoluteDate.PAST_INFINITY);
}
return slot;
}
......
......@@ -1733,10 +1733,14 @@ public class DSSTTesseral implements DSSTForceModel {
final Slot slot = new Slot(mMax, jMax, interpolationPoints);
final AbsoluteDate first = meanStates[0].getDate();
final AbsoluteDate last = meanStates[meanStates.length - 1].getDate();
if (first.compareTo(last) <= 0) {
final int compare = first.compareTo(last);
if (compare < 0) {
slots.addValidAfter(slot, first);
} else {
} else if (compare > 0) {
slots.addValidBefore(slot, first);
} else {
// single date, valid for all time
slots.addValidAfter(slot, AbsoluteDate.PAST_INFINITY);
}
return slot;
}
......
......@@ -3087,10 +3087,14 @@ public class DSSTThirdBody implements DSSTForceModel {
final Slot slot = new Slot(jMax, interpolationPoints);
final AbsoluteDate first = meanStates[0].getDate();
final AbsoluteDate last = meanStates[meanStates.length - 1].getDate();
if (first.compareTo(last) <= 0) {
final int compare = first.compareTo(last);
if (compare < 0) {
slots.addValidAfter(slot, first);
} else {
} else if (compare > 0) {
slots.addValidBefore(slot, first);
} else {
// single date, valid for all time
slots.addValidAfter(slot, AbsoluteDate.PAST_INFINITY);
}
return slot;
}
......
......@@ -1481,10 +1481,14 @@ public class DSSTZonal implements DSSTForceModel {
final Slot slot = new Slot(maxFrequencyShortPeriodics, interpolationPoints);
final AbsoluteDate first = meanStates[0].getDate();
final AbsoluteDate last = meanStates[meanStates.length - 1].getDate();
if (first.compareTo(last) <= 0) {
final int compare = first.compareTo(last);
if (compare < 0) {
slots.addValidAfter(slot, first);
} else {
} else if (compare > 0) {
slots.addValidBefore(slot, first);
} else {
// single date, valid for all time
slots.addValidAfter(slot, AbsoluteDate.PAST_INFINITY);
}
return slot;
}
......
......@@ -26,6 +26,7 @@ import java.io.Reader;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import org.junit.Assert;
import org.junit.Test;
......@@ -51,7 +52,7 @@ public class DataSourceTest {
@Test
public void testFileName() throws IOException, URISyntaxException {
URL url = DirectoryCrawlerTest.class.getClassLoader().getResource("regular-data/UTC-TAI.history");
DataSource ds = new DataSource(url.toURI().getPath());
DataSource ds = new DataSource(Paths.get(url.toURI()).toString());
Assert.assertTrue(ds.getName().endsWith("UTC-TAI.history"));
Assert.assertTrue(ds.getOpener().rawDataIsBinary());
try (InputStream is = ds.getOpener().openStreamOnce();
......@@ -73,6 +74,19 @@ public class DataSourceTest {
checkHistory(br);
}
}
@Test
public void testUri() throws IOException, URISyntaxException {
URL url = DirectoryCrawlerTest.class.getClassLoader().getResource("regular-data/UTC-TAI.history");
DataSource ds = new DataSource(url.toURI());
Assert.assertTrue(ds.getName().endsWith("UTC-TAI.history"));
Assert.assertTrue(ds.getOpener().rawDataIsBinary());
try (InputStream is = ds.getOpener().openStreamOnce();
InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
BufferedReader br = new BufferedReader(isr)) {
checkHistory(br);
}
}
@Test
public void testDirectInputStream() throws IOException {
......
......@@ -206,7 +206,7 @@ public class CssiSpaceWeatherLoaderTest {
CssiSpaceWeatherData cswl = loadCswl();
AbsoluteDate date = new AbsoluteDate(2000, 1, 1, 0, 0, 0.0, utc);
final double meanFlux = cswl.getMeanFlux(date);
assertThat(meanFlux, closeTo(158.6, 1e-10));
assertThat(meanFlux, closeTo(165.6, 1e-10));
}
@Test
......@@ -214,7 +214,7 @@ public class CssiSpaceWeatherLoaderTest {
CssiSpaceWeatherData cswl = loadCswl();
AbsoluteDate date = new AbsoluteDate(2034, 6, 16, 0, 0, 0.0, utc);
final double meanFlux = cswl.getMeanFlux(date);
assertThat(meanFlux, closeTo((134.8 + 138.8) / 2, 1e-3));
assertThat(meanFlux, closeTo((132.1 + 134.9) / 2, 1e-3));
}
@Test
......@@ -238,7 +238,7 @@ public class CssiSpaceWeatherLoaderTest {
CssiSpaceWeatherData cswl = loadCswl();
AbsoluteDate date = new AbsoluteDate(2000, 1, 1, 12, 0, 0.0, utc);
final double instantFlux = cswl.getInstantFlux(date);
assertThat(instantFlux, closeTo((125.6 + 128.5) / 2, 1e-10));
assertThat(instantFlux, closeTo((129.9 + 132.9) / 2, 1e-10));
}
/**
......
......@@ -38,6 +38,7 @@ import org.orekit.errors.OrekitMessages;
import org.orekit.forces.ForceModel;
import org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.ICGEMFormatReader;
import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
import org.orekit.frames.FramesFactory;
......@@ -49,6 +50,9 @@ import org.orekit.propagation.analytical.EcksteinHechlerPropagator;
import org.orekit.propagation.events.DateDetector;
import org.orekit.propagation.events.handlers.StopOnEvent;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.DateComponents;
import org.orekit.time.TimeComponents;
......@@ -59,6 +63,45 @@ import org.orekit.utils.IERSConventions;
public class PropagatorsParallelizerTest {
@Test
public void testIssue717() {
// Gravity
Utils.setDataRoot("regular-data:potential/icgem-format");
GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("^eigen-6s-truncated$", false));
UnnormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getUnnormalizedProvider(8, 8);
// Orbit
Orbit orbit = new KeplerianOrbit(15000000.0, 0.125, 1.25,
0.250, 1.375, 0.0625, PositionAngle.MEAN,
FramesFactory.getEME2000(),
new AbsoluteDate(2000, 2, 24, 11, 35, 47.0, TimeScalesFactory.getUTC()),
gravity.getMu());
// Propagator
final double[][] tol = DSSTPropagator.tolerances(0.01, orbit);
final DSSTPropagator propagator = new DSSTPropagator(new DormandPrince853Integrator(0.01, 600.0, tol[0], tol[1]), PropagationType.OSCULATING);
// Force models
final DSSTForceModel zonal = new DSSTZonal(gravity, 4, 3, 9);
propagator.addForceModel(zonal);
propagator.setInitialState(new SpacecraftState(orbit));
// Configure epochs in order to have a backward propagation mode
final double deltaT = 30.0;
final PropagatorsParallelizer parallelizer =
new PropagatorsParallelizer(Arrays.asList(propagator), interpolators -> {interpolators.get(0).getCurrentState().getDate();});
final SpacecraftState state = parallelizer.propagate(orbit.getDate().shiftedBy(deltaT).shiftedBy(+1.0), orbit.getDate().shiftedBy(-2.0 * deltaT).shiftedBy(-1.0)).get(0);
// Verify that the backward propagation worked properly
Assert.assertNotNull(state);
}
@Test
public void testNumericalNotInitialized() {
......
/*
* Licensed to the Hipparchus project under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.propagation.events;
import org.hipparchus.ode.ODEIntegrator;
import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.propagation.PropagationType;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTThirdBody;
import org.orekit.utils.Constants;
/** Test events with the DSST Propagator.
*
* @author Evan Ward
*/
public class CloseEventsDsstOsculatingTest extends CloseEventsAbstractTest {
@Override
public Propagator getPropagator(double stepSize) {
double[][] tol = DSSTPropagator.tolerances(1, initialOrbit);
ODEIntegrator integrator = new DormandPrince853Integrator(stepSize, stepSize, tol[0], tol[1]);
DSSTPropagator propagator = new DSSTPropagator(integrator, PropagationType.OSCULATING);
propagator.setInitialState(new SpacecraftState(initialOrbit));
double gm = Constants.EIGEN5C_EARTH_MU;
propagator.addForceModel(new DSSTThirdBody(CelestialBodyFactory.getMoon(), gm));
return propagator;
}
}
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