WSF
WsfNASA_BreakupModel.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 2019 Infoscitex, a DCS 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 WSFNASABREAKUPMODEL_HPP
13#define WSFNASABREAKUPMODEL_HPP
14
16
18{
19public:
20 explicit WsfNASA_BreakupModel(WsfSimulation& aSimulation);
21 ~WsfNASA_BreakupModel() override = default;
22
23 size_t GetFragmentCount() const override;
24 Fragment GetFragment(size_t aIndex) const override;
25
27 const std::string& GetExplosionProgenitor() const { return mProgenitorOne.mName; }
28
30 double GetExplosionMass() const { return mProgenitorOne.mMass; }
31
33 const std::string& GetCollisionProgenitorOne() const { return mProgenitorOne.mName; }
34
36 double GetCollisionProgenitorOneMass() const { return mProgenitorOne.mMass; }
37
39 const std::string& GetCollisionProgenitorTwo() const { return mProgenitorTwo.mName; }
40
42 double GetCollisionProgenitorTwoMass() const { return mProgenitorTwo.mMass; }
43
45 double GetCollisionMass() const { return mCollisionMass; }
46
54 const std::string& GetDebrisName() const { return mDebrisName; }
55
57 double GetExplosionS_Factor() const { return mExplosionS_Factor; }
58
60 double GetLargeFragmentMassFraction() const { return mLargeFragmentFraction; }
61
63 bool IsModeledAsSpacecraft() const { return mModelAsSpacecraft; }
64
66 double GetMinFragmentSize() const { return mMinFragmentSize; }
67
74 void SetDebrisName(const std::string& aDebrisName) { mDebrisName = aDebrisName; }
75
77 void SetExplosionS_Factor(double aS_Factor) { mExplosionS_Factor = aS_Factor; }
78
80 void SetLargeFragmentMassFraction(double aLargeFragmentFraction)
81 {
82 mLargeFragmentFraction = std::min(1.0, std::max(0.0, aLargeFragmentFraction));
83 }
84
91 void SetModeledAsSpacecraft(bool aModelAsSpacecraft) { mModelAsSpacecraft = aModelAsSpacecraft; }
92
94 void SetMinFragmentSize(double aMinSize) { mMinFragmentSize = aMinSize; }
95
97 static std::vector<double> PackInputParameters(double aMass, double aSize);
98
99private:
101 struct Progenitor
102 {
103 std::string mName{};
104 UtVec3d mLocation{};
105 UtVec3d mVelocity{};
106 double mMass{-1.0};
107 double mLength{-1.0};
108 };
109
110 // Explosive breakup modeling
111 bool ModelExplosion(WsfPlatform& aPlatform, const std::vector<double>& aParams) override;
112 bool FinalizeExplosionModel(WsfPlatform& aPlatform, const std::vector<double>& aParams);
113 Fragment GenerateExplosiveFragment(double aLc, int aId);
114 Fragment GenerateExplosiveLargeFragment(double aMinLc,
115 double aMassRemaining,
116 bool aIsLast,
117 int aId,
118 const UtVec3d& aLocation,
119 const UtVec3d& aVelocity);
120
121 // Collisional breakup modeling
122 bool ModelCollision(WsfPlatform& aTargetPlatform,
123 const std::vector<double>& aTargetParams,
124 WsfPlatform& aImpactorPlatform,
125 const std::vector<double>& aImpactorParams) override;
126 bool FinalizeCollisionModel(WsfPlatform& aTargetPlatform,
127 const std::vector<double>& aTargetParams,
128 WsfPlatform& aImpactorPlatform,
129 const std::vector<double>& aImpactorParams);
130 bool ModelCatastrophicCollision();
131 bool ModelNonCatastrophicCollision();
132 double ModelCollisionDebris(double aTotalMass, const Progenitor& aProgenitor, bool aGenerateLargeFragments = true);
133 Fragment GenerateCollisionalFragment(double aLc, int aId, const UtVec3d& aLocation, const UtVec3d& aVelocity);
134 Fragment GenerateCollisionalLargeFragment(double aMinLc,
135 double aMassRemaining,
136 bool aIsLast,
137 int aId,
138 const UtVec3d& aLocation,
139 const UtVec3d& aVelocity);
140 Fragment GenerateCrateredFragment(const Progenitor& aProgenitor);
141 std::pair<Progenitor, Progenitor> SolveCollisionProblem(const Progenitor& aSmall, const Progenitor& aLarge) const;
142
143 // Utilities for dealing with velocities
144 UtVec3d GenerateRandomVelocity(double aMagnitude);
145 static void EnsureMomentumConservation(std::vector<Fragment>& aFragments);
146 static void EnsureMomentumConservation(std::vector<Fragment>::iterator aStart, std::vector<Fragment>::iterator aEnd);
147
148 // NASA model routines
149 double ExplosionN(double aLc) const;
150 double InverseExplosionN(double aCn) const;
151 bool IsCatastrophicCollision() const;
152 double CatastrophicCollisionMass() const;
153 double NonCatastrophicCollisionMass() const;
154 void ComputeCollisionMass();
155 static double CollisionN(double aLc, double aCollisionMass);
156 static double InverseCollisionN(double aCn, double aCollisionMass);
157 static double LimitedLerp(double aValue, double aValueMin, double aValueMax, double aRangeMin, double aRangeMax);
158 static double BlendFunctionWeight(double aLc);
159 double AoverM_SmallSize(double aLambdaC);
160 double AoverM_RocketBodyTermOne(double aLambdaC);
161 double AoverM_RocketBodyTermTwo(double aLambdaC);
162 double AoverM_RocketBody(double aLc);
163 double AoverM_SpacecraftTermOne(double aLambdaC);
164 double AoverM_SpacecraftTermTwo(double aLambdaC);
165 double AoverM_Spacecraft(double aLc);
166 static double AfromLc(double aLc);
167 double DeltaV_Explosion(double aAoverM);
168 double DeltaV_Collision(double aAoverM);
169
172 Progenitor mProgenitorOne{};
173
176 Progenitor mProgenitorTwo{};
177
178 std::string mDebrisName{};
179 std::vector<Fragment> mFragments{};
180 double mMinFragmentSize{0.1};
181 double mExplosionS_Factor{1.0};
182 double mLargeFragmentFraction{0.5};
183 double mCollisionRelativeSpeed{0.0};
184 double mCollisionMass{-1.0};
185 bool mIsCatastrophicCollision{false};
186 bool mModelAsSpacecraft{true};
187};
188
189#endif // WSFNASABREAKUPMODEL_HPP
double GetCollisionProgenitorOneMass() const
Return the mass of the smaller mass progenitor in a collisional breakup.
Definition WsfNASA_BreakupModel.hpp:36
double GetExplosionMass() const
Return the mass involved in the explosive breakup.
Definition WsfNASA_BreakupModel.hpp:30
double GetLargeFragmentMassFraction() const
Return the fraction of the mass that will be deposited as large fragments.
Definition WsfNASA_BreakupModel.hpp:60
bool IsModeledAsSpacecraft() const
Return if the object involved in the breakup should be modeled as a spacecraft.
Definition WsfNASA_BreakupModel.hpp:63
Fragment GetFragment(size_t aIndex) const override
Get the indicated fragment's details.
Definition WsfNASA_BreakupModel.cpp:79
double GetMinFragmentSize() const
Return the minimum fragment size that will be produced.
Definition WsfNASA_BreakupModel.hpp:66
WsfNASA_BreakupModel(WsfSimulation &aSimulation)
Definition WsfNASA_BreakupModel.cpp:69
double GetExplosionS_Factor() const
Return the S factor for the explosive breakup.
Definition WsfNASA_BreakupModel.hpp:57
~WsfNASA_BreakupModel() override=default
void SetMinFragmentSize(double aMinSize)
Set the minimum size of a fragment produced by the model.
Definition WsfNASA_BreakupModel.hpp:94
double GetCollisionMass() const
Return the mass of debris produced by the collision.
Definition WsfNASA_BreakupModel.hpp:45
void SetModeledAsSpacecraft(bool aModelAsSpacecraft)
Definition WsfNASA_BreakupModel.hpp:91
double GetCollisionProgenitorTwoMass() const
Return the mass of the larger mass progenitor in a collisional breakup.
Definition WsfNASA_BreakupModel.hpp:42
void SetExplosionS_Factor(double aS_Factor)
Set the S factor for an explosive breakup.
Definition WsfNASA_BreakupModel.hpp:77
const std::string & GetDebrisName() const
Definition WsfNASA_BreakupModel.hpp:54
size_t GetFragmentCount() const override
Return the number of pieces of debris that were generated.
Definition WsfNASA_BreakupModel.cpp:74
const std::string & GetCollisionProgenitorOne() const
Return the name of the smaller mass progenitor in a collisional breakup.
Definition WsfNASA_BreakupModel.hpp:33
static std::vector< double > PackInputParameters(double aMass, double aSize)
A utility method to pack progenitor input parameters.
Definition WsfNASA_BreakupModel.cpp:89
void SetDebrisName(const std::string &aDebrisName)
Definition WsfNASA_BreakupModel.hpp:74
const std::string & GetCollisionProgenitorTwo() const
Return the name of the larger mass progenitor in a collisional breakup.
Definition WsfNASA_BreakupModel.hpp:39
void SetLargeFragmentMassFraction(double aLargeFragmentFraction)
Set the large fragment mass fraction.
Definition WsfNASA_BreakupModel.hpp:80
const std::string & GetExplosionProgenitor() const
Return the name of the progenitor of the explosive breakup.
Definition WsfNASA_BreakupModel.hpp:27
WsfSatelliteBreakupModel(WsfSimulation &aSimulation)
Definition WsfSatelliteBreakupModel.hpp:26
The main controller for a simulation.
Definition WsfSimulation.hpp:109
The standard information produced by breakup models for each fragment.
Definition WsfSatelliteBreakupModel.hpp:42
Copyrights Multiple, All Rights Reserved