C# Extensions |
Top Previous Next |
The FreeFlyer Extensions SDK installation includes access to a directory of sample extensions designed to help you learn how to create and use extensions in FreeFlyer. To access the sample extensions, download the FreeFlyer Extensions SDK in your desired version (1 or 2) and bitness (32-bit or 64-bit), then navigate to the Examples folder within your general Extensions SDK directory.
To use the sample extensions, first open the solution file (FreeFlyer SDK Examples.sln) in Visual Studio 2013 or later and build the solution (or an individual example). After building, register the extension DLL using the Extensions Manager located in the Utilities folder in the SDK installation directory. If the extension is registered successfully it will appear in the list of registered FreeFlyer Extensions.
To see how the extension is used in FreeFlyer, open the Mission Plan that goes with the extension (located in the MissionPlans folder in the SDK installation directory). You can view the Extensions log to check whether the extension was loaded properly into FreeFlyer. Run the Mission Plan to see the additional functionality that the extension adds to FreeFlyer.
Jump to an extension description in the following table:
Comprehensive ExtensionThis extension demonstrates how to implement a variety of different property types and methods. It implements an interface called IComprehensiveExample in a class called ComprehensiveExample. The class contains four different property types: bool, double, int, and string. It additionally contains various methods which use these base types as well as ISpacecraft and ICelestialObject types as arguments. The ComprehensiveExtension Mission Plan checks the operation of the ComprehensiveExtension properties and methods and reports the results to the Console.
Note: The 32-bit version of this extension includes additional properties of types double[], string[], and IMatrix, as well as a few additional methods which use these types.
For more information on the topics covered by this example, see the Anatomy of an Extension and Using an Extension guides. CPPConnectThis extension illustrates how to connect a C# assembly to a C/C++ dll. The extension imports a simple C++ dll that is created by a Visual Studio C++ solution file included with the FreeFlyer Extensions SDK installation in the "Examples\SimpleCPPDll" folder. The C++ script simply reads in a 2-element input array, then outputs an array containing the product of the input array elements and their product multiplied by 10. The CPPConnectExtension Mission Plan calls the wrapped C++ method with an input array containing the values 13 and 11, and reports the results of the C++ method (143 and 1430).
For more information on the topics covered by this example, see the Anatomy of an Extension and Using an Extension guides.
Custom Force ExtensionThis extension implements an interface called IMyCustomForce. The CustomForceExtension Mission Plan turns off FreeFlyer's default Earth force in a Spacecraft's Force Model, and adds the custom force defined by the extension instead. The Mission Plan then propagates the Spacecraft for 60 days using the custom force and generates a view of the orbit in the output workspace.
Spacecraft propagated with the custom force implemented in the extension
For more information on the topics covered by this example, see the Anatomy of an Extension and Custom Force Extensions guides.
Estimable Custom Force ExtensionThis extension implements an interface called IMyCustomEstimableForce with Earth's gravitational parameter Mu set as an estimable property. The EstimableCustomForceExtension Mission Plan configures one Spacecraft named scTruth to use FreeFlyer's default Earth gravity force model, and a second Spacecraft named scExtension to use the custom force defined by the extension, then sets up a BatchLeastSquaresOD object to process scExtension and specifies Mu as an estimable property to process. The Mission Plan iterates the Batch and plots Truth vs. Estimated Mu, then propagates both Spacecraft for 3 days and plots the residuals for scExtension and the orbit separations between scTruth and scExtension in the output workspace.
Output generated by EstimableCustomForceExtension Mission Plan
Note: The ICustomForceWithEstimablePropertyExtension interface is only available in the version 2 FreeFlyer Extensions SDK.
For more information on the topics covered by this example, see the Anatomy of an Extension, Custom Force Extensions, and Custom Estimates Extensions guides.
Estimable SRP ExtensionThis extension implements an interface called IMyCustomEstimableSRPForce with the coefficient of reflectivity CustomCr set as an estimable property. The EstimableSRP Extension configures one Spacecraft named scTruth to use FreeFlyer's native SRP model, and a second Spacecraft named scExtension to use the custom SRP force defined by the extension. The Mission Plan then configures a KalmanFilterOD object to process scExtension and the estimable CustomCr property. The Kalman filter processes simulated observations over 6 days and plots the results.
Output generated by EstimableSRPExtension Mission Plan
Note: The ICustomForceWithEstimablePropertyExtension interface is only available in the version 2 FreeFlyer Extensions SDK.
For more information on the topics covered by this example, see the Anatomy of an Extension, Custom Force Extensions, and Custom Estimates Extensions guides. Simple ExtensionThis is a basic example of an extension which implements an interface called ISimpleExtension in a class named SimpleExtension. The class contains a double named MyProperty and a method called MyMethod which takes two double arrays as arguments and returns the sum of the input array values in the output array. The SimpleExtension Mission Plan creates a SimpleExtension object, reports and modifies the value of MyProperty, then calls MyMethod and reports the result to the Console.
For more information on the topics covered by this example, see the Anatomy of an Extension and Using an Extension guides.
Spinner SRPThis extension calculates a custom Solar Radiation Pressure (SRP) Force for a spin-stabilized spacecraft based on the orientation of the spin-axis in a Solar-Ecliptic reference frame. The SpinnerSRP_CustomForce Mission Plan propagates two Spacecraft from the same initial state using the custom SRP force defined in the extension. The Mission Plan takes user inputs for the right ascension and declination of the spin axes for both Spacecraft in the Solar-Ecliptic Frame, then propagates both Spacecraft for 5.5 days and plots the SRP force over time and orbit differences between the two Spacecraft.
Output generated by Mission Plan using SpinnerSRP extension
For more information on the topics covered by this example, see the Anatomy of an Extension and Custom Force Extensions guides.
|