Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
GpwsPredictiveWindshear.cpp
Go to the documentation of this file.
1
#include "
Module.h
"
2
#include "
GpwsWindshearSource.h
"
3
#include "
../Viewscreen/Viewscreen.h
"
4
#include "
../Viewscreen/grid.h
"
5
#include "
../Viewscreen/weather.h
"
6
7
void
Gpws::UpdatePredictiveWindshear
(
float
seconds)
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;
14
in.
maxFrameSeconds
=
maxFrameSeconds
;
15
in.
enabled
=
ourcockpit
.
weatherRadarEquipped
&&
ourcockpit
.
weatherRadarPower
&&
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
&&
21
viewscreen
->
ptrGrid
->
dataReady
?
viewscreen
->
ptrWeather
->
RadarWeatherData
() :
nullptr
;
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
});
33
},
bus
->
GPWS
.
predictiveWindshear
);
34
}
GpwsWindshearSource.h
Module.h
REF_ACLMODE
@ REF_ACLMODE
Definition
ServerTypes.h:44
REF_APNMODE
@ REF_APNMODE
Definition
ServerTypes.h:42
Viewscreen.h
Bus::GPWS
struct Bus::Gpws GPWS
Bus::RadioAltitudeKm
float RadioAltitudeKm
Definition
Bus.h:157
Gpws::predictiveWindshear
GpwsPredictiveWindshear::Detector predictiveWindshear
Definition
Module.h:66
Gpws::UpdatePredictiveWindshear
void UpdatePredictiveWindshear(float seconds)
Definition
GpwsPredictiveWindshear.cpp:7
Gpws::viewscreen
Viewscreen * viewscreen
Definition
Module.h:45
GpwsPredictiveWindshear::Detector::Update
void Update(const Input &in, double elapsed, Sampler sample, State &out)
Definition
GpwsPredictiveWindshear.h:44
Module::bus
Bus * bus
Definition
Module.h:21
Module::maxFrameSeconds
float maxFrameSeconds
Definition
Module.h:30
Viewscreen::ptrWeather
std::unique_ptr< weather > ptrWeather
Definition
Viewscreen.h:434
Viewscreen::ptrGrid
std::unique_ptr< grid > ptrGrid
Definition
Viewscreen.h:426
grid::InterpolateElevation
bool InterpolateElevation(char face, double u, double v, float &meters) const
Definition
grid.cpp:167
grid::dataReady
bool dataReady
Definition
grid.h:36
weather::RadarWeatherData
const PlotWeather::Store * RadarWeatherData() const
Definition
weather.h:161
playerships
s_network_objects playerships[MAX_SCAN]
Definition
globals.cpp:112
ourcockpit
Scockpit ourcockpit
Definition
globals.cpp:114
radiusC
#define radiusC
Definition
globals.h:87
grid.h
GpwsPredictiveWindshear
Definition
GpwsPredictiveWindshear.h:9
GpwsPredictiveWindshear::SampleGrid
Sample SampleGrid(const PlotWeather::Store &source, Vector3 position, Elevation elevation)
Definition
GpwsWindshearSource.h:7
Bus::Gpws::inhibited
bool inhibited
Definition
Bus.h:250
Bus::Gpws::faults
unsigned faults
Definition
Bus.h:259
Bus::Gpws::predictiveWindshear
GpwsPredictiveWindshear::State predictiveWindshear
Definition
Bus.h:265
Bus::Gpws::testLevel
int testLevel
Definition
Bus.h:260
GpwsPredictiveWindshear::Input
Definition
GpwsPredictiveWindshear.h:24
GpwsPredictiveWindshear::Input::groundVelocityKms
Vector3 groundVelocityKms
Definition
GpwsPredictiveWindshear.h:25
GpwsPredictiveWindshear::Input::generation
uint64_t generation
Definition
GpwsPredictiveWindshear.h:29
GpwsPredictiveWindshear::Input::vehicle
int vehicle
Definition
GpwsPredictiveWindshear.h:28
GpwsPredictiveWindshear::Input::maxFrameSeconds
double maxFrameSeconds
Definition
GpwsPredictiveWindshear.h:26
GpwsPredictiveWindshear::Input::revision
uint32_t revision
Definition
GpwsPredictiveWindshear.h:30
GpwsPredictiveWindshear::Input::enabled
bool enabled
Definition
GpwsPredictiveWindshear.h:27
GpwsPredictiveWindshear::Input::position
Vector3 position
Definition
GpwsPredictiveWindshear.h:25
GpwsPredictiveWindshear::Input::radiusKm
double radiusKm
Definition
GpwsPredictiveWindshear.h:26
GpwsPredictiveWindshear::Input::dataAvailable
bool dataAvailable
Definition
GpwsPredictiveWindshear.h:27
GpwsPredictiveWindshear::Input::radioKm
double radioKm
Definition
GpwsPredictiveWindshear.h:26
GpwsPredictiveWindshear::Sample
Definition
GpwsPredictiveWindshear.h:22
Scockpit::power
float power
Definition
globals.h:599
Scockpit::weatherRadarEquipped
bool weatherRadarEquipped
Definition
globals.h:669
Scockpit::weatherRadarPower
bool weatherRadarPower
Definition
globals.h:597
weather.h
Modules
GpwsPredictiveWindshear.cpp
Generated on
for Rise by
1.18.0