« API Propagation » : différence entre les versions
Aucun résumé des modifications |
|||
| (6 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
There are two possibilities to initialize an orbital propagation using a GtmLeoPropagator or a GtmLeoPropagator object. | There are two possibilities to initialize an orbital propagation using a [{{PathCurrentJavaDoc}}/fr/cnes/dynvol/gentleman/calc/propagation/GtmLeoPropagator.html GtmLeoPropagator] or a [{{PathCurrentJavaDoc}}/fr/cnes/dynvol/gentleman/calc/propagation/GtmGeoPropagator.html GtmLeoPropagator] object. | ||
== LEO propagation == | == LEO propagation == | ||
| Ligne 51 : | Ligne 51 : | ||
=== Propagation data initialization === | === Propagation data initialization === | ||
The | The simplest way is to use the setPropagationData() method passing only the duration of the propagation and the output step. All other data (for the numerical propagator) will be considered with default values. | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
| Ligne 64 : | Ligne 64 : | ||
leo.setPropagationData(propData); | leo.setPropagationData(propData); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Case of adding maneuvers === | |||
In the example below, we will add both an impulse maneuver and a continuous one. Note that, rather to use basic [http://patrius.cnes.fr PATRIUS] objects for maneuvers and maneuvers sequences, we will use "Custom" ones which correspond to equivalent ones but used by [http://psimu.cnes.fr PSIMU] (see [http://psimu.cnes.fr/index.php/Data_initialization#Maneuvers here]). | |||
<syntaxhighlight lang="java"> | |||
final double MAXCHECK = AbstractDetector.DEFAULT_MAXCHECK; | |||
final double THRESHOLD = AbstractDetector.DEFAULT_THRESHOLD; | |||
// Impulse maneuver of 1 m/s at the beginning of the propagation | |||
final double dvImp = 1.; | |||
final AbsoluteDate dateImp = date; | |||
final CustomDateDetector event = new CustomDateDetector(dateImp, MAXCHECK, THRESHOLD, Action.STOP); | |||
final CustomImpulseManeuver imp = new CustomImpulseManeuver("Impulse man", | |||
leo.getListOfEngines().get(0), leo.getListOfTanks().get(0), LOFType.LVLH, event, | |||
new Vector3D(dvImp, 0., 0.), leo.getMassModel()); | |||
// Continuous maneuver coresponding to -1 m/s, 1 period after | |||
final double period = simpleOrbit.getOrbit().getKeplerianPeriod(); | |||
final AbsoluteDate startDate = date.shiftedBy(period); | |||
final CustomDateDetector startEvent = new CustomDateDetector(startDate, MAXCHECK, THRESHOLD, Action.STOP); | |||
final double dur = veh.getVehicle().getTotalMass()*dvImp/thrust; | |||
final AbsoluteDate endDate = startDate.shiftedBy(dur); | |||
final CustomDateDetector stopEvent = new CustomDateDetector(endDate, MAXCHECK, THRESHOLD, Action.STOP); | |||
final Vector3D direction = new Vector3D(-1., 0., 0.); | |||
final CustomConstantManeuver cont = new CustomConstantManeuver("Continuous maneuver", | |||
leo.getListOfEngines().get(0), leo.getListOfTanks().get(0), LOFType.TNW, | |||
startEvent, stopEvent, direction, leo.getMassModel()); | |||
// Sequence of maneuvers | |||
final CustomManeuverSequence manSeq = new CustomManeuverSequence(0., 0.); | |||
manSeq.addManeuver(imp); | |||
manSeq.addManeuver(cont); | |||
leo.setManeuvers(manSeq); | |||
</syntaxhighlight> | |||
=== Case of adding attitude laws === | |||
We may just add a single attitude law during all the propagation: | |||
<syntaxhighlight lang="java"> | |||
leo.setAttitude(new LofOffset(LOFType.LVLH, RotationOrder.ZYX, FastMath.PI, 0., 0.)); | |||
</syntaxhighlight> | |||
.. or a more complex attitude sequence: | |||
<syntaxhighlight lang="java"> | |||
// Initializing attitude sequence | |||
final AttitudesSequence seqAtt = new AttitudesSequence(); | |||
// Building a first attitude law (Sun pointing) | |||
final CelestialBody sun = new MeeusSun(); | |||
final Vector3D firstAxis = new Vector3D(1., 0., 0.); | |||
final Vector3D secondAxis = new Vector3D(0., 1., 0.); | |||
final AttitudeLaw sunPointingLaw = new SunPointing(sun, firstAxis, secondAxis, sun); | |||
// Building a second attitude law (LVLH) | |||
final AttitudeLaw lvlhLaw = new LofOffset(LOFType.LVLH); | |||
// Events that will switch from a law to another | |||
final double maxCheck = 10.; | |||
final double threshold = 1.e-3; | |||
final double sunRadius = Constants.SUN_RADIUS; | |||
final double earthRadius = Constants.WGS84_EARTH_EQUATORIAL_RADIUS; | |||
final Frame ITRF = FramesFactory.getITRF(); | |||
final GeometricBodyShape earth = | |||
new ExtendedOneAxisEllipsoid(earthRadius, Constants.WGS84_EARTH_FLATTENING, ITRF, "EARTH"); | |||
final EventDetector eventEntryEclipse = new EclipseDetector(sun, sunRadius, earth, earthRadius, 0, | |||
maxCheck, threshold, Action.RESET_STATE, Action.RESET_STATE); | |||
final EventDetector eventExitEclipse = new EclipseDetector(sun, sunRadius, earth, earthRadius, 0, | |||
maxCheck, threshold, Action.RESET_STATE, Action.RESET_STATE); | |||
//Adding switches | |||
seqAtt.addSwitchingCondition(lvlhLaw, eventEntryEclipse, true, false, sunPointingLaw); | |||
seqAtt.addSwitchingCondition(sunPointingLaw, eventExitEclipse, false, true, lvlhLaw); | |||
// Adding attitude to GENTLEMAN | |||
leo.setAttitude(seqAtt); | |||
</syntaxhighlight> | |||
In each case all attitude objects will correspond to [http://patrius.cnes.fr PATRIUS] ones. | |||
=== Propagation === | === Propagation === | ||
Dernière version du 13 septembre 2021 à 08:00
There are two possibilities to initialize an orbital propagation using a GtmLeoPropagator or a GtmLeoPropagator object.
LEO propagation
First, we will have to create a GtmLeoPropagator object:
final GtmLeoPropagator leo = new GtmLeoPropagator();
Then, we will set all the information needed for the propagation ...
Initial orbit initialization
We may use the GtmLeoSimpleOrbit object which allows to enter simplified data as defined below and here or a full PATRIUS Orbit object
// Orbit initialization
final AbsoluteDate date = new AbsoluteDate("2020-01-01T00:00:00.000", GtmConstants.UTC);
final double hp = 299.e+3;
final double ha = 300.e+3;
final double inc = FastMath.toRadians(51.6);
final GtmLeoSimpleOrbit simpleOrbit = new GtmLeoSimpleOrbit(date, hp, ha, inc);
leo.setIniOrbit(simpleOrbit.getOrbit());
Vehicle initialization
As for the initial orbit, we may use a GtmSimpleVehicle object for simpler data or a full PATRIUS Vehicle object.
// Vehicle characteristics
final double dryMass = 1000.;
final double mainArea = 1.;
final double spArea = 2.;
final double cd = 2.;
final GtmSimpleVehicle veh = new GtmSimpleVehicle(dryMass, mainArea, spArea, 0., 0., cd, 0., 0., 0.);
leo.setVehicle(veh.getVehicle());
Forces initialization
Here again, we can use a GtmSimpleForces object or define a full PATRIUS ForceModelsData object.
// Forces models
final GtmSimpleForces forces = new GtmSimpleForces(2, 0, true, false, false, false, false, leo.getAssembly(), leo.getEllipsoid());
leo.setForces(forces.getForces());
Propagation data initialization
The simplest way is to use the setPropagationData() method passing only the duration of the propagation and the output step. All other data (for the numerical propagator) will be considered with default values.
// Propagation data
leo.setPropagationData(Constants.JULIAN_DAY, GtmConstants.HOUR);
But it is also possible to use the same method with a GtmPropagationData GtmPropagationData object as argument. The example below is fully equivalent to the previous one:
final GtmPropagationData propData = new GtmPropagationData(Constants.JULIAN_DAY, GtmConstants.HOUR, 1.0, 300., 7.e-6, 3.e-10, 0., 0.)
leo.setPropagationData(propData);
Case of adding maneuvers
In the example below, we will add both an impulse maneuver and a continuous one. Note that, rather to use basic PATRIUS objects for maneuvers and maneuvers sequences, we will use "Custom" ones which correspond to equivalent ones but used by PSIMU (see here).
final double MAXCHECK = AbstractDetector.DEFAULT_MAXCHECK;
final double THRESHOLD = AbstractDetector.DEFAULT_THRESHOLD;
// Impulse maneuver of 1 m/s at the beginning of the propagation
final double dvImp = 1.;
final AbsoluteDate dateImp = date;
final CustomDateDetector event = new CustomDateDetector(dateImp, MAXCHECK, THRESHOLD, Action.STOP);
final CustomImpulseManeuver imp = new CustomImpulseManeuver("Impulse man",
leo.getListOfEngines().get(0), leo.getListOfTanks().get(0), LOFType.LVLH, event,
new Vector3D(dvImp, 0., 0.), leo.getMassModel());
// Continuous maneuver coresponding to -1 m/s, 1 period after
final double period = simpleOrbit.getOrbit().getKeplerianPeriod();
final AbsoluteDate startDate = date.shiftedBy(period);
final CustomDateDetector startEvent = new CustomDateDetector(startDate, MAXCHECK, THRESHOLD, Action.STOP);
final double dur = veh.getVehicle().getTotalMass()*dvImp/thrust;
final AbsoluteDate endDate = startDate.shiftedBy(dur);
final CustomDateDetector stopEvent = new CustomDateDetector(endDate, MAXCHECK, THRESHOLD, Action.STOP);
final Vector3D direction = new Vector3D(-1., 0., 0.);
final CustomConstantManeuver cont = new CustomConstantManeuver("Continuous maneuver",
leo.getListOfEngines().get(0), leo.getListOfTanks().get(0), LOFType.TNW,
startEvent, stopEvent, direction, leo.getMassModel());
// Sequence of maneuvers
final CustomManeuverSequence manSeq = new CustomManeuverSequence(0., 0.);
manSeq.addManeuver(imp);
manSeq.addManeuver(cont);
leo.setManeuvers(manSeq);
Case of adding attitude laws
We may just add a single attitude law during all the propagation:
leo.setAttitude(new LofOffset(LOFType.LVLH, RotationOrder.ZYX, FastMath.PI, 0., 0.));
.. or a more complex attitude sequence:
// Initializing attitude sequence
final AttitudesSequence seqAtt = new AttitudesSequence();
// Building a first attitude law (Sun pointing)
final CelestialBody sun = new MeeusSun();
final Vector3D firstAxis = new Vector3D(1., 0., 0.);
final Vector3D secondAxis = new Vector3D(0., 1., 0.);
final AttitudeLaw sunPointingLaw = new SunPointing(sun, firstAxis, secondAxis, sun);
// Building a second attitude law (LVLH)
final AttitudeLaw lvlhLaw = new LofOffset(LOFType.LVLH);
// Events that will switch from a law to another
final double maxCheck = 10.;
final double threshold = 1.e-3;
final double sunRadius = Constants.SUN_RADIUS;
final double earthRadius = Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
final Frame ITRF = FramesFactory.getITRF();
final GeometricBodyShape earth =
new ExtendedOneAxisEllipsoid(earthRadius, Constants.WGS84_EARTH_FLATTENING, ITRF, "EARTH");
final EventDetector eventEntryEclipse = new EclipseDetector(sun, sunRadius, earth, earthRadius, 0,
maxCheck, threshold, Action.RESET_STATE, Action.RESET_STATE);
final EventDetector eventExitEclipse = new EclipseDetector(sun, sunRadius, earth, earthRadius, 0,
maxCheck, threshold, Action.RESET_STATE, Action.RESET_STATE);
//Adding switches
seqAtt.addSwitchingCondition(lvlhLaw, eventEntryEclipse, true, false, sunPointingLaw);
seqAtt.addSwitchingCondition(sunPointingLaw, eventExitEclipse, false, true, lvlhLaw);
// Adding attitude to GENTLEMAN
leo.setAttitude(seqAtt);
In each case all attitude objects will correspond to PATRIUS ones.
Propagation
To propagate the trajectory, it is only needed to call the propagate() method:
leo.propagate();
GEO progation
For GEO orbits, the principle is exactly the same as for LEO ones except the fact that we will use a GtmLeoPropagator object.
final GtmGeoPropagator geo = new GtmGeoPropagator();
// Orbit initialization
final AbsoluteDate date = new AbsoluteDate("2020-01-01T00:00:00.000", GtmConstants.UTC);
final double lon = FastMath.toRadians(75.);
final GtmGeoSimpleOrbit simpleOrbit = new GtmGeoSimpleOrbit(date, 0., 0., 0., lon);
geo.setIniOrbit(simpleOrbit.getOrbit());
// Vehicle characteristics
final double dryMass = 3000.;
final double mainArea = 10.;
final double spArea = 90.;
final GtmSimpleVehicle veh = new GtmSimpleVehicle(dryMass, mainArea, spArea, 0., 0., 0., 0., 0.);
geo.setVehicle(veh.getVehicle());
// Forces models
final GtmSimpleForces forces = new GtmSimpleForces(0, 0, false, false, false, false, false, geo.getAssembly(), geo.getEllipsoid());
geo.setForces(forces.getForces());
// Propagation data
geo.setPropagationData(7*Constants.JULIAN_DAY, GtmConstants.HOUR);
// Propagation
geo.propagate();