List of Objects

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
Nate McCoun 6613f484be0f7
Posts: 6
Joined: Mon Apr 08, 2024 1:43 pm
List of Objects

Post by Nate McCoun 6613f484be0f7 »

Lists are a container for one or more FreeFlyer objects of the same type. Lists of objects can only be created in FreeFlyer script - they can't be created in the Object Browser. Angle brackets are used to specify the type of object List you are creating. The syntax for creating a List is:

Code: Select all

List<Object Type> ListName;

List<GroundStation> DSN;
List<ImpulsiveBurn> ApogeeManeuvers;
When you first create a List, it will be empty. To begin editing a List, start by setting its "Count", or length. This specifies how many elements the List will contain.

Code: Select all

// Set the length of Object Lists
DSN.Count = 3;
ApogeeManeuvers.Count = 4;

// Set List's count during its initial creation
List<GroundStation> DSN[3];
List<ImpulsiveBurn> ApogeeManeuvers[4];
Formations are a container for one or more Spacecraft objects. Formations are a specialized version of a List of Spacecraft (you can create a List of most types of FreeFlyer objects). The benefit of a Formation over a List of Spacecraft is that the Formation provides additional control over the visualization of the Spacecraft, and allows you to read TLE data into each Spacecraft in the Formation using a single line of script.
Useful example of utilizing Lists of objects for Contact Analysis

Code: Select all

Formation sc[3]; // Specialized List of 3 Spacecraft
List<GroundStation> gs[3];
List<VisibilitySegment> scToDSN[sc.Count*gs.Count]; // Create List of VisibilitySegments between each Spacecraft and each GroundStation
List<Vector> visVec[scToDSN.Count]; // Use Vectors for visual confirmation

Variable i;
Variable j;
Variable count;

For i = 0 to sc.Count-1;
	sc[i].A  = 10000;
	sc[i].I  = 20 + i*20; // Space out Spacecraft at 20 deg increments of inclination
	sc[i].TA = 120;
End;

// Edit individual GroundStations through indexing
gs[0].LoadFromStationGeodeticsFile("GTSC"); // White Sands, NM
gs[1].LoadFromStationGeodeticsFile("CSCU"); // Colorado Springs, CO
gs[2].LoadFromStationGeodeticsFile("DS25"); // Goldstone, CA

gs[0].Color = ColorTools.Lime;
gs[1].Color = ColorTools.Fuchsia;
gs[2].Color = ColorTools.Red;

// Set up VisibilitySegments and Vectors
For i = 0 to sc.Count-1;
	For j = 0 to gs.Count-1;
		scToDSN[count].SetObserver(sc[i]);
		scToDSN[count].SetTarget(gs[j]);
		visVec[count].BuildVector(9, sc[i], gs[j]);
		count++;
	End;
End;

View sc, gs, visVec;

For information on collections of objects of different types, see the Structs page.