WSF
WsfLaunchComputer.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 WSFLAUNCHCOMPUTER_HPP
13#define WSFLAUNCHCOMPUTER_HPP
14
15#include "wsf_mil_export.h"
16
17class UtInput;
18#include "WsfGeoPoint.hpp"
19#include "WsfObject.hpp"
20class WsfPlatform;
21class WsfTrack;
22#include "WsfTrackId.hpp"
23#include "WsfWeapon.hpp"
24
33
34class WSF_MIL_EXPORT WsfLaunchComputer : public WsfObject
35{
36protected:
37 enum
38 {
43 cVF_BURN_TIME = 0X0010,
49 cVF_END_TIME = 0X0400,
51 };
52
53 bool ResultIsValidFor(unsigned int aDataMask) const { return (mValidityFlags & aDataMask) != 0; }
54
55public:
56 static std::string BaseTypeName() { return "WSF_LAUNCH_COMPUTER"; }
57
59 static const double cFOREVER;
60
62 static const double cOUT_OF_REACH;
63
65 static const double cUNDEFINED_DOUBLE;
66
78
79 static bool LoadInstance(UtInput& aInput, WsfLaunchComputer*& aLCPtr);
80
83 ~WsfLaunchComputer() override = default;
85
86 WsfLaunchComputer* Clone() const override;
87 const char* GetScriptClassName() const override;
88 bool ProcessInput(UtInput& aInput) override;
89 virtual bool Initialize(double aSimTime, WsfWeapon* aWeaponPtr);
90 virtual void Update(double aSimTime);
91
93 WsfWeapon* GetWeapon() const { return mWeaponPtr; }
94
96 WsfPlatform* GetPlatform() const { return mWeaponPtr->GetPlatform(); }
97
98 WsfSimulation* GetSimulation() const;
99
100 void SetMaximumDeltaAltitude(double aMaxDeltaAltitude);
101 void SetMinimumDeltaAltitude(double aMinDeltaAltitude);
102 void SetMaximumClosingSpeed(double aMaxClosingSpeed);
103 void SetMaximumOpeningSpeed(double aMaxOpeningSpeed);
104 void SetMinimumClosingSpeed(double aMinClosingSpeed);
105 void SetMinimumOpeningSpeed(double aMinOpeningSpeed);
106 void SetMaximumSlantRange(double aMaxRange);
107 void SetMinimumSlantRange(double aMinRange);
108 void SetMaximumOffBoresight(double aMaxAngle);
109 void SetMaximumTimeOfFlight(double aMaxTOF) { mMaximumTOF = aMaxTOF; }
110 void SetThrustDuration(double aThrustTime) { mBurnDuration = aThrustTime; }
111 void SetCoastDuration(double aCoastTime) { mCoastTime = aCoastTime; }
112 void SetBurnoutSpeed(double aBurnoutSpeed) { mBurnoutSpeed = aBurnoutSpeed; }
113 void SetMinTerminalSpeed(double aMinTerminalSpeed) { mMinTerminalSpeed = aMinTerminalSpeed; }
114
115 virtual double EstimatedTimeToIntercept(double aSimTime, const WsfTrack& aTrack, double aLaunchDelayTime);
121
122 bool HaveResultsFor(const WsfTrackId& aTrackId) const { return aTrackId == mLastPredictionTrackId; }
123 bool HaveResultsFor(double aSimTime, const WsfTrackId& aTrackId, double& aTimeToIntercept) const;
136
137 double GetLaunchTime() const { return mLaunchTime; }
138 double GetLauncherBearing() const { return mLauncherBearing; }
139 double GetLauncherElevation() const { return mLauncherElevation; }
140 double GetLoftAngle() const { return mLoftAngle; }
141 double GetBurnTime() const { return mBurnTime; }
142 double GetTimeOfFlight() const { return mTimeOfFlight; }
143 double GetInterceptTime() const { return mInterceptTime; }
145 double GetTargetImpactTime() const { return mTargetImpactTime; }
147 double GetEndTime() const { return mEndTime; }
148 const WsfGeoPoint& GetEndPoint() const { return mEndPoint; }
150
155
156 void SetInterceptTime(double aInterceptTime)
157 {
158 mInterceptTime = aInterceptTime;
160 }
161
162 void SetInterceptPoint(const WsfGeoPoint& aInterceptPoint)
163 {
164 mInterceptPoint = aInterceptPoint;
166 }
167
168 void SetInterceptPointWCS(const double aLocationWCS[])
169 {
170 mInterceptPoint.SetLocationWCS(aLocationWCS);
172 }
173
174 void SetLaunchTime(double aLaunchTime)
175 {
176 mLaunchTime = aLaunchTime;
178 }
179
180 void SetTimeOfFlight(double aTimeOfFlight)
181 {
182 mTimeOfFlight = aTimeOfFlight;
184 }
185
186 void SetTargetImpactTime(double aImpactTime)
187 {
188 mTargetImpactTime = aImpactTime;
190 }
191
192 void SetLoftAngle(double aLoftAngle)
193 {
194 mLoftAngle = aLoftAngle;
196 }
197
198 void SetBurnTime(double aBurnTime)
199 {
200 mBurnTime = aBurnTime;
202 }
203
204 void SetLauncherBearing(double aBearing)
205 {
206 mLauncherBearing = aBearing;
208 }
209
210 void SetLauncherElevation(double aElevation)
211 {
212 mLauncherElevation = aElevation;
214 }
215
216 void SetTargetImpactPoint(const WsfGeoPoint& aImpactPoint)
217 {
218 mTargetImpactPoint = aImpactPoint;
220 }
221
222 void SetTargetImpactPointWCS(const double aLocationWCS[])
223 {
224 mTargetImpactPoint.SetLocationWCS(aLocationWCS);
226 }
227
228 void SetEndTime(double aEndTime)
229 {
230 mEndTime = aEndTime;
232 }
233
234 void SetEndPoint(const WsfGeoPoint& aLocation)
235 {
236 mEndPoint = aLocation;
238 }
239
240 void SetEndPointWCS(const double aLocationWCS[])
241 {
242 mEndPoint.SetLocationWCS(aLocationWCS);
244 }
245
246
250
251 void CopyResultsToTrack(WsfTrack& aTrack);
252
253 static bool GetLauncherBearing(const WsfTrack& aTrack, double& aBearing);
254 static bool GetLauncherElevation(const WsfTrack& aTrack, double& aElevation);
255 static bool GetLoftAngle(const WsfTrack& aTrack, double& aLoftAngle);
256 static bool GetBurnTime(const WsfTrack& aTrack, double& aBurnTime);
257 static bool GetInterceptTime(const WsfTrack& aTrack, double& aInterceptTime);
258 static bool GetInterceptPoint(const WsfTrack& aTrack, WsfGeoPoint& aPoint);
260
264
266 void SetCommandedLauncherBearing(double aBearing)
267 {
268 mCommandedLauncherBearing = aBearing;
270 }
271 void SetCommandedLauncherElevation(double aElevation)
272 {
273 mCommandedLauncherElevation = aElevation;
275 }
276 void SetCommandedLoftAngle(double aLoftAngle)
277 {
278 mCommandedLoftAngle = aLoftAngle;
280 }
281 void SetCommandedBurnTime(double aBurnTime)
282 {
283 mCommandedBurnTime = aBurnTime;
285 }
291
292
293 bool DebugEnabled() const { return mDebugEnabled; }
294 void SetDebugEnabled(bool aDebugEnabled) { mDebugEnabled = aDebugEnabled; }
295
296 bool ShowResults() const { return mShowResults; }
297
301
303 void SetComputerGenerationMode(bool aComputerGenerationMode) { mComputerGenerationMode = aComputerGenerationMode; }
305
306protected:
307 static bool GetDataValue(const WsfTrack& aTrack, const std::string& aName, double& aValue, double aMultiplier);
308
309 void InitializeResults(double aSimTime, const WsfTrack& aTrack);
310
311 void UpdateResults(double aSimTime, double aTimeToIntercept, const WsfTrack& aTrack);
312
313 void ClearConstraints();
314 void CopyConstraints(const bool aSrc[]);
315
316 double ExpectedFlightDistance() const { return mExpectedFlightDistance; }
317 double CurrentOpeningSpeed() const { return mCurrentOpeningSpeed; }
318
319 virtual bool InitializeTTIData();
320 virtual bool WithinConstraintsAt(double aSimTime, double aFutureInterceptTime, const WsfTrack& aTrack);
321
322 bool DeltaAltitudeCheck(double aDeltaAltitude) const;
323 bool SlantRangeCheck(double aSlantRange) const;
324 bool BoresightAngleCheck(WsfPlatform* aPlatPtr, double aLocWCS[3]) const;
325
327
332
337
345
353
355
358 unsigned int mValidityFlags;
363 double mBurnTime;
369 double mEndTime;
372
374
381
382private:
383 double mExpectedFlightDistance;
384 double mCurrentOpeningSpeed;
385 double mThrustingDistance;
386 double mCoastingDistance;
387};
388
389#endif
aObjectPtr Update(simTime)
Definition WsfGeoPoint.hpp:29
double ExpectedFlightDistance() const
Definition WsfLaunchComputer.hpp:316
bool ResultIsValidFor(unsigned int aDataMask) const
Definition WsfLaunchComputer.hpp:53
bool LoftAngleIsValid() const
Definition WsfLaunchComputer.hpp:127
double mMaxSlantRange
Definition WsfLaunchComputer.hpp:342
bool TargetImpactTimeIsValid() const
Definition WsfLaunchComputer.hpp:132
bool BurnTimeIsValid() const
Definition WsfLaunchComputer.hpp:128
void SetDebugEnabled(bool aDebugEnabled)
Definition WsfLaunchComputer.hpp:294
bool mShowResults
Definition WsfLaunchComputer.hpp:329
void SetThrustDuration(double aThrustTime)
Definition WsfLaunchComputer.hpp:110
double GetLoftAngle() const
Definition WsfLaunchComputer.hpp:140
static const double cUNDEFINED_DOUBLE
A constant indicating a value is undefined.
Definition WsfLaunchComputer.hpp:65
void SetCommandedLauncherBearing(double aBearing)
Definition WsfLaunchComputer.hpp:266
void SetEndTime(double aEndTime)
Definition WsfLaunchComputer.hpp:228
void SetLaunchTime(double aLaunchTime)
Definition WsfLaunchComputer.hpp:174
double mCommandedBurnTime
Definition WsfLaunchComputer.hpp:378
bool mComputerGenerationMode
Definition WsfLaunchComputer.hpp:330
void SetTargetImpactPoint(const WsfGeoPoint &aImpactPoint)
Definition WsfLaunchComputer.hpp:216
void SetInterceptTime(double aInterceptTime)
Definition WsfLaunchComputer.hpp:156
@ cVF_LOFT_ANGLE
Definition WsfLaunchComputer.hpp:42
@ cVF_LAUNCH_TIME
Definition WsfLaunchComputer.hpp:39
@ cVF_TARGET_IMPACT_TIME
Definition WsfLaunchComputer.hpp:47
@ cVF_LAUNCHER_ELEVATION
Definition WsfLaunchComputer.hpp:41
@ cVF_LAUNCHER_BEARING
Definition WsfLaunchComputer.hpp:40
@ cVF_BURN_TIME
Definition WsfLaunchComputer.hpp:43
@ cVF_TARGET_IMPACT_POINT
Definition WsfLaunchComputer.hpp:48
@ cVF_END_POINT
Definition WsfLaunchComputer.hpp:50
@ cVF_INTERCEPT_TIME
Definition WsfLaunchComputer.hpp:45
@ cVF_TIME_OF_FLIGHT
Definition WsfLaunchComputer.hpp:44
@ cVF_END_TIME
Definition WsfLaunchComputer.hpp:49
@ cVF_INTERCEPT_POINT
Definition WsfLaunchComputer.hpp:46
double mMinDeltaAltitude
Definition WsfLaunchComputer.hpp:339
double GetLauncherBearing() const
Definition WsfLaunchComputer.hpp:138
void SetCommandedBurnTime(double aBurnTime)
Definition WsfLaunchComputer.hpp:281
bool InterceptTimeIsValid() const
Definition WsfLaunchComputer.hpp:130
double mMaxDeltaAltitude
Definition WsfLaunchComputer.hpp:338
bool ShowResults() const
Definition WsfLaunchComputer.hpp:296
double mMinSlantRange
Definition WsfLaunchComputer.hpp:343
double GetBurnTime() const
Definition WsfLaunchComputer.hpp:141
const WsfGeoPoint & GetEndPoint() const
Definition WsfLaunchComputer.hpp:148
double mLastPredictionTime
Definition WsfLaunchComputer.hpp:356
WsfGeoPoint mCommandedInterceptPoint
Definition WsfLaunchComputer.hpp:379
double mBurnDuration
Definition WsfLaunchComputer.hpp:349
bool DebugEnabled() const
Definition WsfLaunchComputer.hpp:293
const WsfGeoPoint & GetTargetImpactPoint() const
Definition WsfLaunchComputer.hpp:146
void SetInterceptPointWCS(const double aLocationWCS[])
Definition WsfLaunchComputer.hpp:168
bool LauncherElevationIsValid() const
Definition WsfLaunchComputer.hpp:126
double mMaxOpeningSpeed
Definition WsfLaunchComputer.hpp:341
WsfLaunchComputer & operator=(const WsfLaunchComputer &)=delete
void SetMinTerminalSpeed(double aMinTerminalSpeed)
Definition WsfLaunchComputer.hpp:113
double mMinTerminalSpeed
Definition WsfLaunchComputer.hpp:352
static const double cFOREVER
Constant indicating a large amount of time, or "will never get there".
Definition WsfLaunchComputer.hpp:59
double GetLaunchTime() const
Definition WsfLaunchComputer.hpp:137
bool TargetImpactPointIsValid() const
Definition WsfLaunchComputer.hpp:133
unsigned int mValidityFlags
Definition WsfLaunchComputer.hpp:358
double mCommandedLauncherBearing
Definition WsfLaunchComputer.hpp:375
void SetBurnoutSpeed(double aBurnoutSpeed)
Definition WsfLaunchComputer.hpp:112
double mLauncherBearing
Definition WsfLaunchComputer.hpp:360
const WsfGeoPoint & GetInterceptPoint() const
Definition WsfLaunchComputer.hpp:144
bool mDebugEnabled
Definition WsfLaunchComputer.hpp:328
double CurrentOpeningSpeed() const
Definition WsfLaunchComputer.hpp:317
double mEndTime
Definition WsfLaunchComputer.hpp:369
bool LaunchTimeIsValid() const
Definition WsfLaunchComputer.hpp:124
double mTimeOfFlight
Definition WsfLaunchComputer.hpp:364
static bool LoadInstance(UtInput &aInput, WsfLaunchComputer *&aLCPtr)
bool LauncherBearingIsValid() const
Definition WsfLaunchComputer.hpp:125
void SetCommandedLauncherElevation(double aElevation)
Definition WsfLaunchComputer.hpp:271
bool EndPointIsValid() const
Definition WsfLaunchComputer.hpp:135
WsfLaunchComputer()
Definition WsfLaunchComputer.cpp:44
void SetCommandedInterceptPoint(const WsfGeoPoint &aPoint)
Definition WsfLaunchComputer.hpp:286
WsfGeoPoint mInterceptPoint
Definition WsfLaunchComputer.hpp:366
double mAvgCoastingAccel
Definition WsfLaunchComputer.hpp:351
WsfPlatform * GetPlatform() const
Return the platform with which this launch computer is associated.
Definition WsfLaunchComputer.hpp:96
void SetEndPointWCS(const double aLocationWCS[])
Definition WsfLaunchComputer.hpp:240
static std::string BaseTypeName()
Definition WsfLaunchComputer.hpp:56
bool ComputerGenerationMode() const
Definition WsfLaunchComputer.hpp:302
Constraints
Definition WsfLaunchComputer.hpp:68
@ cMIN_DELTA_ALTITUDE
Constraint index indicating the lowest attainable target altitude.
Definition WsfLaunchComputer.hpp:70
@ cMAX_BORESIGHT_ANGLE
Constraint index indicating the maximum successful off-boresight angle.
Definition WsfLaunchComputer.hpp:75
@ cMAX_SLANT_RANGE
Constraint index indicating the longest attainable target slant range.
Definition WsfLaunchComputer.hpp:73
@ cNUMBER_OF_CONSTRAINTS
Used internally as a loop counter limit.
Definition WsfLaunchComputer.hpp:76
@ cMAX_OPENING_SPEED
Constraint index indicating the maximum opening speed (positive = diverging).
Definition WsfLaunchComputer.hpp:72
@ cMIN_SLANT_RANGE
Constraint index indicating the longest attainable (2-D) ground range.
Definition WsfLaunchComputer.hpp:74
@ cMIN_OPENING_SPEED
Constraint index indicating the minimum opening speed (positive = diverging).
Definition WsfLaunchComputer.hpp:71
@ cMAX_DELTA_ALTITUDE
Constraint index indicating the highest attainable target altitude.
Definition WsfLaunchComputer.hpp:69
double mCoastTime
Definition WsfLaunchComputer.hpp:350
void SetLauncherElevation(double aElevation)
Definition WsfLaunchComputer.hpp:210
double GetInterceptTime() const
Definition WsfLaunchComputer.hpp:143
double GetTargetImpactTime() const
Definition WsfLaunchComputer.hpp:145
bool InterceptPointIsValid() const
Definition WsfLaunchComputer.hpp:131
~WsfLaunchComputer() override=default
double mLaunchTime
Definition WsfLaunchComputer.hpp:359
double mPredictionLockinTime
Definition WsfLaunchComputer.hpp:336
void SetBurnTime(double aBurnTime)
Definition WsfLaunchComputer.hpp:198
double mMaximumTOF
Definition WsfLaunchComputer.hpp:346
WsfWeapon * mWeaponPtr
Definition WsfLaunchComputer.hpp:326
void SetInterceptPoint(const WsfGeoPoint &aInterceptPoint)
Definition WsfLaunchComputer.hpp:162
double mAvgThrustingAccel
Definition WsfLaunchComputer.hpp:347
double mLauncherElevation
Definition WsfLaunchComputer.hpp:361
double mBurnoutSpeed
Definition WsfLaunchComputer.hpp:348
double mCommandedLauncherElevation
Definition WsfLaunchComputer.hpp:376
void SetTimeOfFlight(double aTimeOfFlight)
Definition WsfLaunchComputer.hpp:180
WsfGeoPoint mEndPoint
Definition WsfLaunchComputer.hpp:370
double mCosineMaxBoresight
Definition WsfLaunchComputer.hpp:344
double GetEndTime() const
Definition WsfLaunchComputer.hpp:147
double mBurnTime
Definition WsfLaunchComputer.hpp:363
void SetLoftAngle(double aLoftAngle)
Definition WsfLaunchComputer.hpp:192
void SetTargetImpactPointWCS(const double aLocationWCS[])
Definition WsfLaunchComputer.hpp:222
bool EndTimeIsValid() const
Definition WsfLaunchComputer.hpp:134
WsfWeapon * GetWeapon() const
Return the weapon with which this launch computer is associated.
Definition WsfLaunchComputer.hpp:93
static const double cOUT_OF_REACH
Constant indicating an unattainable distance, or "a long way away".
Definition WsfLaunchComputer.hpp:62
bool mConstraintEnabled[cNUMBER_OF_CONSTRAINTS]
Definition WsfLaunchComputer.hpp:331
void ClearCommandedValues()
Definition WsfLaunchComputer.hpp:265
void SetLauncherBearing(double aBearing)
Definition WsfLaunchComputer.hpp:204
double mInterceptTime
Definition WsfLaunchComputer.hpp:365
double mTargetImpactTime
Definition WsfLaunchComputer.hpp:367
WsfGeoPoint mTargetImpactPoint
Definition WsfLaunchComputer.hpp:368
double GetTimeOfFlight() const
Definition WsfLaunchComputer.hpp:142
bool TimeOfFlightIsValid() const
Definition WsfLaunchComputer.hpp:129
bool HaveResultsFor(const WsfTrackId &aTrackId) const
Definition WsfLaunchComputer.hpp:122
void SetCoastDuration(double aCoastTime)
Definition WsfLaunchComputer.hpp:111
double mMinOpeningSpeed
Definition WsfLaunchComputer.hpp:340
double GetLauncherElevation() const
Definition WsfLaunchComputer.hpp:139
double mCommandedLoftAngle
Definition WsfLaunchComputer.hpp:377
void SetEndPoint(const WsfGeoPoint &aLocation)
Definition WsfLaunchComputer.hpp:234
void SetCommandedLoftAngle(double aLoftAngle)
Definition WsfLaunchComputer.hpp:276
void SetComputerGenerationMode(bool aComputerGenerationMode)
Definition WsfLaunchComputer.hpp:303
void SetMaximumTimeOfFlight(double aMaxTOF)
Definition WsfLaunchComputer.hpp:109
double mLoftAngle
Definition WsfLaunchComputer.hpp:362
void SetTargetImpactTime(double aImpactTime)
Definition WsfLaunchComputer.hpp:186
WsfTrackId mLastPredictionTrackId
Definition WsfLaunchComputer.hpp:357
virtual bool Initialize(double aSimTime, WsfWeapon *aWeaponPtr)
Definition WsfLaunchComputer.cpp:393
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
const char * GetScriptClassName() const override
Definition WsfObject.cpp:115
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfTrackId.hpp:33
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfWeapon.hpp:63
Copyrights Multiple, All Rights Reserved