Support Forums
Automatic Weather Station (AWS) code

The first area I would like some help with is for rainfall with my tipping bucket rain gauge. I would like to have a single schedule where I can record the following:

  • a date/time stamp with each tip of the bucket
  • record the total rainfall over a given period of time Can already do this via code from FAQ page - General Weather Station?

For testing purposes, I will go for a summary every 2 mins with the total being reset after the result is printed. Here is the code I have thus far:

BEGIN
/D
/T
1CV=0
RA1HSC(1)
1CV("Rain rate")=1CV+0.2
END

Any help will be appreciated.

Cheers,
Grant

The first area I would like some help with is for rainfall with my tipping bucket rain gauge. I would like to have a single schedule where I can record the following: - a date/time stamp with each tip of the bucket - record the total rainfall over a given period of time Can already do this via code from FAQ page - General Weather Station? For testing purposes, I will go for a summary every 2 mins with the total being reset after the result is printed. Here is the code I have thus far: ```` BEGIN /D /T 1CV=0 RA1HSC(1) 1CV("Rain rate")=1CV+0.2 END ```` Any help will be appreciated. Cheers, Grant

Good afternoon Grant,

Your requirements are mutually exclusive. Rain events are random therefore rain intensity readings need to be triggered by the physical tipping of the bucket (when HSC changes).

The accumulative rain fall every 2 minutes is time based so you will need two schedule, Event based for Rain Intensity and Time based for accumulated rain for a given duration

BEGIN
/D
/T
1CV=0
RA1HSC(1)
1CV("Rain rate")=0.2
2CV(w)=2CV+0.2

RA2M
2CV("Accum_Rain~mm")
END

Cheers,
Roger

Good afternoon Grant, Your requirements are mutually exclusive. Rain events are random therefore rain intensity readings need to be triggered by the physical tipping of the bucket (when HSC changes). The accumulative rain fall every 2 minutes is time based so you will need two schedule, Event based for Rain Intensity and Time based for accumulated rain for a given duration ```` BEGIN /D /T 1CV=0 RA1HSC(1) 1CV("Rain rate")=0.2 2CV(w)=2CV+0.2 RA2M 2CV("Accum_Rain~mm") END ```` Cheers, Roger

G'Day Roger,

Thanks for your reply, I was afraid that may be the case. I was wondering, do you know if it would be possible to do this using the system timers, alarms & an if statement?

Thanks,
Grant

G'Day Roger, Thanks for your reply, I was afraid that may be the case. I was wondering, do you know if it would be possible to do this using the system timers, alarms & an if statement? Thanks, Grant

Hi Grant,

You can't use if statements or timers. The best I can do is to have three schedule:

  • One event based to recored when the tip occurs
  • One time based to recored the accumulation
  • One polled to record the data.

Then you need to track if the polled schedule was called by an event or time.

BEGIN
/D
/T
1..2CV(W)=0
RA1HSC(1)
1CV("Rain_Event",W)=1
2CV("Accum_Rain",W)=2CV+0.2
Do{XC}
RB2M
1CV("Rain_Event",W)=0
Do{XC}

RCX
1CV("Event",ff1)
2CV("Total~mm",ff1)
END

Cheers,
Roger

Hi Grant, You can't use if statements or timers. The best I can do is to have three schedule: - One event based to recored when the tip occurs - One time based to recored the accumulation - One polled to record the data. Then you need to track if the polled schedule was called by an event or time. ```` BEGIN /D /T 1..2CV(W)=0 RA1HSC(1) 1CV("Rain_Event",W)=1 2CV("Accum_Rain",W)=2CV+0.2 Do{XC} RB2M 1CV("Rain_Event",W)=0 Do{XC} RCX 1CV("Event",ff1) 2CV("Total~mm",ff1) END ```` Cheers, Roger

G'Day,

My next question is in with regard to the calculation of Heat Index. I have the formula which I want to use but so far have yet to successfully implement a condition.

Okay, here's what I'm after. If the air temperature is below 20 degC then I want the heat index to equal the air temperature. If the air temperature is above 20 degC then I want the heat index to be calculated via a formula. I have included various info below:

  • Air Temperature = 101CV
  • Humidity = 151CV
  • Heat Index = 251CV

Heat Index Formula:

