Configuring Formation with VisibilitySegments or VisibilityCalculators

Post your experiences with FreeFlyer in this forum to get feedback and support. If you're a current customer who needs support, please contact the FreeFlyer Support Team.
Technical Support Email: techsupport@ai-solutions.com Phone: +1 (301) 306-1756 Ext 2
Angel Rocha 6645752e1159d
Posts: 5
Joined: Thu May 16, 2024 2:53 am
Configuring Formation with VisibilitySegments or VisibilityCalculators

Post by Angel Rocha 6645752e1159d »

VisibilityCalculator Objects can be used to create and manage multiple VisibilitySegments when you want to evaluate whether all or any of a set of segments are simultaneously true. The following example demonstrates configuration of a VisibilityCalculator Object to test whether a Formation Object with 3 Spacecraft has line of sight visibility with a GroundStation. Both all and any visibility conditions are evaluated and reported.

Code: Select all

// Instantiate Objects
Formation Trio(3);
GroundStation GroundStation1;
VisibilityCalculator TrioToGS;
Variable i;

// Configure Trio Formation
Trio[0].TA = 0; Trio[1].TA = 10; Trio[2].TA = 20;
Trio.GroupPointSize = 5;

// Configure each VisibilitySegment in VisibilityCalculator
For i = 0 to Trio.Count-1;
	TrioToGS.AddSegment();
	TrioToGS.Segments[i].SetObserver(Trio[i]);
	TrioToGS.Segments[i].SetTarget(GroundStation1);
	TrioToGS.Segments[i].AddOccultingBody(Earth);
	TrioToGS.Segments[i].CelestialObjectOccultationModel = 1; // Ellipsoid
	TrioToGS.Segments[i].Active = 1;
End;

// Propagate & Generate Output
While(Trio[0].ElapsedTime < TIMESPAN(1 days));
	
	// Report when all segments are complete
	If (TrioToGS.Visibility(Trio[0].Epoch) == 1);
		Report Trio[0].EpochText, TrioToGS.Visibility(Trio[0].Epoch);
	End;
	
	// Report whether each segment is complete
	For i = 0 to Trio.Count-1;
		Report Trio[0].EpochText, i, TrioToGS.Segments[i].Visibility(Trio[0].Epoch);
	End;
	
	View Trio, GroundStation1;
	Trio.Step();
End;