MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

29
MACCE and Real-Time Schedulers Steve Roberts EEL 6897

Transcript of MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Page 1: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

MACCE andReal-Time Schedulers

Steve Roberts

EEL 6897

Page 2: 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

Page 3: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Agenda

Discuss some different simulation issues Define a scheduler or real-time executive What is MACCE? A MACCE configuration file Conclusion Questions

Page 4: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Some Simulation Issues

Real-Time cards Interrupts Multiple Language Support Callbacks Shared Memory Multi-Threading

Page 5: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Real Time Cards

Sync cards Provide interrupts Interrupts can occur at different frequencies More accurate than software interrupts

Page 6: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 7: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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)

Page 8: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Shared Memory

Block of memory used by different processes Hardware shared memory

Multiple CPUs Software shared memory

Single CPU

Page 9: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

SCRAMNet

Shared Common Random Access Memory Network

Ring architecture Fiber Optic Network Large Throughput

>200MB/s Automatically updates other CPUs

Page 10: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Multi-Threading

Multiple processes running at the same time Multiple CPU Multiple threads/callbacks on a single CPU

Page 11: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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.

Page 12: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 13: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 14: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

MACCE System Diagram

Linux PC

Windows PC

SIMULATION HOST COMPUTER

MACCE SERVER(MACCES)

MAIN PROCESSSPAWNS CLIENTS

MACCEConfig

File

MACCEAPI

User Can Configurewith Config file or all

callbacks via MACCEAPI

M3Config

File

MACCE CLIENT 1MACCEC

MACCE CLIENT NMACCEC

MACCE CLIENT 3MACCEC

MACCE CLIENT 2MACCEC

MACCE CONTROL TABLEThreads, Modes, Callbacks, Clocks

M3 (MACCE MEMORY MANAGER) GLOBAL MEMORY

M3DBMFile

MACCE DAEMONMACCE

MACCECOMMAND

LINE

Users can also dynamicallyconfigure MACCE via

Command Line and Daemon

MACCE GUIMACCEG

MACCE GUIMACCEG

VEHICLE SIMULATION

Page 15: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

MACCE Architecture

Server Client Daemon Graphical User Interface (GUI)

Page 16: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 17: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 18: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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.

Page 19: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 20: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 21: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 22: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

MACCE APIMacceApiAttachCallback 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

Page 23: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

MACCE Configuration File

Variables SETENV GLOBAL

Clocks Modes Callbacks Tables Threads Processes

Page 24: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 25: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 26: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 27: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 28: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

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

Page 29: MACCE and Real-Time Schedulers Steve Roberts EEL 6897.

Questions?