Skip to content

Commit 010c67d

Browse files
authored
Merge pull request #204 from mcrossley/main
Davis Cloud Station wind processing changed, instead of MX trying to …
2 parents 5bcca9d + 45e23e8 commit 010c67d

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

CumulusMX/CumulusMX.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</PropertyGroup>
3737

3838
<PropertyGroup>
39-
<Version>4.1.2.4026</Version>
39+
<Version>4.1.2.4027</Version>
4040
<Copyright>Copyright © 2015-$([System.DateTime]::Now.ToString('yyyy')) Cumulus MX</Copyright>
4141
</PropertyGroup>
4242

CumulusMX/DavisCloudStation.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ public DavisCloudStation(Cumulus cumulus) : base(cumulus)
7272
cumulus.LeafWetDPlaces = 1;
7373
cumulus.LeafWetFormat = "F1";
7474

75-
CalcRecentMaxGust = true;
76-
cumulus.StationOptions.CalcuateAverageWindSpeed = true;
75+
CalcRecentMaxGust = false;
76+
cumulus.StationOptions.CalcuateAverageWindSpeed = false;
7777
cumulus.StationOptions.UseSpeedForAvgCalc = true;
78+
cumulus.StationOptions.UseSpeedForLatest = true;
7879
cumulus.StationOptions.CalculatedDP = false;
7980
cumulus.StationOptions.CalculatedWC = false;
8081

@@ -750,6 +751,7 @@ private void GetHistoricData(BackgroundWorker worker)
750751
private void DecodeCurrent(List<WlCurrentSensor> sensors)
751752
{
752753
// The WLL sends the timestamp in Unix ticks, and in UTC
754+
var dataUpdated = false;
753755

754756
foreach (var sensor in sensors)
755757
{
@@ -779,6 +781,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
779781
continue;
780782
}
781783
cumulus.LogDebugMessage($"DecodeCurrent: Using Leaf/Soil {txid}");
784+
dataUpdated = true;
782785
}
783786
catch (KeyNotFoundException)
784787
{
@@ -1000,6 +1003,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
10001003
continue;
10011004
}
10021005
cumulus.LogDebugMessage("DecodeCurrent: Using barometer");
1006+
dataUpdated = true;
10031007
}
10041008
catch (KeyNotFoundException)
10051009
{
@@ -1069,6 +1073,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
10691073
continue;
10701074
}
10711075
cumulus.LogDebugMessage($"DecodeCurrent: Using Inside temp/hum");
1076+
dataUpdated = true;
10721077
}
10731078
catch (KeyNotFoundException)
10741079
{
@@ -1132,6 +1137,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
11321137
continue;
11331138
}
11341139
cumulus.LogDebugMessage("DecodeCurrent: Using WLL health");
1140+
dataUpdated = true;
11351141
}
11361142
catch (KeyNotFoundException)
11371143
{
@@ -1163,6 +1169,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
11631169
continue;
11641170
}
11651171
cumulus.LogDebugMessage("DecodeCurrent: Using WLC health");
1172+
dataUpdated = true;
11661173
}
11671174
catch (KeyNotFoundException)
11681175
{
@@ -1211,6 +1218,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
12111218
continue;
12121219
}
12131220
cumulus.LogDebugMessage($"DecodeCurrent: Using this record type {sensor.data_structure_type}");
1221+
dataUpdated = true;
12141222
}
12151223
catch (KeyNotFoundException)
12161224
{
@@ -1361,20 +1369,17 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
13611369

13621370
try
13631371
{
1364-
if (data.wind_speed.HasValue && data.wind_dir.HasValue)
1372+
if (data.wind_gust_10_min.HasValue && data.wind_speed.HasValue && data.wind_dir.HasValue)
13651373
{
1366-
var gust = ConvertUnits.WindMPHToUser(data.wind_speed.Value);
1374+
// The cloud data isn't coming in a a rapid enough rate to perform averaging, so just use the Davis values
1375+
var gust = ConvertUnits.WindMPHToUser(data.wind_gust_10_min.Value);
1376+
var spd = ConvertUnits.WindMPHToUser(data.wind_speed.Value);
13671377
// dir is a direction code: 0=N, 1=NNE, ... 14=NW, 15=NNW - convert to degress
13681378
var dir = (int) ((data.wind_dir ?? 0) * 22.5);
13691379

13701380
cumulus.LogDebugMessage("DecodeCurrent: using wind data");
13711381

1372-
DoWind(gust, dir, -1, lastRecordTime);
1373-
1374-
if (data.wind_gust_10_min.HasValue)
1375-
{
1376-
CheckHighGust(ConvertUnits.WindMPHToUser(data.wind_gust_10_min.Value), dir, lastRecordTime);
1377-
}
1382+
DoWind(gust, dir, spd, lastRecordTime);
13781383
}
13791384
else
13801385
{
@@ -1674,6 +1679,7 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
16741679
continue;
16751680
}
16761681
cumulus.LogDebugMessage($"DecodeCurrent: Using ISS {rec.tx_id}, type {sensor.data_structure_type}");
1682+
dataUpdated = true;
16771683
}
16781684
catch (KeyNotFoundException)
16791685
{
@@ -2052,6 +2058,12 @@ private void DecodeCurrent(List<WlCurrentSensor> sensors)
20522058
}
20532059
}
20542060

2061+
if (!dataUpdated)
2062+
{
2063+
// no new data, bail out
2064+
return;
2065+
}
2066+
20552067
var dateTime = DateTime.Now;
20562068

20572069
// Now we have the primary data, calculate the derived data

Updates.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
4.1.2 - b4026
1+
4.1.2 - b4027
22
—————————————
33
New
44
- Adds wind run to the dashboard "now" page
@@ -24,6 +24,8 @@ Fixed
2424
- Remove UV/Solar missing data messages from Davis Cloud (VP2)
2525
- A new version of MigrateData3to4 (1.0.3) to fix issues migrating the day file
2626
- Negative 0.0 appearing when no rainfall has occurred
27+
- 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.
28+
The data rate from the cloud is not fast enough for the average to be calculated.
2729

2830

2931

0 commit comments

Comments
 (0)