WSF
WsfWeapon.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 WSFWEAPON_HPP
13#define WSFWEAPON_HPP
14
15#include <list>
16#include <map>
17#include <vector>
18
19class UtInput;
21#include "WsfComponentList.hpp"
22class WsfEM_Rcvr;
23class WsfEM_Xmtr;
24#include "wsf_mil_export.h"
25
26#include "WsfEvent.hpp"
29#include "WsfMode.hpp"
30#include "WsfModeList.hpp"
31#include "WsfRandomVariable.hpp"
32#include "WsfStringId.hpp"
33#include "WsfTrack.hpp"
34#include "WsfTrackId.hpp"
35class WsfWeapon;
38
62class WSF_MIL_EXPORT WsfWeapon : public WsfArticulatedPart
63{
64public:
65 static const double cUNDEFINED_DOUBLE;
66
75
77 class WSF_MIL_EXPORT WsfWeaponMode : public WsfMode
78 {
79 public:
80 WsfWeaponMode(const WsfScenario& aScenario);
81 WsfWeaponMode(const WsfWeaponMode& aSrc);
82 ~WsfWeaponMode() override = default;
84
87
89 WsfWeapon* GetWeapon() const { return mWeaponPtr; }
90
92 WsfMode* Clone() const override = 0;
93
94 virtual bool Initialize(double aSimTime, WsfWeapon* aWeaponPtr);
95
96 bool ProcessInput(UtInput& aInput) override;
97
98 void Deselect(double aSimTime) override = 0;
99 void Select(double aSimTime) override = 0;
100
101 const WsfScenario& GetScenario() const { return mScenario; }
102
103 protected:
109 };
110
112 static double TimeWeaponLastFiredFor(const WsfPlatform& aPlatform,
113 const WsfTrackId& aTrackId,
114 WsfStringId aWeaponName = WsfStringId());
115
116 static double TimeWeaponLastTerminatedFor(const WsfPlatform& aPlatform,
117 const WsfTrackId& aTrackId,
118 WsfStringId aWeaponName = WsfStringId());
119
120 static int WeaponsPendingFor(const WsfPlatform& aPlatform,
121 const WsfTrackId& aTrackId,
122 WsfStringId aWeaponName = WsfStringId());
123
124 static int WeaponsActiveFor(const WsfPlatform& aPlatform,
125 const WsfTrackId& aTrackId,
126 WsfStringId aWeaponName = WsfStringId());
127
128 static int RoundsCompleteFor(const WsfPlatform& aPlatform,
129 const WsfTrackId& aTrackId,
130 WsfStringId aWeaponName = WsfStringId());
131
132 static int WeaponsActiveAndPendingFor(const WsfPlatform& aPlatform,
133 const WsfTrackId& aTrackId,
134 WsfStringId aWeaponName = WsfStringId());
135
136 static int RoundsFiredAt(const WsfPlatform& aPlatform,
137 const WsfTrackId& aTrackId,
138 WsfStringId aWeaponName = WsfStringId());
139
140 static int SalvosFiredAt(const WsfPlatform& aPlatform,
141 const WsfTrackId& aTrackId,
142 WsfStringId aWeaponName = WsfStringId());
143
144 static std::vector<size_t> ActiveWeaponPlatformsFor(const WsfPlatform& aPlatform,
145 const WsfTrackId& aTrackId,
146 WsfStringId aWeaponName = WsfStringId());
147
148 static void DetermineFirepowerStatus(WsfPlatform& aPlatform);
150
151 WsfWeapon(const WsfScenario& aScenario);
152 ~WsfWeapon() override;
153
156
158 ComponentList& GetComponents() { return mComponents; }
159 const ComponentList& GetComponents() const { return mComponents; }
161
163
164 WsfComponent* CloneComponent() const override { return Clone(); }
165 const int* GetComponentRoles() const override;
166 void* QueryInterface(int aRole) override;
169
171
172 const char* GetScriptClassName() const override;
175 WsfWeapon* Clone() const override = 0;
176 bool PreInitialize(double aSimTime) override;
177 bool Initialize(double aSimTime) override;
178 bool Initialize2(double aSimTime) override;
179 void PreInput() override;
180 bool ProcessInput(UtInput& aInput) override;
181 void Update(double aSimTime) override;
183
185
186 void TurnOff(double aSimTime) override;
187 void TurnOn(double aSimTime) override;
188 void SetNonOperational(double aSimTime) override;
189 void SetOperational(double aSimTime) override;
190 void PartBroken(double aSimTime) override;
191 void Restore(double aSimTime) override;
193
195 double GetUpdateInterval() const override { return mUpdateInterval; }
196
199
200 virtual size_t GetEM_RcvrCount() const;
201 virtual WsfEM_Rcvr& GetEM_Rcvr(size_t aIndex);
202
203 virtual size_t GetEM_XmtrCount() const;
204 virtual WsfEM_Xmtr& GetEM_Xmtr(size_t aIndex);
205 virtual size_t GetEM_XmtrCount(size_t aModeIndex) const;
206 virtual WsfEM_Xmtr& GetEM_Xmtr(size_t aModeIndex, size_t aIndex);
207 virtual WsfEM_Xmtr& GetEM_Xmtr(size_t aModeIndex, size_t aBeamIndex, size_t aIndex);
209
212
213 virtual WsfStringId GetCurrentModeName() const;
214 virtual WsfWeaponMode* GetCurrentMode();
215 virtual size_t GetModeCount();
216 virtual WsfWeaponMode* GetModeEntry(size_t aModeIndex);
217 virtual size_t GetModeIndex(WsfStringId aModeNameId);
218 virtual WsfStringId GetModeName(size_t aModeIndex);
219 virtual void DeselectMode(double aSimTime, WsfStringId aModeNameId);
220 virtual void SelectMode(double aSimTime, WsfStringId aModeNameId);
222
224
225
227 WsfLaunchComputer* GetLaunchComputer() const { return mLaunchComputerPtr; }
228
229 void SetLaunchComputer(WsfLaunchComputer* aLaunchComputerPtr);
231
233
234
235 WsfStringId GetWeaponEffectsType() const { return mWeaponEffectsType.GetConstReference(); }
236
238 void SetWeaponEffectsType(WsfStringId aWeaponEffect) { mWeaponEffectsType = aWeaponEffect; }
240
243 {
244 public:
246 : mTrackPtr(nullptr)
247 {
248 }
249 FireTarget(const WsfTrack* aTrackPtr)
250 : mTrackPtr(aTrackPtr)
251 {
252 if (mTrackPtr != nullptr)
253 {
254 mTrackId = mTrackPtr->GetTrackId();
255 }
256 }
257
261
263 std::string mTargetName;
264
265 WsfTrackId mTrackId; // For convenience only...
266
270 std::string mTargetOffset;
271 };
272
275 {
276 public:
278 : mWeaponId(0)
279 {
280 }
281
282 FireOptions(int aWeaponId)
283 : mWeaponId(aWeaponId)
284 {
285 }
286
289
292
295 };
296
299 {
300 public:
302 : SalvoOptions(1)
303 {
304 }
305
306 SalvoOptions(int aQuantity, double aSalvoInterval = -1.0, int aWeaponId = 0)
307 : FireOptions(aWeaponId)
308 , mQuantity(aQuantity)
309 , mSalvoInterval(aSalvoInterval)
310 {
311 }
312
315 };
316
319 {
320 public:
322 : mSuccess(false)
323 , mEngagementPtr(nullptr)
324 {
325 }
326
327 FireResult(bool aResult)
328 : mSuccess(aResult)
329 , mEngagementPtr(nullptr)
330 {
331 }
332
333 operator bool() const { return mSuccess; }
334
341 };
342
344
345 virtual void CueToTarget(double aSimTime, const WsfTrack* aTrackPtr);
346
347 virtual FireResult Fire(double aSimTime, const FireTarget& aTarget, const FireOptions& aSettings);
348
349 virtual bool FireSalvo(double aSimTime, const FireTarget& aTarget, const SalvoOptions& aSettings);
350
351 virtual void ContinueSalvo(double aSimTime, unsigned int aRequestId);
352
353 virtual void AbortSalvo(double aSimTime, const WsfTrackId& aTrackId);
354
355 virtual void CeaseFire(double aSimTime);
356
358 virtual unsigned int GetActiveRequestCount() const { return static_cast<unsigned int>(mSalvoRequestList.size()); }
359
362 virtual unsigned int GetMaximumRequestCount() const { return mMaximumRequestCount; }
364
366
367
368 double GetTimeLastFired() const { return mTimeLastFired; }
369
373 virtual double GetFiringDelay() { return mFiringDelay.Draw(); }
374
378 void SetFiringDelay(const WsfRandomVariable& aFiringDelay) { mFiringDelay = aFiringDelay; }
379
382 virtual double GetSalvoInterval() { return mSalvoInterval.Draw(); }
383
387 double GetFiringInterval() const { return mFiringInterval; }
388
392 void SetFiringInterval(double aFiringInterval) { mFiringInterval = aFiringInterval; }
394
396
397
398 WsfStringId GetLaunchedPlatformType() const { return mLaunchedPlatformType; }
399
401 void SetLaunchedPlatformType(WsfStringId aLaunchedPlatformType) { mLaunchedPlatformType = aLaunchedPlatformType; }
403
407
408
411 double GetInitialStateQuantityRemaining() const { return mInitialStateQuantityRemaining; }
412 virtual double GetQuantityRemaining() const;
413 virtual double GetQuantityCommitted() const;
414 virtual double GetMaximumQuantity() const;
415 virtual double GetTotalQuantityUsed() const;
416 virtual void SetQuantityRemaining(double aQuantity);
417 void ChangeQuantity(double aDeltaQuantity);
419
425
426
429 bool IsReloading() const { return mIsReloading; }
430
432 bool InhibitWhileReloading() const { return mInhibitWhileReloading; }
433
434 virtual void CompleteReloading(double aSimTime, double aQuantity);
435
438 double GetReloadInventory() const { return mReloadInventory; }
439
441 double GetReloadThreshold() const { return mReloadThreshold; }
442
446 double GetReloadIncrement() const { return mReloadIncrement; }
448
453
454 WsfTrack* CreateTargetTrack(double aSimTime, const WsfTrack* aTrackPtr);
455
456 bool GetTargetLocationWCS(double aSimTime, const WsfTrack* aTrackPtr, double aTargetLocWCS[3]);
458
462
463 virtual void SetTargetIndex(int aId, size_t aTargetIndex) {}
464 virtual size_t GetTargetIndex(int aId) const { return 0; }
465
466 virtual void SetTargetedLocationWCS(int aId, const double aTargetedLocationWCS[3]) {}
467 virtual void GetTargetedLocationWCS(int aId, double aTargetedLocationWCS[3]) const {}
468
469 virtual bool TargetedLocationValid(int aId) const { return false; }
470
472
475
476 virtual bool WithinFieldOfView(double aSimTime, WsfPlatform* aPlatformPtr);
477 virtual bool WithinFieldOfView(double aSimTime, WsfTrack* aTrackPtr);
479
482
483
484 virtual bool StartJamming(double aSimTime,
485 double aFrequency,
486 double aBandwidth,
487 size_t aBeamNumber,
488 WsfStringId aTechniqueId,
489 WsfTrackId aTrackId,
490 size_t aTargetIndex)
491 {
492 return false;
493 }
494 virtual bool StartJammingTrack(double aSimTime, WsfStringId aTechniqueId, const WsfTrack* aTrackPtr)
495 {
496 return false;
497 }
498
499 virtual bool StopJamming(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfTrackId aTrackId)
500 {
501 return false;
502 }
503
504 virtual bool UpdateJamming(double aSimTime,
505 size_t aXmtrIndex,
506 double aFrequency,
507 double aBandwidth,
508 WsfStringId aTechniqueId,
509 WsfTrackId aTrackId,
510 size_t aTargetIndex)
511 {
512 return false;
513 }
514
515 virtual size_t GetActiveBeamCount() const { return 0; }
516 virtual size_t GetMaximumBeamCount() const { return 0; }
517 virtual size_t GetActiveSpotCount(size_t aBeamNumber) const { return 0; }
518 virtual size_t GetMaximumSpotCount(size_t aBeamNumber) const { return 0; }
520
523
524 virtual bool SelectEA_Technique(double aSimTime,
525 double aFrequency,
526 double aBandwidth,
527 size_t aBeamNumber,
528 WsfStringId aTechniqueId,
529 WsfTrackId aTrackId)
530 {
531 return false;
532 }
533
534 virtual bool DeselectEA_Technique(double aSimTime,
535 double aFrequency,
536 double aBandwidth,
537 size_t aBeamNumber,
538 WsfStringId aTechniqueId,
539 WsfTrackId aTrackId)
540 {
541 return false;
542 }
543
544 virtual bool SetEA_DeltaGainTechnique(double aSimTime,
545 WsfStringId aTechniqueId,
546 bool aOnOff,
547 WsfStringId aEffectId,
548 double aJammingDeltaGain_dB,
549 WsfStringId aSystemTypeId,
550 WsfStringId aFunctionTypeId)
551 {
552 return false;
553 }
554
555 virtual bool SetEA_DeltaGainTechnique(double aSimTime,
556 WsfStringId aTechniqueId,
557 bool aOnOff,
558 WsfStringId aEffectId,
559 double aJammingDeltaGain_dB,
560 WsfStringId aSystemTypeId,
561 WsfStringId aFunctionTypeId,
562 double aFrequency,
563 double aBandwidth,
564 size_t aBeamNumber,
565 WsfTrackId aTrackId)
566 {
567 return false;
568 };
569
570
574 //{@
579 void SetUpdateInterval(double aUpdateInterval) override { mUpdateInterval = aUpdateInterval; }
581
583
584 double TimeWeaponLastFiredFor(const WsfTrackId& aTrackId) const;
585 double TimeWeaponLastTerminatedFor(const WsfTrackId& aTrackId) const;
586 int WeaponsPendingFor(const WsfTrackId& aTrackId) const;
587 int WeaponsActiveFor(const WsfTrackId& aTrackId) const;
588 int RoundsCompleteFor(const WsfTrackId& aTrackId) const;
589 int WeaponsActiveAndPendingFor(const WsfTrackId& aTrackId) const;
590 int RoundsFiredAt(const WsfTrackId& aTrackId) const;
591 int SalvosFiredAt(const WsfTrackId& aTrackId) const;
592 std::vector<size_t> ActiveWeaponPlatformsFor(const WsfTrackId& aTrackId) const;
594
595 virtual void EngagementComplete(double aSimTime, WsfWeaponEngagement* aEngagementPtr);
596
598 void SetIFCEnabled(bool aEnabled) { mIFCEnabled = aEnabled; }
599
601 bool GetIFCEnabled() const { return mIFCEnabled; }
602
604
605 virtual bool AllocateTheWeapon(double aSimTime, WsfTrack* aTrackPtr, int aStoreId);
606
607 void SetState(WeaponState aState);
608
610 WeaponState GetState() const { return mState; }
611
613
614protected:
615 WsfWeapon(const WsfWeapon& aSrc);
616 WsfWeapon& operator=(const WsfWeapon&) = delete;
617
618 bool IsQuantitySpecified() const { return mIsQuantitySpecified; }
619
620 virtual void ProcessReloading(double aSimTime);
621
623 void SetIsReloading(bool aValue) { mIsReloading = aValue; }
624
625 void SetModeList(WsfModeList* aModeListPtr);
626
627 void SetTimeLastFired(double aTimeLastFired);
628
629 void SetMaximumRequestCount(unsigned int aMaximumRequestCount) { mMaximumRequestCount = aMaximumRequestCount; }
630
631 class WSF_MIL_EXPORT SalvoEvent : public WsfEvent
632 {
633 public:
634 SalvoEvent(double aSimTime, WsfWeapon* aWeaponPtr, unsigned int aRequestId);
635 ~SalvoEvent() override = default;
636 EventDisposition Execute() override;
637
638 private:
639 WsfWeapon* mWeaponPtr;
640 size_t mPlatformIndex;
641 unsigned int mRequestId;
642 };
643
644 class WSF_MIL_EXPORT CompleteReloadEvent : public WsfEvent
645 {
646 public:
647 CompleteReloadEvent(double aCompletionTime, double aReloadedAmount, WsfWeapon* aWeaponPtr);
648 ~CompleteReloadEvent() override = default;
649 EventDisposition Execute() override;
650
651 private:
652 WsfWeapon* mWeaponPtr;
653 size_t mPlatformIndex;
654 double mQuantity;
655 };
656
658 {
659 public:
660 SalvoRequest(unsigned int aRequestId, const FireTarget& aTarget, const SalvoOptions& aSettings);
661 virtual ~SalvoRequest();
662
663 unsigned int mRequestId;
666 };
667
668protected:
671
672 double GetReloadInterval() const { return mReloadTime; }
673
680 {
681 ActiveWeapon(size_t weaponPlatIndex, unsigned int serialNum)
682 : mPlatformIndex(weaponPlatIndex)
683 , mSerialNumber(serialNum)
684 {
685 }
686
689 unsigned int mSerialNumber;
690 };
691
727 using WeaponStatusMap = std::map<WsfTrackId, WeaponStatus>;
728 using WeaponStatusMapIter = WeaponStatusMap::iterator;
729 using WeaponStatusMapConstIter = WeaponStatusMap::const_iterator;
730 using WeaponStatusVal = std::pair<WsfTrackId, WeaponStatus>;
732
733 virtual void WeaponFireAborted(double aSimTime, const WsfTrack* aTargetTrackPtr, double aQuantity);
734
735private:
736 enum AltitudeReference
737 {
738 cAR_AGL,
739 cAR_MSL,
740 cAR_RELATIVE
741 };
742
743 using SalvoRequestList = std::vector<std::unique_ptr<SalvoRequest>>;
744
745 ComponentList mComponents;
746
749 WsfVariable<double> mUpdateInterval;
750
753 unsigned int mUpdateEventEpoch;
754
756 bool mUpdateEventActive;
757
761 WsfVariable<WsfStringId> mLaunchedPlatformType;
762
764 WsfVariable<WsfStringId> mWeaponEffectsType;
765
769 WsfVariable<double> mQuantityRemaining;
770
773 bool mIsQuantitySpecified;
774
778 double mInitialStateQuantityRemaining;
779
782 WsfVariable<double> mMaximumQuantity;
783
785 double mTotalQuantityUsed;
786
788 double mQuantityCommitted;
789
791 WsfVariable<double> mReloadThreshold;
792
795 WsfVariable<double> mReloadIncrement;
796
799 WsfVariable<double> mReloadInventory;
800
803 WsfRandomVariable mReloadTime;
804
806 WsfRandomVariable mFiringDelay;
807
809 WsfRandomVariable mSalvoInterval;
810
812 WsfVariable<double> mFiringInterval;
813
815 double mTimeLastFired;
816
819 unsigned int mMaximumRequestCount;
820
822 unsigned int mSalvoRequestId;
823
825 SalvoRequestList mSalvoRequestList;
826
830 WsfVariable<double> mUnknownTargetRange;
831
833 WsfVariable<double> mUnknownTargetAltitude;
834
836 AltitudeReference mUnknownTargetAltitudeRef;
837
839 WeaponState mState;
840
842 bool mAutomaticTargetCueing;
843
845 bool mCueToPredictedIntercept;
846
848 bool mIsReloading;
849
851 bool mInhibitWhileReloading;
852
854 bool mIFCEnabled;
855
856 WsfLaunchComputer* mLaunchComputerPtr;
857
859 std::vector<WsfWeaponMode*> mWeaponModeList;
860};
861
863
864#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_WEAPON
Weapon component.
Definition WsfMilComponentRoles.hpp:18
@ cWSF_INITIALIZE_ORDER_WEAPON
Definition WsfMilComponentRoles.hpp:47
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
bool ProcessInput(UtInput &aInput) override
Definition WsfArticulatedPart.cpp:205
bool Initialize(double aSimTime) override
Definition WsfArticulatedPart.cpp:170
void * QueryInterface(int aRole) override
Definition WsfArticulatedPart.cpp:159
WsfArticulatedPart(const WsfScenario &aScenario, int aPartType)
Definition WsfArticulatedPart.cpp:29
const char * GetScriptClassName() const override
Definition WsfArticulatedPart.cpp:1074
const int * GetComponentRoles() const override
Definition WsfArticulatedPart.cpp:153
A component list that stores only components of a specified type.
Definition WsfComponentList.hpp:343
Definition WsfComponent.hpp:39
virtual bool PreInitialize(double aSimTime)
Definition WsfComponent.cpp:24
virtual void PreInput()
Definition WsfComponent.cpp:86
Definition WsfEM_Rcvr.hpp:68
Definition WsfEM_Xmtr.hpp:55
WsfEvent()=default
EventDisposition
Definition WsfEvent.hpp:37
Definition WsfLaunchComputer.hpp:35
Definition WsfModeList.hpp:31
WsfMode()
Definition WsfMode.cpp:15
virtual WsfObject * Clone() const =0
virtual void Update(double aSimTime)
Definition WsfPlatformPart.cpp:322
virtual void SetOperational(double aSimTime)
Definition WsfPlatformPart.cpp:661
virtual void PartBroken(double aSimTime)
Definition WsfPlatformPart.cpp:232
bool Initialize2(double aSimTime) override
Definition WsfPlatformPart.cpp:291
virtual void TurnOff(double aSimTime)
Definition WsfPlatformPart.cpp:606
virtual void TurnOn(double aSimTime)
Definition WsfPlatformPart.cpp:622
virtual void SetNonOperational(double aSimTime)
Definition WsfPlatformPart.cpp:642
virtual void Restore(double aSimTime)
Definition WsfPlatformPart.cpp:252
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfRandomVariable.hpp:33
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfTrackId.hpp:33
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfVariable.hpp:149
Definition WsfWeaponEngagement.hpp:43
EventDisposition Execute() override
Definition WsfWeapon.cpp:1958
~CompleteReloadEvent() override=default
CompleteReloadEvent(double aCompletionTime, double aReloadedAmount, WsfWeapon *aWeaponPtr)
Definition WsfWeapon.cpp:1948
Weapon firing options.
Definition WsfWeapon.hpp:275
std::string mWeaponPlatformName
Name of the explicit weapon platform. If empty, the weapon will create a new unique name.
Definition WsfWeapon.hpp:291
WsfStringId mWeaponComponentName
Name of the weapon component that will be used to fire.
Definition WsfWeapon.hpp:294
FireOptions(int aWeaponId)
Definition WsfWeapon.hpp:282
int mWeaponId
The weapon id assigned to an allocated weapon platform.
Definition WsfWeapon.hpp:288
FireOptions()
Definition WsfWeapon.hpp:277
Result of WsfWeapon::Fire().
Definition WsfWeapon.hpp:319
WsfWeaponEngagement * mEngagementPtr
Definition WsfWeapon.hpp:340
bool mSuccess
'true' if WsfWeapon::Fire() is successful, 'false' otherwise.
Definition WsfWeapon.hpp:336
FireResult()
Definition WsfWeapon.hpp:321
FireResult(bool aResult)
Definition WsfWeapon.hpp:327
A target for a weapon to fire upon.
Definition WsfWeapon.hpp:243
WsfTrackId mTrackId
Definition WsfWeapon.hpp:265
FireTarget()
Definition WsfWeapon.hpp:245
const WsfTrack * mTrackPtr
Definition WsfWeapon.hpp:260
FireTarget(const WsfTrack *aTrackPtr)
Definition WsfWeapon.hpp:249
std::string mTargetName
The target name against which to fire the weapon.
Definition WsfWeapon.hpp:263
std::string mTargetOffset
Definition WsfWeapon.hpp:270
EventDisposition Execute() override
Definition WsfWeapon.cpp:1935
SalvoEvent(double aSimTime, WsfWeapon *aWeaponPtr, unsigned int aRequestId)
Definition WsfWeapon.cpp:1923
~SalvoEvent() override=default
Salvoing options.
Definition WsfWeapon.hpp:299
SalvoOptions()
Definition WsfWeapon.hpp:301
double mSalvoInterval
The number of rounds to fire.
Definition WsfWeapon.hpp:314
SalvoOptions(int aQuantity, double aSalvoInterval=-1.0, int aWeaponId=0)
Definition WsfWeapon.hpp:306
int mQuantity
Definition WsfWeapon.hpp:313
WsfPlatform * GetPlatform() const
Return the pointer to the platform to which the associated weapon is attached.
Definition WsfWeapon.hpp:86
void Select(double aSimTime) override=0
~WsfWeaponMode() override=default
WsfWeapon * GetWeapon() const
Return the pointer to the weapon with which this mode is associated.
Definition WsfWeapon.hpp:89
WsfPlatform * mPlatformPtr
Pointer to the platform with which the weapon is associated.
Definition WsfWeapon.hpp:106
WsfWeaponMode & operator=(const WsfWeaponMode &)=delete
WsfWeapon * mWeaponPtr
Pointer to the weapon with which the mode is associated.
Definition WsfWeapon.hpp:108
void Deselect(double aSimTime) override=0
WsfMode * Clone() const override=0
Create an exact duplicate of this mode.
const WsfScenario & GetScenario() const
Definition WsfWeapon.hpp:101
const WsfScenario & mScenario
Definition WsfWeapon.hpp:104
WsfWeaponMode(const WsfScenario &aScenario)
Definition WsfWeapon.cpp:1970
Definition WsfWeapon.hpp:63
bool GetIFCEnabled() const
Returns 'true' if the platform supports IFC (Integrated Fire Control).
Definition WsfWeapon.hpp:601
virtual bool UpdateJamming(double aSimTime, size_t aXmtrIndex, double aFrequency, double aBandwidth, WsfStringId aTechniqueId, WsfTrackId aTrackId, size_t aTargetIndex)
Definition WsfWeapon.hpp:504
double GetInitialStateQuantityRemaining() const
Definition WsfWeapon.hpp:411
virtual size_t GetActiveBeamCount() const
Definition WsfWeapon.hpp:515
bool InhibitWhileReloading() const
Flag indicating that when a weapon reload is in progress, any firing will be inhibited.
Definition WsfWeapon.hpp:432
virtual bool SetEA_DeltaGainTechnique(double aSimTime, WsfStringId aTechniqueId, bool aOnOff, WsfStringId aEffectId, double aJammingDeltaGain_dB, WsfStringId aSystemTypeId, WsfStringId aFunctionTypeId)
Definition WsfWeapon.hpp:544
const ComponentList & GetComponents() const
Definition WsfWeapon.hpp:159
WsfStringId GetWeaponEffectsType() const
Get the string ID of the weapon effects to be used.
Definition WsfWeapon.hpp:235
void SetLaunchedPlatformType(WsfStringId aLaunchedPlatformType)
Set the type of the platform that will be launched.
Definition WsfWeapon.hpp:401
virtual void SetTargetedLocationWCS(int aId, const double aTargetedLocationWCS[3])
Definition WsfWeapon.hpp:466
virtual size_t GetMaximumBeamCount() const
Definition WsfWeapon.hpp:516
WsfWeapon(const WsfScenario &aScenario)
Definition WsfWeapon.cpp:48
WsfWeapon * Clone() const override=0
virtual bool FireSalvo(double aSimTime, const FireTarget &aTarget, const SalvoOptions &aSettings)
Definition WsfWeapon.cpp:847
static const double cUNDEFINED_DOUBLE
Definition WsfWeapon.hpp:65
virtual void ContinueSalvo(double aSimTime, unsigned int aRequestId)
Definition WsfWeapon.cpp:890
WeaponStatusMap mWeaponStatusMap
Definition WsfWeapon.hpp:731
double GetUpdateInterval() const override
Get the update interval.
Definition WsfWeapon.hpp:195
virtual bool SetEA_DeltaGainTechnique(double aSimTime, WsfStringId aTechniqueId, bool aOnOff, WsfStringId aEffectId, double aJammingDeltaGain_dB, WsfStringId aSystemTypeId, WsfStringId aFunctionTypeId, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:555
static double TimeWeaponLastTerminatedFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1621
WsfComponent * CloneComponent() const override
Definition WsfWeapon.hpp:164
double GetReloadIncrement() const
Definition WsfWeapon.hpp:446
double GetFiringInterval() const
Definition WsfWeapon.hpp:387
std::pair< WsfTrackId, WeaponStatus > WeaponStatusVal
Definition WsfWeapon.hpp:730
virtual double GetSalvoInterval()
Definition WsfWeapon.hpp:382
WeaponState
Definition WsfWeapon.hpp:68
@ cWEAPON_STATE_NACK
Definition WsfWeapon.hpp:72
@ cWEAPON_STATE_READY
Definition WsfWeapon.hpp:73
@ cWEAPON_STATE_UNALLOCATED
Definition WsfWeapon.hpp:69
@ cWEAPON_STATE_ALLOCATED
Definition WsfWeapon.hpp:70
@ cWEAPON_STATE_DEALLOCATE
Definition WsfWeapon.hpp:71
WsfModeList * mModeListPtr
The pointer to the list of modes (for things like jammers).
Definition WsfWeapon.hpp:670
ComponentList & GetComponents()
Definition WsfWeapon.hpp:158
WsfWeapon & operator=(const WsfWeapon &)=delete
virtual bool DeselectEA_Technique(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:534
WeaponStatusMap::const_iterator WeaponStatusMapConstIter
Definition WsfWeapon.hpp:729
int GetComponentInitializationOrder() const override
Definition WsfWeapon.hpp:167
double GetReloadInterval() const
Definition WsfWeapon.hpp:672
WsfStringId GetLaunchedPlatformType() const
Get the type of the platform that will be launched.
Definition WsfWeapon.hpp:398
virtual void CeaseFire(double aSimTime)
Definition WsfWeapon.cpp:996
void SetWeaponEffectsType(WsfStringId aWeaponEffect)
Set the string ID of the weapon effects to be used.
Definition WsfWeapon.hpp:238
virtual double GetFiringDelay()
Definition WsfWeapon.hpp:373
WeaponStatusMap::iterator WeaponStatusMapIter
Definition WsfWeapon.hpp:728
void SetFiringInterval(double aFiringInterval)
Definition WsfWeapon.hpp:392
virtual FireResult Fire(double aSimTime, const FireTarget &aTarget, const FireOptions &aSettings)
Definition WsfWeapon.cpp:828
virtual void AbortSalvo(double aSimTime, const WsfTrackId &aTrackId)
Definition WsfWeapon.cpp:975
virtual size_t GetTargetIndex(int aId) const
Definition WsfWeapon.hpp:464
virtual bool StopJamming(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:499
void SetMaximumRequestCount(unsigned int aMaximumRequestCount)
Definition WsfWeapon.hpp:629
static void DetermineFirepowerStatus(WsfPlatform &aPlatform)
Decide whether to set or clear the Firepower appearance bit.
Definition WsfWeapon.cpp:1827
static int WeaponsActiveFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of weapons that have been fired at the track and are still alive.
Definition WsfWeapon.cpp:1672
virtual void WeaponFireAborted(double aSimTime, const WsfTrack *aTargetTrackPtr, double aQuantity)
Definition WsfWeapon.cpp:1578
virtual void GetTargetedLocationWCS(int aId, double aTargetedLocationWCS[3]) const
Definition WsfWeapon.hpp:467
void SetUpdateInterval(double aUpdateInterval) override
Definition WsfWeapon.hpp:579
void SetIFCEnabled(bool aEnabled)
Set to true is IFC is supported.
Definition WsfWeapon.hpp:598
virtual bool SelectEA_Technique(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:524
virtual unsigned int GetMaximumRequestCount() const
Definition WsfWeapon.hpp:362
double GetTimeLastFired() const
Get the simulation time when the weapon was last fired.
Definition WsfWeapon.hpp:368
void SetFiringDelay(const WsfRandomVariable &aFiringDelay)
Definition WsfWeapon.hpp:378
static int SalvosFiredAt(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of salvo fire requests requested, and not the actual number of salvos fired.
Definition WsfWeapon.cpp:1772
WsfComponentListT< WsfWeaponComponent > ComponentList
Definition WsfWeapon.hpp:157
virtual size_t GetMaximumSpotCount(size_t aBeamNumber) const
Definition WsfWeapon.hpp:518
virtual bool StartJamming(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId, size_t aTargetIndex)
Definition WsfWeapon.hpp:484
static double TimeWeaponLastFiredFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1597
double GetReloadThreshold() const
Returns the depleted value of inventory at which a reload is attempted.
Definition WsfWeapon.hpp:441
static int WeaponsActiveAndPendingFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Equivalent to WeaponsActiveFor() plus WeaponsPendingFor().
Definition WsfWeapon.cpp:1722
virtual void CueToTarget(double aSimTime, const WsfTrack *aTrackPtr)
Definition WsfWeapon.cpp:752
virtual bool TargetedLocationValid(int aId) const
Definition WsfWeapon.hpp:469
double GetReloadInventory() const
Definition WsfWeapon.hpp:438
virtual unsigned int GetActiveRequestCount() const
Return the number of 'FireSalvo' calls that are in process.
Definition WsfWeapon.hpp:358
static int RoundsCompleteFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of weapons that were fired at the track and are now terminated.
Definition WsfWeapon.cpp:1697
virtual bool StartJammingTrack(double aSimTime, WsfStringId aTechniqueId, const WsfTrack *aTrackPtr)
Definition WsfWeapon.hpp:494
WsfLaunchComputer * GetLaunchComputer() const
Definition WsfWeapon.hpp:227
virtual size_t GetActiveSpotCount(size_t aBeamNumber) const
Definition WsfWeapon.hpp:517
static int WeaponsPendingFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1647
bool IsQuantitySpecified() const
Definition WsfWeapon.hpp:618
std::map< WsfTrackId, WeaponStatus > WeaponStatusMap
Definition WsfWeapon.hpp:727
bool IsReloading() const
Definition WsfWeapon.hpp:429
virtual void SetTargetIndex(int aId, size_t aTargetIndex)
Definition WsfWeapon.hpp:463
static std::vector< size_t > ActiveWeaponPlatformsFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1798
WeaponState GetState() const
Return weapon state.
Definition WsfWeapon.hpp:610
static int RoundsFiredAt(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Equivalent to WeaponsActiveFor() plus RoundsCompleteFor().
Definition WsfWeapon.cpp:1747
void SetIsReloading(bool aValue)
Method used for derived classes to set or clear the IsReloading Flag.
Definition WsfWeapon.hpp:623
ActiveWeapon(size_t weaponPlatIndex, unsigned int serialNum)
Definition WsfWeapon.hpp:681
size_t mPlatformIndex
Platform index of the launched weapon platform.
Definition WsfWeapon.hpp:687
unsigned int mSerialNumber
The serial number of the weapon engagement.
Definition WsfWeapon.hpp:689
unsigned int mRequestId
Definition WsfWeapon.hpp:663
SalvoOptions mSettings
Definition WsfWeapon.hpp:665
SalvoRequest(unsigned int aRequestId, const FireTarget &aTarget, const SalvoOptions &aSettings)
Definition WsfWeapon.cpp:1901
FireTarget mTarget
Definition WsfWeapon.hpp:664
double mTimeWeaponLastTerminated
The simulation time when of the most recent weapon termination event for this task.
Definition WsfWeapon.hpp:715
WeaponStatus()
Definition WsfWeapon.hpp:703
int mRoundsActive
The number of weapons that are active (in flight).
Definition WsfWeapon.hpp:723
int mRoundsPending
The number of weapons that are pending (requested but not yet in flight).
Definition WsfWeapon.hpp:721
int mTotalSalvosFired
The number of salvos that have been fired.
Definition WsfWeapon.hpp:717
int mRoundsCompleted
The total number of weapons that have been fired and terminated for this task.
Definition WsfWeapon.hpp:719
double mTimeWeaponLastFired
The simulation time when of the most recent weapon firing event for this task.
Definition WsfWeapon.hpp:713
std::list< ActiveWeapon > mActiveWeaponList
A list of active weapon platforms.
Definition WsfWeapon.hpp:725
Copyrights Multiple, All Rights Reserved