use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class OPMParserTest method testParseOPM2.
@Test
public void testParseOPM2() throws OrekitException {
// simple test for OPM file, contains all mandatory information plus
// Keplerian elements, Spacecraft parameters and 2 maneuvers.
final String ex = "/ccsds/OPMExample2.txt";
final OPMParser parser = new OPMParser();
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OPMFile file = parser.parse(inEntry, "OPMExample2.txt");
try {
file.getConventions();
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS, oe.getSpecifier());
}
// Check Header Block;
Assert.assertEquals(2.0, file.getFormatVersion(), 1.0e-10);
ArrayList<String> headerComment = new ArrayList<String>();
headerComment.add("Generated by GSOC, R. Kiehling");
headerComment.add("Current intermediate orbit IO2 and maneuver planning data");
Assert.assertEquals(headerComment, file.getHeaderComment());
Assert.assertEquals(new AbsoluteDate(2000, 06, 03, 05, 33, 00, TimeScalesFactory.getUTC()), file.getCreationDate());
Assert.assertEquals(file.getOriginator(), "GSOC");
// Check Metadata Block;
Assert.assertEquals("EUTELSAT W4", file.getMetaData().getObjectName());
Assert.assertEquals("2000-028A", file.getMetaData().getObjectID());
Assert.assertEquals("EARTH", file.getMetaData().getCenterName());
Assert.assertTrue(file.getMetaData().getHasCreatableBody());
Assert.assertEquals(CelestialBodyFactory.getEarth(), file.getMetaData().getCenterBody());
Assert.assertEquals(FramesFactory.getGCRF(), file.getMetaData().getFrame());
Assert.assertEquals(CcsdsTimeScale.GPS, file.getMetaData().getTimeSystem());
Assert.assertEquals(0, file.getMetaDataComment().size());
// Check Data State Vector block
ArrayList<String> epochComment = new ArrayList<String>();
epochComment.add("State Vector");
Assert.assertEquals(epochComment, file.getEpochComment());
Assert.assertEquals(new AbsoluteDate(2006, 06, 03, 00, 00, 00, TimeScalesFactory.getGPS()), file.getEpoch());
checkPVEntry(new PVCoordinates(new Vector3D(6655994.2, -40218575.1, -82917.7), new Vector3D(3115.48208, 470.42605, -1.01495)), file.getPVCoordinates());
// Check Data Keplerian Elements block
Assert.assertTrue(file.hasKeplerianElements());
ArrayList<String> keplerianElementsComment = new ArrayList<String>();
keplerianElementsComment.add("Keplerian elements");
Assert.assertEquals(keplerianElementsComment, file.getKeplerianElementsComment());
Assert.assertEquals(41399512.3, file.getA(), 1e-6);
Assert.assertEquals(0.020842611, file.getE(), 1e-10);
Assert.assertEquals(FastMath.toRadians(0.117746), file.getI(), 1e-10);
Assert.assertEquals(FastMath.toRadians(17.604721), file.getRaan(), 1e-10);
Assert.assertEquals(FastMath.toRadians(218.242943), file.getPa(), 1e-10);
Assert.assertEquals(PositionAngle.TRUE, file.getAnomalyType());
Assert.assertEquals(FastMath.toRadians(41.922339), file.getAnomaly(), 1e-10);
Assert.assertEquals(398600.4415 * 1e9, file.getMuParsed(), 1e-10);
// Check Data Spacecraft block
ArrayList<String> spacecraftComment = new ArrayList<String>();
spacecraftComment.add("Spacecraft parameters");
Assert.assertEquals(spacecraftComment, file.getSpacecraftComment());
Assert.assertEquals(1913.000, file.getMass(), 1e-10);
Assert.assertEquals(10.000, file.getSolarRadArea(), 1e-10);
Assert.assertEquals(1.300, file.getSolarRadCoeff(), 1e-10);
Assert.assertEquals(10.000, file.getDragArea(), 1e-10);
Assert.assertEquals(2.300, file.getDragCoeff(), 1e-10);
// Check Data Maneuvers block
Assert.assertTrue(file.getHasManeuver());
Assert.assertEquals(3, file.getNbManeuvers());
ArrayList<String> stateManeuverComment0 = new ArrayList<String>();
stateManeuverComment0.add("2 planned maneuvers");
stateManeuverComment0.add("First maneuver: AMF-3");
stateManeuverComment0.add("Non-impulsive, thrust direction fixed in inertial frame");
Assert.assertEquals(stateManeuverComment0, file.getManeuver(0).getComment());
Assert.assertEquals(new AbsoluteDate(2000, 06, 03, 9, 00, 34.1, TimeScalesFactory.getGPS()), file.getManeuvers().get(0).getEpochIgnition());
Assert.assertEquals(132.6, file.getManeuver(0).getDuration(), 1e-10);
Assert.assertEquals(-18.418, file.getManeuver(0).getDeltaMass(), 1e-10);
Assert.assertNull(file.getManeuver(0).getRefLofType());
Assert.assertEquals(FramesFactory.getEME2000(), file.getManeuver(0).getRefFrame());
Assert.assertEquals(0.0, new Vector3D(-23.25700, 16.83160, -8.93444).distance(file.getManeuver(0).getDV()), 1.0e-10);
ArrayList<String> stateManeuverComment1 = new ArrayList<String>();
stateManeuverComment1.add("Second maneuver: first station acquisition maneuver");
stateManeuverComment1.add("impulsive, thrust direction fixed in RTN frame");
Assert.assertEquals(stateManeuverComment1, file.getManeuver(1).getComment());
Assert.assertEquals(new AbsoluteDate(2000, 06, 05, 18, 59, 21, TimeScalesFactory.getGPS()), file.getManeuvers().get(1).getEpochIgnition());
Assert.assertEquals(0.0, file.getManeuver(1).getDuration(), 1e-10);
Assert.assertEquals(-1.469, file.getManeuver(1).getDeltaMass(), 1e-10);
Assert.assertEquals(LOFType.QSW, file.getManeuver(1).getRefLofType());
Assert.assertNull(file.getManeuver(1).getRefFrame());
Assert.assertEquals(0.0, new Vector3D(1.015, -1.873, 0.0).distance(file.getManeuver(1).getDV()), 1.0e-10);
Assert.assertTrue(file.getManeuver(2).getComment().isEmpty());
Assert.assertEquals(new AbsoluteDate(2000, 06, 05, 18, 59, 51, TimeScalesFactory.getGPS()), file.getManeuvers().get(2).getEpochIgnition());
Assert.assertEquals(0.0, file.getManeuver(2).getDuration(), 1e-10);
Assert.assertEquals(-1.469, file.getManeuver(2).getDeltaMass(), 1e-10);
Assert.assertEquals(LOFType.QSW, file.getManeuver(2).getRefLofType());
Assert.assertNull(file.getManeuver(2).getRefFrame());
Assert.assertEquals(0.0, new Vector3D(1.015, -1.873, 0.0).distance(file.getManeuver(2).getDV()), 1.0e-10);
file.generateCartesianOrbit();
file.generateKeplerianOrbit();
file.generateSpacecraftState();
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class TDMParserTest method testMetaDataNumberFormatErrorTypeKeyValue.
@Test
public void testMetaDataNumberFormatErrorTypeKeyValue() {
try {
// Number format exception in metadata part
final String ex = "/ccsds/TDM-metadata-number-format-error.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final TDMParser parser = new TDMParser();
parser.parse(inEntry, ex);
Assert.fail("An Orekit Exception \"UNABLE_TO_PARSE_LINE_IN_FILE\" should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE, oe.getSpecifier());
Assert.assertEquals(17, oe.getParts()[0]);
Assert.assertEquals("/ccsds/TDM-metadata-number-format-error.txt", oe.getParts()[1]);
Assert.assertEquals(String.format("\t%s", "TRANSMIT_DELAY_1 = this-is-not-a-number"), oe.getParts()[2]);
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class TDMParserTest method testDataNumberFormatErrorTypeKeyValue.
@Test
public void testDataNumberFormatErrorTypeKeyValue() {
try {
// Number format exception in data part
final String ex = "/ccsds/TDM-data-number-format-error.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final TDMParser parser = new TDMParser();
parser.parse(inEntry, ex);
Assert.fail("An Orekit Exception \"UNABLE_TO_PARSE_LINE_IN_FILE\" should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE, oe.getSpecifier());
Assert.assertEquals(26, oe.getParts()[0]);
Assert.assertEquals("/ccsds/TDM-data-number-format-error.txt", oe.getParts()[1]);
Assert.assertEquals(String.format("\t%s", "RECEIVE_FREQ_1 = 2005-159T17:41:03 this-is-not-a-number"), oe.getParts()[2]);
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class TDMParserTest method testWrongMetaDataKeywordKeyValue.
@Test
public void testWrongMetaDataKeywordKeyValue() throws OrekitException, URISyntaxException {
// Unknown CCSDS keyword was read in data part
final String ex = "/ccsds/TDM-metadata-wrong-keyword.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
try {
new TDMParser().parse(inEntry, ex);
Assert.fail("An exception \"CCSDS_UNEXPECTED_KEYWORD\"should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNEXPECTED_KEYWORD, oe.getSpecifier());
Assert.assertEquals(16, oe.getParts()[0]);
Assert.assertEquals("/ccsds/TDM-metadata-wrong-keyword.txt", oe.getParts()[1]);
Assert.assertEquals(String.format("\t%s", "WRONG_KEYWORD = 32021035200.0"), oe.getParts()[2]);
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class TDMParserTest method testWrongDataKeywordXml.
@Test
public void testWrongDataKeywordXml() throws OrekitException, URISyntaxException {
// Unknown CCSDS keyword was read in data part
final String ex = "/ccsds/XML/TDM-data-wrong-keyword.xml";
final InputStream inEntry = getClass().getResourceAsStream(ex);
try {
new TDMParser().parse(inEntry, ex);
Assert.fail("An exception \"CCSDS_UNEXPECTED_KEYWORD\"should have been thrown");
} catch (OrekitException oe) {
String specifier = String.format("%s\n%s", "unexpected keyword in CCSDS line number 47 of file /ccsds/XML/TDM-data-wrong-keyword.xml:", "<WRONG_KEYWORD>");
Assert.assertEquals(specifier, oe.getMessage());
}
}
Aggregations