![]() |
VR-Forces 4.8 Class Documentation
|
You can publish state properties to the network using either HLA or DIS.
How the data is published depends on how you define it in your OPE. The following example OPE definitions are used to illustrate each of the cases in the following sections.
In DIS 7, state properties are specified in attribute records within an Attribute PDU associated with the entity, aggregate, or environmental process. If you are using an earlier version of DIS, the DIS 7 Attribute PDU is still used. This is used as a non-standard extension to the DIS 6 and earlier standards, as there is no other standard way to include such extensions. Please refer to the IEEE 1278.1-2012 standard for more details on how attribute records are used.
The attribute record is encoded based on how it was defined in the OPE file. Using the state properties defined above as an example, VR-Forces would encode this data in the following ways.
StatePropA is not specified with the publish flag. This means that this property is only a local property and will not be published to the network.
StatePropB and StatePropC are both specified with the publish flag. As a result, these properties will both be encoded within an attribute record for this object. The record type used will be VR-Forces' custom attribute record type, which by default has a type ID value of 252000. Therefore the encoding of the attribute for StatePropB will look like this. (Refer to the Supported Data Types table below for description of how different data types will be encoded.)
| Encoding StatePropB | ||
|---|---|---|
| Value | Field Name | Size |
| 252000 | Record Type | 32 bits |
| 24 | Record Length (in bytes) | 16 bits |
| 10 | Name Length (in bytes) | 16 bits |
| 4 | Data Length (in bytes) | 16 bits |
| "StatePropB" | Property Name | 10 bytes (length of string) |
| 10 | Property Value | 32 bits (size of DtRwInt) |
| 0 | Padding | 0 bits (align to 64 bits - no padding needed in this case) |
StatePropD is specified with the publish flag, but in addition a record type is also specified. When a record type is specified, VR-Forces will associate this record type with the name property. This means that whenever an attribute with that record type is received, the associated property is updated. This means that the name of the property does not need to be included in the record. This also allows you define properties in your OPE that match the formats of well defined DIS attribute records and have them published in a way that any DIS standard application that supports those record types can understand. The encoding of the attribute for StatePropD will look like this.
| Encoding StatePropD | ||
|---|---|---|
| Value | Field Name | Size |
| 100610 | Record Type | 32 bits |
| 16 | Record Length (in bytes) | 16 bits |
| 30 | Property Value | 32 bits (size of DtRwInt) |
| 0 | Padding | 0 bits (align to 64 bits)) |
In HLA, state properties are published in object attributes. There are a few ways this can happen, depending on whether and how an attribute is defined in the FOM. If possible, VR-Forces will attempt to publish state properties directly within FOM attributes with matching names. This allows you to extend your FOM with new attributes, add new state properties to the OPE file, and VR-Forces will automatically match these up and publish your new attributes. If your attributes are added directly within existing RPR FOM classes, for example by adding a new attribute directly to the Platform class, then VR-Forces will discover and use these attributes. If your attributes are added to a subclass of an existing RPR FOM class, for example by adding MyAircraft as a subclass of the Aircraft class, then you must tell VR-Forces to publish this class in the OPE using the hla-fom-class parameter.
(hla-fom-class "BaseEntity.PhysicalEntity.Platform.Aircraft.MyAircraft")
When this is not possible, VR-Forces uses a custom FOM class added as an extension to the RPR FOM to encode any remaining properties. This is the VrfExtendedAttributes class. It can be associated with PhysicalEntity, AggregateEntity, and EnvironmentProcess objects by using its AssociatedObjectIdentifier attribute to reference one of these objects.
As an example, we define the above state properties in our OPE file and indicate that we should be publishing the MyAircraft object class using the hla-fom-class parameter. We then define the following attributes in our FOM.
StatePropB is added to the MyAircraft class. StatePropC is added to the VrfExtendedAttributes class.
VR-Forces would then publish these properties as described below.
StatePropA is not specified with the publish flag. This means that this property is only a local property and will not be published to the network. This will be true even if an attribute named StatePropA can be found in the FOM.
StatePropB is specified with the publish flag. Since we are publishing a MyAircraft object, VR-Forces will look for any new attributes defined in MyAircraft or its parent classes. It will find a matching attribute called StatePropB in the MyAircraft class. StatePropeB will be published in this attribute and encoded as an HLAinteger32BE. (Refer to the Supported Data Types table below for description of how different data types will be encoded.)
StatePropC is specified with the publish flag. VR-Forces looks for any new attributes defined in MyAircraft or its parent classes that match this property name, but it is unable to find any. It then decides to publish this attribute as part of a VrfExtendedAttributes object. A new VrfExtendedAttributes object is then created and associated with the MyAircraft object. VR-Forces then checks the VrfExtendedAttributes class definition and finds that there is an attribute named StatePropC defined in this class. StatePropC will be published in this attribute and encoded as an HLAinteger32BE.
StatePropD is specified with the publish flag. VR-Forces tries to find matching attributes in MyAircraft and its parent classes and then in VrfExtendedAttributes, but it fails to find any. Since a VrfExtendedAttributes object has already been associated with MyAircraft, StatePropD is added to the list of properties published in the ExtendedAttributes attribute of this object. This attribute is simply a list of properties by name.
[<< Getting and Setting User-Created State Property Values] [Home] [Top of Page] [Process State Repositories >>]