AGI STK Objects 11 Send comments on this topic.
IAgAccessConstraint Interface





Description

AgAccessConstraint used to access the AccessConstraint attributes

Public Properties

Public Property ConstraintName Property used to access the constraint name.
Public Property ConstraintType Property used to access the constraint type.
Public Property ExclIntvl Exclude Time Intervals
Public Property IsPlugin This property is deprecated. It is now read-only.
Public Property MaxRelMotion Maximum relative motion used in adaptive sampling.
Public Property MaxTimeStep Maximum time step used in adaptive sampling.

Example

Return a list of available constraints
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
constraintArray = accessConstraints.AvailableConstraints; 
 
disp('List of Available Constraints:'); 
for i=1:length(constraintArray) 
   disp(constraintArray{i,1}); 
end 
 
 
Add and configure a lighting condition access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
% Condition constraint 
light = accessConstraints.AddConstraint('eCstrLighting'); 
light.Condition = 'eDirectSun'; 
 
 
Add and configure a LOS sun exclusion access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
% Angle constraint 
cnstrAngle = accessConstraints.AddConstraint('eCstrLOSSunExclusion'); 
cnstrAngle.Angle = 176.0; 
 
 
Add and configure a lunar elevation angle access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
minmax = accessConstraints.AddConstraint('eCstrLunarElevationAngle'); 
minmax.EnableMin = true; 
minmax.Min = 11.1; 
minmax.EnableMax = true; 
minmax.Max = 88.8; 
 
 
Add and configure a sun elevation angle access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
minmax = accessConstraints.AddConstraint('eCstrSunElevationAngle'); 
minmax.EnableMin = true; 
minmax.Min = 22.2; 
minmax.EnableMax = true; 
minmax.Max = 77.7; 
 
 
Add and configure a third body obstruction access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessconstraints: Access Constraint collection 
% Get IAgAccessCnstrThirdBody interface 
thirdBodyConstraint = accessConstraints.AddConstraint('eCstrThirdBodyObstruction'); 
 
% 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 and configure an altitude access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
% Attitude constraint 
altitude = accessConstraints.AddConstraint('eCstrAltitude'); 
altitude.EnableMin = true; 
altitude.Min = 20.5;    % km 
 
 
Add multiple access constraints of the same type to an STK Object
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
 
% 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'; 
 
 
Add a Exclusion Zone access constraint
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
excludeZone = accessConstraints.AddNamedConstraint('ExclusionZone'); 
excludeZone.MaxLat = 45; 
excludeZone.MinLat = 15; 
excludeZone.MinLon = -75; 
excludeZone.MaxLon = -35; 
 
 
Remove all access constraints except for LOS
[MATLAB] Copy Code
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection 
for i=accessConstraints.Count - 1:-1:0 
    constraint = accessConstraints.Item(i).ConstraintName; 
 
    if (strcmp(constraint,'LineOfSight')) == false 
        if (strcmp(constraint,'ThirdBodyObstruction')) 
            thirdBodyConstraint = accessConstraints.GetActiveNamedConstraint('ThirdBodyObstruction'); 
            assignedArray = thirdBodyConstraint.AssignedObstructions; 
 
            for j=1:length(assignedArray) 
                thirdBodyConstraint.RemoveObstruction(assignedArray{j}); 
            end 
 
        elseif (strcmp(constraint,'ExclusionZone')) 
            accessConstraints.GetActiveNamedConstraint('ExclusionZone').RemoveAll; 
 
        else 
            accessConstraints.RemoveNamedConstraint(constraint); 
        end 
    end 
end 
 
 
Configure the access interval to the availability time span of the object where access is being computed to.
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model root 
 
satellite = root.GetObjectFromPath('/Satellite/MySatellite'); 
facility = root.GetObjectFromPath('/Facility/MyFacility'); 
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 
 
 
GetAccessBetweenObjectsByPath using the output of GetExistingAccesses
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model root 
scenario = root.CurrentScenario; 
accesses = scenario.GetExistingAccesses(); 
 
[row, col] = size(accesses);  % number of accesses 
 
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) 
 
access = scenario.GetAccessBetweenObjectsByPath(object1, object2); 
 
 

CoClasses that Implement IAgAccessConstraint

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1