WSF
WsfSixDOF_Environment.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 WSFSIXDOFENVIRONMENT_HPP
13#define WSFSIXDOFENVIRONMENT_HPP
14
15#include "wsf_six_dof_export.h"
16
17#include "UtAtmosphere.hpp"
18class UtInput;
19#include "UtVec3dX.hpp"
20#include "WsfEnvironment.hpp"
22class WsfSimulation;
23#include "WsfSixDOF_Terrain.hpp"
24
25namespace wsf
26{
27namespace six_dof
28{
30{
31public:
32 Environment() = default;
33 ~Environment() = default;
34
35 // The extension has been added to the scenario. GetScenario() is now callable.
36 void AddedToScenario() override;
37
38 // This reads "terrain" and "integrators" input blocks
39 bool ProcessInput(UtInput& aInput) override;
40
41 UtVec3dX GetWindNED_mps(double aLatitude, double aLongitude, double aAltitude_m) const
42 {
43 double heading_rad;
44 double speed_mps;
45 mEnvironment->GetWind(aLatitude, aLongitude, aAltitude_m, heading_rad, speed_mps);
46
47 return UtVec3dX(heading_rad, 0.0, speed_mps, true);
48 }
49
50 double GetTerrainElevation(double aLatitude, double aLongitude) const
51 {
52 return mTerrain->HeightOfTerrain_m(aLatitude, aLongitude);
53 }
54
55 double GetTerrainDataElevationAndData(double aLatitude,
56 double aLongitude,
57 UtVec3dX& aUpVectorNED,
58 UtVec3dX& aSpeedVectorNED_mps,
59 double& aFrictionMultiplier) const
60 {
61 return mTerrain->HeightOfTerrain_m(aLatitude, aLongitude, aUpVectorNED, aSpeedVectorNED_mps, aFrictionMultiplier);
62 }
63
64 // GetAeroParameters updates several parameters for a vehicle
65 // at the specified altitude (ft) and speed (ft/sec). Parameters
66 // include air density [ ((lbf*sec^2)/ft^4) or slugs/ft^3 ],
67 // dynamic pressure (lbf/sq-ft), and static pressure (lbf/sq-ft).
68 void GetAeroParameters(double aAltitude_ft,
69 double aSpeed_fps,
70 double& aAirDensity,
71 double& aDynamicPressure_psf,
72 double& aStaticPressure_psf) const;
73
74 double CalcAirDensity_slug_ft3(double aAltitude_ft) const
75 {
76 return mAtmosphere->CalcAirDensity_slug_ft3(aAltitude_ft);
77 }
78
79 double CalcAmbientPressure_psf(double aAltitude_ft) const
80 {
81 return mAtmosphere->CalcAmbientPressure_psf(aAltitude_ft);
82 }
83
84 double CalcKtasFromKcas(double aAltitude_m, double aSpeed_kcas) const
85 {
86 return mAtmosphere->CalcKtasFromKcas(aAltitude_m, aSpeed_kcas);
87 }
88
89 double CalcKcasFromKtas(double aAltitude_m, double aSpeed_ktas) const
90 {
91 return mAtmosphere->CalcKcasFromKtas(aAltitude_m, aSpeed_ktas);
92 }
93
94 double CalcKtasFromMach(double aAltitude_m, double aSpeed_mach) const
95 {
96 return mAtmosphere->CalcKtasFromMach(aAltitude_m, aSpeed_mach);
97 }
98
99 double CalcMachFromKtas(double aAltitude_m, double aSpeed_ktas) const
100 {
101 return mAtmosphere->CalcMachFromKtas(aAltitude_m, aSpeed_ktas);
102 }
103
104 double CalcKcasFromMach(double aAltitude_m, double aSpeed_mach) const
105 {
106 return mAtmosphere->CalcKcasFromMach(aAltitude_m, aSpeed_mach);
107 }
108
109 double CalcMachFromKcas(double aAltitude_m, double aSpeed_kcas) const
110 {
111 return mAtmosphere->CalcMachFromKcas(aAltitude_m, aSpeed_kcas);
112 }
113
114 double CalcKcasFromFps(double aAltitude_m, double aSpeed_fps) const
115 {
116 return mAtmosphere->CalcKcasFromFps(aAltitude_m, aSpeed_fps);
117 }
118
119 double CalcFpsFromKcas(double aAltitude_m, double aSpeed_kcas) const
120 {
121 return mAtmosphere->CalcFpsFromKcas(aAltitude_m, aSpeed_kcas);
122 }
123
124 double CalcMachFromFps(double aAltitude_m, double aSpeed_fps) const
125 {
126 return mAtmosphere->CalcMachFromFps(aAltitude_m, aSpeed_fps);
127 }
128
129 double CalcFpsFromMach(double aAltitude_m, double aSpeed_mach) const
130 {
131 return mAtmosphere->CalcFpsFromMach(aAltitude_m, aSpeed_mach);
132 }
133
134 double CalcFpsFromDynamicPressure(double aAltitude_m, double aPressure_psf) const
135 {
136 return mAtmosphere->CalcFpsFromDynamicPressure(aAltitude_m, aPressure_psf);
137 }
138
139 double CalcDynamicPressure_psf(double aAltitude_m, double aSpeed_fps) const
140 {
141 return mAtmosphere->CalcDynamicPressure_psf(aAltitude_m, aSpeed_fps);
142 }
143
144 // This returns the ratio between ambient air density at altitude and sea-level air density
145 double CalcDensityRatio(double aAltitude_m) const { return mAtmosphere->DensityRatio(aAltitude_m); }
146
147 // This returns true if an operating engine can produce contrails at an altitude
148 bool IsWithinContrailBand(double aAltitude_m) const
149 {
150 return mAtmosphere->IsWithinContrailAltitudeBand(aAltitude_m);
151 }
152
153protected:
154private:
155 WsfEnvironment* mEnvironment =
156 nullptr; // Used to serve wind data to SixDOF movers; may eventually serve visibility data
157 UtAtmosphere* mAtmosphere = nullptr; // Contains infomation relevant to pressure, density, Mach
158 std::unique_ptr<Terrain> mTerrain; // Augments the WSF terrain interface
159};
160} // namespace six_dof
161} // namespace wsf
162
163#endif
Definition WsfEnvironment.hpp:37
WsfScenarioExtension()
Definition WsfScenarioExtension.cpp:21
The main controller for a simulation.
Definition WsfSimulation.hpp:109
double CalcMachFromKtas(double aAltitude_m, double aSpeed_ktas) const
Definition WsfSixDOF_Environment.hpp:99
double CalcFpsFromDynamicPressure(double aAltitude_m, double aPressure_psf) const
Definition WsfSixDOF_Environment.hpp:134
double CalcAmbientPressure_psf(double aAltitude_ft) const
Definition WsfSixDOF_Environment.hpp:79
double CalcDensityRatio(double aAltitude_m) const
Definition WsfSixDOF_Environment.hpp:145
double CalcFpsFromMach(double aAltitude_m, double aSpeed_mach) const
Definition WsfSixDOF_Environment.hpp:129
double CalcKcasFromKtas(double aAltitude_m, double aSpeed_ktas) const
Definition WsfSixDOF_Environment.hpp:89
double CalcDynamicPressure_psf(double aAltitude_m, double aSpeed_fps) const
Definition WsfSixDOF_Environment.hpp:139
UtVec3dX GetWindNED_mps(double aLatitude, double aLongitude, double aAltitude_m) const
Definition WsfSixDOF_Environment.hpp:41
void GetAeroParameters(double aAltitude_ft, double aSpeed_fps, double &aAirDensity, double &aDynamicPressure_psf, double &aStaticPressure_psf) const
Definition WsfSixDOF_Environment.cpp:65
double CalcKcasFromMach(double aAltitude_m, double aSpeed_mach) const
Definition WsfSixDOF_Environment.hpp:104
bool ProcessInput(UtInput &aInput) override
Definition WsfSixDOF_Environment.cpp:34
double CalcAirDensity_slug_ft3(double aAltitude_ft) const
Definition WsfSixDOF_Environment.hpp:74
double GetTerrainElevation(double aLatitude, double aLongitude) const
Definition WsfSixDOF_Environment.hpp:50
double CalcKtasFromKcas(double aAltitude_m, double aSpeed_kcas) const
Definition WsfSixDOF_Environment.hpp:84
bool IsWithinContrailBand(double aAltitude_m) const
Definition WsfSixDOF_Environment.hpp:148
double CalcFpsFromKcas(double aAltitude_m, double aSpeed_kcas) const
Definition WsfSixDOF_Environment.hpp:119
double CalcMachFromFps(double aAltitude_m, double aSpeed_fps) const
Definition WsfSixDOF_Environment.hpp:124
double CalcMachFromKcas(double aAltitude_m, double aSpeed_kcas) const
Definition WsfSixDOF_Environment.hpp:109
void AddedToScenario() override
Definition WsfSixDOF_Environment.cpp:24
double GetTerrainDataElevationAndData(double aLatitude, double aLongitude, UtVec3dX &aUpVectorNED, UtVec3dX &aSpeedVectorNED_mps, double &aFrictionMultiplier) const
Definition WsfSixDOF_Environment.hpp:55
double CalcKtasFromMach(double aAltitude_m, double aSpeed_mach) const
Definition WsfSixDOF_Environment.hpp:94
double CalcKcasFromFps(double aAltitude_m, double aSpeed_fps) const
Definition WsfSixDOF_Environment.hpp:114
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved