[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Users] Use DSST in orekit-7.0 from Matlab



Sorry, the attachment was missing...


2015-02-04 10:10 GMT+01:00 Christophe Le Bris <chris.lebris@gmail.com>:
Hello Vivek,

here is a really simple example on how to use DSST propagator from Matlab.
You could set up the numerical propagator in a different way by calling
directly Commons Math to build it.

Christophe


2015-02-04 5:41 GMT+01:00 Vivek <v.vittaldev@utexas.edu>:

> I am interested in integrating satellite orbits using the DSST
> implementation
> of orekit-7.0. Due to all my code being in Matlab and my extremely limited
> knowledge of Java, I would like to call DSST from Matlab. There is a Matlab
> example of a simple orbit propagation in the documentation, which
> unfortunately does not work with orekit-7.0. I was able to run that script
> using orekit-6.1. Could someone help me with a minimal working Matlab
> script
> for integrating an orbit using DSST? With a working example and the
> documentation, I'll be able to figure out how to further adapt the code
> for my
> needs. I would appreciate any help!
>
> Thanks,
>
> Vivek
>



function testDSST()

% do the imports
import org.orekit.bodies.*
import org.orekit.forces.gravity.*
import org.orekit.forces.gravity.potential.*
import org.orekit.frames.*
import org.orekit.orbits.*
import org.orekit.propagation.conversion.*
import org.orekit.propagation.semianalytical.dsst.*
import org.orekit.propagation.semianalytical.dsst.forces.*
import org.orekit.propagation.SpacecraftState
import org.orekit.data.*
import org.orekit.time.*
import org.orekit.utils.Constants

initialOrbit = [ 7152e3, 0.00126, 86.4*pi/180, pi/2, 0, 0 ];

%% Configure Orekit
DM = DataProvidersManager.getInstance();
crawler = ZipJarCrawler('orekit-data.zip');
DM.clearProviders();
DM.addProvider(crawler);

%% configure propagator
% Set frames
inertialFrame = FramesFactory.getEME2000();
rotatingFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();

% prepare gravity force model
GravityFieldFactory.clearPotentialCoefficientsReaders();
GravityFieldFactory.addPotentialCoefficientsReader(ICGEMFormatReader('eigen-6s.gfc', true));
gravityProvider = GravityFieldFactory.getUnnormalizedProvider(30, 30);

sun  = CelestialBodyFactory.getSun();
moon = CelestialBodyFactory.getMoon();

% Build orbit
epoch = AbsoluteDate(2014, 1, 1, 14, 10, 00, TimeScalesFactory.getUTC());
orbit = KeplerianOrbit(initialOrbit(1), initialOrbit(2), initialOrbit(3), ...
    initialOrbit(5), initialOrbit(4), initialOrbit(6), ...
    PositionAngle.MEAN, inertialFrame, epoch, gravityProvider.getMu());

% Build propagator
minStep = orbit.getKeplerianPeriod() * 0.1;
maxStep = orbit.getKeplerianPeriod() * 10.0;
integBuilder = DormandPrince853IntegratorBuilder(minStep, maxStep, 0.001);
integrator = integBuilder.buildIntegrator(EquinoctialOrbit(orbit));
integrator.setInitialStepSize(orbit.getKeplerianPeriod() * 1.0);
prop = DSSTPropagator(integrator, false); % osculating output orbit
prop.setMu(gravityProvider.getMu())

% add needed force models
prop.addForceModel(DSSTCentralBody(rotatingFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, gravityProvider));
% sun
prop.addForceModel(DSSTThirdBody(sun));
% moon
prop.addForceModel(DSSTThirdBody(moon));

prop.setInitialState(SpacecraftState(orbit), false); % initial orbit is mean elements

finalState = prop.propagate(epoch.shiftedBy(86400 * 10));

fprintf('epoch : %s\n', char(finalState.getOrbit().getDate().toString()));
fprintf('orbital parameters:\n%s\n', char(finalState.getOrbit().toString()));

end