From e9751359a5b46599435614c7ad3dbeb378e2ab2c Mon Sep 17 00:00:00 2001
From: Antoni Viros Martin
Date: Tue, 19 May 2020 18:23:47 -0500
Subject: [PATCH 1/6] Refactor to use new FOV interface in Orekit
---
.../seakers/orekit/EnumerateUniqueSats.java | 12 +-
.../src/main/java/seakers/orekit/Orekit.java | 288 -------------
.../main/java/seakers/orekit/Orekit_Pau.java | 378 ------------------
.../main/java/seakers/orekit/Orekit_Pau2.java | 236 -----------
.../seakers/orekit/Orekit_Pau_eph_vec.java | 226 -----------
.../java/seakers/orekit/Orekit_Prachi.java | 212 ----------
.../orekit/Orekit_Prachi_EnumerateWalker.java | 190 ---------
.../src/main/java/seakers/orekit/Tests.java | 174 --------
.../seakers/orekit/constellations/Walker.java | 19 +-
...FieldOfViewAndGndStationEventAnalysis.java | 10 +-
.../event/FieldOfViewEventAnalysis.java | 53 ++-
.../orekit/event/LinkBudgetEventAnalysis.java | 13 +-
.../orekit/event/detector/FOVDetector.java | 99 -----
.../event/detector/TimeIntervalHandler.java | 8 +-
.../examples/CompoundAnalysisExample.java | 25 --
.../orekit/examples/CoverageExample.java | 8 +-
.../examples/PositionVectorExample.java | 8 +-
.../seakers/orekit/object/Instrument.java | 9 +-
.../java/seakers/orekit/object/Satellite.java | 50 ++-
.../AbstractFieldOfViewDefinition.java | 200 ---------
.../object/fieldofview/CustomFieldOfView.java | 251 ------------
.../fieldofview/FieldOfViewDefinition.java | 79 ----
.../fieldofview/NadirRectangularFOV.java | 92 -----
.../fieldofview/NadirSimpleConicalFOV.java | 73 ----
.../fieldofview/OffNadirRectangularFOV.java | 105 -----
.../fieldofview/RectangularFieldOfView.java | 146 -------
.../fieldofview/SimpleConicalFieldOfView.java | 129 ------
.../orekit/propagation/PropagatorFactory.java | 50 ++-
.../java/seakers/orekit/test_LTAN2RAAN.java | 53 +--
29 files changed, 179 insertions(+), 3017 deletions(-)
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit_Pau.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit_Pau2.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit_Pau_eph_vec.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit_Prachi.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Orekit_Prachi_EnumerateWalker.java
delete mode 100644 orekit/src/main/java/seakers/orekit/Tests.java
delete mode 100644 orekit/src/main/java/seakers/orekit/event/detector/FOVDetector.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/AbstractFieldOfViewDefinition.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/CustomFieldOfView.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/FieldOfViewDefinition.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/NadirRectangularFOV.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/NadirSimpleConicalFOV.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/OffNadirRectangularFOV.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/RectangularFieldOfView.java
delete mode 100644 orekit/src/main/java/seakers/orekit/object/fieldofview/SimpleConicalFieldOfView.java
diff --git a/orekit/src/main/java/seakers/orekit/EnumerateUniqueSats.java b/orekit/src/main/java/seakers/orekit/EnumerateUniqueSats.java
index 88a8ba5..7e6918f 100644
--- a/orekit/src/main/java/seakers/orekit/EnumerateUniqueSats.java
+++ b/orekit/src/main/java/seakers/orekit/EnumerateUniqueSats.java
@@ -8,10 +8,15 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+
+import org.orekit.bodies.BodyShape;
+import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.time.AbsoluteDate;
+import org.orekit.utils.Constants;
+import org.orekit.utils.IERSConventions;
import seakers.orekit.constellations.EnumerateConstellations;
import seakers.orekit.constellations.Walker;
import seakers.orekit.constellations.WalkerParameters;
@@ -43,13 +48,16 @@ public static void main(String[] args) throws OrekitException, IOException {
}
ArrayList payload=new ArrayList<>();
- Frame inertialFrame=FramesFactory.getEME2000();
+ Frame inertialFrame = FramesFactory.getEME2000();
+ Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
+ BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
+ Constants.WGS84_EARTH_FLATTENING, earthFrame);
AbsoluteDate date=new AbsoluteDate();
ArrayList constell = EnumerateConstellations.fullFactWalker(alt,inc,sats);
HashMap map=new HashMap<>();
for (WalkerParameters params:constell){
Walker w = new Walker("", payload, params.getA(), params.getI(),
- params.getT(), params.getP(), params.getF(), inertialFrame, date, 0);
+ params.getT(), params.getP(), params.getF(), inertialFrame, earthShape, date, 0);
for(Satellite sat:w.getSatellites()){
map.put(String.valueOf(sat.hashCode()), sat);
}
diff --git a/orekit/src/main/java/seakers/orekit/Orekit.java b/orekit/src/main/java/seakers/orekit/Orekit.java
deleted file mode 100644
index 12ad73a..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.analysis.ephemeris.OrbitalElementsAnalysis;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.object.linkbudget.LinkBudget;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.scenario.ScenarioIO;
-import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.PositionAngle;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.analysis.AbstractSpacecraftAnalysis;
-import seakers.orekit.analysis.CompoundSpacecraftAnalysis;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.FastCoverageAnalysis;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
-import seakers.orekit.object.Constellation;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.UNIFORM;
-import seakers.orekit.object.CoveragePoint;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.orbit.J2KeplerianOrbit;
-//import seak.orekit.sensitivity.CoverageVersusOrbitalElements;
-
-/**
- *
- * @author nozomihitomi
- */
-public class Orekit {
-
- /**
- * @param args the command line arguments
- * @throws org.orekit.errors.OrekitException
- */
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
- long start = System.nanoTime();
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "tropics";
- }
-
- OrekitConfig.init(4);
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2020, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2020, 1, 8, 00, 00, 00.000, utc);
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- Frame inertialFrame = FramesFactory.getEME2000();
-
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
- //Enter satellite orbital parameters
- double a = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 600000.;
- double i = FastMath.toRadians(30.);
-
- //define instruments
- //NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(51), earthShape);
- NadirRectangularFOV fov = new NadirRectangularFOV(FastMath.toRadians(57), FastMath.toRadians(20), 0, earthShape);
- ArrayList payload = new ArrayList<>();
- Instrument view1 = new Instrument("view1", fov, 100, 100);
- payload.add(view1);
-
- Walker constellation = new Walker("walker1", payload, a, i, 12, 2, 1, inertialFrame, startDate, mu);
-// Collection constel = new ArrayList<>();
-// Satellite sat1 = new Satellite("sat1", new KeplerianOrbit(a, 0., i, 0., 0., 0, PositionAngle.TRUE, inertialFrame, startDate, mu), null, payload);
-// Satellite sat2 = new Satellite("sat2", new KeplerianOrbit(a, 0., i, 0., 0., FastMath.PI, PositionAngle.TRUE, inertialFrame, startDate, mu), null, payload);
-// Satellite sat3 = new Satellite("sat3", new KeplerianOrbit(7374726.303523837, 0, FastMath.toRadians(80.52642265614948), 0, FastMath.toRadians(74.10481094668702), FastMath.toRadians(173.13240991233943), PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
-// Satellite sat4 = new Satellite("sat4", new KeplerianOrbit(a, 0, i, 0, FastMath.toRadians(180.), FastMath.toRadians(0.), PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
-// Satellite sat5 = new Satellite("sat5", new KeplerianOrbit(a, 0, i, 0, FastMath.toRadians(240.), FastMath.toRadians(240.), PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
-// Satellite sat6 = new Satellite("sat6", new KeplerianOrbit(a, 0, i, 0, FastMath.toRadians(300), FastMath.toRadians(120), PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
-// constel.add(sat1);
-// constel.add(sat2);
-// constel.add(sat3);
-// constel.add(sat4);
-// constel.add(sat5);
-// constel.add(sat6);
-// Constellation constellation = new Constellation("constel", constel);
-
- ArrayList pts = new ArrayList<>();
-// pts.add(new GeodeticPoint(-0.1745329251994330, 6.0737457969402699, 0.0));
-// pts.add(new GeodeticPoint(-0.8726646259971650, -2.72271363311116, 0.0));
-// pts.add(new GeodeticPoint(1.5707963267949001, 0.0000000000000000, 0.0));
-// CoverageDefinition covDef1 = new CoverageDefinition("covdef1", pts, earthShape);
-// CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 2, -FastMath.PI/2, FastMath.PI/2,-FastMath.PI, FastMath.PI, earthShape, CoverageDefinition.GridStyle.UNIFORM);
-// CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 6, earthShape, CoverageDefinition.GridStyle.EQUAL_AREA);
-// CoverageDefinition covDef1 = new CoverageDefinition("cdef", 5.0, -30, 30, -180, 180, earthShape, CoverageDefinition.GridStyle.UNIFORM);
-// CoverageDefinition covDef1 = new CoverageDefinition("covdef1", STKGRID.getPoints20(), earthShape);
- CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 2, earthShape, UNIFORM);
-
-// CoverageVersusOrbitalElements cvoe
-// = new CoverageVersusOrbitalElements.Builder(1000, startDate, endDate, covDef1.getPoints()).
-// setSAParam(Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 400000, Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 800000).
-// setIParam(FastMath.toRadians(30), FastMath.toRadians(90)).
-// setSensorParam(FastMath.toRadians(30), FastMath.toRadians(90)).
-// setNThreads(6).build();
-// try {
-// cvoe.run();
-// } catch (Exception ex) {
-// Logger.getLogger(Orekit.class.getName()).log(Level.SEVERE, null, ex);
-// }
-// System.exit(0);
- covDef1.assignConstellation(constellation);
-
- HashSet covDefs = new HashSet<>();
- covDefs.add(covDef1);
-
-// FastCoverageAnalysis fca = new FastCoverageAnalysis(startDate, endDate, inertialFrame, covDefs, FastMath.toRadians(51.));
-// start = System.nanoTime();
-// fca.call();
-// System.out.println(new GroundEventAnalyzer(fca.getEvents(covDef1)).getStatistics(AnalysisMetric.MEAN_TIME_TO_T, false, new Properties()).getMean());
-// System.exit(0);
- long end1 = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end1 - start) / Math.pow(10, 9)));
-
- Properties propertiesPropagator = new Properties();
- propertiesPropagator.setProperty("orekit.propagator.mass", "6.");
- propertiesPropagator.setProperty("orekit.propagator.atmdrag", "true");
- propertiesPropagator.setProperty("orekit.propagator.dragarea", "0.075");
- propertiesPropagator.setProperty("orekit.propagator.dragcoeff", "2.2");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.sun", "true");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.moon", "true");
- propertiesPropagator.setProperty("orekit.propagator.solarpressure", "true");
- propertiesPropagator.setProperty("orekit.propagator.solararea", "0.058");
-
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2, propertiesPropagator);
-// PropagatorFactory pf = new PropagatorFactory(PropagatorType.NUMERICAL, propertiesPropagator);
-
- Properties propertiesEventAnalysis = new Properties();
-
- //set the event analyses
- EventAnalysisFactory eaf = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
- ArrayList eventanalyses = new ArrayList<>();
- FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eaf.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
- eventanalyses.add(fovEvent);
-// GroundBodyAngleEventAnalysis gndSunAngEvent = (GroundBodyAngleEventAnalysis) eaf.create(EventAnalysisEnum.GND_BODY_ANGLE, properties);
-// eventanalyses.add(gndSunAngEvent);
-
- //set the analyses
- double analysisTimeStep = 60;
- ArrayList> analyses = new ArrayList<>();
-// for (Satellite sat : walker.getSatellites()) {
- //analyses.add(new OrbitalElementsAnalysis(startDate, endDate, analysisTimeStep, sat, pf));
-// analyses.add(new VectorAnalisysEclipseSunlightDiffDrag(startDate, endDate, analysisTimeStep, sat, pf, inertialFrame, 0.015, 0.075, 0.058, 6));
-// }
-
- Scenario scen = new Scenario.Builder(startDate, endDate, utc).
- eventAnalysis(eventanalyses).analysis(analyses).
- covDefs(covDefs).name("mapuko66").properties(propertiesEventAnalysis).
- propagatorFactory(pf).build();
- try {
- Logger.getGlobal().finer(String.format("Running Scenario %s", scen));
- Logger.getGlobal().finer(String.format("Number of points: %d", covDef1.getNumberOfPoints()));
- Logger.getGlobal().finer(String.format("Number of satellites: %d", constellation.getSatellites().size()));
- scen.call();
- } catch (Exception ex) {
- Logger.getLogger(Orekit.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
-// GroundEventAnalyzer ea2 = new GroundEventAnalyzer(fca.getEvents(covDef1));
-// Properties properties = new Properties();
-// properties.setProperty("threshold", "7200.0");
-// DescriptiveStatistics accessStats2 = ea2.getStatistics(AnalysisMetric.DURATION, true, properties);
-// DescriptiveStatistics gapStats2 = ea2.getStatistics(AnalysisMetric.DURATION, false, properties);
-//// ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_cva", scen, covDef1, fca);
-//// System.exit(0);
-//
-// GroundEventAnalyzer ea = new GroundEventAnalyzer(fovEvent.getEvents(covDef1));
-// DescriptiveStatistics accessStats = ea.getStatistics(AnalysisMetric.DURATION, true, properties);
-// DescriptiveStatistics gapStats = ea.getStatistics(AnalysisMetric.DURATION, false, properties);
-//
-// System.out.println(String.format("Max access time %s\t%s", accessStats.getMax(), accessStats2.getMax()));
-// System.out.println(String.format("Mean access time %s\t%s", accessStats.getMean(), accessStats2.getMean()));
-// System.out.println(String.format("Min access time %s\t%s", accessStats.getMin(), accessStats2.getMin()));
-// System.out.println(String.format("50th access time %s\t%s", accessStats.getPercentile(50), accessStats2.getPercentile(50)));
-// System.out.println(String.format("80th acceses time %s\t%s", accessStats.getPercentile(80), accessStats2.getPercentile(80)));
-// System.out.println(String.format("90th access time %s\t%s", accessStats.getPercentile(90), accessStats2.getPercentile(90)));
-//
-// System.out.println(String.format("Max gap time %s\t%s", gapStats.getMax(), gapStats2.getMax()));
-// System.out.println(String.format("Mean gap time %s\t%s", gapStats.getMean(), gapStats2.getMean()));
-// System.out.println(String.format("Min gap time %s\t%s", gapStats.getMin(), gapStats2.getMin()));
-// System.out.println(String.format("50th gap time %s\t%s", gapStats.getPercentile(50), gapStats2.getPercentile(50)));
-// System.out.println(String.format("80th gap time %s\t%s", gapStats.getPercentile(80), gapStats2.getPercentile(80)));
-// System.out.println(String.format("90th gap time %s\t%s", gapStats.getPercentile(90), gapStats2.getPercentile(90)));
-
- //load in weights
-// HashMap wts = new HashMap<>();
-//
-// try (BufferedReader br = new BufferedReader(new FileReader(new File("tropicsWts_new_2.csv")))) {
-// String line = br.readLine();
-// while (line != null) {
-// String[] arg = line.split(",");
-// wts.put(FastMath.toRadians(Double.parseDouble(arg[0])), Double.parseDouble(arg[1]));
-// line = br.readLine();
-// }
-// } catch (IOException ex) {
-// Logger.getLogger(Orekit.class.getName()).log(Level.SEVERE, null, ex);
-// }
-//
-// for (CoveragePoint pt : covDef1.getPoints()) {
-// DescriptiveStatistics stats = ea2.getStatistics(AnalysisMetric.MEAN_TIME_TO_T, false, pt, properties);
-// System.out.println(FastMath.toDegrees(pt.getPoint().getLatitude())+","
-// +FastMath.toDegrees(pt.getPoint().getLongitude())+","+stats.getMean());
-// }
-
-// System.out.println(wtCHRC);
-
- //ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_cva", scen, covDef1, fca);
- ScenarioIO.saveGroundEventAnalyzerObject(Paths.get(System.getProperty("results"), ""), filename, scen,covDef1, fovEvent);
- //ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename + "_cva", scen, covDef1, fca);
- //ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_fov", scen, covDef1, fovEvent);
- ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
-// ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_gsa", scen, covDef1, gndSunAngEvent);
-// ScenarioIO.saveLinkBudget(Paths.get(System.getProperty("results"), ""), filename, scenComp, cdefToSave);
-// ScenarioIO.saveReadMe(Paths.get(path, ""), filename, scenComp);
-
- for (Analysis> analysis : analyses) {
- ScenarioIO.saveAnalysis(Paths.get(System.getProperty("results"), ""),
- String.format("%s_%s", scen.toString(), "analysis"), analysis);
- }
- long end = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end - end1) / Math.pow(10, 9)));
-
- OrekitConfig.end();
-
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/Orekit_Pau.java b/orekit/src/main/java/seakers/orekit/Orekit_Pau.java
deleted file mode 100644
index cdbb110..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit_Pau.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.Set;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.event.*;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.Orbit;
-import org.orekit.orbits.PositionAngle;
-import org.orekit.propagation.Propagator;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.object.Constellation;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.EQUAL_AREA;
-import seakers.orekit.object.CommunicationBand;
-import seakers.orekit.object.GndStation;
-import seakers.orekit.object.communications.ReceiverAntenna;
-import seakers.orekit.object.communications.TransmitterAntenna;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.util.Orbits;
-
-/**
- *
- * @author paugarciabuzzi
- */
-public class Orekit_Pau {
-
- /**
- * @param args the command line arguments
- * @throws org.orekit.errors.OrekitException
- */
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "tropics";
- }
-
- OrekitConfig.init(4);
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2020, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2020, 1, 8, 00, 00, 00.000, utc);
- //AbsoluteDate endDate = new AbsoluteDate(2021, 1, 1, 00, 00, 00.000, utc);
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- Frame inertialFrame = FramesFactory.getEME2000();
-
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
- //Enter satellite orbital parameters
- double a500 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS+500000;
- double a600 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS+600000;
- double a700 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS+700000;
- double i30 = FastMath.toRadians(30);
- double i51 = FastMath.toRadians(51.6);
- double i90 = FastMath.toRadians(90);
- double iSSO = Orbits.incSSO(600);
- //define instruments
- //NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
- NadirRectangularFOV fov = new NadirRectangularFOV(FastMath.toRadians(57), FastMath.toRadians(20), 0, earthShape);
- //OffNadirRectangularFOV fov = new OffNadirRectangularFOV(FastMath.toRadians(70),
- // FastMath.toRadians(2),FastMath.toRadians(2),0,earthShape);
- ArrayList payload = new ArrayList<>();
- Instrument view1 = new Instrument("view1", fov, 100, 100);
- payload.add(view1);
-
-// //number of total satellites
-// int t=10;
-// //number of planes
-// int p=1;
-//
-// int f=0;
-//
-// Walker constel = new Walker("walker1", payload, a, i, t, p, f, inertialFrame, startDate, mu);
- ArrayList satellites=new ArrayList<>();
- HashSet satBands = new HashSet<>();
- satBands.add(CommunicationBand.UHF);
- Orbit orb1 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(0), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
- //Satellite sat1 = new Satellite("sat1", orb1, null, payload);
- Satellite sat1 = new Satellite("sat1", orb1, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
- Orbit orb2 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(0), Math.toRadians(180), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat2 = new Satellite("sat2", orb2, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
- Orbit orb3 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(120), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat3 = new Satellite("sat3", orb3, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
- Orbit orb4 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(120), Math.toRadians(180), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat4 = new Satellite("sat4", orb4, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
- Orbit orb5 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(240), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat5 = new Satellite("sat5", orb5, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
- Orbit orb6 = new KeplerianOrbit(a600, 0.0001, iSSO, 0.0, Math.toRadians(240), Math.toRadians(180), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat6 = new Satellite("sat6", orb6, null, payload,
- new ReceiverAntenna(6., satBands), new TransmitterAntenna(6., satBands), Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
-// Orbit orb7 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat7 = new Satellite("sat7", orb7, null, payload);
-// Orbit orb8 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(60), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat8 = new Satellite("sat8", orb8, null, payload);
-// Orbit orb9 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(120), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat9 = new Satellite("sat9", orb9, null, payload);
-// Orbit orb10 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(180), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat10 = new Satellite("sat10", orb10, null, payload);
-// Orbit orb11 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(240), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat11 = new Satellite("sat11", orb11, null, payload);
-// Orbit orb12 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(180), Math.toRadians(300), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat12 = new Satellite("sat12", orb12, null, payload);
- satellites.add(sat1);
-// satellites.add(sat2);
-// satellites.add(sat3);
-// satellites.add(sat4);
-// satellites.add(sat5);
-// satellites.add(sat6);
-// satellites.add(sat7);
-// satellites.add(sat8);
-// satellites.add(sat9);
-// satellites.add(sat10);
-// satellites.add(sat11);
-// satellites.add(sat12);
-
-
- Constellation constel = new Constellation ("tropics2",satellites);
-
- CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 9, earthShape, EQUAL_AREA);
-
- covDef1.assignConstellation(constel);
- HashSet covDefs = new HashSet<>();
- covDefs.add(covDef1);
-
- Properties propertiesPropagator = new Properties();
- propertiesPropagator.setProperty("orekit.propagator.mass", "6");
- propertiesPropagator.setProperty("orekit.propagator.atmdrag", "true");
- propertiesPropagator.setProperty("orekit.propagator.dragarea", "0.075");
- propertiesPropagator.setProperty("orekit.propagator.dragcoeff", "2.2");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.sun", "true");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.moon", "true");
- propertiesPropagator.setProperty("orekit.propagator.solarpressure", "true");
- propertiesPropagator.setProperty("orekit.propagator.solararea", "0.058");
-
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.KEPLERIAN,propertiesPropagator);
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2,propertiesPropagator);
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2MODIFIED,propertiesPropagator);
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.NUMERICAL,propertiesPropagator);
-
- Properties propertiesEventAnalysis = new Properties();
- propertiesEventAnalysis.setProperty("fov.numThreads", "4");
- propertiesEventAnalysis.setProperty("fov.saveAccess", "true");
-
-
- //set the event analyses
- EventAnalysisFactory eaf = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
- ArrayList eventanalyses = new ArrayList<>();
- FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eaf.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
-
- Set gndStations = new HashSet<>();
- TopocentricFrame wallopsTopo = new TopocentricFrame(earthShape, new GeodeticPoint(FastMath.toRadians(37.94019444), FastMath.toRadians(-75.46638889), 0.), "Wallops");
- HashSet wallopsBands = new HashSet<>();
- wallopsBands.add(CommunicationBand.UHF);
- gndStations.add(new GndStation(wallopsTopo, new ReceiverAntenna(6., wallopsBands), new TransmitterAntenna(6., wallopsBands), FastMath.toRadians(10.)));
- TopocentricFrame moreheadTopo = new TopocentricFrame(earthShape, new GeodeticPoint(FastMath.toRadians(38.19188139), FastMath.toRadians(-83.43861111), 0.), "Mroehead");
- HashSet moreheadBands = new HashSet<>();
- moreheadBands.add(CommunicationBand.UHF);
- gndStations.add(new GndStation(moreheadTopo, new ReceiverAntenna(47., moreheadBands), new TransmitterAntenna(47., moreheadBands), FastMath.toRadians(10.)));
- TopocentricFrame GS1Topo = new TopocentricFrame(earthShape, new GeodeticPoint(FastMath.toRadians(0), FastMath.toRadians(0), 0.), "GS1");
- HashSet GS1Bands = new HashSet<>();
- GS1Bands.add(CommunicationBand.UHF);
- gndStations.add(new GndStation(GS1Topo, new ReceiverAntenna(10., GS1Bands), new TransmitterAntenna(10., GS1Bands), FastMath.toRadians(10.)));
- TopocentricFrame GS2Topo = new TopocentricFrame(earthShape, new GeodeticPoint(FastMath.toRadians(20), FastMath.toRadians(80), 0.), "GS2");
- HashSet GS2Bands = new HashSet<>();
- GS2Bands.add(CommunicationBand.UHF);
- gndStations.add(new GndStation(GS2Topo, new ReceiverAntenna(10., GS2Bands), new TransmitterAntenna(10., GS2Bands), FastMath.toRadians(10.)));
-
-
- HashMap> stationAssignment = new HashMap<>();
- for (Satellite sat : constel.getSatellites()){
- stationAssignment.put(sat, gndStations);
- }
-
- //eventanalyses.add(fovEvent);
- GndStationEventAnalysis gndEvent = (GndStationEventAnalysis) eaf.createGroundStationAnalysis(EventAnalysisEnum.ACCESS, stationAssignment, propertiesEventAnalysis);
- eventanalyses.add(gndEvent);
-
-
-
-// //set the analyses
-// double analysisTimeStep = 60;
- ArrayList> analyses = new ArrayList<>();
-// for (Satellite sat : walker.getSatellites()) {
-// //analyses.add(new OrbitalElementsAnalysis(startDate, endDate, analysisTimeStep, sat, pf));
-// }
-
- Scenario scen = new Scenario.Builder(startDate, endDate, utc).
- eventAnalysis(eventanalyses).analysis(analyses).
- covDefs(covDefs).name("trialOffNadir").properties(propertiesEventAnalysis).
- propagatorFactory(pf).build();
- try {
-// Logger.getGlobal().finer(String.format("Running Scenario %s", scen));
-// Logger.getGlobal().finer(String.format("Number of points: %d", covDef1.getNumberOfPoints()));
-// Logger.getGlobal().finer(String.format("Number of satellites: %d", constel.getSatellites().size()));
- long start1 = System.nanoTime();
- scen.call();
- long end1 = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end1 - start1) / Math.pow(10, 9)));
-
- } catch (Exception ex) {
- Logger.getLogger(Orekit_Pau.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
- Logger.getGlobal().finer(String.format("Done Running Scenario %s", scen));
-
-
- //set the event analyses
- ArrayList eventanalyses2 = new ArrayList<>();
- FieldOfViewAndGndStationEventAnalysis Event2 = new FieldOfViewAndGndStationEventAnalysis(startDate, endDate,
- inertialFrame, covDefs, stationAssignment,pf, true, false);
- eventanalyses2.add(Event2);
- Scenario scen2 = new Scenario.Builder(startDate, endDate, utc).
- eventAnalysis(eventanalyses2).analysis(analyses).
- covDefs(covDefs).name("Latency_trial2").properties(propertiesEventAnalysis).
- propagatorFactory(pf).build();
- try {
- long start2 = System.nanoTime();
- scen2.call();
- long end2 = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end2 - start2) / Math.pow(10, 9)));
-
- } catch (Exception ex) {
- Logger.getLogger(Orekit_Pau.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
- Logger.getGlobal().finer(String.format("Done Running Scenario %s", scen2));
-
-// //without crosslinks
-// LatencyGroundEventAnalyzer latencyAnalyzer=new LatencyGroundEventAnalyzer(Event2.getAllAccesses().get(covDef1),Event2.getAllAccessesGS(),false);
-// DescriptiveStatistics latencyStats = latencyAnalyzer.getStatistics(new double[]{FastMath.toRadians(-30), FastMath.toRadians(30)}, new double[]{-Math.PI, Math.PI});
-// System.out.println("Without crosslinks:");
-// System.out.println(String.format("Max latency time %s mins", latencyStats.getMax()/60));
-// System.out.println(String.format("Mean latency time %s mins", latencyStats.getMean()/60));
-// System.out.println(String.format("Min latency time %s mins", latencyStats.getMin()/60));
-// System.out.println(String.format("50th latency time %s mins", latencyStats.getPercentile(50)/60));
-// System.out.println(String.format("80th latency time %s mins", latencyStats.getPercentile(80)/60));
-// System.out.println(String.format("90th latency time %s mins", latencyStats.getPercentile(90)/60));
-// //with crosslinks
-// LatencyGroundEventAnalyzer latencyAnalyzer2=new LatencyGroundEventAnalyzer(Event2.getAllAccesses().get(covDef1),Event2.getAllAccessesGS(),true);
-// DescriptiveStatistics latencyStats2 = latencyAnalyzer2.getStatistics(new double[]{FastMath.toRadians(-30), FastMath.toRadians(30)}, new double[]{-Math.PI, Math.PI});
-// System.out.println("With crosslinks:");
-// System.out.println(String.format("Max latency time %s mins", latencyStats2.getMax()/60));
-// System.out.println(String.format("Mean latency time %s mins", latencyStats2.getMean()/60));
-// System.out.println(String.format("Min latency time %s mins", latencyStats2.getMin()/60));
-// System.out.println(String.format("50th latency time %s mins", latencyStats2.getPercentile(50)/60));
-// System.out.println(String.format("80th latency time %s mins", latencyStats2.getPercentile(80)/60));
-// System.out.println(String.format("90th latency time %s mins", latencyStats2.getPercentile(90)/60));
-
-
-// Properties props=new Properties();
-// GroundEventAnalyzer ea = new GroundEventAnalyzer(fovEvent.getEvents(covDef1));
-// DescriptiveStatistics accessStats = ea.getStatistics(AnalysisMetric.DURATION, true,props);
-// DescriptiveStatistics gapStats = ea.getStatistics(AnalysisMetric.DURATION, false,props);
-
-// System.out.println(String.format("Max access time %s", accessStats.getMax()));
-// System.out.println(String.format("Mean access time %s", accessStats.getMean()));
-// System.out.println(String.format("Min access time %s", accessStats.getMin()));
-// System.out.println(String.format("50th access time %s", accessStats.getPercentile(50)));
-// System.out.println(String.format("80th access time %s", accessStats.getPercentile(80)));
-// System.out.println(String.format("90th access time %s", accessStats.getPercentile(90)));
-//
-// System.out.println(String.format("Max gap time %s", gapStats.getMax()));
-// System.out.println(String.format("Mean gap time %s", gapStats.getMean()));
-// System.out.println(String.format("Min gap time %s", gapStats.getMin()));
-// System.out.println(String.format("50th gap time %s", gapStats.getPercentile(50)));
-// System.out.println(String.format("80th gap time %s", gapStats.getPercentile(80)));
-// System.out.println(String.format("90th gap time %s", gapStats.getPercentile(90)));
-
- Properties props=new Properties();
- GroundEventAnalyzer ea = new GroundEventAnalyzer(gndEvent.getEvents());
- DescriptiveStatistics accessStats = ea.getStatistics(AnalysisMetric.DURATION, true,props);
- DescriptiveStatistics gapStats = ea.getStatistics(AnalysisMetric.DURATION, false,props);
-
- System.out.println(String.format("Max access time %s", accessStats.getMax()));
- System.out.println(String.format("Mean access time %s", accessStats.getMean()));
- System.out.println(String.format("Min access time %s", accessStats.getMin()));
- System.out.println(String.format("50th access time %s", accessStats.getPercentile(50)));
- System.out.println(String.format("80th access time %s", accessStats.getPercentile(80)));
- System.out.println(String.format("90th access time %s", accessStats.getPercentile(90)));
-
- System.out.println(String.format("Max gap time %s", gapStats.getMax()));
- System.out.println(String.format("Mean gap time %s", gapStats.getMean()));
- System.out.println(String.format("Min gap time %s", gapStats.getMin()));
- System.out.println(String.format("50th gap time %s", gapStats.getPercentile(50)));
- System.out.println(String.format("80th gap time %s", gapStats.getPercentile(80)));
- System.out.println(String.format("90th gap time %s", gapStats.getPercentile(90)));
-
- GroundEventAnalyzer ea2 = new GroundEventAnalyzer(Event2.getEventsGS());
- DescriptiveStatistics accessStats2 = ea2.getStatistics(AnalysisMetric.DURATION, true,props);
- DescriptiveStatistics gapStats2 = ea2.getStatistics(AnalysisMetric.DURATION, false,props);
- System.out.println("---------------------------------");
- System.out.println(String.format("Max access time %s", accessStats2.getMax()));
- System.out.println(String.format("Mean access time %s", accessStats2.getMean()));
- System.out.println(String.format("Min access time %s", accessStats2.getMin()));
- System.out.println(String.format("50th access time %s", accessStats2.getPercentile(50)));
- System.out.println(String.format("80th access time %s", accessStats2.getPercentile(80)));
- System.out.println(String.format("90th access time %s", accessStats2.getPercentile(90)));
-
- System.out.println(String.format("Max gap time %s", gapStats2.getMax()));
- System.out.println(String.format("Mean gap time %s", gapStats2.getMean()));
- System.out.println(String.format("Min gap time %s", gapStats2.getMin()));
- System.out.println(String.format("50th gap time %s", gapStats2.getPercentile(50)));
- System.out.println(String.format("80th gap time %s", gapStats2.getPercentile(80)));
- System.out.println(String.format("90th gap time %s", gapStats2.getPercentile(90)));
-
- // ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
-// ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
-// ScenarioIO.saveGroundEventAnalyzerObject(Paths.get(System.getProperty("results"), ""), filename, scen,covDef1, fovEvent);
-// ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_gsa", scen, covDef1, gndSunAngEvent);
-// ScenarioIO.saveReadMe(Paths.get(path, ""), filename, scenComp);
-
-
-// for (Analysis> analysis : analyses) {
-// ScenarioIO.saveAnalysis(Paths.get(System.getProperty("results"), ""),
-// String.format("%s_%s",scen.toString(),analysis.getName()), analysis);
-// }
-// long end = System.nanoTime();
-// Logger.getGlobal().finest(String.format("Took %.4f sec", (end - start) / Math.pow(10, 9)));
-//
- OrekitConfig.end();
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/Orekit_Pau2.java b/orekit/src/main/java/seakers/orekit/Orekit_Pau2.java
deleted file mode 100644
index 8057c61..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit_Pau2.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.analysis.ephemeris.OrbitalElementsAnalysis;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.coverage.access.TimeIntervalArray;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.CoveragePoint;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.object.linkbudget.LinkBudget;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.scenario.ScenarioIO;
-import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.Orbit;
-import org.orekit.orbits.PositionAngle;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import org.orekit.utils.TimeStampedPVCoordinates;
-import seakers.orekit.analysis.ephemeris.HohmannTransferAnalysis;
-import seakers.orekit.analysis.vectors.VectorAnalisysEclipseSunlightDiffDrag;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
-import seakers.orekit.event.GroundBodyAngleEventAnalysis;
-import seakers.orekit.object.Constellation;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.EQUAL_AREA;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.UNIFORM;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-
-/**
- *
- * @author paugarciabuzzi
- */
-public class Orekit_Pau2 {
-
- /**
- * @param args the command line arguments
- * @throws org.orekit.errors.OrekitException
- */
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
- long start = System.nanoTime();
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "tropics";
- }
- OrekitConfig.init(4);
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- TimeScale utc = TimeScalesFactory.getUTC();
- //AbsoluteDate startDate = new AbsoluteDate(2020, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate startDate = new AbsoluteDate(2020, 1, 1, 10, 30, 00.000, utc);
- //AbsoluteDate endDate = new AbsoluteDate(2020, 1, 8, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2020, 1, 2, 10, 30, 00.000, utc);
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- Frame inertialFrame = FramesFactory.getEME2000();
-
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
-
- //define instruments
- //NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
- NadirRectangularFOV fov = new NadirRectangularFOV(FastMath.toRadians(52), FastMath.toRadians(20), 0, earthShape);
- ArrayList payload = new ArrayList<>();
- Instrument view1 = new Instrument("view1", fov, 100, 100);
- payload.add(view1);
-
- Properties propertiesPropagator = new Properties();
- propertiesPropagator.setProperty("orekit.propagator.mass", "6");
- propertiesPropagator.setProperty("orekit.propagator.atmdrag", "true");
- propertiesPropagator.setProperty("orekit.propagator.dragarea", "0.075");
- propertiesPropagator.setProperty("orekit.propagator.dragcoeff", "2.2");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.sun", "true");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.moon", "true");
- propertiesPropagator.setProperty("orekit.propagator.solarpressure", "true");
- propertiesPropagator.setProperty("orekit.propagator.solararea", "0.058");
-
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.KEPLERIAN,propertiesPropagator);
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2,propertiesPropagator);
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.NUMERICAL,propertiesPropagator);
- //double[] spacings = {0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180};
- double[] spacings = {180};
- int h=825000;
- double a = Constants.WGS84_EARTH_EQUATORIAL_RADIUS+h;
- double ideg=98.7090;
- double i = FastMath.toRadians(ideg);
-
- for (int j=0;j satellites=new ArrayList<>();
-// Orbit orb1 = new KeplerianOrbit(a, 0.0001, i, 0.0, 0.0, Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat1 = new Satellite("sat1", orb1, null, payload);
-// Orbit orb2 = new KeplerianOrbit(a, 0.0001, i, 0.0, 0.0, Math.toRadians(spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat2 = new Satellite("sat2", orb2, null, payload);
-// Orbit orb7 = new KeplerianOrbit(a, 0.0001, i, 0.0, 0.0, Math.toRadians(2*spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat7 = new Satellite("sat7", orb7, null, payload);
-// Orbit orb3 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(360/3), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat3 = new Satellite("sat3", orb3, null, payload);
-// Orbit orb4 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(360/3), Math.toRadians(spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat4 = new Satellite("sat4", orb4, null, payload);
-// Orbit orb8 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(360/3), Math.toRadians(2*spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat8 = new Satellite("sat8", orb8, null, payload);
-// Orbit orb5 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(2*360/3), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat5 = new Satellite("sat5", orb5, null, payload);
-// Orbit orb6 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(2*360/3), Math.toRadians(spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat6 = new Satellite("sat6", orb6, null, payload);
-// Orbit orb9 = new KeplerianOrbit(a, 0.0001, i, 0.0, Math.toRadians(2*360/3), Math.toRadians(2*spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
-// Satellite sat9 = new Satellite("sat9", orb9, null, payload);
-// satellites.add(sat1);
-// satellites.add(sat2);
-// satellites.add(sat3);
-// satellites.add(sat4);
-// satellites.add(sat5);
-// satellites.add(sat6);
-// satellites.add(sat7);
-// satellites.add(sat8);
-// satellites.add(sat9);
-
- Orbit orb1 = new KeplerianOrbit(a, 0.0001, i, 0.0, FastMath.toRadians(257.8), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat1 = new Satellite("sat1", orb1, null, payload);
- Orbit orb2 = new KeplerianOrbit(a, 0.0001, i, 0.0, FastMath.toRadians(257.8), Math.toRadians(spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat2 = new Satellite("sat2", orb2, null, payload);
- Orbit orb3 = new KeplerianOrbit(a, 0.0001, i, 0.0, FastMath.toRadians(302.79), Math.toRadians(0), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat3 = new Satellite("sat3", orb3, null, payload);
- Orbit orb4 = new KeplerianOrbit(a, 0.0001, i, 0.0, FastMath.toRadians(302.79), Math.toRadians(spacing), PositionAngle.MEAN, inertialFrame, startDate, mu);
- Satellite sat4 = new Satellite("sat4", orb4, null, payload);
-
- satellites.add(sat1);
- satellites.add(sat2);
- satellites.add(sat3);
- satellites.add(sat4);
-
-
- Constellation constel = new Constellation ("tropics2",satellites);
- //CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 9, earthShape, EQUAL_AREA);
- CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 2, earthShape, UNIFORM);
- covDef1.assignConstellation(constel);
-
- HashSet covDefs = new HashSet<>();
- covDefs.add(covDef1);
-
- Properties propertiesEventAnalysis = new Properties();
- propertiesEventAnalysis.setProperty("fov.numThreads", "4");
-
-
- //set the event analyses
- EventAnalysisFactory eaf = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
- ArrayList eventanalyses = new ArrayList<>();
- FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eaf.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
- eventanalyses.add(fovEvent);
-
- //set the analyses
- ArrayList> analyses = new ArrayList<>();
-
- Scenario scen = new Scenario.Builder(startDate, endDate, utc).
- eventAnalysis(eventanalyses).analysis(analyses).
- covDefs(covDefs).name(String.format("SSO_22",ideg,spacing)).properties(propertiesEventAnalysis).
- propagatorFactory(pf).build();
- try {
- Logger.getGlobal().finer(String.format("Running Scenario %s", scen));
- Logger.getGlobal().finer(String.format("Number of points: %d", covDef1.getNumberOfPoints()));
- Logger.getGlobal().finer(String.format("Number of satellites: %d", constel.getSatellites().size()));
- scen.call();
- } catch (Exception ex) {
- Logger.getLogger(Orekit_Pau2.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
- Logger.getGlobal().finer(String.format("Done Running Scenario %s", scen));
- ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
- //ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
- ScenarioIO.saveGroundEventAnalyzerObject(Paths.get(System.getProperty("results"), ""), filename, scen,covDef1, fovEvent);
- // ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_gsa", scen, covDef1, gndSunAngEvent);
- // ScenarioIO.saveLinkBudget(Paths.get(System.getProperty("results"), ""), filename, scenComp, cdefToSave);
- // ScenarioIO.saveReadMe(Paths.get(path, ""), filename, scenComp);
-
- for (Analysis> analysis : analyses) {
- ScenarioIO.saveAnalysis(Paths.get(System.getProperty("results"), ""),
- String.format("%s_%s",scen.toString(),analysis.getName()), analysis);
- }
- }
- long end = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end - start) / Math.pow(10, 9)));
- OrekitConfig.end();
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/Orekit_Pau_eph_vec.java b/orekit/src/main/java/seakers/orekit/Orekit_Pau_eph_vec.java
deleted file mode 100644
index 4d8bb9a..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit_Pau_eph_vec.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.analysis.ephemeris.OrbitalElementsAnalysis;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.object.linkbudget.LinkBudget;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.scenario.ScenarioIO;
-import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.Orbit;
-import org.orekit.orbits.PositionAngle;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.analysis.AbstractSpacecraftAnalysis;
-import seakers.orekit.analysis.CompoundSpacecraftAnalysis;
-import seakers.orekit.analysis.ephemeris.LifetimeAnalysis;
-import seakers.orekit.analysis.ephemeris.LifetimeAnalysis2;
-import seakers.orekit.analysis.vectors.VectorAnalysis;
-import seakers.orekit.analysis.vectors.VectorAnalisysEclipseSunlightDiffDrag;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.FastCoverageAnalysis;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
-import seakers.orekit.object.Constellation;
-import seakers.orekit.object.CoveragePoint;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.orbit.J2KeplerianOrbit;
-//import seak.orekit.sensitivity.CoverageVersusOrbitalElements;
-
-/**
- *
- * @author nozomihitomi
- */
-public class Orekit_Pau_eph_vec {
-
- /**
- * @param args the command line arguments
- * @throws org.orekit.errors.OrekitException
- */
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
- long start = System.nanoTime();
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "analysis";
- }
-
- OrekitConfig.init(4);
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2005, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2030, 1, 1, 00, 00, 00.000, utc);
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame inertialFrame = FramesFactory.getEME2000();
-
- //Enter satellite orbital parameters
- double a400 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 400000;
- double a500 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 500000;
- double a600 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 600000;
- double a700 = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 700000;
- double i = FastMath.toRadians(30);
-
- ArrayList payload = new ArrayList<>();
- Collection constel = new ArrayList<>();
- Satellite sat1 = new Satellite("sat@400km", new KeplerianOrbit(a400, 0.0001, i, 0, 0, 0, PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
- Satellite sat2 = new Satellite("sat@500km", new KeplerianOrbit(a500, 0.0001, i, 0, 0, 0, PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
- Satellite sat3 = new Satellite("sat@600km", new KeplerianOrbit(a600, 0.0001, i, 0, 0, 0, PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
- Satellite sat4 = new Satellite("sat@700km", new KeplerianOrbit(a700, 0.0001, i, 0, 0, 0, PositionAngle.MEAN, inertialFrame, startDate, mu), null, payload);
-
- //constel.add(sat1);
- //constel.add(sat2);
- //constel.add(sat3);
- constel.add(sat4);
-
- Constellation constellation = new Constellation("constel", constel);
-
- Properties propertiesPropagator = new Properties();
- propertiesPropagator.setProperty("orekit.propagator.mass", "6");
- propertiesPropagator.setProperty("orekit.propagator.atmdrag", "true");
- propertiesPropagator.setProperty("orekit.propagator.dragarea", "0.13");
- propertiesPropagator.setProperty("orekit.propagator.dragcoeff", "2.2");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.sun", "true");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.moon", "true");
- propertiesPropagator.setProperty("orekit.propagator.solarpressure", "true");
- propertiesPropagator.setProperty("orekit.propagator.solararea", "0.058");
-
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2, propertiesPropagator);
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.NUMERICAL, propertiesPropagator);
-
- //set the analyses
- double analysisTimeStep = 60;
- Collection> analyses = new ArrayList<>();
- for (final Satellite sat : constellation.getSatellites()) {
- analyses.add(new LifetimeAnalysis(startDate, endDate, analysisTimeStep, sat, PositionAngle.MEAN, pf, earthShape));
- //analyses.add(new OrbitalElementsAnalysis(startDate, endDate, analysisTimeStep, sat, PositionAngle.MEAN,pf));
- //analyses.add(new VectorAnalisysEclipseSunlightDiffDrag(startDate, endDate, analysisTimeStep, sat, pf, inertialFrame, 0.13, 0.07, 0.058, 6));
-// analyses.add(new VectorAnalysis(startDate,endDate,analysisTimeStep,sat,pf,inertialFrame) {
-// private static final long serialVersionUID = 4680062066885650976L;
-// @Override
-// public Vector3D getVector(SpacecraftState currentState, Frame frame) throws OrekitException {
-// return currentState.getPVCoordinates(frame).getPosition();
-// }
-// @Override
-// public String getName() {
-// return String.format("position_%s", sat.getName());
-// }
-// });
- }
-
-// Collection analyses = new ArrayList<>();
-// for (final Satellite sat : constellation.getSatellites()) {
-// Collection analyses2 = new ArrayList<>();
-// analyses2.add(new OrbitalElementsAnalysis(startDate, endDate, analysisTimeStep, sat, PositionAngle.MEAN,pf));
-// analyses2.add(new VectorAnalysis(startDate,endDate,analysisTimeStep,sat,pf,inertialFrame) {
-// private static final long serialVersionUID = 4680062066885650976L;
-// @Override
-// public Vector3D getVector(SpacecraftState currentState, Frame frame) throws OrekitException {
-// return currentState.getPVCoordinates(frame).getPosition();
-// }
-// @Override
-// public String getName() {
-// return String.format("position_%s", sat.getName());
-// }
-// });
-// analyses.add(new CompoundSpacecraftAnalysis(startDate, endDate,analysisTimeStep, sat,
-// pf, analyses2));
-// }
-
- Scenario scen = new Scenario.Builder(startDate, endDate, utc).
- analysis(analyses).name("test1").propagatorFactory(pf).build();
- try {
- Logger.getGlobal().finer(String.format("Running Scenario %s", scen));
- Logger.getGlobal().finer(String.format("Number of satellites: %d", constellation.getSatellites().size()));
- scen.call();
- } catch (Exception ex) {
- Logger.getLogger(Orekit_Pau_eph_vec.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
-
- for (Analysis> analysis : analyses) {
- if (analysis instanceof CompoundSpacecraftAnalysis){
- for (Analysis> anal:((CompoundSpacecraftAnalysis) analysis).getAnalyses()){
- ScenarioIO.saveAnalysis(Paths.get(System.getProperty("results"), ""),
- String.format("%s_%s", filename, anal.getName()), anal);
- }
- } else{
- ScenarioIO.saveAnalysis(Paths.get(System.getProperty("results"), ""),
- String.format("%s_%s", filename, analysis.getName()), analysis);
- }
- }
-
- for (Analysis> analysis : analyses) {
- if (analysis instanceof LifetimeAnalysis){
- Logger.getGlobal().finest(String.format("Satellite %s has a lifetime of %.2f years", ((LifetimeAnalysis) analysis).getSatellite().getName(),
- ((LifetimeAnalysis) analysis).getLifetime()));
- }
- }
- long end = System.nanoTime();
- Logger.getGlobal().finest(String.format("Took %.4f sec", (end - start) / Math.pow(10, 9)));
-
- OrekitConfig.end();
-
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/Orekit_Prachi.java b/orekit/src/main/java/seakers/orekit/Orekit_Prachi.java
deleted file mode 100644
index 12a864a..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit_Prachi.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package seakers.orekit;
-
-/* author Prachi - Example to compute the number of satellites for a revisit time of 15 minutes*/
-
-import seakers.orekit.event.EventAnalysis;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.constellations.EnumerateConstellations;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.constellations.WalkerParameters;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.FastCoverageAnalysis;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.util.OrekitConfig;
-
-public class Orekit_Prachi {
- public static void main(String[] args) throws OrekitException, IOException {
-
- // output file
- String filename;
- if (args.length > 0){
- filename = args[0];
- }
- else {
- filename = "my_example";
- }
-
- // initializes the look up tables for planetary position (required!)
- OrekitConfig.init(16);
-
- //setup logger that spits out runtime info
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- /* setting time for simulation */
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2017, 1, 1, 00, 00, 00, utc);
- AbsoluteDate endDate = new AbsoluteDate(2017, 1, 4, 00, 00, 00, utc);
-
- // creating an array of altitudes for Walker Constellations
- // What should be the constraints? Max? Min?
- // Where do we get this data from?
- // Can there be two different altitudes in a constellation?
- // these altitudes are semi major axises = altitude + radius of the earth
- Double[] semiMajorAxis = new Double[7];
- for (int i = 0; i < 7; i++){
- semiMajorAxis[i] = Constants.WGS84_EARTH_EQUATORIAL_RADIUS+(i)*100000+400000;
- }
-
- // creating an array of inclinations for Walker Constellations
- // Constraints?
- // Plane of Reference?
- // Max? Min? trmm goes moes geostar tropics
-
- Double[] inclinations = new Double[16];
- for (int i = 0; i < 16; i++){
- double i_deg = FastMath.toRadians(i*10+10);
- if (i >= 10){
- double kh = 10.10949;
- double cos_i = (Math.pow(((semiMajorAxis[i-10])/Constants.WGS84_EARTH_EQUATORIAL_RADIUS),3.5))/(-kh);
- i_deg = FastMath.toRadians(180*Math.acos(cos_i)/3.1415);
- }
- inclinations[i] = i_deg;
- }
-
-// how to save using an array list
-// ArrayList inclinationList = new ArrayList<>();
-// for (int i = 0; i < 110; i+=10){
-// inclinationList.add(FastMath.toRadians(i));
-// }
-// Double[] inclinations = new Double[inclinationList.size()];
-// inclinations = inclinationList.toArray(inclinations);
-
- // creating an array of total number of satellites in Walker Constellations
- /*int[] numberOfSatellites = new int[30];
- for (int i = 0; i < 30; i++){
- numberOfSatellites[i] = i+1;
- }*/
-
- Integer[] numberOfSatellites = new Integer[8];
- int j = 32;
- for (int i = 0; i < 8; i++){
- numberOfSatellites[i] = i+j;
- j = j+3;
- }
-
- ArrayList constelParams = new ArrayList<>();
- constelParams = EnumerateConstellations.fullFactWalker(semiMajorAxis, inclinations, numberOfSatellites);
-
- //set the frame of reference i.e. inertial
- Frame inertialFrame = FramesFactory.getEME2000();
- Frame earthFrame = null;
- try{
- earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003,true);
- } catch (OrekitException e) {
- System.exit(1);
- }
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
- // define instruments and payload
- NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
- ArrayList payload = new ArrayList<>();
- Instrument view1 = new Instrument("view1", fov, 100, 100);
- payload.add(view1);
-
- // gravitation coefficient
- double mu = Constants.WGS84_EARTH_MU;
-
- ArrayList averageRevisitTime = new ArrayList<>();
- ArrayList meanResponseTime = new ArrayList<>();
-
- BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("revisitTime5.csv")));
- bufferedWriter.append("A,I,T,P,F,Rev,Resp");
- bufferedWriter.newLine();
-
- for(WalkerParameters params : constelParams){
-
- Walker walker = new Walker("walker1", payload, params.getA(), params.getI(), params.getT(), params.getP(), params.getF(), inertialFrame, startDate, mu);
-
- //set the type of propagation - probably use J2
- // Walker constellation is circular
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2, new Properties());
-
- //can set the number of resources available for propagation
- Properties propertiesEventAnalysis = new Properties();
-
- //create a coverage definition -equal area
- CoverageDefinition coverageDefinition = new CoverageDefinition("coverageDef", 20, earthShape, CoverageDefinition.GridStyle.EQUAL_AREA);
- coverageDefinition.assignConstellation(walker);
-
- HashSet covDefs = new HashSet<>();
- covDefs.add(coverageDefinition);
-
- //set the event analyses
-// EventAnalysisFactory eventAnalysisFactory = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
- ArrayList eventAnalyses = new ArrayList<>();
-// FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eventAnalysisFactory.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
-// eventAnalyses.add(fovEvent);
- FastCoverageAnalysis fca = new FastCoverageAnalysis(startDate,endDate,inertialFrame,covDefs,FastMath.toRadians(45));
-
- //building the scenario
- Scenario scene = new Scenario.Builder(startDate, endDate, utc).eventAnalysis(eventAnalyses).covDefs(covDefs).name("CoverageExample").properties(propertiesEventAnalysis).propagatorFactory(pf).build();
-
- try {
- fca.call();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- GroundEventAnalyzer groundEventAnalyzer = new GroundEventAnalyzer(fca.getEvents(coverageDefinition));
- DescriptiveStatistics stats1 = groundEventAnalyzer.getStatistics(AnalysisMetric.DURATION,false, new Properties());
- DescriptiveStatistics stats2 = groundEventAnalyzer.getStatistics(AnalysisMetric.MEAN_TIME_TO_T,false, new Properties());
- averageRevisitTime.add(stats1.getMean());
- meanResponseTime.add(stats2.getMean());
-
- //saves the start and stop time of each access at each ground point
-// ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_fov", scene, coverageDefinition, fca);
-
- //saves the gap metrics in a csv file for each ground point
- // ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename + "_fov_metrics", scene, groundEventAnalyzer, AnalysisMetric.DURATION, false);
-
- long end = System.nanoTime();
- //Logger.getGlobal().finest(String.format("Took %.4f sec", (end - start) / Math.pow(10, 9)));
-
- System.out.println(String.format("Finished %d out of %d", averageRevisitTime.size(),constelParams.size()));
-
-
- bufferedWriter.append(Double.toString(params.getA()) + ",");
- bufferedWriter.append(Double.toString(params.getI()) + ",");
- bufferedWriter.append(Double.toString(params.getT()) + ",");
- bufferedWriter.append(Double.toString(params.getP()) + ",");
- bufferedWriter.append(Double.toString(params.getF()) + ",");
- bufferedWriter.append(Double.toString(stats1.getMean()) + ",");
- bufferedWriter.append(Double.toString(stats2.getMean()));
- bufferedWriter.newLine();
- bufferedWriter.flush();
-
-
- }
-
- OrekitConfig.end();
- }
-}
\ No newline at end of file
diff --git a/orekit/src/main/java/seakers/orekit/Orekit_Prachi_EnumerateWalker.java b/orekit/src/main/java/seakers/orekit/Orekit_Prachi_EnumerateWalker.java
deleted file mode 100644
index 24fc5fa..0000000
--- a/orekit/src/main/java/seakers/orekit/Orekit_Prachi_EnumerateWalker.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.constellations.EnumerateConstellations;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.constellations.WalkerParameters;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.util.OrekitConfig;
-
-/**
- *
- * @author Prachi
- */
-public class Orekit_Prachi_EnumerateWalker {
-
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
- long start = System.nanoTime();
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "tropics";
- }
-
- OrekitConfig.init(1);
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2020, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2020, 1, 8, 00, 00, 00.000, utc);
-
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- Frame inertialFrame = FramesFactory.getEME2000();
-
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
-
-
- Double[] alt = new Double[2];
- alt = new Double[] {400.0,500.0};
- for(int i_alt = 0; i_alt constelParams = new ArrayList<>();
- constelParams = EnumerateConstellations.fullFactWalker(alt, inc, sats);
-
- //define instruments
- //NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
- ArrayList payload=new ArrayList<>();
- NadirRectangularFOV fov = new NadirRectangularFOV(FastMath.toRadians(57), FastMath.toRadians(20), 0, earthShape);
- Instrument view1 = new Instrument("view1", fov, 420, 590);
- payload.add(view1);
-
- ArrayList averageRevisitTime = new ArrayList<>();
- ArrayList meanResponseTime = new ArrayList<>();
-
- HashMap map=new HashMap<>();
-
- for(WalkerParameters params : constelParams){
-
- Walker walker = new Walker("walker", payload, params.getA(), params.getI(), params.getT(), params.getP(), params.getF(), inertialFrame, startDate, mu);
-//
-//
-// //set the type of propagation - probably use J2
-// // Walker constellation is circular
-// PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2, new Properties());
-//
-// //can set the number of resources available for propagation
-// Properties propertiesEventAnalysis = new Properties();
-//
-// //create a coverage definition -equal area
-// CoverageDefinition coverageDefinition = new CoverageDefinition("coverageDef", 15, -30, 30, -180, 180, earthShape, CoverageDefinition.GridStyle.EQUAL_AREA);
-// coverageDefinition.assignConstellation(walker);
-//
-// HashSet covDefs = new HashSet<>();
-// covDefs.add(coverageDefinition);
-//
-// //set the event analyses
-//// EventAnalysisFactory eventAnalysisFactory = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
-// ArrayList eventAnalyses = new ArrayList<>();
-//// FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eventAnalysisFactory.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
-//// eventAnalyses.add(fovEvent);
-// FastCoverageAnalysis fca = new FastCoverageAnalysis(startDate,endDate,inertialFrame,covDefs,FastMath.toRadians(45));
-//
-// //building the scenario
-// Scenario scene = new Scenario.Builder(startDate, endDate, utc).eventAnalysis(eventAnalyses).covDefs(covDefs).name("CoverageExample").properties(propertiesEventAnalysis).propagatorFactory(pf).build();
-//
-// try {
-// fca.call();
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-//
-// GroundEventAnalyzer groundEventAnalyzer = new GroundEventAnalyzer(fca.getEvents(coverageDefinition));
-// DescriptiveStatistics stats1 = groundEventAnalyzer.getStatistics(AnalysisMetric.DURATION,false, new Properties());
-// DescriptiveStatistics stats2 = groundEventAnalyzer.getStatistics(AnalysisMetric.MEAN_TIME_TO_T,false, new Properties());
-// averageRevisitTime.add(stats1.getMean());
-// meanResponseTime.add(stats2.getMean());
-//
-// //saves the start and stop time of each access at each ground point
-//// ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename + "_fov", scene, coverageDefinition, fca);
-//
-// //saves the gap metrics in a csv file for each ground point
-// // ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename + "_fov_metrics", scene, groundEventAnalyzer, AnalysisMetric.DURATION, false);
-//
-// long end = System.nanoTime();
-// //Logger.getGlobal().finest(String.format("Took %.4f sec", (end - start) / Math.pow(10, 9)));
-//
-// System.out.println(String.format("Finished %d out of %d", averageRevisitTime.size(),constelParams.size()));
-
- for(Satellite sat:walker.getSatellites()){
- map.put(String.valueOf(sat.hashCode()), sat);
- }
- }
-
- int uniqueSats=map.size();
- System.out.printf("%d",uniqueSats);
-
- try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("revisitTime.csv")))){
- bufferedWriter.append("A,I,T,P,F,Rev,Resp");
- bufferedWriter.newLine();
- for (int i = 0; i < constelParams.size(); i++){
- bufferedWriter.append(Double.toString(constelParams.get(i).getA()) + ",");
- bufferedWriter.append(Double.toString(constelParams.get(i).getI()) + ",");
- bufferedWriter.append(Double.toString(constelParams.get(i).getT()) + ",");
- bufferedWriter.append(Double.toString(constelParams.get(i).getP()) + ",");
- bufferedWriter.append(Double.toString(constelParams.get(i).getF()) + ",");
- bufferedWriter.append(Double.toString(averageRevisitTime.get(i)) + ",");
- bufferedWriter.append(Double.toString(meanResponseTime.get(i)));
- bufferedWriter.newLine();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- OrekitConfig.end();
- }
-}
diff --git a/orekit/src/main/java/seakers/orekit/Tests.java b/orekit/src/main/java/seakers/orekit/Tests.java
deleted file mode 100644
index c684cf9..0000000
--- a/orekit/src/main/java/seakers/orekit/Tests.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit;
-
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.OneAxisEllipsoid;
-import seakers.orekit.scenario.ScenarioIO;
-import seakers.orekit.util.OrekitConfig;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.constellations.EnumerateConstellations;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.constellations.WalkerParameters;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
-import seakers.orekit.object.CoverageDefinition;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.EQUAL_AREA;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-
-/**
- *
- * @author paugarciabuzzi
- */
-public class Tests {
-
- /**
- * @param args the command line arguments
- * @throws org.orekit.errors.OrekitException
- */
- public static void main(String[] args) throws OrekitException {
- //if running on a non-US machine, need the line below
- Locale.setDefault(new Locale("en", "US"));
-
- String filename;
- if (args.length > 0) {
- filename = args[0];
- } else {
- filename = "tropics";
- }
-
- OrekitConfig.init();
- //setup logger
- Level level = Level.ALL;
- Logger.getGlobal().setLevel(level);
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(level);
- Logger.getGlobal().addHandler(handler);
-
- double earthRadius=Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
- Double[] alts={400000+earthRadius,600000+earthRadius,800000+earthRadius};
- Double[] incs={30.0,51.6,90.0};
- Integer[] ts={1,2,3,4,6,8,9,12,16};
- ArrayList constels= EnumerateConstellations.fullFactWalker(alts, incs, ts);
-
-
-
- TimeScale utc = TimeScalesFactory.getUTC();
- AbsoluteDate startDate = new AbsoluteDate(2016, 1, 1, 00, 00, 00.000, utc);
- AbsoluteDate endDate = new AbsoluteDate(2016, 1, 14, 00, 00, 00.000, utc);
- double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
-
- //must use IERS_2003 and EME2000 frames to be consistent with STK
- Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
- Frame inertialFrame = FramesFactory.getEME2000();
-
- double earth_radius = org.orekit.utils.Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
- BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
- Constants.WGS84_EARTH_FLATTENING, earthFrame);
- int coverageGridGranularity = 20; // separation of points by degree
-
- //define instruments
-// NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
- NadirRectangularFOV fov = new NadirRectangularFOV(FastMath.toRadians(57), FastMath.toRadians(2.5), 0, earthShape);
- ArrayList payload = new ArrayList<>();
- double mass=6;
- double averagePower=10;
- Instrument view1 = new Instrument("view1", fov, mass, averagePower);
- payload.add(view1);
-
- Properties propertiesPropagator = new Properties();
- propertiesPropagator.setProperty("orekit.propagator.mass", "6");
- propertiesPropagator.setProperty("orekit.propagator.atmdrag", "true");
- propertiesPropagator.setProperty("orekit.propagator.dragarea", "0.13"); //worst case scenario 0.3x0.1*4+0.1x0.1
- propertiesPropagator.setProperty("orekit.propagator.dragcoeff", "2.2");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.sun", "true");
- propertiesPropagator.setProperty("orekit.propagator.thirdbody.moon", "true");
- propertiesPropagator.setProperty("orekit.propagator.solarpressure", "true");
- propertiesPropagator.setProperty("orekit.propagator.solararea", "0.058");
-
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.KEPLERIAN,propertiesPropagator);
- //PropagatorFactory pf = new PropagatorFactory(PropagatorType.J2,propertiesPropagator);
- PropagatorFactory pf = new PropagatorFactory(PropagatorType.NUMERICAL,propertiesPropagator);
-
-
- for (int i=0;i covDefs = new HashSet<>();
- covDefs.add(covDef1);
-
-
- Properties propertiesEventAnalysis = new Properties();
- propertiesEventAnalysis.setProperty("fov.numThreads", "12");
-
-
- //set the event analyses
- EventAnalysisFactory eaf = new EventAnalysisFactory(startDate, endDate, inertialFrame, pf);
- ArrayList eventanalyses = new ArrayList<>();
- FieldOfViewEventAnalysis fovEvent = (FieldOfViewEventAnalysis) eaf.createGroundPointAnalysis(EventAnalysisEnum.FOV, covDefs, propertiesEventAnalysis);
- eventanalyses.add(fovEvent);
-
- //set the analyses
- double analysisTimeStep = 60;
- ArrayList> analyses = new ArrayList<>();
-
- Scenario scen = new Scenario.Builder(startDate, endDate, utc).
- eventAnalysis(eventanalyses).analysis(analyses).
- covDefs(covDefs).name(String.format("%s_%s_%s_%s_%s", (a-earthRadius)/1000,incdeg,t,p,f)).properties(propertiesEventAnalysis).
- propagatorFactory(pf).build();
- try {
- Logger.getGlobal().finer(String.format("Running Scenario %s", scen));
- Logger.getGlobal().finer(String.format("Number of points: %d", covDef1.getNumberOfPoints()));
- Logger.getGlobal().finer(String.format("Number of satellites: %d", walker.getSatellites().size()));
- scen.call();
- } catch (Exception ex) {
- Logger.getLogger(Orekit_Pau.class.getName()).log(Level.SEVERE, null, ex);
- throw new IllegalStateException("scenario failed to complete.");
- }
-
- Logger.getGlobal().finer(String.format("Done Running Scenario %s", scen));
-
- ScenarioIO.saveGroundEventAnalysis(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
- ScenarioIO.saveGroundEventAnalysisMetrics(Paths.get(System.getProperty("results"), ""), filename, scen, covDef1, fovEvent);
- ScenarioIO.saveGroundEventAnalyzerObject(Paths.get(System.getProperty("results"), ""), filename, scen,covDef1, fovEvent);
-
- }
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/constellations/Walker.java b/orekit/src/main/java/seakers/orekit/constellations/Walker.java
index 270a41a..b293f21 100644
--- a/orekit/src/main/java/seakers/orekit/constellations/Walker.java
+++ b/orekit/src/main/java/seakers/orekit/constellations/Walker.java
@@ -7,6 +7,11 @@
import java.util.ArrayList;
import java.util.Collection;
+
+import org.orekit.attitudes.AttitudeProvider;
+import org.orekit.attitudes.NadirPointing;
+import org.orekit.bodies.BodyShape;
+import org.orekit.propagation.Propagator;
import seakers.orekit.object.Constellation;
import seakers.orekit.object.Satellite;
import org.hipparchus.util.FastMath;
@@ -45,12 +50,13 @@ public class Walker extends Constellation {
* @param f the relative spacing between satellites in adjacent planes
* @param inertialFrame the frame in which the PVCoordinates are defined
* (must be a pseudo-inertial frame)
+ * @param earthShape shape of the Earth
* @param startDate the date to begin simulating this constellation
* @param mu central attraction coefficient (m³/s²)
*/
public Walker(String name, Collection payload,
- double semimajoraxis, double i, int t, int p, int f, Frame inertialFrame, AbsoluteDate startDate, double mu) {
- this(name, payload, semimajoraxis, i, t, p, f, inertialFrame, startDate, mu, 0.0, 0.0);
+ double semimajoraxis, double i, int t, int p, int f, Frame inertialFrame, BodyShape earthShape, AbsoluteDate startDate, double mu) {
+ this(name, payload, semimajoraxis, i, t, p, f, inertialFrame, earthShape, startDate, mu, 0.0, 0.0);
}
/**
@@ -78,8 +84,8 @@ public Walker(String name, Collection payload,
*/
public Walker(String name, Collection payload,
double semimajoraxis, double i, int t, int p, int f,
- Frame inertialFrame, AbsoluteDate startDate, double mu, double refRaan, double refAnom) {
- super(name, createConstellation(payload, semimajoraxis, i, t, p, f, inertialFrame, startDate, mu, refRaan, refAnom));
+ Frame inertialFrame, BodyShape earthShape, AbsoluteDate startDate, double mu, double refRaan, double refAnom) {
+ super(name, createConstellation(payload, semimajoraxis, i, t, p, f, inertialFrame, earthShape, startDate, mu, refRaan, refAnom));
}
/**
@@ -102,7 +108,7 @@ public Walker(String name, Collection payload,
*/
private static Collection createConstellation(
Collection payload, double semimajoraxis, double i, int t, int p, int f,
- Frame inertialFrame, AbsoluteDate startDate, double mu, double refRaan, double refAnom) {
+ Frame inertialFrame, BodyShape earthShape, AbsoluteDate startDate, double mu, double refRaan, double refAnom) {
//checks for valid parameters
if (t < 0 || p < 0) {
throw new IllegalArgumentException(String.format("Expected t>0, p>0."
@@ -136,7 +142,8 @@ private static Collection createConstellation(
refRaan + planeNum * delRaan,
anom,
PositionAngle.TRUE, inertialFrame, startDate, mu);
- Satellite sat = new Satellite(String.format("sat_walker_%d", s * planeNum + satNum), orb, null, payload);
+ AttitudeProvider att = new NadirPointing(inertialFrame, earthShape);
+ Satellite sat = new Satellite(String.format("sat_walker_%d", s * planeNum + satNum), orb, att, payload);
walker.add(sat);
}
}
diff --git a/orekit/src/main/java/seakers/orekit/event/FieldOfViewAndGndStationEventAnalysis.java b/orekit/src/main/java/seakers/orekit/event/FieldOfViewAndGndStationEventAnalysis.java
index 11c6b1a..fa82d42 100644
--- a/orekit/src/main/java/seakers/orekit/event/FieldOfViewAndGndStationEventAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/event/FieldOfViewAndGndStationEventAnalysis.java
@@ -29,12 +29,10 @@
import org.orekit.orbits.Orbit;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
-import org.orekit.propagation.events.handlers.EventHandler;
-import org.orekit.propagation.numerical.NumericalPropagator;
+import org.orekit.propagation.events.FieldOfViewDetector;
import org.orekit.time.AbsoluteDate;
import seakers.orekit.coverage.access.TimeIntervalArray;
import seakers.orekit.coverage.access.TimeIntervalMerger;
-import seakers.orekit.event.detector.FOVDetector;
import seakers.orekit.event.detector.GroundStationDetector;
import seakers.orekit.event.detector.TimeIntervalHandler;
import seakers.orekit.object.Constellation;
@@ -570,7 +568,7 @@ public FieldOfViewAndGndStationSubRoutine call() throws Exception {
*/
private void singlePropagate() throws OrekitException {
SpacecraftState initialState = prop.getInitialState();
- HashMap> map = new HashMap<>();
+ HashMap> map = new HashMap<>();
HashMap mapGS = new HashMap<>();
for (Instrument inst : sat.getPayload()) {
for (CoveragePoint pt : cdef.getPoints()) {
@@ -579,8 +577,8 @@ private void singlePropagate() throws OrekitException {
continue;
}
- FOVDetector fovDetec = new FOVDetector(pt, inst).withMaxCheck(fovStepSize).withThreshold(threshold);
- TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
+ FieldOfViewDetector fovDetec = new FieldOfViewDetector(pt, inst.getFOV()).withMaxCheck(fovStepSize).withThreshold(threshold);
+ TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
fovDetec = fovDetec.withHandler(fovHandler);
prop.addEventDetector(fovDetec);
map.put(pt, fovHandler);
diff --git a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
index f58a2ff..795d776 100644
--- a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
@@ -25,15 +25,16 @@
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.TopocentricFrame;
+import org.orekit.geometry.fov.FieldOfView;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
-import org.orekit.propagation.events.handlers.EventHandler;
+import org.orekit.propagation.analytical.tle.TLEPropagator;
+import org.orekit.propagation.events.FieldOfViewDetector;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.time.AbsoluteDate;
import seakers.orekit.coverage.access.TimeIntervalArray;
import seakers.orekit.coverage.access.TimeIntervalMerger;
-import seakers.orekit.event.detector.FOVDetector;
import seakers.orekit.event.detector.TimeIntervalHandler;
import seakers.orekit.object.Constellation;
import seakers.orekit.object.CoverageDefinition;
@@ -79,6 +80,11 @@ public class FieldOfViewEventAnalysis extends AbstractGroundEventAnalysis {
*/
private HashMap>> allAccesses;
+ /**
+ * Stores all the accesses of each satellite if saveAllAccesses is true.
+ */
+ private HashMap>> allInstrumentAccesses;
+
/**
* Creates a new event analysis.
*
@@ -103,8 +109,10 @@ public FieldOfViewEventAnalysis(AbsoluteDate startDate, AbsoluteDate endDate,
this.saveAllAccesses = saveAllAccesses;
if (saveAllAccesses) {
this.allAccesses = new HashMap<>();
+ this.allInstrumentAccesses = new HashMap<>();
for (CoverageDefinition cdef : covDefs) {
allAccesses.put(cdef, new HashMap<>());
+ allInstrumentAccesses.put(cdef, new HashMap<>());
}
}
@@ -144,9 +152,22 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
}
//if no precomuted times available, then propagate
- Propagator prop = propagatorFactory.createPropagator(sat.getOrbit(), sat.getGrossMass());
+ Propagator prop = null;
+ if (sat.getOrbit() != null) {
+ prop = propagatorFactory.createPropagator(sat.getOrbit(), sat.getAttProv(), sat.getGrossMass());
+ }
+ else {
+ prop = propagatorFactory.createPropagator(sat.getTLE(), sat.getAttProv(), sat.getGrossMass());
+ }
+
//Set stepsizes and threshold for detectors
- double fovStepSize = sat.getOrbit().getKeplerianPeriod() / 100.;
+ double fovStepSize;
+ if (sat.getOrbit() != null) {
+ fovStepSize = sat.getOrbit().getKeplerianPeriod() / 100.;
+ }
+ else {
+ fovStepSize = (2.*FastMath.PI/sat.getTLE().getMeanMotion()) / 100.;
+ }
double threshold = 1e-3;
FieldOfViewSubRoutine subRoutine = new FieldOfViewSubRoutine(sat, prop, cdef, fovStepSize, threshold);
@@ -391,14 +412,12 @@ private void multiPropogate() throws OrekitException {
continue;
}
- prop.resetInitialState(initialState);
- prop.clearEventsDetectors();
-
- //need to reset initial state of the propagators or will progate from the last stop time
- prop.resetInitialState(initialState);
- prop.clearEventsDetectors();
+ //need to reset initial state of the propagators or will propagate from the last stop time
+ if (!(prop instanceof TLEPropagator)) {
+ prop.resetInitialState(initialState);
+ }
//Next search through intervals with line of sight to compute when point is in field of view
- TimeIntervalHandler fovHandler = addFOVDetector(pt, inst, initialState);
+ TimeIntervalHandler fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
prop.propagate(getStartDate(), getEndDate());
TimeIntervalArray fovTimeArray = fovHandler.getTimeArray().createImmutable();
@@ -421,7 +440,7 @@ private void multiPropogate() throws OrekitException {
*/
private void singlePropagate() throws OrekitException {
SpacecraftState initialState = prop.getInitialState();
- HashMap> map = new HashMap<>();
+ HashMap> map = new HashMap<>();
for (Instrument inst : sat.getPayload()) {
for (CoveragePoint pt : cdef.getPoints()) {
if (!lineOfSightPotential(pt, initialState.getOrbit(), FastMath.toRadians(2.0))) {
@@ -429,7 +448,7 @@ private void singlePropagate() throws OrekitException {
continue;
}
- TimeIntervalHandler fovHandler = addFOVDetector(pt, inst, initialState);
+ TimeIntervalHandler fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
map.put(pt, fovHandler);
}
prop.propagate(getStartDate(), getEndDate());
@@ -477,9 +496,11 @@ private boolean lineOfSightPotential(CoveragePoint pt, Orbit orbit, double latit
return FastMath.abs(pt.getPoint().getLatitude()) - latitudeMargin < subtendedAngle + orbit.getI();
}
- private TimeIntervalHandler addFOVDetector(CoveragePoint pt, Instrument inst, SpacecraftState initialState) {
- FOVDetector fovDetec = new FOVDetector(pt, inst).withMaxCheck(fovStepSize).withThreshold(threshold);
- TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
+ private TimeIntervalHandler addFOVDetector(CoveragePoint pt, FieldOfView fov, SpacecraftState initialState) {
+ FieldOfViewDetector fovDetec =
+ new FieldOfViewDetector(pt, fov).withMaxCheck(fovStepSize).withThreshold(threshold);
+ TimeIntervalHandler fovHandler =
+ new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
fovDetec = fovDetec.withHandler(fovHandler);
prop.addEventDetector(fovDetec);
return fovHandler;
diff --git a/orekit/src/main/java/seakers/orekit/event/LinkBudgetEventAnalysis.java b/orekit/src/main/java/seakers/orekit/event/LinkBudgetEventAnalysis.java
index 33e5f86..5bbb04a 100644
--- a/orekit/src/main/java/seakers/orekit/event/LinkBudgetEventAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/event/LinkBudgetEventAnalysis.java
@@ -23,13 +23,12 @@
import org.orekit.frames.TopocentricFrame;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
-import org.orekit.propagation.events.handlers.EventHandler;
+import org.orekit.propagation.events.FieldOfViewDetector;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.time.AbsoluteDate;
import seakers.orekit.coverage.access.RiseSetTime;
import seakers.orekit.coverage.access.TimeIntervalArray;
import seakers.orekit.coverage.access.TimeIntervalMerger;
-import seakers.orekit.event.detector.FOVDetector;
import seakers.orekit.event.detector.LBDetector;
import seakers.orekit.event.detector.LOSDetector;
import seakers.orekit.event.detector.TimeIntervalHandler;
@@ -435,8 +434,8 @@ private void multiPropogate() throws OrekitException {
prop.resetInitialState(initialState);
prop.clearEventsDetectors();
//Next search through intervals with line of sight to compute when point is in field of view
- FOVDetector fovDetec = new FOVDetector(pt, inst).withMaxCheck(fovStepSize).withThreshold(threshold);
- TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.STOP);
+ FieldOfViewDetector fovDetec = new FieldOfViewDetector(pt, inst.getFOV()).withMaxCheck(fovStepSize).withThreshold(threshold);
+ TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.STOP);
fovDetec = fovDetec.withHandler(fovHandler);
prop.addEventDetector(fovDetec);
@@ -504,13 +503,13 @@ private void multiPropogate() throws OrekitException {
private void singlePropagate() throws OrekitException {
SpacecraftState initialState = prop.getInitialState();
Logger.getGlobal().finer(String.format("Propagating satellite %s...", sat));
- HashMap> map = new HashMap<>();
+ HashMap> map = new HashMap<>();
HashMap map2 = new HashMap<>();
for (Instrument inst : sat.getPayload()) {
for (CoveragePoint pt : cdef.getPoints()) {
- FOVDetector fovDetec = new FOVDetector(pt, inst).withMaxCheck(fovStepSize).withThreshold(threshold);
- TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
+ FieldOfViewDetector fovDetec = new FieldOfViewDetector(pt, inst.getFOV()).withMaxCheck(fovStepSize).withThreshold(threshold);
+ TimeIntervalHandler fovHandler = new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
fovDetec = fovDetec.withHandler(fovHandler);
prop.addEventDetector(fovDetec);
map.put(pt, fovHandler);
diff --git a/orekit/src/main/java/seakers/orekit/event/detector/FOVDetector.java b/orekit/src/main/java/seakers/orekit/event/detector/FOVDetector.java
deleted file mode 100644
index 9b4989c..0000000
--- a/orekit/src/main/java/seakers/orekit/event/detector/FOVDetector.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.event.detector;
-
-import org.orekit.propagation.events.AbstractDetector;
-import org.orekit.propagation.events.handlers.StopOnIncreasing;
-import seakers.orekit.object.Instrument;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.propagation.events.handlers.EventHandler;
-
-/**
- * Detector responsible for tracking when the target enters an instrument's
- * field of view
- *
- * @author nozomihitomi
- */
-public class FOVDetector extends AbstractDetector {
-
- private static final long serialVersionUID = 3765360560924280705L;
-
- private final TopocentricFrame target;
-
- private final Instrument instrument;
-
- /**
- * Constructor for the detector. Must use a instrument/target pair. Max
- * check for step size is set to 600.0 seconds by default. Threshold for
- * event detection is set to default 1e-6 seconds. This detector by default
- * stops when an event is detected.
- *
- * @param target the target to attach the detector to
- * @param instrument the instrument that will observe the target\
- */
- public FOVDetector(final TopocentricFrame target, final Instrument instrument) {
- this(target, instrument, DEFAULT_MAXCHECK, DEFAULT_THRESHOLD, DEFAULT_MAX_ITER, new StopOnIncreasing<>());
- }
-
- /**
- *
- * This constructor is private as users are expected to use the builder
- * API with the various {@code withXxx()} methods to set up the instance
- * in a readable manner without using a huge amount of parameters.
- *
- * @param target the target to attach the detector to
- * @param instrument the instrument that will observe the target resolution
- * of the access times
- * @param maxCheck maximal checking interval (s)
- * @param threshold convergence threshold (s)
- * @param maxIter maximum number of iterations in the event time search
- * @param handler event handler to call at event occurrences
- */
- private FOVDetector(final TopocentricFrame target, final Instrument instrument,
- final double maxCheck, final double threshold, final int maxIter,
- final EventHandler super FOVDetector> handler) {
- super(maxCheck, threshold, maxIter, handler);
-
- this.instrument = instrument;
- this.target = target;
- }
-
- /**
- * Get the position/velocity provider of the target .
- *
- * @return the position/velocity provider of the target
- */
- public TopocentricFrame getPVTarget() {
- return target;
- }
-
- /**
- * The implementation of this g() function relies on the implementation of
- * the FieldOfViewDetector but first computes line of sight. If there is no
- * line of sight between the satellite and the target, the more expensive
- * computation of the FieldOfViewDetector g function is not executed. This
- * g() function is positive when the target enters the field of view and
- * negative if the target is outside the field of view
- *
- * @param s
- * @return
- * @throws OrekitException
- */
- @Override
- public double g(SpacecraftState s) throws OrekitException {
- //only compute the more expensive FieldOfViewDetector g function if
- //the target and satellite meet the minimum elevation threshold
- return instrument.getFOV().g_FOV(s, target);
- }
-
- @Override
- protected FOVDetector create(final double newMaxCheck, final double newThreshold,
- final int newMaxIter, final EventHandler super FOVDetector> newHandler) {
- return new FOVDetector(target, instrument, newMaxCheck, newThreshold, newMaxIter, newHandler);
- }
-}
diff --git a/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java b/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
index 9952292..f1eef2b 100644
--- a/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
+++ b/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
@@ -28,7 +28,7 @@ public class TimeIntervalHandler implements EventHandle
private final TimeIntervalArray timeArray;
- private Action action;
+ private final Action action;
/**
* Creates a field of view handler for a specific coverage point. Default
@@ -83,11 +83,11 @@ public Action eventOccurred(final SpacecraftState s, final T detector,
final boolean increasing) throws OrekitException {
if (increasing) {
- //Access begins
- timeArray.addRiseTime(s.getDate());
- } else {
//Access ends
timeArray.addSetTime(s.getDate());
+ } else {
+ //Access begins
+ timeArray.addRiseTime(s.getDate());
}
return action;
diff --git a/orekit/src/main/java/seakers/orekit/examples/CompoundAnalysisExample.java b/orekit/src/main/java/seakers/orekit/examples/CompoundAnalysisExample.java
index 26042c3..bbe49a9 100644
--- a/orekit/src/main/java/seakers/orekit/examples/CompoundAnalysisExample.java
+++ b/orekit/src/main/java/seakers/orekit/examples/CompoundAnalysisExample.java
@@ -5,16 +5,9 @@
*/
package seakers.orekit.examples;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Locale;
import java.util.Properties;
import java.util.logging.ConsoleHandler;
@@ -23,28 +16,20 @@
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import seakers.orekit.analysis.Analysis;
import seakers.orekit.analysis.ephemeris.OrbitalElementsAnalysis;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.object.CoverageDefinition;
import seakers.orekit.object.Instrument;
import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.object.linkbudget.LinkBudget;
import seakers.orekit.propagation.PropagatorFactory;
import seakers.orekit.propagation.PropagatorType;
import seakers.orekit.scenario.Scenario;
import seakers.orekit.scenario.ScenarioIO;
import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
import org.hipparchus.util.FastMath;
import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
-import org.orekit.frames.TopocentricFrame;
import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.Orbit;
import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.SpacecraftState;
import org.orekit.time.AbsoluteDate;
@@ -56,17 +41,7 @@
import seakers.orekit.analysis.CompoundSpacecraftAnalysis;
import seakers.orekit.analysis.ephemeris.LifetimeAnalysis;
import seakers.orekit.analysis.vectors.VectorAnalysis;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.FastCoverageAnalysis;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
import seakers.orekit.object.Constellation;
-import seakers.orekit.object.CoveragePoint;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
-import seakers.orekit.orbit.J2KeplerianOrbit;
//import seak.orekit.sensitivity.CoverageVersusOrbitalElements;
/**
diff --git a/orekit/src/main/java/seakers/orekit/examples/CoverageExample.java b/orekit/src/main/java/seakers/orekit/examples/CoverageExample.java
index aad7e92..d0c19c5 100644
--- a/orekit/src/main/java/seakers/orekit/examples/CoverageExample.java
+++ b/orekit/src/main/java/seakers/orekit/examples/CoverageExample.java
@@ -12,10 +12,12 @@
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
+
+import org.hipparchus.geometry.euclidean.threed.Vector3D;
+import org.orekit.geometry.fov.CircularFieldOfView;
import seakers.orekit.constellations.Walker;
import seakers.orekit.object.CoverageDefinition;
import seakers.orekit.object.Instrument;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
import seakers.orekit.propagation.PropagatorFactory;
import seakers.orekit.propagation.PropagatorType;
import seakers.orekit.scenario.Scenario;
@@ -87,13 +89,13 @@ public static void main(String[] args) throws OrekitException {
double i = FastMath.toRadians(45);
//define instruments and payload
- NadirSimpleConicalFOV fov = new NadirSimpleConicalFOV(FastMath.toRadians(45), earthShape);
+ CircularFieldOfView fov = new CircularFieldOfView(Vector3D.PLUS_K, FastMath.toRadians(45), 0.);
ArrayList payload = new ArrayList<>();
Instrument view1 = new Instrument("view1", fov, 100, 100);
payload.add(view1);
//Create a walker constellation
- Walker walker = new Walker("walker1", payload, a, i, 2, 2, 0, inertialFrame, startDate, mu);
+ Walker walker = new Walker("walker1", payload, a, i, 2, 2, 0, inertialFrame, earthShape, startDate, mu);
//create a coverage definition
CoverageDefinition covDef1 = new CoverageDefinition("covdef1", 10, earthShape, CoverageDefinition.GridStyle.UNIFORM);
diff --git a/orekit/src/main/java/seakers/orekit/examples/PositionVectorExample.java b/orekit/src/main/java/seakers/orekit/examples/PositionVectorExample.java
index b0f726c..b7b4135 100644
--- a/orekit/src/main/java/seakers/orekit/examples/PositionVectorExample.java
+++ b/orekit/src/main/java/seakers/orekit/examples/PositionVectorExample.java
@@ -12,6 +12,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
+import org.orekit.bodies.BodyShape;
+import org.orekit.bodies.OneAxisEllipsoid;
+import org.orekit.utils.IERSConventions;
import seakers.orekit.analysis.Analysis;
import seakers.orekit.constellations.Walker;
import seakers.orekit.object.Instrument;
@@ -67,6 +70,9 @@ public static void main(String[] args) throws OrekitException {
//define the scenario parameters
double mu = Constants.WGS84_EARTH_MU; // gravitation coefficient
Frame inertialFrame = FramesFactory.getEME2000();
+ Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
+ BodyShape earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
+ Constants.WGS84_EARTH_FLATTENING, earthFrame);
//Enter satellite orbital parameters
double a = Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 600000;
@@ -74,7 +80,7 @@ public static void main(String[] args) throws OrekitException {
//Create a walker constellation
ArrayList payload = new ArrayList<>();
- Walker walker = new Walker("walker1", payload, a, i, 2, 1, 0, inertialFrame, startDate, mu);
+ Walker walker = new Walker("walker1", payload, a, i, 2, 1, 0, inertialFrame, earthShape, startDate, mu);
//set parameters for numerical propagator
Properties propertiesPropagator = new Properties();
diff --git a/orekit/src/main/java/seakers/orekit/object/Instrument.java b/orekit/src/main/java/seakers/orekit/object/Instrument.java
index 889406c..7dc286c 100644
--- a/orekit/src/main/java/seakers/orekit/object/Instrument.java
+++ b/orekit/src/main/java/seakers/orekit/object/Instrument.java
@@ -7,7 +7,8 @@
import java.io.Serializable;
import java.util.Objects;
-import seakers.orekit.object.fieldofview.FieldOfViewDefinition;
+
+import org.orekit.geometry.fov.FieldOfView;
/**
* The sensor or instrument to install aboard a satellite or at a ground
@@ -22,7 +23,7 @@ public class Instrument implements OrekitObject, Serializable {
private final String name;
- private final FieldOfViewDefinition fov;
+ private final FieldOfView fov;
private final double mass;
@@ -37,7 +38,7 @@ public class Instrument implements OrekitObject, Serializable {
* @param averagePower the average power required by the instrument
*
*/
- public Instrument(String name, FieldOfViewDefinition fov, double mass, double averagePower) {
+ public Instrument(String name, FieldOfView fov, double mass, double averagePower) {
this.name = name;
this.fov = fov;
this.mass = mass;
@@ -49,7 +50,7 @@ public Instrument(String name, FieldOfViewDefinition fov, double mass, double av
*
* @return
*/
- public FieldOfViewDefinition getFOV() {
+ public FieldOfView getFOV() {
return fov;
}
diff --git a/orekit/src/main/java/seakers/orekit/object/Satellite.java b/orekit/src/main/java/seakers/orekit/object/Satellite.java
index a97f06a..859fd83 100644
--- a/orekit/src/main/java/seakers/orekit/object/Satellite.java
+++ b/orekit/src/main/java/seakers/orekit/object/Satellite.java
@@ -19,6 +19,7 @@
import org.orekit.orbits.Orbit;
import org.orekit.orbits.OrbitType;
import org.orekit.propagation.Propagator;
+import org.orekit.propagation.analytical.tle.TLE;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.TimeStampedPVCoordinates;
import seakers.orekit.object.communications.Receiver;
@@ -48,6 +49,11 @@ public class Satellite implements OrekitObject, Serializable {
*/
private final Orbit orbit;
+ /**
+ * initial TLE of satellite
+ */
+ private final TLE tle;
+
/**
* The name of the satellite
*/
@@ -93,6 +99,14 @@ public Satellite(String name, Orbit orbit) {
Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
}
+ public Satellite(String name, TLE tle) {
+ this(name, tle, null, new ArrayList<>(),
+ new ReceiverAntenna(1., new HashSet<>()),
+ new TransmitterAntenna(1, new HashSet<>()),
+ Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
+ }
+
+
/**
* Constructor for new satellite instance with default wet mass and default
* dry mass
@@ -109,6 +123,13 @@ public Satellite(String name, Orbit orbit, AttitudeProvider attProv, Collection<
Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
}
+ public Satellite(String name, TLE tle, AttitudeProvider attProv, Collection instruments) {
+ this(name, tle, attProv, instruments,
+ new ReceiverAntenna(1., new HashSet<>()),
+ new TransmitterAntenna(1, new HashSet<>()),
+ Propagator.DEFAULT_MASS, Propagator.DEFAULT_MASS);
+ }
+
/**
* Constructor for new satellite instance with specified wet mass and
* default dry mass
@@ -125,6 +146,21 @@ public Satellite(String name, Orbit orbit, AttitudeProvider attProv, Collection<
public Satellite(String name, Orbit orbit, AttitudeProvider attProv, Collection instruments,
Receiver receiver, Transmitter transmitter, double wetMass, double dryMass) {
this.orbit = orbit;
+ this.tle = null;
+ this.name = name;
+ this.payload = new ArrayList<>(instruments);
+ this.attProv = attProv;
+ this.transmitter = transmitter;
+ this.receiver = receiver;
+ this.wetMass = wetMass;
+ this.dryMass = dryMass;
+ this.grossMass = wetMass + dryMass;
+ }
+
+ public Satellite(String name, TLE tle, AttitudeProvider attProv, Collection instruments,
+ Receiver receiver, Transmitter transmitter, double wetMass, double dryMass) {
+ this.orbit = null;
+ this.tle = tle;
this.name = name;
this.payload = new ArrayList<>(instruments);
this.attProv = attProv;
@@ -143,6 +179,10 @@ public Orbit getOrbit() {
return orbit;
}
+ public TLE getTLE() {
+ return tle;
+ }
+
public AttitudeProvider getAttProv() {
return attProv;
}
@@ -212,10 +252,12 @@ public int hashCode() {
hash = 23 * hash + Objects.hashCode(this.payload);
try {
//create hash for orbit
- TimeStampedPVCoordinates pv = this.orbit.getPVCoordinates(FramesFactory.getEME2000());
- hash = 23 * hash + Objects.hashCode(pv.getPosition());
- hash = 23 * hash + Objects.hashCode(pv.getVelocity());
- hash = 23 * hash + Objects.hashCode(pv.getAcceleration());
+ if (this.orbit != null) {
+ hash = 23 * hash + this.orbit.hashCode();
+ }
+ else if (this.tle != null) {
+ hash = 23 * hash + this.tle.hashCode();
+ }
//get hash for attitude provider based on rotation matrix at specific time in specific frame
if (attProv != null) {
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/AbstractFieldOfViewDefinition.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/AbstractFieldOfViewDefinition.java
deleted file mode 100644
index 8642143..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/AbstractFieldOfViewDefinition.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import java.io.Serializable;
-import org.hipparchus.geometry.euclidean.threed.Rotation;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.frames.Transform;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.utils.PVCoordinatesProvider;
-import org.orekit.utils.TimeStampedPVCoordinates;
-
-/**
- * This class is responsible for making field of view detection more
- * computationally efficient by computing the elevation between ground targets
- * and the spacecraft. The user can decide to use a minimum elevation (from the
- * perspective of the target) that must be exceeded before attempting a more
- * expensive field of view computation.
- *
- * @author nozomihitomi
- */
-public abstract class AbstractFieldOfViewDefinition implements FieldOfViewDefinition, Serializable {
-
- private static final long serialVersionUID = -2441300006537852331L;
-
- private final double minElevation;
-
- /**
- * Use this constructor to set the minimum elevation that must be exceeded
- * before the more expensive field of view computation is carried out.
- *
- * @param minElevation the minimum elevation threshold [radians] that must
- * be met before the FieldOfViewDetector g() function is computed
- */
- public AbstractFieldOfViewDefinition(double minElevation) {
- this.minElevation = minElevation;
- }
-
- /**
- * This constructor assumes that line of sight is required before the more
- * expensive field of view computation is carried out.
- */
- public AbstractFieldOfViewDefinition() {
- this(0.0);
- }
-
- /**
- * Function to see if the given target is in line of sight with the
- * spacecraft (regardless of attitude). Implementation is similar to the
- * g(s) function from the elevation detector. That is, the g_lineOfSight
- * function value is the difference between the current elevation (and
- * azimuth if necessary) and the reference mask or minimum value (i.e. set
- * to 0degrees). This function will return a positive value if the satellite
- * and the target have line of sight. The function will return a negative
- * value if the satellite and the target do not have line of sight
- *
- * @param s the current spacecraft state
- * @param target The target to be viewed
- * @return This function will return a positive value if the satellite and
- * the target have line of sight. The function will return a negative value
- * if the satellite and the target do not have line of sight
- * @throws org.orekit.errors.OrekitException
- */
- public double g_lineOfSight(SpacecraftState s, TopocentricFrame target) throws OrekitException {
-
- final double trueElevation = target.getElevation(s.getPVCoordinates().getPosition(),
- s.getFrame(), s.getDate());
- return trueElevation - minElevation;
- }
-
- /**
- * The unique g function for a given field of view shape.
- *
- * @param s the spacecraft's current state
- * @param target the target of interest
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- protected abstract double g(SpacecraftState s, TopocentricFrame target) throws OrekitException;
-
- /**
- * This g() function is positive when the given target enters the field of
- * view and negative if the target is outside the field of view. Assumes
- * that line of sight is required
- *
- * @param s the spacecraft's current state
- * @param target the target of interest
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- @Override
- public double g_FOV(SpacecraftState s, TopocentricFrame target) throws OrekitException {
- double los = g_lineOfSight(s, target);
- if(los > 0){
- return g(s, target);
- }else{
- return los;
- }
- }
-
- /**
- * Gets the nadir pointing vector at the current spacecraft state.
- *
- * @param s current spacecraft state
- * @param pvProv
- * @param shape
- * @param frame
- * @return
- * @throws OrekitException
- */
- protected Vector3D getSpacecraftToNadirPosition(final SpacecraftState s, final PVCoordinatesProvider pvProv, final BodyShape shape,
- final Frame frame) throws OrekitException {
- final Vector3D nadirPosRef = getNadirPosition(pvProv, shape, s.getDate(), frame);
- return nadirPosRef.subtract(s.getPVCoordinates(s.getFrame()).getPosition());
- }
-
- /**
- * Gets the nadir position in the spacecraft frame
- *
- * @param pvProv pv coordinate provider for the spacecraft
- * @param shape The shape of the body which the satellite orbits
- * @param date The date at which to obtain the nadir position
- * @param frame The frame in which to obtain the nadir vector
- * @return The position vector of the nadir point in the given frame of
- * reference
- * @throws org.orekit.errors.OrekitException
- */
- protected Vector3D getNadirPosition(final PVCoordinatesProvider pvProv, final BodyShape shape,
- final AbsoluteDate date, final Frame frame) throws OrekitException {
-
- // transform from specified reference frame to body frame
- final Transform refToBody = frame.getTransformTo(shape.getBodyFrame(), date);
- return nadirRef(pvProv.getPVCoordinates(date, frame), shape, refToBody).getPosition();
- }
-
- /**
- * Compute ground point in nadir direction, in reference frame. This method
- * is based on the nadir pointing law NadirPointin
- *
- * @param scRef spacecraft coordinates in reference frame
- * @param The shape of the body which the satellite orbits
- * @param refToBody transform from reference frame to body frame
- * @return intersection point in body frame (only the position is set!)
- * @exception OrekitException if line of sight does not intersect body
- */
- private TimeStampedPVCoordinates nadirRef(final TimeStampedPVCoordinates scRef, final BodyShape shape, final Transform refToBody)
- throws OrekitException {
-
- final Vector3D satInBodyFrame = refToBody.transformPosition(scRef.getPosition());
-
- // satellite position in geodetic coordinates
- final GeodeticPoint gpSat = shape.transform(satInBodyFrame, shape.getBodyFrame(), scRef.getDate());
-
- // nadir position in geodetic coordinates
- final GeodeticPoint gpNadir = new GeodeticPoint(gpSat.getLatitude(), gpSat.getLongitude(), 0.0);
-
- // nadir point position in body frame
- final Vector3D pNadirBody = shape.transform(gpNadir);
-
- // nadir point position in reference frame
- final Vector3D pNadirRef = refToBody.getInverse().transformPosition(pNadirBody);
-
- return new TimeStampedPVCoordinates(scRef.getDate(), pNadirRef, Vector3D.ZERO, Vector3D.ZERO);
-
- }
-
- /**
- * This method returns a rotation matrix that will transform vectors v1 and
- * v2 to point toward nadir and the vector that is normal to the orbital
- * plane, respectively. Normal vector is used instead of the velocity vector
- * because the velocity vector and nadir vector may not be orthogonal
- *
- * @param v1 Vector to line up with nadir
- * @param v2 Vector to line up with the velocity vector
- * @param s the current spacecraft state
- * @param pvProv the pv provider for the satellite
- * @param shape the shape of the body to define nadir direction
- * @param frame the reference frame to translate vectors to
- * @return
- * @throws OrekitException
- */
- public Rotation alignWithNadirAndNormal(Vector3D v1, Vector3D v2,
- final SpacecraftState s, final PVCoordinatesProvider pvProv, final BodyShape shape,
- final Frame frame) throws OrekitException {
- final Vector3D nadirRef = getSpacecraftToNadirPosition(s, pvProv, shape, frame).normalize();
- Vector3D velRef = pvProv.getPVCoordinates(s.getDate(), frame).getVelocity().normalize();
- Vector3D orbitNormal = nadirRef.crossProduct(velRef).normalize();
-
- return new Rotation(nadirRef, orbitNormal, v1, v2);
- }
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/CustomFieldOfView.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/CustomFieldOfView.java
deleted file mode 100644
index 2898c29..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/CustomFieldOfView.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import org.hipparchus.geometry.euclidean.threed.Line;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.hipparchus.geometry.partitioning.Region;
-import org.hipparchus.geometry.spherical.twod.Edge;
-import org.hipparchus.geometry.spherical.twod.S2Point;
-import org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet;
-import org.hipparchus.geometry.spherical.twod.Vertex;
-import org.hipparchus.linear.ArrayRealVector;
-import org.hipparchus.linear.RealMatrix;
-import org.hipparchus.linear.RealVector;
-import org.hipparchus.util.FastMath;
-import org.hipparchus.util.MathUtils;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
-import org.orekit.errors.OrekitException;
-import org.orekit.errors.OrekitMessages;
-import org.orekit.frames.Frame;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.frames.Transform;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.propagation.events.FieldOfView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author nozomihitomi
- */
-public class CustomFieldOfView extends AbstractFieldOfViewDefinition {
- private static final long serialVersionUID = -9001535864555179340L;
-
- private final FieldOfView fov;
-
- public CustomFieldOfView(FieldOfView fov) {
- super(0.0);
- this.fov = fov;
- }
-
- public FieldOfView getFov() {
- return fov;
- }
-
- @Override
- public String toString() {
- return "CustomFieldOfView{}";
- }
-
- /**
- *
- * The g function value is the angular offset between the target and the {@link FieldOfView#offsetFromBoundary(Vector3D)
- * Field Of View boundary}. It is positive if the target is visible within
- * the Field Of View and negative if it is outside of the Field Of View,
- * including the margin.
- *
- *
- * As per the previous definition, when the target enters the Field Of View,
- * a decreasing event is generated, and when the target leaves the Field Of
- * View, an increasing event is generated.
- *
- * @param s current state of the spacecraft
- * @param target the target to view
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- @Override
- protected double g(SpacecraftState s, TopocentricFrame target) throws OrekitException {
- // get line of sight in spacecraft frame
- final Vector3D targetPosInert
- = target.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
- final Vector3D lineOfSightSC = s.toTransform().transformPosition(targetPosInert);
-
- return -fov.offsetFromBoundary(lineOfSightSC);
-
- }
-
- @Override
- public double offsetFromBoundary(Vector3D lineOfSight) {
- return fov.offsetFromBoundary(lineOfSight);
- }
-
- @Override
- public RealVector g_FOV(RealMatrix lineOfSight) {
- double[] out = new double[lineOfSight.getColumnDimension()];
- for(int i=0; i
- * This method assumes the Field Of View is centered on some carrier,
- * which will typically be a spacecraft or a ground station antenna.
- * The points in the footprint boundary loops are all at altitude zero
- * with respect to the ellipsoid, they correspond either to projection
- * on ground of the edges of the Field Of View, or to points on the body
- * limb if the Field Of View goes past horizon. The points on the limb
- * see the carrier origin at zero elevation. If the Field Of View is so
- * large it contains entirely the body, all points will correspond to
- * points at limb. If the Field Of View looks away from body, the
- * boundary loops will be an empty list. The points within footprint
- * the loops are sorted in trigonometric order as seen from the carrier.
- * This implies that someone traveling on ground from one point to the
- * next one will have the points visible from the carrier on his left
- * hand side, and the points not visible from the carrier on his right
- * hand side.
- *
- *
- * The truncation of Field Of View at limb can induce strange results
- * for complex Fields Of View. If for example a Field Of View is a
- * ring with a hole and part of the ring goes past horizon, then instead
- * of having a single loop with a C-shaped boundary, the method will
- * still return two loops truncated at the limb, one clockwise and one
- * counterclockwise, hence "closing" the C-shape twice. This behavior
- * is considered acceptable.
- *
- *
- * If the carrier is a spacecraft, then the {@code fovToBody} transform
- * can be computed from a {@link org.orekit.propagation.SpacecraftState}
- * as follows:
- *
- *
- * Transform inertToBody = state.getFrame().getTransformTo(body.getBodyFrame(), state.getDate());
- * Transform fovToBody = new Transform(state.getDate(),
- * state.toTransform().getInverse(),
- * inertToBody);
- *
- *
- * If the carrier is a ground station, located using a topocentric frame
- * and managing its pointing direction using a transform between the
- * dish frame and the topocentric frame, then the {@code fovToBody} transform
- * can be computed as follows:
- *
- *
- * Transform topoToBody = topocentricFrame.getTransformTo(body.getBodyFrame(), date);
- * Transform topoToDish = ...
- * Transform fovToBody = new Transform(date,
- * topoToDish.getInverse(),
- * topoToBody);
- *
- *
- * Only the raw zone is used, the angular margin is ignored here.
- *
- * @param fovToBody transform between the frame in which the Field Of View
- * is defined and body frame.
- * @param body body surface the Field Of View will be projected on
- * @param angularStep step used for boundary loops sampling (radians)
- * @return list footprint boundary loops (there may be several independent
- * loops if the Field Of View shape is complex)
- */
- public List> getFootprint(final Transform fovToBody, final OneAxisEllipsoid body,
- final double angularStep) {
-
- final Frame bodyFrame = body.getBodyFrame();
- final Vector3D position = fovToBody.transformPosition(Vector3D.ZERO);
- final double r = position.getNorm();
- if (body.isInside(position)) {
- throw new OrekitException(OrekitMessages.POINT_INSIDE_ELLIPSOID);
- }
-
- final SphericalPolygonsSet zone = fov.getZone();
-
- final List> footprint = new ArrayList>();
-
- final List boundary = zone.getBoundaryLoops();
- for (final Vertex loopStart : boundary) {
- int count = 0;
- final List loop = new ArrayList();
- boolean intersectionsFound = false;
- for (Edge edge = loopStart.getOutgoing();
- count == 0 || edge.getStart() != loopStart;
- edge = edge.getEnd().getOutgoing()) {
- ++count;
- final int n = (int) FastMath.ceil(edge.getLength() / angularStep);
- final double delta = edge.getLength() / n;
- for (int i = 0; i < n; ++i) {
- final Vector3D awaySC = new Vector3D(r, edge.getPointAt(i * delta));
- final Vector3D awayBody = fovToBody.transformPosition(awaySC);
- final Line lineOfSight = new Line(position, awayBody, 1.0e-3);
- GeodeticPoint gp = body.getIntersectionPoint(lineOfSight, position,
- bodyFrame, null);
- if (gp != null &&
- Vector3D.dotProduct(awayBody.subtract(position),
- body.transform(gp).subtract(position)) < 0) {
- // the intersection is in fact on the half-line pointing
- // towards the back side, it is a spurious intersection
- gp = null;
- }
-
- if (gp != null) {
- // the line of sight does intersect the body
- intersectionsFound = true;
- } else {
- // the line of sight does not intersect body
- // we use a point on the limb
- gp = body.transform(body.pointOnLimb(position, awayBody), bodyFrame, null);
- }
-
- // add the point in front of the list
- // (to ensure the loop will be in trigonometric orientation)
- loop.add(0, gp);
-
- }
- }
-
- if (intersectionsFound) {
- // at least some of the points did intersect the body,
- // this loop contributes to the footprint
- footprint.add(loop);
- }
-
- }
-
- if (footprint.isEmpty()) {
- // none of the Field Of View loops cross the body
- // either the body is outside of Field Of View, or it is fully contained
- // we check the center
- final Vector3D bodyCenter = fovToBody.getInverse().transformPosition(Vector3D.ZERO);
- if (zone.checkPoint(new S2Point(bodyCenter)) != Region.Location.OUTSIDE) {
- // the body is fully contained in the Field Of View
- // we use the full limb as the footprint
- final Vector3D x = bodyCenter.orthogonal();
- final Vector3D y = Vector3D.crossProduct(bodyCenter, x).normalize();
- final double sinEta = body.getEquatorialRadius() / r;
- final double sinEta2 = sinEta * sinEta;
- final double cosAlpha = (FastMath.cos(angularStep) + sinEta2 - 1) / sinEta2;
- final int n = (int) FastMath.ceil(MathUtils.TWO_PI / FastMath.acos(cosAlpha));
- final double delta = MathUtils.TWO_PI / n;
- final List loop = new ArrayList(n);
- for (int i = 0; i < n; ++i) {
- final Vector3D outside = new Vector3D(r * FastMath.cos(i * delta), x,
- r * FastMath.sin(i * delta), y);
- loop.add(body.transform(body.pointOnLimb(position, outside), bodyFrame, null));
- }
- footprint.add(loop);
- }
- }
-
- return footprint;
-
- }
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/FieldOfViewDefinition.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/FieldOfViewDefinition.java
deleted file mode 100644
index 6654a51..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/FieldOfViewDefinition.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.hipparchus.linear.RealMatrix;
-import org.hipparchus.linear.RealVector;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-
-/**
- * This interface is connects different fields of view to their proper g()
- * function that is computed in the event detectors
- *
- * @author nozomihitomi
- */
-public interface FieldOfViewDefinition {
-
- /**
- * This g() function is positive when the given target enters the field of
- * view and negative if the target is outside the field of view
- *
- * @param s the spacecraft's current state
- * @param target the target of interest
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- public double g_FOV(SpacecraftState s, TopocentricFrame target) throws OrekitException;
-
- /**
- * Get the angular offset of target point with respect to the Field Of View
- * Boundary.
- *
- * The offset is roughly an angle with respect to the closest boundary
- * point, corrected by the margin and using some approximation far from the
- * Field Of View. It is positive if the target is outside of the Field Of
- * view, negative inside, and zero if the point is exactly on the boundary
- * (always taking the margin into account).
- *
- *
- * As Field Of View can have complex shapes that may require long
- * computation, when the target point can be proven to be outside of the
- * Field Of View, a faster but approximate computation is done, that
- * underestimate the offset. This approximation is only performed about 0.01
- * radians outside of the zone and is designed to still return a positive
- * value if the full accurate computation would return a positive value.
- * When target point is close to the zone (and furthermore when it is inside
- * the zone), the full accurate computation is performed. This setup allows
- * this offset to be used as a reliable way to detect Field Of View boundary
- * crossings, which correspond to sign changes of the offset.
- *
- *
- * @param lineOfSight line of sight from the center of the Field Of View
- * support unit sphere to the target in Field Of View canonical frame
- * @return an angular offset negative if the target is visible within the
- * Field Of View and positive if it is outside of the Field Of View,
- * including the margin (note that this cannot take into account interposing
- * bodies)
- */
- public double offsetFromBoundary(Vector3D lineOfSight);
-
- /**
- * This g() function is positive when the given target enters the field of
- * view and negative if the target is outside the field of view
- *
- * @param lineOfSight line of sight normalized-vectors from the center of the Field Of
- * View support unit sphere to the targets in Field Of View canonical frame.
- * The matrix shall be a 3xN matrix where the rows are the x,y,z coordinates
- * and N is the number of targets
- * @return a vector containing the gvalues. Positive if the target is
- * visible within the Field Of View and negative if it is outside of the
- * Field Of View, including the margin
- */
- public RealVector g_FOV(RealMatrix lineOfSight);
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirRectangularFOV.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirRectangularFOV.java
deleted file mode 100644
index c51482f..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirRectangularFOV.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import org.hipparchus.geometry.euclidean.threed.Rotation;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.orekit.bodies.BodyShape;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-
-/**
- * This class models a rectangular field of view. The field of view is defined
- * with a center axis, two axes to define the aperture directions, and two half
- * aperture angles.
- *
- * @author nozomihitomi
- */
-public class NadirRectangularFOV extends RectangularFieldOfView {
- private static final long serialVersionUID = 1559069965493414756L;
-
- private final BodyShape shape;
-
- /**
- * Build a Field Of View with dihedral shape (i.e. rectangular shape).
- * @param acrossTrackHalfAperture FOV half aperture angle in the across-track direction,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param alongTrackHalfAperture FOV half aperture angle in the along-track direction,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param margin angular margin to apply to the zone (if positive,
- * the Field Of View will consider points slightly outside of the
- * zone are still visible)
- * @param shape the shape of the body to define the nadir direction
- * @throws OrekitException
- */
- public NadirRectangularFOV(
- double acrossTrackHalfAperture, double alongTrackHalfAperture,
- double margin, BodyShape shape) throws OrekitException {
- this(Vector3D.PLUS_I, acrossTrackHalfAperture, Vector3D.PLUS_J, alongTrackHalfAperture, margin, shape);
- }
-
- /**
- * Build a Field Of View with dihedral shape (i.e. rectangular shape).
- * @param axis1 FOV dihedral axis 1, in spacecraft frame
- * @param halfAperture1 FOV dihedral half aperture angle 1,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param axis2 FOV dihedral axis 2, in spacecraft frame
- * @param halfAperture2 FOV dihedral half aperture angle 2,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param margin angular margin to apply to the zone (if positive,
- * the Field Of View will consider points slightly outside of the
- * zone are still visible)
- * @param shape the shape of the body to define the nadir direction
- * @throws OrekitException
- */
- public NadirRectangularFOV(
- Vector3D axis1, double halfAperture1,
- Vector3D axis2, double halfAperture2,
- double margin, BodyShape shape) throws OrekitException {
- super(Vector3D.PLUS_K, axis1, halfAperture1, axis2, halfAperture2, margin);
- this.shape = shape;
- }
-
-
- @Override
- protected double g(SpacecraftState s, TopocentricFrame target) throws OrekitException {
- // get line of sight in spacecraft frame
- final Vector3D targetPosInert
- = target.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
- Vector3D spacecraftPosInert = s.getPVCoordinates(s.getFrame()).getPosition();
- Vector3D losInert = spacecraftPosInert.subtract(targetPosInert);
- Rotation rot = alignWithNadirAndNormal(getCenter(), getAxis2(), s, s.getOrbit(), shape, s.getFrame());
- Vector3D lineOfSightSC = rot.applyTo(losInert);
- //TODO find out why need to take the negative
- return -getFov().offsetFromBoundary(lineOfSightSC.negate());
- }
-
- @Override
- public String toString() {
- return "NadirRectangularFieldOfView{ HalfAngle1=" + getHalfAperture1() + ", HalfAngle2=" + getHalfAperture2() + "}";
- }
-
-
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirSimpleConicalFOV.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirSimpleConicalFOV.java
deleted file mode 100644
index 8992bea..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/NadirSimpleConicalFOV.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.orekit.bodies.BodyShape;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-
-/**
- * This field of view models a simple cone that is always pointed nadir
- * regardless of the spacecraft attitude. It is defined with a center axis in
- * the spacecraft frame of reference, and the half aperture angle. This can be
- * used in place of nadir-pointing + SimpleConicalFOV to save on compute time on
- * computing the attitude at every time step (this class computes the attitude
- * only when computing the g() event function)
- *
- * @author nozomihitomi
- */
-public class NadirSimpleConicalFOV extends SimpleConicalFieldOfView {
-
- private static final long serialVersionUID = -5871573780685218252L;
-
- private final BodyShape shape;
-
- /**
- * Constructor to create a simple conical field of view
- *
- * @param halfAngle FOV half aperture angle [rad], must be less than π/2.
- * @param shape the shape of the body to define the nadir direction
- */
- public NadirSimpleConicalFOV(double halfAngle, BodyShape shape) {
- super(Vector3D.PLUS_K, halfAngle);
- this.shape = shape;
- }
-
- /**
- * {@inheritDoc}
- *
- * The g function value is for circular field of views and is the difference
- * between FOV half aperture and the absolute value of the angle between
- * target direction and field of view center. It is positive inside the FOV
- * and negative outside.
- *
- *
- * @param s the current spacecraft state
- * @param target
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- protected double g(SpacecraftState s, TopocentricFrame target) throws OrekitException {
-
- // Compute target position/velocity at date in spacecraft frame */
- final Vector3D targetPosInert = new Vector3D(1, target.getPVCoordinates(s.getDate(), s.getFrame()).getPosition(),
- -1, s.getPVCoordinates().getPosition());
- Vector3D spacecraftToNadirPosition = getSpacecraftToNadirPosition(s, s.getOrbit(), shape, s.getFrame());
- // Target is in the field of view if the absolute value that angle is smaller than FOV half aperture.
- // g function value is the difference between FOV half aperture and the absolute value of the angle between
- // target direction and field of view center. It is positive inside the FOV and negative outside.
- return getHalfAngle() - Vector3D.angle(targetPosInert, spacecraftToNadirPosition);
- }
-
-
- @Override
- public String toString() {
- return "NadirSimpleConicalFieldOfView{" + "halfAngle=" + getHalfAngle() + '}';
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/OffNadirRectangularFOV.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/OffNadirRectangularFOV.java
deleted file mode 100644
index 8b78493..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/OffNadirRectangularFOV.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import org.hipparchus.geometry.Vector;
-import org.hipparchus.geometry.euclidean.threed.Rotation;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.orekit.bodies.BodyShape;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-
-/**
- * This class models a rectangular field of view. The field of view is defined
- * with a center axis, two axes to define the aperture directions, and two half
- * aperture angles.
- *
- * @author paugarciabuzzi
- */
-public class OffNadirRectangularFOV extends RectangularFieldOfView {
- private static final long serialVersionUID = 1559069965493414756L;
-
- private double lookAngle;
-
- private final BodyShape shape;
-
- /**
- * Build a Field Of View with dihedral shape (i.e. rectangular shape).
- * @param lookAngle or off nadir angle [rad] that defines the direction of the FOV center, in spacecraft frame.
- * Assumption: center axis is in the the plane perpendicular to the velocity vector (1,0,0).
- * @param acrossTrackHalfAperture FOV half aperture angle in the across-track direction,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param alongTrackHalfAperture FOV half aperture angle in the along-track direction,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param margin angular margin to apply to the zone (if positive,
- * the Field Of View will consider points slightly outside of the
- * zone are still visible)
- * @param shape the shape of the body to define the nadir direction
- * @throws OrekitException
- */
- public OffNadirRectangularFOV(double lookAngle, double acrossTrackHalfAperture, double alongTrackHalfAperture,
- double margin, BodyShape shape) throws OrekitException {
- this(new Vector3D(0,Math.sin(lookAngle),Math.cos(lookAngle)),
- Vector3D.PLUS_I, acrossTrackHalfAperture,
- new Vector3D(0, Math.cos(lookAngle),-Math.sin(lookAngle)), alongTrackHalfAperture,
- margin, shape);
- this.lookAngle=lookAngle;
- }
-
- /**
- * Build a Field Of View with dihedral shape (i.e. rectangular shape).
- * @param axis0 that defines the direction of the FOV center, in spacecraft frame
- * @param axis1 FOV dihedral axis 1, in spacecraft frame
- * @param halfAperture1 FOV dihedral half aperture angle 1,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param axis2 FOV dihedral axis 2, in spacecraft frame
- * @param halfAperture2 FOV dihedral half aperture angle 2,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param margin angular margin to apply to the zone (if positive,
- * the Field Of View will consider points slightly outside of the
- * zone are still visible)
- * @param shape the shape of the body to define the nadir direction
- * @throws OrekitException
- */
- public OffNadirRectangularFOV(Vector3D axis0,
- Vector3D axis1, double halfAperture1,
- Vector3D axis2, double halfAperture2,
- double margin, BodyShape shape) throws OrekitException {
- super(axis0,axis1, halfAperture1, axis2, halfAperture2, margin);
- this.shape = shape;
- }
-
-
- @Override
- protected double g(SpacecraftState s, TopocentricFrame target) throws OrekitException {
- // get line of sight in spacecraft frame
- final Vector3D targetPosInert
- = target.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
- Vector3D spacecraftPosInert = s.getPVCoordinates(s.getFrame()).getPosition();
- Vector3D losInert = spacecraftPosInert.subtract(targetPosInert);
- Rotation rot = alignWithNadirAndNormal(Vector3D.PLUS_K, Vector3D.PLUS_J, s, s.getOrbit(), shape, s.getFrame());
- Vector3D lineOfSightSC = rot.applyTo(losInert);
- //TODO find out why need to take the negative
- return -getFov().offsetFromBoundary(lineOfSightSC.negate());
- }
-
- public double getLookAngle() {
- return lookAngle;
- }
-
- @Override
- public String toString() {
- return "OffNadirFieldOfView{ LookAngle="+getLookAngle() + ", HalfAngle1=" + getHalfAperture1() + ", HalfAngle2=" + getHalfAperture2() + "}";
- }
-
-
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/RectangularFieldOfView.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/RectangularFieldOfView.java
deleted file mode 100644
index 7569c97..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/RectangularFieldOfView.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import java.util.Objects;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.orekit.errors.OrekitException;
-import org.orekit.propagation.events.FieldOfView;
-
-/**
- * This class models a rectangular field of view. The field of view is defined
- * with a center axis, two axes to define the aperture directions, and two half
- * aperture angles.
- *
- * @author nozomihitomi
- */
-public class RectangularFieldOfView extends CustomFieldOfView {
- private static final long serialVersionUID = 1559069965493414756L;
-
- private final Vector3D center;
-
- private final Vector3D axis1;
-
- private final Vector3D axis2;
-
- private final double halfAperture1;
-
- private final double halfAperture2;
-
-
- /**
- * Build a Field Of View with dihedral shape (i.e. rectangular shape).
- * @param center Direction of the FOV center, in spacecraft frame
- * @param axis1 FOV dihedral axis 1, in spacecraft frame
- * @param halfAperture1 FOV dihedral half aperture angle 1,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param axis2 FOV dihedral axis 2, in spacecraft frame
- * @param halfAperture2 FOV dihedral half aperture angle 2,
- * must be less than π/2, i.e. full dihedra must be smaller then
- * an hemisphere
- * @param margin angular margin to apply to the zone (if positive,
- * the Field Of View will consider points slightly outside of the
- * zone are still visible)
- * @throws OrekitException
- */
- public RectangularFieldOfView(Vector3D center,
- Vector3D axis1, double halfAperture1,
- Vector3D axis2, double halfAperture2,
- double margin) throws OrekitException {
- super(new FieldOfView(center, axis1, halfAperture1, axis2, halfAperture2, margin));
- this.center = center;
- this.axis1 = axis1;
- this.axis2 = axis2;
- this.halfAperture1 = halfAperture1;
- this.halfAperture2 = halfAperture2;
- }
-
- /**
- * Gets the vector defining the center of the field of view
- * @return
- */
- public Vector3D getCenter() {
- return center;
- }
-
- /**
- * Gets the first direction defining the rectangular shape
- * @return
- */
- public Vector3D getAxis1() {
- return axis1;
- }
-
- /**
- * Gets the second direction defining the rectangular shape
- * @return
- */
- public Vector3D getAxis2() {
- return axis2;
- }
-
- /**
- * Gets the first half angle corresponding to the first direction or axis1
- * @return
- */
- public double getHalfAperture1() {
- return halfAperture1;
- }
-
- /**
- * Gets the first half angle corresponding to the first direction or axis1
- * @return
- */
- public double getHalfAperture2() {
- return halfAperture2;
- }
-
- @Override
- public String toString() {
- return "RectangularFieldOfView{ HalfAngle1=" + halfAperture1 + ", HalfAngle2=" + halfAperture2 + "}";
- }
-
- @Override
- public int hashCode() {
- int hash = 3;
- hash = 41 * hash + Objects.hashCode(this.center);
- hash = 41 * hash + Objects.hashCode(this.axis1);
- hash = 41 * hash + Objects.hashCode(this.axis2);
- hash = 41 * hash + (int) (Double.doubleToLongBits(this.halfAperture1) ^ (Double.doubleToLongBits(this.halfAperture1) >>> 32));
- hash = 41 * hash + (int) (Double.doubleToLongBits(this.halfAperture2) ^ (Double.doubleToLongBits(this.halfAperture2) >>> 32));
- return hash;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final RectangularFieldOfView other = (RectangularFieldOfView) obj;
- if (!Objects.equals(this.center, other.center)) {
- return false;
- }
- if (!Objects.equals(this.axis1, other.axis1)) {
- return false;
- }
- if (!Objects.equals(this.axis2, other.axis2)) {
- return false;
- }
- if (Double.doubleToLongBits(this.halfAperture1) != Double.doubleToLongBits(other.halfAperture1)) {
- return false;
- }
- if (Double.doubleToLongBits(this.halfAperture2) != Double.doubleToLongBits(other.halfAperture2)) {
- return false;
- }
- return true;
- }
-
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/object/fieldofview/SimpleConicalFieldOfView.java b/orekit/src/main/java/seakers/orekit/object/fieldofview/SimpleConicalFieldOfView.java
deleted file mode 100644
index b8bfb56..0000000
--- a/orekit/src/main/java/seakers/orekit/object/fieldofview/SimpleConicalFieldOfView.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package seakers.orekit.object.fieldofview;
-
-import java.util.Objects;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import org.hipparchus.linear.ArrayRealVector;
-import org.hipparchus.linear.RealMatrix;
-import org.hipparchus.linear.RealVector;
-import org.hipparchus.util.FastMath;
-import org.orekit.errors.OrekitException;
-import org.orekit.frames.TopocentricFrame;
-import org.orekit.propagation.SpacecraftState;
-
-/**
- * This field of view models a simple cone. It is defined with a center axis in
- * the spacecraft frame of reference, and the half aperture angle.
- *
- * @author nozomihitomi
- */
-public class SimpleConicalFieldOfView extends AbstractFieldOfViewDefinition{
- private static final long serialVersionUID = -5871573780685218252L;
-
- private final Vector3D centerAxis;
-
- private final double halfAngle;
-
-
- /**
- * The threshold value for cos(halfAngle)
- */
- private final double cosAngle;
-
-
- /**
- * Constructor to create a simple conical field of view
- *
- * @param centerAxis Direction of the FOV center, in spacecraft frame
- * @param halfAngle FOV half aperture angle, must be less than π/2.
- */
- public SimpleConicalFieldOfView(Vector3D centerAxis, double halfAngle) {
- super(0.0);
- this.centerAxis = centerAxis.normalize();
- this.halfAngle = halfAngle;
- this.cosAngle = FastMath.cos(halfAngle);
- }
-
- public Vector3D getCenterAxis() {
- return centerAxis;
- }
-
- public double getHalfAngle() {
- return halfAngle;
- }
-
- /**
- * {@inheritDoc}
- *
- * The g function value is for circular field of views and is the difference
- * between FOV half aperture and the absolute value of the angle between
- * target direction and field of view center. It is positive inside the FOV
- * and negative outside.
- *
- * @param s the current spacecraft state
- * @param target
- * @return
- * @throws org.orekit.errors.OrekitException
- */
- protected double g(SpacecraftState s, TopocentricFrame target) throws OrekitException {
-
- // Compute target position/velocity at date in spacecraft frame */
- final Vector3D targetPosInert = new Vector3D(1, target.getPVCoordinates(s.getDate(), s.getFrame()).getPosition(),
- -1, s.getPVCoordinates().getPosition());
- final Vector3D targetPosSat = s.getAttitude().getRotation().applyTo(targetPosInert);
-
- // Target is in the field of view if the absolute value that angle is smaller than FOV half aperture.
- // g function value is the difference between FOV half aperture and the absolute value of the angle between
- // target direction and field of view center. It is positive inside the FOV and negative outside.
- return halfAngle - Vector3D.angle(targetPosSat, centerAxis);
- }
-
- @Override
- public String toString() {
- return "SimpleConicalFieldOfView{" + "halfAngle=" + halfAngle + '}';
- }
-
- @Override
- public int hashCode() {
- int hash = 5;
- hash = 31 * hash + Objects.hashCode(this.centerAxis);
- hash = 31 * hash + (int) (Double.doubleToLongBits(this.halfAngle) ^ (Double.doubleToLongBits(this.halfAngle) >>> 32));
- return hash;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final SimpleConicalFieldOfView other = (SimpleConicalFieldOfView) obj;
- if (!Objects.equals(this.centerAxis, other.centerAxis)) {
- return false;
- }
- if (Double.doubleToLongBits(this.halfAngle) != Double.doubleToLongBits(other.halfAngle)) {
- return false;
- }
- return true;
- }
-
- @Override
- public double offsetFromBoundary(Vector3D lineOfSight) {
- return Vector3D.angle(centerAxis, lineOfSight) - halfAngle;
- }
-
- @Override
- public RealVector g_FOV(RealMatrix lineOfSight) {
- //Assuming plusK is the nadir direction
- return lineOfSight.preMultiply(
- new ArrayRealVector(centerAxis.toArray()))
- .mapSubtractToSelf(cosAngle);
- }
-
-}
diff --git a/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java b/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
index 23279dc..772bf77 100644
--- a/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
+++ b/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
@@ -9,6 +9,7 @@
import org.hipparchus.ode.ODEIntegrator;
import org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator;
import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
+import org.orekit.attitudes.AttitudeProvider;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
@@ -39,6 +40,7 @@
import org.orekit.propagation.analytical.KeplerianPropagator;
import org.orekit.propagation.analytical.tle.SGP4;
import org.orekit.propagation.analytical.tle.TLE;
+import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
@@ -89,11 +91,15 @@ public PropagatorFactory(PropagatorType propType, Properties properties) {
}
public Propagator createPropagator(Orbit orbit, double mass) throws OrekitException {
+ return createPropagator(orbit, Propagator.DEFAULT_LAW, mass);
+ }
+
+ public Propagator createPropagator(Orbit orbit, AttitudeProvider att, double mass) throws OrekitException {
switch (propType) {
case KEPLERIAN:
- return createKeplerianPropagator(orbit, mass);
+ return createKeplerianPropagator(orbit, att, mass);
case J2:
- return createJ2Propagator(orbit, mass);
+ return createJ2Propagator(orbit, att, mass);
case NUMERICAL:
//MASS PROPAGATION
@@ -110,7 +116,20 @@ public Propagator createPropagator(Orbit orbit, double mass) throws OrekitExcept
//DormandPrince853 is an implementation of some Runge Kutta method
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, absTolerance, relTolerance);
integrator.setInitialStepSize(initStep);
- return createNumericalPropagator(orbit,integrator, properties);
+ return createNumericalPropagator(orbit, att, integrator, properties);
+ default:
+ throw new UnsupportedOperationException(String.format("Propagator of type %s is not supported by factory or by this constructor.", propType));
+ }
+ }
+
+ public Propagator createPropagator(TLE tle, double mass) throws OrekitException {
+ return createPropagator(tle, Propagator.DEFAULT_LAW, mass);
+ }
+
+ public Propagator createPropagator(TLE tle, AttitudeProvider att, double mass) throws OrekitException {
+ switch (propType) {
+ case TLE:
+ return createTLEPropagator(tle, att, mass);
default:
throw new UnsupportedOperationException(String.format("Propagator of type %s is not supported by factory or by this constructor.", propType));
}
@@ -125,7 +144,11 @@ public Propagator createPropagator(Orbit orbit, double mass) throws OrekitExcept
* @throws OrekitException
*/
private Propagator createKeplerianPropagator(Orbit orbit, double mass) throws OrekitException {
- return new KeplerianPropagator(orbit, Propagator.DEFAULT_LAW, orbit.getMu(), mass);
+ return createKeplerianPropagator(orbit, Propagator.DEFAULT_LAW, mass);
+ }
+
+ private Propagator createKeplerianPropagator(Orbit orbit, AttitudeProvider att, double mass) throws OrekitException {
+ return new KeplerianPropagator(orbit, att, orbit.getMu(), mass);
}
/**
@@ -137,11 +160,13 @@ private Propagator createKeplerianPropagator(Orbit orbit, double mass) throws Or
* @throws OrekitException
*/
private Propagator createJ2Propagator(Orbit orbit, double mass) throws OrekitException {
-
- return new EcksteinHechlerPropagator(orbit, mass, Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
+ return createJ2Propagator(orbit, Propagator.DEFAULT_LAW, mass);
+ }
+ private Propagator createJ2Propagator(Orbit orbit, AttitudeProvider att, double mass) throws OrekitException {
+ return new EcksteinHechlerPropagator(orbit, att, mass, Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_MU, Constants.WGS84_EARTH_C20, 0, 0, 0, 0);
}
-
+
/**
* Creates a TLE propagator
*
@@ -151,7 +176,11 @@ private Propagator createJ2Propagator(Orbit orbit, double mass) throws OrekitExc
* @throws OrekitException
*/
private Propagator createTLEPropagator(TLE tle, double mass) throws OrekitException {
- return new SGP4(tle, Propagator.DEFAULT_LAW, mass);
+ return createTLEPropagator(tle, Propagator.DEFAULT_LAW, mass);
+ }
+
+ private Propagator createTLEPropagator(TLE tle, AttitudeProvider att, double mass) throws OrekitException {
+ return TLEPropagator.selectExtrapolator(tle, att, mass);
}
/**
@@ -163,9 +192,12 @@ private Propagator createTLEPropagator(TLE tle, double mass) throws OrekitExcept
* @throws OrekitException
*/
private Propagator createNumericalPropagator(Orbit orbit, ODEIntegrator integrator, Properties properties) throws OrekitException {
+ return createNumericalPropagator(orbit, Propagator.DEFAULT_LAW, integrator, properties);
+ }
+ private Propagator createNumericalPropagator(Orbit orbit, AttitudeProvider att, ODEIntegrator integrator, Properties properties) throws OrekitException {
double mass = Double.parseDouble(properties.getProperty("orekit.propagator.mass", "10"));
SpacecraftState s = new SpacecraftState(orbit, mass);
- NumericalPropagator prop = new NumericalPropagator(integrator);
+ NumericalPropagator prop = new NumericalPropagator(integrator, att);
prop.setInitialState(s);
prop.setOrbitType(orbit.getType());
prop.setPositionAngleType(PositionAngle.MEAN);
diff --git a/orekit/src/main/java/seakers/orekit/test_LTAN2RAAN.java b/orekit/src/main/java/seakers/orekit/test_LTAN2RAAN.java
index 8a2d4d0..5ac1c6e 100644
--- a/orekit/src/main/java/seakers/orekit/test_LTAN2RAAN.java
+++ b/orekit/src/main/java/seakers/orekit/test_LTAN2RAAN.java
@@ -5,66 +5,15 @@
*/
package seakers.orekit;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Locale;
-import java.util.Properties;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.hipparchus.geometry.euclidean.threed.Vector3D;
-import seakers.orekit.analysis.Analysis;
-import seakers.orekit.analysis.ephemeris.OrbitalElementsAnalysis;
-import seakers.orekit.constellations.Walker;
-import seakers.orekit.coverage.access.TimeIntervalArray;
-import seakers.orekit.object.CoverageDefinition;
-import seakers.orekit.object.CoveragePoint;
-import seakers.orekit.object.Instrument;
-import seakers.orekit.object.Satellite;
-import seakers.orekit.object.fieldofview.NadirSimpleConicalFOV;
-import seakers.orekit.object.linkbudget.LinkBudget;
-import seakers.orekit.propagation.PropagatorFactory;
-import seakers.orekit.propagation.PropagatorType;
-import seakers.orekit.scenario.Scenario;
-import seakers.orekit.scenario.ScenarioIO;
+
import seakers.orekit.util.Orbits;
import seakers.orekit.util.OrekitConfig;
-import org.hipparchus.stat.descriptive.DescriptiveStatistics;
import org.hipparchus.util.FastMath;
-import org.orekit.bodies.BodyShape;
-import org.orekit.bodies.GeodeticPoint;
-import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
-import org.orekit.frames.Frame;
-import org.orekit.frames.FramesFactory;
-import org.orekit.orbits.KeplerianOrbit;
-import org.orekit.orbits.Orbit;
-import org.orekit.orbits.PositionAngle;
-import org.orekit.propagation.Propagator;
-import org.orekit.propagation.SpacecraftState;
-import org.orekit.time.AbsoluteDate;
-import org.orekit.time.TimeScale;
-import org.orekit.time.TimeScalesFactory;
-import org.orekit.utils.Constants;
-import org.orekit.utils.IERSConventions;
-import org.orekit.utils.TimeStampedPVCoordinates;
-import seakers.orekit.analysis.ephemeris.HohmannTransferAnalysis;
-import seakers.orekit.analysis.vectors.VectorAnalisysEclipseSunlightDiffDrag;
-import seakers.orekit.coverage.analysis.AnalysisMetric;
-import seakers.orekit.coverage.analysis.GroundEventAnalyzer;
-import seakers.orekit.event.EventAnalysis;
-import seakers.orekit.event.EventAnalysisEnum;
-import seakers.orekit.event.EventAnalysisFactory;
-import seakers.orekit.event.FieldOfViewEventAnalysis;
-import seakers.orekit.event.GroundBodyAngleEventAnalysis;
-import seakers.orekit.object.Constellation;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.EQUAL_AREA;
-import static seakers.orekit.object.CoverageDefinition.GridStyle.UNIFORM;
-import seakers.orekit.object.OrbitWizard;
-import seakers.orekit.object.fieldofview.NadirRectangularFOV;
/**
*
From 9c063b8f22c6935fcdd51de2aac1b47d437b2cc1 Mon Sep 17 00:00:00 2001
From: Antoni Viros Martin
Date: Tue, 19 May 2020 20:48:35 -0500
Subject: [PATCH 2/6] Fixed some bugs, results are now very similar to before,
with some new accesses being computed that were ignored before
---
.../event/FieldOfViewEventAnalysis.java | 18 ++++++++++-------
.../event/detector/FilteredFOVBuilder.java | 19 ++++++++++++++++++
.../event/detector/TimeIntervalHandler.java | 5 +++--
.../java/seakers/orekit/object/Satellite.java | 20 +++++++++++++++----
4 files changed, 49 insertions(+), 13 deletions(-)
create mode 100644 orekit/src/main/java/seakers/orekit/event/detector/FilteredFOVBuilder.java
diff --git a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
index 795d776..45fe048 100644
--- a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
@@ -30,11 +30,13 @@
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.analytical.tle.TLEPropagator;
+import org.orekit.propagation.events.EventEnablingPredicateFilter;
import org.orekit.propagation.events.FieldOfViewDetector;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.time.AbsoluteDate;
import seakers.orekit.coverage.access.TimeIntervalArray;
import seakers.orekit.coverage.access.TimeIntervalMerger;
+import seakers.orekit.event.detector.FilteredFOVBuilder;
import seakers.orekit.event.detector.TimeIntervalHandler;
import seakers.orekit.object.Constellation;
import seakers.orekit.object.CoverageDefinition;
@@ -417,7 +419,7 @@ private void multiPropogate() throws OrekitException {
prop.resetInitialState(initialState);
}
//Next search through intervals with line of sight to compute when point is in field of view
- TimeIntervalHandler fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
+ TimeIntervalHandler> fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
prop.propagate(getStartDate(), getEndDate());
TimeIntervalArray fovTimeArray = fovHandler.getTimeArray().createImmutable();
@@ -440,7 +442,7 @@ private void multiPropogate() throws OrekitException {
*/
private void singlePropagate() throws OrekitException {
SpacecraftState initialState = prop.getInitialState();
- HashMap> map = new HashMap<>();
+ HashMap>> map = new HashMap<>();
for (Instrument inst : sat.getPayload()) {
for (CoveragePoint pt : cdef.getPoints()) {
if (!lineOfSightPotential(pt, initialState.getOrbit(), FastMath.toRadians(2.0))) {
@@ -448,7 +450,7 @@ private void singlePropagate() throws OrekitException {
continue;
}
- TimeIntervalHandler fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
+ TimeIntervalHandler> fovHandler = addFOVDetector(pt, inst.getFOV(), initialState);
map.put(pt, fovHandler);
}
prop.propagate(getStartDate(), getEndDate());
@@ -496,10 +498,12 @@ private boolean lineOfSightPotential(CoveragePoint pt, Orbit orbit, double latit
return FastMath.abs(pt.getPoint().getLatitude()) - latitudeMargin < subtendedAngle + orbit.getI();
}
- private TimeIntervalHandler addFOVDetector(CoveragePoint pt, FieldOfView fov, SpacecraftState initialState) {
- FieldOfViewDetector fovDetec =
- new FieldOfViewDetector(pt, fov).withMaxCheck(fovStepSize).withThreshold(threshold);
- TimeIntervalHandler fovHandler =
+ private TimeIntervalHandler> addFOVDetector(CoveragePoint pt, FieldOfView fov, SpacecraftState initialState) {
+
+ EventEnablingPredicateFilter fovDetec =
+ FilteredFOVBuilder.createFilteredFOV(pt, fov).withMaxCheck(fovStepSize).withThreshold(threshold);
+ fovDetec.init(initialState, initialState.getDate());
+ TimeIntervalHandler> fovHandler =
new TimeIntervalHandler<>(getStartDate(), getEndDate(), fovDetec.g(initialState), Action.CONTINUE);
fovDetec = fovDetec.withHandler(fovHandler);
prop.addEventDetector(fovDetec);
diff --git a/orekit/src/main/java/seakers/orekit/event/detector/FilteredFOVBuilder.java b/orekit/src/main/java/seakers/orekit/event/detector/FilteredFOVBuilder.java
new file mode 100644
index 0000000..92e86ed
--- /dev/null
+++ b/orekit/src/main/java/seakers/orekit/event/detector/FilteredFOVBuilder.java
@@ -0,0 +1,19 @@
+package seakers.orekit.event.detector;
+
+import org.orekit.geometry.fov.FieldOfView;
+import org.orekit.propagation.events.EventEnablingPredicateFilter;
+import org.orekit.propagation.events.FieldOfViewDetector;
+import seakers.orekit.object.CoveragePoint;
+
+public class FilteredFOVBuilder {
+ public static EventEnablingPredicateFilter createFilteredFOV(CoveragePoint pt, FieldOfView fov) {
+ return new EventEnablingPredicateFilter<>(
+ new FieldOfViewDetector(pt, fov),
+ (state, eventDetector, g) -> {
+ CoveragePoint localCp = (CoveragePoint)eventDetector.getPVTarget();
+ final double trueElevation = localCp.getElevation(state.getPVCoordinates().getPosition(),
+ state.getFrame(), state.getDate());
+ return trueElevation > 0;
+ });
+ }
+}
diff --git a/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java b/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
index f1eef2b..a42b886 100644
--- a/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
+++ b/orekit/src/main/java/seakers/orekit/event/detector/TimeIntervalHandler.java
@@ -70,9 +70,10 @@ public TimeIntervalHandler(AbsoluteDate startDate, AbsoluteDate endDate, Action
* {CONTINUE, STOP, RESET_DERIVATIVES, RESET_STATE}
*/
public TimeIntervalHandler(AbsoluteDate startDate, AbsoluteDate endDate, double initGVal, Action action) {
- if(initGVal > 0){
+ if(initGVal < 0) {
this.timeArray = new TimeIntervalArray(startDate, endDate, true);
- }else{
+ }
+ else {
this.timeArray = new TimeIntervalArray(startDate, endDate, false);
}
this.action = action;
diff --git a/orekit/src/main/java/seakers/orekit/object/Satellite.java b/orekit/src/main/java/seakers/orekit/object/Satellite.java
index 859fd83..c9e8e5f 100644
--- a/orekit/src/main/java/seakers/orekit/object/Satellite.java
+++ b/orekit/src/main/java/seakers/orekit/object/Satellite.java
@@ -20,7 +20,9 @@
import org.orekit.orbits.OrbitType;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.analytical.tle.TLE;
+import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.time.AbsoluteDate;
+import org.orekit.utils.PVCoordinatesProvider;
import org.orekit.utils.TimeStampedPVCoordinates;
import seakers.orekit.object.communications.Receiver;
import seakers.orekit.object.communications.ReceiverAntenna;
@@ -183,6 +185,15 @@ public TLE getTLE() {
return tle;
}
+ public PVCoordinatesProvider getSatelliteCoordinatesProvider() {
+ if (this.orbit != null) {
+ return orbit;
+ }
+ else {
+ return TLEPropagator.selectExtrapolator(tle).getPvProvider();
+ }
+ }
+
public AttitudeProvider getAttProv() {
return attProv;
}
@@ -261,8 +272,9 @@ else if (this.tle != null) {
//get hash for attitude provider based on rotation matrix at specific time in specific frame
if (attProv != null) {
- double[][] rotMmatrix = attProv.getAttitude(orbit, AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
- hash = 23 * hash + Objects.hashCode(rotMmatrix);
+ hash = 23 * hash + attProv.hashCode();
+// double[][] rotMmatrix = attProv.getAttitude(getSatelliteCoordinatesProvider(), AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
+// hash = 23 * hash + Objects.hashCode(rotMmatrix);
}
} catch (OrekitException ex) {
Logger.getLogger(Satellite.class.getName()).log(Level.SEVERE, null, ex);
@@ -308,8 +320,8 @@ public boolean equals(Object obj) {
return false;
}
if (this.getAttProv() != null && other.getAttProv() != null) {
- double[][] rotMmatrixThis = attProv.getAttitude(orbit, AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
- double[][] rotMmatrixOther = other.getAttProv().getAttitude(orbit, AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
+ double[][] rotMmatrixThis = attProv.getAttitude(getSatelliteCoordinatesProvider(), AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
+ double[][] rotMmatrixOther = other.getAttProv().getAttitude(getSatelliteCoordinatesProvider(), AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
if (!Objects.equals(rotMmatrixThis, rotMmatrixOther)) {
return false;
}
From 5aa24d46283d26dc14ad781638ccfda73948f148 Mon Sep 17 00:00:00 2001
From: Antoni Viros Martin
Date: Thu, 21 May 2020 18:46:49 -0500
Subject: [PATCH 3/6] Added FOV per instruments
---
.../analysis/FastCoverageAnalysis.java | 25 ++++--
.../event/FieldOfViewEventAnalysis.java | 82 +++++++++++++------
.../java/seakers/orekit/object/Satellite.java | 2 -
3 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/orekit/src/main/java/seakers/orekit/coverage/analysis/FastCoverageAnalysis.java b/orekit/src/main/java/seakers/orekit/coverage/analysis/FastCoverageAnalysis.java
index 834163d..2de23e0 100644
--- a/orekit/src/main/java/seakers/orekit/coverage/analysis/FastCoverageAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/coverage/analysis/FastCoverageAnalysis.java
@@ -24,6 +24,7 @@
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.TopocentricFrame;
+import org.orekit.geometry.fov.CircularFieldOfView;
import org.orekit.orbits.KeplerianOrbit;
import org.orekit.orbits.Orbit;
import org.orekit.orbits.PositionAngle;
@@ -34,6 +35,7 @@
import seakers.orekit.event.FieldOfViewEventAnalysis;
import seakers.orekit.object.CoverageDefinition;
import seakers.orekit.object.CoveragePoint;
+import seakers.orekit.object.Instrument;
import seakers.orekit.object.Satellite;
import seakers.orekit.parallel.ParallelRoutine;
import seakers.orekit.parallel.SubRoutine;
@@ -101,6 +103,13 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
getEndDate().durationFrom(getStartDate()) / 86400.));
for (Satellite sat : getUniqueSatellites(cdef)) {
+ sat.getPayload().add(
+ new Instrument(
+ "filler",
+ new CircularFieldOfView(Vector3D.PLUS_K, halfAngle, 0.),
+ 0.,
+ 0.)
+ );
KeplerianOrbit orb = new KeplerianOrbit(sat.getOrbit());
double losTimeStep = orb.getKeplerianPeriod() / 10;
double fovTimeStep = orb.getKeplerianPeriod() / 500;
@@ -118,7 +127,7 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
Task subRoutine = (Task)sr;
Satellite sat = subRoutine.getSat();
- HashMap satAccesses = subRoutine.getSatAccesses();
+ HashMap> satAccesses = subRoutine.getSatAccesses();
processAccesses(sat, cdef, satAccesses);
}
} catch (InterruptedException ex) {
@@ -239,7 +248,7 @@ private class Task implements SubRoutine {
* The times, for each point, when it is being accessed by the given
* satellite and its payload.
*/
- private final HashMap satAccesses;
+ private final HashMap> satAccesses;
/**
*
@@ -260,8 +269,11 @@ public Task(Satellite sat, CoverageDefinition cdef,
this.fovStepSize = fovStepSize;
this.satAccesses = new HashMap<>(cdef.getNumberOfPoints());
- for (CoveragePoint pt : cdef.getPoints()) {
- satAccesses.put(pt, getEmptyTimeArray());
+ for (Instrument inst: this.sat.getPayload()) {
+ satAccesses.put(inst, new HashMap<>(cdef.getNumberOfPoints()));
+ for (CoveragePoint pt : cdef.getPoints()) {
+ satAccesses.get(inst).put(pt, getEmptyTimeArray());
+ }
}
}
@@ -271,6 +283,7 @@ public Task call() throws Exception {
KeplerianOrbit orb = new KeplerianOrbit(sat.getOrbit());
Logger.getGlobal().finer(String.format("Propagating satellite %s...", sat));
//identify accesses and create time interval array for each coverage point
+ satAccesses.put(sat.getPayload().get(0), new HashMap<>());
for (CoveragePoint pt : cdef.getPoints()) {
if (!lineOfSightPotential(pt, orb, FastMath.toRadians(2.0))) {
//if a point is not within 2 deg latitude of what is accessible to the satellite via line of sight, don't compute the accesses
@@ -346,7 +359,7 @@ public Task call() throws Exception {
date1 = Double.NaN;
}
}
- satAccesses.put(pt, array);
+ satAccesses.get(sat.getPayload().get(0)).put(pt, array);
}
return this;
}
@@ -355,7 +368,7 @@ public Satellite getSat() {
return sat;
}
- public HashMap getSatAccesses() {
+ public HashMap> getSatAccesses() {
return satAccesses;
}
diff --git a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
index 45fe048..39031ca 100644
--- a/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
+++ b/orekit/src/main/java/seakers/orekit/event/FieldOfViewEventAnalysis.java
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.sql.Time;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -22,6 +23,7 @@
import org.hipparchus.ode.events.Action;
import org.hipparchus.util.FastMath;
+import org.hipparchus.util.Pair;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.TopocentricFrame;
@@ -85,7 +87,7 @@ public class FieldOfViewEventAnalysis extends AbstractGroundEventAnalysis {
/**
* Stores all the accesses of each satellite if saveAllAccesses is true.
*/
- private HashMap>> allInstrumentAccesses;
+ private HashMap>>> allInstrumentAccesses;
/**
* Creates a new event analysis.
@@ -140,20 +142,20 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
getStartDate(), getEndDate(),
getEndDate().durationFrom(getStartDate()) / 86400.));
- //propogate each satellite individually
+ // propogate each satellite individually
ArrayList subRoutines = new ArrayList<>();
for (Satellite sat : getUniqueSatellites(cdef)) {
- //first check if the satellite accesses are already saved in the database
+ // first check if the satellite accesses are already saved in the database
File file = new File(
System.getProperty("orekit.coveragedatabase"),
String.valueOf(sat.hashCode()));
if (file.canRead()) {
- HashMap satAccesses = readAccesses(file);
+ HashMap> satAccesses = readAccesses(file);
processAccesses(sat, cdef, satAccesses);
break;
}
- //if no precomuted times available, then propagate
+ // if no precomuted times available, then propagate
Propagator prop = null;
if (sat.getOrbit() != null) {
prop = propagatorFactory.createPropagator(sat.getOrbit(), sat.getAttProv(), sat.getGrossMass());
@@ -162,7 +164,7 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
prop = propagatorFactory.createPropagator(sat.getTLE(), sat.getAttProv(), sat.getGrossMass());
}
- //Set stepsizes and threshold for detectors
+ // Set stepsizes and threshold for detectors
double fovStepSize;
if (sat.getOrbit() != null) {
fovStepSize = sat.getOrbit().getKeplerianPeriod() / 100.;
@@ -183,7 +185,7 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
}
FieldOfViewSubRoutine fovsr = (FieldOfViewSubRoutine)sr;
Satellite sat = fovsr.getSat();
- HashMap satAccesses = fovsr.getSatAccesses();
+ HashMap> satAccesses = fovsr.getSatAccesses();
processAccesses(sat, cdef, satAccesses);
if (saveToDB) {
@@ -218,23 +220,40 @@ public FieldOfViewEventAnalysis call() throws OrekitException {
* assigned coverage definition
*/
protected void processAccesses(Satellite sat, CoverageDefinition cdef,
- HashMap satAccesses) {
- //save the satellite accesses
+ HashMap> satAccesses) {
+ // merge all instruments for backwards compatibility
+ HashMap satMergedAccesses = new HashMap<>();
+ HashMap> arrays = new HashMap<>();
+ satAccesses.forEach((instrument, instrAccesses) -> {
+ instrAccesses.forEach((topoFrame, timeArray) -> {
+ if (!arrays.containsKey(topoFrame)) {
+ arrays.put(topoFrame, new ArrayList<>());
+ }
+ arrays.get(topoFrame).add(timeArray);
+ });
+ });
+ arrays.forEach((topoFrame, timeArrays) -> {
+ TimeIntervalMerger merger = new TimeIntervalMerger(timeArrays);
+ satMergedAccesses.put(topoFrame, merger.orCombine());
+ });
+
+ // save the satellite accesses
if (saveAllAccesses) {
- allAccesses.get(cdef).put(sat, satAccesses);
+ allInstrumentAccesses.get(cdef).put(sat, satAccesses);
+ allAccesses.get(cdef).put(sat, satMergedAccesses);
}
- //merge the time accesses across all satellite for each coverage definition
+ // merge the time accesses across all satellites for each coverage definition
if (getEvents().containsKey(cdef)) {
Map mergedAccesses
- = EventIntervalMerger.merge(getEvents().get(cdef), satAccesses, false);
+ = EventIntervalMerger.merge(getEvents().get(cdef), satMergedAccesses, false);
getEvents().put(cdef, mergedAccesses);
} else {
- getEvents().put(cdef, satAccesses);
+ getEvents().put(cdef, satMergedAccesses);
}
}
- private void writeAccesses(File file, HashMap accesses) {
+ private void writeAccesses(File file, HashMap> accesses) {
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) {
oos.writeObject(accesses);
} catch (FileNotFoundException ex) {
@@ -244,8 +263,8 @@ private void writeAccesses(File file, HashMap readAccesses(File file) {
- HashMap out = new HashMap<>();
+ private HashMap> readAccesses(File file) {
+ HashMap> out = new HashMap<>();
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
out = RawSafety.castHashMap(ois.readObject());
} catch (FileNotFoundException ex) {
@@ -292,6 +311,16 @@ public HashMap>>> getAllInstrumentAccesses() {
+ return allInstrumentAccesses;
+ }
+
/**
* Returns the flag that dictates whether the individual satellite coverage
* accesses are to be saved in the database
@@ -358,7 +387,7 @@ private class FieldOfViewSubRoutine implements SubRoutine {
* The times, for each point, when it is being accessed by the given
* satellite and its payload.
*/
- private final HashMap satAccesses;
+ private final HashMap> satAccesses;
/**
*
@@ -380,10 +409,14 @@ public FieldOfViewSubRoutine(Satellite sat, Propagator prop,
this.fovStepSize = fovStepSize;
this.threshold = threshold;
- this.satAccesses = new HashMap<>(cdef.getNumberOfPoints());
- for (CoveragePoint pt : cdef.getPoints()) {
- satAccesses.put(pt, getEmptyTimeArray());
+ this.satAccesses = new HashMap<>(this.sat.getPayload().size());
+ for (Instrument inst: this.sat.getPayload()) {
+ satAccesses.put(inst, new HashMap<>(cdef.getNumberOfPoints()));
+ for (CoveragePoint pt : cdef.getPoints()) {
+ satAccesses.get(inst).put(pt, getEmptyTimeArray());
+ }
}
+
}
//NOTE: this implementation of in the field of view is a bit fragile if propagating highly elliptical orbits (>0.75). Maybe need to use smaller time steps los and fov detectors
@@ -426,8 +459,7 @@ private void multiPropogate() throws OrekitException {
if (fovTimeArray == null || fovTimeArray.isEmpty()) {
continue;
}
- TimeIntervalMerger merger = new TimeIntervalMerger(satAccesses.get(pt), fovTimeArray);
- satAccesses.put(pt, merger.orCombine());
+ satAccesses.get(inst).put(pt, fovTimeArray);
prop.clearEventsDetectors();
}
}
@@ -459,8 +491,7 @@ private void singlePropagate() throws OrekitException {
if (fovTimeArray == null || fovTimeArray.isEmpty()) {
continue;
}
- TimeIntervalMerger merger = new TimeIntervalMerger(satAccesses.get(pt), fovTimeArray);
- satAccesses.put(pt, merger.orCombine());
+ satAccesses.get(inst).put(pt, fovTimeArray);
}
prop.clearEventsDetectors();
}
@@ -470,7 +501,7 @@ public Satellite getSat() {
return sat;
}
- public HashMap getSatAccesses() {
+ public HashMap> getSatAccesses() {
return satAccesses;
}
@@ -499,7 +530,6 @@ private boolean lineOfSightPotential(CoveragePoint pt, Orbit orbit, double latit
}
private TimeIntervalHandler> addFOVDetector(CoveragePoint pt, FieldOfView fov, SpacecraftState initialState) {
-
EventEnablingPredicateFilter fovDetec =
FilteredFOVBuilder.createFilteredFOV(pt, fov).withMaxCheck(fovStepSize).withThreshold(threshold);
fovDetec.init(initialState, initialState.getDate());
diff --git a/orekit/src/main/java/seakers/orekit/object/Satellite.java b/orekit/src/main/java/seakers/orekit/object/Satellite.java
index c9e8e5f..aac0360 100644
--- a/orekit/src/main/java/seakers/orekit/object/Satellite.java
+++ b/orekit/src/main/java/seakers/orekit/object/Satellite.java
@@ -273,8 +273,6 @@ else if (this.tle != null) {
//get hash for attitude provider based on rotation matrix at specific time in specific frame
if (attProv != null) {
hash = 23 * hash + attProv.hashCode();
-// double[][] rotMmatrix = attProv.getAttitude(getSatelliteCoordinatesProvider(), AbsoluteDate.GPS_EPOCH, FramesFactory.getEME2000()).getRotation().getMatrix();
-// hash = 23 * hash + Objects.hashCode(rotMmatrix);
}
} catch (OrekitException ex) {
Logger.getLogger(Satellite.class.getName()).log(Level.SEVERE, null, ex);
From 16289e4e17d43462ee599ba50ab1f0f426ba1f27 Mon Sep 17 00:00:00 2001
From: Antoni Viros
Date: Thu, 1 Apr 2021 17:42:22 -0500
Subject: [PATCH 4/6] removed files
---
.gitignore~ | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 .gitignore~
diff --git a/.gitignore~ b/.gitignore~
deleted file mode 100644
index c3528c1..0000000
--- a/.gitignore~
+++ /dev/null
@@ -1 +0,0 @@
-/orekit/build/
\ No newline at end of file
From ba11d7551d834378055fa52e03d50e9f1bc48176 Mon Sep 17 00:00:00 2001
From: Antoni Viros
Date: Wed, 14 Apr 2021 10:57:01 -0500
Subject: [PATCH 5/6] First try at fixing drag models
---
.../orekit/propagation/PropagatorFactory.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java b/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
index 772bf77..cff3367 100644
--- a/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
+++ b/orekit/src/main/java/seakers/orekit/propagation/PropagatorFactory.java
@@ -12,6 +12,8 @@
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.bodies.OneAxisEllipsoid;
+import org.orekit.data.DataContext;
+import org.orekit.data.DataProvidersManager;
import org.orekit.errors.OrekitException;
import org.orekit.forces.drag.DragForce;
import org.orekit.forces.drag.DragSensitive;
@@ -105,10 +107,10 @@ public Propagator createPropagator(Orbit orbit, AttitudeProvider att, double mas
//set integrator steps and tolerances
final double dP = 0.001;
- final double minStep = 0.00000001;
+ final double minStep = 0.00001;
final double maxStep = 1000;
final double initStep = 60;
- final double[][] tolerance = NumericalPropagator.tolerances(dP, orbit, OrbitType.EQUINOCTIAL);
+ final double[][] tolerance = NumericalPropagator.tolerances(dP, orbit, orbit.getType());
double[] absTolerance = tolerance[0];
double[] relTolerance = tolerance[1];
@@ -218,11 +220,12 @@ private Propagator createNumericalPropagator(Orbit orbit, AttitudeProvider att,
double dragArea = Double.parseDouble(properties.getProperty("orekit.propagator.dragarea", "10"));
double dragCoeff = Double.parseDouble(properties.getProperty("orekit.propagator.dragcoeff", "2.2"));
- String supportedNames = "(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\p{Digit}\\p{Digit}\\p{Digit}\\p{Digit}F10\\.(?:txt|TXT)";
- MarshallSolarActivityFutureEstimation.StrengthLevel strengthlevel = MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE;
- DTM2000InputParameters parameters = new MarshallSolarActivityFutureEstimation(supportedNames, strengthlevel);
-
- Atmosphere atmosphere = new DTM2000(parameters, CelestialBodyFactory.getSun(), earth);
+ MarshallSolarActivityFutureEstimation msafe =
+ new MarshallSolarActivityFutureEstimation(MarshallSolarActivityFutureEstimation.DEFAULT_SUPPORTED_NAMES,
+ MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE);
+ final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
+ manager.feed(msafe.getSupportedNames(), msafe);
+ Atmosphere atmosphere = new DTM2000(msafe, CelestialBodyFactory.getSun(), earth);
DragSensitive spacecraft = new IsotropicDrag(dragArea, dragCoeff);
prop.addForceModel(new DragForce(atmosphere, spacecraft));
}
From afe9232ecae66855e7fb4bff43fabe8af0b3ffe5 Mon Sep 17 00:00:00 2001
From: Antoni Viros
Date: Wed, 14 Apr 2021 10:58:53 -0500
Subject: [PATCH 6/6] Updated dependencies
---
orekit/pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/orekit/pom.xml b/orekit/pom.xml
index 778fbe6..a58bef7 100644
--- a/orekit/pom.xml
+++ b/orekit/pom.xml
@@ -15,22 +15,22 @@
org.hipparchus
hipparchus-core
- 1.5
+ 1.8
com.google.code.gson
gson
- 2.8.5
+ 2.8.6
org.orekit
orekit
- 10.1
+ 10.3
org.moeaframework
moeaframework
- 2.12
+ 2.13