distributed virtual environment and simulation package stephen lawrence [email protected]

17
Distributed Virtual Environment and Simulation Package Stephen Lawrence [email protected]

Upload: sheryl-gibson

Post on 13-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Distributed Virtual Environment and

Simulation Package

Stephen Lawrence

[email protected]

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

Page 3: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Type of Simulation

– 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

Page 4: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Federation Organization

Simulator Federate

UI FederateUI Federate

Simulator Federate

Simulator Federate

Page 5: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

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

Page 6: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Class Organization

Entity

Structure

Projectile

Tick

New Object

Collision

Order

Movement

Simulator Federate Classes

Simulator EventObject Battlefield

= subclass

Page 7: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Simulator ClassEach simulator federate runs one instance of the

simulator class

• 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

Page 8: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Simulator Class (continued)

Page 9: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Simulator Class (continued)

• 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()

Page 10: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Simulator Class Example

1. The federates executive function removes the tick event from the event queue.

2. The tick event is passed to the federates tick event handler (a method of it's simulator class).

3. The tick event is forwarded, by the simulators event handler, to all objects in the battlefield.

4. The simulator class checks for collision between it's local objects and all objects in the battlefield (local and foreign).

5. A new tick event is created and scheduled for some small time in the future.

Page 11: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Battlefield Class• 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

Page 12: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Event 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

Page 13: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Event Class Example

1. Collision event is passed to the event handler by the executive function when it is safe to process.

2. 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).

3. 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.

Page 14: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Object Class

• 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

Page 15: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Object Class (continued)

• 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

Page 16: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Object Class Example1. Simulator federate #1 schedules schedules a new object event for object A at time 1, register's an

object instance for it within the federation, and sends an attribute update for the the object with timestamp 1

2. Simulator federate #2 discovers the object, creates a new object instance, and puts it in a temporary holding place.

3. When requesting a Next Event Request for time 1, federate #2's RTI ambassador delivers the attribute update for object A

4. 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.

5. 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.

Page 17: Distributed Virtual Environment and Simulation Package Stephen Lawrence stevel@cc.gatech.edu

Internals: Visualization

• Display’s all the objects in the federation

• Paces the simulation with wallclock time

• Allows user to send messages to the objects (entities)