﻿ Targeting Examples

# Targeting Examples

Top  Previous  Next

This page presents several examples demonstrating key features of Targeting in FreeFlyer:

For more background information, see the Targeting page.

Note: As of FreeFlyer 7.3, the default timing precision mode is nanosecond precision mode. For older Mission Plans that have not yet been converted from millisecond precision mode, the syntax for working with epochs and calendar date/time strings is different. See the timing precision mode page for more information.

## Example 1: Target Semi-Major Axis

A targeting loop is used to determine the duration of a finite burn necessary to reach a semi-major axis of 8000 km, with an error tolerance of 50 km.

 FiniteBurn FiniteBurn1;   Target;       Iterate Spacecraft1;       Vary FiniteBurn1.BurnDuration = TIMESPAN(30 seconds) + TIMESPAN(2 seconds) within ;       Maneuver Spacecraft1 using FiniteBurn1;       Achieve Spacecraft1.A = 8000 +/- 50; End;

Where:

 •30 is the seed value for FiniteBurn1.BurnDuration •2 is the perturbation for FiniteBurn1.BurnDuration •24 is the minimum for FiniteBurn1.BurnDuration •36 is the maximum for FiniteBurn1.BurnDuration •8000 is the goal value for Spacecraft1.A •50 is the allowable tolerance value for Spacecraft1.A

## Example 2: Target Orbital Period using Customized DifferentialCorrector

A DifferentialCorrector object, with a maximum of ten iterations, is used to target the x-component of an impulsive burn required to achieve an orbital period of 110 minutes. The DifferentialCorrector object provides access to the status of the targeting process, enabling you to report properties such as "Iterations" and "Iteration Mode" to the output screen.

 DifferentialCorrector DifferentialCorrector1; ImpulsiveBurn ImpulsiveBurn1;   DifferentialCorrector1.MaxIterations = 10;   Target using DifferentialCorrector1;       Iterate Spacecraft1;       Vary ImpulsiveBurn1.BurnDirection[0] = 0.1 + 0.001;       Maneuver Spacecraft1 using ImpulsiveBurn1;       Step Spacecraft1;       Achieve Spacecraft1.Period = 110 +/- 0.001;       Report DifferentialCorrector1.Iterations, DifferentialCorrector1.IterationMode, ImpulsiveBurn1.BurnDirection[0], Spacecraft1.Period; End;

Output:

 Iterations IterationMode Burn X-Component Period 0.000000000 Nominal 0.100000000 99.933751603 0.000000000 Perturbation 0.101000000 99.944445593 1.000000000 Nominal 1.041299526 113.801624904 1.000000000 Perturbation 1.042299526 113.821178065 2.000000000 Nominal 0.846874441 110.223565758 2.000000000 Perturbation 0.847874441 110.240876468 3.000000000 Nominal 0.833959560 110.000972154 3.000000000 Converged 0.833959560 110.000972154

## Example 3: Target Semi-Major Axis and Eccentricity

This 2x2 Targeting example determines the burn duration and maneuver start time that will result in a semi-major axis of 7300 km while maintaining an eccentricity of 0. Following the maneuver, the Spacecraft is propagated for 0.5 days.

 Spacecraft1.A    = 7100.0904823510; Spacecraft1.E    = 0.00094973584523096;   Spacecraft1.I    = 0.99755409493606; Spacecraft1.RAAN = 298.41050399768; Spacecraft1.W    = 112.90849010369; Spacecraft1.TA   = 290.38727083823;   Spacecraft1.AddTank("tank1", "SphericalTank"); Spacecraft1.AddThruster("thruster1"); Spacecraft1.Thrusters[0].AddTankToValve(0, Spacecraft1.Tanks[0]);   FiniteBurn FiniteBurn1;   Target;       Iterate Spacecraft1;       Vary FiniteBurn1.BurnDuration = TIMESPAN(30 seconds) + TIMESPAN(10 seconds);       Vary FiniteBurn1.ManeuverStartTime = TIMESPAN(10 seconds) + TIMESPAN(1 seconds) within ;         Maneuver Spacecraft1 using FiniteBurn1 generating "BurnFile.txt";         Achieve Spacecraft1.A = 7300 +/- 5;       Achieve Spacecraft1.E = 0 +/- 0.1;       Report FiniteBurn1.BurnDuration.ToSeconds(), FiniteBurn1.ManeuverStartTime, Spacecraft1.A, Spacecraft1.E;       Plot FiniteBurn1.BurnDuration.ToSeconds(), Spacecraft1.A, Spacecraft1.E;       Plot FiniteBurn1.ManeuverStartTime, Spacecraft1.A, Spacecraft1.E; End;

