AGI STK Objects 11 Send comments on this topic.
IAgAccessConstraintCollection Collection





Description

AgAccessConstraintCollection used to access the list of constraints

Object Model

Public Methods

Public Method AddConstraint Adds a constraint to the Constraint Collection.


To determine the interface to use for a specific constraint, scroll down to the EConstraint Parameter table near the bottom of this help page. This table lists all possible values for the AgEAccessConstraints enumeration. The description column provides the corresponding interface to use with each constraint. For example, IAgAccessCnstrMinMax is the interface used with the Range constraint, eCstrRange.


Code snippet examples that show how to add and configure constraints are provided at the bottom of this help page.


The eCstrApparentTime, eCstrDuration, eCstrGMT, eCstrIntervals, eCstrLocalTime constraint types can be added multiple times to the constraint collection.

Public Method AddNamedConstraint Adds a constraint with the given name to the collection.
Public Method AvailableConstraints Returns a rectangular two-dimensional array of available constraints. A row of the array consists of two elements where the first element is a symbolic name of the constraint and the second is a corresponding enumeration value.
Public Method GetActiveConstraint Retrieves the active constraint.
Public Method GetActiveNamedConstraint Retrieves an active constraint with the given name.
Public Method IsConstraintActive Given an AgEAccessConstraints enum, informs the user if the constraint is active.
Public Method IsConstraintSupported Is the constraint supported for this object.
Public Method IsNamedConstraintActive Given a constraint name, returns whether the specified constraint is active.
Public Method IsNamedConstraintSupported Is the named constraint supported for this object.
Public Method RemoveConstraint Removes a constraint from the collection.
Public Method RemoveNamedConstraint Removes a constraint with the given name from the collection.

Public Properties

Public Property Count property Count returns the size of the collection
Public Property Item property Item returns an AccessConstraint

Example

Add and configure a sun elevation angle access constraint
[C#] Copy Code
IAgAccessCnstrMinMax minmax = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrSunElevationAngle) as IAgAccessCnstrMinMax; 
minmax.EnableMin = true
minmax.Min = 22.2
minmax.EnableMax = true
minmax.Max = 77.7
 

Add and configure a lunar elevation angle access constraint
[C#] Copy Code
IAgAccessCnstrMinMax minmax = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLunarElevationAngle) as IAgAccessCnstrMinMax; 
minmax.EnableMin = true
minmax.Min = 11.1
minmax.EnableMax = true
minmax.Max = 88.8
 

Add and configure a LOS sun exclusion access constraint
[C#] Copy Code
// Angle constraint 
IAgAccessCnstrAngle cnstrAngle = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLOSSunExclusion) as IAgAccessCnstrAngle; 
cnstrAngle.Angle = 176.0
 

Add and configure a lighting condition access constraint
[C#] Copy Code
// Condition constraint 
IAgAccessCnstrCondition light = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLighting) as IAgAccessCnstrCondition; 
light.Condition = AgECnstrLighting.eDirectSun; 
 

