Rise
The Vieneo Province
Loading...
Searching...
No Matches
Tests/TerrainAwarenessTests.cpp

Source at documentation-generation time. See Test catalog for fixture associations.

1// Production geometry, GPWS selection and VMU playback with deterministic scene/audio sources.
2#include "../Modules/Module.h"
3#include <iostream>
4#include <memory>
5#include <cstdlib>
6#include <limits>
7
8using namespace TerrainAwareness;
11bool g_bAboveClouds = false;
12bool g_bAugment = false;
13float fuel = 1;
14static int checks = 0;
15static std::vector<SOUNDS> played, stopped;
16static SOUNDS missingRecording = SOUND_NONE;
17static SOUNDS extendedRecording = SOUND_NONE;
18static float glideslopeVolume = 1;
19static void Check(bool value, const char* message)
20{
21 ++checks;
22 if (!value) { std::cerr << "FAIL: " << message << '\n'; std::exit(1); }
23}
24struct Logger::CrashState {};
25Logger::Logger() = default;
26Logger::~Logger() = default;
27void Logger::Log(const char*, Level, int) {}
29Sound::Sound(GameClass*) { Check(sound_path.size() == SOUND_ENUMERATION,"sound enumeration and paths align"); }
30float Sound::Play(SOUNDS sound, float volume)
31{
32 if (sound == SOUND_GPWSGLIDESLOPE) glideslopeVolume = volume;
33 played.push_back(sound); return sound == missingRecording ? 0.f : (sound == extendedRecording ? 4.5f : 1.f);
34}
35void Sound::Stop(SOUNDS sound) const { stopped.push_back(sound); }
36void Sound::PlayEx(SOUNDS sound, bool, float volume, float, float, bool, bool, bool) { Play(sound,volume); }
37// Scene acquisition is a test input. Prediction, state admission, alert priority,
38// command lifecycle and audio consumption below use the production code.
40#include "GpwsWindshearScene.h"
41
42static Severity Patch(Predictor& predictor, float x, float y, float width, float height,
43 float altitude, bool obstacle = false, bool coverage = false)
44{
45 const Point a{x-width/2,y-height/2,altitude}, b{x+width/2,y-height/2,altitude};
46 const Point c{x+width/2,y+height/2,altitude}, d{x-width/2,y+height/2,altitude};
47 Point first[] = {a,b,c}, second[] = {a,c,d};
48 return Max(predictor.Scan(first,obstacle,coverage),predictor.Scan(second,obstacle,coverage));
49}
50static void Geometry()
51{
52 Flight f; f.altitudeKm = 1; f.speedKms = .1f;
53 Predictor p(f);
54 Check(Patch(p,0,4.5f,.03f,.01f,1) == Severity::Caution,"level flight sees ridge 45 seconds ahead");
55 Check(Patch(p,0,2.5f,.03f,.01f,1) == Severity::Warning,"level flight sees ridge 25 seconds ahead");
56 Check(Patch(p,0,7,.03f,.01f,1) == Severity::None,"outside horizon does not alert");
57 Check(Patch(p,0,-1,.03f,.01f,2) == Severity::None,"terrain behind aircraft does not alert");
58 Check(Patch(p,3,2,.03f,.01f,2) == Severity::None,"off-track city does not alert");
59 Check(Patch(p,.25f,2.043f,.001f,.001f,1,true) == Severity::Warning,"one-meter tower between steps inside corridor is detected");
60 Check(Patch(p,0,2,.01f,.01f,.4f,true) == Severity::None,"low building cleared safely");
61 Check(Patch(p,0,4.5f,.01f,.01f,1,true) == Severity::Caution,"obstacle has its own predictive caution");
62 f.verticalKms = -.02f; Predictor descending(f);
63 Check(Patch(descending,0,2.5f,.02f,.02f,.6f) == Severity::Warning,"descending toward terrain below current altitude");
64 f.verticalKms = .02f; Predictor climbing(f);
65 Check(Patch(climbing,0,2.5f,.02f,.02f,1) == Severity::None,"adequate climb clears ridge");
66 f.verticalKms = 0; f.turnRadiansPerSecond = .08f; Predictor turning(f);
67 const auto turnPoint = turning.segments[24].start;
68 Check(Patch(turning,turnPoint.x,turnPoint.y,.02f,.02f,1) == Severity::Warning,"turn projects corridor into new flight path");
69 Check(Patch(p,turnPoint.x,turnPoint.y,.02f,.02f,1) == Severity::None,"turn hazard was outside straight corridor");
70 f.turnRadiansPerSecond = 0; f.speedKms = .2f; Predictor fast(f);
71 Check(Patch(fast,0,4.5f,.02f,.02f,1) == Severity::Warning,"ground speed changes caution to warning");
72 // A continuous flat surface supplies the complete swath. A deliberately
73 // missing strip cannot be counted as clear terrain.
74 Predictor full(f); Patch(full,0,6,5,12,0,false,true);
75 Check(full.Covered(),"complete terrain covers entire corridor");
76 Predictor gap(f); Patch(gap,0,2,5,4,0,false,true); Patch(gap,0,9,5,6,0,false,true);
77 Check(!gap.Covered(),"missing terrain strip remains unknown");
78 f.speedKms = 2; Predictor limited(f); Patch(limited,0,30,10,60,0,false,true);
79 Check(!limited.Covered(),"range cap reports limited coverage at extreme speed");
80 f.speedKms = 0; Predictor hover(f);
81 Check(hover.segments.empty(),"hover never invents forward velocity");
82 Point invalid[] = {{0,1,1},{1,1,std::numeric_limits<float>::quiet_NaN()},{1,2,1}};
83 Check(p.Scan(invalid,false) == Severity::None,"invalid geometry does not produce arbitrary threats");
84}
85static void Approaches()
86{
87 Flight f; f.altitudeKm = .1f; f.speedKms = .05f; f.verticalKms = -.002f;
88 f.clearanceKm = .05f; f.landing = true; f.landingSite = {0,2.5f,0}; f.landingLengthKm = .5f;
89 Predictor approach(f);
90 Check(Patch(approach,0,1.5f,.1f,.1f,0) == Severity::None,"flat selected runway approach is quiet");
91 Check(Patch(approach,0,1.4f,.1f,.1f,.07f) == Severity::Warning,"hill on landing approach remains protected");
92 Check(Patch(approach,0,1.4f,.01f,.01f,.1f,true) == Severity::Warning,"gear down does not inhibit tower warning");
93 f.landing = false; Predictor noDestination(f);
94 Check(Patch(noDestination,0,2.5f,.1f,.1f,0) == Severity::Caution,"unselected landing surface is not silently exempted");
95}
96static void ColorsAndState()
97{
98 Check(Color(1,1,0,false,Severity::None) == 0xff8c8200,"same altitude uses relative yellow");
99 Check(Color(.86f,1,0,false,Severity::None) == 0xff8c8200,"yellow starts below aircraft");
100 Check(Color(.86f,1,0,true,Severity::None) == 0xff168438,"gear-down clearance band narrows");
101 Check(Color(1.4f,1,0,false,Severity::None) == 0xffd8bb00,"higher terrain has denser yellow shade");
102 Check(Color(1.7f,1,0,false,Severity::None) == 0xffb03030,"high terrain relative red");
103 Check(Color(0,1,0,false,Severity::Caution) == 0xffffff00,"active caution overrides relative band");
104 Check(Color(0,1,0,false,Severity::Warning) == 0xffff2020,"active warning overrides relative band");
105 Check(Color(0,1,0,false,Severity::None,false) == 0xffb030b0,"missing data is magenta not low terrain");
106 Check(Color(.7f,1,-.01f,false,Severity::None) == 0xff8c8200,"descent anticipates lost height");
107 State state; state.terrain = state.obstacle = Severity::Warning;
108 Check(!state.ObstacleAlert(),"guide priority selects terrain for equal-severity threats");
109 state.terrainTime = 20; state.obstacleTime = 25;
110 Check(!state.ObstacleAlert(),"earlier terrain wins equal severity");
111 state.obstacleTime = 15;
112 Check(!state.ObstacleAlert(),"earlier obstacle does not reorder equal-severity guide priority");
113 Check(!NeedsPrediction(11.45f,0,false) && NeedsPrediction(11.44f,0,false),"global height includes 915 m structures and a 1 km margin");
114 Check(NeedsPrediction(17.4f,-.1f,false) && !NeedsPrediction(17.5f,-.1f,false),"suspension checks the full descent horizon");
115 Check(NeedsPrediction(11.6f,0,true) && !NeedsPrediction(11.7f,0,true),"altitude hysteresis is bounded");
117 Check(state.ObstacleAlert(),"obstacle warning label outranks terrain caution");
118 Check(!Allowed(true,false,true,1) && Allowed(false,false,true,1),"simulator admission gate and real-world admission");
119 Check(!Allowed(false,true,true,1) && !Allowed(false,false,false,1) && !Allowed(false,false,true,0),"ground vehicle landing and power inhibit");
120}
121struct Fixture
122{
123 Logger logger;
124 std::unique_ptr<Bus> bus = std::make_unique<Bus>(&logger);
125 std::unique_ptr<Sound> sound = std::make_unique<Sound>(nullptr);
126 Gpws gpws{bus.get(),&logger};
127 Vmu vmu{bus.get(),&logger,sound.get()};
128 Fixture()
129 {
132 ourcockpit.wheeled = false; ourcockpit.flapSettings.clear();
133 bus->RadioAltitudeKm = 2; bus->VerticalSpeedKms = 0; bus->WPtargetC = 0;
134 vmu.FrameMove(2); bus->vmuHold = 0; played.clear(); stopped.clear();
135 }
136 void Threat(Severity terrain, Severity obstacle)
137 { bus->GPWS.terrain.enabled = true; bus->GPWS.terrain.terrain = terrain; bus->GPWS.terrain.obstacle = obstacle; bus->GPWS.terrain.terrainTime = 40; bus->GPWS.terrain.obstacleTime = 45; }
138 void Step(float dt = .1f) { gpws.FrameMove(dt); vmu.FrameMove(dt); }
139};
140static void AudioAndLifecycle()
141{
142 Fixture f;
143 f.Threat(Severity::Caution,Severity::None); f.Step();
144 Check(f.bus->GPWS.Alert == Bus::Gpws::TA_Terrain_Caution && played.back() == SOUND_TA_CAUTION_TERRAIN,"terrain caution reaches GPWS and VMU");
145 f.Threat(Severity::None,Severity::Warning); f.Step();
146 Check(stopped.empty() && played.back() == SOUND_TA_CAUTION_TERRAIN,"warning waits for caution phrase to finish");
147 f.Step(.95f);
148 Check(played.back() == SOUND_TA_OBSTACLE_WARNING && stopped.empty(),"pending warning plays intact after caution");
149 f.Step(2.1f);
150 Check(played.back() == SOUND_TA_PULLUP,"persistent predictive warning repeats plain pull up");
151 Command stale; stale.name = "GPWSObstacleObstacle"; stale.sValue = "GPWSTerrain";
152 stale.ivalues[0] = Bus::Gpws::TA_Obstacle_Warning; stale.ivalues[1] = int(f.bus->GPWS.terrainRevision); stale.delay = 10;
153 f.bus->commandStream.push_back(stale);
154 playerships[0].isSimulator = true; f.Step();
155 Check(!f.bus->GPWS.terrain.enabled && !f.bus->GPWS.IsTerrainAlert(),"simulator entry clears predictive state");
156 Check(f.bus->commandStream.empty() && stopped.back() == SOUND_TA_PULLUP,"simulator entry cancels queued and playing look-ahead audio");
157 auto count = played.size(); playerships[0].isSimulator = false; f.Step(10);
158 Check(played.size() == count,"simulator exit does not replay an old alert");
159 f.Threat(Severity::Warning,Severity::None); f.Step();
160 Check(played.back() == SOUND_GPWSTERRAINTERRAIN,"terrain warning reuses existing Terrain Terrain after simulator");
161 ourcockpit.power = 0; f.Step();
162 Check(!f.bus->GPWS.terrain.enabled && !f.bus->GPWS.IsTerrainAlert() && stopped.back() == SOUND_GPWSTERRAINTERRAIN,"power loss clears display queue and audio");
163 ourcockpit.power = 1; f.vmu.FrameMove(2); f.bus->vmuHold = 0;
164 f.Threat(Severity::Warning,Severity::None); f.bus->RadioAltitudeKm = .1f; f.bus->VerticalSpeedKms = -.02f; f.Step();
165 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode1_Pull_Up && !f.bus->GPWS.IsTerrainAlert(),"reactive pull-up retains higher priority");
166 f.bus->RadioAltitudeKm = 2; f.bus->VerticalSpeedKms = 0; g_bAboveClouds = true;
167 f.Threat(Severity::Warning,Severity::None); f.Step();
168 Check(f.bus->GPWS.Alert == Bus::Gpws::TA_Terrain_Warning,"cloud gate does not suppress known terrain threat");
169 g_bAboveClouds = false;
170 playerships[0].reference = REF_ONGROUND; f.Step();
171 Check(f.bus->GPWS.terrain.enabled && f.bus->GPWS.terrain.Alert() == Severity::None,"landing clears threats while retaining terrain display");
172
173 {
174 Fixture f; // Isolate missing assets from queued, higher-priority reactive alerts.
175 missingRecording = SOUND_TA_OBSTACLE_WARNING;
176 f.Threat(Severity::None,Severity::Warning); f.Step();
177 Check(played.back() == SOUND_TA_PULLUP,"missing obstacle warning uses plain predictive Pull Up");
178 missingRecording = SOUND_TA_CAUTION_TERRAIN;
179 f.Threat(Severity::Caution,Severity::None); f.Step(7.1f);
180 Check(played.back() == SOUND_TA_CAUTION_TERRAIN && f.bus->vmuHold <= 0,"missing caution remains silent without substitute voice");
181 missingRecording = SOUND_NONE;
182
183 Command wrong = stale; wrong.delay = 0; wrong.ivalues[0] = 999;
184 wrong.ivalues[1] = int(f.bus->GPWS.terrainRevision);
185 f.bus->commandStream.push_back(wrong); count = played.size(); f.vmu.FrameMove(.1f);
186 Check(f.bus->commandStream.empty() && played.size() == count,"invalid injected alert is discarded");
187 }
188}
189static void SeparateWarningRecordings()
190{
191 for (bool obstacle : {false,true})
192 {
193 Fixture f;
195 extendedRecording = prefix;
196 f.Threat(obstacle ? Severity::None : Severity::Warning, obstacle ? Severity::Warning : Severity::None);
197 f.Step(); f.Step(2.1f);
198 Check(played == std::vector<SOUNDS>{prefix} && stopped.empty(), "queued Pull Up waits for the complete long warning preface");
199 f.Step(2.5f);
200 Check(played == std::vector<SOUNDS>({prefix,SOUND_TA_PULLUP}) && stopped.empty(), "separate plain Pull Up follows terrain or obstacle without a combined file");
201 f.Step(2.1f);
202 Check(played == std::vector<SOUNDS>({prefix,SOUND_TA_PULLUP,SOUND_TA_PULLUP}), "persistent warning repeats only plain Pull Up");
203 extendedRecording = SOUND_NONE;
204 }
205 {
206 Fixture f; missingRecording = SOUND_TA_PULLUP;
207 f.Threat(Severity::Warning,Severity::None); f.Step(); f.Step(2.1f);
208 Check(played.back() == SOUND_GPWSPULLUP && f.bus->vmuHold > 0, "voice sets awaiting plain Pull Up retain their existing warning recording");
209 missingRecording = SOUND_NONE;
210 }
211 {
212 Fixture f;
213 Command command; command.name = "GPWSPullUp"; f.bus->commandStream.push_back(command); f.vmu.FrameMove(.1f);
214 Check(played == std::vector<SOUNDS>{SOUND_GPWSPULLUP}, "ordinary reactive Pull Up keeps the existing whoop recording");
215 f.vmu.FrameMove(1.1f);
216 command.name = "GPWSTerrain"; f.bus->commandStream.push_back(command); f.vmu.FrameMove(.1f);
217 Check(played.back() == SOUND_GPWSTERRAIN, "single Terrain command uses its independent recording");
218 }
219 for (bool obstacle : {false,true})
220 {
221 Fixture f; extendedRecording = obstacle ? SOUND_TA_CAUTION_OBSTACLE : SOUND_TA_CAUTION_TERRAIN;
222 f.Threat(obstacle ? Severity::None : Severity::Caution,obstacle ? Severity::Caution : Severity::None);
223 f.Step(); f.Step(2.1f);
224 Check(played == std::vector<SOUNDS>{extendedRecording} && stopped.empty(), "complete doubled caution recording is played once per announcement");
225 f.Step(5.f);
226 Check(played == std::vector<SOUNDS>({extendedRecording,extendedRecording}), "doubled caution file repeats at the existing seven-second cadence");
227 extendedRecording = SOUND_NONE;
228 }
229}
230static void CommonDispatch()
231{
232 Fixture f;
233 const auto checkCommand = [&](Bus::Gpws::GpwsEnum alert, const char* name, int priority) {
234 Check(f.bus->GPWS.Alert == alert && f.bus->commandStream.size() == 1,"one selected GPWS alert queues one command");
235 const auto& c = f.bus->commandStream.front();
236 Check(c.name == name && c.priority == priority && c.ttl == 2 &&
237 c.ivalues[0] == alert && unsigned(c.ivalues[1]) == f.bus->GPWS.terrainRevision,
238 "common switch uses named command, selected alert priority and cancellation revision");
239 };
240 f.Threat(Severity::Warning,Severity::Caution); f.gpws.FrameMove(.1f);
241 checkCommand(Bus::Gpws::TA_Terrain_Warning,"GPWSTerrainTerrain",105);
242 f.Threat(Severity::Caution,Severity::Warning); f.gpws.FrameMove(2.1f);
243 checkCommand(Bus::Gpws::TA_Obstacle_Warning,"GPWSObstacleObstacle",106);
244 f.Threat(Severity::Warning,Severity::Warning); f.gpws.FrameMove(2.1f);
245 checkCommand(Bus::Gpws::TA_Terrain_Warning,"GPWSTerrainTerrain",105);
246 f.bus->commandStream.clear(); f.gpws.FrameMove(1.9f);
247 Check(f.bus->commandStream.empty(),"persistent warning waits for two-second interval");
248 f.gpws.FrameMove(.2f);
249 checkCommand(Bus::Gpws::TA_Terrain_Warning,"GPWSPullUp",105);
250 f.gpws.FrameMove(10);
251 Check(f.bus->commandStream.size() == 1,"pending predictive speech is not duplicated");
252 f.Threat(Severity::Caution,Severity::Caution); f.gpws.FrameMove(.1f);
253 checkCommand(Bus::Gpws::TA_Terrain_Caution,"GPWSCautionTerrain",109);
254 f.bus->commandStream.clear(); f.gpws.FrameMove(6.9f);
255 Check(f.bus->commandStream.empty(),"caution waits for seven-second interval");
256 f.gpws.FrameMove(.2f);
257 checkCommand(Bus::Gpws::TA_Terrain_Caution,"GPWSCautionTerrain",109);
258 f.Threat(Severity::None,Severity::Caution); f.gpws.FrameMove(7.1f);
259 checkCommand(Bus::Gpws::TA_Obstacle_Caution,"GPWSCautionObstacle",110);
260 f.vmu.FrameMove(.1f);
261 Check(played.back() == SOUND_TA_CAUTION_OBSTACLE,"named obstacle caution uses vehicle sound slot");
262 f.Threat(Severity::None,Severity::None); f.Step();
263 Check(stopped.empty() && f.bus->vmuHold > 0 && f.bus->commandStream.empty(),"hazard clearance removes queued speech but finishes the active phrase");
264
265 // A threshold-crossing callout must remain queued after its triggering frame.
266 Command altitude; altitude.name = "GPWSMode6FiveHundred";
267 f.bus->commandStream.push_back(altitude);
268 f.Threat(Severity::None,Severity::None); f.gpws.FrameMove(.1f);
269 Check(f.bus->commandStream.size() == 1 && f.bus->commandStream.front().name == altitude.name,
270 "legacy one-shot callout survives alert clearance");
271 f.vmu.FrameMove(2);
272 Check(played.back() == SOUND_GPWSFIVEHUNDRED,"legacy altitude callout still uses normal VMU dispatch");
273
274 // VMU must reject new TA phrases even if a caller bypasses the GPWS producer.
275 Command injected; injected.name = "GPWSObstacleObstacle";
276 playerships[0].isSimulator = true; f.bus->commandStream.push_back(injected);
277 const auto count = played.size(); f.vmu.FrameMove(2);
278 Check(f.bus->commandStream.empty() && played.size() == count,"untagged predictive phrase cannot play in simulator");
279}
280static void UninterruptedSpeech()
281{
282 Fixture f;
283 for (int i = 0; i < 20; ++i)
284 {
285 if (i%2 == 0) f.Threat(Severity::Caution,Severity::None);
286 else { f.bus->GPWS.terrain.Clear(); f.bus->GPWS.terrain.enabled = true; }
287 f.Step(.05f);
288 }
289 Check(played.size() == 1 && stopped.empty(),"coverage flicker cannot restart a caution mid-word or bypass its cadence");
290 f.Threat(Severity::Caution,Severity::None); f.Step(6.2f);
291 Check(played.size() == 2 && stopped.empty(),"persistent caution can repeat after its normal interval");
292 f.bus->GPWS.terrain.Clear(); f.bus->GPWS.terrain.enabled = true;
293 f.Step(2);
294 played.clear(); stopped.clear();
295 Command fifty; fifty.name = "GPWSMode6Fifty"; f.bus->commandStream.push_back(fifty); f.vmu.FrameMove(.1f);
296 Check(played.back() == SOUND_GPWSFIFTY,"normal altitude callout begins");
297 f.Threat(Severity::Warning,Severity::None); f.Step(.1f);
298 Check(played.size() == 1 && stopped.empty(),"new terrain warning cannot cut an altitude callout mid-word");
299 f.Step(1);
300 Check(played.back() == SOUND_GPWSTERRAINTERRAIN,"warning takes the channel after the altitude phrase finishes");
301 {
302 Fixture descent;
303 descent.bus->RadioAltitudeKm = .016f; descent.gpws.FrameMove(2);
304 descent.bus->commandStream.clear();
305 descent.bus->RadioAltitudeKm = .014f; descent.Step(1);
306 descent.bus->RadioAltitudeKm = .008f; descent.Step(1);
307 descent.bus->RadioAltitudeKm = .005f; descent.Step(1);
308 Check(played == std::vector<SOUNDS>{SOUND_GPWSFIFTY,SOUND_GPWSTHIRTY,SOUND_GPWSTWENTY} && stopped.empty(),
309 "fast altitude crossings skip forty without truncating fifty, thirty or twenty");
310 }
311}
312static void StableCategoryPriority()
313{
314 Fixture f;
315 for (int i = 0; i < 150; ++i)
316 {
318 f.bus->GPWS.terrain.terrainTime = 39;
319 f.bus->GPWS.terrain.obstacleTime = i%2 ? 39.001f : 38.999f;
320 f.Step(.1f);
321 Check(!f.bus->GPWS.terrain.ObstacleAlert() && f.bus->GPWS.Alert == Bus::Gpws::TA_Terrain_Caution,
322 "near-equal encounter times cannot chatter the map or selected caution");
323 }
324 Check(played.size() == 3 && std::all_of(played.begin(),played.end(),[](SOUNDS sound) { return sound == SOUND_TA_CAUTION_TERRAIN; }) && stopped.empty(),
325 "jittering threats preserve three intact terrain phrases on the seven-second cadence");
326 f.Threat(Severity::Caution,Severity::Warning); f.Step();
327 Check(f.bus->GPWS.terrain.ObstacleAlert() && f.bus->GPWS.Alert == Bus::Gpws::TA_Obstacle_Warning,
328 "higher obstacle severity takes priority immediately");
329 f.Threat(Severity::None,Severity::Caution); f.Step();
330 Check(f.bus->GPWS.terrain.ObstacleAlert() && f.bus->GPWS.Alert == Bus::Gpws::TA_Obstacle_Caution,
331 "obstacle caution is selected immediately when terrain clears");
332}
333static void ManualAuditRegressions()
334{
335 Check(GpwsBehavior::GearFloor(.1f,false) < .17f && GpwsBehavior::GearFloor(.15f,false) == .3048f,
336 "Mode 4A ramps from 500 ft and caps at 1000 ft instead of using 1000 ft as a minimum");
337 Check(GpwsBehavior::FlapFloor(.09f,false) < .13f && GpwsBehavior::FlapFloor(.15f,false) == .3048f,
338 "Mode 4B ramps from 245 ft and caps at 1000 ft");
339 Check(GpwsBehavior::GearFloor(.2f,true) == .1524f && GpwsBehavior::FlapFloor(.2f,true) == .074676f,
340 "available TAD disables Mode 4 speed expansion");
341 Check(GpwsBehavior::BankLimit(1,false) == 55 && GpwsBehavior::BankLimit(1,true) == 33 &&
342 GpwsBehavior::BankLimit(.006f,false) == 10,"jet bank limits include low altitude and autopilot reduction");
344 Check(std::fabs(history.Update(5,.2f,.3048f)-.05f) < .00001f,"MTC starts at zero and integrates elapsed time");
345 Check(std::fabs(history.Update(10,.2f,.3048f)-.15f) < .00001f,"MTC reaches 75 percent of 15 second average");
346 Check(std::fabs(history.Update(15,.01f,.3048f)-.15f) < .00001f,"MTC cannot fall with decreasing terrain clearance");
347 Check(Color(1,1,0,true,Severity::None,true,1,true) == 0xff000000 &&
348 Color(1.8f,1,0,true,Severity::None,true,1,true) == 0xffb03030,
349 "ground declutter hides airport surface while higher mountains remain red");
350 Check(Color(1,1,0,true,Severity::Warning,true,1,true) == 0xffff2020,
351 "runway display declutter cannot hide a detected threat");
352 Check(Color(.6f,1,0,true,Severity::None,true,1,false) == 0xff104620,
353 "runway declutter is a vertical band, not a blanket hiding of everything below runway height");
354 {
355 Fixture f; playerships[0].reference = REF_ONGROUND;
357 f.bus->RadioAltitudeKm = .1f; f.bus->VerticalSpeedKms = -.1f;
358 f.bus->RollAttitudeRadians = 1.5f; f.Step(4);
359 Check(f.bus->GPWS.terrain.enabled && !f.bus->GPWS.IsTerrainAlert() && played.empty(),
360 "ground state preserves terrain awareness with no predictive or reactive flight warnings");
361 }
362 {
363 Fixture f; playerships[0].geardown = true; f.bus->RadioAltitudeKm = .1f;
364 f.gpws.FrameMove(.01f);
365 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset,"first radio sample cannot invent a closure rate");
366 g_bAboveClouds = true; f.bus->VerticalSpeedKms = -.03f; f.gpws.FrameMove(2);
367 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode1_Pull_Up,"cloud layer cannot inhibit reactive pull up");
368 g_bAboveClouds = false;
369 }
370 {
371 Fixture f; playerships[0].geardown = true;
372 f.bus->RadioAltitudeKm = .08f; f.bus->VerticalSpeedKms = -.001f;
373 f.bus->LocalizerDeviationRadians = 0; f.bus->GlideslopeDeviationRadians = RiseMath::ToRadian(-.8f);
374 f.gpws.FrameMove(4);
375 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode5b_Glideslope,"manual ILS without autopilot capture gets hard glideslope warning");
376 f.bus->GlideslopeDeviationRadians = 0; f.gpws.FrameMove(.1f);
377 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset,"hard glideslope alert clears when deviation recovers");
378 f.bus->GPWS.mode5cancelled = true; f.bus->RadioAltitudeKm = .7f; f.gpws.FrameMove(.1f);
379 Check(f.bus->GPWS.mode5cancelled,"glideslope cancel remains above 2000 ft until touchdown");
380 f.bus->GPWS.mode5cancelled = true; f.bus->RadioAltitudeKm = .008f; f.gpws.FrameMove(.1f);
381 Check(f.bus->GPWS.mode5cancelled,"glideslope cancel remains below 30 ft until touchdown");
382 }
383 {
384 Fixture f; f.bus->RadioAltitudeKm = .007f; f.bus->RollAttitudeRadians = RiseMath::ToRadian(20.f);
385 f.gpws.FrameMove(2);
386 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle,"bank advisory exists below the old 50 ft cutoff");
387 f.bus->RadioAltitudeKm = .7f; f.bus->RollAttitudeRadians = RiseMath::ToRadian(40.f);
388 f.bus->AFCS.AutopilotEngaged = true; f.gpws.FrameMove(2);
389 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle,"autopilot bank protection retains its reduced limit within the flight envelope");
390 }
391 {
392 Fixture f; f.bus->RadioAltitudeKm = .065f; f.gpws.FrameMove(2); f.bus->commandStream.clear();
393 f.bus->RadioAltitudeKm = .059f; f.gpws.FrameMove(1);
394 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode6_Two_Hundred,"gear-up crossing cannot call landing minimums");
395 f.bus->commandStream.clear(); f.bus->RadioAltitudeKm = .065f; f.gpws.FrameMove(1);
396 f.bus->RadioAltitudeKm = .059f; f.gpws.FrameMove(1);
397 Check(f.bus->GPWS.Alert != Bus::Gpws::Mode6_Two_Hundred,"altitude oscillation does not repeat a callout in one approach");
398 }
399 {
400 Fixture f; playerships[0].geardown = true; f.bus->RadioAltitudeKm = .02f; f.gpws.FrameMove(2);
401 f.bus->commandStream.clear(); f.bus->vmuHold = 2;
402 f.bus->RadioAltitudeKm = .014f; f.gpws.FrameMove(.1f);
403 f.bus->RadioAltitudeKm = .008f; f.gpws.FrameMove(.1f);
404 Check(f.bus->commandStream.size() == 1 && f.bus->commandStream.front().name == "GPWSMode6Thirty" &&
405 f.bus->commandStream.front().priority == 112,"latest crossed altitude replaces obsolete queued height without losing priority");
406 }
407 {
408 Fixture f; playerships[0].geardown = true;
409 f.bus->RadioAltitudeKm = .2f; f.bus->VerticalSpeedKms = -.003f;
410 f.bus->LocalizerDeviationRadians = 0; f.bus->GlideslopeDeviationRadians = RiseMath::ToRadian(-.5f);
411 f.Step();
412 Check(played.back() == SOUND_GPWSGLIDESLOPE && glideslopeVolume == .5f,"soft glideslope uses half volume");
413 const auto count = played.size(); f.Step(4);
414 Check(played.size() == count,"unchanged soft glideslope deviation does not repeat on a timer");
415 f.bus->GlideslopeDeviationRadians = RiseMath::ToRadian(-.61f); f.Step(1);
416 Check(played.size() == count+1,"20 percent deeper soft deviation produces another phrase");
417 // Descend without a Mode 2 closure, then allow the crossed 500-foot
418 // callout (which outranks glideslope) to finish before checking volume.
419 f.bus->RadioAltitudeKm = .08f; f.bus->GlideslopeDeviationRadians = RiseMath::ToRadian(-.8f); f.Step(40); f.Step(2);
420 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode5b_Glideslope && glideslopeVolume == 1.f,
421 "hard glideslope restores normal volume after higher-priority altitude callout");
422 f.bus->GlideslopeDeviationRadians = 0; f.gpws.FrameMove(.1f);
423 Check(std::none_of(f.bus->commandStream.begin(),f.bus->commandStream.end(),[](const Command& c) {
424 return c.sValue == "GPWSReactive";
425 }),"recovered reactive warning cannot remain queued for later playback");
426 }
427 {
428 Fixture f; f.bus->RadioAltitudeKm = .75f; f.bus->RollAttitudeRadians = RiseMath::ToRadian(60.f);
429 f.Step(); const auto count = played.size(); f.Step(3);
430 Check(played.size() == count,"unchanged excessive bank produces one advisory");
431 f.bus->RollAttitudeRadians = RiseMath::ToRadian(73.f); f.Step(3);
432 f.bus->RollAttitudeRadians = RiseMath::ToRadian(89.f); f.Step(3); f.Step(3);
433 Check(played.size() == count+3,"second 20 percent bank increase makes advisory continuous");
434 const auto after = played.size(); f.bus->RollAttitudeRadians = RiseMath::ToRadian(60.f); f.Step(3);
435 Check(played.size() == after,"reducing bank below continuous threshold stops repetition");
436 }
437 {
438 Fixture f; playerships[0].geardown = true; f.bus->RadioAltitudeKm = .2f;
439 f.gpws.FrameMove(1); f.bus->RadioAltitudeKm = .1f; f.gpws.FrameMove(1);
440 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode2_Terrain,"full landing configuration suppresses Mode 2B pull up");
441 playerships[0].geardown = false; f.bus->RadioAltitudeKm = .2f; f.gpws.FrameMove(1);
442 f.bus->RadioAltitudeKm = .1f; f.gpws.FrameMove(1);
443 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode2b_Pull_Up,"Mode 2B can warn with gear up when landing-flap input selects it");
444 }
445 {
446 Fixture f; f.bus->IndicatedAirspeedKms = .1f; f.bus->RadioAltitudeKm = .2f;
447 f.gpws.FrameMove(1);
448 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset,"Mode 4A does not warn throughout an incorrectly flattened 1000 ft envelope");
449 f.bus->RadioAltitudeKm = .16f; f.gpws.FrameMove(10);
450 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode4a_Too_Low_Terrain,"correct Mode 4A speed envelope also protects level flight");
451 f.Threat(Severity::None,Severity::None); f.bus->GPWS.terrain.terrainComplete = f.bus->GPWS.terrain.obstaclesComplete = true;
452 f.gpws.FrameMove(1);
453 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset,"TAD availability narrows Mode 4 envelope without muting it entirely");
454 }
455 {
456 Fixture f; playerships[0].reference = REF_ONGROUND; playerships[0].mslKm = .1f;
457 f.bus->RadioAltitudeKm = 0; f.gpws.FrameMove(1);
459 f.bus->RadioAltitudeKm = .2f; f.bus->VerticalSpeedKms = .01f; f.gpws.FrameMove(15);
460 // Rising ground during a climb reduces radio height without altitude loss.
461 playerships[0].mslKm = .31f; f.bus->RadioAltitudeKm = .14f; f.gpws.FrameMove(15);
462 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode4c_Too_Low_Terrain,"takeoff clearance floor detects rising ground without false Don't Sink");
463 playerships[0].mslKm = .29f; f.bus->RadioAltitudeKm = .25f; f.bus->VerticalSpeedKms = -.002f;
464 f.gpws.FrameMove(5);
465 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode3_Dont_Sink,"actual altitude loss after takeoff triggers Don't Sink");
466 f.bus->VerticalSpeedKms = .002f; f.gpws.FrameMove(1);
467 Check(f.bus->GPWS.Alert != Bus::Gpws::Mode3_Dont_Sink,"positive climb clears Don't Sink");
468 }
469 const auto destinationClosure = [](float rangeKm, float heightKm) {
470 Fixture f; ourcockpit.flapSettings.emplace_back(0.f,.2f);
471 f.bus->waypoint.resize(1); auto& runway = f.bus->waypoint[0];
472 runway.type = 2; runway.heading = 0; runway.length = 2;
473 runway.elevationKm = 0; runway.location = RiseMath::Vector3(rangeKm,0,0);
474 playerships[0].position = RiseMath::Vector3(0,0,0); playerships[0].mslKm = heightKm;
475 f.bus->GPWS.terrain.enabled = f.bus->GPWS.terrain.terrainComplete = f.bus->GPWS.terrain.obstaclesComplete = true;
476 f.bus->RadioAltitudeKm = .3f; f.gpws.FrameMove(1);
477 f.bus->RadioAltitudeKm = .2f; f.gpws.FrameMove(1);
478 return f.bus->GPWS.Alert;
479 };
480 Check(destinationClosure(8,.2f) == Bus::Gpws::Mode2b_Pull_Up,
481 "destination airport vicinity selects Mode 2B without gear, flaps or ILS capture");
482 Check(destinationClosure(20,.2f) == Bus::Gpws::Mode2a_Pull_Up,
483 "outside 10 nm destination vicinity retains Mode 2A");
484 Check(destinationClosure(8,1.1f) == Bus::Gpws::Mode2a_Pull_Up,
485 "more than 3500 ft above destination retains Mode 2A despite nearby range");
486}
487
488static void BankAltitudeEnvelope()
489{
490 // The same real bus bit must select distinct profiles throughout normal flight.
491 for (bool autopilot : {false,true})
492 for (float radioKm : {.761999f,.762f,.762001f,1.5f,12.192f})
493 for (float sign : {-1.f,1.f})
494 {
495 Fixture f; playerships[0].mslKm = 9.525f+radioKm;
496 f.bus->RadioAltitudeKm = radioKm; f.bus->AFCS.AutopilotEngaged = autopilot;
497 f.bus->Mach = .8f; f.bus->RollAttitudeRadians = RiseMath::ToRadian(sign*40.f);
498 f.Step();
499 Check((f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle) == autopilot,
500 "40-degree bank selects Autoflyte only, including 40000 ft AGL over a high field");
501 Check(autopilot ? played.size() == 1 && played.back() == SOUND_GPWSBANKANGLE : played.empty(),
502 "manual and Autoflyte bank profiles reach the normal VMU path");
503 f.bus->RollAttitudeRadians = RiseMath::ToRadian(sign*56.f); f.Step(3);
504 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle,
505 "manual 55-degree bank protection remains above the former ceiling");
506 }
507 {
508 Fixture f; f.bus->RadioAltitudeKm = 2; playerships[0].mslKm = 2;
509 f.bus->RollAttitudeRadians = RiseMath::ToRadian(40.f); f.bus->vmuHold = 5;
510 f.gpws.FrameMove(.1f); Check(f.bus->commandStream.empty(),"manual 40-degree bank is quiet");
511 f.bus->AFCS.AutopilotEngaged = true; f.gpws.FrameMove(.1f);
512 Check(f.bus->commandStream.size() == 1 && f.bus->commandStream.front().name == "GPWSBankAngle",
513 "engaging Autoflyte immediately applies the 33-degree profile");
514 f.bus->AFCS.AutopilotEngaged = false; f.gpws.FrameMove(.1f); f.vmu.FrameMove(6);
515 Check(played.empty() && f.bus->commandStream.empty(),"disengaging Autoflyte expires its queued advisory");
516 }
517 for (bool autopilot : {false,true})
518 for (float height : {40.f,100.f,900.f})
519 for (float roll : {-89.f,89.f})
520 for (float mach : {0.f,20.f})
521 {
522 Fixture f; playerships[0].mslKm = height; f.bus->RadioAltitudeKm = height;
523 f.bus->AFCS.AutopilotEngaged = autopilot; f.bus->Mach = mach;
524 f.bus->AirDensityScalar = 1; // Stale bus sample must not revive an orbital warning.
525 f.bus->RollAttitudeRadians = RiseMath::ToRadian(roll); f.bus->VerticalSpeedKms = -3;
526 f.Step(); f.Step(3);
527 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset && played.empty() && f.bus->commandStream.empty(),
528 "thin-air coast, hypersonic entry and 900 km orbit cannot announce bank angle");
529 }
530 {
532 Check(envelope.Allows(2,.01001f,4.99f),"normal flight remains eligible above thin-air and below hypersonic thresholds");
533 Check(!envelope.Allows(2,.01f,0),"one-percent density suspends even stationary suborbital coast");
534 Check(!envelope.Allows(2,.01999f,0),"thin-air hysteresis prevents chattering");
535 Check(envelope.Allows(2,.02f,4),"two-percent density and Mach 4 rearm together");
536 Check(!envelope.Allows(2,.2f,5),"hypersonic flight suspends bank advisories in denser air");
537 Check(!envelope.Allows(2,.2f,4.01f),"hypersonic hysteresis holds during initial deceleration");
538 Check(envelope.Allows(2,.2f,4),"return to Mach 4 rearms normal bank profiles");
539 Check(!envelope.Allows(.762001f,0,20) && envelope.Allows(.762f,0,20),
540 "near-ground protection overrides the spaceflight gate at 762 m inclusive");
541 const float nan = std::numeric_limits<float>::quiet_NaN();
542 Check(!envelope.Allows(nan,.2f,0) && !envelope.Allows(2,nan,0),"invalid admission inputs do not create bank warnings");
543 Check(envelope.Allows(.75f,nan,nan),"valid near-ground radio height does not depend on density or Mach");
544 }
545 {
546 Fixture f; f.bus->RadioAltitudeKm = 2; playerships[0].mslKm = 2;
547 f.bus->RollAttitudeRadians = RiseMath::ToRadian(60.f); f.bus->vmuHold = 5;
548 f.gpws.FrameMove(.1f);
549 Check(f.bus->commandStream.size() == 1,"bank warning can wait behind an existing phrase");
550 playerships[0].mslKm = 40; f.bus->RadioAltitudeKm = 40; f.gpws.FrameMove(.1f); f.vmu.FrameMove(6);
551 Check(played.empty() && f.bus->commandStream.empty(),"spaceflight entry removes queued bank audio");
552 playerships[0].mslKm = 32; f.bus->RadioAltitudeKm = 32; f.Step();
553 Check(played.empty(),"re-entry retains thin-air hysteresis");
554 playerships[0].mslKm = 25; f.bus->RadioAltitudeKm = 25; f.bus->Mach = 6; f.Step();
555 Check(played.empty(),"denser hypersonic re-entry still inhibits the jet bank advisory");
556 f.bus->Mach = 4; f.Step();
557 Check(played.size() == 1 && played.back() == SOUND_GPWSBANKANGLE,"slower atmospheric re-entry rearms the advisory");
558 f.bus->Mach = 5; f.Step();
559 Check(stopped.empty() && f.bus->vmuHold > 0 && played.size() == 1,
560 "spaceflight transition lets an active phrase finish without interruption");
561 f.Step(3); Check(played.size() == 1 && f.bus->commandStream.empty(),"no stale repeats survive spaceflight entry");
562 playerships[0].mslKm = 10.275f; f.bus->RadioAltitudeKm = .75f; f.bus->Mach = 20; f.Step();
563 Check(played.size() == 2 && f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle,
564 "near-ground recovery overrides a latched high-speed exclusion");
565 }
566 for (int reset : {0,1,2})
567 {
568 Fixture f; playerships[0].mslKm = 40; f.bus->RadioAltitudeKm = 40;
569 f.bus->RollAttitudeRadians = RiseMath::ToRadian(60.f); f.gpws.FrameMove(.1f);
570 playerships[0].mslKm = 32; f.bus->RadioAltitudeKm = 32; f.gpws.FrameMove(.1f);
571 Check(f.bus->GPWS.Alert == Bus::Gpws::Reset,"transition band retains the previous spaceflight state");
572 if (reset == 0) { playerships[0].reference = REF_ONGROUND; f.gpws.FrameMove(.1f); playerships[0].reference = REF_APNMODE; }
573 if (reset == 1) { ourcockpit.power = 0; f.gpws.FrameMove(.1f); ourcockpit.power = 1; }
574 if (reset == 2) ++playerships[0].vehicleId;
575 f.gpws.FrameMove(.1f);
576 Check(f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle,"ground, power and vehicle reset cannot retain stale spaceflight hysteresis");
577 }
578 for (float height : {.001f,.002f,.75f})
579 {
580 Fixture f; playerships[0].mslKm = 9.525f+height; f.bus->RadioAltitudeKm = height;
581 f.bus->IndicatedAirspeedKms = f.bus->TrueAirspeedKms = f.bus->Mach = 0;
582 ourcockpit.dntranslimit = 1; f.bus->RollAttitudeRadians = RiseMath::ToRadian(60.f); f.Step();
583 Check((f.bus->GPWS.Alert == Bus::Gpws::Mode6_Bank_Angle) == (height >= .001524f),
584 "zero-IAS VTOL retains the five-foot minimum and near-ground bank protection");
586 }
587 {
588 Fixture f; f.bus->RadioAltitudeKm = 25; playerships[0].mslKm = 25; f.bus->Mach = 6;
589 f.bus->RollAttitudeRadians = RiseMath::ToRadian(89.f); f.Threat(Severity::Warning,Severity::None); f.Step();
590 Check(f.bus->GPWS.Alert == Bus::Gpws::TA_Terrain_Warning && played.back() == SOUND_GPWSTERRAINTERRAIN,
591 "spaceflight bank exclusion cannot inhibit a separate predictive terrain warning");
592 f.Threat(Severity::None,Severity::Warning); f.gpws.FrameMove(.1f);
593 Check(f.bus->GPWS.Alert == Bus::Gpws::TA_Obstacle_Warning,
594 "spaceflight bank exclusion cannot inhibit a separate obstacle warning");
595 }
596}
597
598#include "GpwsControlsTests.h"
599#include "GpwsWindshearTests.h"
600#include "ModuleSchedulerTests.h"
601#include "GpwsPredictiveWindshearTests.h"
602#include "TerrainAlertStabilityTests.h"
603int main()
604{
605 TerrainAlertStabilityRegressions();
606 Geometry(); Approaches(); ColorsAndState(); AudioAndLifecycle(); SeparateWarningRecordings(); CommonDispatch(); UninterruptedSpeech(); StableCategoryPriority();
607 ManualAuditRegressions(); BankAltitudeEnvelope(); ControlsAndCompletion(); WindshearRegressions(); ModuleSchedulingRegressions(); PredictiveWindshearRegressions();
608 std::cout << "PASS: " << checks << " terrain/obstacle, map, priority and lifecycle checks\n";
609}
SCRIPT_CONTROL SCRIPT_STATE const void int
#define MAX_SCAN
@ REF_APNMODE
Definition ServerTypes.h:42
@ REF_ONGROUND
Definition ServerTypes.h:43
SOUNDS
Definition Sound.h:23
@ SOUND_GPWSTHIRTY
Definition Sound.h:55
@ SOUND_TA_CAUTION_OBSTACLE
Definition Sound.h:69
@ SOUND_GPWSFIVEHUNDRED
Definition Sound.h:61
@ SOUND_NONE
Definition Sound.h:24
@ SOUND_GPWSBANKANGLE
Definition Sound.h:50
@ SOUND_GPWSPULLUP
Definition Sound.h:45
@ SOUND_GPWSGLIDESLOPE
Definition Sound.h:51
@ SOUND_GPWSFIFTY
Definition Sound.h:57
@ SOUND_ENUMERATION
Definition Sound.h:344
@ SOUND_TA_OBSTACLE_WARNING
Definition Sound.h:70
@ SOUND_GPWSTWENTY
Definition Sound.h:54
@ SOUND_TA_PULLUP
Definition Sound.h:72
@ SOUND_GPWSTERRAIN
Definition Sound.h:71
@ SOUND_GPWSTERRAINTERRAIN
Definition Sound.h:46
@ SOUND_TA_CAUTION_TERRAIN
Definition Sound.h:68
Bus(Logger *prmLogger)
Definition Bus.cpp:55
void UpdateTerrainAwareness(float seconds)
void FrameMove(float fElapsedTime) override
Definition GPWS.cpp:52
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
Logger()
Definition Logger.cpp:392
~Logger()
Definition Logger.cpp:448
void Stop(SOUNDS soundEnum) const
Definition Sound.cpp:3397
std::vector< std::string > sound_path
Definition Sound.h:397
float Play(SOUNDS soundEnum, float volume=1.0f)
Definition Sound.cpp:802
void PlayEx(SOUNDS soundEnum, bool loop, float volume=1.0f, float frequencyMod=1.0f, float pan=0.0f, bool restart=true, bool fromOutside=false, bool partOfHull=false)
Definition Sound.cpp:1006
Sound(GameClass *gameptr)
Definition Sound.cpp:69
Severity Scan(const Point(&triangle)[3], bool obstacle, bool coverage=false, float *firstThreatTime=nullptr)
void FrameMove(float fElapsedTime) override
Definition VMU.cpp:5
float fuel
Definition globals.cpp:90
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
Scockpit ourcockpit
Definition globals.cpp:114
bool g_bAboveClouds
Definition globals.cpp:16
bool g_bAugment
Definition globals.cpp:47
float FlapFloor(float speedKms, bool terrainAvailable)
float BankLimit(float radioKm, bool autopilot)
float GearFloor(float speedKms, bool terrainAvailable)
Path Geometry(const Input &, const Request &r, const ArrivalPreview &gate)
auto ToRadian(T value)
Definition ClientMath.h:13
Severity Max(Severity a, Severity b)
uint32_t Color(float terrainKm, float altitudeKm, float verticalKms, bool gearDown, Severity severity, bool known=true, float displayRunwayKm=-100, bool onGround=false)
bool NeedsPrediction(float altitudeKm, float verticalKms, bool active)
bool Allowed(bool simulator, bool groundVehicle, bool airborne, float power)
GpwsEnum
Definition Bus.h:189
@ TA_Obstacle_Caution
Definition Bus.h:206
@ Mode1_Pull_Up
Definition Bus.h:194
@ Mode2_Terrain
Definition Bus.h:203
@ Mode4c_Too_Low_Terrain
Definition Bus.h:209
@ Mode6_Bank_Angle
Definition Bus.h:228
@ TA_Terrain_Caution
Definition Bus.h:205
@ Mode5b_Glideslope
Definition Bus.h:226
@ Mode4a_Too_Low_Terrain
Definition Bus.h:207
@ Mode6_Two_Hundred
Definition Bus.h:213
@ Mode2a_Pull_Up
Definition Bus.h:195
@ Mode2b_Pull_Up
Definition Bus.h:196
@ TA_Obstacle_Warning
Definition Bus.h:202
@ TA_Terrain_Warning
Definition Bus.h:201
@ Mode3_Dont_Sink
Definition Bus.h:224
@ Reset
Definition Bus.h:247
std::string sValue
Definition Command.h:20
int ivalues[2]
Definition Command.h:21
std::string name
Definition Command.h:11
float delay
Definition Command.h:8
bool Allows(float radioKm, float densityRatio, float mach)
float Update(float dt, float radioKm, float limitKm)
float dntranslimit
Definition globals.h:601
float maxGrossLbs
Definition globals.h:634
float power
Definition globals.h:599
std::vector< FlapSetting > flapSettings
Definition globals.h:661
float emptyWeightLbs
Definition globals.h:633
bool wheeled
Definition globals.h:596
RiseMath::Vector3 position
Definition globals.h:511
unsigned short vehicleId
Definition globals.h:537