STK ObjectsSend comments on this topic.
IAgChUserSpecifiedTimePeriod Interface

Description

User-specified time period for the chain.

Public Properties

Public Property TimeIntervalAllows configuring the time interval.

Interfaces

Implemented Interface
IAgChTimePeriodBase

CoClasses that Implement IAgChUserSpecifiedTimePeriod

Example

Define and compute a chain (advance)
[C#]
// Remove all previous accesses
chain.ClearAccess();

// Add some objects to chain
chain.Objects.Add("Facility/fac1");
chain.Objects.Add("Satellite/sat1");
chain.Objects.Add("Satellite/sat2");
chain.Objects.Add("Aircraft/air1");

// Configure chain parameters
chain.AutoRecompute = false;
chain.EnableLightTimeDelay = false;
chain.TimeConvergence = 0.001;
chain.DataSaveMode = AgEDataSaveMode.eSaveAccesses;

// Specify our own time period
chain.SetTimePeriodType(AgEChTimePeriodType.eUserSpecifiedTimePeriod);

// Get chain time period interface
IAgChUserSpecifiedTimePeriod chainUserTimePeriod = chain.TimePeriod as IAgChUserSpecifiedTimePeriod;
chainUserTimePeriod.TimeInterval.SetExplicitInterval("1 Jul 2005 12:00:00", "2 Jul 2005 12:00:00");

// Compute the chain
chain.ComputeAccess();
Configure the chain compute time period.
[C#]
chain.SetTimePeriodType(AgEChTimePeriodType.eUserSpecifiedTimePeriod);
IAgChUserSpecifiedTimePeriod userSpecifiedTimePeriod = chain.TimePeriod as IAgChUserSpecifiedTimePeriod;
userSpecifiedTimePeriod.TimeInterval.SetExplicitInterval("1 May 2015 04:00:00.000", "1 May 2015 05:00:00.000");
Prints the strand intervals of chain object
[C#]
IAgStkObject chainAsStkObject = chain as IAgStkObject;

// Compute the chain access if not done already.
chain.ComputeAccess();

// Considered Start and Stop time
Console.WriteLine("Chain considered start time: {0}", chainAsStkObject.Vgt.Events["ConsideredStartTime"].FindOccurrence().Epoch);
Console.WriteLine("Chain considered stop time: {0}", chainAsStkObject.Vgt.Events["ConsideredStopTime"].FindOccurrence().Epoch);

IAgCrdnEventIntervalCollection objectParticipationIntervals = chainAsStkObject.Vgt.EventIntervalCollections["StrandAccessIntervals"];
IAgCrdnIntervalsVectorResult intervalListResult = objectParticipationIntervals.FindIntervalCollection();

for (int i = 0; i < intervalListResult.IntervalCollections.Count; ++i)
{
    if (intervalListResult.IsValid)
    {
        Console.WriteLine("Link Name: {0}", objectParticipationIntervals.Labels.GetValue(i));
        Console.WriteLine("--------------");
        for (int j = 0; j < intervalListResult.IntervalCollections[i].Count; ++j)
        {
            object startTime = intervalListResult.IntervalCollections[i][j].Start;
            object stopTime = intervalListResult.IntervalCollections[i][j].Stop;
            Console.WriteLine("Start: {0}, Stop: {1}", startTime, stopTime);
        }
    }
}
Define and compute a chain (advance)
[Visual Basic .NET]
' Remove all previous accesses
chain.ClearAccess()

' Add some objects to chain
chain.Objects.Add("Facility/fac1")
chain.Objects.Add("Satellite/sat1")
chain.Objects.Add("Satellite/sat2")
chain.Objects.Add("Aircraft/air1")

' Configure chain parameters
chain.AutoRecompute = False
chain.EnableLightTimeDelay = False
chain.TimeConvergence = 0.001
chain.DataSaveMode = AgEDataSaveMode.eSaveAccesses

' Specify our own time period
chain.SetTimePeriodType(AgEChTimePeriodType.eUserSpecifiedTimePeriod)

' Get chain time period interface
Dim chainUserTimePeriod As IAgChUserSpecifiedTimePeriod = TryCast(chain.TimePeriod, IAgChUserSpecifiedTimePeriod)
chainUserTimePeriod.TimeInterval.SetExplicitInterval("1 Jul 2005 12:00:00", "2 Jul 2005 12:00:00")

' Compute the chain
chain.ComputeAccess()
Configure the chain compute time period.
[Visual Basic .NET]
chain.SetTimePeriodType(AgEChTimePeriodType.eUserSpecifiedTimePeriod)
Dim userSpecifiedTimePeriod As IAgChUserSpecifiedTimePeriod = TryCast(chain.TimePeriod, IAgChUserSpecifiedTimePeriod)
userSpecifiedTimePeriod.TimeInterval.SetExplicitInterval("1 May 2015 04:00:00.000", "1 May 2015 05:00:00.000")
Prints the strand intervals of chain object
[Visual Basic .NET]
Dim chainAsStkObject As IAgStkObject = TryCast(chain, IAgStkObject)

' Compute the chain access if not done already.
chain.ComputeAccess()

' Considered Start and Stop time
Console.WriteLine("Chain considered start time: {0}", chainAsStkObject.Vgt.Events("ConsideredStartTime").FindOccurrence().Epoch)
Console.WriteLine("Chain considered stop time: {0}", chainAsStkObject.Vgt.Events("ConsideredStopTime").FindOccurrence().Epoch)

Dim objectParticipationIntervals As IAgCrdnEventIntervalCollection = chainAsStkObject.Vgt.EventIntervalCollections("StrandAccessIntervals")
Dim intervalListResult As IAgCrdnIntervalsVectorResult = objectParticipationIntervals.FindIntervalCollection()

Dim i As Integer = 0
While i < intervalListResult.IntervalCollections.Count
	If intervalListResult.IsValid Then
		Console.WriteLine("Link Name: {0}", objectParticipationIntervals.Labels.GetValue(i))
		Console.WriteLine("--------------")
		Dim j As Integer = 0
		While j < intervalListResult.IntervalCollections(i).Count
			Dim startTime As Object = intervalListResult.IntervalCollections(i)(j).Start
			Dim stopTime As Object = intervalListResult.IntervalCollections(i)(j).[Stop]
			Console.WriteLine("Start: {0}, Stop: {1}", startTime, stopTime)
			System.Threading.Interlocked.Increment(j)
		End While
	End If
	System.Threading.Interlocked.Increment(i)
End While
© 2024 Analytical Graphics, Inc. All Rights Reserved.