Open-Source, Extensible Spacecraft Simulation And Modeling Environment Framework

Andrew Turner Masters Thesis Presentation July 17th, 2003 Outline of Presentation

Introduction Background Purpose Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions

2 Introduction

Open-SESSAME Framework

Open-Source

Extensible

Spacecraft

Simulation And Modeling

Environment

Framework

Adapted by J. Schwartz from http://www.jenn98.com/bugs/1957-1.html 3 Section: Background

Spacecraft Simulation Software Alternatives Project Background Purpose Object-Oriented Programming Introduction Background Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions 4 Spacecraft Simulation Aerospace Engineering Computer Science / Software Engineering - Attitude dynamics - Object-Oriented Design - Orbit dynamics - Computational Speed - environment - Networking - Terminology - Data Handling - Aerospace tools - Extensibility - Typical use cases - Software development tools - Satellite Community - Open-Source Community

5 Project Background

Developing attitude control algorithms No current solution Performs necessary tasks Understandable and inspectable Need to redevelop solution every time

6 Software Alternatives

Package Manufacturer Benefits Negatives AutoCon NASA Goddard Heritage Not maintained, not readily available DSHELL NASA JPL Free to academic institutions Not readily available dshell.jpl..gov Formation Flying NASA Goddard Well supported, ties in with hardware Expensive, limited availability, aimed Testbed towards formations FreeFlyer www.ai- a.i. solutions Scriptable, good user interface, her- Expensive, limited integration with ex- solutions.com itage, 2D/3D visualization isting software MultiSatSim Princeton Satel- Good graphics, easy to use interface, Apple hardware only, limited to 8 satel- www.psatellite.com lite Systems scriptable lites, limited expandability ORSA Open-Source multiple platforms, active development Not complete, limited functionality, or- orsa.sourceforge.net bits only Open-SESSAME Open-Source multiple platforms, extensible, well No graphical user interface, requires space- documented, active development, orbit knowledge of ++ programming craft.sourceforge.net and attitude, seperate libraries SATCOS SAIC Heritage Orbit and constellations only 1 www.saic.com/space/ SaVi Open-Source Good user interface, in development Only models orbits, made for constel- savi.sourceforge.net lations, single developer SC Modeler AVM Dynamics - No longer supported www.avmdynamics.com Spacecraft Con- Princeton Satel- Well developed, documented MatLab only, attitude only trol Toolbox lite Systems www.psatellite.com Satellite ToolKit Analytical Easy to use, 2D/3D visualization, her- Expensive, not extensible, complex www.stk.com Graphics itage, large number of modules, good support, external communcations, va- riety of operating systems Swingby Computer Sci- – – ences Corpora- tion WinOrbit www.sat- Carl Gregory, Free of cost, graphical user interface Windows only, not extensible, user in- net.com/winorbit/ Univ. Illinois terface difficult 7 Purpose Provide a useful spacecraft simulation modeling tool to engineers Complement existing engineering tools Include underdeveloped methodologies Allow for infinite extensibility Educate students and other users how to design and implement simulation in software Readable and useful documentation and software Logical architecture design Develop an open-source framework that can be maintained and extended longer than the original project’s lifetime Host on a public repository and include developers in the community Foster communication between developers and users 8 Object-Oriented Programming Objects = Classes

Encapsulate Physical Objects

Abstract Functionality

Data-Hiding

UML Diagram

Object-Oriented Design

Composition

Inheritance

9 Section: Architecture Design

Software Architecture Component Libraries Building an Application

Introduction Background Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions 10 Architecture Design Collections of libraries Dynamics Library Interchangeable components

Application framework

‘Assemble’ to build an application Attitude Library Orbit Library

Suggested Architecture

Reconfigurable Rotation Library Environment Library

Communications Data Handling

11 Rotation Library

Rotation Class Rotation DirectionCosine -Quaternion Matrix Abstract Matrix +SetDCM +SetEulerAngles Conversion Routines +SetEulerAxisAngle +SetMRP 1 Quaternion +SetQuaternion Stored as a Quaternion +GetDCM +GetEulerAxisAngle Vector +GetMRP ModifiedRodriguez +GetQuaternion Parameters

Other Representations

12 Attitude Library

AttitudeState

odeFunctor * AttitudeFrame Composition

