Skip to content
Snippets Groups Projects
Commit 5690377e authored by Federico Mandelli's avatar Federico Mandelli Committed by Matteo Pignataro
Browse files

[Pitot] Velocity is now 0 if totalPressure is greater then staticPressure

parent 9e9c140f
Branches
No related tags found
No related merge requests found
......@@ -59,15 +59,23 @@ public:
{
float totalPressure = getTotalPressure();
float staticPressure = getStaticPressure();
PitotData pitotSpeed;
if (totalPressure > staticPressure)
{
// clang-format off
float gamma = 1.4f;
float c = sqrt(gamma * Constants::R * reference.refTemperature);
// clang-format off
float M = sqrt(((pow(totalPressure / staticPressure, (gamma - 1) / gamma)) - 1) * (2 / (gamma - 1)));
// clang-format on
PitotData pitotSpeed;
pitotSpeed.airspeed = M * c;
pitotSpeed.deltaP = totalPressure - staticPressure;
}
else
{
pitotSpeed.airspeed = 0;
pitotSpeed.deltaP = 0;
}
pitotSpeed.timestamp = TimestampTimer::getTimestamp();
return pitotSpeed;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment