You want to calculate the average of an angle (e.g. Wind Direction). The Avg function is not suitable for this task because it is a simple mean: Avg( 359° + 1° ) will result in 180° rather than 0°.
The Bazefield Calculation Service supports the calculation of angular average across assets with the function AngAvg(). This can be used the same way as Sum() and Avg().
--Calculating average wind direction for all turbines at site: Expression=AngAvg($[SITE-WTG%-Turbine Wind Direction])
No tag-data version like TagAvg() exists for angular data. Instead, use TagRaw() to get measurement data and use them in the AngAvg() function. You need to take into account the amount of measurements you expect to be available in the interval when invoking the TagRaw function. There is an upper limit of number of data that can be processed this way.
--Calculating a daily average wind direction for a turbine using a 10 minute tag. 144 values are expected in the interval Expression=AngAvg(TagRaw(144,[SITE1-WTG001-WindDirection-ODBC]))|StartTime=00:00|Interval=Day1|PeriodInterval=Day1 --Making a 10 minute tag from Scada data Expression=AngAvg(TagRaw(600,[SITE1-WTG001-WindDirection]))|StartTime=00:00|Interval=600|PeriodInterval=600
Product Environment and Version
Article last updated for Bazefield Portal 126.96.36.199