use of org.orekit.errors.OrekitException in project SpriteOrbits by ProjectPersephone.
the class SpriteProp method main.
/**
* @param args
*/
public static void main(String[] args) {
PrintStream out = null;
try {
// set up orekit data
// for this to work, the orekit-data.zip file avaiable at the following URL
// must be put in the current working directory
// URL: https://www.orekit.org/forge/projects/orekit/files
File userDir = new File(System.getProperty("user.dir"));
File orekitZip = new File(userDir, "orekit-data.zip");
DataProvidersManager.getInstance().addProvider(new ZipJarCrawler(orekitZip));
// reference models
// this is the frame labeled J2K in the NASA page
final Frame eme2000 = FramesFactory.getEME2000();
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final TimeScale utc = TimeScalesFactory.getUTC();
// central attraction coefficient MU
final double mu = Constants.EIGEN5C_EARTH_MU;
// set up some data, ideally, this should be provided as input to the program
// ISS orbit is from http://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html
//
// Coasting Arc #15 (Orbit 3386)
// ---------------------------------------
//
// Vector Time (GMT): 2014/055/16:27:06.921
// Vector Time (MET): N/A
// Weight (LBS) : 911651.1
//
// ...
//
// J2K Cartesian
// --------------------------------
// X = 2998767.75
// Y = -6097451.56 meter
// ... Z = -141448.92
// XDOT = 4323.077242
// YDOT = 1994.291706 meter/sec
// ZDOT = 6000.774574
// we start small, we can increase this later
final int numberOfSprites = 12;
// (m/s)
final double relativeReleaseVelocity = 1.0;
final AbsoluteDate releaseDate = new // year, month, day
AbsoluteDate(// year, month, day
2014, // year, month, day
3, // year, month, day
1, // hours, minutes, seconds
12, // hours, minutes, seconds
0, // hours, minutes, seconds
0.0, utc);
final CartesianOrbit kickSatOrbit = new CartesianOrbit(new // position (m)
PVCoordinates(// position (m)
new Vector3D(2998767.75, -6097451.56, -141448.92), // velocity (m/s)
new Vector3D(4323.077242, 1994.291706, 6000.774574)), eme2000, new // year, day in year as NASA page above
AbsoluteDate(// year, day in year as NASA page above
new DateComponents(2014, 55), // hour in day
new TimeComponents(16, 27, 6.921), utc), mu);
// kg
final double kickSatMass = 10.0;
// m^2
final double kickSatCrossSection = 0.03;
// no units
final double kickSatDragCoeff = 2.2;
// kg
final double spriteMass = 0.01;
// m^2
final double spriteCrossSection = 2.5e-3;
// no units
final double spriteDragCoeff = 2.2;
SpriteProp spriteProp = new SpriteProp(numberOfSprites, kickSatOrbit, kickSatMass, kickSatCrossSection, kickSatDragCoeff, spriteMass, spriteCrossSection, spriteDragCoeff, relativeReleaseVelocity, releaseDate, itrf);
// days after release
final double propagationDuration = 0.2;
// seconds
final double step = 60.0;
// out = new PrintStream(new File(userDir, "sprites-prop.txt"));
out = new PrintStream(new File(userDir, "orbits.json"));
out.format(Locale.US, "[");
spriteProp.run(out, propagationDuration, step, utc);
out.format(Locale.US, "]");
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (OrekitException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}
}
use of org.orekit.errors.OrekitException in project SpriteOrbits by ProjectPersephone.
the class SpritePropOrig method main.
/**
* @param args
*/
public static void main(String[] args) {
PrintStream out = null;
try {
// set up orekit data
// for this to work, the orekit-data.zip file avaiable at the following URL
// must be put in the current working directory
// URL: https://www.orekit.org/forge/projects/orekit/files
File userDir = new File(System.getProperty("user.dir"));
File orekitZip = new File(userDir, "orekit-data.zip");
DataProvidersManager.getInstance().addProvider(new ZipJarCrawler(orekitZip));
// reference models
// this is the frame labeled J2K in the NASA page
final Frame eme2000 = FramesFactory.getEME2000();
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final TimeScale utc = TimeScalesFactory.getUTC();
// central attraction coefficient MU
final double mu = Constants.EIGEN5C_EARTH_MU;
// set up some data, ideally, this should be provided as input to the program
// ISS orbit is from http://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html
//
// Coasting Arc #15 (Orbit 3386)
// ---------------------------------------
//
// Vector Time (GMT): 2014/055/16:27:06.921
// Vector Time (MET): N/A
// Weight (LBS) : 911651.1
//
// ...
//
// J2K Cartesian
// --------------------------------
// X = 2998767.75
// Y = -6097451.56 meter
// ... Z = -141448.92
// XDOT = 4323.077242
// YDOT = 1994.291706 meter/sec
// ZDOT = 6000.774574
// we start small, we can increase this later
final int numberOfSprites = 12;
// (m/s)
final double relativeReleaseVelocity = 1.0;
final AbsoluteDate releaseDate = new // year, month, day
AbsoluteDate(// year, month, day
2014, // year, month, day
3, // year, month, day
1, // hours, minutes, seconds
12, // hours, minutes, seconds
0, // hours, minutes, seconds
0.0, utc);
final CartesianOrbit kickSatOrbit = new CartesianOrbit(new // position (m)
PVCoordinates(// position (m)
new Vector3D(2998767.75, -6097451.56, -141448.92), // velocity (m/s)
new Vector3D(4323.077242, 1994.291706, 6000.774574)), eme2000, new // year, day in year as NASA page above
AbsoluteDate(// year, day in year as NASA page above
new DateComponents(2014, 55), // hour in day
new TimeComponents(16, 27, 6.921), utc), mu);
// kg
final double kickSatMass = 10.0;
// m^2
final double kickSatCrossSection = 0.03;
// no units
final double kickSatDragCoeff = 2.2;
// kg
final double spriteMass = 0.01;
// m^2
final double spriteCrossSection = 2.5e-3;
// no units
final double spriteDragCoeff = 2.2;
SpritePropOrig spriteProp = new SpritePropOrig(numberOfSprites, kickSatOrbit, kickSatMass, kickSatCrossSection, kickSatDragCoeff, spriteMass, spriteCrossSection, spriteDragCoeff, relativeReleaseVelocity, releaseDate, itrf);
// days after release
final double propagationDuration = 0.2;
// seconds
final double step = 60.0;
out = new PrintStream(new File(userDir, "sprites-prop.txt"));
spriteProp.run(out, propagationDuration, step, utc);
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (OrekitException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testWrongParameterRadiation.
@Test
public void testWrongParameterRadiation() throws OrekitException {
SpacecraftState state = propagator.getInitialState();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 1.0, 0.0);
try {
s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), Vector3D.PLUS_I, getRadiationParameters(s), "wrong");
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
Assert.assertEquals("wrong", (String) oe.getParts()[0]);
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class PolynomialParametricAccelerationTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
final double a = 24396159;
final double e = 0.72831215;
final double i = FastMath.toRadians(7);
final double omega = FastMath.toRadians(180);
final double OMEGA = FastMath.toRadians(261);
final double lv = 0;
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
initialOrbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, Constants.EIGEN5C_EARTH_MU);
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class MarshallSolarActivityFutureEstimationTest method testWithPropagator.
/**
* Check integration error is small when integrating the same equations over the same
* interval.
*
* @throws OrekitException on error.
*/
@Test
public void testWithPropagator() throws OrekitException {
CelestialBody sun = CelestialBodyFactory.getSun();
final Frame eci = FramesFactory.getGCRF();
final Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
AbsoluteDate date = new AbsoluteDate(2004, 1, 1, utc);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
Orbit orbit = new KeplerianOrbit(6378137 + 400e3, 1e-3, FastMath.toRadians(50), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU);
final SpacecraftState ic = new SpacecraftState(orbit);
final AbsoluteDate end = date.shiftedBy(5 * Constants.JULIAN_DAY);
final AbsoluteDate resetDate = date.shiftedBy(0.8 * Constants.JULIAN_DAY + 0.1);
final SpacecraftState[] lastState = new SpacecraftState[1];
final OrekitStepHandler stepSaver = (interpolator, isLast) -> {
final AbsoluteDate start = interpolator.getPreviousState().getDate();
if (start.compareTo(resetDate) < 0) {
lastState[0] = interpolator.getPreviousState();
}
};
// propagate with state rest to take slightly different path
NumericalPropagator propagator = getNumericalPropagator(sun, earth, ic);
propagator.setMasterMode(stepSaver);
propagator.propagate(resetDate);
propagator.resetInitialState(lastState[0]);
propagator.setSlaveMode();
final SpacecraftState actual = propagator.propagate(end);
// propagate straight through
propagator = getNumericalPropagator(sun, earth, ic);
propagator.resetInitialState(ic);
propagator.setSlaveMode();
final SpacecraftState expected = propagator.propagate(end);
assertThat(actual.getPVCoordinates(), pvCloseTo(expected.getPVCoordinates(), 1.0));
}
Aggregations