Script Aliases

Top  Previous  Next

Script Aliases in FreeFlyer allow you to create a simple abbreviation for more complex expressions in FreeForm script.


The following Sample Mission Plans (included with your FreeFlyer installation) demonstrate the use of the Script Aliases:


FreeFlyer Scripting Samples

Script Aliases


An Alias can refer to any of the following types of expressions:



Child Objects

Child Objects with type casting

Object Properties

Object Methods with set input arguments

Math expressions


Alias s = Spacecraft1;                 // Object

Alias g = GroundStation1;             // Object


Alias p1 = s.Propagator;               // Child Object

Alias p2 = (s.Propagator AsType RK89); // Child Object with type casting


Alias d = Spacecraft1.ElapsedTime;     // Object Property

Alias c = s.Contact(g);               // Object Method with set input argument


Alias e = (1 - Spacecraft1.Apogee/Spacecraft1.A);   // Math expression


Once the Alias has been created, it can be used anywhere in FreeFlyer script in place of the expression it was initialized with:


p1.StepSize = TIMESPAN(60 seconds); // The StepSize property is available to all Propagator types

p2.FixedStep = 1;                   // The FixedStep boolean property is only available to some Propagator types, such as the RK89



// Propagation loop:  View, Plot, and Step for three days

While (d < TIMESPAN(3 days));


     View s, g;

     Plot d, c;

     Step s;




Aliases will behave just as if the expressions they refer to have been substituted directly into the FreeFlyer script. For example, Aliases that refer to properties or methods with a state are initialized separately for each time the Alias is used.


While (d < TIMESPAN(1 days));

     While (d < TIMESPAN(1 days));   // Each "d" is a separate instance of Spacecraft1.ElapsedTime

          View s;

          Step s;






Script Aliases can be created within loops, such as a While, For, or If loop, but an Alias created in a loop cannot be used outside the loop. In the following example, the Alias "a" can be used inside the While loop in order to generate a Plot, but if you attempt to Report the Alias "a" outside the While loop, a syntax error will be generated.


While (d < 3);


    Alias a = Spacecraft1.A;

    Plot d, a;

    Step s;




Report a; // Syntax error




Script Aliases cannot refer to expressions containing any FreeFlyer commands.


// The following is NOT valid:


Alias f = Step Spacecraft1;


Script Aliases can be passed into Procedures, but they cannot be used to Define a Procedure.


// The following is NOT valid:


Define Procedure AliasProcedure(Alias s);


// ...




// This is valid, but the user must ensure that the Alias "s" will

// deliver the input type expected by the Procedure.


Define Procedure AliasProcedure(Spacecraft sc);


// ...




Call AliasProcedure(s);   // "s" is an Alias that refers to "Spacecraft1"