|
I’m trying to model a satellite sensor FOV with the DihedralFieldOfViewDetector. I’m assuming this would be the right approach. I’ve attached the complete compile-able source to this email in case you want to take a look or run it. I started out with the test code for DihedralFieldOfViewDetector: And started modifying it to fit my need. I changed the propagator to use TLEPropagator with the appropriate TLE’s for the day in question. (which I know works well because I’m using the same code to calculate satellite subtracks and line
of sight visibility schedules and it’s working perfectly.) Now I get stuck in the parameters to feed the DihedralFieldOfViewDetector.
I changed:
final PVCoordinatesProvider sunPV = CelestialBodyFactory.getSun(); to GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(25.61379), FastMath.toRadians(-80.38402), 0.0); TopocentricFrame stationFrame = new TopocentricFrame(earth, point, "CSTARS Ground Station"); final PVCoordinatesProvider aoiTarget = stationFrame; So that it detects when the FOV encounters a target on earth and not the sun.
I left the Vector3D parameters the same because I don’t know enough to know what to change. And I changed the aperture1 & aperture2 variables like so: final double aperture1 = FastMath.toRadians(20); final double aperture2 = FastMath.toRadians(45); Because the sensor I’m trying to model has an incidence angle of 20-45 degrees. So I’m pretty sure I could have multiple things wrong here. I’d appreciate if anyone can tell me what that is. Thanks, Carlos Krefft |
/**
* Property of CSTARS.
*/
package edu.miami.cstars.testing;
import edu.miami.cstars.webservices.feasibilityanalyzer.OrkitDataController;
import edu.miami.cstars.webservices.feasibilityanalyzer.Swath;
import java.io.File;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.TimeZone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.orekit.bodies.BodyShape;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.data.DataProvider;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.TopocentricFrame;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.analytical.tle.TLE;
import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.propagation.events.DihedralFieldOfViewDetector;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.events.handlers.EventHandler;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinatesProvider;
/**
*
* @author Carlos Krefft <ckrefft@cstars.miami.edu>
*/
public class DihedralSensorDetection {
public static void main(String[] args) throws ParseException, SQLException, ClassNotFoundException {
try {
// configure Orekit data directory.
final File orekitDir = new File(System.getProperty("user.dir") + "/data/orekit-data");
final DataProvider provider = new DirectoryCrawler(orekitDir);
DataProvidersManager.getInstance().addProvider(provider);
final TimeScale utc = TimeScalesFactory.getUTC();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
AbsoluteDate startDate = new AbsoluteDate(sdf.parse("2014-01-25T00:00:00Z"), utc);
AbsoluteDate endDate = new AbsoluteDate(sdf.parse("2014-01-26T00:00:00Z"), utc);
TLE tle = new TLE("1 31698U 07026A 14024.22071808 -.00000360 00000-0 -13953-4 0 5106", "2 31698 097.4446 033.5849 0002003 094.1596 036.5079 15.19152067366624");
// create propagator
Propagator propagator = TLEPropagator.selectExtrapolator(tle);
// Earth and frame
double ae = 6378137.0; // equatorial radius in meter
double f = 1.0 / 298.257223563; // flattening
Frame ITRF2005 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); // terrestrial frame at an arbitrary date
BodyShape earth = new OneAxisEllipsoid(ae, f, ITRF2005);
//CSTARS Location
GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(25.61379), FastMath.toRadians(-80.38402), 0.0);
TopocentricFrame stationFrame = new TopocentricFrame(earth, point, "CSTARS Ground Station");
final double maxCheck = 1.;
final PVCoordinatesProvider aoiTarget = stationFrame;
final Vector3D center = Vector3D.MINUS_J;
final Vector3D axis1 = Vector3D.PLUS_K;
final Vector3D axis2 = Vector3D.PLUS_I;
final double aperture1 = FastMath.toRadians(20);
final double aperture2 = FastMath.toRadians(45);
final EventDetector aolTargetFoundEvent =
new DihedralFieldOfViewDetector(maxCheck, aoiTarget, center, axis1, aperture1, axis2, aperture2).
withHandler(new DihedralLocationVisiHandler());
// Add event to be detected
propagator.addEventDetector(aolTargetFoundEvent);
SpacecraftState finalState = propagator.propagate(startDate, endDate);
System.out.println(" Final state : " + finalState.getDate().durationFrom(startDate));
} catch (OrekitException oe) {
System.err.println(oe.getMessage());
}
}
/** Handler for visibility event. */
private static class DihedralLocationVisiHandler implements EventHandler<DihedralFieldOfViewDetector> {
private static Swath swath = null;
@Override
public EventHandler.Action eventOccurred(final SpacecraftState s, final DihedralFieldOfViewDetector detector, final boolean increasing) throws OrekitException {
if(swath == null){
swath = new Swath();
}
if (increasing) {
System.out.println(" Start Visibility at " + s.getDate());
return EventHandler.Action.CONTINUE;
} else {
System.out.println(" End Visibility at " + s.getDate());
return EventHandler.Action.CONTINUE;//STOP;
}
}
@Override
public SpacecraftState resetState(DihedralFieldOfViewDetector detector, SpacecraftState oldState) {
return oldState;
}
}
}