mil.navy.nps.dis
Class FirePdu

java.lang.Object
  extended bymil.navy.nps.dis.PduElement
      extended bymil.navy.nps.dis.ProtocolDataUnit
          extended bymil.navy.nps.dis.FirePdu
All Implemented Interfaces:
java.lang.Cloneable, SerializationInterface

public class FirePdu
extends ProtocolDataUnit

Weapon firing PDU (bang!).

Version:
1.0
Author:
Don McGregor (http://www.npsnet.org/~mcgredo)
Location:
Web: http://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/FirePdu.java
or locally: ~/mil/navy/nps/dis/FirePdu.java
Hierarchy Diagram:
Summary:
The firing of a weapon shall be communicated by issuing a Fire PDU.
Explanation:
The fire pdu denotes the firing of a weapon. It inherits the header information from ProtocolDataUnit, an abstract class that contains assorted protocol information. It implements the IDs of what's firing, what's being shot at, the munition, the event, and where the munition is headed.

As with other PDUs, it knows how to serialize and deserialize itself from the wire. It also knows how to clone itself, and knows how to calculate its size when sent to the wire.

History:
11Dec96 /Don McGregor /New
10Mar97 /Don McGregor /changes for javadoc compliance
16Apr97 /Don McGregor /PrintStream passed to printValues
8Dec97 /Ronan Fauglas /changes for documentation templates + complements in documentation
11Dec97 /Ronan Fauglas /changed access methods: thisVariable() --> getThisVariable()
14Jan97 /Ronan Fauglas /changed position to locationInWorldCoordinate
19Nov99 /Ivan Chang /changes for javadoc compliance
References:
DIS Data Dictionary: Fire PDU (local) and Fire PDU
DIS-Java-VRML Working Group: http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/
DIS specification : IEEE 1278.1, Section 5.4.4.1, 4.4.3.2
Note:
No accessor methods to nested records is provided.
See Also:
ProtocolDataUnit, PduElement, SerializationInterface, DetonationPdu

Field Summary
protected  BurstDescriptor burstDescriptor
          Burst Descriptor - This field shall describe the type of munition fired, the warhead, the fuse, the quantity, and the rate of fire, and shall be represented by a Burst Descriptor record Value: This field shall contain the following: Type of munuition fired Warhead of the munition (if applicable, otherwise, it has a value of zero) Fuse employed by the munition (if applicable, otherwise, it has a value of zero) Quantity and rate at which munition was fired Reference: DIS Data Dictionary: Burst Descriptor Record (local) and Burst Descriptor Record
protected  EventID eventID
          Event Identification - This field shall contain an identification generated by the firing entity to associate related firing and detonation events, and shall be represented by an Event Identifier record Reference: DIS Data Dictionary: Event Identifier Record (local) and Event Identifier Record
protected  UnsignedInt fireMissionIndex
          Fire Mission Index - This field shall identify the fire mission Value: If the fire mission is unknown this field shall contain NO_FIRE_MISSION.
protected  EntityID firingEntityID
          Firing Entity Identification - This field shall identify the firing entity, and shall be represented by an Entity Identifier record Reference: DIS Data Dictionary: Event Identifier (local) and Event Identifier Record
protected  WorldCoordinate locationInWorldCoordinate
          Location in World Coordinate - This field shall specify the location, in world coordinates, from which the munition was launched, and shall be represented by a World Coordinates record Reference: DIS Data Dictionary: World Coordinate Record (local) and World Coordinate Record
protected  EntityID munitionID
          Munition Identification - This field shall specify the entity ID of the fired munition if tracking data is required, and shall be represented by an Entity Identifier record Value: A munition ID shall have a value of MUNITION _NOT_TRACKED if tracking data for the munition is not required.
protected  float range
          This field shall specify the range that an entity's fire control system has assumed in computing the fire control solution.
static int sizeOf
          Constant value--size of Fire PDU with header.
protected  EntityID targetEntityID
          Target Entity Identification - This field shall identify the intended target, and shall be represented by an Entity Identifier record Value: If the intended target is unknown, this field shall contain TARGET_ID_ UNKNOWN.
protected  LinearVelocity velocity
          Velocity - This field shall specify the velocity of the fired munition at the point when the issuing simulation application intends the externally visible effects of the launch (e.g.
 
Fields inherited from class mil.navy.nps.dis.ProtocolDataUnit
DEBUG, exerciseID, pduType, protocolFamily, protocolVersion, timeReceived, timestamp
 
Constructor Summary
FirePdu()
          Default constructor - creates firingEntityID, targetEntityID, munitionID, eventID, fireMissionIndex, locationInWorldCoordinate, and burstDescriptor - fills with zeros for all values of the following parameters: fireMissionIndex, locationInWorldCoordinate, velocity, range
 
Method Summary
 java.lang.Object clone()
          Make a copy of the object.
 void deSerialize(java.io.DataInputStream inputStream)
          Deserialize the input stream, and order is important here, since we need to read in the same order as specified by the DIS standard
 BurstDescriptor getBurstDescriptor()
          Gets the burst descriptor.
 EventID getEventID()
          Gets the event ID The event identification shall be specified by the Event Identifier Record.
 UnsignedInt getFireMissionIndex()
          Gets the fire mission index
 EntityID getFiringEntityID()
          Gets firing entity ID.
 WorldCoordinate getLocationInWorldCoordinate()
          Gets the location in world coordinate vector Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z.
 EntityID getMunitionID()
          Gets the munition ID.
 float getRange()
          Gets the range value.
 EntityID getTargetEntityID()
          Gets target entity ID.
 LinearVelocity getVelocity()
          Gets the linear velocity vector.
 int length()
          Returns the length of the entity
 java.lang.String pduName()
          Returns the PDU name - Fire PDU
 void printValues(int indentLevel, java.io.PrintStream printStream)
          Print the values of the following object out, with correct level of indentation on the page.
 void serialize(java.io.DataOutputStream outputStream)
          Serialize and write out the output stream, order is important here since it needs to conform to the DIS standard
 void setBurstDescriptor(BurstDescriptor pBurstDescriptor)
          Sets the burst descriptor.
 void setEventID(EventID pEventID)
          Sets the event ID The event identification shall be specified by the Event Identifier Record.
 void setFireMissionIndex(int pFireMissionIndex)
          Sets the fire mission index
 void setFireMissionIndex(UnsignedInt pFireMissionIndex)
          Sets the fire mission index
 void setFiringEntityID(EntityID pFiringEntityID)
          Sets firing entity ID Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.
 void setLocationInWorldCoordinate(double pX, double pY, double pZ)
          Sets the location in world coordinate vector (x, y, z).
 void setLocationInWorldCoordinate(WorldCoordinate pWorldCoordinate)
          Sets the location in world coordinate vector Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z.
 void setMunitionID(EntityID pMunitionID)
          Sets the munition ID
 void setRange(float pRange)
          Sets the range value.
 void setTargetEntityID(EntityID pTargetEntityID)
          Sets target entity ID.
 void setVelocity(float pX, float pY, float pZ)
          Sets the linear velocity vector (x, y, z) Each field represents velocity in meters per second in x, y, z vector respectively
 void setVelocity(LinearVelocity pVelocity)
          Sets the linear velocity vector Linear velocity shall be represented as a vector with three component.
 
Methods inherited from class mil.navy.nps.dis.ProtocolDataUnit
byteArrayToPdu, datagramToPdu, debug, getExerciseID, getPaddingOfLength, getPduType, getProtocolFamily, getProtocolVersion, getRtpHeaderEnabled, getTimeReceived, getTimestamp, getVRMLTimestamp, makeTimestampCurrent, setExerciseID, setExerciseID, setPduType, setPduType, setProtocolFamily, setProtocolFamily, setProtocolVersion, setProtocolVersion, setRtpHeaderEnabled, setSimulationStartTime, setTimeReceived, setTimestamp, setTimestamp, stampTimeReceived, toString, trace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

firingEntityID

protected EntityID firingEntityID
Firing Entity Identification - This field shall identify the firing entity, and shall be represented by an Entity Identifier record
Reference:
DIS Data Dictionary: Event Identifier (local) and Event Identifier Record


targetEntityID

protected EntityID targetEntityID
Target Entity Identification - This field shall identify the intended target, and shall be represented by an Entity Identifier record
Value:
If the intended target is unknown, this field shall contain TARGET_ID_ UNKNOWN.
Reference:
DIS Data Dictionary: Event Identifier Record (local) and Event Identifier Record


munitionID

protected EntityID munitionID
Munition Identification - This field shall specify the entity ID of the fired munition if tracking data is required, and shall be represented by an Entity Identifier record
Value:
A munition ID shall have a value of MUNITION _NOT_TRACKED if tracking data for the munition is not required.
Reference:
DIS Data Dictionary: Event Identifier Record (local) and Event Identifier Record


eventID

protected EventID eventID
Event Identification - This field shall contain an identification generated by the firing entity to associate related firing and detonation events, and shall be represented by an Event Identifier record
Reference:
DIS Data Dictionary: Event Identifier Record (local) and Event Identifier Record


fireMissionIndex

protected UnsignedInt fireMissionIndex
Fire Mission Index - This field shall identify the fire mission
Value:
If the fire mission is unknown this field shall contain NO_FIRE_MISSION. This field shall be represented by a 32-bit unsigned integer
Reference:
DIS Data Dictionary: Fire Missile Index Field (local) and Fire Missile Index Field


locationInWorldCoordinate

protected WorldCoordinate locationInWorldCoordinate
Location in World Coordinate - This field shall specify the location, in world coordinates, from which the munition was launched, and shall be represented by a World Coordinates record
Reference:
DIS Data Dictionary: World Coordinate Record (local) and World Coordinate Record


burstDescriptor

protected BurstDescriptor burstDescriptor
Burst Descriptor - This field shall describe the type of munition fired, the warhead, the fuse, the quantity, and the rate of fire, and shall be represented by a Burst Descriptor record
Value:
This field shall contain the following: Type of munuition fired Warhead of the munition (if applicable, otherwise, it has a value of zero) Fuse employed by the munition (if applicable, otherwise, it has a value of zero) Quantity and rate at which munition was fired
Reference:
DIS Data Dictionary: Burst Descriptor Record (local) and Burst Descriptor Record


velocity

protected LinearVelocity velocity
Velocity - This field shall specify the velocity of the fired munition at the point when the issuing simulation application intends the externally visible effects of the launch (e.g. exhaust plume or muzzle blast) to first become apparent. The velocity shall be represented in world coordinates, and shall be represented by a Linear Velocity Vector record
Reference:
DIS Data Dictionary: Linaer Velocity Vector Record (local) and Linear Velocity Vector Record


range

protected float range
This field shall specify the range that an entity's fire control system has assumed in computing the fire control solution. This range is a 3-dimension, straight-line distance.
Value:
This field shall be represented by a 32-bit floating point number in meters. For systems where range is unknown or unavailable, this field shall contain a value of zero.
References:
DIS Data Dictionary: Range Field (local) and Range Field


sizeOf

public static final int sizeOf
Constant value--size of Fire PDU with header. Here: sizeOf = 96 bytes

See Also:
Constant Field Values
Constructor Detail

FirePdu

public FirePdu()
Default constructor - creates firingEntityID, targetEntityID, munitionID, eventID, fireMissionIndex, locationInWorldCoordinate, and burstDescriptor - fills with zeros for all values of the following parameters: fireMissionIndex, locationInWorldCoordinate, velocity, range

Method Detail

clone

public java.lang.Object clone()
Make a copy of the object. This requires a deep copy, so we don't have two objects sharing pointers to the same data.

Overrides:
clone in class ProtocolDataUnit
Returns:
a new Fire PDU entity

serialize

public void serialize(java.io.DataOutputStream outputStream)
Serialize and write out the output stream, order is important here since it needs to conform to the DIS standard

Specified by:
serialize in interface SerializationInterface
Overrides:
serialize in class ProtocolDataUnit
Throws:
java.lang.RuntimeException - when IO error occurs.

deSerialize

public void deSerialize(java.io.DataInputStream inputStream)
Deserialize the input stream, and order is important here, since we need to read in the same order as specified by the DIS standard

Specified by:
deSerialize in interface SerializationInterface
Overrides:
deSerialize in class ProtocolDataUnit
Throws:
java.lang.RuntimeException - when IO error occurs.

length

public int length()
Returns the length of the entity

Overrides:
length in class ProtocolDataUnit
Returns:
an integer length of the entity

pduName

public java.lang.String pduName()
Returns the PDU name - Fire PDU

Specified by:
pduName in class ProtocolDataUnit
Returns:
a string "Fire PDU"

printValues

public void printValues(int indentLevel,
                        java.io.PrintStream printStream)
Print the values of the following object out, with correct level of indentation on the page. firingEntityID, targetEntityID, munitionID, eventID, fireMissionIndex, locationInWorldCoordinate, burstDescriptor, velocity, and range.

Overrides:
printValues in class ProtocolDataUnit

getFiringEntityID

public EntityID getFiringEntityID()
Gets firing entity ID. Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.

Returns:
a clone of the firing entity ID

setFiringEntityID

public void setFiringEntityID(EntityID pFiringEntityID)
Sets firing entity ID Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.

Parameters:
pFiringEntityID - the firing entity ID

getTargetEntityID

public EntityID getTargetEntityID()
Gets target entity ID. Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.

Returns:
a clone of the target entity ID

setTargetEntityID

public void setTargetEntityID(EntityID pTargetEntityID)
Sets target entity ID. Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.

Parameters:
pTargetEntityID - target entity ID value

getMunitionID

public EntityID getMunitionID()
Gets the munition ID. Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record Unique to the exercise.

Returns:
a clone of a munition ID

setMunitionID

public void setMunitionID(EntityID pMunitionID)
Sets the munition ID

Parameters:
pMunitionID - a munition ID

getEventID

public EventID getEventID()
Gets the event ID The event identification shall be specified by the Event Identifier Record. The record shall consist of a Simulation Address Record and an Event Number. The latter is uniquely assigned within the host by the simulation application that initiates the sequence of events. The Event Identifier Record shall be set to one for each exercise and incremented by one for each fire event or collision event. In the case where all possible values are exhausted, the numbers may be reused, beginning at one.

Returns:
a clone of an event ID

setEventID

public void setEventID(EventID pEventID)
Sets the event ID The event identification shall be specified by the Event Identifier Record. The record shall consist of a Simulation Address Record and an Event Number. The latter is uniquely assigned within the host by the simulation application that initiates the sequence of events. The Event Identifier Record shall be set to one for each exercise and incremented by one for each fire event or collision event. In the case where all possible values are exhausted, the numbers may be reused, beginning at one.

Parameters:
pEventID - eventID value

getFireMissionIndex

public UnsignedInt getFireMissionIndex()
Gets the fire mission index

Returns:
a clone an unsigned integer value of fire mission index

setFireMissionIndex

public void setFireMissionIndex(UnsignedInt pFireMissionIndex)
Sets the fire mission index

Parameters:
pFireMissionIndex - an unsigned integer value for fire mission index

setFireMissionIndex

public void setFireMissionIndex(int pFireMissionIndex)
Sets the fire mission index

Parameters:
pFireMissionIndex - an integer value for fire mission index

getLocationInWorldCoordinate

public WorldCoordinate getLocationInWorldCoordinate()
Gets the location in world coordinate vector Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z. The shape of the earth shall be specified using WGS 84. The origin of the world coordinate system shall be the centroid of the earth, with the X-axis passing through the Prime Meridian at the Equator, the Y-axis passing through 90 degrees East longitude at the Equator, and the Z-axis passing through the North pole. These coordinates shall represent meters from the centroid of the earth. A 64-bit double precision floating point number shall represent the location for each coordinate.

Returns:
the location in world coordinates

setLocationInWorldCoordinate

public void setLocationInWorldCoordinate(WorldCoordinate pWorldCoordinate)
Sets the location in world coordinate vector Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z. The shape of the earth shall be specified using WGS 84. The origin of the world coordinate system shall be the centroid of the earth, with the X-axis passing through the Prime Meridian at the Equator, the Y-axis passing through 90 degrees East longitude at the Equator, and the Z-axis passing through the North pole. These coordinates shall represent meters from the centroid of the earth. A 64-bit double precision floating point number shall represent the location for each coordinate.

Parameters:
pWorldCoordinate - the world coordinates

setLocationInWorldCoordinate

public void setLocationInWorldCoordinate(double pX,
                                         double pY,
                                         double pZ)
Sets the location in world coordinate vector (x, y, z). Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z. The shape of the earth shall be specified using WGS 84. The origin of the world coordinate system shall be the centroid of the earth, with the X-axis passing through the Prime Meridian at the Equator, the Y-axis passing through 90 degrees East longitude at the Equator, and the Z-axis passing through the North pole. These coordinates shall represent meters from the centroid of the earth. A 64-bit double precision floating point number shall represent the location for each coordinate.

Parameters:
pX - the X coordinate in world coordinates
pY - the Y coordinate in world coordinates
pZ - the Z coordinate in world coordinates

getBurstDescriptor

public BurstDescriptor getBurstDescriptor()
Gets the burst descriptor. The firing of a round or a burst of ammunition shall be represented by a Burst Descriptor Record. This record shall specify the type of ammunition fired, the type of warhead, the type of fuse, the number of rounds fired, and the rate at which the rounds are fired in rounds per minute.

Returns:
a clone of the burst descriptor record

setBurstDescriptor

public void setBurstDescriptor(BurstDescriptor pBurstDescriptor)
Sets the burst descriptor. The firing of a round or a burst of ammunition shall be represented by a Burst Descriptor Record. This record shall specify the type of ammunition fired, the type of warhead, the type of fuse, the number of rounds fired, and the rate at which the rounds are fired in rounds per minute.

Parameters:
pBurstDescriptor - a burst descriptor record

getVelocity

public LinearVelocity getVelocity()
Gets the linear velocity vector. Linear velocity shall be represented as a vector with three component. Each vector component shall represent velocity in meters per second

Returns:
a clone of the linear velocity vector

setVelocity

public void setVelocity(LinearVelocity pVelocity)
Sets the linear velocity vector Linear velocity shall be represented as a vector with three component. Each vector component shall represent velocity in meters per second

Parameters:
pVelocity - a linear velocity vector

setVelocity

public void setVelocity(float pX,
                        float pY,
                        float pZ)
Sets the linear velocity vector (x, y, z) Each field represents velocity in meters per second in x, y, z vector respectively

Parameters:
pX - the X velocity vector
pY - the Y velocity vector
pZ - the Z velocity vector

getRange

public float getRange()
Gets the range value. This field shall specify the range that an entity's fire control system has assumed in computing the fire control solution. This field shall be represented by a 32bit floating point number in meters. For system where range is unknown or unavailable, this field shall contain a value of zero.

Returns:
a range value

setRange

public void setRange(float pRange)
Sets the range value. This field shall specify the range that an entity's fire control system has assumed in computing the fire control solution. This field shall be represented by a 32bit floating point number in meters. For system where range is unknown or unavailable, this field shall contain a value of zero.

Parameters:
pRange - a range value