FreeFlyer Scripting Samples
|Top Previous Next|
These Mission Plans demonstrate the use of several of FreeFlyer's built-in math functions and the syntax and implementation of FreeFlyer's logic control statements. After exploring these Mission Plans, continue to the Functions and Flow Control script references for more information.
Jump to a Mission Plan Description:
This Mission Plan exercises FreeFlyer's various built-in conversion functions.
This Mission Plan demonstrates the use of a Procedure, defined in an external .FFProcedure file, which copies a Spacecraft object and all of its child objects using the Put command. Another Procedure that takes advantage of the Get command is then used to populate a Formation object of identical Spacecraft with identical hardware.
Formation of eight identical spacecraft copied using Procedures
This Mission Plan demonstrates the 'heap' sorting of an array in FreeFlyer. The array values are initialized using a UniformNoise function to generate pseudo-random numbers. The initial array and the final sorted array are reported to the Console.
This Mission Plan demonstrates use of If/Then decision control. In this example, propagation is terminated when spacecraft height falls below a given value. To learn more about topics related to this sample Mission Plan, see the If statement.
Output Plot of the height of a Spacecraft in a Low Earth Orbit
This Mission Plan demonstrates how to convert various Keplerian orbital elements into different sets of elements. The first option converts apogee and radius values (in km) to semi-major axis and eccentricity. The second option converts eccentric anomaly and eccentricity into true anomaly.
This Mission Plan shows the various launch sites around the world in a 2D view. Each ground station has a Region to show the direction in which spacecraft may be launched. This Mission Plan also demonstrates how to create and work with Lists of GroundStation objects and Region objects.
A visualization of the launch sites around the world
This Mission Plan demonstrates various mathematical operations using the Matrix, Array, and Variable objects in FreeFlyer, including Matrix filling, Matrix statistics, Matrix slicing and resizing, Matrix decompositions, Matrix-Variable operations, Array-Variable operations, Array-Array operations, concatenating Arrays, and operations with row Matrices, differently-sized Matrices, and square, same-sized Matrices.
This Mission Plan demonstrates the usage of FreeFlyer GaussianNoise and UniformNoise statistical functions in a Monte Carlo analysis for a Low-Earth Orbit (LEO) to Geosynchronous Orbit (GEO) impulsive maneuver. In this example, given normal distributions in the error associated with the radius and velocity, and uniform distribution in the error associated with the impulsive maneuver, the final end apogee for the transfer orbit is calculated, plotted and reported for each case along with the mean, standard deviation, minimum, and maximum values.
The mission plan targets the optimal impulsive burn using a Targeting loop with the given initial state and then the errors are applied to the trajectory for each Monte Carlo case. The Mission version utilizes a User Interface to input the initial state values and Monte Carlo case size.
Output results of the Monte Carlo SMP
This Mission Plan demonstrates the use of Script Aliases in FreeFlyer. Script Aliases allow you to create simple abbreviations for more complex expressions in FreeForm script. An Alias can refer to any of the following types of expressions:
In this example, Script Aliases are used to propagate a Spacecraft for two days, while generating a 3D output view and two plots.
This Mission Plan exercises FreeFlyer's built-in sorting functions.
This Mission Plan demonstrates the use of Structs in FreeFlyer. The script defines a few example Structs and demonstrates creating and working with instances of those Structs. In particular, this example demonstrates computing the time of closest approach (TCA) and miss distance for two Spacecraft objects contained within a HighInterestConjunction Struct.
This Mission Plan demonstrates the use of the Switch statement to determine what type of output will be generated. In this example, while the Spacecraft is propagated for one day, the Switch enforces the following:
You can change which Case is executed by adjusting the value of the Variable 'a' in the FreeForm script.
This Mission Plan demonstrates the use of the Switch statement to determine when a Spacecraft should be maneuvered. The Switch statement monitors how many hours have elapsed, and when this value equals '1' or '3', a maneuver is executed. At all other times, the Spacecraft is simply stepped forward in time.
Orbital path of the maneuvered Spacecraft
This Mission Plan demonstrates how to synchronize all of the Spacecraft state vectors in a TLE file to the same epoch. Synched epochs are important if the TLEs are going to be imported into a Formation: when stepping the Formation, synched Epochs are important to keep the output coherent.
The Mission Plan starts by importing the states in a TLE file into a Formation, then finding the maximum state epoch. All states are then propagated to the maximum epoch and reported out to a file. This technique can be used to synch an unlimited number of states in a file; this is especially useful for Conjunction Assessment analyses.
This Mission Plan demonstrates various usages of the TimeSpan object introduced to extend timing precision in FreeFlyer beyond millisecond to the nanosecond level. It is designed to showcase the syntax primarily, and thus to supplement Mission Plan development using the nanosecond timing precision mode.
Output ConsoleWindow showcasing TimeSpan syntax