Vulcan
Aerospace Engineering Utilities Built on Janus
Loading...
Searching...
No Matches
WindTypes.hpp
Go to the documentation of this file.
1// Wind Model Types and Utilities
2// Common types for all wind models - MIL-F-8785C / MIL-HDBK-1797 compliant
3#pragma once
4
5#include <janus/janus.hpp>
6
7namespace vulcan::wind {
8
9// ============================================================================
10// Wind Vector Representation
11// ============================================================================
12
21template <typename Scalar> struct WindVector {
22 Scalar north;
23 Scalar east;
24 Scalar down;
25
27 Scalar horizontal_speed() const {
28 return janus::sqrt(north * north + east * east);
29 }
30
32 Scalar speed() const {
33 return janus::sqrt(north * north + east * east + down * down);
34 }
35
38 Scalar direction_from() const { return janus::atan2(east, north); }
39};
40
46template <typename Scalar> struct GustVelocity {
47 Scalar u_g;
48 Scalar v_g;
49 Scalar w_g;
50};
51
57template <typename Scalar> struct GustAngularRate {
58 Scalar p_g;
59 Scalar q_g;
60 Scalar r_g;
61};
62
63// ============================================================================
64// Turbulence Parameters
65// ============================================================================
66
73template <typename Scalar = double> struct TurbulenceParams {
74 Scalar sigma_u;
75 Scalar sigma_v;
76 Scalar sigma_w;
77 Scalar L_u;
78 Scalar L_v;
79 Scalar L_w;
80};
81
90
91// ============================================================================
92// MIL-Spec Parameter Calculation
93// ============================================================================
94
95namespace detail {
96
98inline constexpr double W20_LIGHT = 7.5; // [m/s] (~15 knots)
99inline constexpr double W20_MODERATE = 15.0; // [m/s] (~30 knots)
100inline constexpr double W20_SEVERE = 30.0; // [m/s] (~60 knots)
101
102} // namespace detail
103
126 TurbulenceSeverity severity) {
127 // Convert altitude to feet for MIL-spec equations
128 constexpr double M_TO_FT = 3.28084;
129 constexpr double FT_TO_M = 0.3048;
130 double h_ft = altitude * M_TO_FT;
131
132 // Wind speed at 20 ft based on severity
133 double W20 = 0.0;
134 switch (severity) {
136 W20 = detail::W20_LIGHT;
137 break;
140 break;
142 W20 = detail::W20_SEVERE;
143 break;
144 }
145
147
148 if (h_ft < 1000.0) {
149 // Low altitude model
150 // Ensure minimum altitude of 10 ft for numerical stability
151 h_ft = std::max(h_ft, 10.0);
152
153 // Scale lengths (in feet, then convert)
154 double denom = std::pow(0.177 + 0.000823 * h_ft, 1.2);
155 params.L_w = h_ft * FT_TO_M;
156 params.L_u = (h_ft / denom) * FT_TO_M;
157 params.L_v = params.L_u;
158
159 // Turbulence intensities
160 params.sigma_w = 0.1 * W20;
161 double denom2 = std::pow(0.177 + 0.000823 * h_ft, 0.4);
162 params.sigma_u = params.sigma_w / denom2;
163 params.sigma_v = params.sigma_u;
164 } else {
165 // Medium/high altitude model
166 // Scale lengths are constant at 1750 ft = 533.4 m
167 params.L_u = 533.4;
168 params.L_v = 533.4;
169 params.L_w = 533.4;
170
171 // Intensities based on probability of exceedance
172 // Using simplified model: σ increases with severity
173 switch (severity) {
175 params.sigma_u = params.sigma_v = params.sigma_w = 1.5;
176 break;
178 params.sigma_u = params.sigma_v = params.sigma_w = 3.0;
179 break;
181 params.sigma_u = params.sigma_v = params.sigma_w = 7.0;
182 break;
183 }
184 }
185
186 return params;
187}
188
189} // namespace vulcan::wind
Definition WindTypes.hpp:95
constexpr double W20_LIGHT
Wind speed at 20 ft for different turbulence severities (MIL-HDBK-1797).
Definition WindTypes.hpp:98
constexpr double W20_MODERATE
Definition WindTypes.hpp:99
constexpr double W20_SEVERE
Definition WindTypes.hpp:100
Definition WindTypes.hpp:7
TurbulenceSeverity
Turbulence severity levels per MIL-HDBK-1797.
Definition WindTypes.hpp:85
@ Moderate
σ_w ≈ 3 m/s at low altitude
Definition WindTypes.hpp:87
@ Light
σ_w ≈ 1 m/s at low altitude
Definition WindTypes.hpp:86
@ Severe
σ_w ≈ 7 m/s at low altitude
Definition WindTypes.hpp:88
TurbulenceParams< double > mil_spec_params(double altitude, TurbulenceSeverity severity)
Compute MIL-spec turbulence parameters for given conditions.
Definition WindTypes.hpp:125
Angular gust rates in body frame.
Definition WindTypes.hpp:57
Scalar p_g
Roll gust rate [rad/s].
Definition WindTypes.hpp:58
Scalar r_g
Yaw gust rate [rad/s].
Definition WindTypes.hpp:60
Scalar q_g
Pitch gust rate [rad/s].
Definition WindTypes.hpp:59
Turbulent gust velocities in body frame.
Definition WindTypes.hpp:46
Scalar w_g
Vertical gust [m/s] (along body z-axis).
Definition WindTypes.hpp:49
Scalar v_g
Lateral gust [m/s] (along body y-axis).
Definition WindTypes.hpp:48
Scalar u_g
Longitudinal gust [m/s] (along body x-axis).
Definition WindTypes.hpp:47
Turbulence intensity and scale parameters (MIL-F-8785C).
Definition WindTypes.hpp:73
Scalar sigma_u
Longitudinal RMS intensity [m/s].
Definition WindTypes.hpp:74
Scalar sigma_v
Lateral RMS intensity [m/s].
Definition WindTypes.hpp:75
Scalar L_w
Vertical scale length [m].
Definition WindTypes.hpp:79
Scalar L_u
Longitudinal scale length [m].
Definition WindTypes.hpp:77
Scalar L_v
Lateral scale length [m].
Definition WindTypes.hpp:78
Scalar sigma_w
Vertical RMS intensity [m/s].
Definition WindTypes.hpp:76
3D wind velocity in NED frame
Definition WindTypes.hpp:21
Scalar speed() const
Total magnitude.
Definition WindTypes.hpp:32
Scalar horizontal_speed() const
Magnitude in horizontal plane.
Definition WindTypes.hpp:27
Scalar north
North component [m/s].
Definition WindTypes.hpp:22
Scalar direction_from() const
Definition WindTypes.hpp:38
Scalar east
East component [m/s].
Definition WindTypes.hpp:23
Scalar down
Down component [m/s].
Definition WindTypes.hpp:24