use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class OPMParserTest method testParseOPM3NoDesignator.
@Test
public void testParseOPM3NoDesignator() throws OrekitException, URISyntaxException {
final String name = getClass().getResource("/ccsds/OPM-no-designator.txt").toURI().getPath();
OPMParser parser = new OPMParser().withConventions(IERSConventions.IERS_2010).withInternationalDesignator(2060, 666, "XYZ");
final OPMFile file = parser.parse(name);
Assert.assertEquals(new AbsoluteDate(1998, 12, 18, 14, 28, 15.1172, TimeScalesFactory.getGMST(IERSConventions.IERS_2010, false)), file.getMetaData().getFrameEpoch());
Assert.assertEquals(2060, file.getMetaData().getLaunchYear());
Assert.assertEquals(666, file.getMetaData().getLaunchNumber());
Assert.assertEquals("XYZ", file.getMetaData().getLaunchPiece());
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class OPMParserTest method testParseOPM3.
@Test
public void testParseOPM3() throws OrekitException, URISyntaxException {
// simple test for OPM file, contains all mandatory information plus
// Spacecraft parameters and the position/velocity Covariance Matrix.
final String name = getClass().getResource("/ccsds/OPMExample3.txt").toURI().getPath();
OPMParser parser = new OPMParser().withConventions(IERSConventions.IERS_2010);
final OPMFile file = parser.parse(name);
Assert.assertEquals(new AbsoluteDate(1998, 12, 18, 14, 28, 15.1172, TimeScalesFactory.getGMST(IERSConventions.IERS_2010, false)), file.getMetaData().getFrameEpoch());
Assert.assertEquals(2, file.getMetaDataComment().size());
Assert.assertEquals("GEOCENTRIC, CARTESIAN, EARTH FIXED", file.getMetaDataComment().get(0));
Assert.assertEquals("titi", file.getMetaDataComment().get(1));
Assert.assertEquals(15951238.3495, file.generateKeplerianOrbit().getA(), 0.001);
Assert.assertEquals(0.5914452565, file.generateKeplerianOrbit().getE(), 1.0e-10);
// Check Data Covariance matrix Block
ArrayList<String> dataCovMatrixComment = new ArrayList<String>();
dataCovMatrixComment.add("toto");
dataCovMatrixComment.add("tata");
Assert.assertEquals(dataCovMatrixComment, file.getCovarianceComment());
Assert.assertTrue(file.hasCovarianceMatrix());
Assert.assertEquals(file.getCovRefFrame(), FramesFactory.getTEME());
Array2DRowRealMatrix covMatrix = new Array2DRowRealMatrix(6, 6);
double[] column1 = { 333.1349476038534, 461.8927349220216, -307.0007847730449, -0.3349365033922630, -0.2211832501084875, -0.3041346050686871 };
double[] column2 = { 461.8927349220216, 678.2421679971363, -422.1234189514228, -0.4686084221046758, -0.2864186892102733, -0.4989496988610662 };
double[] column3 = { -307.0007847730449, -422.1234189514228, 323.1931992380369, 0.2484949578400095, 0.1798098699846038, 0.3540310904497689 };
double[] column4 = { -0.3349365033922630, -0.4686084221046758, 0.2484949578400095, 0.0004296022805587290, 0.0002608899201686016, 0.0001869263192954590 };
double[] column5 = { -0.2211832501084875, -0.2864186892102733, 0.1798098699846038, 0.0002608899201686016, 0.0001767514756338532, 0.0001008862586240695 };
double[] column6 = { -0.3041346050686871, -0.4989496988610662, 0.3540310904497689, 0.0001869263192954590, 0.0001008862586240695, 0.0006224444338635500 };
covMatrix.setColumn(0, column1);
covMatrix.setColumn(1, column2);
covMatrix.setColumn(2, column3);
covMatrix.setColumn(3, column4);
covMatrix.setColumn(4, column5);
covMatrix.setColumn(5, column6);
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
Assert.assertEquals(covMatrix.getEntry(i, j), file.getCovarianceMatrix().getEntry(i, j), 1e-15);
}
}
// Check User defined Parameters Block
HashMap<String, String> userDefinedParameters = new HashMap<String, String>();
userDefinedParameters.put("USER_DEFINED_EARTH_MODEL", "WGS-84");
userDefinedParameters.put("USER_DEFINED_TOTO", "TITI");
Assert.assertEquals(userDefinedParameters, file.getUserDefinedParameters());
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class TDMParserTest method validateTDMExample6.
/**
* Validation function for example 6.
* @param file Parsed TDMFile to validate
* @throws OrekitException if UTC time scale cannot be retrieved
*/
public static void validateTDMExample6(TDMFile file) throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
// Header
Assert.assertEquals(1.0, file.getFormatVersion(), 0.0);
Assert.assertEquals(new AbsoluteDate("1998-06-10T01:00:00", utc).durationFrom(file.getCreationDate()), 0.0, 0.0);
Assert.assertEquals("JAXA", file.getOriginator());
final List<String> headerComment = new ArrayList<String>();
headerComment.add("TDM example created by yyyyy-nnnA Nav Team (JAXA)");
Assert.assertEquals(headerComment, file.getHeaderComment());
// Meta-Data
final TDMFile.TDMMetaData metaData = file.getObservationsBlocks().get(0).getMetaData();
Assert.assertEquals(CcsdsTimeScale.UTC, metaData.getTimeSystem());
Assert.assertEquals(new AbsoluteDate("1998-06-10T00:57:37", utc).durationFrom(metaData.getStartTime()), 0.0, 0.0);
Assert.assertEquals(new AbsoluteDate("1998-06-10T00:57:44", utc).durationFrom(metaData.getStopTime()), 0.0, 0.0);
Assert.assertEquals("NORTH", metaData.getParticipants().get(1));
Assert.assertEquals("F07R07", metaData.getParticipants().get(2));
Assert.assertEquals("E7", metaData.getParticipants().get(3));
Assert.assertEquals("SEQUENTIAL", metaData.getMode());
Assert.assertEquals("1,2,3,2,1", metaData.getPath());
Assert.assertEquals(1.0, metaData.getIntegrationInterval(), 0.0);
Assert.assertEquals("MIDDLE", metaData.getIntegrationRef());
Assert.assertEquals("CONSTANT", metaData.getRangeMode());
Assert.assertEquals(0.0, metaData.getRangeModulus(), 0.0);
Assert.assertEquals("KM", metaData.getRangeUnits());
Assert.assertEquals("AZEL", metaData.getAngleType());
// Data
final List<TDMFile.Observation> observations = file.getObservationsBlocks().get(0).getObservations();
// Reference data
final String[] keywords = { "RANGE", "ANGLE_1", "ANGLE_2", "TRANSMIT_FREQ_1", "RECEIVE_FREQ", "RANGE", "ANGLE_1", "ANGLE_2", "TRANSMIT_FREQ_1", "RECEIVE_FREQ", "RANGE", "ANGLE_1", "ANGLE_2", "TRANSMIT_FREQ_1", "RECEIVE_FREQ", "RANGE", "ANGLE_1", "ANGLE_2", "TRANSMIT_FREQ_1", "RECEIVE_FREQ" };
final String[] epochs = { "1998-06-10T00:57:37", "1998-06-10T00:57:37", "1998-06-10T00:57:37", "1998-06-10T00:57:37", "1998-06-10T00:57:37", "1998-06-10T00:57:38", "1998-06-10T00:57:38", "1998-06-10T00:57:38", "1998-06-10T00:57:38", "1998-06-10T00:57:38", "1998-06-10T00:57:39", "1998-06-10T00:57:39", "1998-06-10T00:57:39", "1998-06-10T00:57:39", "1998-06-10T00:57:39", "1998-06-10T00:57:44", "1998-06-10T00:57:44", "1998-06-10T00:57:44", "1998-06-10T00:57:44", "1998-06-10T00:57:44" };
final double[] values = { 80452.7542, 256.64002393, 13.38100016, 2106395199.07917, 2287487999.0, 80452.7368, 256.64002393, 13.38100016, 2106395199.07917, 2287487999.0, 80452.7197, 256.64002393, 13.38100016, 2106395199.07917, 2287487999.0, 80452.6331, 256.64002393, 13.38100016, 2106395199.07917, 2287487999.0 };
// Check consistency
for (int i = 0; i < keywords.length; i++) {
Assert.assertEquals(keywords[i], observations.get(i).getKeyword());
Assert.assertEquals(new AbsoluteDate(epochs[i], utc).durationFrom(observations.get(i).getEpoch()), 0.0, 0.0);
Assert.assertEquals(values[i], observations.get(i).getMeasurement(), 0.0);
}
// Comment
final List<String> dataComment = new ArrayList<String>();
dataComment.add("This is a data comment");
Assert.assertEquals(dataComment, file.getObservationsBlocks().get(0).getObservationsComment());
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class TDMParserTest method validateTDMExample15.
/**
* Validation function for example 15.
* @param file Parsed TDMFile to validate
* @throws OrekitException if UTC time scale cannot be retrieved
*/
public static void validateTDMExample15(TDMFile file) throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
// Header
Assert.assertEquals(1.0, file.getFormatVersion(), 0.0);
Assert.assertEquals(new AbsoluteDate("2005-161T15:45:00", utc).durationFrom(file.getCreationDate()), 0.0, 0.0);
Assert.assertEquals("NASA/JPL", file.getOriginator());
final List<String> headerComment = new ArrayList<String>();
headerComment.add("TDM example created by yyyyy-nnnA Nav Team (NASA/JPL)");
headerComment.add("The following are clock offsets, in seconds between the");
headerComment.add("clocks at each DSN complex relative to UTC(NIST). The offset");
headerComment.add("is a mean of readings using several GPS space vehicles in");
headerComment.add("common view. Value is \"station clock minus UTC”.");
Assert.assertEquals(headerComment, file.getHeaderComment());
// Meta-Data 1
final TDMFile.TDMMetaData metaData = file.getObservationsBlocks().get(0).getMetaData();
Assert.assertEquals(CcsdsTimeScale.UTC, metaData.getTimeSystem());
Assert.assertEquals(new AbsoluteDate("2005-142T12:00:00", utc).durationFrom(metaData.getStartTime()), 0.0, 0.0);
Assert.assertEquals(new AbsoluteDate("2005-145T12:00:00", utc).durationFrom(metaData.getStopTime()), 0.0, 0.0);
Assert.assertEquals("DSS-10", metaData.getParticipants().get(1));
Assert.assertEquals("UTC-NIST", metaData.getParticipants().get(2));
final List<String> metaDataComment = new ArrayList<String>();
metaDataComment.add("Note: SPC10 switched back to Maser1 from Maser2 on 2005-142");
Assert.assertEquals(metaDataComment, metaData.getComment());
// Data 1
final List<TDMFile.Observation> observations = file.getObservationsBlocks().get(0).getObservations();
// Reference data 1
final String[] keywords = { "CLOCK_BIAS", "CLOCK_DRIFT", "CLOCK_BIAS", "CLOCK_DRIFT", "CLOCK_BIAS", "CLOCK_DRIFT", "CLOCK_BIAS" };
final String[] epochs = { "2005-142T12:00:00", "2005-142T12:00:00", "2005-143T12:00:00", "2005-143T12:00:00", "2005-144T12:00:00", "2005-144T12:00:00", "2005-145T12:00:00" };
final double[] values = { 9.56e-7, 6.944e-14, 9.62e-7, -2.083e-13, 9.44e-7, -2.778e-13, 9.20e-7 };
// Check consistency
for (int i = 0; i < keywords.length; i++) {
Assert.assertEquals(keywords[i], observations.get(i).getKeyword());
Assert.assertEquals(new AbsoluteDate(epochs[i], utc).durationFrom(observations.get(i).getEpoch()), 0.0, 0.0);
Assert.assertEquals(values[i], observations.get(i).getMeasurement(), 0.0);
}
// Comment
final List<String> dataComment = new ArrayList<String>();
dataComment.add("This is a data comment");
Assert.assertEquals(dataComment, file.getObservationsBlocks().get(0).getObservationsComment());
// Meta-Data 2
final TDMFile.TDMMetaData metaData2 = file.getObservationsBlocks().get(1).getMetaData();
Assert.assertEquals(CcsdsTimeScale.UTC, metaData2.getTimeSystem());
Assert.assertEquals(new AbsoluteDate("2005-142T12:00:00", utc).durationFrom(metaData2.getStartTime()), 0.0, 0.0);
Assert.assertEquals(new AbsoluteDate("2005-145T12:00:00", utc).durationFrom(metaData2.getStopTime()), 0.0, 0.0);
Assert.assertEquals("DSS-40", metaData2.getParticipants().get(1));
Assert.assertEquals("UTC-NIST", metaData2.getParticipants().get(2));
final List<String> metaDataComment2 = new ArrayList<String>();
metaDataComment2.add("This is a meta-data comment");
Assert.assertEquals(metaDataComment2, metaData2.getComment());
// Data 2
final List<TDMFile.Observation> observations2 = file.getObservationsBlocks().get(1).getObservations();
// Reference data 2
// Same keywords and dates than 1
final double[] values2 = { -7.40e-7, -3.125e-13, -7.67e-7, -1.620e-13, -7.81e-7, -4.745e-13, -8.22e-7 };
// Check consistency
for (int i = 0; i < keywords.length; i++) {
Assert.assertEquals(keywords[i], observations2.get(i).getKeyword());
Assert.assertEquals(new AbsoluteDate(epochs[i], utc).durationFrom(observations2.get(i).getEpoch()), 0.0, 0.0);
Assert.assertEquals(values2[i], observations2.get(i).getMeasurement(), 0.0);
}
// Comment
final List<String> dataComment2 = new ArrayList<String>();
dataComment2.add("This is a data comment");
Assert.assertEquals(dataComment2, file.getObservationsBlocks().get(1).getObservationsComment());
// Meta-Data 3
final TDMFile.TDMMetaData metaData3 = file.getObservationsBlocks().get(2).getMetaData();
Assert.assertEquals(CcsdsTimeScale.UTC, metaData3.getTimeSystem());
Assert.assertEquals(new AbsoluteDate("2005-142T12:00:00", utc).durationFrom(metaData3.getStartTime()), 0.0, 0.0);
Assert.assertEquals(new AbsoluteDate("2005-145T12:00:00", utc).durationFrom(metaData3.getStopTime()), 0.0, 0.0);
Assert.assertEquals("DSS-60", metaData3.getParticipants().get(1));
Assert.assertEquals("UTC-NIST", metaData3.getParticipants().get(2));
final List<String> metaDataComment3 = new ArrayList<String>();
metaDataComment3.add("This is a meta-data comment");
Assert.assertEquals(metaDataComment3, metaData3.getComment());
// Data 3
final List<TDMFile.Observation> observations3 = file.getObservationsBlocks().get(2).getObservations();
// Reference data 2
// Same keywords and dates than 1
final double[] values3 = { -1.782e-6, 1.736e-13, -1.767e-6, 1.157e-14, -1.766e-6, 8.102e-14, -1.759e-6 };
// Check consistency
for (int i = 0; i < keywords.length; i++) {
Assert.assertEquals(keywords[i], observations3.get(i).getKeyword());
Assert.assertEquals(new AbsoluteDate(epochs[i], utc).durationFrom(observations3.get(i).getEpoch()), 0.0, 0.0);
Assert.assertEquals(values3[i], observations3.get(i).getMeasurement(), 0.0);
}
// Comment
final List<String> dataComment3 = new ArrayList<String>();
dataComment3.add("This is a data comment");
Assert.assertEquals(dataComment3, file.getObservationsBlocks().get(2).getObservationsComment());
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class TDMParserTest method validateTDMExample2.
/**
* Validation function for example 2.
* @param file Parsed TDMFile to validate
* @throws OrekitException if UTC time scale cannot be retrieved
*/
public static void validateTDMExample2(TDMFile file) throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
// Header
Assert.assertEquals(1.0, file.getFormatVersion(), 0.0);
Assert.assertEquals(new AbsoluteDate("2005-160T20:15:00", utc).durationFrom(file.getCreationDate()), 0.0, 0.0);
Assert.assertEquals("NASA/JPL", file.getOriginator());
final List<String> headerComment = new ArrayList<String>();
headerComment.add("TDM example created by yyyyy-nnnA Nav Team (NASA/JPL)");
headerComment.add("StarTrek 1-way data, Ka band down");
Assert.assertEquals(headerComment, file.getHeaderComment());
// Meta-Data
final TDMFile.TDMMetaData metaData = file.getObservationsBlocks().get(0).getMetaData();
Assert.assertEquals(CcsdsTimeScale.UTC, metaData.getTimeSystem());
Assert.assertEquals(new AbsoluteDate("2005-159T17:41:00", utc).durationFrom(metaData.getStartTime()), 0.0, 0.0);
Assert.assertEquals(new AbsoluteDate("2005-159T17:41:40", utc).durationFrom(metaData.getStopTime()), 0.0, 0.0);
Assert.assertEquals("DSS-25", metaData.getParticipants().get(1));
Assert.assertEquals("YYYY-NNNA", metaData.getParticipants().get(2));
Assert.assertEquals("SEQUENTIAL", metaData.getMode());
Assert.assertEquals("2,1", metaData.getPath());
Assert.assertEquals(1.0, metaData.getIntegrationInterval(), 0.0);
Assert.assertEquals("MIDDLE", metaData.getIntegrationRef());
Assert.assertEquals(32021035200.0, metaData.getFreqOffset(), 0.0);
Assert.assertEquals(0.000077, metaData.getTransmitDelays().get(1), 0.0);
Assert.assertEquals(0.000077, metaData.getReceiveDelays().get(1), 0.0);
Assert.assertEquals("RAW", metaData.getDataQuality());
final List<String> metaDataComment = new ArrayList<String>();
metaDataComment.add("This is a meta-data comment");
Assert.assertEquals(metaDataComment, metaData.getComment());
// Data
final List<TDMFile.Observation> observations = file.getObservationsBlocks().get(0).getObservations();
// Reference data
final String[] keywords = { "TRANSMIT_FREQ_2", "RECEIVE_FREQ_1", "RECEIVE_FREQ_1", "RECEIVE_FREQ_1", "RECEIVE_FREQ_1", "RECEIVE_FREQ_1", "RECEIVE_FREQ_1" };
final String[] epochs = { "2005-159T17:41:00", "2005-159T17:41:00", "2005-159T17:41:01", "2005-159T17:41:02", "2005-159T17:41:03", "2005-159T17:41:04", "2005-159T17:41:05" };
final double[] values = { 32023442781.733, -409.2735, -371.1568, -333.0551, -294.9673, -256.9054, -218.7951 };
// Check consistency
for (int i = 0; i < keywords.length; i++) {
Assert.assertEquals(keywords[i], observations.get(i).getKeyword());
Assert.assertEquals(new AbsoluteDate(epochs[i], utc).durationFrom(observations.get(i).getEpoch()), 0.0, 0.0);
Assert.assertEquals(values[i], observations.get(i).getMeasurement(), 0.0);
}
// Comment
final List<String> dataComment = new ArrayList<String>();
dataComment.add("This is a data comment");
Assert.assertEquals(dataComment, file.getObservationsBlocks().get(0).getObservationsComment());
}
Aggregations