Small Satellites

Home » AGI STK10 MATLAB Interface » AGI STK 10 MATLAB INTERFACE: Satellite Ground Track

AGI STK 10 MATLAB INTERFACE: Satellite Ground Track

close all; clear all; clc

 AGI STK, is  as a software package from Analytical Graphics, Inc.(AGI) that
 allows to perform complex analyses of ground, sea, air, and space
 missions. More information can be found in AGI website.  https://www.agi.com
 To create this code we used educational code samples from % https://www.agi.com/resources/

% Establish the connection AGI STK 10
try
    % Grab an existing instance of STK 10
    uiapp = actxGetRunningServer('STK10.application');
catch
    % STK is not running, launch new instance
    % Launch a new instance of STK10 and grab it
    uiapp = actxserver('STK10.application');
end
%get the root from the personality
%it has two... get the second, its the newer STK Object Model Interface as
%documented in the STK Help
root = uiapp.Personality2;

% set visible to true (show STK GUI)
uiapp.visible = 1;
% From the STK Object Root you can command every aspect of the STK GUI
% close current scenario or open new one
try
    root.CloseScenario();
    root.NewScenario('SatelliteGroundTrack');
catch
    root.NewScenario('SatelliteGroundTrack');
end
% Set units to utcg before setting scenario time period and animation period
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG');
% %set units to epoch seconds because this works the easiest in matlab
% root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EPSEC');

% Set scenario time period and animation period
root.CurrentScenario.SetTimePeriod('25 May 2013 12:00:00.000', '26 May 2013 12:00:00.000');
root.CurrentScenario.Epoch = '25 May 2013 12:00:00.000';

% Create satellite
satObj = root.CurrentScenario.Children.New('eSatellite', 'SmallSats1');

% Propagate satellite
satObj.Propagator.InitialState.Representation.AssignClassical(...
    'eCoordinateSystemJ2000', 6750, 0.1, 53.4, 0, 0, 0);
% CoordinateSystem, Semimajor Axis, Eccentricity, Inclination,
% Arg. of Perigee, RAAN, Mean Anomaly

satObj.Propagator.StartTime = '25 May 2013 12:00:00.000';
satObj.Propagator.StopTime  = '25 May 2013 15:00:00.000';
satObj.Propagator.Propagate;

% Get Latitude, Longitude  for the satellite over the course of the mission.
LLAState = satObj.DataProviders.Item('LLA State').Group.Item('Fixed');
Elems = {'Time';'Lat';'Lon'};
satStartTime = satObj.Propagator.EphemerisInterval.FindStartTime;
satStopTime = satObj.Propagator.EphemerisInterval.FindStopTime;
Results = LLAState.ExecElements(satStartTime, satStopTime, 10, Elems);
time = cell2mat(Results.DataSets.GetDataSetByName('Time').GetValues);
Lat  = cell2mat(Results.DataSets.GetDataSetByName('Lat').GetValues);
Long = cell2mat(Results.DataSets.GetDataSetByName('Lon').GetValues);

Plot

figure(1);
hold on;
axis([0 360 -90 90]);
load('topo.mat','topo','topomap1');
contour(0:359,-89:90,topo,[0 0],'b')
axis equal
box on
set(gca,'XLim',[-180 180],'YLim',[-90 90], ...
    'XTick',[-180 -120 -60 0 60 120 180], ...
    'Ytick',[-90 -60 -30 0 30 60 90]);
image([-180 180],[-90 90],topo,'CDataMapping', 'scaled');
colormap(topomap1);
ylabel('Latitude [deg]');
xlabel('Longitude [deg]');
title('Satellite Ground Track');
scatter(Long,Lat,'.r');

Simplesat_01Ground track generated by AGI STK10  

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Recent Post

%d bloggers like this: