WSF
WsfUtil Namespace Reference

A set of utilities that perform generic calculations among WSF objects. More...

Functions

template<typename SYSTEM, typename ATTRIBUTE_TYPE>
bool GetAuxValue (SYSTEM *aSystem, const std::string &aLabel, ATTRIBUTE_TYPE &aValue)
template<typename SYSTEM, typename ATTRIBUTE_TYPE>
bool GetAuxValue (SYSTEM &aSystem, const std::string &aLabel, ATTRIBUTE_TYPE &aValue)
template<class T1, class T2>
double TimeToDestination (T1 &aSource, T2 &aDest, const double aVel[3])
 Calculate the time it would take an object (e.g., a WsfPlatform) to traverse a great circle distance from a source to a destination.
template<class T1, class T2>
double DistanceToDestination (T1 &aSource, T2 &aDest)
 Calculate the great circle distance from a source to a destination.
int WSF_EXPORT CountBitsOn (unsigned int aBitMask)
unsigned int GenerateBitMask (int aNumBits)
void WSF_EXPORT ClosestApproachPoint2D (const double aMoverLocWCS[3], const double aMoverVelWCS[3], const double aTargetLocWCS[3], double aClosestLocWCS[3])
double WSF_EXPORT ClosestApproachPoint3D (const double aMoverLocWCS[3], const double aMoverVelWCS[3], const double aTargetLocWCS[3], double aClosestLocWCS[3])
bool WSF_EXPORT PotentiallyWithinRange (double aSimTime, WsfPlatform *aObject1Ptr, WsfPlatform *aObject2Ptr, double aMaximumRange)
bool WSF_EXPORT TriangulateLocation (const double aOriginWCS_1[3], const double &aBearing1, const double &aElevation1, const double aOriginWCS_2[3], const double &aBearing2, const double &aElevation2, double aLocationWCS[3])
void WSF_EXPORT ConvertRangeBearing (const double aFromLocationWCS[3], UtEntity *aToEntity, double &aRange, double &aBearing)
void WSF_EXPORT ErrorNED (double aRange, double aBearing, double aElevation, double aRangeError, double aBearingError, double aElevationError, double aErrorNED[3])
void WSF_EXPORT ErrorNED (double aRange, double aBearing, double aRangeError, double aBearingError, double aErrorNED[3])
int WSF_EXPORT TrackIdToInt (const WsfTrackId &aTrackId)
WsfTrackId WSF_EXPORT IntToTrackId (int aIntTrackId)
void WSF_EXPORT CovarianceToEllipse_2x2 (std::vector< double > &aMatrix, double &aSemiMajorAxis, double &aSemiMinorAxis, double &aBearingRad)
double WSF_EXPORT BallisticPropagate (const UtVec3d &aLocationWCS, const UtVec3d &aVelocityWCS, double aStopAltitude, UtVec3d &aPropagatedLocationWCS, UtVec3d &aPropagatedVelocityWCS)
void WSF_EXPORT MakeTrack (double aSimTime, WsfTrack &aTrack, WsfPlatform &aTarget, WsfPlatform &aSource)
 Fill a track with truth information on aTarget with aSource as the track source.
void WSF_EXPORT GetErrorEstimateLLA_SpeedHeading (const WsfTrack &aTrack, unsigned short &aValidity, double &aStDevLat, double &aStDevLon, double &aStDevAlt, double &aStDevSpeed, double &aStDevHeading)
void WSF_EXPORT PrintLLA (const std::string &aLabel, double aLocationWCS[3])
 Calls PrintLLA() for the LLA representation of aLocationWCS.
void WSF_EXPORT PrintLLA (const std::string &aLabel, double aLat, double aLon, double aAlt)
void WSF_EXPORT PrintLength (const std::string &aLabel, double aLength)
template<class T1, class T2>
double SlantRange (T1 &aSource, T2 &aDest)
 Calculate the slant range distance from a source to a destination (second parameter is const).

Variables

static const unsigned short cLLA_ERROR_VALID = 0x01
 Validity Masks associated with the "aValidity" parameter in the following method:
static const unsigned short cSPEED_ERROR_VALID = 0x02
static const unsigned short cHEADING_ERROR_VALID = 0x04

Detailed Description

A set of utilities that perform generic calculations among WSF objects.

Function Documentation

◆ BallisticPropagate()

