Implement MaxTWS for OBP true wind calculation

This commit is contained in:
Ulrich Meine
2026-06-19 00:00:08 +02:00
parent 8f50c6a09c
commit c17f8238a4
3 changed files with 28 additions and 9 deletions
+7 -5
View File
@@ -68,7 +68,6 @@ private:
// [10000: 0 - 6.5535 | 1000: 0 - 65.535 | 100: 0 - 655.35 | 10: 0 - 6553.5 | 1: 0 - 65535 | 0.1: 0 - 655350]
double bufferMinVal; // minimum valid data value
double bufferMaxVal; // maximum valid data value
//String format; // format of data type
};
std::map<String, HistoryParams> bufferParams = {
@@ -91,14 +90,13 @@ private:
{ "WTemp", { 1000, 100, 263.0, 403.0 } }, // water temp [-10..130] °C
{ "formatXdr:C:K", { 1000, 100, 223.0, 473.15 } }, // temperature [-50..200] deg celsius
{ "formatXdr:P:B", { 1000, 1000, 0, 65.0 } }, // pressure [0..65] bar
{ "formatXdr:P:P", { 60000, 0.1, 0, 650000 } }, // pressure [0..6500] hPa
{ "formatXdr:P:P", { 5000, 0.1, 0, 650000 } }, // pressure [0..6500] hPa
{ "formatXdr:H:P", { 1000, 100, 0, 100 } }, // humidity [0..100] percent
{ "formatXdr:I:A", { 1000, 100, 0, 650.0 } }, // current [0..650] amperes
{ "formatXdr:U:V", { 1000, 1000, 0, 65.0 } }, // voltage [0..65] volts
{ "formatXdr:T:R", { 1000, 1, 0, 65000 } }, // tachometer [0..65000] rpm
{ "formatXdr:T:R", { 1000, 1, 0, 30000 } }, // tachometer [0..30000] rpm
{ "formatXdr:V:L", { 10000, 100, 0, 650 } }, // volume [0..650] litres
{ "formatXdr:V:M", { 10000, 10000, 0, 6.50 } }, // volume [0..6.5] m^3
{ "formatXdr:G:M", { 3000, 0.1, 0, 650000 } } // generic -> (pressure) [0..6500] hPa
};
public:
@@ -110,9 +108,10 @@ public:
class WindUtils {
private:
GwApi::BoatValue *twaBVal, *twsBVal, *twdBVal;
GwApi::BoatValue *twaBVal, *twsBVal, *twdBVal, *maxtwsBVal;
GwApi::BoatValue *awaBVal, *awsBVal, *awdBVal;
GwApi::BoatValue *cogBVal, *stwBVal, *sogBVal, *hdtBVal, *hdmBVal, *varBVal;
double twd, tws, twa, awd;
static constexpr double DBL_MAX = std::numeric_limits<double>::max();
GwLog* logger;
@@ -122,6 +121,7 @@ public:
{
twaBVal = boatValues->findValueOrCreate("TWA");
twsBVal = boatValues->findValueOrCreate("TWS");
maxtwsBVal = boatValues->findValueOrCreate("MaxTws");
twdBVal = boatValues->findValueOrCreate("TWD");
awaBVal = boatValues->findValueOrCreate("AWA");
awsBVal = boatValues->findValueOrCreate("AWS");
@@ -150,5 +150,7 @@ public:
bool calcTrueWinds(const double* awaVal, const double* awsVal, const double* awd,
const double* cogVal, const double* stwVal, const double* sogVal, const double* hdtVal,
double* twdVal, double* twsVal, double* twaVal);
void setMaxWs(GwApi::BoatValue *wsMaxValue, const double * wsVal);
void setMaxWs() { setMaxWs(maxtwsBVal, &tws); };
bool handleWinds(bool calcWinds);
};