WSF
WsfATA_LaunchComputer.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 WSFATA_LAUNCHCOMPUTER_HPP
13#define WSFATA_LAUNCHCOMPUTER_HPP
14
15#include "wsf_mil_export.h"
16
17#include <vector>
18
19class UtInput;
20class UtInputBlock;
21#include "WsfLaunchComputer.hpp"
22
32
33class WSF_MIL_EXPORT WsfATA_LaunchComputer : public WsfLaunchComputer
34{
35public:
37 static std::string BaseTypeName() { return "WSF_ATA_LAUNCH_COMPUTER"; }
38
41 ~WsfATA_LaunchComputer() override;
42
43 WsfLaunchComputer* Clone() const override;
44 bool Initialize(double aSimTime, WsfWeapon* aWeaponPtr) override;
45 bool ProcessInput(UtInput& aInput) override;
46
47 bool ToolOnlyInitialize(double aSimTime);
48
49 double EstimatedTimeToIntercept(double aSimTime, const WsfTrack& aTrack, double aLaunchDelayTime) override;
50
58 class WSF_MIL_EXPORT EvenlySpaced
59 {
60 public:
61 EvenlySpaced() = default;
62
63 void SetNumBins(unsigned int aSize) { mBins = aSize; }
64 unsigned int GetNumBins() const { return mBins; }
65 void SetDelta(double aValue) { mDelta = aValue; }
66 double Delta() const { return mDelta; }
67 void SetMin(double aValue) { mMin = aValue; }
68 double Min() const { return mMin; }
69 double Max() const { return mMin + mBins * mDelta; }
70 bool BinCenter(unsigned int aIndex, double& aValue) const;
71 bool BinLower(unsigned int aIndex, double& aValue) const;
72 bool BinUpper(unsigned int aIndex, double& aValue) const;
73 bool GetIndex(double aValue, unsigned int& aIndex) const;
74
75 private:
76 double mMin{0.0};
77 double mDelta{0.0};
78 unsigned int mBins{0};
79 };
80
83 class WSF_MIL_EXPORT NotEvenlySpaced
84 {
85 public:
86 void SetNumBins(unsigned int aSize) { mValues.resize(aSize + 1, 0.0); }
87 unsigned int GetNumBins() const { return static_cast<unsigned int>(mValues.size() - 1); }
88 bool SetValue(unsigned int aIndex, double aValue);
89 bool Delta(unsigned int aIndex, double& aValue) const;
90 double Min() const { return mValues[0]; }
91 double Max() const { return mValues[mValues.size() - 1]; }
92 bool BinCenter(unsigned int aIndex, double& aValue) const;
93 bool BinLower(unsigned int aIndex, double& aValue) const;
94 bool BinUpper(unsigned int aIndex, double& aValue) const;
95 bool GetIndex(double aValue, unsigned int& aIndex) const;
96
97 private:
98 std::vector<double> mValues;
99 };
100
104
105
106 void AllocateResults(unsigned int aSize);
107 void ResetAllIndices();
108 void SetResult(double aValue);
109 bool IncrementRange();
110
112 const EvenlySpaced& Aspects() { return mTableShotAspects; }
114 const EvenlySpaced& Azimuths() { return mTableTargetAzimuths; }
116 const EvenlySpaced& Elevations() { return mTableTargetElevations; }
118 const EvenlySpaced& RangeRates() { return mTableRangeRates; }
120 const NotEvenlySpaced& Ranges() { return mTableRanges; }
121
123 unsigned int RangeIndex() const { return mRangeIndex; }
124
126 unsigned int SizeOfResults() const { return SizeOfAspectsSet(); }
127
128 unsigned int SizeOfAspectsSet() const;
129 unsigned int SizeOfAzimuthsSet() const;
130 unsigned int SizeOfElevationsSet() const;
131 unsigned int SizeOfRangeRatesSet() const;
132 unsigned int SizeOfRangeBinsSet() const;
133
135 bool TableLookUpUsed() const { return !mTOFResults.empty(); }
137 double GetResult() const { return mTOFResults.empty() ? 0.0 : mTOFResults[mIterIndex]; }
138
139 double TableTargetRange() const;
140 double TableTargetRangeRate() const;
141 double TableTargetAspect() const;
142 double TableTargetAzimuth() const;
143 double TableTargetElevation() const;
144
145 bool TableTargetRange(unsigned int aIndex, double& aValue) const;
146 bool TableTargetRangeRate(unsigned int aIndex, double& aValue) const;
147 bool TableTargetRelHeading(unsigned int aIndex, double& aValue) const;
148 bool TableTargetAzimuth(unsigned int aIndex, double& aValue) const;
149 bool TableTargetElevation(unsigned int aIndex, double& aValue) const;
150
152 double TableMinRange() const { return mTableRanges.Min(); }
154 double TableMaxRange() const { return mTableRanges.Max(); }
156 double TableRange(unsigned int aIndex) const
157 {
158 double value;
159 mTableRanges.BinCenter(aIndex, value);
160 return value;
161 }
162
164 unsigned int RangeRateIndex() const { return mRangeRateIndex; }
166 unsigned int TargetElIndex() const { return mTargetElIndex; }
168 unsigned int TargetAzIndex() const { return mTargetAzIndex; }
170 unsigned int ShotAspectIndex() const { return mTableShotAspectIndex; }
171
173
174protected:
176
177 void ProcessInterceptBlock(UtInputBlock& aInputBlock);
178 void ProcessGenerateBlock(UtInputBlock& aInputBlock);
179 bool CheckRanges();
180
181 bool InitializeTTIData() override;
182
183 double GetTOF(double aAspect, double aAzimuth, double aElevation, double aRangeRate, double aRange);
184
185private:
186 void SetIterIndex();
187 bool IncrementRangeRate();
188 bool IncrementTargetElevation();
189 bool IncrementTargetAzimuth();
190 bool IncrementShotAspect();
191
192 unsigned int mTableShotAspectIndex;
193 unsigned int mTargetAzIndex;
194 unsigned int mTargetElIndex;
195 unsigned int mRangeRateIndex;
196 unsigned int mRangeIndex;
197 unsigned int mIterIndex;
198
199 EvenlySpaced mTableShotAspects;
200 EvenlySpaced mTableTargetAzimuths;
201 EvenlySpaced mTableTargetElevations;
202 EvenlySpaced mTableRangeRates;
203 NotEvenlySpaced mTableRanges;
204
205 std::vector<double> mTOFResults;
206};
207
208#endif
Definition WsfATA_LaunchComputer.hpp:59
void SetNumBins(unsigned int aSize)
Definition WsfATA_LaunchComputer.hpp:63
double Min() const
Definition WsfATA_LaunchComputer.hpp:68
double Delta() const
Definition WsfATA_LaunchComputer.hpp:66
void SetMin(double aValue)
Definition WsfATA_LaunchComputer.hpp:67
unsigned int GetNumBins() const
Definition WsfATA_LaunchComputer.hpp:64
double Max() const
Definition WsfATA_LaunchComputer.hpp:69
void SetDelta(double aValue)
Definition WsfATA_LaunchComputer.hpp:65
Definition WsfATA_LaunchComputer.hpp:84
double Min() const
Definition WsfATA_LaunchComputer.hpp:90
void SetNumBins(unsigned int aSize)
Definition WsfATA_LaunchComputer.hpp:86
unsigned int GetNumBins() const
Definition WsfATA_LaunchComputer.hpp:87
double Max() const
Definition WsfATA_LaunchComputer.hpp:91
Definition WsfATA_LaunchComputer.hpp:34
bool TableLookUpUsed() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:135
double TableRange(unsigned int aIndex) const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:156
double TableTargetElevation() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.cpp:611
bool TableTargetRelHeading(unsigned int aIndex, double &aValue) const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.cpp:760
double TableTargetAzimuth() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.cpp:603
double TableTargetRangeRate() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.cpp:587
const NotEvenlySpaced & Ranges()
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:120
unsigned int SizeOfResults() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:126
unsigned int RangeRateIndex() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:164
static std::string BaseTypeName()
The basic type name (needed by weapon_tools and launch computer processor).
Definition WsfATA_LaunchComputer.hpp:37
const EvenlySpaced & Elevations()
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:116
unsigned int TargetElIndex() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:166
double TableMaxRange() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:154
unsigned int ShotAspectIndex() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:170
WsfATA_LaunchComputer()
Definition WsfATA_LaunchComputer.cpp:30
unsigned int SizeOfAspectsSet() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.cpp:549
const EvenlySpaced & Azimuths()
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:114
double TableMinRange() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:152
const EvenlySpaced & RangeRates()
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:118
WsfATA_LaunchComputer & operator=(const WsfATA_LaunchComputer &)=delete
bool ToolOnlyInitialize(double aSimTime)
Definition WsfATA_LaunchComputer.cpp:778
unsigned int RangeIndex() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:123
unsigned int TargetAzIndex() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:168
bool TableTargetRange(unsigned int aIndex, double &aValue) const
const EvenlySpaced & Aspects()
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:112
double GetResult() const
Used by the Weapon_Tool during the Launch Computer Generation process.
Definition WsfATA_LaunchComputer.hpp:137
virtual bool InitializeTTIData()
Definition WsfLaunchComputer.cpp:440
WsfLaunchComputer()
Definition WsfLaunchComputer.cpp:44
virtual double EstimatedTimeToIntercept(double aSimTime, const WsfTrack &aTrack, double aLaunchDelayTime)
Definition WsfLaunchComputer.cpp:749
WsfLaunchComputer * Clone() const override
Definition WsfLaunchComputer.cpp:518
bool ProcessInput(UtInput &aInput) override
Definition WsfLaunchComputer.cpp:171
virtual bool Initialize(double aSimTime, WsfWeapon *aWeaponPtr)
Definition WsfLaunchComputer.cpp:393
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfWeapon.hpp:63
Copyrights Multiple, All Rights Reserved