15#ifndef WSFGUIDEDMOVER_HPP
16#define WSFGUIDEDMOVER_HPP
18#include "wsf_mil_export.h"
22#include "UtCloneablePtr.hpp"
23#include "UtECI_Conversion.hpp"
25#include "UtRungeKutta.hpp"
47 using CurvePtr = UtCloneablePtr<UtTable::Curve>;
48 using TablePtr = UtCloneablePtr<UtTable::Table>;
71 bool GetPropertyDouble(
const std::string& aPropertyName,
double& aProperty)
override;
89 UtVec3d::Set(aThrustForcesECS,
mCurState.mLastThrustForcesECS);
91 double GetMaximumLateralAerodynamicForce()
const;
92 double GetDynamicPressure()
const;
93 double GetGravitationalAcceleration()
const;
99 double GetEmptyMass()
const;
100 double GetFuelMass()
const;
101 double GetPayloadMass()
const;
102 double GetTotalMass()
const;
105 double GetEmptyMass(
size_t aStageIndex)
const;
106 double GetFuelMass(
size_t aStageIndex)
const;
107 double GetPayloadMass(
size_t aStageIndex)
const;
108 double GetTotalMass(
size_t aStageIndex)
const;
117 double GetLevelFlightThrust(
double aSimTime,
double aAltitude_m,
double aMach)
const;
119 double GetLevelFlightDrag(
double aAltitude_m,
double aMach,
double aWeight_N)
const;
121 double GetLevelFlightFuelBurnRate(
double aSimTime,
double aAltitude_m,
double aSpeed_mps,
double aWeight_N)
const;
327 void SetDxDt(
const UtVec3d& aDxDt) { mX = aDxDt; }
328 void SetDvDt(
const UtVec3d& aDvDt) { mY = aDvDt; }
333 return KinematicState{mX * aScaling, mY * aScaling, mZ * aScaling};
338 return KinematicState{mX + aOther.mX, mY + aOther.mY, mZ + aOther.mZ};
355 void Print(ut::log::MessageStream& aMsgStream,
double aFMM_Time);
363 const State& aInitialState,
364 bool aIntegrateMass =
false);
419 void AdvanceTime(
double aSimTime,
double aBegTime,
double& aEndTime,
Phase& aNextPhase)
override;
427 bool SeparateStage(
double aSimTime,
size_t aStageIndex)
override;
429 bool IgniteStage(
double aSimTime,
size_t aStageIndex)
override;
431 void InitiateStage(
double aSimTime,
double aCurTime,
size_t aStageIndex)
override;
444 template<
typename Callable>
447 return ut::RK2_Step<State, KinematicState>(aSimTime, aState, aRightHandSide);
454 template<
typename Callable>
457 return ut::RK4_Step<State, KinematicState>(aSimTime, aState, aRightHandSide);
462 template<
typename StepFunction>
470 double dt = aEndTime - aBegTime;
473 auto rhs = [
this, aSimTime, aBegTime, aEndTime, &stage, &first, &aeroSave](
State& aState)
479 UtVec3d::Set(aeroSave.GetData(), aState.mLastAeroForcesECS);
482 retval.
SetDxDt(aState.mVelocity);
483 retval.
SetDvDt(aState.mAcceleration);
484 retval.
SetDmDt(aState.mCurrentFuelFlowRate);
488 auto step = StepFunction::Step(dt,
mCurState, rhs);
493 void ComputeDivertForces(
double aDeltaTime,
495 double aCommandedForceY,
496 double aCommandedForceZ,
497 double aAppliedForcesECS[3],
498 double aDivertThrustForcesECS[3])
const;
500 void ComputeThrustForces(
double aSimTime,
double aDeltaTime, State& aState, Stage& aStage,
double aThrustForceECS[3])
const;
502 double GetHorizontalThrust(
double aSimTime,
505 double aCommandedThrottle,
506 const double aIV_Values[6],
507 Stage& aCurrentStage)
const;
509 void ComputeVectoredThrustForces(
double aSimTime,
510 double aCommandedForceY,
511 double aCommandedForceZ,
513 double aThrustForceECS[3])
const;
515 void ComputeAeroForces(
double aSimTime,
518 const double aThrustForcesECS[3],
519 double aAeroForcesECS[3])
const;
521 void ComputeThrustForCommandedSpeed(
double aDeltaT,
524 const double aAeroForcesECS[3],
525 double aThrustForcesECS[3])
const;
527 double GetTimeConstant(
const Stage& aStage)
const;
529 void ComputeFullForces(
double aSimTime,
double aBegTime,
double aEndTime, State& aRHS_State, Stage& aRHS_Stage)
const;
531 void IntegrateEOM(
double aDeltaTime,
const double aAppliedForcesECS[3], State& aOutState, State& aInState1, State& aInState2);
533 void JettisonEjectables(
double aSimTime);
535 bool SelectCoordinateFrame(
const State& aState, CoordinateFrame& aTargetFrame)
const;
537 void SwitchCoordinateFrame(State& aState, CoordinateFrame aTargetFrame);
539 void UpdateExternalState(State& aState);
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfAero.hpp:30
bool Initialize(double aSimTime) override
Definition WsfGuidedMoverBase.cpp:166
WsfGuidedMoverBase(WsfScenario &aScenario)
Definition WsfGuidedMoverBase.cpp:55
virtual void PostUpdate(double aSimTime)
Definition WsfGuidedMoverBase.cpp:937
bool ProcessInput(UtInput &aInput) override
Definition WsfGuidedMoverBase.cpp:258
virtual void AdvanceTime(double aSimTime, double aBegTime, double &aEndTime, Phase &aNextPhase)=0
size_t mStageIndex
The index of the current stage.
Definition WsfGuidedMoverBase.hpp:210
Phase
Definition WsfGuidedMoverBase.hpp:143
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
bool Initialize2(double aSimTime) override
Definition WsfGuidedMoverBase.cpp:192
virtual bool IgniteStage(double aSimTime, size_t aStageIndex)
The base mover only supports a single stage.
Definition WsfGuidedMoverBase.cpp:740
virtual void InitiateStage(double aSimTime, double aCurTime, size_t aStageIndex)
Definition WsfGuidedMoverBase.cpp:747
Definition WsfGuidedMoverTestObject.hpp:21
double mMass
Definition WsfGuidedMover.hpp:410
std::string mName
Definition WsfGuidedMover.hpp:409
double mAltitude
Definition WsfGuidedMover.hpp:412
Ejectable()
Definition WsfGuidedMover.hpp:402
double mTime
Definition WsfGuidedMover.hpp:411
Definition WsfGuidedMover.hpp:305
const UtVec3d & GetVelocity() const
Definition WsfGuidedMover.hpp:316
void SetDxDt(const UtVec3d &aDxDt)
Definition WsfGuidedMover.hpp:327
void SetDmDt(double aDmDt)
Definition WsfGuidedMover.hpp:329
void SetFuelMass(double aMass)
Definition WsfGuidedMover.hpp:325
KinematicState operator*(double aScaling) const
Definition WsfGuidedMover.hpp:331
void SetVelocity(const UtVec3d &aVelocity)
Definition WsfGuidedMover.hpp:324
KinematicState operator+(const KinematicState &aOther) const
Definition WsfGuidedMover.hpp:336
const UtVec3d & GetDxDt() const
Definition WsfGuidedMover.hpp:319
const UtVec3d & GetPosition() const
Definition WsfGuidedMover.hpp:315
double GetFuelMass() const
Definition WsfGuidedMover.hpp:317
const UtVec3d & GetDvDt() const
Definition WsfGuidedMover.hpp:320
void SetDvDt(const UtVec3d &aDvDt)
Definition WsfGuidedMover.hpp:328
double GetDmDt() const
Definition WsfGuidedMover.hpp:321
KinematicState(const UtVec3d &aX, const UtVec3d &aY, double aZ)
Definition WsfGuidedMover.hpp:308
void SetPosition(const UtVec3d &aPosition)
Definition WsfGuidedMover.hpp:323
Definition WsfGuidedMover.hpp:134
double mThrustSeaLevel
The thrust (N) at sea level.
Definition WsfGuidedMover.hpp:200
double mLateralThrustGain
Lateral thrust gain for TVC and divert.
Definition WsfGuidedMover.hpp:267
double mPreIgnitionCoastTime
Coast time between separation of previous state and ignition of this stage.
Definition WsfGuidedMover.hpp:239
EngineType mEngineType
The type of the engine.
Definition WsfGuidedMover.hpp:176
double mProbabilityOfSeparation
The probability of separation of this stage from subsequent stages.
Definition WsfGuidedMover.hpp:273
double mMaxTVC_Angle
Maximum TVC angle.
Definition WsfGuidedMover.hpp:264
double mThrustDuration
The engine burn time (sec).
Definition WsfGuidedMover.hpp:236
CurvePtr mVacuumThrustTablePtr
Vacuum thrust as a function of time.
Definition WsfGuidedMover.hpp:212
double mTotalMass
Definition WsfGuidedMover.hpp:194
double mThrust
The thrust (N).
Definition WsfGuidedMover.hpp:197
double mSpecificImpulseSeaLevel
The specific impulse (sec) at sea level.
Definition WsfGuidedMover.hpp:221
double mIntegrationTimestep
The integration timestep.
Definition WsfGuidedMover.hpp:270
double mPayloadMass
Definition WsfGuidedMover.hpp:294
bool mFinalBoostStage
Definition WsfGuidedMover.hpp:287
TablePtr mTimeConstantPtr
The airframe time constant.
Definition WsfGuidedMover.hpp:252
double mThrustVacuum
The thrust (N) in vacuum.
Definition WsfGuidedMover.hpp:203
ThrustReference mThrustReference
Reference for thrust.
Definition WsfGuidedMover.hpp:179
bool mReverseThrust
'true' if the direction of the thrust should be reversed.
Definition WsfGuidedMover.hpp:282
double mBurnRate
The rate of fuel expenditure (Kg/Sec).
Definition WsfGuidedMover.hpp:227
double mMaxTVC_Time
The maximum time that thrust vector control can be used (relative to ignition start).
Definition WsfGuidedMover.hpp:261
bool Initialize(double aSimTime, WsfGuidedMover *aMoverPtr, bool aShowStatus)
Definition WsfGuidedMover.cpp:2608
TablePtr mThrottlePtr
The throttle setting.
Definition WsfGuidedMover.hpp:233
WsfStringId mAeroId
The string ID of the aerodynamic attributes to be used.
Definition WsfGuidedMover.hpp:246
void ShowStatus(WsfGuidedMover *aMoverPtr, ut::log::MessageStream &aMsgStream) const
Definition WsfGuidedMover.cpp:3121
EngineType
Definition WsfGuidedMover.hpp:137
@ cNONE
Definition WsfGuidedMover.hpp:138
@ cJET
Definition WsfGuidedMover.hpp:140
@ cROCKET
Definition WsfGuidedMover.hpp:139
bool ProcessInput(UtInput &aInput)
Definition WsfGuidedMover.cpp:2812
double mNozzleExitArea
The nozzle exit area (m^2).
Definition WsfGuidedMover.hpp:215
TurnMethod mTurnMethod
The visual method for turns (skid or bank).
Definition WsfGuidedMover.hpp:279
double mEmptyMass
Definition WsfGuidedMover.hpp:186
bool CompletePairedValues(WsfGuidedMover *aMoverPtr)
Definition WsfGuidedMover.cpp:2328
CurvePtr mThrustTablePtr
Thrust as a function of time.
Definition WsfGuidedMover.hpp:206
ThrustReference
Definition WsfGuidedMover.hpp:144
@ cPAIRED
Definition WsfGuidedMover.hpp:148
@ cSEA_LEVEL
Definition WsfGuidedMover.hpp:147
@ cVACUUM
Definition WsfGuidedMover.hpp:146
@ cDEFAULT
Definition WsfGuidedMover.hpp:145
double mMinTVC_Time
The minimum time that thrust vector control can be used (relative to ignition start).
Definition WsfGuidedMover.hpp:258
double mPreSeparationCoastTime
Definition WsfGuidedMover.hpp:243
TurnMethod
Definition WsfGuidedMover.hpp:152
@ cBANK_TO_TURN
Definition WsfGuidedMover.hpp:154
@ cSKID_TO_TURN
Definition WsfGuidedMover.hpp:153
Stage()
Definition WsfGuidedMover.cpp:2228
TablePtr mAngleOfAttackPtr
The angle of attack.
Definition WsfGuidedMover.hpp:255
double mSpecificImpulseVacuum
The specific impulse (sec) in vacuum.
Definition WsfGuidedMover.hpp:224
CurvePtr mBurnRateTablePtr
The rate of fuel expenditure as a function of time.
Definition WsfGuidedMover.hpp:230
WsfAero * mAeroPtr
The pointer to the aerodynamic attributes to be used.
Definition WsfGuidedMover.hpp:249
double mSpecificImpulse
The specific impulse (sec).
Definition WsfGuidedMover.hpp:218
double ComputeSpecificImpulse(double aAmbientPressure, double aSeaLevelPressure) const
Definition WsfGuidedMover.cpp:3188
double mFuelMass
Definition WsfGuidedMover.hpp:190
double mProbabilityOfIgnition
The probability of ignition of this stage.
Definition WsfGuidedMover.hpp:276
ThrustReference mImpulseReference
Reference for specific impulse.
Definition WsfGuidedMover.hpp:182
double ComputeTimeWeightedAverage(const UtTable::Curve &aCurve) const
Definition WsfGuidedMover.cpp:2452
CurvePtr mSeaLevelThrustTablePtr
Sea level thrust as a function of time.
Definition WsfGuidedMover.hpp:209
bool ComputeUnknownValues(WsfGuidedMover *aMoverPtr, int &aRecursionDepth)
Definition WsfGuidedMover.cpp:2472
Stage & operator=(const Stage &)=delete
double DetermineCurrentThrust(double aAmbientPressure, double aSeaLevelPressure, double aPhaseTime)
Definition WsfGuidedMover.cpp:3234
Definition WsfGuidedMover.hpp:351
double mCurrentFuelMass
Definition WsfGuidedMover.hpp:391
State()
Definition WsfGuidedMover.cpp:3297
double mSpeed
Definition WsfGuidedMover.hpp:384
double mTime
Definition WsfGuidedMover.hpp:372
double mVelocity[3]
Definition WsfGuidedMover.hpp:375
KinematicState GetDerivatives() const
Definition WsfGuidedMover.cpp:3397
void ComputeDerivatives(const double aAppliedForcesECS[3])
Definition WsfGuidedMover.cpp:1443
void ComputeGravitationalForce(double aGravitationalForceWCS[3]) const
Definition WsfGuidedMover.cpp:1714
State Advance(double aDeltaT, const KinematicState &aKinematicState) const
Definition WsfGuidedMover.cpp:3367
void TakeEulerStep(double aDeltaTime, const KinematicState &aDerivatives, const State &aInitialState, bool aIntegrateMass=false)
Definition WsfGuidedMover.cpp:1775
double mAltitude
Definition WsfGuidedMover.hpp:383
KinematicState GetUnpoweredDerivatives() const
Definition WsfGuidedMover.cpp:3402
void UpdateOtherStateData(double aSimTime)
Definition WsfGuidedMover.cpp:2194
double mThrustDurationExtension
The amount of time the thrust duration is extended due to commanded throttle.
Definition WsfGuidedMover.hpp:389
double mAppliedForcesECS[3]
Definition WsfGuidedMover.hpp:377
bool mMaintainInclination
For launch-to-orbit, maintain the inclination as defined by the launch conditions (latitude and launc...
Definition WsfGuidedMover.hpp:396
void Print(ut::log::MessageStream &aMsgStream, double aFMM_Time)
Definition WsfGuidedMover.cpp:3321
CoordinateFrame mCoordinateFrame
Definition WsfGuidedMover.hpp:392
State(const State &aOther)=default
double mPsi
Definition WsfGuidedMover.hpp:380
double mLocation[3]
Definition WsfGuidedMover.hpp:374
void UpdateOrientationData(double aSimTime, double aDeltaTime)
Definition WsfGuidedMover.cpp:2073
double mMach
Definition WsfGuidedMover.hpp:385
double mLastThrustForcesECS[3]
Definition WsfGuidedMover.hpp:378
bool mLaunchToOrbit
Definition WsfGuidedMover.hpp:394
double mAcceleration[3]
Definition WsfGuidedMover.hpp:376
double mECI_SwitchTime
The time when the WCS->ECI frame switch occurred.
Definition WsfGuidedMover.hpp:393
double mLastAeroForcesECS[3]
Definition WsfGuidedMover.hpp:379
const WsfGuidedMover * mMoverPtr
Definition WsfGuidedMover.hpp:371
double mCurrentFuelFlowRate
Definition WsfGuidedMover.hpp:388
double mPhi
Definition WsfGuidedMover.hpp:382
double mCurrentThrust
Definition WsfGuidedMover.hpp:387
double mDivertFuelMass
Definition WsfGuidedMover.hpp:390
double mWorld_ToECS_Transform[3][3]
Definition WsfGuidedMover.hpp:373
double mTheta
Definition WsfGuidedMover.hpp:381
double mMass
Definition WsfGuidedMover.hpp:386
Definition WsfGuidedMover.hpp:45
State mCurState
The current entity state.
Definition WsfGuidedMover.hpp:565
CoordinateFrame
Definition WsfGuidedMover.hpp:51
@ cCF_ECI
Definition WsfGuidedMover.hpp:53
@ cCF_WCS
Definition WsfGuidedMover.hpp:52
UtCloneablePtr< UtTable::Table > TablePtr
Definition WsfGuidedMover.hpp:48
bool mImplicitStageUsed
'true' if a stage was defined without using 'stage'
Definition WsfGuidedMover.hpp:543
std::vector< Ejectable > mEjectables
The list of eject-able objects.
Definition WsfGuidedMover.hpp:544
UtEntity mTempEntity
Temporary entity for WCS<->ECI conversions.
Definition WsfGuidedMover.hpp:569
void AdvanceTimeLegacyRK2(double aSimTime, State &aState, const double aAppliedForcesECS[3])
Definition WsfGuidedMover.cpp:1344
WsfGuidedMoverTestObject * GetTestSupportObject() const
Definition WsfGuidedMover.hpp:81
void AdvanceTimeMultistep(double aSimTime, double aBegTime, double aEndTime, Phase &aNextPhase)
Definition WsfGuidedMover.cpp:963
bool mVerifyValues
Definition WsfGuidedMover.hpp:553
double mCommandedPitch
Definition WsfGuidedMover.hpp:555
double mIV_Values[6]
Definition WsfGuidedMover.hpp:564
bool mExplicitStageUsed
'true' if a 'stage' command was used
Definition WsfGuidedMover.hpp:542
double mCommandedRoll
Definition WsfGuidedMover.hpp:556
double mDivertThrust
Definition WsfGuidedMover.hpp:545
bool mComputeForcesEachSubstep
Definition WsfGuidedMover.hpp:579
void AdvanceTimeRK(double aSimTime, double aBegTime, double aEndTime)
This method takes a Runge-Kutta step.
Definition WsfGuidedMover.hpp:463
double GetDivertThrust() const
Definition WsfGuidedMover.hpp:77
double mLastQ
For tracking MaxQ for show_status.
Definition WsfGuidedMover.hpp:562
double GetCurrentThrust() const
Definition WsfGuidedMover.hpp:85
void AdvanceTimeSinglestep(double aSimTime, double aBegTime, double &aEndTime, Phase &aNextPhase)
Definition WsfGuidedMover.cpp:872
double GetEmptyMass() const
Definition WsfGuidedMover.cpp:700
bool mGuidanceOn
Definition WsfGuidedMover.hpp:552
double mECI_LastUpdateTime
Definition WsfGuidedMover.hpp:577
size_t GetNumStages() const
Definition WsfGuidedMover.hpp:96
double mLastMach
For tracking Mach 1 crossing for show_status.
Definition WsfGuidedMover.hpp:561
void AdvanceTimeTrapezoidal(double aSimTime, State &aState, const double aAppliedForcesECS[3])
Definition WsfGuidedMover.cpp:1409
void ComputeFullForces(double aSimTime, double aBegTime, double aEndTime, State &aRHS_State, Stage &aRHS_Stage) const
Definition WsfGuidedMover.cpp:1739
double mLastYaw
Definition WsfGuidedMover.hpp:557
double mLastAeroForcesECS[3]
Definition WsfGuidedMover.hpp:560
~WsfGuidedMover() override=default
double mCommandedYaw
Definition WsfGuidedMover.hpp:554
UtECI_Conversion & GetECI_Conversion()
Get the ECI conversion object. You MUST call this method, instead of directly accessing the object.
Definition WsfGuidedMover.cpp:183
double GetDivertFuelMass() const
Definition WsfGuidedMover.hpp:78
State mTempState3
Temporary state for RK4 integration.
Definition WsfGuidedMover.hpp:568
std::unique_ptr< WsfGuidedMoverTestObject > mTestSupportObjectPtr
Definition WsfGuidedMover.hpp:571
ut::CloneablePtr< UtECI_Conversion > mECI_ConversionPtr
Definition WsfGuidedMover.hpp:575
State mTempState2
Temporary state for RK4 integration.
Definition WsfGuidedMover.hpp:567
UtCloneablePtr< UtTable::Curve > CurvePtr
Definition WsfGuidedMover.hpp:47
void GetThrustForcesECS(double aThrustForcesECS[3]) const
Definition WsfGuidedMover.hpp:87
double mDivertFuelFlowRate
Definition WsfGuidedMover.hpp:546
std::vector< Stage > mStageList
The list of stages.
Definition WsfGuidedMover.hpp:541
CoordinateFrame mDesiredCoordinateFrame
Definition WsfGuidedMover.hpp:550
void AdvanceTimeLegacyRK4(double aSimTime, State &aState, const double aAppliedForcesECS[3])
Definition WsfGuidedMover.cpp:1366
double GetPayloadMass() const
Definition WsfGuidedMover.cpp:710
State mTempState1
Temporary state for RK2/RK4 integration.
Definition WsfGuidedMover.hpp:566
double GetCurrentTotalMass() const
Definition WsfGuidedMover.hpp:112
void GetCommandedAttitude(double &aYaw, double &aPitch, double &aRoll) const
Definition WsfGuidedMover.cpp:662
IntegrationMethod
Definition WsfGuidedMover.hpp:127
@ cTRAPEZOIDAL
Definition WsfGuidedMover.hpp:128
@ cRK4
Definition WsfGuidedMover.hpp:130
@ cRK2
Definition WsfGuidedMover.hpp:129
double GetCurrentFuelFlowRate() const
Definition WsfGuidedMover.hpp:115
double mDivertMaxAlt
Definition WsfGuidedMover.hpp:548
WsfGuidedMover(WsfScenario &aScenario, bool aGuidanceOn=true)
Definition WsfGuidedMover.cpp:86
UtCloneablePtr< UtTable::Table > mTimeConstantPtr
airframe time constant
Definition WsfGuidedMover.hpp:549
double GetCurrentFuelMass() const
Definition WsfGuidedMover.hpp:111
double mDivertMinAlt
Definition WsfGuidedMover.hpp:547
void GetAeroForcesECS(double aAeroForcesECS[3]) const
Definition WsfGuidedMover.hpp:86
IntegrationMethod mIntegrationMethod
Definition WsfGuidedMover.hpp:551
double mMaxQ
Definition WsfGuidedMover.hpp:563
double mLastRoll
Definition WsfGuidedMover.hpp:559
double mLastPitch
Definition WsfGuidedMover.hpp:558
WsfGuidedMover & operator=(const WsfGuidedMover &)=delete
double mECI_UpdateTime
Definition WsfGuidedMover.hpp:576
WsfMover * Clone() const override=0
virtual bool GetPropertyDouble(const std::string &aPropertyName, double &aProperty)
Definition WsfMover.cpp:178
const char * GetScriptClassName() const override
Definition WsfMover.cpp:616
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Take a step using second-order Runge-Kutta.
Definition WsfGuidedMover.hpp:443
static State Step(double aSimTime, State &aState, Callable &&aRightHandSide)
Definition WsfGuidedMover.hpp:445
Take a step using fourth-order Runge-Kutta.
Definition WsfGuidedMover.hpp:453
static State Step(double aSimTime, State &aState, Callable &&aRightHandSide)
Definition WsfGuidedMover.hpp:455