Naved Maududi
/
DebugMonitor_revised
Diff: Calculate_flow.cpp
- Revision:
- 2:64a34ae90bb1
- Parent:
- 1:9fa7cc80f1a7
diff -r 9fa7cc80f1a7 -r 64a34ae90bb1 Calculate_flow.cpp --- a/Calculate_flow.cpp Fri Oct 04 22:03:30 2019 +0000 +++ b/Calculate_flow.cpp Sat Oct 05 21:17:17 2019 +0000 @@ -34,7 +34,7 @@ #include "shared.h" -//#include <math.h> +#include <math.h> #define BLUFF_BODY_INCHES (0.5) #define BLUFF_BODY_METERS (0.0127) @@ -86,20 +86,15 @@ float density = 0; float viscosity = 0; - while (velocity_dif > 0.01) + while (velocity_dif > 0.01 && !isnan(velocity_dif)) { velocity_prev = velocity; viscosity = calculateViscosity(temperature); - //printf("viscosity: %f\r\n", viscosity); density = calculateDensity(temperature); - //printf("density: %f\r\n", density); reynoldsNumber = calculateReynoldsNumber(density, viscosity, velocity_prev); - //printf("reynoldsNumber: %f\r\n", reynoldsNumber); strouhalNumber = calculateStrouhalNumber(reynoldsNumber); - //printf("strouhalNumber: %f\r\n", strouhalNumber); velocity = calculateVelocity(freq_value, strouhalNumber); velocity_dif = fabs((velocity - velocity_prev)/(velocity + velocity_prev)); - //printf("velocity: %f\r\n", velocity); } flow = (2.45 * PID_INCHES_SQUARED * velocity);