Aerospace Simulations in C++

C.1 Introduction

The simulation examples of this book are provided on the CADAC CD-ROM in FORTRAN. This computer language has had a long and illustrious tradition in the engineering sciences. I did all coding starting in the mid 1960s in FORTRAN II, IV, and 77, until the year 2000, when a cadet from the U. S. Air Force Academy convinced me to give C++ a try. After some exploration I set out to upgrade CADAC to C++. It is not a straight conversion, but rather a complete re-write of the executive, modules, and utility functions, taking full advantage of the language’s polymorphism, inheritance, and encapsulation.

Today, CADAC++ as it is called is a mature trajectory simulation in ANSI/ISO 1998 C++. While teaching graduate courses at the University of Florida in modeling and simulation (M&S), I developed three self-study CD-ROMs that complement this textbook with C++ simulations. The first one, entitled “Building Aerospace Simulations in C++,”1 focuses on the architecture of the simulation framework, and uses simple cruise missile and satellite models to illustrate the interplay be­tween the executive and vehicle functions. The second CD lays the foundation for high fidelity simulations and is entitled "Fundamentals of Six Degrees of Freedom Aerospace Simulation and Analysis in FORTRAN and C++."2 As the title implies it juxtaposes FORTRAN with C++ by dealing with missile and aircraft simulations side by side. At the advanced level, the third CD, entitled “Advance Six Degrees of Freedom Aerospace Simulation and Analysis in C++.”3 treats some of the most dif­ficult topics of aerospace vehicle components like modeling of the elliptical Earth, inertial navigation systems, Kalman filters, global positioning systems (GPS), star trackers, and endo – and exo-atmospheric guidance laws. These three progressively more challenging CDs, this textbook, the CADAC Studio plotting programs, and the solutions manual,4 constitute a complete set of instructions for aerospace ve­hicle modeling and simulation. A more detailed description of each CD follows, with particular emphasis on their computer simulations.

C.2 C++ Architecture and Three-DoF Cruise Missile Simulation

The first CD, “Building Aerospace Simulations in C++,” introduces the appli­cation of C++. It assumes that you have taken a C++ language course and have a good understanding of Chapter 8, “Three-Degrees-of-Freedom Simulation." The lesson plan of the 16 labs is given in Table C. l. The labs are grouped into five training units, of which numbers 2-5 lead to four simulations: satellite, target on the ground, cruise missile, and short-range air-to-air missile. The SRAAM6 is a teaser of things to come. It models a missile/target engagement in six DoF without providing much detail. It is left to CD no. 2 to pick up the story from there with more elaborate discussions.

Table C. l Lesson plan of CD-ROM no. 1 “Building Aerospace Simulations in C++”

Training modules

Lab no.

Training units

1 Introduction

1

Welcome; C++ Overview

2 Satellite3

2

Satellite3 Simulation

3

Rocket Propulsion; Class: Variable

4

Apparent Forces; Output

3 Target3

5

Integration; Input

4 Cruise3

6

Aero; Tables; Cruise3 Simulation

7

Turbojet; Polymorphism

8

Autopilot; Overloading Operators

9

Plotting; CADAC Studio

10

Environment; Event Scheduling

11

Line Guidance; Multiple Objects

12

Intercept; Communication Bus

13

Terminal Guidance; Subscribing

14

Engagements; Satellite Targeting

15

Global Engagements; Cruise3S Sim

5 SRAAM6

16

Six-DoF Equations; SRAAM6 Sim

Each lab discusses an aerospace vehicle component and combines it with a particular C++ feature. The topics become progressively more difficult as the simulations are combined to grow to a full engagement model with cruise missiles attacking ground targets, guided by overhead satellites.

More detail is provided in Table C.2 with references to the sections of this book. To build up to the satellite simulation in Lab 3 we need to cover only two modules: “newton” and “propulsion.” The simulation is called Satellite3 and models a satellite orbiting the Earth with optional rocket propulsion to change its orbital parameters. The equations of motion are based on Newton’s law expressed in inertial coordinates.

