Rise
The Vieneo Province
Loading...
Searching...
No Matches
GpwsPredictiveWindshear.cpp
Go to the documentation of this file.
1#include "Module.h"
6
8{
9 using namespace GpwsPredictiveWindshear;
10 const auto& ship = playerships[0];
11 Input in;
12 in.position = ship.position; in.groundVelocityKms = ship.velocity-ship.barycentric;
13 in.radiusKm = radiusC; in.radioKm = bus->RadioAltitudeKm; in.vehicle = ship.vehicleId;
16 std::isfinite(ourcockpit.power) && ourcockpit.power >= .5f && !ship.isSimulator && !ship.groundvehicle &&
17 (ship.reference == REF_APNMODE || ship.reference == REF_ACLMODE) &&
18 !bus->GPWS.inhibited && !bus->GPWS.testLevel && !(bus->GPWS.faults&7) &&
19 std::isfinite(ship.mslKm) && ship.mslKm != -1;
20 const auto* source = viewscreen && viewscreen->ptrWeather && viewscreen->ptrGrid &&
22 if (source)
23 {
24 const auto& header = source->Header();
25 in.dataAvailable = true; in.generation = (uint64_t(header.requestToken)<<8)|header.cube;
26 in.revision = header.revision;
27 }
28 predictiveWindshear.Update(in,seconds,[&](Vector3 position) {
29 if (!source) return Sample{};
30 return SampleGrid(*source,position,[&](unsigned face,double u,double v,float& meters) {
31 return viewscreen->ptrGrid->InterpolateElevation(char(face),u,v,meters);
32 });
34}
@ REF_ACLMODE
Definition ServerTypes.h:44
@ REF_APNMODE
Definition ServerTypes.h:42
struct Bus::Gpws GPWS
float RadioAltitudeKm
Definition Bus.h:157
GpwsPredictiveWindshear::Detector predictiveWindshear
Definition Module.h:66
void UpdatePredictiveWindshear(float seconds)
Viewscreen * viewscreen
Definition Module.h:45
void Update(const Input &in, double elapsed, Sampler sample, State &out)
Bus * bus
Definition Module.h:21
float maxFrameSeconds
Definition Module.h:30
std::unique_ptr< weather > ptrWeather
Definition Viewscreen.h:434
std::unique_ptr< grid > ptrGrid
Definition Viewscreen.h:426
bool InterpolateElevation(char face, double u, double v, float &meters) const
Definition grid.cpp:167
bool dataReady
Definition grid.h:36
const PlotWeather::Store * RadarWeatherData() const
Definition weather.h:161
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
Scockpit ourcockpit
Definition globals.cpp:114
#define radiusC
Definition globals.h:87
Sample SampleGrid(const PlotWeather::Store &source, Vector3 position, Elevation elevation)
bool inhibited
Definition Bus.h:250
unsigned faults
Definition Bus.h:259
GpwsPredictiveWindshear::State predictiveWindshear
Definition Bus.h:265
int testLevel
Definition Bus.h:260
float power
Definition globals.h:599
bool weatherRadarEquipped
Definition globals.h:669
bool weatherRadarPower
Definition globals.h:597