WSF
WsfGuidedMoverBase.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// Updated by Infoscitex, a DCS Company
13// ****************************************************************************
14
15#ifndef WSFGUIDEDMOVERBASE_HPP
16#define WSFGUIDEDMOVERBASE_HPP
17
18#include "wsf_mil_export.h"
19
20#include <fstream>
21
22#include "UtAtmosphere.hpp"
23#include "UtCallback.hpp"
24#include "UtEntity.hpp"
25class UtInput;
26#include "UtLog.hpp"
27#include "WsfMover.hpp"
29class WsfProcessor;
30#include "WsfRoute.hpp"
31class WsfWeapon;
32
34
35class WSF_MIL_EXPORT WsfGuidedMoverBase : public WsfMover
36{
37public:
39 ~WsfGuidedMoverBase() override;
41
43
44 bool Initialize(double aSimTime) override;
45 bool Initialize2(double aSimTime) override;
46 bool ProcessInput(UtInput& aInput) override;
47 void Update(double aSimTime) override;
49
51
52 void PartBroken(double aSimTime) override;
54
56
58
59 const WsfRoute* GetRoute() const override;
60
61 // IsExtrapolating is used to signify that boost phase is complete.
62 bool IsExtrapolating() const override { return mBoostComplete; }
63
64 bool IsPaused() const override { return mFMM_Time < 0.0; }
65
66 bool IsStopped() const override { return mFMM_Time < 0.0; }
67
68 bool SetRoute(double aSimTime, const WsfRoute& aRoute) override;
69
70 bool UpdateRoute(double aSimTime, const WsfRoute& aRoute) override;
72
75 virtual void SetGuidance(WsfMoverGuidance* aGuidancePtr) { mGuidancePtr = aGuidancePtr; }
76
78 virtual WsfMoverGuidance* GetGuidance() const { return mGuidancePtr; }
79
81
82
85 virtual void SetYandZForces(double aYForce, double aZForce)
86 {
87 mYForce = aYForce;
88 mZForce = aZForce;
89 }
90
92 virtual void SetCommandedYawRate(double aRate) { mCommandedYawRate = aRate; }
93
95 virtual void SetCommandedPitchRate(double aRate) { mCommandedPitchRate = aRate; }
96
98 virtual void SetCommandedRollRate(double aRate) { mCommandedRollRate = aRate; }
99
103 virtual void SetCommandedSpeed(double aCommandedSpeed) { mCommandedSpeed = aCommandedSpeed; }
104
108 virtual void SetCommandedThrottle(double aCommandedThrottle) { mCommandedThrottle = aCommandedThrottle; }
109
112 virtual void SetCommandedEngineStopTime(double aStopTime) { mCommandedEngineStopTime = aStopTime; }
113
120 virtual void SetMinimumHeightAboveTerrain(double aMinimum) { mMinimumHeightAboveTerrain = aMinimum; }
121
123 virtual size_t CurrentStage() const { return mStageIndex; }
124
125 virtual void EjectStage(double aSimTime, double aPreSeparationCoastTime, double aPreIgnitionCoastTime);
127
132
133 UtCallbackListN<void(double)> RouteChanged;
134 UtCallbackListN<void(double, double)> StageIgnition;
135 UtCallbackListN<void(double, double)> StageBurnout;
136 UtCallbackListN<void(double, double)> StageSeparation;
138
139 void WriteKinematicStatus(ut::log::MessageStream& aStream);
140
141protected:
142 enum Phase
143 {
144 cPHASE_PRE_BURN, //<! Coasting, after separation of previous stage, before starting engine
145 cPHASE_BURN, //<! Engine running
146 cPHASE_POST_BURN, //<! Coasting after expenditure of fuel, before stage separation.
147 cPHASE_FAIL //<! Coasting after a failure (ignition, staging, etc.)
148 };
149
150 // Declare default copy constructor (for Clone())
152
164 virtual void AdvanceTime(double aSimTime, double aBegTime, double& aEndTime, Phase& aNextPhase) = 0;
165
166 void CallStagingEventScript(double aSimTime, const std::string& aScriptName);
167
168 virtual void InitiateMotion(double aSimTime, double aCurTime);
169
170 virtual bool SeparateStage(double aSimTime, size_t aStageIndex);
171
172 virtual bool IgniteStage(double aSimTime, size_t aStageIndex);
173
174 virtual void InitiateStage(double aSimTime, double aCurTime, size_t aStageIndex);
175
176 virtual void PostUpdate(double aSimTime);
177
178 void PrelaunchAdvanceTime(double aSimTime, double aCurTime);
179
180 void PrelaunchComplete(double aSimTime, double aCurTime);
181
182 void SetInitialState(double aSimTime, double aCurTime, bool aInitiatingMotion);
183
184 virtual void WriteStagingMessage(ut::log::MessageStream& aStream,
185 double aSimTime,
186 double aCurTime,
187 const std::string& aStatus,
188 size_t aStageIndex);
189
190 virtual void WriteTrajectoryOutput(double aSimTime, double aCurTime, const double aECS_Forces[3]);
191
195
203
206
209
210 size_t mStageIndex;
211
214
217
219
221
230
233
235 double mYForce;
236 double mZForce;
242
247
252
255
262
263 UtAtmosphere mAtmosphere;
265
267
268 double mFMM_Time;
269 double mFMM_LocWCS[3];
272
273 std::string mTimeHistoryPath;
274 std::ofstream mTimeHistoryOfs;
275
280
281private:
282 void AdvanceTimeInternal(double aSimTime, double aBegTime, double& aEndTime);
283};
284
285#endif
WsfSpatialDomain
A collection of enumerations and type definitions that are used across a number of components.
Definition WsfTypes.hpp:32
@ WSF_SPATIAL_DOMAIN_AIR
Cars, trucks, buildings, etc.
Definition WsfTypes.hpp:35
An abstract base class that defines an interface for guided movers.
Definition WsfGuidedMoverBase.hpp:36
bool IsStopped() const override
Return whether the mover (and its attached platform) is stopped.
Definition WsfGuidedMoverBase.hpp:66
void PrelaunchComplete(double aSimTime, double aCurTime)
Definition WsfGuidedMoverBase.cpp:803
double mCommandedYawRate
Definition WsfGuidedMoverBase.hpp:239
Phase mPhase
Definition WsfGuidedMoverBase.hpp:222
virtual void WriteStagingMessage(ut::log::MessageStream &aStream, double aSimTime, double aCurTime, const std::string &aStatus, size_t aStageIndex)
Definition WsfGuidedMoverBase.cpp:941
WsfGuidedMoverBase(WsfScenario &aScenario)
Definition WsfGuidedMoverBase.cpp:55
virtual void SetCommandedYawRate(double aRate)
Set the commanded yaw rate.
Definition WsfGuidedMoverBase.hpp:92
void CallStagingEventScript(double aSimTime, const std::string &aScriptName)
Definition WsfGuidedMoverBase.cpp:708
bool mMatchOwningPlatHeading
If true, sets unguided mover heading to match owning platform's velocity vector, rather than orientat...
Definition WsfGuidedMoverBase.hpp:259
virtual void SetCommandedSpeed(double aCommandedSpeed)
Definition WsfGuidedMoverBase.hpp:103
bool mBoostComplete
'true' if the boost phase has been declared complete.
Definition WsfGuidedMoverBase.hpp:216
double mCommandedPitchRate
Definition WsfGuidedMoverBase.hpp:238
bool mCheckForGroundImpact
If true, check for ground impact directly instead of relying on a 'fuse' processor.
Definition WsfGuidedMoverBase.hpp:261
double mLaunchComputerBurnTime
The time (relative to launch) when then launch computer has indicated the engines are to shut down.
Definition WsfGuidedMoverBase.hpp:232
double mCommandedPreSeparationCoastTime
Override of the pre_separation_coast_time for the NEXT stage (from EjectStage).
Definition WsfGuidedMoverBase.hpp:249
bool mShowStatus
show initial conditions on standard output
Definition WsfGuidedMoverBase.hpp:256
void PrelaunchAdvanceTime(double aSimTime, double aCurTime)
Advance time while still attached to the launch platform.
Definition WsfGuidedMoverBase.cpp:772
virtual void PostUpdate(double aSimTime)
Definition WsfGuidedMoverBase.cpp:937
double mLastAdvanceTime
The time to which 'mExternalState' is applicable.
Definition WsfGuidedMoverBase.hpp:205
double mYForce
Definition WsfGuidedMoverBase.hpp:235
UtCallbackListN< void(double, double)> StageBurnout
Definition WsfGuidedMoverBase.hpp:135
double mFMM_Time
Information captured at time of 'first missile motion' (needed by trajectory output).
Definition WsfGuidedMoverBase.hpp:268
bool IsPaused() const override
Definition WsfGuidedMoverBase.hpp:64
virtual void SetCommandedRollRate(double aRate)
Set the commanded roll rate.
Definition WsfGuidedMoverBase.hpp:98
void SetInitialState(double aSimTime, double aCurTime, bool aInitiatingMotion)
Definition WsfGuidedMoverBase.cpp:832
bool mShowTrajectory
Definition WsfGuidedMoverBase.hpp:257
UtCallbackListN< void(double)> RouteChanged
Definition WsfGuidedMoverBase.hpp:133
double mFMM_Heading
Definition WsfGuidedMoverBase.hpp:270
std::string mTimeHistoryPath
Definition WsfGuidedMoverBase.hpp:273
WsfMoverGuidance * mGuidancePtr
Definition WsfGuidedMoverBase.hpp:234
virtual size_t CurrentStage() const
Currently active Stage for this object.
Definition WsfGuidedMoverBase.hpp:123
UtAtmosphere mAtmosphere
Definition WsfGuidedMoverBase.hpp:263
void WriteKinematicStatus(ut::log::MessageStream &aStream)
Definition WsfGuidedMoverBase.cpp:657
double mCommandedPreIgnitionCoastTime
Override of the pre_ignition_coast_time for the CURRENT stage (from EjectStage).
Definition WsfGuidedMoverBase.hpp:251
double mFMM_LocWCS[3]
Definition WsfGuidedMoverBase.hpp:269
virtual void WriteTrajectoryOutput(double aSimTime, double aCurTime, const double aECS_Forces[3])
Write trajectory output if requested by the user.
Definition WsfGuidedMoverBase.cpp:962
WsfSpatialDomain GetSpatialDomain() const override
Definition WsfGuidedMoverBase.hpp:57
virtual void AdvanceTime(double aSimTime, double aBegTime, double &aEndTime, Phase &aNextPhase)=0
size_t mLaunchPlatformIndex
Definition WsfGuidedMoverBase.hpp:278
WsfGuidedMoverBase & operator=(const WsfGuidedMoverBase &)=delete
bool IsExtrapolating() const override
Definition WsfGuidedMoverBase.hpp:62
double mMinimumHeightAboveTerrain
The minimum height above terrain required for terrain following.
Definition WsfGuidedMoverBase.hpp:254
size_t mStageIndex
The index of the current stage.
Definition WsfGuidedMoverBase.hpp:210
double mCommandedEngineStopTime
Definition WsfGuidedMoverBase.hpp:246
Phase
Definition WsfGuidedMoverBase.hpp:143
@ cPHASE_POST_BURN
Definition WsfGuidedMoverBase.hpp:146
@ cPHASE_PRE_BURN
Definition WsfGuidedMoverBase.hpp:144
@ cPHASE_BURN
Definition WsfGuidedMoverBase.hpp:145
@ cPHASE_FAIL
Definition WsfGuidedMoverBase.hpp:147
virtual void SetCommandedThrottle(double aCommandedThrottle)
Definition WsfGuidedMoverBase.hpp:108
virtual void SetCommandedPitchRate(double aRate)
Set the commanded pitch rate.
Definition WsfGuidedMoverBase.hpp:95
double mCommandedThrottle
Definition WsfGuidedMoverBase.hpp:241
std::ofstream mTimeHistoryOfs
Definition WsfGuidedMoverBase.hpp:274
WsfWeapon * mLaunchWeaponPtr
Definition WsfGuidedMoverBase.hpp:279
virtual void SetMinimumHeightAboveTerrain(double aMinimum)
Definition WsfGuidedMoverBase.hpp:120
double mSeaLevelPressure
Definition WsfGuidedMoverBase.hpp:264
UtCallbackListN< void(double, double)> StageSeparation
Definition WsfGuidedMoverBase.hpp:136
double mPreIgnitionCoastTime
The amount of time that must elapse prior to ignition.
Definition WsfGuidedMoverBase.hpp:226
virtual WsfMoverGuidance * GetGuidance() const
Get the pointer to the mover guidance object.
Definition WsfGuidedMoverBase.hpp:78
size_t mBoostCompleteStageIndex
The index of the stage, which when the burn completes, signifies the boost phase is complete.
Definition WsfGuidedMoverBase.hpp:213
double mCommandedSpeed
Definition WsfGuidedMoverBase.hpp:240
double mIntegrationTimestep
The timestep for fixed-timestep movement.
Definition WsfGuidedMoverBase.hpp:208
virtual void SetCommandedEngineStopTime(double aStopTime)
Definition WsfGuidedMoverBase.hpp:112
double mZForce
Definition WsfGuidedMoverBase.hpp:236
double mLaunchTime
Definition WsfGuidedMoverBase.hpp:194
virtual bool SeparateStage(double aSimTime, size_t aStageIndex)
The base mover only supports a single stage.
Definition WsfGuidedMoverBase.cpp:733
virtual void InitiateMotion(double aSimTime, double aCurTime)
Definition WsfGuidedMoverBase.cpp:726
virtual void SetYandZForces(double aYForce, double aZForce)
Definition WsfGuidedMoverBase.hpp:85
virtual bool IgniteStage(double aSimTime, size_t aStageIndex)
The base mover only supports a single stage.
Definition WsfGuidedMoverBase.cpp:740
double mPreSeparationCoastTime
The amount of tame that must elapse after the motor turns off and stage separation.
Definition WsfGuidedMoverBase.hpp:228
double mPhaseStartTime
The simulation time when the phase started.
Definition WsfGuidedMoverBase.hpp:224
UtEntity mExternalState
Definition WsfGuidedMoverBase.hpp:202
WsfRoute mRoute
A route to follow (if guidance supports it).
Definition WsfGuidedMoverBase.hpp:218
virtual void SetGuidance(WsfMoverGuidance *aGuidancePtr)
Definition WsfGuidedMoverBase.hpp:75
double mCommandedRollRate
Definition WsfGuidedMoverBase.hpp:237
UtCallbackListN< void(double, double)> StageIgnition
Definition WsfGuidedMoverBase.hpp:134
virtual void InitiateStage(double aSimTime, double aCurTime, size_t aStageIndex)
Definition WsfGuidedMoverBase.cpp:747
Definition WsfMoverGuidance.hpp:23
bool ProcessInput(UtInput &aInput) override
Definition WsfMover.cpp:138
bool Initialize(double aSimTime) override
Definition WsfMover.cpp:108
bool Initialize2(double aSimTime) override
Definition WsfPlatformPart.cpp:291
void PartBroken(double aSimTime) override
Definition WsfMover.cpp:282
WsfMover()=delete
virtual const WsfRoute * GetRoute() const
Definition WsfMover.cpp:348
virtual bool SetRoute(double aSimTime, const WsfRoute &aRoute)
Definition WsfMover.cpp:481
void Update(double aSimTime) override
Definition WsfMover.cpp:310
virtual bool UpdateRoute(double aSimTime, const WsfRoute &aRoute)
Definition WsfMover.cpp:492
Definition WsfProcessor.hpp:39
A collection of WsfWaypoint objects that represent a path to be followed.
Definition WsfRoute.hpp:40
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfWeapon.hpp:63
Copyrights Multiple, All Rights Reserved