255CV(W)=(0.185212*((9/5*101CV)+32))
256CV(W)=(5.37941*151CV)
257CV(W)=(0.100254*((9/5*101CV)+32)*151CV)
258CV(W)=(0.00941695*((9/5*101CV)+32)^2)
259CV(W)=(0.00728898*151CV^2)
260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV)
261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2)
262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2)
263CV(W)=(0.000038646*((9/5*101CV)+32)^3)
264CV(W)=(0.0000291583*151CV^3)
265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV)
266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3)
267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2)
268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3)
269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3)

251CV=((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9

Thanks,
Grant

G'Day, My next question is in with regard to the calculation of Heat Index. I have the formula which I want to use but so far have yet to successfully implement a condition. Okay, here's what I'm after. If the air temperature is below 20 degC then I want the heat index to equal the air temperature. If the air temperature is above 20 degC then I want the heat index to be calculated via a formula. I have included various info below: - Air Temperature = 101CV - Humidity = 151CV - Heat Index = 251CV Heat Index Formula: ```` 255CV(W)=(0.185212*((9/5*101CV)+32)) 256CV(W)=(5.37941*151CV) 257CV(W)=(0.100254*((9/5*101CV)+32)*151CV) 258CV(W)=(0.00941695*((9/5*101CV)+32)^2) 259CV(W)=(0.00728898*151CV^2) 260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV) 261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2) 262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2) 263CV(W)=(0.000038646*((9/5*101CV)+32)^3) 264CV(W)=(0.0000291583*151CV^3) 265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV) 266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3) 267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2) 268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3) 269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3) 251CV=((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9 ```` Thanks, Grant

Hey Roger,

The formula is this:

251CV=((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9

With the CV values representing the following:
255CV(W)=(0.185212*((9/5*101CV)+32))
256CV(W)=(5.37941*151CV)
257CV(W)=(0.100254*((9/5*101CV)+32)*151CV)
258CV(W)=(0.00941695*((9/5*101CV)+32)^2)
259CV(W)=(0.00728898*151CV^2)
260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV)
261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2)
262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2)
263CV(W)=(0.000038646*((9/5*101CV)+32)^3)
264CV(W)=(0.0000291583*151CV^3)
265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV)
266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3)
267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2)
268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3)
269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3)

Cheers,
Grant

Hey Roger, The formula is this: ```` 251CV=((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9 With the CV values representing the following: 255CV(W)=(0.185212*((9/5*101CV)+32)) 256CV(W)=(5.37941*151CV) 257CV(W)=(0.100254*((9/5*101CV)+32)*151CV) 258CV(W)=(0.00941695*((9/5*101CV)+32)^2) 259CV(W)=(0.00728898*151CV^2) 260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV) 261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2) 262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2) 263CV(W)=(0.000038646*((9/5*101CV)+32)^3) 264CV(W)=(0.0000291583*151CV^3) 265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV) 266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3) 267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2) 268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3) 269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3) ```` Cheers, Grant

Hi Grant,

What is the formula you use for the calculation of Heat Index? I want to see if we can simplify the code to make it more understandable and make sure your calculation is correct.

Cheers,
Roger

Hi Grant, What is the formula you use for the calculation of Heat Index? I want to see if we can simplify the code to make it more understandable and make sure your calculation is correct. Cheers, Roger

G'Day Roger,

Ah okay no problem. Here is the formula in it's raw form:

Heat Index = 16.923 + (1.85212 X 10-1*T) + (5.37941*RH) - (1.00254 X 10-1 * T * RH) + (9.41695 X 10-3 * T^2) + 
(7.28898 X 10-3 * RH^2) + (3.45372 X 10-4 * T^2 * RH) - (8.14971 X 10-4 * T * RH^2) + (1.02102 X 10-5 * T^2 * RH^2) - 
(3.8646 X 10-5 * T^3) + (2.91583 X 10-5 * RH^3) + (1.42721 X 10-6 * T^3 * RH) + (1.97483 X 10-7 * T * RH^3) - 
(2.18429 X 10-8 * T^3 * RH^2) + (8.43296 X 10-10 * T^2 * RH^3) - (4.81975 X 10-11 * T^3 * RH^3)

where T = temperature in degF & RH = relative humidity (input as a whole number). I use the formula "(9/5*T)+32" to convert my degC inputs into degF to suit the formula.

Thanks,
Grant

