Open-Source, Extensible Spacecraft Simulation And Modeling...

41
Andrew Turner Masters Thesis Presentation July 17th, 2003 Open-Source, Extensible Spacecraft Simulation And Modeling Environment Framework

Transcript of Open-Source, Extensible Spacecraft Simulation And Modeling...

Page 1: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Andrew TurnerMasters Thesis Presentation

July 17th, 2003

Open-Source, Extensible Spacecraft Simulation And Modeling Environment Framework

Page 2: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Introduction

Background

Purpose

Architecture Design

Software Implementation

Verification and Validation

Simulation Examples

Conclusions

Outline of Presentation

2

Page 3: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Open-SESSAME Framework

Open-Source

Extensible

Spacecraft

Simulation And Modeling

Environment

Framework

Introduction

Adapted by J. Schwartz from http://www.jenn98.com/bugs/1957-1.html3

Page 4: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Spacecraft Simulation

Software Alternatives

Project Background

Purpose

Object-Oriented Programming

Section: Background

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

4

Page 5: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Spacecraft SimulationAerospace Engineering

- Attitude dynamics

- Orbit dynamics

- Satellite environment

- Terminology

- Aerospace tools

- Typical use cases

- Satellite Community

Computer Science / Software Engineering

- Object-Oriented Design

- Computational Speed

- Networking

- Data Handling

- Extensibility

- Software development tools

- Open-Source Community

5

Page 6: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Developing attitude control algorithms

No current solution

Performs necessary tasks

Understandable and inspectable

Need to redevelop solution every time

Project Background

6

Page 7: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Software AlternativesPackage Manufacturer Benefits NegativesAutoCon NASA Goddard Heritage Not maintained, not readily availableDSHELLdshell.jpl.nasa.gov

NASA JPL Free to academic institutions Not readily available

Formation FlyingTestbed

NASA Goddard Well supported, ties in with hardware Expensive, limited availability, aimedtowards formations

FreeFlyer www.ai-solutions.com

a.i. solutions Scriptable, good user interface, her-itage, 2D/3D visualization

Expensive, limited integration with ex-isting software

MultiSatSimwww.psatellite.com

Princeton Satel-lite Systems

Good graphics, easy to use interface,scriptable

Apple hardware only, limited to 8 satel-lites, limited expandability

ORSAorsa.sourceforge.net

Open-Source multiple platforms, active development Not complete, limited functionality, or-bits only

Open-SESSAMEspace-craft.sourceforge.net

Open-Source multiple platforms, extensible, welldocumented, active development, orbitand attitude, seperate libraries

No graphical user interface, requiresknowledge of C++ programming

SATCOSwww.saic.com/space/

SAIC Heritage Orbit and constellations only

SaVisavi.sourceforge.net

Open-Source Good user interface, in development Only models orbits, made for constel-lations, single developer

SC Modelerwww.avmdynamics.com

AVM Dynamics - No longer supported

Spacecraft Con-trol Toolboxwww.psatellite.com

Princeton Satel-lite Systems

Well developed, documented MatLab only, attitude only

Satellite ToolKitwww.stk.com

AnalyticalGraphics

Easy to use, 2D/3D visualization, her-itage, large number of modules, goodsupport, external communcations, va-riety of operating systems

Expensive, not extensible, complex

Swingby Computer Sci-ences Corpora-tion

– –

WinOrbit www.sat-net.com/winorbit/

Carl Gregory,Univ. Illinois

Free of cost, graphical user interface Windows only, not extensible, user in-terface difficult

1

7

Page 8: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

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

Purpose

8

Page 9: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Objects = Classes

Encapsulate Physical Objects

Abstract Functionality

Data-Hiding

UML Diagram

Object-Oriented Design

Composition

Inheritance

Object-Oriented Programming

9

Page 10: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Software Architecture

Component Libraries

Building an Application

Section: Architecture Design

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

10

Page 11: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Architecture Design

Rotation Library

Attitude Library Orbit Library

Dynamics Library

Environment Library

Data Handling

Collections of libraries

Interchangeable components

Application framework

‘Assemble’ to build an application

Suggested Architecture

Reconfigurable

Communications

11

Page 12: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Rotation Class

Abstract

Conversion Routines

Stored as a Quaternion

Rotation Library

Rotation-Quaternion+SetDCM+SetEulerAngles+SetEulerAxisAngle+SetMRP+SetQuaternion+GetDCM+GetEulerAxisAngle+GetMRP+GetQuaternion

Quaternion

ModifiedRodriguezParameters

DirectionCosineMatrix

Vector

Matrix

1

Other Representations

12

