VR-Link C# API Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
5.7 - Using DDM

Table of Contents

There are two ways to use Data Distribution Management (DDM) with VR-Link:

The default VR-Link DDM scheme uses a space named BenchmarkGeographicSpace that has two dimensions, X and Y, which correspond, respectively, to longitude and latitude.

Note
This section describes the recommended ways to use DDM with VR-Link. As always, you can also make direct calls to the RTI if you want.

5.7.1 Geographic DDM

The DtEntityPublisher and DtAggregatePublisher can create their own DDM regions on instantiation, and update them based on entity location and velocity. The size of the region depends on velocity. To enable this, turn on geographic DDM in the DtExerciseConn, as follows:

exConn.setUseGeographicDdm(true);

The exercise connection also has a "playbox" that is used to define the minimum and maximum values of latitude and longitude when performing DDM normalization. The region bounds may not exceed those specified by the playbox. The default values cover the entire Earth (-90 to 90 degrees latitude, and -180 to 180 degrees longitude). To change them, for example to the region bounded by 30N–40N latitude and 120E–130E longitude, do the following:

DtGeodeticCoord lowerBound(DtDeg2Rad(30.0), DtDeg2Rad(-130.0), 0);
DtGeodeticCoord upperBound(DtDeg2Rad(40.0, DtDeg2Rad(-120.0), 0);
exConn.setDdmPlayboxLowerBound(lowerBound);
exConn.setDdmPlayboxUpperBound(upperBound);

5.7.2 Publishing Using Geographic DDM

To publish with a geographic region, the DtExerciseConn's setUseGeographicDDM flag must be set to true. When an entity or aggregate publisher is created, the object is published using a region. This region can be accessed and passed to other publishers, to allow them to publish in the same region. For example, suppose an entity is published with a region. To publish an emitter system in the same region, the entity's region can be passed into the emitter publisher's constructor, as follows:

exConn.setUseGeographicDdm(true);
DtEntityPublisher entityPub(...);
DtEmitterSystemPublisher emitterPub(&exConn, 0, entityPub.publishingRegion());

5.7.3 Reflecting Using Geographic DDM

You can create a geographic region and pass it into a reflected list to subscribe to a class with region.

Note
The DtDDMRegion and DtGeodeticRegion classes in VR-Link are passed into methods using Boost's shared pointer container, since many different objects can hold regions concurrently. The types, DtDDMRegionSP and DtGeodeticRegionSP correspond to DtDDMRegion and DtGeodeticRegion shared pointers.

To subscribe to the region spanning 35 to 40 degrees N and 118 to 122 degrees W, do the following:

DtGeodCoord lowerBound(DtDeg2Rad(35.0), DtDeg2Rad(118.0), 0);
DtGeodCoord upperBound(DtDeg2Rad(40.0), DtDeg2Rad(122.0), 0);
DtGeodeticRegionSP region(new DtGeodeticRegion(&exConn));
region->setRegionBounds(lowerBound, upperBound);
DtReflectedEntityList reflEntList(&exConn, region);

If the attribute scope advisory switch is enabled in the RTI, the federate will receive attributesOutOfScope callbacks when an object goes out of scope of the region. The object will be removed from the reflected list and rediscovered if it comes back into scope. To enable the advisory switch, do the following:

exConn.rtiAmb()->enableAttributeScopeAdvisorySwitch();

Notes

5.7.4 Interactions with Regions

VR-Link also lets you send and receive interactions in regions. The add callback member function of each interaction can take a region shared pointer, and DtExerciseConn has a member function to send interactions with regions.

To subscribe with region:

// Set up region bounds
...
DtGeodeticRegionSP region(...);
DtFireInteraction::addCallback(&exConn, fireCb, NULL, region);

To send an interaction with region:

// Set up region bounds
...
DtGeodeticRegionSP region(...);
DtFireInteraction fireInteraction;
...
exConn.sendStampedWithRegion(fireInteraction, region);

5.7.5 Using DDM without VR-Link's Geographic Implementation

You can create any type of region using the DtDDMRegion class. You can specify the space (for HLA 1.3) and dimensions, and DtDDMRegion will create an RTI region that can be manipulated using normalized values. Each publisher, reflected list, and interaction can now take a DtDDMRegion, and will publish or subscribe with whatever DtDDMRegion you pass in.

[<< Ownership Management] [Home] [Top of Page] [Using the DtInteraction Class >>]


Document ID: Generated on Fri Dec 2 02:42:08 EST 2016 from SVN revision 171416
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)