Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

error in windsonic program


Geert Jul 9, 2011 12:54 PM

I have a cr1000 logger and i want to ad the windsonic rs232.

I generate this program with Short Cut

---------------------------------------------------

'CR1000
'Created by Short Cut (2.8)

'Declare Variables and Units
Dim WSStr As String * 21
Dim ByteRet
Dim ChkSumF As Boolean
Public BattV
Public WSData(3)
Public N(9)

Alias WSData(1)=WindDir
Alias WSData(2)=WS_kph
Alias WSData(3)=WSDiag
Alias N(1)=SmplsF
Alias N(2)=Diag1F
Alias N(3)=Diag2F
Alias N(4)=Diag4F
Alias N(5)=Diag8F
Alias N(6)=Diag9F
Alias N(7)=Diag10F
Alias N(8)=NNDF
Alias N(9)=CSEF

Units BattV=Volts
Units WindDir=Degrees
Units WS_kph=kilometers/hour
Units WSDiag=unitless

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,1,Min,10)
Sample(1,WindDir,FP2)
Sample(1,WS_kph,FP2)
EndTable

DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
SerialOpen(Com1,38400,3,0,145)
Scan(60,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'WindSonic1 Two Dimensional Sonic Wind Speed & Direction Sensor measurements WindDir, WS_kph, and WSDiag
'Get data from WindSonic1
SerialInRecord(Com1,WSStr,&h02,0,&h0Dh0A,ByteRet,00)
WindDir=Mid(WSStr,3,3)
WS_kph=Mid(WSStr,7,6)
WSDiag=Mid(WSStr,16,2)
WS_kph=WS_kph*3.6
ChkSumF = HextoDec(Mid(WSStr,20,2)) Eqv CheckSum(WSStr,9,18)
'Set diagnostic variables as needed
If ByteRet=0 Then WSDiag=NAN
Move(SmplsF,9,0,1)
Select Case WSDiag
Case=0
SmplsF=1
Case=1
Diag1F=1
Case=2
Diag2F=1
Case=4
Diag4F=1
Case=8
Diag8F=1
Case=9
Diag9F=1
Case=10
Diag10F=1
Else
NNDF=1
EndSelect
If Not (ByteRet<>0 Imp ChkSumF) Then CSEF=1
'Call Data Tables and Store Data
CallTable(Table1)
CallTable(Table2)
NextScan
EndProg


------------------------------------------------------------

Then i get this error:


Datalogger program not Created.
c:\lib\compilers\cr1comp.exe exot code:1
c:\scwin\windsonic.cr1 -- Complile Failes!

line 50: Undeclared variable h0Dh0A
line 50: Variable illegal in Parameter: h0Dh0A


Did i something wrong?


regards

Geert


aps Jul 9, 2011 10:20 PM

Sorry this is due to a change in the logger operating system which highlighted an error in the original Shortcut code. This will be fixed very soon in an official release of Shortcut. If you would like to email me (email in other postings) we can send you and file to fix the Windsonic program generation.


Geert Jul 22, 2011 06:32 AM

I have a strange reading in my data file created with Short Cut.

This is my program:
------------------------------------------------------------

'CR1000
'Created by Short Cut (2.8)

'Declare Variables and Units
Dim WSStr As String * 21
Dim ByteRet
Dim ChkSumF As Boolean
Public BattV
Public TRHData(2)
Public RTD_C
Public BP_mbar
Public Rain_mm
Public WSData(3)
Public N(9)

Alias TRHData(1)=AirTC
Alias TRHData(2)=RH
Alias WSData(1)=WindDir
Alias WSData(2)=WS_kph
Alias WSData(3)=WSDiag
Alias N(1)=SmplsF
Alias N(2)=Diag1F
Alias N(3)=Diag2F
Alias N(4)=Diag4F
Alias N(5)=Diag8F
Alias N(6)=Diag9F
Alias N(7)=Diag10F
Alias N(8)=NNDF
Alias N(9)=CSEF

Units BattV=Volts
Units RTD_C=Deg C
Units BP_mbar=mbar
Units Rain_mm=mm
Units AirTC=Deg C
Units RH=%
Units WindDir=degrees
Units WS_kph=kilometers/hour
Units WSDiag=unitless

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,1,Min,10)
Sample(1,RTD_C,FP2)
Sample(1,RH,FP2)
Sample(1,BP_mbar,FP2)
Totalize(1,Rain_mm,FP2,False)
Sample(1,WindDir,FP2)
Sample(1,WS_kph,FP2)
Sample(1,WSDiag,FP2)
Sample(1,SmplsF,FP2)
Sample(1,Diag1F,FP2)
Sample(1,Diag2F,FP2)
Sample(1,Diag4F,FP2)
Sample(1,Diag8F,FP2)
Sample(1,Diag9F,FP2)
Sample(1,Diag10F,FP2)
Sample(1,NNDF,FP2)
Sample(1,CSEF,FP2)
EndTable

DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
SerialOpen(Com2,38400,3,0,5785)
Scan(60,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'CS215 Temperature & Relative Humidity Sensor measurements AirTC and RH
SDI12Recorder(TRHData(),7,"0","M!",1,0)
'43347-VX RTD Temperature Probe (calibrated) measurement RTD_C
BrHalf4W(RTD_C,1,mV250,mV250,1,1,1,2500,True,True,0,_50Hz,1000,0)
RTD_C=-251.38+(RTD_C*2.4012e-1)+((RTD_C^2)*1.1200e-5)
'CS100 Barometric Pressure Sensor measurement BP_mbar
PortSet(1,1)
VoltSE(BP_mbar,1,mV2500,5,1,0,_50Hz,0.2,600.3604)
BP_mbar=BP_mbar*1
'52202/52203 Rain Gage (CSL) measurement Rain_mm
PulseCount(Rain_mm,1,1,2,0,0.1,0)
'WindSonic1 Two Dimensional Sonic Wind Speed & Direction Sensor measurements 'WindDir', 'WS_kph', and 'WSDiag'
'Get data from WindSonic1
SerialInRecord(Com2,WSStr,&h02,0,&h0D0A,ByteRet,00)
WindDir=Mid(WSStr,3,3)
WS_kph=Mid(WSStr,7,6)
WSDiag=Mid(WSStr,16,2)
WS_kph=WS_kph*3.6
ChkSumF=HextoDec(Mid(WSStr,20,2)) Eqv CheckSum(WSStr,9,18)
'Set diagnostic variables as needed
If ByteRet=0 Then WSDiag=NAN
Move(SmplsF,9,0,1)
Select Case WSDiag
Case=0
SmplsF=1
Case=1
Diag1F=1
Case=2
Diag2F=1
Case=4
Diag4F=1
Case=8
Diag8F=1
Case=9
Diag9F=1
Case=10
Diag10F=1
Else
NNDF=1
EndSelect
If Not (ByteRet<>0 Imp ChkSumF) Then CSEF=1
'Call Data Tables and Store Data
CallTable(Table1)
CallTable(Table2)
NextScan
EndProg

----------------------------------------------------------

And this is my data ouput file:

------------------------------------------------
101,2011,203,759,0,14.07,87.8,1021,0,317,6.156,0,1,0,0,0,0,0,0,0,0
101,2011,203,800,0,14.09,87.2,1012,0,332,4.608,0,1,0,0,0,0,0,0,0,0
101,2011,203,801,0,14.11,87.7,1012,0,268,1.188,0,1,0,0,0,0,0,0,0,0
--------------------------------------------------


The readings from the windsonic, speed and direction look to be ok.
But SmplsF give's permanently a 1 code.
Is that correct?

And why is the WS_kph reading multiplied with 3.6?
(WS_kph=WS_kph*3.6)

regards

Geert

* Last updated by: Geert on 7/22/2011 @ 12:41 AM *


aps Jul 22, 2011 08:38 AM

The break down of the sonic error value is included in the code for diagnostic purposes. Generally people will either just totalise one or more of the flags to check for errors over longer periods. (The main error value from the sonic is normally zero if all is OK and only goes non-zero if there is a fault of blockage of the sonic path).

The SmplsF is a variable created to allow you to do the inverse or counting errors, as it is set to one if all the errors are zero. You can totalise that variable to indicate the number of good readings taken in any one period.

In your Shortcut generated program you are only scanning once per minute and storing data once per minute so totalising is not relevant. (Normally for wind statistics you normally scan more often.) The fact it is one indicates the measurement was good.

The Ws_kph=3.6*Ws_kph, is a result of automatic program generation and reuse of a variable name. The sensors, as we ship them, give outputs in m/s. The 3.6 converts the value to km/hr which is what I guess you selected in Shortcut?

Log in or register to post/reply in the forum.