Page 13: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Attitude Library

Attitude AttitudeState

Rotation

AttitudeFrame

1

1

1..n Vector

AngularVelocity1

odeFunctor

QuaternionAngularVelocity

Any Kinematic or Kinetic EOM

ModifiedRodriguezAngularMomentum

Kinematic & Kinetic Equations of Motion

*

AttitudeState

Composition

Rotation, Frame, AngVel

Attitude

Larger composition

AttitudeState

Kinematics & Dynamics

History

13

Page 14: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Orbit Library Orbit

OrbitState

OrbitState-Representation OrbitFrame

PositionVelocity

Keplerian

Delauney

Poincaré OrbitFramePQW

OrbitFrameECEF

OrbitFrameIJK

OrbitFrameRSW

1 1

1..n

Other State Representations Other OrbitFrames

OrbitState

Local Composite

OrbitStateRep

OrbitFrame

Orbit

Larger Composite

Dynamics

History

14

Page 15: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Dynamics Library

Propagator

NumericPropagator

Combined-NumericPropagator

AnalyticPropagator

EnkeCombined-NumericPropagator

AnalyticPropagator Schemes

Other Numeric Propagators

Propagator

Abstract interface

Types of propagators

Numeric

Analytic

15

Page 16: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Environment LibraryEnvironment

EarthCentralBody

CentralBody EnvFunction

TwoBodyGravity

SimpleAeroDrag

SimpleSolarRadiationPressure

GravityGradient

AerodynamicTorque

MagneticDipole

Force Environmental Disturbance Functions

Torque Environmental Disturbance Functions

1 0,1..n

MoonCentralBody

MarsCentralBody

ComplexAeroDrag

Other Environment Force Functions

J2GravityModel

ComplexMagneticDipole

Other Environment Torque Functions

ComplexGravityGradient

Other CentralBodies

Environment

Composition and interface

CentralBody

Physical parameters

Defines frames

Location with respect to other celestial bodies

EnvFunctions

Interface to force and torque functions

Parameters: time, orbit state, attitude state 16

Page 17: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Data Handling Utilities

History

AttitudeState OrbitState

AttitudeHistory OrbitHistory

ssfTime0,1..n

0,1..n 0,1..n

Other History Collections

ControlHistory(Torque / Force)

ControlState Applicable Data or State

0,1..n 0,1..n

History

Vectors of data

Associated with times

Interpolation

Data Conversion

17

Page 18: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Math Library

Integrator

RungeKuttaIntegrator

AdamsBashforthIntegrator

Interpolator

LinearInterpolator

CubicSplineInterpolator

NaturalCubicSplineInterpolator

FixedStep Integrator

VariableStepIntegrator

Other Interpolators

Other VariableStep Integrators

Other FixedStep Integrators

Numerical Integration

Fixed step

Variable step

Data Interpolation

18

Page 19: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Keplerian

MatLabSTK Export

XML Export

MarsCBMoonCB

OrbitState

Attitude

Rotation Quaternion

Vector

AttitudeState

Orbit

Propagator Environment

EarthCB

EnvFunction

HistoryConverter CentralBody

OrbitRep

OrbitFrame

AttitudeHistory

OrbitHistory

Position Velocity

AttitudeFrame

Attitude Dynamics

Orbit Dynamics

Integrator

Runge-Kutta Integrator

Runge-Kutta Fehlberg

Interpolator

LinearInterpolator

CubicSpline Interpolator

A

A

0..n

B

0,1,2

B

Open-SESSAME Application

2. Add Dynamic Components

1. Choose Equations of Motion

3. Choose Orbit Characteristics

4. Choose Attitude Characteristics

5. Add Environment Effects

6. Add History

7. Choose Interpolators

8. Simulate!

19

Page 20: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Software Implementation

Code Metrics

Implementation Artifacts

Documentation

Section: Software Implementation

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

20

Page 21: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

C++ software language

Open-source libraries and toolkits

Matrix

Network Communications

Documentation

Verbose coding

Doxygen

Software Implementation

21

Page 22: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Lines of code: 4810

Lines of documentation: 8112

Number of classes: 44

Functions: 498

Avg executable size: ~4 MB

Code Metrics

Library Size

Attitude 335k

Data Handling 749k

Dynamics 697k

Environment 518k

Math 430k

Matrix 1.88M

Orbit 658k

Rotation 255k

Utils 223k

22

Page 23: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Framework bundle

9 libraries

Source code

Example applications

Documentation

User’s Manual

Master’s Thesis

Conference paper

Public repository

Forums, documentation, Source (CVS)

Implementation Artifacts

23

Page 24: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Doxygen

