Rise
The Vieneo Province
GPWS.cpp
Go to the documentation of this file.
1 #include "Module.h"
2 
10 
11 // MESSAGE MODE
12 // 1-3 “Pull Up” ...............................................................................1, 2 a&b
13 // 4-5 “Terrain, Terrain” ......................................................................2 a&b
14 // 6 “Terrain, Terrain Pull Up” a, d ...........................................................TA
15 // 7 “Obstacle, Obstacle Pull Up” a, e .........................................................TA
16 // 8 “Terrain” .................................................................................2
17 // 9 “Minimums, Minimums” a, f .................................................................6
18 // 10 “Caution Terrain, Caution Terrain” a, b ..................................................TA
19 // 11 “Caution Obstacle, Caution Obstacle” a, c ................................................TA
20 // 12-15 “Too Low Terrain” .....................................................................4 a&b&c, TCF
21 // 16-24 Altitude Callouts .....................................................................6
22 // 25 “Too Low Gear” ...........................................................................4A
23 // 26 “Too Low Flaps” ..........................................................................4B
24 // 27 “Sink rate, Sink rate” ...................................................................1
25 // 28 “Don’t Sink, Don’t Sink” .................................................................3
26 // 29 “Glideslope” .............................................................................5
27 // 30 “Bank Angle, Bank Angle” .................................................................6
28 
29 Gpws::Gpws(Bus* prmBus, Logger* prmLogger) : Module(prmBus)
30 {
31  logger = prmLogger;
32 }
33 
34 void Gpws::FrameMove(float fElapsed)
35 {
36  if (ourcockpit.gndvehicle) return;
37 
38  if (ourcockpit.power < 0.5f) return;
39 
40  if (g_bAboveClouds)
41  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::NoAlert;
42  else
43  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Reset;
44 
45  secsincelast += fElapsed;
46 
47  // Mode 1 - Excessive barometric descent rate
48  if (bus->RadioAltitudeKm >= 0.009f && bus->RadioAltitudeKm <= 0.746f) // 30' to 2450'
49  {
50  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode1_Pull_Up &&
51  ((-bus->VerticalSpeedKms >= 0.009f && bus->RadioAltitudeKm < 0.082f) ||
52  (bus->RadioAltitudeKm >= 0.082f && -bus->VerticalSpeedKms > ((bus->RadioAltitudeKm - 0.082f)*0.04367f + 0.009f))))
53  {
54  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode1_Pull_Up;
55  }
56  else if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode1_Sink_Rate &&
57  (bus->RadioAltitudeKm >= 0.009f && -bus->VerticalSpeedKms > ((bus->RadioAltitudeKm - 0.009f)*0.02306f + 0.008f)))
58  {
59  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode1_Sink_Rate;
60  }
61  }
62 
63  // Mode 2A - Excessive terrain closure rate (not landing)
64  if (bus->RadioAltitudeKm <= 0.609f && !playerships[0].geardown) // 2000'
65  {
66  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode2a_Pull_Up &&
67  (-groundclose > (bus->RadioAltitudeKm*0.020997f + 0.011f) ||
68  (-groundclose > 0.019f && bus->RadioAltitudeKm < 0.381f)))
69  {
70  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode2a_Pull_Up;
71  }
72  else if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode2a_Terrain_Terrain &&
73  (-groundclose > (bus->RadioAltitudeKm*0.020997f + 0.010f) ||
74  (bus->RadioAltitudeKm >= 0.381f && -groundclose > ((bus->RadioAltitudeKm - 0.381f)*0.144408f + 0.018f))))
75  {
76  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode2a_Terrain_Terrain;
77  }
78  }
79 
80  // Mode 2B - Excessive terrain closure rate (landing config)
81  if (bus->RadioAltitudeKm >= 0.061f && bus->RadioAltitudeKm < 0.241f && playerships[0].geardown) // 200' to 790'
82  {
83  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode2b_Pull_Up &&
84  (-groundclose > ((bus->RadioAltitudeKm - 0.061f) / 0.12184f*0.002538f + 0.01523f) || // front side of pull up envelope
85  (-groundclose > 0.017768f && -groundclose < ((bus->RadioAltitudeKm - 0.061f) / 0.12184f*0.03046f + 0.017768f)))) // backside of pull up envelope
86  {
87  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode2b_Pull_Up;
88  }
89  else if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode2b_Terrain_Terrain &&
90  (-groundclose > ((bus->RadioAltitudeKm - 0.061f) / 0.18f*0.002538f + 0.012692f) || // front side of terrain terrain envelope
91  (-groundclose > 0.01523f && -groundclose < ((bus->RadioAltitudeKm - 0.118793f) / 0.12184f*0.035537f + 0.01523f)))) // backside of terrain terrain envelope
92  {
93  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode2b_Terrain_Terrain;
94  }
95  }
96 
97  /* Mode 3 provides alerts for significant altitude loss after takeoff or low altitude go-around (less than 245* feet AGL) with gear or flaps not in the landing configuration.
98  * The amount of altitude loss that is permitted before an alert is given is a function of the height of the aircraft above the terrain as shown below.
99  * This protection is available until the EGPWS determines that the aircraft has gained sufficient altitude that it is no longer in the takeoff phase of flight.
100  * Significant altitude loss after takeoff or during a low altitude go-around activates the EGPWS caution lights and the aural message “DON’T SINK, DON’T SINK”.
101  */
102  if (oldradioaltitude < 0.04572f && bus->RadioAltitudeKm >= 0.04572f) // climbing through 150'
103  mode3active = true;
104  else if (bus->RadioAltitudeKm > 0.4572f || bus->RadioAltitudeKm < 0.04572f) // outside of envelope, turn off
105  mode3active = false;
106  if (mode3active)
107  {
108  if (bus->RadioAltitudeKm > oldradioaltitude) // climbing
109  mode3altitude = bus->RadioAltitudeKm; // 300'
110  else if ((bus->RadioAltitudeKm - mode3altitude) < (0.003f * bus->RadioAltitudeKm - 0.008f) && // 200 - 300 equals -100!
111  bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode3_Dont_Sink)
112  {
113  // say we lost 50 feet (0.015 m) from 400 feet (0.122m) after activating
114  // so we are 0.107m and last climb was 0.122m ... so left side is -0.015m ... we are allowed to lose -0.007679 at that altitude
115  // so at 0.04572 i shan't be able to descend more than 0.0051054km ...
116  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode3_Dont_Sink;
117  }
118  }
119 
120  // Mode 4A - Unsafe terrain clearance with the gear UP
121  // AND DESCENDING @ref https://jira.risetvp.com/view.php?id=457
122  if (bus->RadioAltitudeKm < 0.304599f && !playerships[0].geardown && bus->VerticalSpeedKms <= 0.0f && playerships[0].reference != Reference::REF_ONGROUND)
123  {
124  // above 190 kts, scaled from 500' to 1000' to 250 kts, capped at 1000' above 250 kts
125  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Terrain && bus->IndicatedAirspeedKms > 0.0977837f && bus->RadioAltitudeKm < max(4.937376f * bus->IndicatedAirspeedKms - 0.3302008f, 0.304599f))
126  {
127  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Terrain;
128  }
129  // at or below 190 kts and below 500'
130  else if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Gear && bus->IndicatedAirspeedKms <= 0.0977837f && bus->RadioAltitudeKm < 0.1523f)
131  {
132  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Gear;
133  }
134  }
135 
136  // Mode 4B - Unsafe terrain clearance with the gear DOWN but the flaps are not in the landing configuration
137  // AND DESCENDING @ref https://jira.risetvp.com/view.php?id=457
138  if (bus->RadioAltitudeKm < 0.304599f && playerships[0].geardown && bus->VerticalSpeedKms <= 0.0f && !ourcockpit.flapSettings.empty() && bus->TrailingEdgeFlapsPosition < 20.0f && playerships[0].reference != Reference::REF_ONGROUND)
139  {
140  // above 159 kts, scaled from 245' to 1000' to 250 kts, capped at 1000' above 250 kts
141  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Terrain && bus->IndicatedAirspeedKms > 0.0817967f && bus->RadioAltitudeKm < max(4.915677f * bus->IndicatedAirspeedKms - 0.3274102f, 0.304599f))
142  {
143  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Terrain;
144  }
145  // at or below 159 kts and below 245'
146  else if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Flaps && bus->IndicatedAirspeedKms <= 0.0817967f && bus->RadioAltitudeKm < 0.074676f)
147  {
148  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Flaps;
149  }
150  }
151 
153  /* Mode 4C is based on an EGPWS computed Minimum Terrain Clearance (MTC) floor that increases with Radio Altitude.
154  * It is active after takeoff when the gear or flaps are not in the landing configuration.
155  * It is also active during a low altitude go-around if the aircraft has descended below 245 feet AGL (or 150 feet depending on aircraft type).
156  * At takeoff the Minimum Terrain Clearance (MTC) is zero feet. As the aircraft ascends the MTC is increased to 75% of the aircraft’s Radio Altitude (averaged over the previous 15 seconds).
157  * This value is not allowed to decrease and is limited to 500 feet AGL for airspeed less than 190 knots.
158  * Beginning at 190 knots, the MTC increases linearly to the limit of 1000 feet at 250 knots.
159  * If the aircraft’s Radio Altitude decreases to the value of the MTC, the EGPWS caution illuminates and the aural message “TOO LOW TERRAIN” is enunciated.
160  * EGPWS caution lights extinguish and aural messages cease when the Mode 4C alert envelope is exited.
161  * If the Aural Declutter feature is disabled, mode 4C alert messages are repeated continuously until the Mode 4C envelope is exited.
162  */
163 
164 
165  // Mode 5a soft single glideslope below 1000' RA and 1.3 dots or more BELOW the beam... each additional 20% causes a new aural warning
167  if (bus->RadioAltitudeKm < 0.3048f && bus->GlideslopeDeviationRadians <= D3DXToRadian(-1.3f * 0.35f)) // 1.3 dots , 1 dot I think is .35 degrees which is half-scale
168  {
169  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode5a_Glideslope)
170  {
171  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode5a_Glideslope;
172  }
173  }
174  // Mode 5b hard repeat glideslope below 300' RA and 2 dots or greater deviation until less than 1.3 dots
175  if (bus->RadioAltitudeKm < 0.09144f && fabsf(bus->GlideslopeDeviationRadians) >= D3DXToRadian(2.0f * 0.35f))
176  {
177  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode5b_Glideslope)
178  {
179  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode5b_Glideslope;
180  }
181  }
182 
183 
184  // Mode 6 - Bank Angle
185  if (bus->RadioAltitudeKm > 0.00913798f && bus->RadioAltitudeKm < 0.761499f) // 30' to 2500'
186  {
187  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Bank_Angle && // alt-30' divided by 120' times 30° plus 10°
188  (bus->RadioAltitudeKm<0.0456899f && fabsf(bus->RollAttitudeRadians)>((bus->RadioAltitudeKm - 0.00913798f) / 0.0365519f*0.523599f + 0.174532925f) ||
189  bus->RadioAltitudeKm > 0.0456899f && fabsf(bus->RollAttitudeRadians) > ((bus->RadioAltitudeKm - 0.0456899f) / 0.715809f*0.261799f + 0.6981317f) ||
190  fabsf(bus->PitchAttitudeRadians) > D3DX_HALFPI)) // 90° is upside-down
191  {
192  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Bank_Angle;
193  }
194  }
195 
196  // Mode 6 - Altitudes
197  if (bus->RadioAltitudeKm < oldradioaltitude) // descending only
198  {
199  if (oldradioaltitude >= 0.003048f && bus->RadioAltitudeKm < 0.003048f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Ten)
200  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Ten;
201  else if (oldradioaltitude >= 0.006096f && bus->RadioAltitudeKm < 0.006096f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Twenty)
202  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Twenty;
203  else if (oldradioaltitude >= 0.009144f && bus->RadioAltitudeKm < 0.009144f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Thirty)
204  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Thirty;
205  else if (oldradioaltitude >= 0.012192f && bus->RadioAltitudeKm < 0.012192f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Forty)
206  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Forty;
207  else if (oldradioaltitude >= 0.01524f && bus->RadioAltitudeKm < 0.01524f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Fifty)
208  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Fifty;
209  else if (oldradioaltitude >= 0.03048f && bus->RadioAltitudeKm < 0.03048f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_One_Hundred)
210  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_One_Hundred;
211  else if (oldradioaltitude >= 0.06096f && bus->RadioAltitudeKm < 0.06096f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Two_Hundred)
212  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Two_Hundred;
213  else if (oldradioaltitude >= 0.1524f && bus->RadioAltitudeKm < 0.1524f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Five_Hundred)
214  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Five_Hundred;
215  else if (oldradioaltitude >= 0.3048f && bus->RadioAltitudeKm < 0.3048f && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_One_Thousand)
216  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_One_Thousand;
217 
218  // Retard
219  if (bus->RadioAltitudeKm < 0.01524f && bus->IndicatedAirspeedKms > ourcockpit.Vs1 && bus->VerticalSpeedKms <= 0.0f &&
220  (bus->EngineThrustLever[0] > 0.1f || bus->EngineThrustLever[1] > 0.1f || bus->EngineThrustLever[2] > 0.1f) &&
221  playerships[0].reference != REF_ONGROUND && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Retard)
222  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Retard;
223 
224  // Minimums, minimums
226  if (oldradioaltitude >= 0.06096f && bus->RadioAltitudeKm < 0.06096f && playerships[0].reference != REF_ONGROUND && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Minimums_Minimums)
227  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Minimums_Minimums;
228  }
229 
231 
232  if (ourcockpit.wheeled && oldIndicatedAirspeedKms < ourcockpit.Vr && bus->IndicatedAirspeedKms >= ourcockpit.Vr && playerships[0].reference == Reference::REF_ONGROUND)
233  {
234  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Rotate)
235  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Rotate;
236  }
238 
239  // Mode 6 Pilot Monitoring
240  if (oldReference == REF_ONGROUND && playerships[0].reference != REF_ONGROUND)
241  {
242  if (bus->VerticalSpeedKms >= 0.002f)
243  {
244  oldReference = static_cast<Reference>(playerships[0].reference);
245  if (bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode6_Positive_Rate)
246  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode6_Positive_Rate;
247  }
248  }
249  else
250  oldReference = static_cast<Reference>(playerships[0].reference);
251 
252 
253  // Mode 7 Windshear
254  // Detects windshear from inputs including air data, temperature, rate of climb or descent, angle of attack, radio height, vertical & longitudinal acceleration
255  if (bus->RadioAltitudeKm < 0.4572f && playerships[0].reference != Reference::REF_ONGROUND) // 1500'
256  {
257  const float knotsPerSecond = (bus->WindSpeedMs - oldWindSpeedMs) * 1.94384f;
258  const float UpdraftFpm = bus->WindUpdraftMs * 196.85f;
259  if (UpdraftFpm < (-750.0f * knotsPerSecond - 1750.0f) && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode7_Windshear_Warning)
260  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode7_Windshear_Warning;
261  else if (UpdraftFpm > (-750.0f * knotsPerSecond + 1750) && bus->GPWS.Alert > Bus::Gpws::GpwsEnum::Mode7_Windshear_Caution)
262  bus->GPWS.Alert = Bus::Gpws::GpwsEnum::Mode7_Windshear_Caution;
263  }
265 
266 
267 
269 
270  Command newCommand;
271  switch (bus->GPWS.Alert)
272  {
273  case Bus::Gpws::GpwsEnum::Mode5a_Glideslope:
274  case Bus::Gpws::GpwsEnum::Mode5b_Glideslope:
275  if (secsincelast >= 2.0f)
276  {
277  newCommand.name = "GPWSGlideslope";
278  bus->commandStream.emplace_back(newCommand);
279  secsincelast = 0.0f;
280  }
281  break;
282  case Bus::Gpws::GpwsEnum::Mode1_Pull_Up:
283  case Bus::Gpws::GpwsEnum::Mode2a_Pull_Up:
284  case Bus::Gpws::GpwsEnum::Mode2b_Pull_Up:
285  if (secsincelast >= 2.0f)
286  {
287  newCommand.name = "GPWSPullUp";
288  bus->commandStream.emplace_back(newCommand);
289  secsincelast = 0.0f;
290  }
291  break;
292  case Bus::Gpws::GpwsEnum::Mode2a_Terrain_Terrain:
293  case Bus::Gpws::GpwsEnum::Mode2b_Terrain_Terrain:
294  if (secsincelast >= 4.0f)
295  {
296  newCommand.name = "GPWSTerrainTerrain";
297  bus->commandStream.emplace_back(newCommand);
298  secsincelast = 0.0f;
299  }
300  break;
301  case Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Terrain:
302  case Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Terrain:
303  case Bus::Gpws::GpwsEnum::Mode4c_Too_Low_Terrain:
304  if (secsincelast >= 4.0f)
305  {
306  newCommand.name = "GPWSTooLowTerrain";
307  bus->commandStream.emplace_back(newCommand);
308  secsincelast = 0.0f;
309  }
310  break;
311  case Bus::Gpws::GpwsEnum::Mode4a_Too_Low_Gear:
312  if (secsincelast >= 2.0f)
313  {
314  newCommand.name = "GPWSTooLowGear";
315  bus->commandStream.emplace_back(newCommand);
316  secsincelast = 0.0f;
317  }
318  break;
319  case Bus::Gpws::GpwsEnum::Mode4b_Too_Low_Flaps:
320  if (secsincelast >= 2.0f)
321  {
322  newCommand.name = "GPWSTooLowFlaps";
323  bus->commandStream.emplace_back(newCommand);
324  secsincelast = 0.0f;
325  }
326  break;
327  case Bus::Gpws::GpwsEnum::Mode1_Sink_Rate:
328  if (secsincelast >= 2.0f)
329  {
330  newCommand.name = "GPWSSinkRate";
331  bus->commandStream.emplace_back(newCommand);
332  secsincelast = 0.0f;
333  }
334  break;
336  if (secsincelast >= 2.0f)
337  {
338  newCommand.name = "GPWSBankAngle";
339  bus->commandStream.emplace_back(newCommand);
340  secsincelast = 0.0f;
341  }
342  break;
343  case Bus::Gpws::GpwsEnum::Mode6_Retard:
344  if (secsincelast >= 1.0f)
345  {
346  newCommand.name = "GPWSMode6Retard";
347  bus->commandStream.emplace_back(newCommand);
348  secsincelast = 0.0f;
349  }
350  break;
351  case Bus::Gpws::GpwsEnum::Mode6_Ten:
352  if (secsincelast >= 0.431f)
353  {
354  newCommand.name = "GPWSMode6Ten";
355  newCommand.ttl = 0.339f;
356  bus->commandStream.emplace_back(newCommand);
357  secsincelast = 0.0f;
358  }
359  break;
360  case Bus::Gpws::GpwsEnum::Mode6_Twenty:
361  if (secsincelast >= 0.449f)
362  {
363  newCommand.name = "GPWSMode6Twenty";
364  newCommand.ttl = 0.431f;
365  bus->commandStream.emplace_back(newCommand);
366  secsincelast = 0.0f;
367  }
368  break;
369  case Bus::Gpws::GpwsEnum::Mode6_Thirty:
370  if (secsincelast >= 0.473f)
371  {
372  newCommand.name = "GPWSMode6Thirty";
373  newCommand.ttl = 0.449f;
374  bus->commandStream.emplace_back(newCommand);
375  secsincelast = 0.0f;
376  }
377  break;
378  case Bus::Gpws::GpwsEnum::Mode6_Forty:
379  if (secsincelast >= 0.443f)
380  {
381  newCommand.name = "GPWSMode6Forty";
382  newCommand.ttl = 0.473f;
383  bus->commandStream.emplace_back(newCommand);
384  secsincelast = 0.0f;
385  }
386  break;
387  case Bus::Gpws::GpwsEnum::Mode6_Fifty:
388  newCommand.name = "GPWSMode6Fifty";
389  newCommand.ttl = 0.443f;
390  bus->commandStream.emplace_back(newCommand);
391  secsincelast = 0.0f;
392  break;
393  case Bus::Gpws::GpwsEnum::Mode6_One_Hundred:
394  newCommand.name = "GPWSMode6OneHundred";
395  bus->commandStream.emplace_back(newCommand);
396  secsincelast = 0.0f;
397  break;
398  case Bus::Gpws::GpwsEnum::Mode6_Two_Hundred:
399  newCommand.name = "GPWSMode6TwoHundred";
400  bus->commandStream.emplace_back(newCommand);
401  secsincelast = 0.0f;
402  break;
403  case Bus::Gpws::GpwsEnum::Mode6_Minimums_Minimums:
404  newCommand.name = "GPWSMode6Minimums";
405  bus->commandStream.emplace_back(newCommand);
406  secsincelast = 0.0f;
407  break;
408  case Bus::Gpws::GpwsEnum::Mode6_Positive_Rate:
409  newCommand.name = "GPWSMode6PositiveRate";
410  bus->commandStream.emplace_back(newCommand);
411  secsincelast = 0.0f;
412  break;
413  case Bus::Gpws::GpwsEnum::Mode6_Five_Hundred:
414  newCommand.name = "GPWSMode6FiveHundred";
415  bus->commandStream.emplace_back(newCommand);
416  secsincelast = 0.0f;
417  break;
418  case Bus::Gpws::GpwsEnum::Mode6_One_Thousand:
419  newCommand.name = "GPWSMode6OneThousand";
420  bus->commandStream.emplace_back(newCommand);
421  secsincelast = 0.0f;
422  break;
423  case Bus::Gpws::GpwsEnum::Mode6_Rotate:
424  newCommand.name = "GPWSMode6Rotate";
425  bus->commandStream.emplace_back(newCommand);
426  secsincelast = 0.0f;
427  break;
428  case Bus::Gpws::GpwsEnum::Mode3_Dont_Sink:
429  if (secsincelast >= 4.0f)
430  {
431  newCommand.name = "GPWSMode3DontSink";
432  bus->commandStream.emplace_back(newCommand);
433  secsincelast = 0.0f;
434  }
435  break;
436  case Bus::Gpws::GpwsEnum::Mode7_Windshear_Warning:
437  if (secsincelast >= 4.0f)
438  {
439  newCommand.name = "GPWSMode7WindshearWarning";
440  bus->commandStream.emplace_back(newCommand);
441  secsincelast = 0.0f;
442  }
443  break;
444  case Bus::Gpws::GpwsEnum::Mode7_Windshear_Caution:
445  if (secsincelast >= 4.0f)
446  {
447  newCommand.name = "GPWSMode7WindshearCaution";
448  bus->commandStream.emplace_back(newCommand);
449  secsincelast = 0.0f;
450  }
451  break;
452  }
453 }
Scockpit ourcockpit
Definition: globals.cpp:176
float power
Definition: globals.h:608
enum Bus::Gpws::GpwsEnum Alert
bool g_bAboveClouds
Definition: globals.cpp:22
std::vector< Command > commandStream
Definition: Bus.h:342
float oldradioaltitude
Definition: Module.h:41
std::vector< int > flapSettings
Definition: globals.h:656
Definition: Logger.h:9
bool wheeled
Definition: globals.h:605
float groundclose
Definition: globals.cpp:39
s_network_objects playerships[MAX_SCAN]
Definition: globals.cpp:174
float RadioAltitudeKm
Definition: Bus.h:134
float VerticalSpeedKms
Definition: Bus.h:351
float RollAttitudeRadians
Definition: Bus.h:37
float Vs1
Definition: globals.h:636
void FrameMove(float fElapsedTime) override
Definition: GPWS.cpp:34
float secsincelast
Definition: Module.h:40
Gpws(Bus *prmBus, Logger *prmLogger)
Definition: GPWS.cpp:29
float GlideslopeDeviationRadians
Definition: Bus.h:136
Definition: Bus.h:16
std::string name
Definition: Command.h:11
bool mode3active
Definition: Module.h:42
float ttl
Definition: Command.h:17
float IndicatedAirspeedKms
Definition: Bus.h:27
float oldWindSpeedMs
Definition: Module.h:46
float WindUpdraftMs
Definition: Bus.h:231
float WindSpeedMs
Definition: Bus.h:230
Reference oldReference
Definition: Module.h:44
Definition: Module.h:12
struct Bus::Gpws GPWS
Definition: Command.h:5
float mode3altitude
Definition: Module.h:43
float TrailingEdgeFlapsPosition
Definition: Bus.h:324
Bus * bus
Definition: Module.h:17
float oldIndicatedAirspeedKms
Definition: Module.h:45
Logger * logger
Definition: Module.h:38
float Vr
Definition: globals.h:636
bool gndvehicle
Definition: globals.h:604
float PitchAttitudeRadians
Definition: Bus.h:36
float EngineThrustLever[MAX_ENGINES]
Definition: Bus.h:264