1 Rotation, Frame, AngVel 1..n Vector Attitude AttitudeState 1 AngularVelocity Attitude Quaternion AngularVelocity 1 Larger composition

ModifiedRodriguez Rotation AngularMomentum AttitudeState

Any Kinematic or Kinematics & Dynamics Kinetic EOM History Kinematic & Kinetic Equations of Motion

13 Orbit Library Orbit 1..n

OrbitState OrbitState

Local Composite 1 1 OrbitState- OrbitFrame OrbitStateRep Representation

OrbitFrame PositionVelocity OrbitFrameECEF Orbit

Poincaré OrbitFramePQW Larger Composite

Keplerian OrbitFrameIJK Dynamics

History Delauney OrbitFrameRSW

Other State Other OrbitFrames Representations

14 Dynamics Library

Propagator

Propagator Abstract interface

Types of propagators

Numeric NumericPropagator AnalyticPropagator Analytic

Combined- EnkeCombined- AnalyticPropagator NumericPropagator NumericPropagator Schemes

Other Numeric Propagators 15 Environment Environment Library 1 0,1..n

CentralBody EnvFunction Environment

Composition and interface EarthCentralBody TwoBodyGravity GravityGradient CentralBody SimpleAeroDrag MagneticDipole MoonCentralBody Physical parameters SimpleSolar Aerodynamic RadiationPressure Torque MarsCentralBody Defines frames

Force Environmental Torque Environmental Disturbance Functions Disturbance Functions Location with respect to other celestial Other CentralBodies Complex bodies J2GravityModel GravityGradient EnvFunctions ComplexAeroDrag Complex MagneticDipole Interface to force and torque functions Other Environment Other Environment Force Functions Torque Functions Parameters: time, orbit state, attitude state 16 Data Handling Utilities

History

Vectors of data 0,1..n History ssfTime Associated with times

Interpolation ControlHistory Other History AttitudeHistory OrbitHistory (Torque / Force) Collections Data Conversion

0,1..n 0,1..n 0,1..n 0,1..n Applicable Data AttitudeState OrbitState ControlState or State

17 Math Library

Numerical Integration Integrator Interpolator Fixed step

Variable step FixedStep VariableStep Linear Integrator Integrator Interpolator Data Interpolation CubicSpline RungeKutta AdamsBashforth Interpolator Integrator Integrator

NaturalCubicSpline Interpolator Other FixedStep Other VariableStep Integrators Integrators

Other Interpolators

18 Linear CubicSpline AttitudeFrame Vector Open-SESSAME Interpolator Interpolator

Rotation Quaternion Application 0..n Interpolator

A 1. Choose Equations of Motion AttitudeState MarsCB MoonCB 2. Add Dynamic Components AttitudeHistory Attitude EarthCB

MatLab Attitude 3. Choose Orbit Characteristics STK Export A Dynamics XML Export 4. Choose Attitude Characteristics Converter History Propagator Environment CentralBody Orbit B 5. Add Environment Effects Dynamics OrbitHistory Orbit EnvFunction 6. Add History

B OrbitState 7. Choose Interpolators Keplerian 0,1,2 Integrator Position OrbitRep 8. Simulate! Velocity

Runge-Kutta Runge-Kutta OrbitFrame Fehlberg Integrator 19 Section: Software Implementation

Software Implementation Code Metrics Implementation Artifacts Documentation

Introduction Background Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions 20 Software Implementation

C++ software language Open-source libraries and toolkits Matrix Network Communications Documentation Verbose coding Doxygen

21 Code Metrics

Lines of code: 4810 Library Size Lines of documentation: 8112 Attitude 335k Data Handling 749k Number of classes: 44 Dynamics 697k Functions: 498 Environment 518k Avg executable size: ~4 MB Math 430k Matrix 1.88M Orbit 658k Rotation 255k Utils 223k

22 Implementation Artifacts

Framework bundle 9 libraries Source code Example applications Documentation User’s Manual Master’s Thesis Conference paper Public repository Forums, documentation, Source (CVS) 23 Documentation

Doxygen Automatic document generation Produces html, xml, latex (pdf) Includes equations Verbose coding ‘Hungarian Notation’ Inline comments Cite references Programming primer

24 Section: Verification and Validation