Output: Excerpt from "BurnFile.txt"

 Maneuver for spacecraft Spacecraft1   Finite maneuver start epoch:   Modified Julian: 28849.635549178   Calendar:        Jan 01 2020 03:15:11.449                    20200101 03:15:11.449   Finite maneuver end epoch:   Modified Julian: 28849.692357536   Calendar:        Jan 01 2020 04:36:59.691                    20200101 04:36:59.691   Maneuver Duration:   4908.2420900580 seconds   Premaneuver Keplerian State (ICRF):     A      7100.1790031293 km     E      0.00074475030402244       I      0.99619300838106 deg  RAAN      297.34415545127 deg    AP      108.71160088047 deg    TA      285.64750365563 deg   Postmaneuver Keplerian State (ICRF):     A      7301.2185335398 km     E      0.0066203579216475       I      0.99582346870238 deg  RAAN      296.82788286011 deg    AP      193.15669142569 deg    TA      133.77544219585 deg

## Example 4: Target using ResetTargetingLoop Command

This Mission Plan demonstrates the use of the ResetTargetingLoop command in FreeFlyer. The Target command is used to achieve a certain orbit apogee by varying the impulsive delta V, but the seed and perturbation fed into the Targeter are set too high.

If an unrealistically high delta V is attempted, FreeFlyer will reset the Targeting loop with new, lower, seeds.

 ImpulsiveBurn ImpulsiveBurn1; Variable seed = 100; Variable perturbation = 10;   Target;       Iterate Spacecraft1;       Vary ImpulsiveBurn1.BurnDirection[0] = seed + perturbation;         Maneuver Spacecraft1 using ImpulsiveBurn1;       Achieve Spacecraft1.Apogee = 8000 +/- 10;         Report ImpulsiveBurn1.BurnDirection[0], seed, perturbation, Spacecraft1.Apogee;         If (ImpulsiveBurn1.BurnDirection[0] > 1000);               // Decrease the seed and perturbation by a factor of 10             seed = seed/10;             perturbation = perturbation/10;               // Reset the Targeter with the new seed and perturbation             ResetTargetingLoop;         End; End;

Where:

 •seed is a Variable containing the seed value for ImpulsiveBurn1.BurnDirection[0] •perturbation is a Variable containing the perturbation for ImpulsiveBurn1.BurnDirection[0] •8000 is the goal value for Spacecraft1.Apogee •10 is the allowable tolerance value for Spacecraft1.Apogee

## Example 5: RuntimeSetup Targeting

In this example, a For loop is used to loop over arrays storing information about the maneuvers to apply and the values to achieve. In an operational satellite ground system, this maneuver information could be read into FreeFlyer from a database or other external data source. Impulsive burns are used to achieve a semi-major axis of 8500 km and an inclination of 35 degrees.

FreeFlyer contains two separate timing precision modes, and the Targeter behaves slightly differently in each timing precision mode. As of FreeFlyer 7.3, the default timing precision mode is nanosecond precision mode. In millisecond precision mode, the Target command keywords "with RuntimeSetup" must be used in order to call Iterate, Vary, and Achieve commands inside loops (If, While, For, etc).

 List Burns; DifferentialCorrector differentialCorrector1; TimeSpanArray eventEpochs[0]; Array eventTypes[0]; Array eventValues[0]; Variable i; Variable j;   Spacecraft1.A = 8000; Spacecraft1.I = 30;   eventEpochs = {"Jan 01 2020 00:00:00.000000000".ParseCalendarDate(),  // Maneuver                             "Jan 01 2020 04:00:00.000000000".ParseCalendarDate(),  // SMA                             "Jan 02 2020 00:00:00.000000000".ParseCalendarDate(),  // Maneuver                              "Jan 02 2020 12:00:00.000000000".ParseCalendarDate()}; // Inc   eventTypes = {-1,       // Maneuver                             1,       // SMA                           -1,       // Maneuver                             2};      // Inc   eventValues = {1,       // Maneuver                             8500,    // SMA                             2,       // Maneuver                             35};     // Inc   Target using differentialCorrector1;         Iterate Spacecraft1;       j = 0;         For i = 0 to eventEpochs.Dimension-1;                          If (eventTypes[i] == -1);                     If (differentialCorrector1.IterationMode == "Nominal" and differentialCorrector1.Iterations == 0);                         Burns.Count++;                   End;                   Burns[j].AttitudeSystem = 2;                   Burns[j].BurnDirection[0] = 0;                    If (eventValues[i] == 1);  // X direction                         Vary Burns[j].BurnDirection[0] = 0.1 + 0.01 within <-0.5, 0.5>;                   ElseIf (eventValues[i] == 2);  // Y direction                         Vary Burns[j].BurnDirection[1] = 0.1 + 0.01 within <-2, 2>;                   End;                   Step Spacecraft1 to (Spacecraft1.Epoch == eventEpochs[i]);                   Maneuver Spacecraft1 using Burns[j];                   j++;               ElseIf (eventTypes[i] == 1);                    Step Spacecraft1 to (Spacecraft1.Epoch == eventEpochs[i]);                   Achieve Spacecraft1.A = eventValues[i] +/- 1;               ElseIf (eventTypes[i] == 2);                    Step Spacecraft1 to (Spacecraft1.Epoch  == eventEpochs[i]);                   Achieve Spacecraft1.I = eventValues[i] +/- 0.1;             End;       End;       Report differentialCorrector1.IterationMode, Burns[0].BurnDirection, Burns[1].BurnDirection, Spacecraft1.A, Spacecraft1.I; End;