WSF
WsfWeaponFuse.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 WSFWEAPONFUSE_HPP
13#define WSFWEAPONFUSE_HPP
14
15#include "wsf_mil_export.h"
16
17#include <memory>
18#include <string>
19
20#include "UtAtmosphere.hpp"
21class UtInput;
22class UtScriptClass;
23class UtScriptTypes;
24#include "WsfCategoryList.hpp"
25class WsfPlatform;
27class WsfTrack;
28#include "WsfTrackId.hpp"
29
30namespace wsf
31{
32class Terrain;
33}
34
52
53class WSF_MIL_EXPORT WsfWeaponFuse : public WsfScriptProcessor
54{
55public:
63
72
85
91
92 WsfWeaponFuse(WsfScenario& aScenario);
93 WsfWeaponFuse(const WsfWeaponFuse& aSrc);
94 ~WsfWeaponFuse() override;
96
97 static std::unique_ptr<UtScriptClass> CreateScriptClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
98
99 const char* GetScriptClassName() const override { return "WsfWeaponFuse"; }
100
101 WsfProcessor* Clone() const override;
102 bool Initialize(double aSimTime) override;
103 bool Initialize2(double aSimTime) override;
104 bool ProcessInput(UtInput& aInput) override;
105 void Update(double aSimTime) override;
106
107 void Detonate(double aSimTime);
108 void Arm(double aSimTime);
109
111 Reason GetReason() const { return mReason; }
112
114 double GetMaximumTimeOfFlight() const { return mMaxTOF; }
115 SpeedCriteria GetSpeedCriteria() const { return mMinSpeedCriteria; }
116 double GetMinSpeedLimit() const { return mMinSpeedLimit; }
117 AltCriteria GetMSL_Criteria() const { return mMSL_Criteria; }
118 AltCriteria GetAGL_Criteria() const { return mAGL_Criteria; }
119 double GetAGL_Limit() const { return mAGL_Limit; }
120 double GetMSL_Limit() const { return mMSL_Limit; }
121 double GetTimeOfFlightToArm() const { return mTOF_ToArm; }
122
124 //@
125 void SetAirToGroundMode(bool aValue);
126 void SetAGL_Criteria(AltCriteria aCriteria, double aAltAGL);
127 void SetMSL_Criteria(AltCriteria aCriteria, double aAltMSL);
128 void SetTargetName(WsfStringId aNameId);
129 void SetUseCurrentTarget(bool aValue);
130 void SetGrossProximityRange(double aRange) { mGrossProximityRange = aRange; }
131 void SetHitProximityRange(double aRange) { mHitProximityRange = aRange; }
132 void SetGrossUpdateInterval(double aInterval) { mGrossUpdateInterval = aInterval; }
133 void SetFineUpdateInterval(double aInterval);
134 void SetTOFToArm(double aTOF) { mTOF_ToArm = aTOF; }
136
137protected:
147
148 void CheckForDetonation(double aSimTime);
149 virtual void PrivateDetonate(double aSimTime);
150 void PrintDetonationReason(double aSimTime);
151 bool ProcessAltAGL(double aSimTime);
152 bool ProcessAltMSL(double aSimTime);
153 void ProcessMinSpeed(double aSimTime);
154 bool ProcessProximity(double aSimTime);
155
156 bool CheckAllTargets(double aSimTime);
157
158 double ComputeGrossProximityRange(const double aTgtVelWCS[3]) const;
159
160 double ComputeTimeToPCAorFuse(const double aTgtLocWCS[3], const double aTgtVelWCS[3]) const;
161
162 void SelectPCA_ForDetonation(double aSimTime,
163 WsfPlatform* aTgtPtr,
164 const double aTgtLocWCS[3],
165 const double aTgtVelWCS[3],
166 double aTimeToPCA,
167 double aMissDistanceLimit);
168
169 void ShowPCA_Results(double aSimTime,
170 WsfPlatform* aTgtPtr,
171 const double aTgtLocWCS[3],
172 const double aTgtVelWCS[3],
173 double aTimeToPCA) const;
174
175 bool UpdateTargetState(double aSimTime);
176 void UpdateWeaponState(double aSimTime);
177
178 void PermanentlyArrestMotion(double aSimTime);
179
180
181private:
183
184 TargetLossOption mTargetLossOption;
185 AltCriteria mMSL_Criteria;
186 AltCriteria mAGL_Criteria;
187 SpeedCriteria mMinSpeedCriteria;
188
189 WsfStringId mTgtNameId;
190 bool mUseCurTgtOnly;
191 bool mATG_Mode;
192 OnIntercept mOnIntercept; // defaulted to cACTION_DETONATE.
193
194 double mGrossUpdateInterval;
195 double mFineUpdateInterval;
196 double mGrossProximityRange;
197 double mHitProximityRange;
198 double mFuseFunctionRange; // mandatory detonation upon approaching
199
200 double mMSL_Limit;
201 double mAGL_Limit;
202 double mMinSpeedLimit;
203 double mTOF_ToArm;
204 double mMaxTOF;
205 double mCoastTime;
206 WsfCategoryList mInvincibleCats;
208
211
212
213 // General dynamic data.
214
215 wsf::Terrain* mTerrainPtr;
216 Reason mReason;
217 //
218 // The following two variables define the minimum and maximum time offsets from PCA
219 // when a hit will be declared.
220 double mPCA_HitMinTime;
221 double mPCA_HitMaxTime;
222 size_t mLauncherIndex;
223 double mLaunchTime;
224 double mLastUpdateTime;
225 double mTimeStartedMoving;
226 double mArmTime;
227 bool mIsArmed;
228 bool mForceDetonate;
229 bool mProximityHit;
230 bool mAGL_Hit;
231 bool mMSL_Hit;
232 bool mTOF_Hit;
233 bool mMinSpeedHit;
234
235 // Dynamic weapon data.
236 UtAtmosphere mAtmosphere;
237 double mThisWpnAltMSL;
238 double mLastWpnAltMSL;
239 double mThisWpnAltAGL;
240 double mThisWpnSpeed;
241 double mLastWpnSpeed;
242 double mThisWpnLocWCS[3];
243 double mLastWpnLocWCS[3];
244 double mThisWpnVelWCS[3];
245 double mLastAGL_Delta;
246 double mThisAGL_Delta;
247 double mLastMSL_Delta;
248 double mThisMSL_Delta;
249 double mCapturedMaxSpeed;
250 unsigned int mAGL_UpdateCount;
251 unsigned int mMSL_UpdateCount;
252
253 // Dynamic target data.
254 WsfTrackId mTgtTrackId;
255 WsfPlatform* mTgtPtr;
256 size_t mTgtIndex;
257 size_t mLastTgtIndex;
258 double mTgtLocWCS[3];
259 double mTgtVelWCS[3];
260 double mTgtAltAGL;
261 double mLastGoodTgtUpdateTime;
262 bool mTgtAltSet;
263
264 // PCA Data from previous update
265 double mLastPCA_Time;
266 double mLastPCA_WpnLocWCS[3];
267 double mLastPCA_TgtLocWCS[3];
268
269 // Proximity detonation data.
270 double mDetTime;
271 double mDetWpnLocWCS[3];
272 double mDetTgtLocWCS[3];
274};
275
276#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Contains the 'categories' to which an object belongs.
Definition WsfCategoryList.hpp:34
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfProcessor.hpp:39
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
bool Initialize2(double aSimTime) override
Definition WsfScriptProcessor.cpp:142
void Update(double aSimTime) override
Definition WsfScriptProcessor.cpp:281
WsfProcessor * Clone() const override
Definition WsfScriptProcessor.cpp:97
WsfScriptProcessor(const WsfScenario &aScenario)
Definition WsfScriptProcessor.cpp:30
bool Initialize(double aSimTime) override
Definition WsfScriptProcessor.cpp:104
bool ProcessInput(UtInput &aInput) override
Definition WsfScriptProcessor.cpp:186
Definition WsfTrackId.hpp:33
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfWeaponFuse.hpp:54
AltCriteria GetMSL_Criteria() const
Definition WsfWeaponFuse.hpp:117
const char * GetScriptClassName() const override
Definition WsfWeaponFuse.hpp:99
double GetTimeOfFlightToArm() const
Definition WsfWeaponFuse.hpp:121
WsfWeaponFuse(WsfScenario &aScenario)
Constructor.
Definition WsfWeaponFuse.cpp:69
OnIntercept
Definition WsfWeaponFuse.hpp:87
@ cACTION_DETONATE
Default normal behavior, upon Intercept, detonate.
Definition WsfWeaponFuse.hpp:88
@ cACTION_HALT
Upon Intercept, halt/freeze motion.
Definition WsfWeaponFuse.hpp:89
static std::unique_ptr< UtScriptClass > CreateScriptClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfWeaponFuse.cpp:1680
double GetMaximumTimeOfFlight() const
Access the values used to determine detonation based on Time, Altitude, and Speed.
Definition WsfWeaponFuse.hpp:114
void SetGrossUpdateInterval(double aInterval)
Definition WsfWeaponFuse.hpp:132
AltCriteria
The AGL/MSL detonation criteria.
Definition WsfWeaponFuse.hpp:58
@ cNO_LIMIT
Definition WsfWeaponFuse.hpp:59
@ cDETONATE_BELOW
Definition WsfWeaponFuse.hpp:61
@ cDETONATE_ABOVE
Definition WsfWeaponFuse.hpp:60
WsfWeaponFuse & operator=(const WsfWeaponFuse &)=delete
TargetLossOption
Definition WsfWeaponFuse.hpp:141
@ cCANCEL_PROXIMITY_CHECKS
Quit considering proximity.
Definition WsfWeaponFuse.hpp:144
@ cCONSIDER_ALL_PROXIMITY
Revert to checking all existing platforms (CPU Intensive).
Definition WsfWeaponFuse.hpp:145
@ cCOAST
Coast for a specified period of time while waiting for the target to reappear.
Definition WsfWeaponFuse.hpp:143
@ cDETONATE
Detonate.
Definition WsfWeaponFuse.hpp:142
double GetMSL_Limit() const
Definition WsfWeaponFuse.hpp:120
SpeedCriteria
The Minimum Speed detonation criteria.
Definition WsfWeaponFuse.hpp:66
@ cSC_SPEED
Definition WsfWeaponFuse.hpp:68
@ cSC_MACH
Definition WsfWeaponFuse.hpp:69
@ cSC_NONE
Definition WsfWeaponFuse.hpp:67
@ cSC_MACH_DECAY
Definition WsfWeaponFuse.hpp:70
Reason GetReason() const
Access the reason why the fuse arrived at its current State.
Definition WsfWeaponFuse.hpp:111
void SetGrossProximityRange(double aRange)
Definition WsfWeaponFuse.hpp:130
double GetAGL_Limit() const
Definition WsfWeaponFuse.hpp:119
AltCriteria GetAGL_Criteria() const
Definition WsfWeaponFuse.hpp:118
double GetMinSpeedLimit() const
Definition WsfWeaponFuse.hpp:116
void SetTOFToArm(double aTOF)
Definition WsfWeaponFuse.hpp:134
SpeedCriteria GetSpeedCriteria() const
Definition WsfWeaponFuse.hpp:115
Reason
Reason for the final state of the fuse object.
Definition WsfWeaponFuse.hpp:75
@ cMIN_SPEED
Weapon speed fell below its minimum 'effective' value, initiating detonation.
Definition WsfWeaponFuse.hpp:80
@ cNO_REASON
Fuse has not attempted detonation yet.
Definition WsfWeaponFuse.hpp:76
@ cCOMMAND
Detonated by command.
Definition WsfWeaponFuse.hpp:83
@ cTOF_LIMIT
Maximum Time Of Flight (TOF) was exceeded, initiating detonation.
Definition WsfWeaponFuse.hpp:81
@ cCOAST_TIME_LIMIT
Coast time limit exceeded, initiating detonation.
Definition WsfWeaponFuse.hpp:82
@ cAGL_LIMIT
Crossing an Above Ground Level (AGL) limit initiated detonation.
Definition WsfWeaponFuse.hpp:78
@ cPROXIMITY
Proximity to a target initiated the detonation.
Definition WsfWeaponFuse.hpp:77
@ cMSL_LIMIT
Crossing a Mean Sea Level (MSL) limit initiated detonation.
Definition WsfWeaponFuse.hpp:79
void SetHitProximityRange(double aRange)
Definition WsfWeaponFuse.hpp:131
Definition WsfTerrain.hpp:336
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved