MACCE and Real-Time Schedulers Steve Roberts EEL 6897

advertisement
MACCE and
Real-Time Schedulers
Steve Roberts
EEL 6897
Who Am I?




Master’s in Modeling and Simulation
Employed by Veraxx Engineering Corp.
Undergraduate in Computer Engineering
from UCF
Worked in the simulation industry 4 years
Agenda






Discuss some different simulation issues
Define a scheduler or real-time executive
What is MACCE?
A MACCE configuration file
Conclusion
Questions
Some Simulation Issues






Real-Time cards
Interrupts
Multiple Language Support
Callbacks
Shared Memory
Multi-Threading
Real Time Cards




Sync cards
Provide interrupts
Interrupts can occur at different frequencies
More accurate than software interrupts
Multiple Language Support





Fortran
ADA/ADA 95
C++
C
Many simulators that are upgraded are
comprised of legacy code and code from
other simulators are pulled in to these legacy
systems
Callbacks




A pointer to a function
Usually the function is in a high level
language
The function pointer is passed to a low level
language
May also exist within the same application
(high level/high level)
Shared Memory


Block of memory used by different processes
Hardware shared memory


Multiple CPUs
Software shared memory

Single CPU
SCRAMNet




Shared Common Random Access Memory
Network
Ring architecture
Fiber Optic Network
Large Throughput


>200MB/s
Automatically updates other CPUs
Multi-Threading



Multiple processes running at the same time
Multiple CPU
Multiple threads/callbacks on a single CPU
What Is A Scheduler?

A scheduler is a piece of software that is an
integration point for a simulation. It is where
all the variables are instantiated, where the
functions are called, where proper timing and
order of execution happens, and where a
simulation is initialized, executed and
terminated.
Why Have a Scheduler?





Simplifies and automates integration
Wraps many low level details
Automatically handles many low level details
Provides a common simulation environment
Provides simple debuggin and analysis tools
What is MACCE?




Marine Aviation Common Computing
Environment
Manages and controls a Vehicle Simulation
Environment in real-time and standalone
modes
Linux based C++ architecture
Takes advantage of multiple CPUs
MACCE System Diagram
MACCE GUI
MACCEG
MACCE DAEMON
MACCE
Linux PC
MACCE SERVER
(MACCES)
MAIN PROCESS
SPAWNS CLIENTS
User Can Configure
with Config file or all
callbacks via MACCE
API
MACCE
Config
File
MACCE
API
Users can also dynamically
configure MACCE via
Command Line and Daemon
MACCE GUI
MACCEG
M3
Config
File
MACCE
COMMAND
LINE
MACCE CONTROL TABLE
Threads, Modes, Callbacks, Clocks
Windows PC
M3
DBM
File
MACCE CLIENT 1
MACCEC
MACCE CLIENT 2
MACCEC
MACCE CLIENT 3
MACCEC
VEHICLE SIMULATION
M3 (MACCE MEMORY MANAGER) GLOBAL MEMORY
SIMULATION HOST COMPUTER
MACCE CLIENT N
MACCEC
MACCE Architecture




Server
Client
Daemon
Graphical User Interface (GUI)
MACCE Server






This is the main process
Reads the configuration file
Creates the control table in shared memory
Starts all the clients
Monitors the command line
Does not perform real-time tasks
MACCE Server Cont.



Configures MACCE Memory Manager (M3)
global areas
Can be started in debug mode
Debugger such as GDB can be used to step
through any of the callbacks in the simulation
MACCE Client







MACCEC
This is a process
Connects to the control table
All callbacks are initiated by the client
One MACCEC per CPU is recommended
Has top level exception handling
Can manage multiple threads.
MACCE Daemon




Monitors a port for MACCE commands from
MACCE Clients
Forwards those commands to the MACCE
server
Runs on a Linux machine
One instance runs
MACCE GUI





More of a text-based UI
Provides interface for printing and watching
variables
Provides timing statistics
Displays log messages
Used to terminate a MACCE Server instance
MACCE Memory Manager (M3)





