From 7ced07d2d945f78285758594ea055dea53bb6662 Mon Sep 17 00:00:00 2001 From: Ulrich Meine Date: Thu, 15 May 2025 23:24:40 +0200 Subject: [PATCH] TWA, TWS, TWD + Pages Wind, WindRose, WindRoseFlex added --- lib/obp60task/BoatDataCalibration.cpp | 4 ++-- lib/obp60task/PageWind.cpp | 3 +++ lib/obp60task/PageWindRose.cpp | 7 +++++++ lib/obp60task/PageWindRoseFlex.cpp | 7 +++++++ lib/obp60task/config.json | 9 +++++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/obp60task/BoatDataCalibration.cpp b/lib/obp60task/BoatDataCalibration.cpp index 4ce1cfa..3a817c2 100644 --- a/lib/obp60task/BoatDataCalibration.cpp +++ b/lib/obp60task/BoatDataCalibration.cpp @@ -34,7 +34,7 @@ void CalibrationDataList::readConfig(GwConfigHandler* config, GwLog* logger) calibrationData.list[i].slope = (config->getString(slope, "")).toFloat(); // Convert calibration values to internal standard formats - if (calibrationData.list[i].instance == "AWS") { + if (calibrationData.list[i].instance == "AWS" || calibrationData.list[i].instance == "TWS") { if (windspeedFormat == "m/s") { // No conversion needed } else if (windspeedFormat == "km/h") { @@ -45,7 +45,7 @@ void CalibrationDataList::readConfig(GwConfigHandler* config, GwLog* logger) calibrationData.list[i].offset *= 0.5; // Convert Bft to m/s (approx) -> to be improved } - } else if (calibrationData.list[i].instance == "AWA" || calibrationData.list[i].instance == "HDM") { + } else if (calibrationData.list[i].instance == "AWA" || calibrationData.list[i].instance == "TWA" ||calibrationData.list[i].instance == "TWD" || calibrationData.list[i].instance == "HDM") { calibrationData.list[i].offset *= M_PI / 180; // Convert deg to rad } else if (calibrationData.list[i].instance == "DBT") { diff --git a/lib/obp60task/PageWind.cpp b/lib/obp60task/PageWind.cpp index e629597..272478b 100644 --- a/lib/obp60task/PageWind.cpp +++ b/lib/obp60task/PageWind.cpp @@ -3,6 +3,7 @@ #include "Pagedata.h" #include "OBP60Extensions.h" #include "N2kMessages.h" +#include "BoatDataCalibration.h" #define front_width 120 #define front_height 162 @@ -323,6 +324,7 @@ public: } String name1 = bvalue1->getName().c_str(); // Value name name1 = name1.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name1, bvalue1, logger); // Check if boat data value is to be calibrated double value1 = bvalue1->value; // Value as double in SI unit // bool valid1 = bvalue1->valid; // Valid information String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -336,6 +338,7 @@ public: } String name2 = bvalue2->getName().c_str(); // Value name name2 = name2.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name2, bvalue2, logger); // Check if boat data value is to be calibrated double value2 = bvalue2->value; // Value as double in SI unit // bool valid2 = bvalue2->valid; // Valid information if (simulation) { diff --git a/lib/obp60task/PageWindRose.cpp b/lib/obp60task/PageWindRose.cpp index 49a7ba3..dba50d1 100644 --- a/lib/obp60task/PageWindRose.cpp +++ b/lib/obp60task/PageWindRose.cpp @@ -2,6 +2,7 @@ #include "Pagedata.h" #include "OBP60Extensions.h" +#include "BoatDataCalibration.h" class PageWindRose : public Page { @@ -51,6 +52,7 @@ public: GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) String name1 = xdrDelete(bvalue1->getName()); // Value name name1 = name1.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name1, bvalue1, logger); // Check if boat data value is to be calibrated double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer @@ -65,6 +67,7 @@ public: GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue) String name2 = xdrDelete(bvalue2->getName()); // Value name name2 = name2.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name2, bvalue2, logger); // Check if boat data value is to be calibrated double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -78,6 +81,7 @@ public: GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) String name3 = xdrDelete(bvalue3->getName()); // Value name name3 = name3.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name3, bvalue3, logger); // Check if boat data value is to be calibrated double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -91,6 +95,7 @@ public: GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) String name4 = xdrDelete(bvalue4->getName()); // Value name name4 = name4.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name4, bvalue4, logger); // Check if boat data value is to be calibrated double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -104,6 +109,7 @@ public: GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue) String name5 = xdrDelete(bvalue5->getName()); // Value name name5 = name5.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name5, bvalue5, logger); // Check if boat data value is to be calibrated double value5 = bvalue5->value; // Value as double in SI unit bool valid5 = bvalue5->valid; // Valid information String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -117,6 +123,7 @@ public: GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue) String name6 = xdrDelete(bvalue6->getName()); // Value name name6 = name6.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name6, bvalue6, logger); // Check if boat data value is to be calibrated double value6 = bvalue6->value; // Value as double in SI unit bool valid6 = bvalue6->valid; // Valid information String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index 413f047..c8c453b 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -2,6 +2,7 @@ #include "Pagedata.h" #include "OBP60Extensions.h" +#include "BoatDataCalibration.h" class PageWindRoseFlex : public Page { @@ -51,6 +52,7 @@ public: GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) String name1 = xdrDelete(bvalue1->getName()); // Value name name1 = name1.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name1, bvalue1, logger); // Check if boat data value is to be calibrated double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer @@ -65,6 +67,7 @@ public: GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue) String name2 = xdrDelete(bvalue2->getName()); // Value name name2 = name2.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name2, bvalue2, logger); // Check if boat data value is to be calibrated double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -78,6 +81,7 @@ public: GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) String name3 = xdrDelete(bvalue3->getName()); // Value name name3 = name3.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name3, bvalue3, logger); // Check if boat data value is to be calibrated double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -91,6 +95,7 @@ public: GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) String name4 = xdrDelete(bvalue4->getName()); // Value name name4 = name4.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name4, bvalue4, logger); // Check if boat data value is to be calibrated double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -104,6 +109,7 @@ public: GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue) String name5 = xdrDelete(bvalue5->getName()); // Value name name5 = name5.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name5, bvalue5, logger); // Check if boat data value is to be calibrated double value5 = bvalue5->value; // Value as double in SI unit bool valid5 = bvalue5->valid; // Valid information String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places @@ -117,6 +123,7 @@ public: GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue) String name6 = xdrDelete(bvalue6->getName()); // Value name name6 = name6.substring(0, 6); // String length limit for value name + calibrationData.calibrateInstance(name6, bvalue6, logger); // Check if boat data value is to be calibrated double value6 = bvalue6->value; // Value as double in SI unit bool valid6 = bvalue6->valid; // Valid information String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 4f59854..5c1c298 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -698,6 +698,9 @@ "DBT", "HDM", "STW", + "TWA", + "TWS", + "TWD", "WTemp" ], "category": "OBP60 Calibrations", @@ -739,6 +742,9 @@ "DBT", "HDM", "STW", + "TWA", + "TWS", + "TWD", "WTemp" ], "category": "OBP60 Calibrations", @@ -780,6 +786,9 @@ "DBT", "HDM", "STW", + "TWA", + "TWS", + "TWD", "WTemp" ], "category": "OBP60 Calibrations",