WSF
WsfAssetPerception.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFASSETPERCEPTION_HPP
13#define WSFASSETPERCEPTION_HPP
14
15#include "wsf_mil_export.h"
16
17class WsfLocalTrack;
18#include "WsfObject.hpp"
19class WsfPlatform;
21class WsfSensor;
22#include "WsfTaskResource.hpp"
23class WsfWeapon;
24
31class WSF_MIL_EXPORT WsfAssetPerception : public WsfObject
32{
33public:
35 {
36 public:
38 AssetSystem(WsfWeapon& aWeapon);
39 AssetSystem(WsfSensor& aSensor);
40 AssetSystem(AssetSystem& aSrc, unsigned int aReady, double aQuantity);
41
42 // cTASK_RESOURCE_TYPE_SENSOR, cTASK_RESOURCE_TYPE_WEAPON, cTASK_RESOURCE_TYPE_JAMMER,
43 // cTASK_RESOURCE_TYPE_PROCESSOR, cTASK_RESOURCE_TYPE_UPLINK, cTASK_RESOURCE_TYPE_NONE
45 WsfStringId mSystemType{"<type>"}; // WSF type definition (like "RADAR_MISSILE")
46 WsfStringId mSystemName{"<name>"}; // WSF object name
47 unsigned int mReadyAssignment{0U}; // similar to "channels" or "available request count", represents number of
48 // tasks this system can still receive
49 double mQuantityRemaining{0.0};
50 };
51
55 WsfAssetPerception(const WsfAssetPerception& aSrc, const AssetSystem& aSys);
56 WsfAssetPerception(double aSimTime, WsfPlatform& aPlatform);
57 WsfAssetPerception* Clone() const override { return new WsfAssetPerception(*this); }
58
59 const char* GetScriptClassName() const override { return "WsfAssetPerception"; }
60 bool operator<(const WsfAssetPerception& aRhs) const { return (mIndex < aRhs.mIndex); }
61 bool operator==(const WsfAssetPerception& aRhs) const;
62 operator int() { return (int)mIndex; }
63 operator const int() const { return (int)mIndex; }
64 operator size_t() { return mIndex; }
65 operator const size_t() const { return mIndex; }
66
67 size_t mIndex; // unique simulation platform index
68 double mTime; // seconds
69 double mLocationWCS[3]; // Meters
70 double mVelocityWCS[3]; // Meters / Second
71 double mOrientationNED[3]; // Radians (heading, pitch, roll)
72
73 std::vector<AssetSystem> mSystems;
74};
75
76
77class WSF_MIL_EXPORT WsfSortedPerception
78{
79public:
80 WsfSortedPerception(WsfPlatform* aPlatform, WsfPlatform* aReference);
81 WsfSortedPerception(WsfLocalTrack* aTrack, WsfPlatform* aReference);
83
84 WsfSortedPerception(WsfPlatform* aPlatform, double distance);
85 WsfSortedPerception(WsfLocalTrack* aTrack, double distance);
86 WsfSortedPerception(WsfAssetPerception* aAsset, double distance);
87
88 inline bool operator<(const WsfSortedPerception& aRhs) const { return (mDistance < aRhs.mDistance); }
89
90 double mDistance;
94};
95
96
100{
101public:
102 WsfScriptAssetPerceptionClass(const std::string& aClassName, UtScriptTypes* aTypesPtr);
103 ~WsfScriptAssetPerceptionClass() override = default;
104
105 void* Create(const UtScriptContext& aInstance) override;
106 void* Clone(void* aObjectPtr) override;
107 void Destroy(void* aObjectPtr) override;
108 std::string ToString(void* aObjectPtr) const override;
109 bool LessThan(void* aLHS, void* aRHS) override;
110 void OnNewScriptRef(UtScriptRef& aReference) override;
111
112 UT_DECLARE_SCRIPT_METHOD(Index); // truth data - platform simulation index
114
115 UT_DECLARE_SCRIPT_METHOD(Location); // WsfGeoPoint (can get LLA or WCS from geo point)
116 UT_DECLARE_SCRIPT_METHOD(VelocityWCS); // meters/second
117 UT_DECLARE_SCRIPT_METHOD(VelocityNED); // meters/second
118 UT_DECLARE_SCRIPT_METHOD(Speed); // meters/second
119 UT_DECLARE_SCRIPT_METHOD(OrientationNED); // degrees
120 UT_DECLARE_SCRIPT_METHOD(OrientationWCS); // degrees
121 UT_DECLARE_SCRIPT_METHOD(Heading); // degrees
122 UT_DECLARE_SCRIPT_METHOD(Pitch); // degrees
123 UT_DECLARE_SCRIPT_METHOD(Roll); // degrees
124
125 // UT_DECLARE_SCRIPT_METHOD(Fuel);
126 // UT_DECLARE_SCRIPT_METHOD(Sensor);
127 // UT_DECLARE_SCRIPT_METHOD(SensorCount);
128 // UT_DECLARE_SCRIPT_METHOD(SensorEntry);
129 // UT_DECLARE_SCRIPT_METHOD(Weapon);
130 // UT_DECLARE_SCRIPT_METHOD(WeaponCount);
131 // UT_DECLARE_SCRIPT_METHOD(WeaponEntry);
133 UT_DECLARE_SCRIPT_METHOD(SystemKind); // system at index
134 UT_DECLARE_SCRIPT_METHOD(SystemType); // system at index
135 UT_DECLARE_SCRIPT_METHOD(SystemName); // system at index
136 UT_DECLARE_SCRIPT_METHOD(SystemReadyAssignment); // system at index
137 UT_DECLARE_SCRIPT_METHOD(SystemQuantityRemaining); // system at index
138
139 UT_DECLARE_SCRIPT_METHOD(InterceptLocation);
140 UT_DECLARE_SCRIPT_METHOD(TrueBearingTo); // degrees
141 UT_DECLARE_SCRIPT_METHOD(RelativeBearingTo); // degrees
142 UT_DECLARE_SCRIPT_METHOD(ClosestApproachOf);
144};
145
146#endif
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
@ cTASK_RESOURCE_TYPE_NONE
resource is not set
Definition WsfTaskResource.hpp:23
Definition WsfAssetPerception.hpp:35
AssetSystem()
Definition WsfAssetPerception.cpp:76
WsfStringId mSystemType
Definition WsfAssetPerception.hpp:45
unsigned int mSystemKind
Definition WsfAssetPerception.hpp:44
double mQuantityRemaining
Definition WsfAssetPerception.hpp:49
WsfStringId mSystemName
Definition WsfAssetPerception.hpp:46
unsigned int mReadyAssignment
Definition WsfAssetPerception.hpp:47
Definition WsfAssetPerception.hpp:32
WsfAssetPerception * Clone() const override
Definition WsfAssetPerception.hpp:57
size_t mIndex
Definition WsfAssetPerception.hpp:67
double mVelocityWCS[3]
Definition WsfAssetPerception.hpp:70
const char * GetScriptClassName() const override
Definition WsfAssetPerception.hpp:59
bool operator<(const WsfAssetPerception &aRhs) const
Definition WsfAssetPerception.hpp:60
double mOrientationNED[3]
Definition WsfAssetPerception.hpp:71
double mTime
Definition WsfAssetPerception.hpp:68
double mLocationWCS[3]
Definition WsfAssetPerception.hpp:69
WsfAssetPerception & operator=(const WsfAssetPerception &)=delete
WsfAssetPerception()
Definition WsfAssetPerception.cpp:145
std::vector< AssetSystem > mSystems
Definition WsfAssetPerception.hpp:73
Definition WsfLocalTrack.hpp:32
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
void Destroy(void *aObjectPtr) override
Definition WsfAssetPerception.cpp:334
UT_DECLARE_SCRIPT_METHOD(SystemReadyAssignment)
UT_DECLARE_SCRIPT_METHOD(OrientationWCS)
WsfScriptAssetPerceptionClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfAssetPerception.cpp:286
UT_DECLARE_SCRIPT_METHOD(SystemCount)
UT_DECLARE_SCRIPT_METHOD(InterceptLocation)
UT_DECLARE_SCRIPT_METHOD(SystemQuantityRemaining)
~WsfScriptAssetPerceptionClass() override=default
UT_DECLARE_SCRIPT_METHOD(VelocityWCS)
UT_DECLARE_SCRIPT_METHOD(TrueBearingTo)
UT_DECLARE_SCRIPT_METHOD(ClosingSpeedOf)
UT_DECLARE_SCRIPT_METHOD(ClosestApproachOf)
UT_DECLARE_SCRIPT_METHOD(RelativeBearingTo)
bool LessThan(void *aLHS, void *aRHS) override
Definition WsfAssetPerception.cpp:371
void OnNewScriptRef(UtScriptRef &aReference) override
Definition WsfAssetPerception.cpp:379
UT_DECLARE_SCRIPT_METHOD(OrientationNED)
std::string ToString(void *aObjectPtr) const override
Definition WsfAssetPerception.cpp:340
UT_DECLARE_SCRIPT_METHOD(VelocityNED)
void * Create(const UtScriptContext &aInstance) override
Definition WsfAssetPerception.cpp:322
WsfScriptObjectClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfScriptObjectClass.cpp:24
Definition WsfSensor.hpp:92
WsfLocalTrack * mTrackPtr
Definition WsfAssetPerception.hpp:92
double mDistance
Definition WsfAssetPerception.hpp:90
WsfPlatform * mPlatformPtr
Definition WsfAssetPerception.hpp:91
WsfSortedPerception(WsfPlatform *aPlatform, WsfPlatform *aReference)
Definition WsfAssetPerception.cpp:228
WsfAssetPerception * mAssetPtr
Definition WsfAssetPerception.hpp:93
bool operator<(const WsfSortedPerception &aRhs) const
Definition WsfAssetPerception.hpp:88
Definition WsfWeapon.hpp:63
Copyrights Multiple, All Rights Reserved