WSF
WsfPointMassSixDOF_Utils.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 2020 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 WSFPOINTMASSSIXDOFUTILS_HPP
13#define WSFPOINTMASSSIXDOFUTILS_HPP
14
15#include "wsf_six_dof_export.h"
16
17#include <memory>
18#include <string>
19#include <vector>
20
21#include "UtVec3dX.hpp"
23#include "WsfSixDOF_Utils.hpp"
24
25namespace wsf
26{
27namespace six_dof
28{
29class Mover;
30class PointMassMover;
32
33namespace utils
34{
35WSF_SIX_DOF_EXPORT PointMassMover* CastToPointMass(Mover* aVehicle);
36
37WSF_SIX_DOF_EXPORT void CreateAutopilotConfigFile(PointMassMover* aVehicle, const std::string& aFilename);
38
39// The throttle input assumes that 0 is idle, 1 is full power without
40// augmentation/afterburner (military power), and 2 is full power with
41// full augmentation/afterburner (full afterburner).
42WSF_SIX_DOF_EXPORT CanFlyAtReturnValue
43CanFlyAt(PointMassMover* aObject, double aAltitude_ft, double aVelocity_fps, double aThrottleForward, double aFlapsDown);
44
45// The filename is typically "autopilot_support_tables.txt"
46WSF_SIX_DOF_EXPORT void CreateAutopilotSupportFile(PointMassMover* aObject, const std::string& aFilename);
47
48// The filename is typically "autopilot_support_tables.txt"
49WSF_SIX_DOF_EXPORT void CreateAutopilotSupportFileWithMaxMach(PointMassMover* aObject,
50 const std::string& aFilename,
51 const double& aMaxMach);
52
53// This provides the processing that is common between CreateAutopilotSupportFile()
54// and CreateAutopilotSupportFileWithMaxMach()
55WSF_SIX_DOF_EXPORT void CommonCreateAutopilotSupportFile(PointMassTableTool& aTool, const std::string& aFilename);
56
57} // namespace utils
58
59class WSF_SIX_DOF_EXPORT PointMassMachParamDataTable
60{
61public:
64
66
68
69 void CreateNewMach(double aMach);
70 void AddNewParamDataPair(double aParameter, double aData);
71
72 double GetValueAtMachParam(double aMach, double aParameter) const;
73
74 double GetMinParameterAtMach(double aMach) const;
75 double GetMaxParameterAtMach(double aMach) const;
76
77 double GetMinDataAtMach(double aMach) const;
78 double GetMaxDataAtMach(double aMach) const;
79
80 // aParameterType typically is "alpha" or "cl"
81 // aParameterUnitsString typically is "units deg" or "precision float"
82 void OutputToString(std::string& aInput,
83 const std::string& aTableName,
84 const std::string& aParameterType,
85 const std::string& aParameterUnitsString) const;
86
87protected:
89
91 {
92 double parameter; // This can be anything (for example, alpha_deg or CL)
93 double value;
94 };
95
97 {
98 double mach;
99 std::vector<paramDataPair*> paramDataList;
100 };
101
102 double GetParameterAtMach(double aMach, bool aGetMin) const;
103 double GetMinParameter(const machParamDataListPair* aMachParamDataListPair) const;
104 double GetMaxParameter(const machParamDataListPair* aMachParamDataListPair) const;
105
106 double GetDataAtMach(double aMach, bool aGetMin) const;
107 double GetMinData(const machParamDataListPair* aMachParamDataListPair) const;
108 double GetMaxData(const machParamDataListPair* aMachParamDataListPair) const;
109
110 double GetValueAtParam(std::vector<paramDataPair*>& aList, double aParameter) const;
111
112 std::vector<machParamDataListPair*> mMachParamDataList;
113
115};
116
117// -------------------------------------------------------------------------------
118
119class WSF_SIX_DOF_EXPORT PointMassMachDataTable
120{
121public:
124
126
128
129 void CreateNewMachValuePair(double aMach, double aValue);
130
131 double GetValueAtMach(double aMach) const;
132
133 void OutputToString(std::string& aInput, const std::string& aTableName) const;
134
135protected:
137
139 {
140 double mach;
141 double value;
142 };
143
144 std::vector<machDataPair*> mMachDataList;
145};
146
147// -------------------------------------------------------------------------------
148
149class PointMassMover;
150
151class WSF_SIX_DOF_EXPORT PointMassTableTool
152{
153public:
154 explicit PointMassTableTool(PointMassMover* aObject);
156
157 void InitializeTableMachValues(double aMaxMach);
158
159 // Returns true if everything worked properly
161
162 // These functions output tabular data to a string, useful
163 // for outputting data to a file
164 void OutputCLMaxMachTableToInputString(std::string& aInput) const;
165 void OutputCLMinMachTableToInputString(std::string& aInput) const;
166 void OutputAlphaMaxMachTableToInputString(std::string& aInput) const;
167 void OutputAlphaMinMachTableToInputString(std::string& aInput) const;
168 void OutputAlphaMachCLTableToInputString(std::string& aInput) const;
169 void OutputCLMachAlphaTableToInputString(std::string& aInput) const;
170
171protected:
172 double CalcCLFromCLArea(double aCLArea);
173
174 void CreateMachTestList(double aMaxMach);
175
176 void AddAlphaVsMachCL(double aMach, double aCL, double aMinAlpha_deg, double aMaxAlpha_deg, bool& aMachAdded);
177
179 std::unique_ptr<PointMassMachDataTable> mCLMaxVsMachTable;
180 std::unique_ptr<PointMassMachDataTable> mCLMinVsMachTable;
181 std::unique_ptr<PointMassMachDataTable> mAlphaMax_degVsMachTable;
182 std::unique_ptr<PointMassMachDataTable> mAlphaMin_degVsMachTable;
183 std::unique_ptr<PointMassMachParamDataTable> mCLVsMachAlphaTable;
184 std::unique_ptr<PointMassMachParamDataTable> mAlphaVsMachCLTable;
185
186 // These lists are used to store effective lists of mach, alpha,
187 // and beta values for generating tabular data.
188 std::vector<double> mMachTestList;
190
191private:
192 void Initialize();
193 bool CreateCLMaxAndAlphaMaxTables();
194 bool CreateCLMinAndAlphaMinTables();
195 bool CreateCLTable();
196 bool CreateAlphaVsMachCLTable();
197};
198} // namespace six_dof
199} // namespace wsf
200
201#endif
This is a base class for detailed air movers. This umbrella can cover RB6 or PM6 models.
Definition WsfSixDOF_Mover.hpp:58
std::vector< machDataPair * > mMachDataList
Definition WsfPointMassSixDOF_Utils.hpp:144
void OutputToString(std::string &aInput, const std::string &aTableName) const
Definition WsfPointMassSixDOF_Utils.cpp:1012
void CreateNewMachValuePair(double aMach, double aValue)
Definition WsfPointMassSixDOF_Utils.cpp:977
PointMassMachDataTable()
Definition WsfPointMassSixDOF_Utils.cpp:953
PointMassMachDataTable & operator=(const PointMassMachDataTable &other)=delete
double GetValueAtMach(double aMach) const
Definition WsfPointMassSixDOF_Utils.cpp:985
PointMassMachDataTable * Clone() const
Definition WsfPointMassSixDOF_Utils.cpp:972
void AddNewParamDataPair(double aParameter, double aData)
Definition WsfPointMassSixDOF_Utils.cpp:368
double GetMaxParameterAtMach(double aMach) const
Definition WsfPointMassSixDOF_Utils.cpp:414
PointMassMachParamDataTable & operator=(const PointMassMachParamDataTable &other)=delete
double GetMaxData(const machParamDataListPair *aMachParamDataListPair) const
Definition WsfPointMassSixDOF_Utils.cpp:855
double GetDataAtMach(double aMach, bool aGetMin) const
Definition WsfPointMassSixDOF_Utils.cpp:654
double GetParameterAtMach(double aMach, bool aGetMin) const
Definition WsfPointMassSixDOF_Utils.cpp:429
double GetValueAtMachParam(double aMach, double aParameter) const
Definition WsfPointMassSixDOF_Utils.cpp:378
PointMassMachParamDataTable()
Definition WsfPointMassSixDOF_Utils.cpp:320
std::vector< machParamDataListPair * > mMachParamDataList
Definition WsfPointMassSixDOF_Utils.hpp:112
double GetValueAtParam(std::vector< paramDataPair * > &aList, double aParameter) const
Definition WsfPointMassSixDOF_Utils.cpp:879
double GetMaxDataAtMach(double aMach) const
Definition WsfPointMassSixDOF_Utils.cpp:424
void OutputToString(std::string &aInput, const std::string &aTableName, const std::string &aParameterType, const std::string &aParameterUnitsString) const
Definition WsfPointMassSixDOF_Utils.cpp:908
double GetMaxParameter(const machParamDataListPair *aMachParamDataListPair) const
Definition WsfPointMassSixDOF_Utils.cpp:630
double GetMinParameterAtMach(double aMach) const
Definition WsfPointMassSixDOF_Utils.cpp:409
double GetMinDataAtMach(double aMach) const
Definition WsfPointMassSixDOF_Utils.cpp:419
double GetMinParameter(const machParamDataListPair *aMachParamDataListPair) const
Definition WsfPointMassSixDOF_Utils.cpp:606
double GetMinData(const machParamDataListPair *aMachParamDataListPair) const
Definition WsfPointMassSixDOF_Utils.cpp:831
void CreateNewMach(double aMach)
Definition WsfPointMassSixDOF_Utils.cpp:359
PointMassMachParamDataTable * Clone() const
Definition WsfPointMassSixDOF_Utils.cpp:354
machParamDataListPair * mCurrentMachParamDataPairPtr
Definition WsfPointMassSixDOF_Utils.hpp:114
Definition WsfPointMassSixDOF_Mover.hpp:33
Definition WsfPointMassSixDOF_Utils.hpp:152
PointMassMover * mObject
Definition WsfPointMassSixDOF_Utils.hpp:178
std::unique_ptr< PointMassMachParamDataTable > mAlphaVsMachCLTable
Definition WsfPointMassSixDOF_Utils.hpp:184
PointMassTableTool(PointMassMover *aObject)
Definition WsfPointMassSixDOF_Utils.cpp:1027
double CalcCLFromCLArea(double aCLArea)
Definition WsfPointMassSixDOF_Utils.cpp:1040
void AddAlphaVsMachCL(double aMach, double aCL, double aMinAlpha_deg, double aMaxAlpha_deg, bool &aMachAdded)
Definition WsfPointMassSixDOF_Utils.cpp:1083
void OutputCLMaxMachTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1164
bool CreateAutopilotTables()
Definition WsfPointMassSixDOF_Utils.cpp:1053
std::unique_ptr< PointMassMachDataTable > mAlphaMin_degVsMachTable
Definition WsfPointMassSixDOF_Utils.hpp:182
std::unique_ptr< PointMassMachParamDataTable > mCLVsMachAlphaTable
Definition WsfPointMassSixDOF_Utils.hpp:183
void OutputAlphaMachCLTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1204
void InitializeTableMachValues(double aMaxMach)
Definition WsfPointMassSixDOF_Utils.cpp:1228
void OutputAlphaMinMachTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1194
std::unique_ptr< PointMassMachDataTable > mCLMaxVsMachTable
Definition WsfPointMassSixDOF_Utils.hpp:179
void CreateMachTestList(double aMaxMach)
Definition WsfPointMassSixDOF_Utils.cpp:1233
void OutputCLMinMachTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1174
void OutputCLMachAlphaTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1216
void OutputAlphaMaxMachTableToInputString(std::string &aInput) const
Definition WsfPointMassSixDOF_Utils.cpp:1184
std::vector< double > mMachTestList
Definition WsfPointMassSixDOF_Utils.hpp:188
bool mTableListsInitialized
Definition WsfPointMassSixDOF_Utils.hpp:189
std::unique_ptr< PointMassMachDataTable > mAlphaMax_degVsMachTable
Definition WsfPointMassSixDOF_Utils.hpp:181
std::unique_ptr< PointMassMachDataTable > mCLMinVsMachTable
Definition WsfPointMassSixDOF_Utils.hpp:180
Definition WsfPointMassSixDOF_Utils.hpp:34
WSF_SIX_DOF_EXPORT void CreateAutopilotConfigFile(PointMassMover *aVehicle, const std::string &aFilename)
Definition WsfPointMassSixDOF_Utils.cpp:49
WSF_SIX_DOF_EXPORT void CommonCreateAutopilotSupportFile(PointMassTableTool &aTool, const std::string &aFilename)
Definition WsfPointMassSixDOF_Utils.cpp:273
WSF_SIX_DOF_EXPORT void CreateAutopilotSupportFileWithMaxMach(PointMassMover *aObject, const std::string &aFilename, const double &aMaxMach)
Definition WsfPointMassSixDOF_Utils.cpp:262
WSF_SIX_DOF_EXPORT CanFlyAtReturnValue CanFlyAt(PointMassMover *aObject, double aAltitude_ft, double aVelocity_fps, double aThrottleForward, double aFlapsDown)
Definition WsfPointMassSixDOF_Utils.cpp:200
WSF_SIX_DOF_EXPORT PointMassMover * CastToPointMass(Mover *aVehicle)
Definition WsfPointMassSixDOF_Utils.cpp:42
CanFlyAtReturnValue
Definition WsfSixDOF_Utils.hpp:31
WSF_SIX_DOF_EXPORT void CreateAutopilotSupportFile(PointMassMover *aObject, const std::string &aFilename)
Definition WsfPointMassSixDOF_Utils.cpp:252
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfPointMassSixDOF_Utils.hpp:139
double mach
Definition WsfPointMassSixDOF_Utils.hpp:140
double value
Definition WsfPointMassSixDOF_Utils.hpp:141
std::vector< paramDataPair * > paramDataList
Definition WsfPointMassSixDOF_Utils.hpp:99
double mach
Definition WsfPointMassSixDOF_Utils.hpp:98
Definition WsfPointMassSixDOF_Utils.hpp:91
double value
Definition WsfPointMassSixDOF_Utils.hpp:93
double parameter
Definition WsfPointMassSixDOF_Utils.hpp:92
Copyrights Multiple, All Rights Reserved