170 likes | 198 Views
Distributed Virtual Environment and Simulation Package. Stephen Lawrence stevel@cc.gatech.edu. Overview of Topics. Type of Simulation Federation Organization Class Organization Internals of some DVESIM classes Creating a Federate Creating Simulation Objects.
E N D
Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu
Overview of Topics • Type of Simulation • Federation Organization • Class Organization • Internals of some DVESIM classes • Creating a Federate • Creating Simulation Objects
Object Based Simulation (using c++) Simulator, object(such as a tank or projectile), and battlefield classes new object types are created by sub-classing existing objects Event Driven Classes define event handlers to process events Federated (using DRTI) Each federate has local and non-local entities object updates are only send when needed Messages are sent between user and entities Type of Simulation
Simulator Federate Simulator Federate Simulator Federate Federation Organization UI Federate UI Federate
Federation Organization (cont) • Simulator Federates • Each controls a number of objects within the simulation world • Sends and received updates and interactions concerning it’s objects, and objects controlled by other federates • UI Federates • Allows users to view and interact with object in the Federation
Simulator Object Battlefield Event Tick New Object Movement Order Collision Class Organization Simulator Federate Classes Structure Entity Projectile =subclass
Manages Event Queue Schedules events Dispatches events to objects Simulates Battlefield Collision/proximity detection Projectile detonation Federate communication sends and receives events such as object updates and messages Internals: Simulator ClassEach simulator federate runs one instance of the simulator class
Simulation Class Execution init() Schedule all new object events for all local objects. Sets up simulation state schedules first new state event run() while event-queue not empty process event deliver event to object if necessary finishUp() Internals: Simulator Class (continued)
Internals: Simulator Class Example • The federates executive function removes the tick event from the event queue. • The tick event is passed to the federates tick event handler (a method of it's simulator class). • The tick event is forwarded, by the simulators event handler, to all objects in the battlefield. • The simulator class checks for collision between it's local objects and all objects in the battlefield (local and foreign). • A new tick event is created and scheduled for some small time in the future.
Manages objects objects hashed by RTI::ObjectHandle for fast access Provides means for objects to access other objects Contains both locally controlled objects, and objects controlled by other federates. Terrain Information (not implemented) provides terrain type for given coordinates on the battlefield objects view the world in only two dimensions, the battlefield provides additional elevation and slope information when needed Internals: Battlefield Class
Stores Event Information (TimeStamp, details) Tick Event -> triggers location updates and collision detection New Object Event -> adds a new object to the battlefield Order Event -> sends object and simulation messages, such as orders, simulation over, etc… Other Events Movement Event, Collision Event, Proximity Event,Detonation Event, User Defined Events Internals: Event Class
Internals: Event Class Example • Collision event is passed to the event handler by the executive function when it is safe to process. • The event handler passes the collision event to the local object involved in the collision (if two local objects are in collision, each will get it's own event). • The object reacts to the collision event. The default action is to do nothing, but subclasses of the object type can redefine the event handlers to do something interesting, such as stop, change direction, or calculate a new path.
Physical State Information (location, velocity, acceleration) Processes New State events to update it’s physical state Entity Subclass Provides basic movement services (set heading/location, etc) Fires projectiles Internals: Object Class
Object Class Execution A new object is created and stored in new object event The simulator later processes new object event Calls object init() function Sends New State and other events to object Object is removed by a call to exitObject() objects finishUp() function is called, and the object is deleted Internals: Object Class (continued)
Internals: Object Class Example • Simulator federate #1 schedules schedules a new object event for object A at time 1, register's an object instance for it within thefederation, and sends an attribute update for the the object with timestamp 1 • Simulator federate #2 discovers the object, creates a new object instance, and puts it in a temporary holding place. • When requesting a Next Event Request for time 1, federate #2's RTI ambassador delivers the attribute update for object A • Federate #2, now having received the first attribute information about object A, schedules a new object event with timestamp 1, which will be processed to add object A to it's battlefield. • After completing a Next Event Request for timestep 1, federate #1 will be able to process it's new object event and add object A to it's battlefield.
Display’s all the objects in the federation Paces the simulation with wallclock time Allows user to send messages to the objects (entities) Internals: Visualization