% AvailableObstructions returns a one dimensional array of obstruction paths availableArray = thirdBodyConstraint.AvailableObstructions;
% In this example add all available obstructions disp('Available obstructions'); for i=1:length(availableArray) disp(availableArray{i,1}); thirdBodyConstraint.AddObstruction(availableArray{i,1}); end
% AssignedObstructions returns a one dimensional array of obstruction paths assignedArray = thirdBodyConstraint.AssignedObstructions;
disp('Assigned obstructions'); for i=1:length(assignedArray) disp(assignedArray{i,1}); end
% Add constraints % Only the eCstrApparentTime, eCstrDuration, eCstrGMT, eCstrIntervals, eCstrLocalTime constraint % types can be added multiple times to the constraint collection. time1 = accessConstraints.AddConstraint('eCstrLocalTime'); time1.Min = '00:00:00.000'; time1.Max = '23:00:00.000';
% Print results for i = 0:results.Count - 1 result = results.Item(i); disp(['Time: ' result.Time ' HasAccess: ' num2str(result.AccessSatisfied)]);
for j = 0:result.Constraints.Count - 1 constraint = result.Constraints.Item(j); disp(['Constraint: ' constraint.Constraint ' Object: ' constraint.ObjectPath ' Status: ' constraint.Status ' Value: ' num2str(constraint.Value)]); end end
Compute and extract access interval times
[MATLAB]
% IAgStkAccess access: Access calculation % Get and display the Computed Access Intervals intervalCollection = access.ComputedAccessIntervalTimes;
% Set the intervals to use to the Computed Access Intervals computedIntervals = intervalCollection.ToArray(0, -1); access.SpecifyAccessIntervals(computedIntervals);
Configure the access analysis time period to specified time instants.
% For this code snippet, let's use the time interval when the satellite reached min and max altitude values. % Note, this assumes time at min happens before time at max. timeOfAltMin = satellite.Vgt.Events.Item('GroundTrajectory.Detic.LLA.Altitude.TimeOfMin'); timeOfAltMax = satellite.Vgt.Events.Item('GroundTrajectory.Detic.LLA.Altitude.TimeOfMax');
% Set the access time period with the times we figured out above. access = satellite.GetAccessToObject(facility); access.AccessTimePeriod = 'eUserSpecAccessTime'; accessTimePeriod = access.AccessTimePeriodData;
if (satellite.Vgt.EventIntervals.Contains('AvailabilityTimeSpan')) availabilityTimeSpan = satellite.Vgt.EventIntervals.Item('AvailabilityTimeSpan'); accessTimePeriod.AccessInterval.SetImplicitInterval(availabilityTimeSpan); end
object1 = accesses{1,1}; % e.g. "Satellite/MySatellite" object2 = accesses{1,2}; % e.g. "Facility/MyFacility" computed = accesses{1,3}; % e.g. true (if access has been computed)
Set the Propagator to GreatArc and set the start time
[MATLAB]
% IAgAircraft aircraft: Aircraft object %Set the propagator to GreatArc aircraft.SetRouteType('ePropagatorGreatArc');
%Set the start time to a new start time aircraft.Route.StartTime = '25 Dec 2019 00:00:00.00'; aircraft.Route.Propagate;
Create an area target (on the current scenario central body)
[MATLAB]
%IAgStkObjectRoot root: STK Object Model Root
% Create the AreaTarget on the current scenario central body (use % NewOnCentralBody to specify explicitly the central body) areaTarget = root.CurrentScenario.Children.New('eAreaTarget', 'MyAreaTarget');
Define area target boundary and position from list of lat/lon/alt
% By using the fine grained interfaces, % BeginUpdate/EndUpdate prevent intermediate redraws root.BeginUpdate(); areaTarget.AreaType = 'ePattern'; patterns = areaTarget.AreaTypeData; patterns.Add(48.897, 18.637); patterns.Add(46.534, 13.919); patterns.Add(44.173, 21.476); root.EndUpdate(); areaTarget.AutoCentroid = true;
Define area target boundary and position from list of lat/lon/alt (using common tasks)
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root % IAgAreaTarget areaTarget: AreaTarget object % Remove all points in the area target areaTarget.AreaTypeData.RemoveAll;
% By using the CommonTasks interface, % make an array of lattitude and longitude boundary points boundary = {29, -12; 29, 34; 6, 34; 6, -12};
% SetAreaTypePattern expects a two dimensional array of latitude and longitude values areaTarget.CommonTasks.SetAreaTypePattern(boundary);
List all points in an area target
[MATLAB]
% IAgAreaTarget areaTarget: AreaTarget object if strcmp(areaTarget.AreaType,'ePattern')
% Get IAgAreaTypePatternCollection interface from AreaTypeData patternPoints = areaTarget.AreaTypeData;
% ToArray returns a two dimensional array of latitude and longitude points areaTargetPoints = patternPoints.ToArray();
disp('All points in Area Target'); for i= 1:length(areaTargetPoints) disp(['Latitude ' num2str(areaTargetPoints{i,1}) ' Longitude: ' num2str(areaTargetPoints{i,2})]); end end
% By using the fine grained interfaces, % BeginUpdate/EndUpdate prevent intermediate redraws root.BeginUpdate(); areaTarget.AreaType = 'eEllipse'; ellipse = areaTarget.AreaTypeData; ellipse.SemiMajorAxis = 85.25; % in km (distance dimension) ellipse.SemiMinorAxis = 80.75; % in km (distance dimension) ellipse.Bearing = 44; % in deg (angle dimension) root.EndUpdate();
Set an elliptical area target (using common tasks)
% By using the CommonTasks interface areaTarget.CommonTasks.SetAreaTypeEllipse(85.25, 80.75, 44);
Create a chain (on the current scenario central body)
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root % Create the Chain on the current scenario central body (use % NewOnCentralBody to specify explicitly the central body) chain = root.CurrentScenario.Children.New('eChain', 'MyChain');
% Specify our own time period chain.SetTimePeriodType('eUserSpecifiedTimePeriod');
% Get chain time period interface chainUserTimePeriod = chain.TimePeriod; chainUserTimePeriod.SetTimePeriod(root.CurrentScenario.StartTime, root.CurrentScenario.StopTime); % Set to scenario period
% Compute the chain chain.ComputeAccess();
Define and compute a chain (basic)
[MATLAB]
% IAgChain chain: Chain object
% Add some objects to chain (using STK path) chain.Objects.Add('Facility/MyFacility'); chain.Objects.Add('Satellite/MySatellite');
% Compute the chain chain.ComputeAccess();
Prints the strand intervals of chain object
[MATLAB]
% IAgChain chain: Chain Object % Compute the chain access if not done already. chain.ComputeAccess();
% Considered Start and Stop time disp(['Chain considered start time: ' chain.Vgt.Events.Item('ConsideredStartTime').FindOccurrence.Epoch]); disp(['Chain considered stop time: ', chain.Vgt.Events.Item('ConsideredStopTime').FindOccurrence.Epoch]);
Create a New CoverageDefinition (on the current scenario central body)
[MATLAB]
% IAgScenario scenario: Scenario object %Create new Coverage Definition and set the Bounds to an area target coverage = scenario.Children.New('eCoverageDefinition', 'MyCoverage'); coverage.Grid.BoundsType = 'eBoundsCustomRegions'; covGrid = coverage.Grid; bounds = covGrid.Bounds; bounds.AreaTargets.Add('AreaTarget/MyAreaTarget'); %Define the Grid Resolution Res = covGrid.Resolution; Res.LatLon = .5; %deg %Set the satellite as the Asset coverage.AssetList.Add('Satellite/MySatellite');
% Turn off Show Grid Points coverage.Graphics.Static.IsPointsVisible = false;
Extracting Elements from Data Providers with Groups
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgSatellite satellite: Satellite object % IAgScenario scenario: Scenario object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); satPosDP = satellite.DataProviders.Item('Cartesian Position').Group.Item('ICRF').Exec(scenario.StartTime,scenario.StopTime,60); satx = cell2mat(satPosDP.DataSets.GetDataSetByName('x').GetValues); saty = cell2mat(satPosDP.DataSets.GetDataSetByName('y').GetValues); satz = cell2mat(satPosDP.DataSets.GetDataSetByName('z').GetValues);
satVelDP = satellite.DataProviders.GetDataPrvTimeVarFromPath('Cartesian Velocity/ICRF').Exec(scenario.StartTime,scenario.StopTime,60); %There are 4 Methods to get DP From a Path depending on the kind of DP: % GetDataPrvTimeVarFromPath % GetDataPrvIntervalFromPath % GetDataPrvInfoFromPath % GetDataPrvFixedFromPath satvx = cell2mat(satVelDP.DataSets.GetDataSetByName('x').GetValues); satvy = cell2mat(satVelDP.DataSets.GetDataSetByName('y').GetValues); satvz = cell2mat(satVelDP.DataSets.GetDataSetByName('z').GetValues);
Extracting Elements from Data Providers with PreData
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgFacility facility: Facility object % IAgScenario scenario: Scenario object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); facChooseDP = facility.DataProviders.Item('Points Choose System'); dataProvCenter = facChooseDP.Group.Item('Center'); %Choose the referense system you want to report the Center point in dataProvCenter.PreData = 'CentralBody/Earth TOD'; rptElems = {'Time';'x';'y';'z'}; results = dataProvCenter.ExecElements(scenario.StartTime, scenario.StopTime, 60, rptElems); datasets = results.DataSets; Time = cell2mat(datasets.GetDataSetByName('Time').GetValues); facTODx = cell2mat(datasets.GetDataSetByName('x').GetValues); facTODy = cell2mat(datasets.GetDataSetByName('y').GetValues); facTODz = cell2mat(datasets.GetDataSetByName('z').GetValues);
Getting Data for a Single Point in Time
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgSatellite satellite: Satellite object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); satPassDP = satellite.DataProviders.Item('Precision Passes').ExecSingle(2600); pass = cell2mat(satPassDP.DataSets.GetDataSetByName('Precision Pass Number').GetValues);
Getting Data for Specific Points and Elements
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgSatellite satellite: Satellite object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); times = {0;15000;20000;55000}; elems = {'Time';'Precision Pass Number'}; satPassesDP = satellite.DataProviders.Item('Precision Passes').ExecSingleElementsArray(times,elems); passes = cell2mat(satPassesDP.GetArray(cast(1,'int32')));
Getting Time Dependent Data that's broken into Sections
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgScenario scenario: Scenario object % IAgStkAccess access: Access calculation %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); accessAER = access.DataProviders.Item('AER Data').Group.Item('BodyFixed').Exec(scenario.StartTime, scenario.StopTime,60); AERTimes = cell2mat(accessAER.Interval.Item(cast(0,'int32')).DataSets.GetDataSetByName('Time').GetValues); Az = cell2mat(accessAER.Interval.Item(cast(0,'int32')).DataSets.GetDataSetByName('Azimuth').GetValues); El = cell2mat(accessAER.Interval.Item(cast(0,'int32')).DataSets.GetDataSetByName('Elevation').GetValues); for i = 1:1:accessAER.Interval.Count-1 AERTimes = [AERTimes; cell2mat(accessAER.Interval.Item(cast(i,'int32')).DataSets.GetDataSetByName('Time').GetValues)]; Az = [Az; cell2mat(accessAER.Interval.Item(cast(i,'int32')).DataSets.GetDataSetByName('Azimuth').GetValues)]; El = [El; cell2mat(accessAER.Interval.Item(cast(i,'int32')).DataSets.GetDataSetByName('Elevation').GetValues)]; end
Using a Time Dependent Data Provider and requesting only specified elements
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgSatellite satellite: Satellite object % IAgScenario scenario: Scenario object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); elems = {'Time';'q1';'q2';'q3';'q4'}; satDP = satellite.DataProviders.Item('Attitude Quaternions').ExecElements(scenario.StartTime, scenario.StopTime, 60, elems); %Whenever you pass an index to an array, you need to cast it to a long %equivalent (int32) satTime = cell2mat(satDP.DataSets.Item(cast(0,'int32')).GetValues); satq1 = cell2mat(satDP.DataSets.Item(cast(1,'int32')).GetValues); satq2 = cell2mat(satDP.DataSets.Item(cast(2,'int32')).GetValues); satq3 = cell2mat(satDP.DataSets.Item(cast(3,'int32')).GetValues); satq4 = cell2mat(satDP.DataSets.Item(cast(4,'int32')).GetValues);
Using a Time Independent Data Provider
[MATLAB]
% IAgStkObjectRoot root: STK Object Model root % IAgFacility facility: Facility object %Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); facDP = facility.DataProviders.Item('Cartesian Position').Exec; facx = cell2mat(facDP.DataSets.GetDataSetByName('x').GetValues); facy = cell2mat(facDP.DataSets.GetDataSetByName('y').GetValues); facz = cell2mat(facDP.DataSets.GetDataSetByName('z').GetValues);
%Change DateFormat dimension to epoch seconds to make the data easier to handle in %MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); %Get the current scenario scenario = root.CurrentScenario; %Set up the access object access = satellite.GetAccessToObject(facility); access.ComputeAccess; %Get the Access AER Data Provider accessDP = access.DataProviders.Item('Access Data').Exec(scenario.StartTime, scenario.StopTime); %DP results return cell data types. cell2mat accessStartTimes = cell2mat(accessDP.DataSets.GetDataSetByName('Start Time').GetValues); accessStopTimes = cell2mat(accessDP.DataSets.GetDataSetByName('Stop Time').GetValues);
track1 = mto.Tracks.AddTrack(1,mtoTimes,mtoLats,mtoLons,mtoAlts); track1.Interpolate = true; % Change the color of the track mto.Graphics.Tracks.GetTrackFromId(1).Color = 255;
Load MTO track points from file
[MATLAB]
% LoadPoints expects the path an Ephemeris file path % IAgMto mto: MTO Object track2 = mto.Tracks.Add(2); track2.Points.LoadPoints('<Install_Dir>\Data\Resources\stktraining\text\EphemerisLLATimePosVel_Example.e'); track2.Interpolate = true;
objCoverageFOM = objCoverage.FOM; if objCoverageFOM.IsDefinitionTypeSupported('eFmAccessDuration') objCoverageFOM.SetDefinitionType('eFmAccessDuration'); objCoverageFOM.Definition.SetComputeType('eMaximum'); end
% IAgSatellite satellite: Satellite object keplerian = satellite.Propagator.InitialState.Representation.ConvertTo('eOrbitStateClassical'); % Use the Classical Element interface keplerian.SizeShapeType = 'eSizeShapeAltitude'; % Changes from Ecc/Inc to Perigee/Apogee Altitude keplerian.LocationType = 'eLocationTrueAnomaly'; % Makes sure True Anomaly is being used keplerian.Orientation.AscNodeType = 'eAscNodeLAN'; % Use LAN instead of RAAN for data entry
% Assign the perigee and apogee altitude values: keplerian.SizeShape.PerigeeAltitude = 500; % km keplerian.SizeShape.ApogeeAltitude = 600; % km
% Assign the other desired orbital parameters: keplerian.Orientation.Inclination = 90; % deg keplerian.Orientation.ArgOfPerigee = 12; % deg keplerian.Orientation.AscNode.Value = 24; % deg keplerian.Location.Value = 180; % deg
% Apply the changes made to the satellite's state and propagate: satellite.Propagator.InitialState.Representation.Assign(keplerian); satellite.Propagator.Propagate;
% IAgSatellite satellite: Satellite object satellite.SetPropagatorType('ePropagatorSGP4'); propagator = satellite.Propagator; propagator.UseScenarioAnalysisTime; propagator.CommonTasks.AddSegsFromOnlineSource('25544'); % International Space Station propagator.AutoUpdateEnabled = true; propagator.Propagate;
Set satellite propagator to SPICE and propagate
[MATLAB]
% IAgSatellite satellite: Satellite object % IAgStkObjectRoot root: STK Object Model Root satellite.SetPropagatorType('ePropagatorSPICE'); propagator = satellite.propagator; propagator.Spice = '<Install_Dir>\STKData\Spice\planets.bsp'; % Make sure this is a valid path propagator.BodyName = 'MARS';
propagator.StartTime = root.CurrentScenario.StartTime; % Set to scenario start time propagator.StopTime = root.CurrentScenario.StopTime; % Set to scenario stop time propagator.Step = 60.0; propagator.Propagate;
Create a new component through the Component Browser
[MATLAB]
% IAgVADriverMCS driver: MCS driver interface % IAgScenario scenario: Scenario object %Get the Prop Funct Folder compBrowser = scenario.ComponentDirectory.GetComponents('eComponentAstrogator').GetFolder('Propagator Functions'); %Get the Atmospheric Models Folder atmos = compBrowser.GetFolder('Atmospheric Models'); %Grab the Mars Exponential Model mars = atmos.Item('Exponential - Mars'); %Make a copy of the Model to Edit it marsClone = mars.CloneObject;
%Grab a handle of the new Mars Model and edit properties newMars = atmos.Item('Exponential - Mars1'); newMars.Name = 'New Mars'; newMars.ReferenceAltitude = 0; %km newMars.ReferenceDensity = 20000000; %kg/km^3 newMars.ScaleAltitude = 11.1; %km
Insert a Propagate State Segment into the MCS and Add/Remove Stopping Conditions
% IAgSatellite satellite: Satellite object %Remove all data displays so you can easily pick one that may already be in %the list satellite.VO.DataDisplay.RemoveAll; %Add LLA data display and change size/title datadisplay = satellite.VO.DataDisplay.Add('LLA Position'); datadisplay.IsVisible = true; datadisplay.FontSize = 'eMedium'; datadisplay.TitleText = 'My Data Display'; datadisplay.IsShowNameEnabled = false;
% IAgSatellite satellite: Satellite object %Set the contours in the 2D properties contours = satellite.Graphics.ElevContours; contours.IsVisible = true; contours.NumOfDecimalDigits = 0; contours.Elevations.AddLevelRange(0,90,10); % Min, Max, Step %Turn the contours on in the 3D properties satellite.VO.ElevContours.IsVisible = true;
Set 2D/3D Pass Display Properties
[MATLAB]
% IAgSatellite satellite: Satellite object %Display one pass for ground track and orbit on 2D passdata = satellite.Graphics.PassData; groundTrack = passdata.GroundTrack; groundTrack.SetLeadDataType('eDataOnePass'); groundTrack.SetTrailSameAsLead; orbit = passdata.Orbit; orbit.SetLeadDataType('eDataOnePass'); orbit.SetTrailSameAsLead; %Display one orbit pass and no ground track on 3D passdata3D = satellite.VO.Pass.TrackData.PassData; groundTrack3D = passdata3D.GroundTrack; groundTrack3D.SetLeadDataType('eDataNone'); groundTrack3D.SetTrailSameAsLead; orbit3D = passdata3D.Orbit; orbit3D.SetLeadDataType('eDataOnePass'); orbit3D.SetTrailSameAsLead;
Set 2D/3D Range Contours
[MATLAB]
% IAgSatellite satellite: Satellite object %Set a contour level in the 2D properties rangeContours = satellite.Graphics.RangeContours; rangeContours.IsVisible = true; rangeLevel = rangeContours.LevelAttributes.AddLevel(2000); % km rangeLevel.Color = 16711935; rangeLevel.LineWidth = 4; rangeLevel.LabelAngle = 90; rangeLevel.UserTextVisible = true; rangeLevel.UserText = 'Range'; %Turn the contours on in the 3D properties satellite.VO.RangeContours.IsVisible = true;
% IAgSensor sensor: Sensor object % Change pattern and set sensor.CommonTasks.SetPatternRectangular(20,25); % Change pointing and set sensor.CommonTasks.SetPointingFixedAzEl(90,60,'eAzElAboutBoresightRotate'); % Change location and set sensor.SetLocationType('eSnFixed'); sensor.LocationData.AssignCartesian(-.0004,-.0004,.004);
% IAgScenario scenario: Scenario object % Create a array of LLA values and interoplate them over the specified % central body positionArray = {35.017; -118.540; 0; 44.570; -96.474; 0; 31.101; -82.619; 0}; manager = scenario.SceneManager; % Interpolate points over great arc interpolator = manager.Initializers.GreatArcInterpolator.InitializeWithCentralBody('Earth'); interpolator.Granularity = .1; result = interpolator.Interpolate(positionArray);
% IAgCrdnProvider vgtSat: Vector Geometry Tool Interface % IAgCrdnEventArray custom: Time Array Component timeArrayFactory = vgtSat.EventArrays.Factory; timeArray = timeArrayFactory.CreateEventArrayStartStopTimes('StartTimes','Start Times of Custom Intervals'); timeArray.ReferenceIntervals = Custom; timeArray.StartStopOption = 'eCrdnStartStopOptionCountStartOnly';
Create a new Time Array
[MATLAB]
% IAgCrdnProvider vgtSat: Vector Geometry Tool Interface % IAgCrdnEventArray custom: Time Array Component timeArrayFactory = vgtSat.EventArrays.Factory; timeArray = timeArrayFactory.CreateEventArrayStartStopTimes('StartTimes','Start Times of Custom Intervals'); timeArray.ReferenceIntervals = Custom; timeArray.StartStopOption = 'eCrdnStartStopOptionCountStartOnly';
Create a new Time Instant
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root % IAgCrdnProvider vgtSat: Vector Geometry Tool Interface % Change DateFormat dimension to epoch seconds to make the time easier to handle in % MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); timeInstFactory = vgtSat.Events.Factory; timeEpoch = timeInstFactory.CreateEventEpoch('FixedTime','Fixed Epoch Time'); timeEpoch.Epoch = 3600;
Create a new Time Interval
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root % IAgCrdnProvider vgtSat: Vector Geometry Tool Interface % Change DateFormat dimension to epoch seconds to make the time easier to handle in % MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); timeIntFactory = vgtSat.EventIntervals.Factory; timeInterval = timeIntFactory.CreateEventIntervalFixed('TimeInterval','Fixed time interval'); timeInterval.SetInterval(60,120);
% IAgSatellite satellite: Satellite object vgtSat = satellite.vgt; % Get handle to the Center point on the satellite centerPtSat = vgtSat.Points.Item('Center'); % Get handle to the Body Y Vector bodyYSat = vgtSat.Vectors.Item('Body.Y'); % Get handle to the Body Axes bodyAxes = vgtSat.Axes.Item('Body'); icrfAxes = vgtSat.Axes.Item('ICRF');
Get Times From Defined Time Instant and create an cell array
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root % IAgCrdnProvider vgtSat: Vector Geometry Tool Interface % Change DateFormat dimension to epoch seconds to make the time easier to handle in % MATLAB root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec'); satStart= vgtSat.Events.Item('AvailabilityStartTime'); start = satStart.FindOccurrence.Epoch;
% IAgStkObjectRoot root: STK Object Model Root root.NewScenario('Example_Scenario');
Open a VDF
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root root.LoadVDF('<Install_Dir>\Data\ExampleScenarios\Intro_STK_Space_Systems.vdf','');
Reset the scenario time
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root root.Rewind;
Set unit preferences for Object Model
[MATLAB]
% IAgStkObjectRoot root: STK Object Model Root root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG'); root.UnitPreferences.Item('Distance').SetCurrentUnit('km');
STK window layout settings
[MATLAB]
% COM.STK13_application uiApplication: STK Application % Loop through the available windows to close the Timeline and maximize the % 3D window timelineWindow = ''; for i=0:uiApplication.Windows.Count - 1 window = uiApplication.Windows.Item(i); if (strcmp(window.Caption,'3D Graphics 1 - Earth')) window.WindowState = 'eWindowStateMaximized'; elseif (strcmp(window.Caption,'')) timelineWindow = window; end end timelineWindow.Close;
Create instance of AgStkObjectRoot in STK Engine application
[MATLAB]
% Before instantiating AgStkObjectRoot an instance of AgSTKXApplication or an STK X control must be created % This also requires a STKX license to be present STKXApplication = actxserver('STKX13.Application'); rootEngine = actxserver('AgStkObjects13.AgStkObjectRoot');