double WsfUtil::BallisticPropagate ( const UtVec3d & aLocationWCS,
const UtVec3d & aVelocityWCS,
double aStopAltitude,
UtVec3d & aPropagatedLocationWCS,
UtVec3d & aPropagatedVelocityWCS )

Computes a simple ballistic projection from a starting location and velocity until falling below an altitude. Does NOT consider drag.

Parameters
aLocationWCSStarting location in WCS
aVelocityWCSStarting velocity in WCS
aStopAltitudeAltitude below which propagation is halted
aPropagatedLocationWCSResulting location in WCS
aPropagatedVelocityWCSResulting velocity in WCS
Returns
Seconds until reaching the desired altitude

◆ ClosestApproachPoint2D()

void WsfUtil::ClosestApproachPoint2D ( const double aMoverLocWCS[3],
const double aMoverVelWCS[3],
const double aTargetLocWCS[3],
double aClosestLocWCS[3] )

Compute the horizontal point of closest approach of a moving object to a given point. Given the location and velocity of a moving object and determine the horizontal point of closest approach to a given target location. This algorithm only solves the problem in the horizontal plane.

Parameters
aMoverLocWCS[input] The WCS location of the moving object.
aMoverVelWCS[input] The WCS velocity of the moving object.
aTargetLocWCS[input] The WCS location of the target.
aClosestLocWCS[output] The WCS location of the moving object at its point of closest approach.
Note
If the velocity of the mover is zero or if the points are coincident then location of the mover will be returned.

Referenced by UT_DEFINE_SCRIPT_METHOD().

◆ ClosestApproachPoint3D()

double WsfUtil::ClosestApproachPoint3D ( const double aMoverLocWCS[3],
const double aMoverVelWCS[3],
const double aTargetLocWCS[3],
double aClosestLocWCS[3] )

Compute the point of closest approach of a moving object at a given velocity.

Parameters
aMoverLocWCS[input] The WCS location of the moving object.
aMoverVelWCS[input] The WCS velocity of the moving object.
aTargetLocWCS[input] The WCS location of the static target.
aClosestLocWCS[output] The WCS location of the moving object at its point of closest approach.
Returns
Time in seconds when the closest point is reached. Returns -1 if the velocity is zero.
Note
If the velocity of the mover is zero then the location of the mover will be returned.

◆ ConvertRangeBearing()

void WsfUtil::ConvertRangeBearing ( const double aFromLocationWCS[3],
UtEntity * aToEntityPtr,
double & aRange,
double & aBearing )

Given an origin WCS location, range, and bearing, return the range and bearing from the given entity.

◆ CountBitsOn()

int WsfUtil::CountBitsOn ( unsigned int aBitMask)

Count the number of bits on in a bit mask

Parameters
aBitMaskThe bit mask to be tested.
Returns
The number of bits on in the bit mask.

Referenced by WsfPlatform::ScriptOverride(), WsfDefaultSensorTracker::TargetDeleted(), WsfDefaultSensorTracker::TargetDetected(), and WsfDefaultSensorTracker::TargetSkipped().

◆ CovarianceToEllipse_2x2()

void WsfUtil::CovarianceToEllipse_2x2 ( std::vector< double > & aMatrix,
double & aSemiMajorAxis,
double & aSemiMinorAxis,
double & aBearingRad )

Given a 2x2 covariance matrix (in the form of a std::vector<double>), compute the semi-major axis, semi-minor axis, and bearing, in radians, of the associated error ellipse measured clockwise from north (y-axis).

Parameters
aMatrixThe covariance matrix in std::vector<double> form.
aSemiMajorAxisThe semi-major axis of the error ellipse.
aSemiMinorAxisThe semi-minor axis of the error ellipse.
aBearingRadThe bearing, in radians, of the semi-major axis measured clockwise from north (y-axis).
Note
e.g., Ref. http://www.math.harvard.edu/archive/21b_fall_04/exhibits/2dmatrices/index.html

References c1.

Referenced by wsf::event::utils::PrintTrackCovarianceData(), and wsf::event::utilsCSV::PrintTrackCovarianceData().

◆ DistanceToDestination()

template<class T1, class T2>
double WsfUtil::DistanceToDestination ( T1 & aSource,
T2 & aDest )

Calculate the great circle distance from a source to a destination.

Parameters
aSourceThe source object (non-const; typically a WsfPlatform or UtEntity).
aDestThe destination object.
Note
'aSource' and 'aDest' must be of types that implement the method GetLocationLLA( double& lat, double& lon, double& alt) (e.g., WsfPlatform::GetLocationLLA).
Returns
The great circle distance between 'source' and 'destination.'