In Labs 4 and 5 a simulation is built for targets moving on the surface of the Earth, which is called Target3. Here we are especially challenged by having to include Coriolis and centrifugal accelerations to the equations of motions for the vehicles to hug the surface.

The remaining labs, 5-14, build toward the three-DoF cruise missile simulation Cruise3. Such modules like aerodynamics, turbojet propulsion, guidance, control, and seekers are added to create a complete vehicle.

Finally, in Lab 15 all three types of vehicle objects are combined to build the engagement simulation Cruise3S, which consists of cruise missiles flying toward multiple targets while monitored by overhead satellites. The trajectories of these engagements can be displayed by the plot programs of CADAC Studio from the CADAC CD.

C.3 High Fidelity Missile and Aircraft Simulations

The second CD, “Fundamentals of Six Degrees of Freedom Aerospace Simu­lation and Analysis in FORTRAN and C++,” introduces high fidelity missile and

Table C.2 Simulation and language features of CD-ROM no. 1

Lab

Theme

Simulation feature

C++ Feature

Book

1

Introduction

3 DoF Overview

C++ Overview

Chap. 8

2

Satellite

Module “Newton”

Statements

Arrays

Sec. 8.1.1

3

Satellite with propulsion

Rocket propulsion

Class “Variable” Inheritance

Sec. 8.2.4

4

Ground targets

Module “force”

Output to screen and to files

Sec. 5.3.1

5

Multiple ground targets

Integration Module utility fcts.

Input from file

Sec. 3.2.2

6

Missiles

Module

Structure “Table”

Chap. 8

Aerodynamics

“aerodynamics”

Overloading

Sec. 8.2.3

7

Turbojet

propulsion

Module

“propulsion”

Polymorphism

Sec. 8.2.4.2

8

Autopilot

Module “control”

Matrix utilities

Operator

overloading

Sec. 9.2.3

9

Plotting

CADAC Studio

Output plotting

10

Events

Environment

Flight phases

Module

“environment”

Class “Event”

Sec. 8.2.1 Sec. 8.2.2

11

Missiles and targets

Line guidance

Multiple objects Polymorphism

Sec. 9.2.4.3

12

Communication

Terminal miss

Communication

bus

Prob. 2.9

13

Terminal homing

Module “seeker” Module “guidance”

Subscribing of variables

Sec. 9.2.5 Sec. 9.2.4

14

Multiple

engagements

Module “targeting” Overhead satellites

Structure

“Targeting”

15

Global

engagements

Missiles, targets, and satellites

Satellite object

16

Air-to-air

engagements

Six-DoF

Simulation

Equations of motion

Chap. 10

aircraft simulations in C++. It does this from a FORTRAN vantage point, based on simulations from the CADAC CD. The FORTRAN modules are converted to C++ and incorporated into the CADAC++ architecture of CD no. 1. A particular appeal of CD no. 2 is the dual language track. You can work either in FORTRAN, C++ or both.

Table C.3 provides an overview. Five training modules encompass 13 labs. As you can see, the emphasis is on modeling the components of aerospace vehicles. Because this CD focuses on aircraft and missiles, the Earth can be assumed to be quasiflat, as discussed in Sec. 3.2.2.7, and it can serve as an inertial reference frame. The individual training units have similar titles as those of CD no. 1, but are more elaborate, because of their high fidelity, six-DoF characteristics.

Table C.3 Lesson plan of CD-ROM no. 2 “Fundamentals of Six Degrees of Freedom Aerospace Simulation and Analysis in FORTRAN and C++”

Training modules

Lab no.

Training units

1 Overview

1

Concepts in Modeling and Simulation

2

Primer of FORTRAN and C++ Simulations

2 Dynamics

3

Matrices, Vectors, and Tensors

4

Coordinate Systems

