Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with extracting STK object reports using MATLAB

Status
Not open for further replies.

odegreeangle

Newbie
Joined
Oct 18, 2021
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
7
Dear everybody,
I am struggling with a problem that I have with extracting STK data. I developed a walker satellite constellation by using MATLAB but i am unable to extract objects data and report from STK. I can extract base satellite (that I defined primarily) data by using Dataproviders command. but there is no way to gain access to other satellites reports. I am attaching MATLAB code here. Please help me out if you can. I am working on it for a week.
Thank you in advance

Code:
%% initialization
clc; clear;

%% system parameters
stk_scenario_name = 'walker';
start_time = '2 Oct 2021 12:00:00.000';
stop_time = '3 Oct 2021 12:00:00.000';

main_satellite_name = 'LeoSat';

%% Create a New Instance of STK from Inside MATLAB
app = actxserver('STK11.application'); % Create a new instance of STK11
app.UserControl = 1; % Create a new instance of STK11
root = app.Personality2; % Grab a handle on the STK application root

%% Create a New STK Scenario and configure its properties
scenario = root.Children.New('eScenario',stk_scenario_name); % Create a new scenario
scenario.SetTimePeriod(start_time,stop_time); % Configure your STK scenario's properties
scenario.StartTime = start_time;
scenario.StopTime = stop_time;
root.ExecuteCommand('Animate * Reset');

%% Add a satellite and configure its properties
satellite = scenario.Children.New('eSatellite',main_satellite_name);
% 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
basic = satellite.Attitude.Basic;
basic.SetProfileType('eProfileSpinning')
basic.Profile.Body.AssignXYZ(0,0,1)
basic.Profile.Inertial.AssignXYZ(0,1,0);
basic.Profile.Rate = 6;  % rev/sec

%% Create walker constellation based on LeoSat
walker_constellation = root.ExecuteCommand('Walker  */Satellite/LeoSat  Type  Delta  NumPlanes  1  NumSatsPerPlane  10  InterPlanePhaseIncrement 0 ColorByPlane Yes ConstellationName walker_system SetUniqueNames Yes');
% satellite.Unload();



%% Extract data
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);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top