WSF
WsfChaffParcel.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
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#ifndef WSFCHAFFPARCEL_HPP
12#define WSFCHAFFPARCEL_HPP
13
14#include "wsf_nx_export.h"
15
16#include <memory>
17#include <unordered_map>
18
19#include "UtCloneablePtr.hpp"
20#include "UtTable.hpp"
24#include "WsfObject.hpp"
26
30{
31public:
33 WsfChaffParcel(const WsfChaffParcel& aSrc);
34 WsfChaffParcel& operator=(const WsfChaffParcel& aSrc) = delete;
35 ~WsfChaffParcel() override = default;
36
38
39 WsfObject* Clone() const override;
40 bool ProcessInput(UtInput& aInput) override;
42
44
45 WsfPlatform* GetPlatform() const override { return GetComponentParent(); }
46 double GetRadialSize() const override { return mRadialSize; }
47 void GetDropLocationWCS(double aDropLocationWCS[3]) const override;
49
57 double GetRadarCrossSection(double aFrequency, const double aXmtrLocationWCS[3], const double aRcvrLocationWCS[3]) const;
58
59 static bool Find(WsfChaffParcel*& aParcelPtr, const WsfPlatform& aPlatform);
60
61 virtual bool InitializeType() const;
62
63 void Update(double aSimTime);
64 bool IsExpired(double aSimTime);
65
66 void AddToCloud(std::shared_ptr<WsfChaffCloudInterface>& aCloudPtr);
67
68 static void ClearMaxRcsCache();
69
70 virtual double GetMaximumRCS() const;
71
72protected:
74
75 WsfComponent* CloneComponent() const override;
76 void* QueryInterface(int aRole) override;
77 bool Initialize(double aSimTime) override;
79
80 virtual double GetMaximumRCS(double aFrequency) const;
81
82private:
83 std::shared_ptr<WsfChaffCloudInterface> mCloudPtr; // Pointer to cloud that parcel belongs to, for presented area calculation
84
85 using MaxRcsCache = std::unordered_map<std::pair<WsfStringId, double>, double>;
86 static MaxRcsCache sMaxRcsCache; // Cache of (Parcel Type, Frequency) -> Max RCS computed by GetMaximumRCS
87
88 // Inputs
90 double mBloomDiameter; // Characteristic diameter of scatterers in parcel as time goes to infinity
91 double mExpansionTimeConstant; // Radial size expansion time constant (bloom rate)
92
94 double mTerminalVelocity; // Free fall velocity of chaff parcel (m/s)
95 double mDecelerationRate; // Rate at which parcel decelerates when ejected
96
98 double mExpirationTime; // Time after which the parcel is dropped to expire it
99 bool mDebug; // Debugging flag
100
102 using CurvePtr = UtCloneablePtr<UtTable::Curve>;
103 CurvePtr mFreqMaxRCS_Table; // Input table of maximum RCS for dispersed cloud viewed broadside vs. frequency
104 unsigned int mNumberDipoles; // Number of dipoles, assuming all cut to the same length (spot chaff). Used as
105 // alternative to lookup table, for computing max parcel RCS assuming half-wave dipoles.
106
107 // Drop conditions saved in Initialize
108 double mDropLocationWCS[3]; // Parcel location
109 double mDropVelocityWCS[3]; // Parcel velocity
110 double mDropAccelerationWCS[3]; // Parcel acceleration
111 double mFreeFallVelocityWCS[3]; // Free fall velocity vector
112 double mDropTime; // Time at which parcel was dropped
113
114 // Physical attributes computed in Update
115 double mRadialSize; // Mean radial size of parcel, computed as exponential growth to value of 0.5 * mBloomDiameter
116};
117
119
120namespace std // To use pair as key for unordered_map
121{
122template<>
123class hash<std::pair<WsfStringId, double>>
124{
125public:
126 size_t operator()(const std::pair<WsfStringId, double>& pair) const
127 {
128 return WsfStringId()(pair.first) ^ std::hash<double>()(pair.second);
129 }
130};
131} // namespace std
132#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_CHAFF_PARCEL
Chaff parcel extension for WsfPlatform.
Definition WsfNonExportableComponentRoles.hpp:19
aObjectPtr Update(simTime)
WsfSimpleComponentT< WsfPlatformComponent > WsfSimplePlatformComponent
Definition WsfSimpleComponent.hpp:126
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfChaffParcelInterface.hpp:19
virtual void GetDropLocationWCS(double aDropLocationWCS[3]) const =0
Definition WsfChaffParcel.hpp:30
WsfChaffParcel()
Definition WsfChaffParcel.cpp:22
~WsfChaffParcel() override=default
WsfChaffParcel & operator=(const WsfChaffParcel &aSrc)=delete
WsfPlatform * GetPlatform() const override
Definition WsfChaffParcel.hpp:45
double GetRadialSize() const override
Definition WsfChaffParcel.hpp:46
ParentType * GetComponentParent() const
Definition WsfComponent.hpp:154
Definition WsfComponent.hpp:39
virtual bool Initialize(double aSimTime)
Definition WsfComponent.cpp:45
virtual WsfComponent * CloneComponent() const =0
virtual void * QueryInterface(int aRole)=0
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
virtual bool ProcessInput(UtInput &aInput)
Definition WsfObject.cpp:140
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
size_t operator()(const std::pair< WsfStringId, double > &pair) const
Definition WsfChaffParcel.hpp:126
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185
Copyrights Multiple, All Rights Reserved