5

Kinematics

6

Equations of Motion; Numerical Integration

3 Aerodynamics & Propulsion

7

Aerodynamics; Table Look-up

8

Propulsion & Actuators

4 Guidance & Control

9

Autopilot

10

Seeker

11

Guidance

5 Performance

12

Performance Analysis

13

Summary

Simulations

Air-to-Air Missile in FORTRAN Air-to-Air Missile in C++

FI6 Aircraft in FORTRAN F16 Aircraft in C++

The detailed simulation buildup is shown in Table C.4. Both the air intercept missile (AIM) and the Falcon aircraft (FI6) are modeled in FORTRAN (FTN) and in C++. To jump-start your involvement, the primer of Lab 2 helps you, without going into details, to execute and plot the complete missile simulation in FORTRAN and C++. In Lab 3 the computational methods are discussed. Though up to this point the missile is used as illustration, the aircraft follows similar patterns. However, starting with coordinate systems in Lab 4, the aircraft requires separate treatment from the missile. As you proceed, you focus on one module at a time, skipping the nonexistent aircraft seeker module. Eventually in Lab 12 you evaluate the performance of the complete missile and aircraft using the final simulations. In a separate folder you are given the beginning simulations, code additions, and the final completed simulations.

This self-study course touches on all major elements of missile and aircraft sim­ulations in a FORTRAN and C++ environment. Because of the modular structure, you can expand and tailor the simulations to your own needs. If you want to model a cruise missile or unmanned air vehicle you would start with the FI6 simulation and import the seeker module from the missile simulation. You need not worry about violating copyright laws. All source code on the CDs is in the public domain; only the accompanying training charts are restricted by AIAA copyright.

Though this CD is complete in itself, it only deals with the fundamentals of six-DoF simulations. Advanced subjects, like elliptical Earth, inertial navigation systems, GPS, Kalman filters, and exo-atmospheric guidance are reserved for the third CD. Yet, you should first master the fundamentals before approaching these advanced subjects.

Table C.4 Creating aircraft and missile simulations in FORTRAN and C++

of CD-ROM no. 2

Simulations

Training

Aim Missile

F16 Aircraft

Lab no.

Training units

FTN

C++

FTN

C++

modules

Startup

1 Overview

1

Introduction: Concepts in Modeling and Simulation

2

Primer

AIMF02

AIMC02

2 Dynamics

3

Matrices, Vectors, and Tensors

AIMF03

AIMC03

4

Coordinate

Systems

AIMF04

AIMC04

F16F04

F16C04

5

Kinematics

AIMF05

AIMC05

F16F05

F16C05

6

Equations of Motion; Numerical Integration

AIMF06

AIMC06

F16F06

F16C06

3 Aerodynamics & Propulsion

7

Aerodynamics

AIMF07

AIMC07

F16F07

F16C07

8

Propulsion & Actuators

AIMF08

AIMC08

F16F08

F16C08

4 Guidance

9

Autopilot

AIMF09

AIMC09

F16F09

F16C09

& Control

10

Seeker

AIMF10

AIMC10

11

Guidance

AIMF11

AIMC11

F16F11

F16C11

5 Performance

12

Performance

Analysis

AIMF12

AIMC12

F16F12

F16C12

13

Summary

Simulations

Begin Sims

AIMF#

AIMC#

F16F#

F16C#

Code Results

AIMF%

AIMC%

F16F%

F16C%

Final Sims

AIMFS

AIMCS

F16F$

F16C$

C.4 Advanced Components of Ascent Vehicles

The third CD, “Advanced Six Degrees of Freedom Aerospace Simulation and Analysis in C++,” presents advanced topics and assumes that you already have a good working knowledge of aerospace simulations, commensurate with CDs 1 and 2. It uses as a prototype a three-stage ascent vehicle, composed of a hypersonic air breather, exo-atmospheric transfer vehicle, and terminal interceptor.