G'Day Roger, Ah okay no problem. Here is the formula in it's raw form: ```` Heat Index = 16.923 + (1.85212 X 10-1*T) + (5.37941*RH) - (1.00254 X 10-1 * T * RH) + (9.41695 X 10-3 * T^2) + (7.28898 X 10-3 * RH^2) + (3.45372 X 10-4 * T^2 * RH) - (8.14971 X 10-4 * T * RH^2) + (1.02102 X 10-5 * T^2 * RH^2) - (3.8646 X 10-5 * T^3) + (2.91583 X 10-5 * RH^3) + (1.42721 X 10-6 * T^3 * RH) + (1.97483 X 10-7 * T * RH^3) - (2.18429 X 10-8 * T^3 * RH^2) + (8.43296 X 10-10 * T^2 * RH^3) - (4.81975 X 10-11 * T^3 * RH^3) ```` where T = temperature in degF & RH = relative humidity (input as a whole number). I use the formula "(9/5*T)+32" to convert my degC inputs into degF to suit the formula. Thanks, Grant

G'Day Roger,

I just found another part of the user manual which was able to help me out with my problem, all appears to work correctly. Below is my solution if your interested:

255CV(W)=(0.185212*((9/5*101CV)+32))
256CV(W)=(5.37941*151CV)
257CV(W)=(0.100254*((9/5*101CV)+32)*151CV)
258CV(W)=(0.00941695*((9/5*101CV)+32)^2)
259CV(W)=(0.00728898*151CV^2)
260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV)
261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2)
262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2)
263CV(W)=(0.000038646*((9/5*101CV)+32)^3)
264CV(W)=(0.0000291583*151CV^3)
265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV)
266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3)
267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2)
268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3)
269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3)