Referenced by TimeToDestination().

◆ ErrorNED() [1/2]

void WsfUtil::ErrorNED ( double aRange,
double aBearing,
double aElevation,
double aRangeError,
double aBearingError,
double aElevationError,
double aErrorNED[3] )

Given a range, bearing, elevation, and associated errors, compute the associated NED error.

◆ ErrorNED() [2/2]

void WsfUtil::ErrorNED ( double aRange,
double aBearing,
double aRangeError,
double aBearingError,
double aErrorNED[3] )

Given a range and bearing, and associated errors, compute the associated NED error. This version of the method will return a D error of the input range.

◆ GenerateBitMask()

unsigned int WsfUtil::GenerateBitMask ( int aNumBits)
inline

Form a bit mask with specified number of least-significant bits on.

Parameters
aNumBitsThe number of bits to be on.
Returns
The resulting mask.

Referenced by WsfPlatform::GetAppearance(), WsfExchange::IsCapable(), WsfSensorMode::ProcessInput(), WsfPlatform::ScriptOverride(), WsfPlatform::SetAppearance(), and WsfExchange::SetCapabilityFlag().

◆ GetAuxValue() [1/2]

template<typename SYSTEM, typename ATTRIBUTE_TYPE>
bool WsfUtil::GetAuxValue ( SYSTEM & aSystem,
const std::string & aLabel,
ATTRIBUTE_TYPE & aValue )
inline

References GetAuxValue().

◆ GetAuxValue() [2/2]

template<typename SYSTEM, typename ATTRIBUTE_TYPE>
bool WsfUtil::GetAuxValue ( SYSTEM * aSystem,
const std::string & aLabel,
ATTRIBUTE_TYPE & aValue )
inline

◆ GetErrorEstimateLLA_SpeedHeading()

void WsfUtil::GetErrorEstimateLLA_SpeedHeading ( const WsfTrack & aTrack,
unsigned short & aValidity,
double & aStDevLat,
double & aStDevLon,
double & aStDevAlt,
double & aStDevSpeed,
double & aStDevHeading )

Given a track with valid location and covariance, provide estimates of error in location (lat, lon, alt), as well as speed, and heading of the target. If the covariance is 3x3, only the location errors are will be valid. A validity bit-field is passed as a parameter to determine which of the outputs are valid. The masks for this field are defied in the WsfUtil header: WsfUtil::cLLA_ERROR_VALID = 0x01 WsfUtil::cSPEED_ERROR_VALID = 0x02 WsfUtil::cHEADING_ERROR_VALID = 0x04

Parameters
aTrackThe track that is the source of the data being evaluated (position, velocity, and covariance).
aStDevLatThe estimated latitude error of the track location, in degreees.
aValidityThe bit-field that indicates the validitity of the return values.
aStDevLonThe estimated longitude error of the track location, in degrees.
aStDevAltThe estimated altitude error of the track location, in meters.
aStDevSpeedThe estimated error in the track's speed (magnitude of velocity estimate), in meters per second.
aStDevHeadingThe estimated error of the track's heading (arctan of east velocity component divided by north velocity component), in degrees.
Returns
true for a 6x6 covariance matrix, false for a 3x3 or unrecognized size matrix.

References cHEADING_ERROR_VALID, cLLA_ERROR_VALID, and cSPEED_ERROR_VALID.

◆ IntToTrackId()

WsfTrackId WsfUtil::IntToTrackId ( int aIntTrackId)

Given an integer track id, compute a WSF track id. It is assumed that the argument was initially computed by the WsfUtil::ToInt method; otherwise the returned track id will not have meaning to an WSF simulation.

Note
This algorithm returns unique numbers only for track numbers < 65535. This method should be used as a convenience for interfacing with software that expects integer track numbers.

◆ MakeTrack()

◆ PotentiallyWithinRange()

bool WsfUtil::PotentiallyWithinRange ( double aSimTime,
WsfPlatform * aObject1Ptr,
WsfPlatform * aObject2Ptr,
double aMaximumRange )

Perform a very conservative check to see if two objects are within a defined interaction range.

This method is called by various 'device' objects (sensors, interferers, etc.) to determine if two platforms are POTENTIALLY within the interaction range of the device. It is basically a fast culling check that is used to prevent more expensive calculations that may be unnecessary.