Verification Purpose Methods Results Validation Introduction Purpose Background Methods Architecture Design Software Implementation Results Verification and Validation Simulation Examples Conclusions 25 Verification

Show that the software is implemented correctly - Verify Computational results from software match analytical analysis Output is compared to alternative, industry accepted, solutions

26 Orbit Verification Conservation of Angular Momentum

ri [1131.34, 2282.343, 6672.423]T km 0 − Keplerian Equation vi [ 5.64305, 4.30333, 2.42879]T km/s 0 − t 2400 sec Integrator RK-4(5), tol: 10 10 9 × − Output Running Time 0.59 sec i T rKep(t) [ 4219.853, 4363.116, 3958.789] km i − − T vKep(t) [3.689736, 1.91662, 6.112528] km/s i − − T rSim(t) [ 4219.752, 4363.029, 3958.766] km i − − T vSim(t) [3.689865, 1.916734, 6.112511] km/s − − 5 RMS error ∆rRMS = 3.1493 10− × 5 ∆vRMS = 6.95115 10− × 27

1 Closed-Form Attitude Solution

3

Euler’s Equations:

2 Assume: axisymmetric 1

Closed-form solution:

28 Attitude Verification

29 Validation

Show that the correct software is implemented - Validate Does the code meet requirements of use? Does the implementation improve upon existing solutions? Can the software easily demonstrate its purpose?

30 Section: Simulation Examples

Attitude Integration Orbit Integration Coupled Simulation Hardware-in-the-loop HokieSat Orbit/Attitude Coupled Simulation Server Introduction Background HOACSS Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions 31 1. Code the attitude dynamics equation Attitude Integration 2. Code the disturbance torque function 3. Assign function parameters

4. Create an initial attitude state AttitudeFrame Rotation Quaternion 5. Create and initialize integrator 6. Integrate the equations AttitudeState Vector 7. Graph or output the state history

AttitudeHistory Attitude

Runge-Kutta Converter History Integrator

CubicSpline Attitude EnvFunction Interpolator Dynamics 32 Attitude Simulation Output

Gnuplot

Save/Export

Dynamics display Quaternion

Time (s) 33 Orbit Simulation Output

Similar application construction

Output orbit position z (km)

x (km) y (km) 34 Hardware-in-the-Loop

Flight Software

Attitude Orbit Attitude Control Orbit Control Determination Determination

Torquers RateGyro GPS Thrusters SensorStub SensorStub SensorStub SensorStub

Magnetometer Applied Applied SensorStub Position Torques Forces Angular Velocity Velocity B-Field

Open-SESSAME Communications Layer

Open-SESSAME Propagator and Application Server History 35 HokieSat Simulation Orbit Plot Attitude Plot

36 Conclusions

No prior solution for configurable, extensible, coupled spacecraft simulation Open-SESSAME fulfills goals and requirements Speed and accuracy comparable to commercial packages Used to ease development and testing of HokieSat flight code Future Introduction Background Multiple extension points for added functionality Architecture Design Integrate software into curriculum Software Implementation Verification and Validation Publish use cases and include in lab activities Simulation Examples Increase connectivity with other programs Conclusions Optimize operation 37 Thank you Space Systems Simulation Laboratory

Jana Schwartz

Dr. Christopher Hall Virginia Tech Department of Aerospace & Ocean Engineering Sourceforge.net

ION-F & HokieSat

38 Questions?

Introduction Background Architecture Design Software Implementation Verification and Validation Simulation Examples Conclusions Questions Accumulation of Error

High Eccentricity Error r (km) o r sition Er o P

Altitude (km) High Eccentricity

Parameter Value T Initial Orbit State r0 = 7500 0 0 T v0 = 0 6.819333903! 6.819333903" Disturbances Two-Body Gravity ! " Integrator Runge-Kutta-Fehlberg 4(5) Simulation Time 20 days Output O-SESSAME STK FreeFlyer 46724.94751 46727.35881 46713.96349 − − − 8276.177337 8275.048124 8283.620519 − − −  8276.177337  8275.048124  8283.620519 Final Orbit State − − −  1.339061791   1.338824   1.340490327         0.85741544   0.857447   0.857151194  −   −  −   0.85741544   0.857447   0.857151194  −   −  −  Running Time  15 sec   4 sec   48 sec  RMS Error - 2.72 10 4 1.73 10 3 × − × −

1