Automatic document generation

Produces html, xml, latex (pdf)

Includes equations

Verbose coding

‘Hungarian Notation’

Inline comments

Cite references

Programming primer

Documentation

24

Page 25: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Verification

Purpose

Methods

Results

Validation

Purpose

Methods

Results

Section: Verification and Validation

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

25

Page 26: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Show that the software is implemented correctly - Verify

Computational results from software match analytical analysis

Output is compared to alternative, industry accepted, solutions

Verification

26

Page 27: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Orbit Verification

ri0 [1131.34,−2282.343, 6672.423]T km

vi0 [−5.64305, 4.30333, 2.42879]T km/st 2400 sec

Integrator RK-4(5), tol: 10× 10−9

OutputRunning Time 0.59 sec

riKep(t) [−4219.853, 4363.116,−3958.789]T km

viKep(t) [3.689736,−1.91662,−6.112528]T km/s

riSim(t) [−4219.752, 4363.029,−3958.766]T km

viSim(t) [3.689865,−1.916734,−6.112511]T km/s

RMS error ∆rRMS = 3.1493× 10−5

∆vRMS = 6.95115× 10−5

1

Conservation of Angular Momentum

Keplerian Equation

27

Page 28: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Closed-Form Attitude Solution

Euler’s Equations:

Closed-form solution:

Assume: axisymmetric

3

1

2

28

Page 29: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Attitude Verification

29

Page 30: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

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?

Validation

30

Page 31: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Attitude Integration

Orbit Integration

Coupled Simulation

Hardware-in-the-loop

HokieSat Orbit/Attitude Coupled Simulation Server

HOACSS

Section: Simulation Examples

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

31

Page 32: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Attitude Integration

Attitude

Rotation Quaternion

VectorAttitudeState

EnvFunction

HistoryConverter

AttitudeHistory

AttitudeFrame

Attitude Dynamics

Runge-Kutta Integrator

CubicSpline Interpolator

1. Code the attitude dynamics equation2. Code the disturbance torque function3. Assign function parameters4. Create an initial attitude state5. Create and initialize integrator6. Integrate the equations7. Graph or output the state history

32

Page 33: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Gnuplot

Save/Export

Dynamics display

Attitude Simulation Output

Time (s)

Qua

tern

ion

33

Page 34: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Orbit Simulation Output

x (km) y (km

)

z (k

m)

34

Similar application construction

Output orbit position

Page 35: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Hardware-in-the-Loop

GPS SensorStub

Flight Software

Orbit Determination

Attitude DeterminationAttitude Control Orbit Control

Thrusters SensorStub

Torquers SensorStub

RateGyro SensorStub

Magnetometer SensorStub

Open-SESSAME Communications Layer

AppliedTorques

PositionVelocity

AppliedForces

B-FieldAngularVelocity

Open-SESSAME Application Server

Propagator and History

35

Page 36: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

HokieSat SimulationAttitude PlotOrbit Plot

36

Page 37: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

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

Multiple extension points for added functionality

Integrate software into curriculum

Publish use cases and include in lab activities

Increase connectivity with other programs

Optimize operation

Conclusions

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusions

37

Page 38: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Space Systems Simulation Laboratory

Jana Schwartz

Dr. Christopher Hall

Sourceforge.net

ION-F & HokieSat

Thank you

Virginia Tech Department of Aerospace & Ocean Engineering

38

Page 39: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Questions?

IntroductionBackgroundArchitecture DesignSoftware ImplementationVerification and ValidationSimulation ExamplesConclusionsQuestions

Page 40: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

Accumulation of ErrorHigh Eccentricity Error

Altitude (km)

Posi

tion

Erro

r (k

m)

Page 41: Open-Source, Extensible Spacecraft Simulation And Modeling ...spacecraft.sourceforge.net/presentations/Turner_MastersThesis... · Andrew Turner Masters Thesis Presentation July 17th,

High Eccentricity

Parameter Value

Initial Orbit State r0 =[7500 0 0

]T

v0 =[0 6.819333903 6.819333903

]T

Disturbances Two-Body GravityIntegrator Runge-Kutta-Fehlberg 4(5)Simulation Time 20 days

Output O-SESSAME STK FreeFlyer

Final Orbit State

−46724.94751−8276.177337−8276.1773371.339061791−0.85741544−0.85741544

−46727.35881−8275.048124−8275.048124

1.338824−0.857447−0.857447

−46713.96349−8283.620519−8283.6205191.340490327−0.857151194−0.857151194

Running Time 15 sec 4 sec 48 secRMS Error - 2.72× 10−4 1.73× 10−3

1