Judicious use of this method can reduce computation time.

Parameters
aSimTimeThe current simulation time.
aObject1PtrPointer to the first platform.
aObject2PtrPointer to the second platform.
aMaximumRangeThe declared maximum interaction range.
Returns
true if there is even a remote possibility that the objects can interact.

References deltaTime, WsfPlatform::GetLastUpdateTime(), and WsfPlatform::Update().

Referenced by WsfSensorMode::WithinDetectionRange().

◆ PrintLength()

void WsfUtil::PrintLength ( const std::string & aLabel,
double aLength )

Prints out a length value in meters and feet on a single line prepended by a label. used for debug output.

◆ PrintLLA() [1/2]

void WsfUtil::PrintLLA ( const std::string & aLabel,
double aLat,
double aLon,
double aAlt )

Prints out lat,lon,alt in both DMS and D formats as an info message. Used for debug output.

◆ PrintLLA() [2/2]

void WsfUtil::PrintLLA ( const std::string & aLabel,
double aLocationWCS[3] )

Calls PrintLLA() for the LLA representation of aLocationWCS.

References PrintLLA().

Referenced by PrintLLA().

◆ SlantRange()

template<class T1, class T2>
double WsfUtil::SlantRange ( T1 & aSource,
T2 & aDest )

Calculate the slant range distance from a source to a destination (second parameter is const).

Parameters
aSourceThe source object (non-const; typically a WsfPlatform or UtEntity).
aDestThe destination object.
Note
'aSource' and 'aDest' must be of types that implement the method GetLocationWCS( double[3]) (e.g., WsfPlatform::GetLocationWCS).
Returns
The slant range distance between 'source' and 'destination.'

Referenced by WsfThreatProcessor::IsThreatening().

◆ TimeToDestination()

template<class T1, class T2>
double WsfUtil::TimeToDestination ( T1 & aSource,
T2 & aDest,
const double aVel[3] )

Calculate the time it would take an object (e.g., a WsfPlatform) to traverse a great circle distance from a source to a destination.

Parameters
aSourceThe source object.
aDestThe destination object.
aVelvelocity vector for the source object.
Note
'aSource' and 'aDest' must be of types that implement the method GetLocationLLA( double& lat, double& lon, double& alt) (e.g., WsfPlatform::GetLocationLLA).
Returns
The time required to reach the given destination.

References DistanceToDestination().

Referenced by UT_DEFINE_SCRIPT_METHOD().

◆ TrackIdToInt()

int WsfUtil::TrackIdToInt ( const WsfTrackId & aTrackId)

Given a WSF track id, compute a unique single integer.

Note
This algorithm returns unique numbers only for track numbers < 65535. This method should be used as a convenience for interfacing with software that expects integer track numbers.

References WsfTrackId::GetLocalTrackNumber(), and WsfTrackId::GetOwningPlatformId().

Referenced by MTT_PerceivedCluster::CopyFrom(), and WsfMTT_Correlation::CorrelateImpl().

◆ TriangulateLocation()

bool WsfUtil::TriangulateLocation ( const double aOriginWCS_1[3],
const double & aBearing1,
const double & aElevation1,
const double aOriginWCS_2[3],
const double & aBearing2,
const double & aElevation2,
double aLocationWCS[3] )

Compute a triangulated position based on two valid azimuth/elevation measurements.

Parameters
aOriginWCS_1The WCS origin of the first measurement.
aBearing1The bearing measurement of the target from the first sensor.
aElevation1The elevation measurement of the target from the first sensor.
aOriginWCS_2The WCS origin of the first measurement.
aBearing2The bearing measurement of the target from the first sensor.
aElevation2The elevation measurement of the target from the first sensor.
aLocationWCSThe computed triangulated position. TODO The algorithm currently only utilized the second elevation measurement. review the paper to ensure the triangulation is as accurate as possible.

Variable Documentation

◆ cHEADING_ERROR_VALID

const unsigned short WsfUtil::cHEADING_ERROR_VALID = 0x04
static

◆ cLLA_ERROR_VALID

const unsigned short WsfUtil::cLLA_ERROR_VALID = 0x01
static

Validity Masks associated with the "aValidity" parameter in the following method:

Referenced by GetErrorEstimateLLA_SpeedHeading().

◆ cSPEED_ERROR_VALID

const unsigned short WsfUtil::cSPEED_ERROR_VALID = 0x02
static
Copyrights Multiple, All Rights Reserved