Add and configure an altitude access constraint
[C#] Copy Code
// Attitude constraint 
IAgAccessCnstrMinMax altitude = accessConstraints.AddConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax; 
altitude.EnableMin = true
altitude.Min = 20.5
 

List all exclusion zones of an access constraint
[C#] Copy Code
IAgAccessCnstrExclZonesCollection excZones = accessconstraints.GetActiveConstraint(AgEAccessConstraints.eCstrExclusionZone) as IAgAccessCnstrExclZonesCollection; 
 
if (excZones != null

    // ToArray returns a two dimensional array 
    // The second dimension is an array of minLon, minLat, maxLon, maxLat values 
    Array zones = excZones.ToArray(0, -1); 
 
    for (int i = 0; i < zones.GetUpperBound(0); i++) 
    { 
        Console.WriteLine("MinLon: {0}, MinLat: {1}, MaxLon: {2}, MaxLat {3}", zones.GetValue(i, 0), zones.GetValue(i, 1), zones.GetValue(i, 2), zones.GetValue(i, 3)); 
    } 

 

Enumerate the available constraints collection
[C#] Copy Code
// The AvailableConstraints method returns a rectangular two-dimensional array of available constraints. 
// A row of the array consists of two elements where the first element is a symbolic name of the constraint, 
// and the second is a corresponding enumeration value. 
 
Array arAvailable = accessConstraints.AvailableConstraints(); 
for (int i = 0; i < arAvailable.GetLength(0); i++) 

    string availName = (string)arAvailable.GetValue(i, 0); 
    AgEAccessConstraints eAccessConstraint = (AgEAccessConstraints)(int)arAvailable.GetValue(i, 1); 
    Console.WriteLine("\tConstraint {0}: {1} ({2})", i, availName, eAccessConstraint); 

 

Add and configure a sun elevation angle access constraint
[Visual Basic .NET] Copy Code
Dim minmax As IAgAccessCnstrMinMax = TryCast(accessConstraints.AddConstraint(AgEAccessConstraints.eCstrSunElevationAngle), IAgAccessCnstrMinMax)
minmax.EnableMin = True
minmax.Min = 22.2
minmax.EnableMax = True
minmax.Max = 77.7

Add and configure a lunar elevation angle access constraint
[Visual Basic .NET] Copy Code
Dim minmax As IAgAccessCnstrMinMax = TryCast(accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLunarElevationAngle), IAgAccessCnstrMinMax)
minmax.EnableMin = True
minmax.Min = 11.1
minmax.EnableMax = True
minmax.Max = 88.8

Add and configure a LOS sun exclusion access constraint
[Visual Basic .NET] Copy Code
' Angle constraint
Dim cnstrAngle As IAgAccessCnstrAngle = TryCast(accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLOSSunExclusion), IAgAccessCnstrAngle)
cnstrAngle.Angle = 176

Add and configure a lighting condition access constraint
[Visual Basic .NET] Copy Code
' Condition constraint
Dim light As IAgAccessCnstrCondition = TryCast(accessConstraints.AddConstraint(AgEAccessConstraints.eCstrLighting), IAgAccessCnstrCondition)
light.Condition = AgECnstrLighting.eDirectSun

Add and configure an altitude access constraint
[Visual Basic .NET] Copy Code
' Attitude constraint
Dim altitude As IAgAccessCnstrMinMax = TryCast(accessConstraints.AddConstraint(AgEAccessConstraints.eCstrAltitude), IAgAccessCnstrMinMax)
altitude.EnableMin = True
altitude.Min = 20.5

List all exclusion zones of an access constraint
[Visual Basic .NET] Copy Code
Dim excZones As IAgAccessCnstrExclZonesCollection = TryCast(accessconstraints.GetActiveConstraint(AgEAccessConstraints.eCstrExclusionZone), IAgAccessCnstrExclZonesCollection)

If excZones IsNot Nothing Then
    ' ToArray returns a two dimensional array
    ' The second dimension is an array of minLon, minLat, maxLon, maxLat values
    Dim zones As Array = excZones.ToArray(0, -1)

    Dim i As Integer = 0
    While i <>
        Console.WriteLine("MinLon: {0}, MinLat: {1}, MaxLon: {2}, MaxLat {3}", zones.GetValue(i, 0), zones.GetValue(i, 1), zones.GetValue(i, 2), zones.GetValue(i, 3))
        System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
    End While
End If

Enumerate the available constraints collection
[Visual Basic .NET] Copy Code
' The AvailableConstraints method returns a rectangular two-dimensional array of available constraints.
' A row of the array consists of two elements where the first element is a symbolic name of the constraint,
' and the second is a corresponding enumeration value.

Dim arAvailable As Array = accessConstraints.AvailableConstraints()
Dim i As Integer = 0
While i <>
    Dim availName As String = DirectCast(arAvailable.GetValue(i, 0), String)
    Dim eAccessConstraint As AgEAccessConstraints = DirectCast(DirectCast(arAvailable.GetValue(i, 1), Integer), AgEAccessConstraints)
    Console.WriteLine(vbTab & "Constraint {0}: {1} ({2})", i, availName, eAccessConstraint)
    System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While

Get handle to the object access constraints
[MATLAB] Copy Code
% IAgSatellite satellite: Satellite object 
accessConstraints = satellite.AccessConstraints; 
 
 
© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1