diff --git a/lib/obp60task/OBPDataOperations.cpp b/lib/obp60task/OBPDataOperations.cpp index 1d84a70..887a3ae 100644 --- a/lib/obp60task/OBPDataOperations.cpp +++ b/lib/obp60task/OBPDataOperations.cpp @@ -532,24 +532,18 @@ bool WindUtils::handleWinds(bool calcWinds) return false; } - // calculate AWD if not existing and if possible + // calculate AWD if it does not exist yet and AWA is available if (!awdBVal->valid) { if (calcWD(&awaVal, &hdtVal, &awd)) { awdBVal->value = awd; awdBVal->valid = true; } else { awdBVal->valid = false; - return false; } } - if (!calcWinds) { // don't calculate true winds if not set in configuration - return twCalculated; - } - - // calculate TWD if not existing and if possible + // calculate TWD if it does not exist yet and TWA is available if (!twdBVal->valid) { - // calculate TWD if it does not exist yet and TWA is available if (calcWD(&twaVal, &hdtVal, &twd)) { twdBVal->value = twd; twdBVal->valid = true; @@ -558,6 +552,10 @@ bool WindUtils::handleWinds(bool calcWinds) } } + if (!calcWinds) { // don't calculate true winds from apparent winds if not set in configuration + return twCalculated; + } + if (!twaBVal->valid || !twsBVal->valid || !twdBVal->valid) { // calculate true winds at least one of three true wind values does not exist twCalculated = calcTrueWinds(&awaVal, &awsVal, &awd, &cogVal, &stwVal, &sogVal, &hdtVal, &twa, &tws, &twd); @@ -576,8 +574,6 @@ bool WindUtils::handleWinds(bool calcWinds) } } } - // LOG_DEBUG(GwLog::DEBUG, "WindUtils:handleWinds: twCalculated %d, TWD %.1f, TWA %.1f, TWS %.2f kn, AWD: %.1f", twCalculated, twdBVal->value * RAD_TO_DEG, - // twaBVal->value * RAD_TO_DEG, twsBVal->value * 3.6 / 1.852, awdBVal->value * RAD_TO_DEG); return twCalculated; } diff --git a/lib/obp60task/OBPDataOperations.h b/lib/obp60task/OBPDataOperations.h index 558a03b..37c6faa 100644 --- a/lib/obp60task/OBPDataOperations.h +++ b/lib/obp60task/OBPDataOperations.h @@ -138,6 +138,7 @@ public: static double toPI(double a); static double to360(double a); static double to180(double a); + void toCart(const double* phi, const double* r, double* x, double* y); void toPol(const double* x, const double* y, double* phi, double* r); void addPolar(const double* phi1, const double* r1,