Lays out shared data areas
Reads in a memory config file
Generates Fortran scan file
Generates C, C++ header file
Generates Ada records
MACCE API
MacceApiAttachCallback
MacceApiGetExecutiveState
MacceApiRpSeek
MacceApiAttachThread
MacceApiGetFrameNumber
MacceApiRpStop
MacceApiCfgFileImport
MacceApiGetGlobalAddress
MacceApiRun
MacceApiCfgFileOpen
MacceApiGetGlobalSize
MacceApiSetClocks
MacceApiConfigureAndRun
MacceApiGetGlobalSymbolAddress
MacceApiShmClose
MacceApiCreateCallback
MacceApiGetIterationRate
MacceApiShmGetAddress
MacceApiCreateClock
MacceApiSetGlobalAddress
MacceApiShmOpen
MacceApiCreateGlobal
MacceApiInit
MacceApiSymbolQueryAddress
MacceApiCreateMode
MacceApiLogMessage
MacceApiSymbolQueryClose
MacceApiCreateProcess
MacceApiMalloc
MacceApiSymbolQueryOpen
MacceApiCreateThread
MacceApiRequestMode
MacceApiSymbolQuerySetLanguage
MacceApiEnvVarGet
MacceApiRpAddItem
MacceApiSymbolQueryType
MacceApiEnvVarSet
MacceApiRpClose
MacceApiUtilsSwapTwoBytes
MacceApiEnvVarUnset
MacceApiRpFastForward
MacceApiUtilsSwapFourBytes
MacceApiErrno
MacceApiRpOpen
MacceApiUtilsSwapEightBytes
MacceApiFinalize
MacceApiRpPause
MacceApiFree
MacceApiRpPlay
MacceApiGetDatabaseFirstSymbol
MacceApiRpRecord
MacceApiGetDatabaseNextSymbol
MacceApiRpRewind
MACCE Configuration File

Variables








SETENV
GLOBAL
Clocks
Modes
Callbacks
Tables
Threads
Processes
Sample MACCE Configuration























//////////
// clocks
//////////
[CLOCKS]
external = 0
internal = 60
standalone = 10
/////////
// modes
/////////
[MODE]
name
= STARTUP_MODE
description = Startup mode
type
= ONESHOT
next
= FREEFLIGHT_MODE
[MODE]
name
= SHUTDOWN_MODE
description = Shutdown mode
type
= ONESHOT
[MODE]
name
= FREEFLIGHT_MODE
description = Freeflight mode
type
= REALTIME
Cont…

































/////////////
// callbacks
/////////////
[CALLBACK]
name
= EOM_STARTUP_CALLBACK
description = Equations of motion startup callback
symbol
= eom_startup
language = CPP
[CALLBACK]
name
= EOM_SHUTDOWN_CALLBACK
description = Equations of motion shutdown callback
symbol
= eom_shutdown
language = CPP
[CALLBACK]
name
= EOM_SIMULATE_CALLBACK
description = Equations of motion simulate callback
symbol
= eom_simulate
language = CPP
[CALLBACK]
name
= UHF_RADIO_STARTUP_CALLBACK
description = UHF radio startup callback
symbol
= uhf_radio_startup
language = CPP
[CALLBACK]
name
= UHF_RADIO_SHUTDOWN_CALLBACK
description = UHF radio shutdown callback
symbol
= uhf_radio_shutdown
language = CPP
[CALLBACK]
name
= UHF_RADIO_SIMULATE_CALLBACK
description = UHF radio simulate callback
symbol
= uhf_radio_simulate
language = CPP
Cont…



































///////////
// threads
///////////
[THREAD]
name
= STARTUP_THREAD
description = Startup Thread
mode
= STARTUP_MODE
frequency = 1
phase
=0
callback = EOM_STARTUP_CALLBACK
callback = UHF_RADIO_STARTUP_CALLBACK
callback = TACAN_STARTUP_CALLBACK
[THREAD]
name
= SHUTDOWN_THREAD
description = Shutdown Thread
mode
= SHUTDOWN_MODE
frequency = 1
phase
=0
callback = EOM_SHUTDOWN_CALLBACK
callback = UHF_RADIO_SHUTDOWN_CALLBACK
callback = TACAN_SHUTDOWN_CALLBACK
[THREAD]
name
= FREEFLIGHT_60HZ_THREAD
description = 60 hertz freeflight thread
mode
= FREEFLIGHT_MODE
frequency = 1
phase
=0
callback = EOM_SIMULATE_CALLBACK
[THREAD]
name
= FREEFLIGHT_30HZ_PHASE0_THREAD
description = 30 hertz phase 0 freeflight thread
mode
= FREEFLIGHT_MODE
frequency = 2
phase
=0
callback = UHF_RADIO_SIMULATE_CALLBACK
Cont…













/////////////
// processes
/////////////
[PROCESS]
name
= TUTORIAL1_PROCESS
description = tutorial1 process
filter
=1
cpu
=1
thread
= STARTUP_THREAD
thread
= SHUTDOWN_THREAD
thread
= FREEFLIGHT_60HZ_THREAD
thread
= FREEFLIGHT_30HZ_PHASE0_THREAD
thread
= FREEFLIGHT_30HZ_PHASE1_THREAD
Conclusion



MACCE is a great tool that allows software
engineers the ability to pull together many
different pieces of simulators and combine
them to build a new simulator
MACCE also provides software engineers
with a debugging environment
MACCE can save time and headaches
Questions?
Download