As above, so we can get ideas for the non experienced crbasic users...
Or use it for your own sensors.
Ok, heres mine.
Probably not in the best way written, it has some faults in it.
Maybe someone can shine a light or use it as an example...
'600s en 1440s zijn de gemiddelde versie, zonder s de max.
'define all angles in degrees not radians
AngleDegrees
'bron
Public Windskm
Public Windr
Public Beaufort
Public AvgBeaufort
Public BP_mbar
Public Temp
Public Vocht
Public SlrW
Public Rain_mm
Public Tot24
Public TotSunHrs
Public TotSun_H, TotSun_M, TotSun_S
Public TotSun_HMS As String * 32
Public SlrkJ
Public Solar_kWh
Public TotSolar_kWh
Public RTime(9)
Public SolPos(5)
Public PotSlrW
Public SunHrs
Public RainRate
Alias RTime(1)=Year
Alias RTime(2)=Month
Alias RTime(3)=DayOfMonth
Alias RTime(4)=HourOfDay
Alias RTime(5)=Minutes
Alias RTime(6)=Seconds
Alias RTime(7)=Microseconds
Alias RTime(8)=DayOfWeek
Alias RTime(9)=DayOfYear
Alias SolPos(1)=SolarAzimuth
Alias SolPos(2)=SunElevation
Alias SolPos(3)=HourAngle
Alias SolPos(4)=Declination
Alias SolPos(5)=AirMass
'gmiddelde versie 10 min in 1 uur---------------------------------------
Public Windskm_600s
Public Windskm600sMax(2)
Public Timeatmax600s As Long
Public Winddiratmax600s
'gmiddelde versie 1 dag--------------------------------------------------
Public Windskm1440sMax(2)
Public Timeatmax1440s As Long
'max versie 1 uur--------------------------------------------------------
Public Windskm60Max(2)
Public Windskm60Min(2)
Public Winddiratmax60
Public Timeatmax60 As Long
'max versie 1 dag--------------------------------------------------------
Public WindskmdagMax(2)
Public WindskmdagMin(2)
Public Winddiratmaxdag
Public Timeatmaxdag As Long
'These could be redefined as DIMs post testing gemiddelde versie---------
Dim Windskm600s(60)
Dim Windskm1440s(1440)
Dim Windr600 (60)
Dim Timeofmax600s(60) As Long
Dim Timeofmax1440s(1440) As Long
'These could be redefined as DIMs post testing max versie 1 uur----------
Dim Windskm60(60)
Dim Windr60 (60)
Dim Timeofmax60(60) As Long
'These could be redefined as DIMs post testing max versie 1 dag----------
Dim Windskmdag(1440)
Dim Windrdag (1440)
Dim Timeofmaxdag(1440) As Long
'Windrichting in text----------------------------------------------------
Public WDtxtlive As String * 5
Public WDtxt_2 As String * 5
Public WDtxt_3 As String * 5
Public WDtxt_4 As String * 5
Public WDtxt_5 As String * 5
'Windrichting gemiddelde-------------------------------------------------
Dim SinWindr
Dim CosWindr
Dim AvgSinWindr
Dim AvgCosWindr
Public AvgWindr
'------------------------------------------------------------------------
Public Temp_Max
Public Time_temp_Max As Long
Public Temp_Min
Public Time_Temp_Min As Long
Public Temp_Change
Public Vocht_Max
Public Time_Vocht_Max As Long
Public Vocht_Min
Public Time_Vocht_Min As Long
Public Vocht_Change
Public BP_mbar_Change
'Define Data Tables
'First the one minute one
DataTable(TableOnemin,True,-1)
DataInterval(0,1,min,10)
WindVector (1,Windskm,Windr,IEEE4,False,0,0,1)
FieldNames ("Windskm,Windr")
'Set the last parameter of the next instr true to capture time of max
'Capture the maximum 3 sec gust
Maximum(1,Windskm_600s,IEEE4,False,True)
FieldNames ("MaxWindskm_600s,TimeofmaxAvg")
Average(1,Windskm_600s,IEEE4,False)
FieldNames ("AverageWindskm_600s,TimeofmaxAvg")
Sample(1,AvgWindr,IEEE4,False)
FieldNames ("AvgWindr")
Sample(1,Rainrate,IEEE4)
FieldNames ("Rainrate")
Sample(1,Tot24,IEEE4)
FieldNames ("Tot24")
Sample(1,TotSolar_kWh,IEEE4)
FieldNames ("TotSolarkWh24")
Sample(1,TotSun_HMS,String)
FieldNames ("TotSunHrs")
Sample(1,PotSlrW,IEEE4)
FieldNames ("PotSlrW")
'Set the last parameter of the next instr true to capture time of max
'Capture the maximum gust
Maximum(1,Windskm,IEEE4,False,True)
FieldNames ("MaxWindskm,Timeofmax")
SampleMaxMin (1,Windr,IEEE4,False)
FieldNames ("DiratMaxWindskm")
Sample(1,BP_mbar,IEEE4,False)
FieldNames ("Baro")
Sample(1,SlrW,IEEE4,False)
FieldNames ("SlrW")
Average(1,Temp,IEEE4,False)
FieldNames ("Temp")
Sample (1,Temp_Max,IEEE4,False)
FieldNames ("MaxTemp")
Sample (1,Time_temp_Max,Nsec,False)
FieldNames ("timeMaxTemp")
Sample (1,Temp_Min,IEEE4,False)
FieldNames ("MinTemp")
Sample (1,Time_Temp_Min,Nsec,False)
FieldNames ("timeMinTemp")
Average(1,Vocht,IEEE4,False)
FieldNames ("Vocht")
Sample (1,Vocht_Max,IEEE4,False)
FieldNames ("MaxVocht")
Sample (1,Time_Vocht_Max,Nsec,False)
FieldNames ("timeMaxVocht")
Sample (1,Vocht_Min,IEEE4,False)
FieldNames ("MinVocht")
Sample (1,Time_Vocht_Min,Nsec,False)
FieldNames ("timeMinVocht")
EndTable
DataTable(TableTenmin,True,-1)
DataInterval(0,10,min,10)
WindVector (1,Windskm,Windr,FP2,False,0,0,1)
FieldNames ("Windskm,Windr")
'Set the last parameter of the next instr true to capture time of max
'Capture the maximum 3 sec gust
Maximum(1,Windskm_600s,FP2,False,True)
FieldNames ("MaxWindskm_600s,TimeofmaxAvg")
Average(1,Windskm_600s,FP2,False)
FieldNames ("AverageWindskm_600s,TimeofmaxAvg")
Sample(1,AvgWindr,FP2,False)
FieldNames ("AvgWindr")
Sample(1,Tot24,IEEE4)
FieldNames ("Tot24")
Sample(1,TotSun_HMS,String)
FieldNames ("TotSunHrs")
'Set the last parameter of the next instr true to capture time of max
'Capture the maximum gust
Maximum(1,Windskm,FP2,False,True)
FieldNames ("MaxWindskm,Timeofmax")
SampleMaxMin (1,Windr,FP2,False)
FieldNames ("DiratMaxWindskm")
Sample(1,BP_mbar,IEEE4,False)
FieldNames ("Baro")
Sample(1,SlrW,FP2,False)
FieldNames ("SlrW")
Average(1,Temp,FP2,False)
FieldNames ("Temp")
Sample (1,Temp_Max,FP2,False)
FieldNames ("MaxTemp")
Sample (1,Time_temp_Max,Nsec,False)
FieldNames ("timeMaxTemp")
Sample (1,Temp_Min,FP2,False)
FieldNames ("MinTemp")
Sample (1,Time_Temp_Min,Nsec,False)
FieldNames ("timeMinTemp")
Average(1,Vocht,FP2,False)
FieldNames ("Vocht")
Sample (1,Vocht_Max,FP2,False)
FieldNames ("MaxVocht")
Sample (1,Time_Vocht_Max,Nsec,False)
FieldNames ("timeMaxVocht")
Sample (1,Vocht_Min,FP2,False)
FieldNames ("MinVocht")
Sample (1,Time_Vocht_Min,Nsec,False)
FieldNames ("timeMinVocht")
EndTable
DataTable (TestTemp,True,0)
DataInterval (0,1,Sec,0)
Sample (1,Temp,IEEE4)
Sample (1,Temp_Change,IEEE4)
EndTable
DataTable (TestVocht,True,0)
DataInterval (0,1,Sec,0)
Sample (1,Vocht,IEEE4)
Sample (1,Vocht_Change,IEEE4)
EndTable
DataTable (TestBP_mbar,True,0)
DataInterval (0,1,Sec,0)
Sample (1,BP_mbar,IEEE4)
Sample (1,BP_mbar_Change,IEEE4)
EndTable
DataTable (TestRainrate,True,0)
DataInterval (0,1,Sec,0)
Sample (1,Tot24,IEEE4)
Sample (1,Rainrate,IEEE4)
EndTable
'------------------------------------------------------------------------
DataTable(rollingmaxtestAvg,true,1440)
DataInterval(0,1,min,10)
'Sample the 60 min rolling max average ws, dir at max, and time of max
Sample (1,Windskm600sMax(),FP2)
Sample (1,Winddiratmax600s,FP2)
Sample (1,Timeatmax600s,Nsec)
'Sample the 1 dag rolling max avg ws, dir at max, and time of max
Sample (1,Windskm1440sMax(),FP2)
Sample (1,Timeatmax1440s,Nsec)
EndTable
'------------------------------------------------------------------------
'Test of rolling max table
DataTable(rollingmaxtest,true,1440)
DataInterval(0,1,min,10)
'Sample the 60 min rolling max ws, dir at max, and time of max
Sample (1,Windskm60Max(),FP2)
Sample (1,Winddiratmax60,FP2)
Sample (1,Timeatmax60,Nsec)
'Sample the 1 dag rolling max ws, dir at max, and time of max
Sample (1,WindskmdagMax(),FP2)
Sample (1,Winddiratmaxdag,FP2)
Sample (1,Timeatmaxdag,Nsec)
EndTable
'------------------------------------------------------------------------
'Main Program
BeginProg
Temp_Max = -100
Time_temp_Max = "NAN"
Temp_Min = 100
Time_Temp_Min= "NAN"
Vocht_Max = -100
Time_Vocht_Max = "NAN"
Vocht_Min = 100
Time_Vocht_Min= "NAN"
Scan(1,Sec,1,0)
VoltDiff(Windskm,1,mV2500,1,True,0,_60Hz,0.081035,-39.9875)
VoltDiff(Windr,1,mV2500,2,True,0,_60Hz,0.18,0)
VoltDiff(BP_mbar,1,mV2500,6,1,0,_60Hz,0.184,600)
VoltDiff(Temp,1,mV2500,3,True,0,_60Hz,0.05,-65)
VoltDiff(Vocht,1,mV2500,4,True,0,_60Hz,0.05,-25)
VoltDiff(SlrW,1,mV250,7,True,0,_60Hz,1,0)
PulseCount(Rain_mm,1,1,2,0,0.2,0)
'------------------------------------------------------------------------
'User Entered Calculation
Windr = (Windr-220+360)MOD 360
If Windr>360 Then Windr =Windr-360
If Windr <0 Then Windr = Windr+360
If Windr>=360 Then Windr=0
RainRate = Tot24 * 3600 'rainfall(mm) over Interval
AvgRun(RainRate,1,Tot24,300) ' keep a running average of rainfall over a given period - in this case 300 seconds.
If SlrW<0 Then SlrW=0
SlrkJ=SlrW*0.04330879
SlrW=SlrW*43.30879
AvgRun(Windskm_600s,1,Windskm,600)
'24 hour running total calculation Tot24
Tot24=Tot24+Rain_mm
TotSolar_kWh=TotSolar_kWh+(SlrW/3600000)
If IfTime (0,1440,min) Then TotSolar_kWh=0
If IfTime (0,1440,min) Then Tot24=0
If IfTime (0,1440,min) Then Windskm600sMax=Windskm
If IfTime (0,1440,min) Then Winddiratmax600s=Windr
If IfTime (0,1440,min) Then Timeatmax600s=status.timestamp
If IfTime (0,1440,min) Then Windskm1440sMax=Windskm
If IfTime (0,1440,min) Then Timeatmax1440s=status.timestamp
If IfTime (0,1440,min) Then Windskm60Max=Windskm
If IfTime (0,1440,min) Then Winddiratmax60=Windr
If IfTime (0,1440,min) Then Timeatmax60=status.timestamp
If IfTime (0,1440,min) Then WindskmdagMax=Windskm
If IfTime (0,1440,min) Then Winddiratmaxdag=Windr
If IfTime (0,1440,min) Then Timeatmaxdag=status.timestamp
If IfTime (0,1440,min) Then Time_Temp_Min=status.timestamp
If IfTime (0,1440,min) Then Temp_Min=Temp
If IfTime (0,1440,min) Then Temp_Max=Temp
If IfTime (0,1440,min) Then Time_temp_Max=status.timestamp
If IfTime (0,1440,min) Then Vocht_Max=Vocht
If IfTime (0,1440,min) Then Time_Vocht_Max=status.timestamp
If IfTime (0,1440,min) Then Vocht_Min=Vocht
If IfTime (0,1440,min) Then Time_Vocht_Min=status.timestamp
CallTable (TableOnemin)
CallTable (TableTenmin)
'Only update the 60 minute max gust, direction and time once per
'minute after the one minute table has stored data
If tableonemin.output Then
Move (Windskm600s(2),59,Windskm600s(1),59)
Windskm600s(1) = Tableonemin.MaxWindskm_600s(1,1)
'Also use an array of times (as long integers)
Move (Timeofmax600s(2),59,Timeofmax600s(1),59)
Timeofmax600s(1) = Tableonemin.TimeofmaxAvg(1,1)
'Look through all 60 values in the array (not 59)
MaxSpa (Windskm600sMax(),60,Windskm600s(1))
'The MaxSpa second output points to the max value in the array
'We use that value to pick out the matching direction and time
'in the other two arrays of data
Winddiratmax600s=Windr600(Windskm600sMax(2))
Timeatmax600s=Timeofmax600s(Windskm600sMax(2))
EndIf
'Put any instructions to sample the new values here
'Be careful to sample the time values as type NSEC
'e.g. this is a test table
'Only update the 1440 minute max gust, direction and time once per
'minute after the one minute table has stored data
If tableonemin.output Then
Move (Windskm1440s(2),1439,Windskm1440s(1),1439)
Windskm1440s(1) = Tableonemin.MaxWindskm_600s(1,1)
'Also use an array of times (as long integers)
Move (Timeofmax1440s(2),1439,Timeofmax1440s(1),1439)
Timeofmax1440s(1) = Tableonemin.TimeofmaxAvg(1,1)
'Look through all 60 values in the array (not 59)
MaxSpa (Windskm1440sMax(),1440,Windskm1440s(1))
'The MaxSpa second output points to the max value in the array
'We use that value to pick out the matching direction and time
'in the other two arrays of data
Winddiratmax600s=Windr600(Windskm600sMax(2))
Timeatmax1440s=Timeofmax1440s(Windskm1440sMax(2))
EndIf
'Only update the 60 minute max gust, direction and time once per
'minute after the one minute table has stored data
If tableonemin.output Then
Move (Windskm60(2),59,Windskm60(1),59)
Windskm60(1) = Tableonemin.MaxWindskm(1,1)
Move (Windr60(2),59,Windr60(1),59)
Windr60(1) = Tableonemin.DiratMaxWindskm(1,1)
'Also use an array of times (as long integers)
Move (Timeofmax60(2),59,Timeofmax60(1),59)
Timeofmax60(1) = Tableonemin.Timeofmax(1,1)
'Look through all 60 values in the array (not 59)
MaxSpa (Windskm60Max(),60,Windskm60(1))
MinSpa (Windskm60Min(),60,Windskm60(1))
'The MaxSpa second output points to the max value in the array
'We use that value to pick out the matching direction and time
'in the other two arrays of data
Winddiratmax60=Windr60(Windskm60Max(2))
Timeatmax60=Timeofmax60(Windskm60Max(2))
EndIf
'Only update the 1 dag max gust, direction and time once per
'minute after the one minute table has stored data
If tableonemin.output Then
Move (Windskmdag(2),1439,Windskmdag(1),1439)
Windskmdag(1) = Tableonemin.MaxWindskm(1,1)
Move (Windrdag(2),1439,Windrdag(1),1439)
Windrdag(1) = Tableonemin.DiratMaxWindskm(1,1)
'Also use an array of times (as long integers)
Move (Timeofmaxdag(2),1439,Timeofmaxdag(1),1439)
Timeofmaxdag(1) = Tableonemin.Timeofmax(1,1)
'Look through all 60 values in the array (not 59)
MaxSpa (WindskmdagMax(),1440,Windskmdag(1))
MinSpa (WindskmdagMin(),1440,Windskmdag(1))
'The MaxSpa second output points to the max value in the array
'We use that value to pick out the matching direction and time
'in the other two arrays of data
Winddiratmaxdag=Windrdag(WindskmdagMax(2))
Timeatmaxdag=Timeofmaxdag(WindskmdagMax(2))
EndIf
'Calculate 10 Minute Running Average For Wind Direction
SinWindr = SIN(Windr)
CosWindr = COS(Windr)
AvgRun (AvgSinWindr,1,SinWindr,600)
AvgRun (AvgCosWindr,1,CosWindr,600)
AvgWindr = ATN(AvgSinWindr/AvgCosWindr)
If AvgCosWindr < 0 Then
AvgWindr = 180 + AvgWindr
ElseIf AvgSinWindr < 0 Then
AvgWindr = 360 + AvgWindr
EndIf
Solar_kWh=SlrW/3600000
'Calculate Sunshine Hours
'Get current time
RealTime(RTime(1))
'Calculate solar position
SolarPosition(SolPos(),RTime(),2*3600,51.483169,3.622959,0,BP_mbar,Temp)
'Calculate potential radiation for time && position (multiply sine of solar elevation angle by solar constant 1373)
PotSlrW=SIN(SunElevation)*1000
'If the measured value (W/m^2) is greater than 0.4 * the potential solar radiation (W/m^2)
'and the sine of the sun elevation angle (degrees) is great than 0.1 (elevation angle of 6 degrees)
'than it has been sunny for the current scan.
If SlrW>0.8*PotSlrW AND SIN(SunElevation)>0.1 Then
'Calculate sun hours for scan time in seconds
SunHrs=(1/86400)*1
Else
'Set sun hours for scan time in seconds to 0
SunHrs=0
If PotSlrW<0 Then PotSlrW=0
EndIf
'24 hour running total calculation TotSunHrs
TotSunHrs=TotSunHrs+SunHrs
If IfTime (0,1440,min) Then TotSunHrs=0
TotSun_H=INT(TotSunHrs*24)
TotSun_M=INT((TotSunHrs*24-TotSun_H)*60)
TotSun_S=Round((((TotSunHrs*24-TotSun_H)*60)-TotSun_M)*60,0)
TotSun_HMS=FormatFloat(TotSun_H,"%02.00f")+":"+FormatFloat(TotSun_M,"%02.00f")+":"+FormatFloat(TotSun_S,"%02.00f")
If Temp > Temp_Max Then
Temp_Max=Temp
Time_temp_Max=status.timestamp
EndIf
If Temp < Temp_Min Then
Temp_Min=Temp
Time_Temp_Min=status.timestamp
EndIf
If Vocht > Vocht_Max Then
Vocht_Max=Vocht
Time_Vocht_Max=status.timestamp
EndIf
If Vocht < Vocht_Min Then
Vocht_Min=Vocht
Time_Vocht_Min=status.timestamp
EndIf
VoltDiff(Temp,1,mV2500,3,True,0,_60Hz,0.05,-65)
PortSet(1,0)
If TestTemp.Record(1,1) > 0 Then
'calculate change for one hour
Temp_Change = Temp - TestTemp.Temp(1,1)
EndIf
VoltDiff(Vocht,1,mV2500,4,True,0,_60Hz,0.05,-25)
PortSet(1,0)
If TestVocht.Record(1,1) > 0 Then
'calculate change for one hour
Vocht_Change = Vocht - TestVocht.Vocht(1,1)
EndIf
VoltDiff(BP_mbar,1,mV2500,6,1,0,_60Hz,0.184,600)
PortSet(1,0)
If TestBP_mbar.Record(1,1) > 0 Then
'calculate change for one hour
BP_mbar_Change = BP_mbar - TestBP_mbar.BP_mbar(1,1)
EndIf
PortSet(1,0)
If TestRainrate.Record(1,1) > 0 Then
'calculate rainrate for one hour
Rainrate = Tot24 - TestRainrate.Tot24(1,1)
EndIf
'-------------------------------------------------------------------------
Select Case Windr
Case Is >=0 AND Is <=11.25
WDtxtlive = "N"
Case Is >11.25 AND Is <=33.75
WDtxtlive = "NNO"
Case Is >33.75 AND Is <=56.25
WDtxtlive = "NO"
Case Is >56.25 AND Is <=78.75
WDtxtlive = "ONO"
Case Is >78.75 AND Is <=101.25
WDtxtlive = "O"
Case Is >101.25 AND Is <=123.75
WDtxtlive = "OZO"
Case Is >123.75 AND Is <=146.25
WDtxtlive = "ZO"
Case Is >146.25 AND Is <=168.75
WDtxtlive = "ZZO"
Case Is >168.75 AND Is <=191.25
WDtxtlive = "Z"
Case Is >191.25 AND Is <=213.75
WDtxtlive = "ZZW"
Case Is >213.75 AND Is <=236.25
WDtxtlive = "ZW"
Case Is >236.25 AND Is <=258.75
WDtxtlive = "WZW"
Case Is >258.75 AND Is <=281.25
WDtxtlive = "W"
Case Is >281.25 AND Is <=303.75
WDtxtlive = "WNW"
Case Is >303.75 AND Is <=326.25
WDtxtlive = "NW"
Case Is >326.25 AND Is <=348.75
WDtxtlive = "NNW"
Case Is >348.75 AND Is <=360
WDtxtlive = "N"
EndSelect
'------------------------------------------------------------------------
Select Case rollingmaxtestAvg.Winddiratmax600s
Case Is >=0 AND Is <=11.25
WDtxt_2 = "N"
Case Is >11.25 AND Is <=33.75
WDtxt_2 = "NNO"
Case Is >33.75 AND Is <=56.25
WDtxt_2 = "NO"
Case Is >56.25 AND Is <=78.75
WDtxt_2 = "ONO"
Case Is >78.75 AND Is <=101.25
WDtxt_2 = "O"
Case Is >101.25 AND Is <=123.75
WDtxt_2 = "OZO"
Case Is >123.75 AND Is <=146.25
WDtxt_2 = "ZO"
Case Is >146.25 AND Is <=168.75
WDtxt_2 = "ZZO"
Case Is >168.75 AND Is <=191.25
WDtxt_2 = "Z"
Case Is >191.25 AND Is <=213.75
WDtxt_2 = "ZZW"
Case Is >213.75 AND Is <=236.25
WDtxt_2 = "ZW"
Case Is >236.25 AND Is <=258.75
WDtxt_2 = "WZW"
Case Is >258.75 AND Is <=281.25
WDtxt_2 = "W"
Case Is >281.25 AND Is <=303.75
WDtxt_2 = "WNW"
Case Is >303.75 AND Is <=326.25
WDtxt_2 = "NW"
Case Is >326.25 AND Is <=348.75
WDtxt_2 = "NNW"
Case Is >348.75 AND Is <=360
WDtxt_2 = "N"
EndSelect
'------------------------------------------------------------------------
Select Case rollingmaxtest.Winddiratmax60
Case Is >=0 AND Is <=11.25
WDtxt_3 = "N"
Case Is >11.25 AND Is <=33.75
WDtxt_3= "NNO"
Case Is >33.75 AND Is <=56.25
WDtxt_3 = "NO"
Case Is >56.25 AND Is <=78.75
WDtxt_3 = "ONO"
Case Is >78.75 AND Is <=101.25
WDtxt_3 = "O"
Case Is >101.25 AND Is <=123.75
WDtxt_3 = "OZO"
Case Is >123.75 AND Is <=146.25
WDtxt_3 = "ZO"
Case Is >146.25 AND Is <=168.75
WDtxt_3 = "ZZO"
Case Is >168.75 AND Is <=191.25
WDtxt_3 = "Z"
Case Is >191.25 AND Is <=213.75
WDtxt_3 = "ZZW"
Case Is >213.75 AND Is <=236.25
WDtxt_3 = "ZW"
Case Is >236.25 AND Is <=258.75
WDtxt_3 = "WZW"
Case Is >258.75 AND Is <=281.25
WDtxt_3 = "W"
Case Is >281.25 AND Is <=303.75
WDtxt_3 = "WNW"
Case Is >303.75 AND Is <=326.25
WDtxt_3 = "NW"
Case Is >326.25 AND Is <=348.75
WDtxt_3 = "NNW"
Case Is >348.75 AND Is <=360
WDtxt_3 = "N"
EndSelect
'------------------------------------------------------------------------
Select Case rollingmaxtest.Winddiratmaxdag
Case Is >=0 AND Is <=11.25
WDtxt_4 = "N"
Case Is >11.25 AND Is <=33.75
WDtxt_4 = "NNO"
Case Is >33.75 AND Is <=56.25
WDtxt_4 = "NO"
Case Is >56.25 AND Is <=78.75
WDtxt_4 = "ONO"
Case Is >78.75 AND Is <=101.25
WDtxt_4 = "O"
Case Is >101.25 AND Is <=123.75
WDtxt_4 = "OZO"
Case Is >123.75 AND Is <=146.25
WDtxt_4 = "ZO"
Case Is >146.25 AND Is <=168.75
WDtxt_4 = "ZZO"
Case Is >168.75 AND Is <=191.25
WDtxt_4 = "Z"
Case Is >191.25 AND Is <=213.75
WDtxt_4 = "ZZW"
Case Is >213.75 AND Is <=236.25
WDtxt_4 = "ZW"
Case Is >236.25 AND Is <=258.75
WDtxt_4 = "WZW"
Case Is >258.75 AND Is <=281.25
WDtxt_4 = "W"
Case Is >281.25 AND Is <=303.75
WDtxt_4 = "WNW"
Case Is >303.75 AND Is <=326.25
WDtxt_4 = "NW"
Case Is >326.25 AND Is <=348.75
WDtxt_4 = "NNW"
Case Is >348.75 AND Is <=360
WDtxt_4 = "N"
EndSelect
'------------------------------------------------------------------------
Select Case TableOnemin.AvgWindr
Case Is >=0 AND Is <=11.25
WDtxt_5 = "N"
Case Is >11.25 AND Is <=33.75
WDtxt_5 = "NNO"
Case Is >33.75 AND Is <=56.25
WDtxt_5 = "NO"
Case Is >56.25 AND Is <=78.75
WDtxt_5 = "ONO"
Case Is >78.75 AND Is <=101.25
WDtxt_5 = "O"
Case Is >101.25 AND Is <=123.75
WDtxt_5 = "OZO"
Case Is >123.75 AND Is <=146.25
WDtxt_5 = "ZO"
Case Is >146.25 AND Is <=168.75
WDtxt_5 = "ZZO"
Case Is >168.75 AND Is <=191.25
WDtxt_5 = "Z"
Case Is >191.25 AND Is <=213.75
WDtxt_5 = "ZZW"
Case Is >213.75 AND Is <=236.25
WDtxt_5 = "ZW"
Case Is >236.25 AND Is <=258.75
WDtxt_5 = "WZW"
Case Is >258.75 AND Is <=281.25
WDtxt_5 = "W"
Case Is >281.25 AND Is <=303.75
WDtxt_5 = "WNW"
Case Is >303.75 AND Is <=326.25
WDtxt_5 = "NW"
Case Is >326.25 AND Is <=348.75
WDtxt_5 = "NNW"
Case Is >348.75 AND Is <=360
WDtxt_5 = "N"
EndSelect
'------------------------------------------------------------------------
If TableOnemin.AverageWindskm_600s<0.8 Then
AvgBeaufort=0
ElseIf TableOnemin.AverageWindskm_600s<5.5 Then
AvgBeaufort=1
ElseIf TableOnemin.AverageWindskm_600s<12 Then
AvgBeaufort=2
ElseIf TableOnemin.AverageWindskm_600s<19.5 Then
AvgBeaufort=3
ElseIf TableOnemin.AverageWindskm_600s<28.7 Then
AvgBeaufort=4
ElseIf TableOnemin.AverageWindskm_600s<38.6 Then
AvgBeaufort=5
ElseIf TableOnemin.AverageWindskm_600s<49.8 Then
AvgBeaufort=6
ElseIf TableOnemin.AverageWindskm_600s<61.7 Then
AvgBeaufort=7
ElseIf TableOnemin.AverageWindskm_600s<74.6 Then
AvgBeaufort=8
ElseIf TableOnemin.AverageWindskm_600s<87.9 Then
AvgBeaufort=9
ElseIf TableOnemin.AverageWindskm_600s<102.3 Then
AvgBeaufort=10
ElseIf TableOnemin.AverageWindskm_600s<117.5 Then
AvgBeaufort=11
ElseIf TableOnemin.AverageWindskm_600s>132.8 Then
AvgBeaufort=12
EndIf
'------------------------------------------------------------------------
If Windskm<0.8 Then
Beaufort=0
ElseIf Windskm<5.5 Then
Beaufort=1
ElseIf Windskm<12 Then
Beaufort=2
ElseIf Windskm<19.5 Then
Beaufort=3
ElseIf Windskm<28.7 Then
Beaufort=4
ElseIf Windskm<38.6 Then
Beaufort=5
ElseIf Windskm<49.8 Then
Beaufort=6
ElseIf Windskm<61.7 Then
Beaufort=7
ElseIf Windskm<74.6 Then
Beaufort=8
ElseIf Windskm<87.9 Then
Beaufort=9
ElseIf Windskm<102.3 Then
Beaufort=10
ElseIf Windskm<117.5 Then
Beaufort=11
ElseIf Windskm>132.8 Then
Beaufort=12
EndIf
CallTable rollingmaxtestAvg
CallTable rollingmaxtest
CallTable TestTemp
CallTable TestVocht
CallTable TestBP_mbar
CallTable TestRainrate
NextScan
EndProg