Compasscorrection.bas, Sensoravg.bas, Sensormax.bas – Xylem STORM 3 Basic Programming manual User Manual
Page 45

43
Example Programs
REM Determines true wind direction as a bouy rotates,
REM based off recorded compass and wind direction
GETVALUE SENSOR “Compass”, WindDirVal
GETVALUE SENSOR “WD”, CompassVal
TrueWindDirVal = WindDirVal + CompassVal
IF (TrueWindDirVal >= 360) THEN
TrueWindDirVal = TrueWindDirVal - 360
END IF
CompassCorrection.bas
REM Calculates the running average for a specific sensor
SensorName$ = “SystemTemperature”
Measurements = 4
CombinedValue = 0
FOR n = 1 TO Measurements
GETVALUE SENSOR SensorName$ n, SensorValue
CombinedValue = CombinedValue + SensorValue
NEXT n
AverageValue = CombinedValue / Measurements
SensorAvg.bas
REM Finds the maximum measurement of the given sensor’s last n values
SensorName$ = “TempC”
Measurements = 4
MaximumValue = -99999
FOR n = 1 TO Measurements
GETVALUE SensorName$ n, SensorValue
IF (SensorValue > MaximumValue) THEN
MaximumValue = SensorValue
END IF
NEXT n
SensorMax.bas