251CV=(101CV*(101CV<20))+((((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9)*(101CV>=20))

where 101CV is air temperature (degC), 151CV is humidity, 251CV is heat index - calculated equal to or above 20 degC or simply equals the air temperature below 20 degC

So yeah, if that code can be simplified please let me know.

Cheers,
Grant

G&#039;Day Roger, I just found another part of the user manual which was able to help me out with my problem, all appears to work correctly. Below is my solution if your interested: ```` 255CV(W)=(0.185212*((9/5*101CV)+32)) 256CV(W)=(5.37941*151CV) 257CV(W)=(0.100254*((9/5*101CV)+32)*151CV) 258CV(W)=(0.00941695*((9/5*101CV)+32)^2) 259CV(W)=(0.00728898*151CV^2) 260CV(W)=(0.000345372*((9/5*101CV)+32)^2*151CV) 261CV(W)=(0.000814971*((9/5*101CV)+32)*151CV^2) 262CV(W)=(0.0000102102*((9/5*101CV)+32)^2*151CV^2) 263CV(W)=(0.000038646*((9/5*101CV)+32)^3) 264CV(W)=(0.0000291583*151CV^3) 265CV(W)=(0.00000142721*((9/5*101CV)+32)^3*151CV) 266CV(W)=(0.000000197483*((9/5*101CV)+32)*151CV^3) 267CV(W)=(0.0000000218429*((9/5*101CV)+32)^3*151CV^2) 268CV(W)=(0.000000000843296*((9/5*101CV)+32)^2*151CV^3) 269CV(W)=(0.0000000000481975*((9/5*101CV)+32)^3*151CV^3) 251CV=(101CV*(101CV&lt;20))+((((16.923+255CV+256CV-257CV+258CV+259CV+260CV-261CV+262CV-263CV+264CV+265CV+266CV-267CV+268CV-269CV)-32)*5/9)*(101CV&gt;=20)) ```` where 101CV is air temperature (degC), 151CV is humidity, 251CV is heat index - calculated equal to or above 20 degC or simply equals the air temperature below 20 degC So yeah, if that code can be simplified please let me know. Cheers, Grant

Hi Grant,

Yes, Boolean logic is the ware to select if the calculation is over or under a set point.

There isn't much you can do to simplify but you can make the degC to degF simple by using a span in the calculations to do the conversion for you, e.g:

S1=32,212,0,100"DegF"
1CV=S1(100)

Cheers,
Roger

Hi Grant, Yes, Boolean logic is the ware to select if the calculation is over or under a set point. There isn&#039;t much you can do to simplify but you can make the degC to degF simple by using a span in the calculations to do the conversion for you, e.g: ```` S1=32,212,0,100&quot;DegF&quot; 1CV=S1(100) ```` Cheers, Roger

Hey Roger,

This question is with regard to my ultrasonic anemometer (Vaisala WMT52). Can you please tell me how I would modify the following code to return only the following:

  • Wind direction average (2CV)
  • Wind speed average (5CV)
  • Wind speed max (6CV)

Thanks,
Grant

BEGIN
1SSPWR=1
/T
PS=9600,E,7,1,NOFC
1SERIAL(RS485,"{\\e}")
RA1S LOGONA
1SERIAL(RS485,"\\e{0R1\\013\\010}\\m[,Dn=]%f[1CV],%*3S%f[2CV],%*3S%f[3CV],%*3S%f[4CV],%*3S%f[5CV],%*3S%f[6CV]",2,W)
1CV("Wind Dir Min ~Deg")
2CV("Wind Dir Ave ~Deg")
3CV("Wind Dir Max ~Deg")
4CV("Wind Speed Min ~m/s")
5CV("Wind Speed Ave ~m/s")
6CV("Wind Speed Max ~m/s")
END

Here is also some output which may or may not help:

1SERIAL: RxBuf=3[K\013\010]
1SERIAL: InputAction: "\e"
1SERIAL: RxBuf-0[]
1SERIAL: OutputActions: "0R1\013\010"
1SERIAL: Tx [0R1\013\010]
1SERIAL: InputAction: "\m[,Dn=]"
1SERIAL: RxBuf+53[0R1,Dn=238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: RxBuf-46[238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%f[1CV]"
1SERIAL: RxBuf-43[D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: ","
1SERIAL: RxBuf-41[Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%*3S"
1SERIAL: RxBuf-38[283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%f[2CV]"
1SERIAL: RxBuf-35[D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: ","
1SERIAL: RxBuf-33[Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%*3S"
1SERIAL: RxBuf-30[352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%f[3CV]"
1SERIAL: RxBuf-27[D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: ","
1SERIAL: RxBuf-25[Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%*3S"
1SERIAL: RxBuf-22[0.3K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%f[4CV]"
1SERIAL: RxBuf-19[K,Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: ","
1SERIAL: RxBuf-17[Sm=0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%*3S"
1SERIAL: RxBuf-14[0.3K,Sx=0.3K\013\010]
1SERIAL: InputAction: "%f[5CV]"
1SERIAL: RxBuf-11[K,Sx=0.3K\013\010]
1SERIAL: InputAction: ","
1SERIAL: RxBuf-9[Sx=0.3K\013\010]
1SERIAL: InputAction: "%*3S"
1SERIAL: RxBuf-6[0.3K\013\010]
1SERIAL: InputAction: "%f[6CV]"
1SERIAL: RxBuf-3[K\013\010]
Time 13:34:09.000
Wind Dir Min 238.0 Deg
Wind Dir Ave 283.0 Deg
Wind Dir Max 352.0 Deg
Wind Speed Min 0.3 m/s
Wind Speed Ave 0.3 m/s
Wind Speed Max 0.3 m/s
Hey Roger, This question is with regard to my ultrasonic anemometer (Vaisala WMT52). Can you please tell me how I would modify the following code to return only the following: - Wind direction average (2CV) - Wind speed average (5CV) - Wind speed max (6CV) Thanks, Grant ```` BEGIN 1SSPWR=1 /T PS=9600,E,7,1,NOFC 1SERIAL(RS485,&quot;{\\e}&quot;) RA1S LOGONA 1SERIAL(RS485,&quot;\\e{0R1\\013\\010}\\m[,Dn=]%f[1CV],%*3S%f[2CV],%*3S%f[3CV],%*3S%f[4CV],%*3S%f[5CV],%*3S%f[6CV]&quot;,2,W) 1CV(&quot;Wind Dir Min ~Deg&quot;) 2CV(&quot;Wind Dir Ave ~Deg&quot;) 3CV(&quot;Wind Dir Max ~Deg&quot;) 4CV(&quot;Wind Speed Min ~m/s&quot;) 5CV(&quot;Wind Speed Ave ~m/s&quot;) 6CV(&quot;Wind Speed Max ~m/s&quot;) END ```` Here is also some output which may or may not help: ```` 1SERIAL: RxBuf=3[K\013\010] 1SERIAL: InputAction: &quot;\e&quot; 1SERIAL: RxBuf-0[] 1SERIAL: OutputActions: &quot;0R1\013\010&quot; 1SERIAL: Tx [0R1\013\010] 1SERIAL: InputAction: &quot;\m[,Dn=]&quot; 1SERIAL: RxBuf+53[0R1,Dn=238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: RxBuf-46[238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%f[1CV]&quot; 1SERIAL: RxBuf-43[D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;,&quot; 1SERIAL: RxBuf-41[Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%*3S&quot; 1SERIAL: RxBuf-38[283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%f[2CV]&quot; 1SERIAL: RxBuf-35[D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;,&quot; 1SERIAL: RxBuf-33[Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%*3S&quot; 1SERIAL: RxBuf-30[352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%f[3CV]&quot; 1SERIAL: RxBuf-27[D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;,&quot; 1SERIAL: RxBuf-25[Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%*3S&quot; 1SERIAL: RxBuf-22[0.3K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%f[4CV]&quot; 1SERIAL: RxBuf-19[K,Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;,&quot; 1SERIAL: RxBuf-17[Sm=0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%*3S&quot; 1SERIAL: RxBuf-14[0.3K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%f[5CV]&quot; 1SERIAL: RxBuf-11[K,Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;,&quot; 1SERIAL: RxBuf-9[Sx=0.3K\013\010] 1SERIAL: InputAction: &quot;%*3S&quot; 1SERIAL: RxBuf-6[0.3K\013\010] 1SERIAL: InputAction: &quot;%f[6CV]&quot; 1SERIAL: RxBuf-3[K\013\010] Time 13:34:09.000 Wind Dir Min 238.0 Deg Wind Dir Ave 283.0 Deg Wind Dir Max 352.0 Deg Wind Speed Min 0.3 m/s Wind Speed Ave 0.3 m/s Wind Speed Max 0.3 m/s ````

Good afternoon Grant,

Ok, the output is a great help When you poll the WNT50 it responds with

0R1,Dn=238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010

Now according to the WXT520 manual:

  • Dm = Average wind speed
  • Sm = Average Wind speed
  • Sx = Maximum Wind speed

So you want to read the second, fifth and sixth items. We can use the match function \m[] to lock on to the Average wind speed header and the average wind speed header and we can either skip the characters to the next item or do another match.

So we could try:

1SERIAL(RS485,"\\e{0R1\\013\\010}\\m[,Dm=]%f[2CV]\\m[,Sm=]%f[5CV]\\m[,Sx]%f[6CV]",2,W)

Giving us the code

BEGIN
1SSPWR=1
/T
PS=9600,E,7,1,NOFC
1SERIAL(RS485,"{\\e}")
RA1S LOGONA
1SERIAL(RS485,"\\e{0R1\\013\\010}\\m[,Dm=]%f[2CV]\\m[,Sm=]%f[5CV]\\m[,Sx]%f[6CV]",2,W)

2CV("Wind Dir Ave ~Deg")
5CV("Wind Speed Ave ~m/s")
6CV("Wind Speed Max ~m/s")
END

Cheers,
Roger

Good afternoon Grant, Ok, the output is a great help When you poll the WNT50 it responds with ```` 0R1,Dn=238D,Dm=283D,Dx=352D,Sn=0.3K,Sm=0.3K,Sx=0.3K\013\010 ```` Now according to the WXT520 manual: - Dm = Average wind speed - Sm = Average Wind speed - Sx = Maximum Wind speed So you want to read the second, fifth and sixth items. We can use the match function \m[] to lock on to the Average wind speed header and the average wind speed header and we can either skip the characters to the next item or do another match. So we could try: ```` 1SERIAL(RS485,&quot;\\e{0R1\\013\\010}\\m[,Dm=]%f[2CV]\\m[,Sm=]%f[5CV]\\m[,Sx]%f[6CV]&quot;,2,W) ```` Giving us the code ```` BEGIN 1SSPWR=1 /T PS=9600,E,7,1,NOFC 1SERIAL(RS485,&quot;{\\e}&quot;) RA1S LOGONA 1SERIAL(RS485,&quot;\\e{0R1\\013\\010}\\m[,Dm=]%f[2CV]\\m[,Sm=]%f[5CV]\\m[,Sx]%f[6CV]&quot;,2,W) 2CV(&quot;Wind Dir Ave ~Deg&quot;) 5CV(&quot;Wind Speed Ave ~m/s&quot;) 6CV(&quot;Wind Speed Max ~m/s&quot;) END ```` Cheers, Roger

G'Day Roger,

All seems to work well except for the max wind speed, see a copy of the results below.

Cheers,
Grant

dataTaker 80 E90 - Serial sensor scan error at control string position 60
Time 15:03:43.000
Wind Dir Ave 85.0 Deg
Wind Speed Ave 0.9 m/s
Wind Speed Max 0.0 m/s

dataTaker 80 E90 - Serial sensor scan error at control string position 60
Time 15:03:44.001
Wind Dir Ave 87.0 Deg
Wind Speed Ave 0.6 m/s
Wind Speed Max 0.0 m/s

Here is results plus some additional output:

1SERIAL: RxBuf=7[=0.1#\013\010]
1SERIAL: InputAction: "\e"
1SERIAL: RxBuf-0[]
1SERIAL: OutputActions: "0R1\013\010"
1SERIAL: Tx [0R1\013\010]
1SERIAL: InputAction: "\m[,Dm=]"
1SERIAL: RxBuf+53[0R1,Dn=000#,Dm=000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: RxBuf-38[000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "%f[2CV]"
1SERIAL: RxBuf-35[#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "\m[,Sm=]"
1SERIAL: RxBuf-14[0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "%f[5CV]"
1SERIAL: RxBuf-11[#,Sx=0.1#\013\010]
1SERIAL: InputAction: "\m[,Sx]"
1SERIAL: RxBuf-7[=0.1#\013\010]
1SERIAL: InputAction: "%f[6CV]"
dataTaker 80 E90 - Serial sensor scan error at control string position 60
Time 15:06:05.000
Wind Dir Ave 0.0 Deg
Wind Speed Ave 0.1 m/s
Wind Speed Max 0.0 m/s

1SERIAL: RxBuf=7[=0.1#\013\010]
1SERIAL: InputAction: "\e"
1SERIAL: RxBuf-0[]
1SERIAL: OutputActions: "0R1\013\010"
1SERIAL: Tx [0R1\013\010]
1SERIAL: InputAction: "\m[,Dm=]"
1SERIAL: RxBuf+53[0R1,Dn=000#,Dm=000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: RxBuf-38[000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "%f[2CV]"
1SERIAL: RxBuf-35[#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "\m[,Sm=]"
1SERIAL: RxBuf-14[0.1#,Sx=0.1#\013\010]
1SERIAL: InputAction: "%f[5CV]"
1SERIAL: RxBuf-11[#,Sx=0.1#\013\010]
1SERIAL: InputAction: "\m[,Sx]"
1SERIAL: RxBuf-7[=0.1#\013\010]
1SERIAL: InputAction: "%f[6CV]"
dataTaker 80 E90 - Serial sensor scan error at control string position 60
Time 15:06:06.005
Wind Dir Ave 0.0 Deg
Wind Speed Ave 0.1 m/s
Wind Speed Max 0.0 m/s
G&#039;Day Roger, All seems to work well except for the max wind speed, see a copy of the results below. Cheers, Grant ```` dataTaker 80 E90 - Serial sensor scan error at control string position 60 Time 15:03:43.000 Wind Dir Ave 85.0 Deg Wind Speed Ave 0.9 m/s Wind Speed Max 0.0 m/s dataTaker 80 E90 - Serial sensor scan error at control string position 60 Time 15:03:44.001 Wind Dir Ave 87.0 Deg Wind Speed Ave 0.6 m/s Wind Speed Max 0.0 m/s ```` Here is results plus some additional output: ```` 1SERIAL: RxBuf=7[=0.1#\013\010] 1SERIAL: InputAction: &quot;\e&quot; 1SERIAL: RxBuf-0[] 1SERIAL: OutputActions: &quot;0R1\013\010&quot; 1SERIAL: Tx [0R1\013\010] 1SERIAL: InputAction: &quot;\m[,Dm=]&quot; 1SERIAL: RxBuf+53[0R1,Dn=000#,Dm=000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: RxBuf-38[000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[2CV]&quot; 1SERIAL: RxBuf-35[#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;\m[,Sm=]&quot; 1SERIAL: RxBuf-14[0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[5CV]&quot; 1SERIAL: RxBuf-11[#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;\m[,Sx]&quot; 1SERIAL: RxBuf-7[=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[6CV]&quot; dataTaker 80 E90 - Serial sensor scan error at control string position 60 Time 15:06:05.000 Wind Dir Ave 0.0 Deg Wind Speed Ave 0.1 m/s Wind Speed Max 0.0 m/s 1SERIAL: RxBuf=7[=0.1#\013\010] 1SERIAL: InputAction: &quot;\e&quot; 1SERIAL: RxBuf-0[] 1SERIAL: OutputActions: &quot;0R1\013\010&quot; 1SERIAL: Tx [0R1\013\010] 1SERIAL: InputAction: &quot;\m[,Dm=]&quot; 1SERIAL: RxBuf+53[0R1,Dn=000#,Dm=000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: RxBuf-38[000#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[2CV]&quot; 1SERIAL: RxBuf-35[#,Dx=000#,Sn=0.1#,Sm=0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;\m[,Sm=]&quot; 1SERIAL: RxBuf-14[0.1#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[5CV]&quot; 1SERIAL: RxBuf-11[#,Sx=0.1#\013\010] 1SERIAL: InputAction: &quot;\m[,Sx]&quot; 1SERIAL: RxBuf-7[=0.1#\013\010] 1SERIAL: InputAction: &quot;%f[6CV]&quot; dataTaker 80 E90 - Serial sensor scan error at control string position 60 Time 15:06:06.005 Wind Dir Ave 0.0 Deg Wind Speed Ave 0.1 m/s Wind Speed Max 0.0 m/s ````

Good morning Grant,

Yes, there is an error in the code and it is a simple one to fix.
Hint: Look at the item that is not being read correctly. Remember we need to account for every character.

Cheers,
Roger

Good morning Grant, Yes, there is an error in the code and it is a simple one to fix. Hint: Look at the item that is not being read correctly. Remember we need to account for every character. Cheers, Roger

G'Day Roger,

Okay thanks for that, found it lol. You'll need to warn me next time when you throw me code that isn't quite correct smile . Least i'll be more aware from now on smile .

Thanks again,
Grant

G&#039;Day Roger, Okay thanks for that, found it lol. You&#039;ll need to warn me next time when you throw me code that isn&#039;t quite correct :wink: . Least i&#039;ll be more aware from now on :smile: . Thanks again, Grant

Hi Grant,

It wasn't intentional, That code was written off the cuff and not tested at all. But if I can teach people how to program then I am teaching you how to fish.

Cheers,
Roger

Hi Grant, It wasn&#039;t intentional, That code was written off the cuff and not tested at all. But if I can teach people how to program then I am teaching you how to fish. Cheers, Roger

Hey Roger,

My next hurdle is with regard to wind direction. Basically I would like my DT80 to convert my wind direction in degrees to the acronym of the long wind direction with 16 compass points.

For example, if my CV value is between 12 & 33 degrees then output NNE, if it's between 34 & 56 then output NE, if it's between 57 & 78 then output ENE etc. I'm just looking for the best way to code this & an idea of the format I would use.

I have tried several attempts so far without success & have had no further luck with both the manual or the forum.

Cheers,
Grant

Hey Roger, My next hurdle is with regard to wind direction. Basically I would like my DT80 to convert my wind direction in degrees to the acronym of the long wind direction with 16 compass points. For example, if my CV value is between 12 &amp; 33 degrees then output NNE, if it&#039;s between 34 &amp; 56 then output NE, if it&#039;s between 57 &amp; 78 then output ENE etc. I&#039;m just looking for the best way to code this &amp; an idea of the format I would use. I have tried several attempts so far without success &amp; have had no further luck with both the manual or the forum. Cheers, Grant

Hi Grant,

I think you will have to use 16 If (alarm) statements, e.g.:

BEGIN
1CV=
RA1S
'Wind direction calculated here
If(1CV<12){1$="N"}
If(1CV><12,33){1$="NNE"}
...
...
...
If(1CV>348){1$="N"}
1$("Wind Direction")

END

Cheers,
Roger

Hi Grant, I think you will have to use 16 If (alarm) statements, e.g.: ```` BEGIN 1CV= RA1S &#039;Wind direction calculated here If(1CV&lt;12){1$=&quot;N&quot;} If(1CV&gt;&lt;12,33){1$=&quot;NNE&quot;} ... ... ... If(1CV&gt;348){1$=&quot;N&quot;} 1$(&quot;Wind Direction&quot;) END ```` Cheers, Roger

Thanks Roger, worked great.

Now how would I go about recording the wind gust direction (from a CV value) at the instant that the maximum wind gust is recorded?

Cheers,
Grant

Thanks Roger, worked great. Now how would I go about recording the wind gust direction (from a CV value) at the instant that the maximum wind gust is recorded? Cheers, Grant
12
131
22
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft