Professional Documents
Culture Documents
An Open-Source Simulation Environment in C++: Peter Zipfel, PH.D., University of Florida
An Open-Source Simulation Environment in C++: Peter Zipfel, PH.D., University of Florida
in C++
MaSTech © 2013 2
What Is CADAC?
• CADAC – Computer Aided Design of Aerospace Concepts
MaSTech © 2013 3
What Is CADAC?
• CADAC – Computer Aided Design of Aerospace Concepts
• An engineering tool for the development of aerospace vehicles
– Focuses on high fidelity flight simulation of main vehicle
– Interacts with other secondary vehicles
MaSTech © 2013 4
What Is CADAC?
• CADAC – Computer Aided Design of Aerospace Concepts
• An engineering tool for the development of aerospace vehicles
– Focuses on high fidelity flight simulation of main vehicle
– Interacts with other secondary vehicles
• An evaluation tool for performance studies
– Fly-out performance
– Flight envelopes, launch envelopes, footprints
MaSTech © 2013 5
What Is CADAC?
• CADAC – Computer Aided Design of Aerospace Concepts
• An engineering tool for the development of aerospace vehicles
– Focuses on high fidelity flight simulation of main vehicle
– Interacts with other secondary vehicles
• An evaluation tool for performance studies
– Fly-out performance
– Flight envelopes, launch envelopes, footprints
• A planning and analysis tool for flight tests
– Trajectories, safety footprints
– Performance prediction
– Data correlation
MaSTech © 2013 6
What Is CADAC?
• CADAC – Computer Aided Design of Aerospace Concepts
• An engineering tool for the development of aerospace vehicles
– Focuses on high fidelity flight simulation of main vehicle
– Interacts with other secondary vehicles
• An evaluation tool for performance studies
– Fly-out performance
– Flight envelopes, launch envelopes, footprints
• A planning and analysis tool for flight tests
– Trajectories, safety footprints
– Performance prediction
– Data correlation
• A training tool
– University of Florida graduate courses in M&S
– Real-time integration into flight simulators
MaSTech © 2013 7
CADAC Genesis
• 1966 Litton Industries
– 6 DOF missile simulation in Fortran IV
– Adopted by industry and government
– IBM, Control Data mainframes
• 1978 U.S. Air Force – CADAC Fortran
– Air-to-ground and air-to-air missiles
– Fighter Aircraft
– Hypersonic vehicles
– Hosted on Digital VAX, IBM PC
• 2000 University of Florida – CADAC C++
– Conversion to C++
– ANSI / ISO 1998 Standard C++
– Microsoft Visual C++ compilers
• Present
– USAF/AFRL 5 & 6 DOF simulations
– UFL and other academic institutions
– Embedded in FLAMES
MaSTech © 2013 8
CADAC++ Active Simulations
TYPE VEHICLE OBJECTS DoF EARTH FEATURES
Cruise Missile Missile; Target; Satellite 5 Spherical Remote Targeting
Fighter Aircraft Aircraft 6 Flat Generic F16
Air-to-Ground Missile Missile; Aircraft; Target 6 Flat Weather Deck, MC
Air-to-Air Missile Missile; Target Aircraft 6 Flat MC
Plane + Transfer Vehicle +
Hypersonic Ascent Generic X30,
Interceptor; Tracking Station; 6 WGS84
Plane Weather Deck, MC
Satellite
Generic Defense Defensive Missile; Aircraft;
6 Flat MC
Missile Offensive Missile
Insertion Guidance, Weather
Three Stage Booster Rocket with Three Stages 6 WGS84
Deck, MC
Long Range Strike
Missile; Target 5 Spherical Hypersonic, FLAMES®
Missile
Two Pulse Rocket, Integral
Dual Role Missile Missile; Target; Recce Aircraft 6 Flat
Rocket Ramjet, MC
Booster + Waverider + Munition;
Global Strike 6 WGS84 Wave Rider, MC
Satellite; Target
Defensive Missile; Aircraft;
Self Defense Missile 6 Flat Real time, MC, FLAMES®
Offensive Missile
Small Smart Bomb Bomb; Satellite; Target 6 WGS84 Weather Deck, MC
Hypersonic Cruise
Missile; Satellite; Target 6 WGS84 Scramjet, Weather Deck, MC
Missile
MaSTech © 2013 9
CADAC, an Open Source Environment
MaSTech © 2013 10
CADAC Usage
• USAF/AFRL since 1978
• University of Florida since 1978
• Missouri University of Science and Technology,
Rolla, MO
• University of Queensland, Australia
• Indian Institute of Technology, Madras, India
• National University of Córdoba, Argentina
• Technion, Haifa, Israel
MaSTech © 2013 11
Graduate Courses at UF
Cruise Missile
MaSTech © 2013 12
Graduate Courses at UF
Fighter Aircraft
Cruise Missile
Air-to-Air Missile
MaSTech © 2013 13
Graduate Courses at UF
Building Aerospace Vehicle Fundamentals of Six DoF Aerospace Advanced Six DoF Aerospace
Simulations in C++, 2nd Ed, 2008 Simulation and Analysis in FORTRAN Simulation and Analysis in C++, 2005
and C++, 2004
Available at www.aiaa.org
MaSTech © 2013 14
• Who is out there in cyberspace ?
On next slide click a number for:
1. Student
2. Aerospace engineer
3. Software engineer
4. Scientist
5. Manager
6. Just Human
MaSTech © 2013
15
Requirements for Constructive
Simulations
MaSTech © 2013 16
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
MaSTech © 2013 17
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
MaSTech © 2013 18
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
MaSTech © 2013 19
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
MaSTech © 2013 20
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
• Global communication bus
– Data flow between encapsulated objects
MaSTech © 2013 21
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
• Global communication bus
– Data flow between encapsulated objects
• Table look-up
– 1, 2, 3 – dimensional
– Separate files of data decks for safekeeping
MaSTech © 2013 22
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
• Global communication bus
– Data flow between encapsulated objects
• Table look-up
– 1, 2, 3 – dimensional
– Separate files of data decks for safekeeping
• Monte Carlo capability
– Uniform, Gauss, Rayleigh, exponential, Markov distributions
MaSTech © 2013 23
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
• Global communication bus
– Data flow between encapsulated objects
• Table look-up
– 1, 2, 3 – dimensional
– Separate files of data decks for safekeeping
• Monte Carlo capability
– Uniform, Gauss, Rayleigh, exponential, Markov distributions
• Matrix utility operations
– Programming matrix equations directly
MaSTech © 2013 24
Requirements for Constructive
Simulations
• Synthesis capability for multi-vehicle environments
– High fidelity simulation of main vehicle
– Lower fidelity for supporting vehicles
• Encapsulation of vehicles for multiple instantiation
– Binding data and functions and restricting their access
• Modular structure to mirror the vehicle’s components
– Strict interface control
– Re-use of code
• Event scheduling
– Simulating all phases of flight
• Global communication bus
– Data flow between encapsulated objects
• Table look-up
– 1, 2, 3 – dimensional
– Separate files of data decks for safekeeping
• Monte Carlo capability
– Uniform, Gauss, Rayleigh, exponential, Markov distributions
• Matrix utility operations
– Programming matrix equations directly
• Documentation and error checking
– Documenting all interface variables
– Checking interface variables, matrix compatibility, and file streams
– Making output compatible with CADAC-Studio
MaSTech © 2013 25
Class Structure
CLASS DESCRIPTION
Cadac, ... Base class of hierarchical class structure of vehicles
Vehicle Hosting a pointer array of type Cadac
Module Storing module information
Variable Declaring module-variables
Event Storing event information
Packet Storing data packets for global communication bus
Datadeck Hosting a pointer array of type Table
Table Storing tabular data
Markov Storing Markov data
Matrix Declaring matrix operations
Document Storing module-variable definitions
MaSTech © 2013 26
Vehicles Are Encapsulated Objects
MaSTech © 2013 27
Vehicles Are Encapsulated Objects
MaSTech © 2013 28
Examples of Hierarchies
Hypersonic
Cruise Missile Fighter Aircraft
Ascent Plane
MaSTech © 2013 29
CADAC Execution
modules.cpp
headers.hpp
compile
aero_deck.asc
input.asc vehicle.exe
prop_deck.asc
Program Execution
input19PR_3.asc: Ascent and rendezvous with circular and elliptical satellite May 21 2005 16:58:56
+90
+70
+50
+30
plot.asc traj.asc stat.asc
+70
main
+50
+150
+30
-50
CADAC Studio
MaSTech © 2013 30
• What is your preferred language?
1. Fortran
2. C
3. C++
4. C#
5. Java
6. English
MaSTech © 2013
31
The Power of Polymorphism
• Definition
– Polymorphism is the capability of C++ to use many forms (polymorph) with one
interface (polymorph)
MaSTech © 2013 32
The Power of Polymorphism
• Definition
– Polymorphism is the capability of C++ to use many forms (polymorph) with one
interface (polymorph)
• Examples
– Overloaded functions: many coding forms, but one function name
– Overloaded operators: many operations, but one operator symbol
– Virtual functions: many coding forms, but one function name
– Run-time polymorphism: many derived objects, but with pointers of the same type of
the ‘base class’
MaSTech © 2013 33
The Power of Polymorphism
• Definition
– Polymorphism is the capability of C++ to use many forms (polymorph) with one
interface (polymorph)
• Examples
– Overloaded functions: many coding forms, but one function name
– Overloaded operators: many operations, but one operator symbol
– Virtual functions: many coding forms, but one function name
– Run-time polymorphism: many derived objects, but with pointers of the same type of
the ‘base class’
• The power of late binding (function calls are resolved at run-time)
– The (virtual) function call is determined by the type of object pointed to by the pointer
– The pointers to the derived objects can be stored in one array of type ‘base class’
– Late binding reduces code complexity
MaSTech © 2013 34
Run-Time Polymorphism
• Run-time polymorphism is accomplished using inheritance and virtual
functions
MaSTech © 2013 35
Run-Time Polymorphism
• Run-time polymorphism is accomplished using inheritance and virtual
functions
• A virtual function is a member of the base class and may be overridden
by a new function of the derived class
MaSTech © 2013 36
Run-Time Polymorphism
• Run-time polymorphism is accomplished using inheritance and virtual
functions
• A virtual function is a member of the base class and may be overridden
by a new function of the derived class
• Procedure:
1. Build a branching class hierarchy
2. Dynamically allocate memory for an array of pointers to the objects; the
array pointer is of type base_class
pointer = new base_class *[size];
3. Place the object pointers into the array
4. At run-time, as one of the pointer array elements accesses a virtual function,
the correct version of the virtual function corresponding to the object
pointer will be called
MaSTech © 2013 37
Run-Time Polymorphism
• Run-time polymorphism is accomplished using inheritance and virtual
functions
• A virtual function is a member of the base class and may be overridden
by a new function of the derived class
• Procedure:
1. Build a branching class hierarchy
2. Dynamically allocate memory for an array of pointers to the objects; the
array pointer is of type base_class
pointer = new base_class *[size];
3. Place the object pointers into the array
4. At run-time, as one of the pointer array elements accesses a virtual function,
the correct version of the virtual function corresponding to the object
pointer will be called
• A class is called an abstract class if at least one of its functions is purely
virtual; it cannot be used to create an object
MaSTech © 2013 38
Run-Time Polymorphism
• Run-time polymorphism is accomplished using inheritance and virtual
functions
• A virtual function is a member of the base class and may be overridden
by a new function of the derived class
• Procedure:
1. Build a branching class hierarchy
2. Dynamically allocate memory for an array of pointers to the objects; the
array pointer is of type base_class
pointer = new base_class *[size];
3. Place the object pointers into the array
4. At run-time, as one of the pointer array elements accesses a virtual function,
the correct version of the virtual function corresponding to the object
pointer will be called
• A class is called an abstract class if at least one of its functions is purely
virtual; it cannot be used to create an object
• Benefit of run-time polymorphism (late binding)
– Program ‘morphs’ during execution without a large amount of contingency
code
– But slows down execution
MaSTech © 2013 39
Implementation of Run-Time Polymorphism
• All vehicle objects are stored in the pointer array vehicle_ptr
Classes
of type Cadac (abstract base class)
Cadac, ... 1. Create Vehicle vehicle_list which has as private member the pointer
Vehicle array Cadac **vehicle_ptr
Module 2. From ‘input.asc’ read the number and type of vehicle objects
Variable 3. Add the vehicle pointers to vehicle_ptr array in the order read from
Event ‘input.asc’
Packet
Datadeck
Table
Markov
Matrix
Document
MaSTech © 2013 40
Implementation of Run-Time Polymorphism
• All vehicle objects are stored in the pointer array vehicle_ptr
Classes
of type Cadac (abstract base class)
Cadac, ... 1. Create Vehicle vehicle_list which has as private member the pointer
Vehicle array Cadac **vehicle_ptr
Module 2. From ‘input.asc’ read the number and type of vehicle objects
Variable 3. Add the vehicle pointers to vehicle_ptr array in the order read from
Event ‘input.asc’
Packet • During run-time the vehicle objects are accessed by their pointers
Datadeck – The class Vehicle declares an overloaded offset operator
Cadac *operator[] that returns the vehicle pointer
Table
– The vehicle pointer is of the correct vehicle type (e.g., Cruise, Target,
Markov Satellite) although it is stored in the pointer array of type Cadac
Matrix (polymorphism)
Document 4. With this vehicle-pointer the member functions of the respective vehicle are
accessed
– Example: At every integration step the ‘newton’ module of the i-th vehicle is
called
vehicle_list[i]->newton(int_step); ♣
MaSTech © 2013 41
Cruise Missile Architecture
Abstract base class Cadac
MaSTech © 2013 42
Cruise Missile Architecture
Abstract base class Cadac
MaSTech © 2013 43
Cruise Missile Architecture
Abstract base class Cadac
Virtual functions
MaSTech © 2013 44
Cruise Missile Architecture
Abstract base class Cadac
Virtual functions
MaSTech © 2013 45
Cruise Missile Architecture
Abstract base class Cadac
Virtual functions
MaSTech © 2013 46
Cruise Missile Architecture
Abstract base class Cadac
Virtual functions
environment
control aerodynamics
propulsion
MaSTech © 2013 48
CADAC++ Modularity
• CADAC’s modular structure mirrors the hardware components
Classes of an aerospace vehicle
Cadac, ... – A module is a model of a vehicle component
Vehicle • Examples: aerodynamics, propulsion, actuator, guidance, control
Module
• The calling order of the modules is controlled by the input file
Variable
Event
Packet
Datadeck
Table
Markov
Matrix
Document
MaSTech © 2013 49
CADAC++ Modularity
• CADAC’s modular structure mirrors the hardware components
Classes of an aerospace vehicle
Cadac, ... – A module is a model of a vehicle component
Vehicle • Examples: aerodynamics, propulsion, actuator, guidance, control
Module
• The calling order of the modules is controlled by the input file
Variable
Event • Data between modules is transferred by module-variables
Packet – Module-variables, being the only interface, are strictly controlled
Datadeck – Each vehicle object has reserved an array for its module-variables
Table – There is a one-to-one relationship between the module-variable name and
the array location
Markov
– The file doc.asc documents all module-variables
Matrix
Document
MaSTech © 2013 50
CADAC++ Modularity
• CADAC’s modular structure mirrors the hardware components
Classes of an aerospace vehicle
Cadac, ... – A module is a model of a vehicle component
Vehicle • Examples: aerodynamics, propulsion, actuator, guidance, control
Module
• The calling order of the modules is controlled by the input file
Variable
Event • Data between modules is transferred by module-variables
Packet – Module-variables, being the only interface, are strictly controlled
Datadeck – Each vehicle object has reserved an array for its module-variables
Table – There is a one-to-one relationship between the module-variable name and
the array location
Markov
– The file doc.asc documents all module-variables
Matrix
Document • Module-variables can be of type int, double, 3x1 vector, and
3x3 matrix
MaSTech © 2013 51
CADAC++ Modularity
• CADAC’s modular structure mirrors the hardware components
Classes of an aerospace vehicle
Cadac, ... – A module is a model of a vehicle component
Vehicle • Examples: aerodynamics, propulsion, actuator, guidance, control
Module
• The calling order of the modules is controlled by the input file
Variable
Event • Data between modules is transferred by module-variables
Packet – Module-variables, being the only interface, are strictly controlled
Datadeck – Each vehicle object has reserved an array for its module-variables
Table – There is a one-to-one relationship between the module-variable name and
the array location
Markov
– The file doc.asc documents all module-variables
Matrix
Document • Module-variables can be of type int, double, 3x1 vector, and
3x3 matrix
• Inside a module, the module-variables are localized and, after
computations, are loaded into their array location ♣
•
MaSTech © 2013 52
Fighter Aircraft Modular Structure
Class Hierarchy
Cadac
Flat6 Cadac::flat6[]
Plane Cadac::plane[]
propulsion( )
plane[50-99]
Modules
guidance( )
plane[400-499]
MaSTech © 2013 53
Hypersonic Plane Modular Structure
rcs( ) propulsion( )
hyper[50-99] hyper[10-49] 6 DoF Hypersonic Vehicle HYPER6
actuator( ) aerodynamics( ) forces( ) euler( ) newton( ) intercept( )
hyper[600-649] hyper[100-199] round6[200-209] round6[150-199] round6[210-299] hyper[650-699]
seeker( ) gps( )
hyper[200-299] hyper[700-799]
startrack( ) Round6
datalink( )
hyper[350-399 ] hyper[800-849]
Hyper
MaSTech © 2013 54
Hypersonic Plane Modular Structure
rcs( ) propulsion( )
hyper[50-99] hyper[10-49] 6 DoF Hypersonic Vehicle HYPER6
actuator( ) aerodynamics( ) forces( ) euler( ) newton( ) intercept( )
hyper[600-649] hyper[100-199] round6[200-209] round6[150-199] round6[210-299] hyper[650-699]
seeker( ) gps( )
hyper[200-299] hyper[700-799]
3 DoF Satellite SAT3 Round3 Ground0
startrack( ) Round6
datalink( ) newton( ) forces( )
hyper[350-399 ] hyper[800-849]
round3[20-59] satellite[10-19]
environment( )
0 DoF Ground Hyper Satellite Radar
seeker( ) round3[10-19]
radar [10-29] Radar RADAR0
kinematics( ) data flow on combus
ground0[10-19] data flow inside object ♣
MaSTech © 2013 55
Structure of Newton Module
previous module
void Round3::def_newton()
Definition of module-variables used in this module
void Round3::init_newton ()
Initial calculations
Integration loop
next module
MaSTech © 2013 56
Code Example of Module Newton
void Round3::def_newton()
{
MaSTech © 2013 57
Code Example of Module Newton
void Round3::def_newton()
{
name, value, definition, module, type, out to: screen, plot file, combus
Definition of //Definition of module-variables
module-variables in round3[19].init("lonx",0,"Vehicle longitude-deg","newton","diag","scrn,plot,com");
round3[20].init("latx",0,"Vehicle latitude-deg","newton","diag","scrn,plot,com");
array ‘round3[ ]’, round3[21].init("alt",0,"Vehicle altitude-m","newton","out","scrn,plot,com");
a member of class ...
‘Round3’ }void Round3::init_newton()
{
........................
}
void Round3::newton(double int_step)
{
//localizing module-variables
//input from other modules
double time=round3[0].real();
Matrix FSPV=round3[10].vec();
double grav=round3[11].real();
Matrix WEII=round3[27].mat();
//state variables
Matrix SBII=round3[35].vec();
Matrix VBII=round3[36].vec();
Matrix ABII=round3[37].vec();
...
//-------------------------------------------------------------------------
//building gravitational vector in geographic coordinates
GRAV.assign_loc(2,0,grav);
MaSTech © 2013 58
Code Example of Module Newton
void Round3::def_newton()
{
name, value, definition, module, type, out to: screen, plot file, combus
Definition of //Definition of module-variables
module-variables in round3[19].init("lonx",0,"Vehicle longitude-deg","newton","diag","scrn,plot,com");
round3[20].init("latx",0,"Vehicle latitude-deg","newton","diag","scrn,plot,com");
array ‘round3[ ]’, round3[21].init("alt",0,"Vehicle altitude-m","newton","out","scrn,plot,com");
a member of class ...
‘Round3’ }void Round3::init_newton()
{
........................
}
void Round3::newton(double int_step)
{
//localizing module-variables
Getting module- //input from other modules
double time=round3[0].real();
variables from Matrix FSPV=round3[10].vec();
‘round3[ ]’ array double grav=round3[11].real();
Matrix WEII=round3[27].mat();
//state variables
Matrix SBII=round3[35].vec();
Matrix VBII=round3[36].vec();
Matrix ABII=round3[37].vec();
...
//-------------------------------------------------------------------------
//building gravitational vector in geographic coordinates
GRAV.assign_loc(2,0,grav);
MaSTech © 2013 59
Code Example of Module Newton
void Round3::def_newton()
{
name, value, definition, module, type, out to: screen, plot file, combus
Definition of //Definition of module-variables
module-variables in round3[19].init("lonx",0,"Vehicle longitude-deg","newton","diag","scrn,plot,com");
round3[20].init("latx",0,"Vehicle latitude-deg","newton","diag","scrn,plot,com");
array ‘round3[ ]’, round3[21].init("alt",0,"Vehicle altitude-m","newton","out","scrn,plot,com");
a member of class ...
‘Round3’ }void Round3::init_newton()
{
........................
}
void Round3::newton(double int_step)
{
//localizing module-variables
Getting module- //input from other modules
double time=round3[0].real();
variables from Matrix FSPV=round3[10].vec();
‘round3[ ]’ array double grav=round3[11].real();
Matrix WEII=round3[27].mat();
//state variables
Matrix SBII=round3[35].vec();
Matrix VBII=round3[36].vec();
Matrix ABII=round3[37].vec();
...
//-------------------------------------------------------------------------
//building gravitational vector in geographic coordinates
GRAV.assign_loc(2,0,grav);
MaSTech © 2013 60
Code Example of Module Newton
void Round3::def_newton()
{
name, value, definition, module, type, out to: screen, plot file, combus
Definition of //Definition of module-variables
module-variables in round3[19].init("lonx",0,"Vehicle longitude-deg","newton","diag","scrn,plot,com");
round3[20].init("latx",0,"Vehicle latitude-deg","newton","diag","scrn,plot,com");
array ‘round3[ ]’, round3[21].init("alt",0,"Vehicle altitude-m","newton","out","scrn,plot,com");
a member of class ...
‘Round3’ }void Round3::init_newton()
{
........................
}
void Round3::newton(double int_step)
{
//localizing module-variables
Getting module- //input from other modules
double time=round3[0].real();
variables from Matrix FSPV=round3[10].vec();
‘round3[ ]’ array double grav=round3[11].real();
Matrix WEII=round3[27].mat();
//state variables
Matrix SBII=round3[35].vec();
Matrix VBII=round3[36].vec();
Matrix ABII=round3[37].vec();
...
//-------------------------------------------------------------------------
//building gravitational vector in geographic coordinates
GRAV.assign_loc(2,0,grav);
MaSTech © 2013 61
• How do you feel about polymorphism?
1. Too difficult to understand
2. I want to get to know it better
3. Best for multi-object modular simulations
4. Not the best architecture
5. I am numbed and without feelings
MaSTech © 2013
62
Event Scheduling
• Aerospace vehicle trajectories are divided into phases initiated by events
– Rocket ascent in three stages
– Aircraft take-off, cruise, landing
– Missile launch, midcourse, terminal, intercept
MaSTech © 2013 63
Event Scheduling
• Aerospace vehicle trajectories are divided into phases initiated by events
Classes – Rocket ascent in three stages
Cadac, ... – Aircraft take-off, cruise, landing
Vehicle – Missile launch, midcourse, terminal, intercept
Module • Events in CADAC++ are interruptions of the trajectory for the purpose of
Variable reading new module-variables
Event – Global dimensioning of events
• NEVENT = maximum number of events
Packet
• NVAR = maximum number of module-variables at each event
Datadeck
Table
Markov
Matrix
Document
MaSTech © 2013 64
Event Scheduling
• Aerospace vehicle trajectories are divided into phases initiated by events
Classes – Rocket ascent in three stages
Cadac, ... – Aircraft take-off, cruise, landing
Vehicle – Missile launch, midcourse, terminal, intercept
Module • Events in CADAC++ are interruptions of the trajectory for the purpose of
Variable reading new module-variables
Event – Global dimensioning of events
• NEVENT = maximum number of events
Packet
• NVAR = maximum number of module-variables at each event
Datadeck • Events are introduced in the input file input.asc
Table – Event block
Markov IF watch_variable_name relational_operator value
Matrix module-variables
ENDIF
Document
– Relational operators: <, =, >
– Example: seeker is enabled at dbt = 8000 m to-go
IF dbt < 8000
mseek 2 //'int' =2:Enable, =3:Acquisition, =4:Lock module seeker
ENDIF
♣
MaSTech © 2013 65
Input File of Cruise Missile ( 1 of 4 )
TITLE input1_3.asc: UAV cruising and attacking target tracked by satellite
// Waypoint guidance and dive into target
OPTIONS y_scrn n_comscrn y_events n_tabout y_plot y_traj n_merge y_doc
MODULES
environment def,init,exec
aerodynamics def,exec
propulsion def,init,exec
forces def,exec
newton def,init,exec
targeting def,exec
seeker def,exec
guidance def,exec
control def,exec
intercept def,exec
END
TIMING
scrn_step 30
plot_step 0.2
traj_step 0.5
int_step 0.05
END
. . . . . . . continue
MaSTech © 2013 66
Input File of Cruise Missile ( 2 of 4 )
VEHICLES 3
CRUISE3 UAV
//initial conditions
lonx 14.7 //Vehicle longitude - deg module newton
latx 35.4 //Vehicle latitude - deg module newton
alt 7000 //Vehicle altitude - m module newton
psivgx 90 //Vehicle heading angle - deg module newton
thtvgx 0 //Vehicle flight path angle - deg module newton
dvbe 200 //Vehicle speed - m/s module newton
alphax 0 //Angle of attack - deg module control
phimvx 0.0 //Bank angle - deg module control
//aerodynamics
AERO_DECK cruise3_aero_deck.asc
//mass properties and propulsion
mprop 4 //'int' Mode switch - ND module propulsion
PROP_DECK cruise3_prop_deck.asc
//seeker
//guidance
//autopilot
. . . . . . . . continue
MaSTech © 2013 67
Input File of Cruise Missile ( 3 of 4 )
IF wp_flag = -1
//Waypoint #1 crossed
wp_lonx 15.1 //Longitude of way point - deg module guidance
wp_latx 35.35 //Latitude of way point - deg module guidance
psifgx 135 //Heading line-of-attack angle - deg module guidance
altcom 5000 //Altitude command - m) module control
ENDIF
IF wp_flag = -1
//Waypoint #2 crossed
……
ENDIF
IF wp_flag = -1
//after Waypoint #3: hold heading at 180 and descend to 1500 m
//turn-on seeker and intercept nearest target l
ENDIF
IF mseeker = 3
//seeker is locked on target
ENDIF
END (of CRUISE3)
. . . . . . . . continue
MaSTech © 2013 68
Input File of Cruise Missile ( 4 of 4 )
TARGET3 Tank_t1
lonx 15.4 //Vehicle longitude - deg module newton
latx 35.3 //Vehicle latitude - deg module newton
alt 100 //Vehicle altitude - m module newton
psivgx 45 //Vehicle heading angle - deg module newton
dvbe 10 //Vehicle speed - m/s module newton
END
SATELLITE3 Sat_s1
lonx 10 //Vehicle longitude - deg module newton
latx 30 //Vehicle latitude - deg module newton
alt 500000 //Vehicle altitude - m module newton
psivgx 45 //Vehicle heading angle - deg module newton
thtvgx 0 //Vehicle flight path angle - deg module newton
dvbe 7700 //Vehicle speed - m/s module newton
END
END
ENDTIME 300
STOP
MaSTech © 2013 69
Console Output
input1_3.asc: UAV cruising and attacking target tracked by satellite Jan 10 2013 10:03:33
Vehicle: CRUISE3
time event_time pdynmc mach lonx latx
psivgx thtvgx SBEG1 SBEG2 SBEG3 VBEG1
mprop thrust mass cl_ov_cd mcontrol anx
phimvx phicx ancomx alcomx mguidance wp_grdrange
UAV
0 0 11790 0.640464 14.7003 35.4
90.0005 -0.0560967 -4.67125e-005 10.0005 0.00489589 -0.0018685
4 1342.26 999.999 3.81163 46 0.189791
-0.621118 -12.4224 1.0202 -0.0206828 30 18098.6
UAV
30 30 14037.7 0.698874 14.7697 35.4001
89.9982 -0.0169859 6.92492 6301.06 -0.390137 0.00697903
4 971.033 998.649 10.008 46 0.996081
-0.154728 -0.155251 0.994662 -0.00135087 30 11814.5
UAV
60 60 14039.9 0.698925 14.8418 35.4
90.0525 -2.33129e-006 3.00039 12848.7 -0.322431 -0.200044
4 964.612 997.811 10.0282 46 0.990144
-0.236911 -0.238453 0.990137 -0.00206247 30 5274.05
*** Missile c1 overflies waypoint at longitude = 14.9 deg, latitude = 35.4 deg at time = 84.2 sec
SWBG-horizontal miss distance = 1.92061 m north = 0.00257307 m east = -1.9206 m
MaSTech © 2013 70
UAV Trajectory
Launch
Long 14.7o, Lat 35.4o, heading East
Altitude - m
Alt 7000 m
Mach 0.7
8.00 e +3
Launch 6.00
4.00 Waypoints
2.00
Lon-deg Lat-deg
WP #1 14.9 35.4
0 WP #2 15.25 35.54
WP #3 15.43
35.1 35.44
Target
35.2
Waypoint # 1
35.3
14.4
# 3 35.4
Cruise -2.00
Mach 0.7
#2 35.5 After WP #1 descend to 5000 m
14.6 14.8 35.6 After WP #2 descend to 2000 m
15.0
15.2
Latitude - deg
After WP #3 descend to Target
15.4
Longitude - deg
input_3.asc: UAV Cruise ' UAV ' Nov 28 2006 16:00:52
MaSTech © 2013 71
• What is your preferred format for
input data?
1. Programmed into code
2. ASCI input file
3. Graphic user interface
4. Namelist (Fortran)
MaSTech © 2013
72
Communication Bus combus
MaSTech © 2013 73
Communication Bus combus
• Encapsulation of vehicle-objects prevents direct data exchange
MaSTech © 2013 74
Communication Bus combus
• Encapsulation of vehicle-objects prevents direct data exchange
• The communication bus combus gives global access to the module-
variables of all vehicle-objects
MaSTech © 2013 75
Communication Bus combus
• Encapsulation of vehicle-objects prevents direct data exchange
Classes
• The communication bus combus gives global access to the module-
Cadac, ... variables of all vehicle-objects
Vehicle • Building the communication bus
Module – Module-variables are flagged by the keyword “com”
Variable round3[19].init("lonx",0,"Vehicle longitude - deg","newton","init/diag","com");
MaSTech © 2013 76
Communication Bus combus
• Encapsulation of vehicle-objects prevents direct data exchange
Classes
• The communication bus combus gives global access to the module-
Cadac, ... variables of all vehicle-objects
Vehicle • Building the communication bus
Module – Module-variables are flagged by the keyword “com”
Variable round3[19].init("lonx",0,"Vehicle longitude - deg","newton","init/diag","com");
MaSTech © 2013 77
Communication Bus combus
• Encapsulation of vehicle-objects prevents direct data exchange
Classes
• The communication bus combus gives global access to the module-
Cadac, ... variables of all vehicle-objects
Vehicle • Building the communication bus
Module – Module-variables are flagged by the keyword “com”
Variable round3[19].init("lonx",0,"Vehicle longitude - deg","newton","init/diag","com");
MaSTech © 2013 78
Publishing and Subscribing Module-Variables
Publishing Subscribing
CRUISE3 c1
Packets
round3[]: lonx, latx, alt
cruise[]: thrust, mguidance combus
c1
CRUISE3 c2 c2
round3[]: lonx, latx, alt .
cruise[]: thrust, mguidance .
..
. t1
TARGET3 t1 t2
.
round3[]: lonx, latx, alt .
--------------------------
TARGET3 t2
round3[]: lonx, latx, alt
--------------------------
.. CRUISE3 c2 CRUISE3 c1
. … t1 lonx, latx, alt t1 lonx, latx, alt
t2 lonx, latx, alt t2 lonx, latx, alt
MaSTech © 2013 79
Publishing and Subscribing
MaSTech © 2013 80
Publishing and Subscribing
• The communication bus Packet combus enables the communication
among the encapsulated vehicle objects
MaSTech © 2013 81
Publishing and Subscribing
• The communication bus Packet combus enables the communication
among the encapsulated vehicle objects
• Vehicles publish selected module-variables by using the keyword “com”
in the definition
– Every vehicle object of the same type (multiple instantiation) publishes the
same module-variables
– Example: All vehicle objects are derived from the round3 class and publish
the same round3 module-variables
MaSTech © 2013 82
Publishing and Subscribing
• The communication bus Packet combus enables the communication
among the encapsulated vehicle objects
• Vehicles publish selected module-variables by using the keyword “com”
in the definition
– Every vehicle object of the same type (multiple instantiation) publishes the
same module-variables
– Example: All vehicle objects are derived from the round3 class and publish
the same round3 module-variables
• Subscription of module-variables is complicated by the fact that the
subscribing vehicle object (this) is unaware of the publishing vehicle
MaSTech © 2013 83
Publishing and Subscribing
• The communication bus Packet combus enables the communication
among the encapsulated vehicle objects
• Vehicles publish selected module-variables by using the keyword “com”
in the definition
– Every vehicle object of the same type (multiple instantiation) publishes the
same module-variables
– Example: All vehicle objects are derived from the round3 class and publish
the same round3 module-variables
• Subscription of module-variables is complicated by the fact that the
subscribing vehicle object (this) is unaware of the publishing vehicle
• Subscription methodology:
– Publishing vehicle must by identified by its combus slot#
• Logic is required to select the publishing vehicle from all other vehicle objects
– Example: Pick target (publisher) when it is in acquisition range of missile (subscriber)
• Build the publishing vehicle’s ID
• Find this ID in combus und thus determining its slot#
– Download module-variables from the combus data packet
MaSTech © 2013 84
Console Display of combus
. . . . . . . .
UAV
60 60 14039.9 0.698925 14.8418 35.4 7000.32
90.0525 -2.33129e-006 3.00039 12848.7 -0.322431 -0.200044 218.255
4 964.612 997.811 10.0282 46 0.990144 0
-0.236911 -0.238453 0.990137 -0.00206247 30 5274.05 0
*** Missile c1 overflies waypoint at longitude = 14.9 deg, latitude = 35.4 deg at time = 84.2 sec ***
SWBG-horizontal miss distance = 1.92061 m north = 0.00257307 m east = -1.9206 m
*** Event #1 UAV time = 84.2 sec; criteria: wp_flag = -1 ***
MaSTech © 2013 85
Table Look-Up
Classes • Aerodynamic and propulsion decks
Cadac, ... – Contain 1, 2, 3 dimensional tables
Vehicle – Linear interpolation adequate
Module
Variable • Desired features
Event – Keep data decks separate from code
Packet – Make adding or deleting tables simple
Datadeck • Architecture
Table – Encapsulation of data and methods
Markov – Table stores tabular data
Matrix – Datadeck hosts pointer-arrays of type Table
Document – Tables to be accessed by pointers stored in these arrays
– Overloading the look-up function for 1, 2, 3 dimensions
MaSTech © 2013 86
Table Look-Up Procedure
MaSTech © 2013 87
Table Look-Up Procedure
• Tables are located in files ‘cruise3_aero_deck.asc’ and ‘cruise3_prop_deck.asc’
MaSTech © 2013 88
Table Look-Up Procedure
• Tables are located in files ‘cruise3_aero_deck.asc’ and ‘cruise3_prop_deck.asc’
• These file names are identified in ‘input.asc’ by the key words AERO_DECK or PROP_DECK
MaSTech © 2013 89
Table Look-Up Procedure
• Tables are located in files ‘cruise3_aero_deck.asc’ and ‘cruise3_prop_deck.asc’
• These file names are identified in ‘input.asc’ by the key words AERO_DECK or PROP_DECK
• The function look_up(…), located in the ‘utility_functions.cpp’ file, carries out the
interpolation
MaSTech © 2013 90
Table Look-Up Procedure
• Tables are located in files ‘cruise3_aero_deck.asc’ and ‘cruise3_prop_deck.asc’
• These file names are identified in ‘input.asc’ by the key words AERO_DECK or PROP_DECK
• The function look_up(…), located in the ‘utility_functions.cpp’ file, carries out the
interpolation
• Tabular data are read and stored during initialization
– main() opens the file ‘input.asc’
– For every vehicle-object, the function vehicle_data(…) is called
– In vehicle_data(…) the file name of the aero-deck is read and the file is opened
– Then the function read_tables(…) is called, which reads and stores the table
MaSTech © 2013 91
Table Look-Up Procedure
• Tables are located in files ‘cruise3_aero_deck.asc’ and ‘cruise3_prop_deck.asc’
• These file names are identified in ‘input.asc’ by the key words AERO_DECK or PROP_DECK
• The function look_up(…), located in the ‘utility_functions.cpp’ file, carries out the
interpolation
• Tabular data are read and stored during initialization
– main() opens the file ‘input.asc’
– For every vehicle-object, the function vehicle_data(…) is called
– In vehicle_data(…) the file name of the aero-deck is read and the file is opened
– Then the function read_tables(…) is called, which reads and stores the table
• Using tables during integration
– Function look_up(…) is overloaded for one, two, and three dimensional table look-up
– The table interpolation consists of two steps
• Finding the index of the discrete independent variable with function find_index(…) nearest and below the
input variable
• Conducting a linear interpolation with function interpolate(…) between data points
– Extrapolation is constant at the upper end and linearly sloped at the lower end ♣
MaSTech © 2013 92
One-Dimensional Table Look-Up
Object name
of table
Keywords
1DIM cd0_vs_mach
NX1 6 Number of discrete
0.4000 0.0506 points
0.5500 0.0462
0.6500 0.0435
0.7700 0.0410
0.8500 0.0506
0.9500 0.1078
MaSTech © 2013 93
Two-Dimensional Table Look-Up
Keywords Object name of table
2DIM tav_vs_alt_mach
NX1 3 NX2 4 // altitude - m, Mach #; thrust available - N
0 0.4 2168.0 2088.8 2043.9 1987.8
1524 0.55 1942.9 1891.3 1863.3 1846.8
3048 0.7 1711.6 1677.3 1676.0 1683.6
0.85
MaSTech © 2013 94
• What do you like about Monte Carlo best?
1. A vacation spot on the Côte Azure
2. The Formal One race care event
3. Gambling in the casinos
4. Grace Kelly, the former princess
5. Statistical method for nonlinear systems
MaSTech © 2013
95
Monte Carlo Technique
• ‘Monte Carlo’ is an important technique of experimental mathematics
– Statistical mechanics, nuclear physics, genetics
– We use the simple direct simulation method
MaSTech © 2013 96
Monte Carlo Technique
• ‘Monte Carlo’ is an important technique of experimental mathematics
– Statistical mechanics, nuclear physics, genetics
– We use the simple direct simulation method
• We study the response of nonlinear systems to random inputs
– Making multiple runs, drawing values from stochastic distributions
– Obtaining large quantity of output for post-analysis
MaSTech © 2013 97
Monte Carlo Technique
• ‘Monte Carlo’ is an important technique of experimental mathematics
– Statistical mechanics, nuclear physics, genetics
– We use the simple direct simulation method
• We study the response of nonlinear systems to random inputs
– Making multiple runs, drawing values from stochastic distributions
– Obtaining large quantity of output for post-analysis
• High fidelity aerospace simulations have many noise sources
– Turbulence, INS, sensors, aerodynamic misalignments
– With distributions like uniform, Gaussian, Rayleigh, exponential, Gaussian-
Markov, Dryden
MaSTech © 2013 98
Monte Carlo Technique
• ‘Monte Carlo’ is an important technique of experimental mathematics
– Statistical mechanics, nuclear physics, genetics
– We use the simple direct simulation method
• We study the response of nonlinear systems to random inputs
– Making multiple runs, drawing values from stochastic distributions
– Obtaining large quantity of output for post-analysis
• High fidelity aerospace simulations have many noise sources
– Turbulence, INS, sensors, aerodynamic misalignments
– With distributions like uniform, Gaussian, Rayleigh, exponential, Gaussian-
Markov, Dryden
• Output data are nearly Gaussian if there are many noise sources
– Asserted by the central limit theorem
– Requires at least 10 uncorrelated noise sources
MaSTech © 2013 99
Monte Carlo Technique
• ‘Monte Carlo’ is an important technique of experimental mathematics
– Statistical mechanics, nuclear physics, genetics
– We use the simple direct simulation method
• We study the response of nonlinear systems to random inputs
– Making multiple runs, drawing values from stochastic distributions
– Obtaining large quantity of output for post-analysis
• High fidelity aerospace simulations have many noise sources
– Turbulence, INS, sensors, aerodynamic misalignments
– With distributions like uniform, Gaussian, Rayleigh, exponential, Gaussian-
Markov, Dryden
• Output data are nearly Gaussian if there are many noise sources
– Asserted by the central limit theorem
– Requires at least 10 uncorrelated noise sources
• Output is expressed in univariate or bivariate performance criteria
– Univariate: mean, standard deviation, CEP (Circular Error Probable),
– Bivariate: error ellipses ♣
1
max min
UNI vname min, max
min max vname
pdf
0.2
GAUSS vname mean, sigma
0 -20 -10 0 10
vname
mean sigma
pdf
0.4
RAYL vname mode
0.2
HYPER6
HYPER6
HYPER6
RADAR0
Intercept of
+50satellite
Start of
+30
hypersonic
vehicle
+10
+50
-110 +30
-90 +10
-70 -50 -30 -10
-10
25.0
250
e +3
e +3
input19_1PR.asc: Ascent from Cape Canaveral until satellite intercept ' Hypersonic Vehicle ' May 14 2005 14:56:35
8.00
20.0
200
6.00
15.0
150
Inertial velocity - m/s
4.00
10.0
50.0 100
Altitude - m
2.00
5.00
Mach #
0
11.0
input19PR_3.asc: Ascent and rendezvous with circular and elliptical satellite May 21 2005 16:58:56
Intercept Sat 2
+50
+30
+70
+90
+70
+50 Release of
two
+150 interceptors
+30
-50
Start of
+170
+10 hypersonic
-70 vehicle
-10
-170
MaSTech © 2013 -90 110
Stochastic Analysis of Intercept
– With INS/GPS, star tracker and seeker errors, 30 Monte Carlo runs
·
-2.5
1
-7.5
the RF seeker
• Their miss distances are plotted
in the 1H, 3H coordinates, normal
to the satellite trajectory
-17.5
MaSTech © 2013
112
Overloaded Matrix Operators
Vehicle – The operator function defines the operation that the overloaded operator performs
Module – Most useful to define the operations of a new class, e.g., class Matrix
Variable
Event
Packet
Datadeck
Table
Markov
Matrix
Document
Vehicle – The operator function defines the operation that the overloaded operator performs
Module – Most useful to define the operations of a new class, e.g., class Matrix
Variable • Example: matrix multiplication
Event – Prototype
Packet Matrix Matrix::operator*(const Matrix &B);
Datadeck – Usage
Table • Matrix AMAT(3,3),BMAT(3,3),CMAT(3,3);
• CMAT=AMAT*BMAT;
Markov
Matrix
Document
Vehicle – The operator function defines the operation that the overloaded operator performs
Module – Most useful to define the operations of a new class, e.g., class Matrix
Variable • Example: matrix multiplication
Event – Prototype
Packet Matrix Matrix::operator*(const Matrix &B);
Datadeck – Usage
Table • Matrix AMAT(3,3),BMAT(3,3),CMAT(3,3);
• CMAT=AMAT*BMAT;
Markov
– Multiplication is explained by actual operator function assignment
Matrix
• CMAT=AMAT.operator*(BMAT);
Document
– AMAT, the left operand , is the object which initiates the function call: operator*(…)
– BMAT, the right operand, is the argument of the function
MaSTech © 2013
126
CADAC Studio
• 2DIM: 2-dimensional plotting
– Up to three variables in two frames (total of six variables)
– Multiple vehicle plotting
• PITA: 3-dimensional plotting in Cartesian coordinates
– Up to ten vehicles
• GLOBE: 3-dimensional plotting over the Earth (longitude, latitude, altitude)
– Up to four vehicles
• CHARTS: Strip charts
– Up to 12 traces in one frame
• Stochastic processing
– HIST: Histograms
– BIVAR: CEP and bivariate ellipses from scatter plots
– MCAP: Mean and std. deviation of trajectory fans
• Automated launch envelope and footprint generation
– SWEEP and SWEEP++ for CADAC_FTN and CADAC++
MaSTech © 2013
139
MaSTech © 2013 140