From 45e23e80f8766c0e003e702b93f8a92038426213 Mon Sep 17 00:00:00 2001 From: Mark Crossley Date: Tue, 23 Jul 2024 15:46:20 +0100 Subject: [PATCH] Davis Cloud Station wind processing changed, instead of MX trying to calculate an average wind speed, MX now uses the wind speed data from Davis directly --- CumulusMX/CumulusMX.csproj | 2 +- CumulusMX/DavisCloudStation.cs | 32 ++++++++++++++++++++++---------- Updates.txt | 4 +++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/CumulusMX/CumulusMX.csproj b/CumulusMX/CumulusMX.csproj index e9943ece..303d0b86 100644 --- a/CumulusMX/CumulusMX.csproj +++ b/CumulusMX/CumulusMX.csproj @@ -36,7 +36,7 @@ - 4.1.2.4026 + 4.1.2.4027 Copyright © 2015-$([System.DateTime]::Now.ToString('yyyy')) Cumulus MX diff --git a/CumulusMX/DavisCloudStation.cs b/CumulusMX/DavisCloudStation.cs index 49ed35b3..2e74d39d 100644 --- a/CumulusMX/DavisCloudStation.cs +++ b/CumulusMX/DavisCloudStation.cs @@ -72,9 +72,10 @@ public DavisCloudStation(Cumulus cumulus) : base(cumulus) cumulus.LeafWetDPlaces = 1; cumulus.LeafWetFormat = "F1"; - CalcRecentMaxGust = true; - cumulus.StationOptions.CalcuateAverageWindSpeed = true; + CalcRecentMaxGust = false; + cumulus.StationOptions.CalcuateAverageWindSpeed = false; cumulus.StationOptions.UseSpeedForAvgCalc = true; + cumulus.StationOptions.UseSpeedForLatest = true; cumulus.StationOptions.CalculatedDP = false; cumulus.StationOptions.CalculatedWC = false; @@ -750,6 +751,7 @@ private void GetHistoricData(BackgroundWorker worker) private void DecodeCurrent(List sensors) { // The WLL sends the timestamp in Unix ticks, and in UTC + var dataUpdated = false; foreach (var sensor in sensors) { @@ -779,6 +781,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage($"DecodeCurrent: Using Leaf/Soil {txid}"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1000,6 +1003,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage("DecodeCurrent: Using barometer"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1069,6 +1073,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage($"DecodeCurrent: Using Inside temp/hum"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1132,6 +1137,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage("DecodeCurrent: Using WLL health"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1163,6 +1169,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage("DecodeCurrent: Using WLC health"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1211,6 +1218,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage($"DecodeCurrent: Using this record type {sensor.data_structure_type}"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -1361,20 +1369,17 @@ private void DecodeCurrent(List sensors) try { - if (data.wind_speed.HasValue && data.wind_dir.HasValue) + if (data.wind_gust_10_min.HasValue && data.wind_speed.HasValue && data.wind_dir.HasValue) { - var gust = ConvertUnits.WindMPHToUser(data.wind_speed.Value); + // The cloud data isn't coming in a a rapid enough rate to perform averaging, so just use the Davis values + var gust = ConvertUnits.WindMPHToUser(data.wind_gust_10_min.Value); + var spd = ConvertUnits.WindMPHToUser(data.wind_speed.Value); // dir is a direction code: 0=N, 1=NNE, ... 14=NW, 15=NNW - convert to degress var dir = (int) ((data.wind_dir ?? 0) * 22.5); cumulus.LogDebugMessage("DecodeCurrent: using wind data"); - DoWind(gust, dir, -1, lastRecordTime); - - if (data.wind_gust_10_min.HasValue) - { - CheckHighGust(ConvertUnits.WindMPHToUser(data.wind_gust_10_min.Value), dir, lastRecordTime); - } + DoWind(gust, dir, spd, lastRecordTime); } else { @@ -1674,6 +1679,7 @@ private void DecodeCurrent(List sensors) continue; } cumulus.LogDebugMessage($"DecodeCurrent: Using ISS {rec.tx_id}, type {sensor.data_structure_type}"); + dataUpdated = true; } catch (KeyNotFoundException) { @@ -2052,6 +2058,12 @@ private void DecodeCurrent(List sensors) } } + if (!dataUpdated) + { + // no new data, bail out + return; + } + var dateTime = DateTime.Now; // Now we have the primary data, calculate the derived data diff --git a/Updates.txt b/Updates.txt index 80648899..26e80c95 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,4 +1,4 @@ -4.1.2 - b4026 +4.1.2 - b4027 ————————————— New - Adds wind run to the dashboard "now" page @@ -24,6 +24,8 @@ Fixed - Remove UV/Solar missing data messages from Davis Cloud (VP2) - A new version of MigrateData3to4 (1.0.3) to fix issues migrating the day file - Negative 0.0 appearing when no rainfall has occurred +- Davis Cloud Station wind processing changed, instead of MX trying to calculate an average wind speed, MX now uses the wind speed data from Davis directly. + The data rate from the cloud is not fast enough for the average to be calculated.