Table C.5 outlines the 12 labs divided into seven training modules. Each lab consists of a training unit that introduces the subject and hands-on exercises using a self-contained simulation. There are 16 simulations, starting with simple or­bital trajectories over the elliptical Earth; a hypersonic vehicle with aerodynamics, propulsion, flight controller, inertial navigation, GPS and star tracker; a trans­fer vehicle; and finally an interceptor. Together they produce the full-up HYPER

Table C.5 Creating a three-stage ascent vehicle simulation with CD-ROM no. 3 “Advanced Six Degrees of Freedom Aerospace Simulation and Analysis in C++”

Training modules

Lab no.

Training units

Hands-on

Simulation

1 Overview

1

2

Introduction; C++ Essentials CADAC Primer; Architecture Paper

HYPER

Slide Show

2 Elliptical Earth

3

Translational Equations

HandsOn03

HYPER03

4

Attitude Equations

HandsOn04

HYPER04

3 Hypersonic

5

Aerodynamics

HandsOn05

HYPER05

Vehicle

6

Propulsion & Actuators

HandsOn06

HYPER06

7

Flight Control

HandsOn07

HYPER07

8

Monte Carlo & Turbulence

HandsOn08

HYPER08

9

Inertial Navigation

HandsOn09

HYPER09

10

Endo-Guidance

HandsOnlO

HYPER10

11

Global Positioning System

HandsOnl 1

HYPER 11

12

Kalman Filter

HandsOnl2

HYPER 12

13

Star Tracker

HandsOnl 3

HYPER 13

4 Transfer Vehicle

14

Reaction Control

HandsOnl4

HYPER 14

15

Orbit Insertion

HandsOnl 5

HYPER 15

5 Aux Vehicles

16

Satellite & Radar

HandsOnl 6

HYPER 16

6 Interceptor

17

Rendezvous

HandsOnl7

HYPER 17

18

Intercept with Seeker

HandsOnl8

HYPER 18

7 Performance

19

End-to-End Analysis

HandsOnl 9

HYPER

20

Summary

simulation, which consists of three objects: ascent vehicle, satellite, and ground radar. All of them interact with each other and can be multiply instantiated.

The course starts with a review of C++ features and an in-depth discussion of the CADAC architecture. Then, at once, you will execute the complete HYPER simulation in a typical scenario. This should motivate you for the arduous task of building up to the HYPER simulation in 16 labs until in Lab 19 you conduct a complete end-to-end analysis.

Modeling and simulation can only be learned by doing. It requires a great investment of time and resources. The top experts in industry, academia, and government have made mastery of this subject a life-long quest. They combine a broad system engineering knowledge with mathematical modeling skills and computer savvy. Often they are the highest paid, nonsupervisory engineers.

To achieve this expertise in aerospace simulations you should build on a multidis­cipline college education in mathematics, flight mechanics, aerodynamics, propul­sion, and guidance and control, followed by hands-on training with prototype simulations. Having taught M&S courses for many years, I distilled them into these three CDs. They combine instructions and experimentation with a host of typical aerospace simulations. Everything you need is provided, you only supply the compiler. The one thing I cannot provide is the motivation it takes to plow through the material. That only can come from your commitment to and fondness for aerospace engineering.

References

‘Zipfel, P. H., “Building Aerospace Simulations in C++,” AIAA Self Study Series CD – ROM, 2003.

2Zipfel, P. H., “Fundamentals of Six Degrees of Freedom Aerospace Simulation and Analysis in FORTRAN and C++,” AIAA Self Study Series CD-ROM, 2004.

’Zipfel, P. H., “Advanced Six Degrees of Freedom Aerospace Simulation and Analysis in C++,” AIAA Self Study Series CD-ROM, 2005.

4Zipfel, P. H., “Solution Manual for Modeling and Simulation of Aerospace Vehicles,” AIAA 2000 (instructors can request a free copy from AIAA).

Appendix D