STK ObjectsSend comments on this topic.
IAgAccessConstraint Interface

Description

AgAccessConstraint used to access the AccessConstraint attributes.

Public Properties

Public Property ConstraintNameProperty used to access the constraint name.
Public Property ConstraintTypeProperty used to access the constraint type.
Public Property ExclIntvlExclude Time Intervals.
Public Property IsPluginReturns true if the access constraint is a plugin.
Public Property MaxRelMotionMaximum relative motion used in adaptive sampling.
Public Property MaxTimeStepMaximum time step used in adaptive sampling.

CoClasses that Implement IAgAccessConstraint

Example

Return a list of available constraints
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection
constraintArray = accessConstraints.AvailableConstraints()

print('List of Available Constraints:')
for i in range(0, len(constraintArray)):
    print(constraintArray[i])

Add and configure a lighting condition access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# Condition constraint
light = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLighting)
light.Condition = AgECnstrLighting.eDirectSun

Add and configure a LOS sun exclusion access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# Angle constraint
cnstrAngle = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLOSSunExclusion)
cnstrAngle.Angle = 176.0

Add and configure a lunar elevation angle access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
minmax = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLunarElevationAngle)
minmax.EnableMin = True
minmax.Min = 11.1
minmax.EnableMax = True
minmax.Max = 88.8

Add and configure a sun elevation angle access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
minmax = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrSunElevationAngle)
minmax.EnableMin = True
minmax.Min = 22.2
minmax.EnableMax = True
minmax.Max = 77.7

Add and configure a central body obstruction access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection
# Get IAgAccessCnstrCbObstruction interface
cbObstrConstraint = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrCbObstruction)

# AvailableObstructions returns a one dimensional array of obstruction paths
availableArray = cbObstrConstraint.AvailableObstructions

# In this example add all available obstructions
print('Available obstructions')
for i in range(0, len(availableArray)):
    print(availableArray[i])
    cbObstrConstraint.AddObstruction(availableArray[i])

# AssignedObstructions returns a one dimensional array of obstruction paths
assignedArray = cbObstrConstraint.AssignedObstructions

print('Assigned obstructions')
for i in range(0, len(assignedArray)):
    print(assignedArray[i])

Add and configure an altitude access constraint
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
# Attitude constraint
altitude = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrAltitude)
altitude.EnableMin = True
altitude.Min = 20.5  # km

Add multiple access constraints of the same type to an STK Object
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection

# Add constraints
# Only the eCstrApparentTime (4), eCstrDuration (13), eCstrGMT (16), eCstrIntervals (22), eCstrLocalTime (27) constraint
# types can be added multiple times to the constraint collection.
time1 = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLocalTime)
time1.Min = '00:00:00.000'
time1.Max = '23:00:00.000'

Add an Exclusion Zone access constraint
[Python - STK API]
# 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
[Python - STK API]
# IAgAccessConstraintCollection accessConstraints: Access Constraint collection
for i in range(accessConstraints.Count - 1, 0, -1):
    constraint = accessConstraints.Item(i).ConstraintName

    if (constraint == 'LineOfSight') is False:
        if (constraint == 'ThirdBodyObstruction'):
            thirdBodyConstraint = accessConstraints.GetActiveNamedConstraint('ThirdBodyObstruction')
            assignedArray = thirdBodyConstraint.AssignedObstructions

            for j in range(0, len(assignedArray)):
                thirdBodyConstraint.RemoveObstruction(assignedArray[j])

        elif (constraint == 'ExclusionZone'):
            accessConstraints.GetActiveNamedConstraint('ExclusionZone').RemoveAll()

        else:
            accessConstraints.RemoveNamedConstraint(constraint)

Configure the access interval to the availability time span of the object where access is being computed to.
[Python - STK API]
# IAgStkObjectRoot root: STK Object Model root

satellite = root.GetObjectFromPath('Satellite/MySatellite')
facility = root.GetObjectFromPath('Facility/MyFacility')
access = satellite.GetAccessToObject(facility)

access.AccessTimePeriod = AgEAccessTimeType.eUserSpecAccessTime
accessTimePeriod = access.AccessTimePeriodData

if (satellite.Vgt.EventIntervals.Contains('AvailabilityTimeSpan')):
    availabilityTimeSpan = satellite.Vgt.EventIntervals.Item('AvailabilityTimeSpan')
    accessTimePeriod.AccessInterval.SetImplicitInterval(availabilityTimeSpan)


GetAccessBetweenObjectsByPath using the output of GetExistingAccesses
[Python - STK API]
# IAgStkObjectRoot root: STK Object Model root
scenario = root.CurrentScenario
accesses = scenario.GetExistingAccesses()

size = len(accesses)  # number of accesses

object1 = accesses[0][0]   # e.g. "Satellite/MySatellite"
object2 = accesses[0][1]   # e.g.  "Facility/MyFacility"
computed = accesses[0][2]  # e.g. True  (if access has been computed)

access = scenario.GetAccessBetweenObjectsByPath(object1, object2)

Return a list of available constraints
[MATLAB]
% 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]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection

% Condition constraint
light = accessConstraints.AddConstraint('eCstrLighting');
light.Condition = 'eDirectSun';


        
Add and configure a LOS sun exclusion access constraint
[MATLAB]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection

% To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
% Angle constraint
cnstrAngle = accessConstraints.AddConstraint('eCstrLOSSunExclusion');
cnstrAngle.Angle = 176.0;


        
Add and configure a lunar elevation angle access constraint
[MATLAB]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection

% To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
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]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection

% To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
minmax = accessConstraints.AddConstraint('eCstrSunElevationAngle');
minmax.EnableMin = true;
minmax.Min = 22.2;
minmax.EnableMax = true;
minmax.Max = 77.7;


        
Add and configure a central body obstruction access constraint
[MATLAB]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection
% Get IAgAccessCnstrCbObstruction interface
cbObstrConstraint = accessConstraints.AddConstraint('eCstrCbObstruction');

% AvailableObstructions returns a one dimensional array of obstruction paths
availableArray = cbObstrConstraint.AvailableObstructions;

% In this example add all available obstructions
disp('Available obstructions');
for i=1:length(availableArray)
   disp(availableArray{i, 1});
   cbObstrConstraint.AddObstruction(availableArray{i, 1});
end

% AssignedObstructions returns a one dimensional array of obstruction paths
assignedArray = cbObstrConstraint.AssignedObstructions;

disp('Assigned obstructions');
for i=1:length(assignedArray)
    disp(assignedArray{i, 1});
end


        
Add and configure an altitude access constraint
[MATLAB]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection

% To make this more efficient, wrap this method between calls to root.BeginUpdate() and root.EndUpdate()
% 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]
% 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 an Exclusion Zone access constraint
[MATLAB]
% 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 Line Of Sight
[MATLAB]
% 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


        
Remove Line of Sight access constraint
[MATLAB]
% IAgAccessConstraintCollection accessConstraints: Access Constraint collection
accessConstraints.RemoveNamedConstraint('LineOfSight');

        
Configure the access interval to the availability time span of the object where access is being computed to.
[MATLAB]
% 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]
% 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);


        
© 2024 Analytical Graphics, Inc. All Rights Reserved.