hello
I'm trying to program my CR3000 to measure the wind with an anemometer Gill HS50 by rs232 and a CR3000. The frequency of acquisition is 20HZ.
But with my program, I have a problem with the anemometer.Few data recorded for the Sonic series on the port are NAN every 30 minutes. I think is a problème with a buffer.
Any help is appreciated.
'CR3000 Series Datalogger
'To create a different opening program template, type in new
'instructions and select Template | Save as Default Template
'date:17/01/2012
'program author:Fred Bornet
' Par rapport v2 j'ai change le format des donnees dans la table (j'ai remplace fp2
'par ieee4)
'par Rapport v2 j'ai change LI7200 (CO2,1,5,2) par LI7200 (CO2_dry,1,5,2)
' car co2dry est le premier de la liste (irga (10))
'Declare Public Variables
Public IRGA(10)
Alias IRGA(1)= CO2_dry
Alias IRGA(2)= H2O_dry
Alias IRGA(3)= CO2
Alias IRGA(4) = H2O
Alias IRGA(5) = AGC
Alias IRGA(6) = Ptotal
Alias IRGA(7) = Tin
Alias IRGA(8) = Tout
Alias IRGA(9) = TAvg
Alias IRGA(10) = Aux
Units CO2_dry = umol/mol
'v4 changement d'unite pour h2o_dry
Units H2O_dry = mmol/mol
Units CO2 = mmol/m3
Units H2O = mmol/m3
Units Ptotal= kPa
Units PTemp = C
Units batt_volt = C
Public result1,dummy1
Public PTemp, batt_volt
public sonic_u
Public sonic_v
Public sonic_w
public sonic_t
public toto as string * 100
units sonic_u = m/s
units sonic_v = m/s
units sonic_w = m/s
units sonic_t = C
'Declare Other Variables
'Example:
'Dim Counter
dim sonic_string as string * 100
dim sonic_sub_string(7) as string * 8
dim nmbr_bytes_rtrnd
dim socket as Long
'Declare Constants
'Example:
'CONST PI = 3.141592654
'Define Data Tables
DataTable (Test,true,-1)
DataInterval (0,50,mSec,50)
cardout(0,-1)
'plus enregistrer dans la v5
'Minimum (1,batt_volt,FP2,0,False)
'Sample (1,PTemp,FP2)
sample (1,sonic_u,FP2)
sample (1,sonic_v,FP2)
sample (1,sonic_w,FP2)
Sample (1,sonic_t,FP2)
'changer ieee4 par fp2 dans la v6
Sample (1,CO2,FP2)
Sample (1,H2O,FP2)
Sample (1,Ptotal,FP2)
'inserer dans la v5
Sample (1,TAvg,FP2)
Sample (1,Tin,FP2)
Sample (1,Tout,FP2)
'fin insersiondans la v5
'changer ieee4 par fp2 dans la v6
Sample (1,CO2_dry,FP2)
Sample (1,H2O_dry,FP2)
EndTable
BeginProg
'Changement tx et buffer size suivant program daniel
SerialOpen (ComRS232,115200,0,0,1024)
Scan (50,mSec,1,0)
'modif_version v7
'SerialFlush (ComRS232)
'Fin modif version v7
' v4 mise a 0 des variables avnt chaque scan
' CO2=nan
' H2O=nan
' Ptotal=nan
' CO2_dry=nan
' H2O_dry=nan
' Move (CO2,5,nan,5)
'PanelTemp (PTemp,250)
'Battery (batt_volt)
'v4 changement de valeur du dernier parametre passage a 01
SerialInRecord (ComRS232,sonic_string,&h02,0,&h03,nmbr_bytes_rtrnd,01)
splitstr (sonic_sub_string(),sonic_string,",",7,6)
sonic_u =sonic_sub_string(2)
sonic_v=sonic_sub_string(3)
sonic_w=sonic_sub_string(4)
sonic_t=sonic_sub_string (5)
LI7200 (CO2_dry,1,5,2)
CallTable Test
NextScan
EndProg
How fast is the sonic programmed to output its data?
Hello
RS232 115000 baud. Is it your question ?
No. Form you program it looks like you are just picking up data from the sensor, which has been preprogrammed to output data at a given rate, e.g. 20 Hz. Can you confirm how frequently the sensor is setup to output data?
the characteristics of the instruments are the following
Data output rates up to 50s-1.
• Measurement of wind velocities in excess of 30ms-1 .
• Wind speed accuracy < 1% RMS.
• Accurate speed of sound measurement.
• Configuration carried out via serial port and stored in non-volatile memory.
• High speed, full duplex RS422 interface, operating up to 115200 baud.
• Background diagnostics providing the user with the confidence that the unit is operating correctly.
• 6 differential 14 bit analogue inputs and one PRT100 input.
• Analogue outputs representing wind speed, SoS, and temperature optionally fitted in PCI.
An other information about the rates:
Wind velocity, SoS and analogue inputs are sampled every 10ms, in a fixed sequential pattern. The PRT100 is sampled every 40ms. The measurement sequence is shown in Drawing Number 1210-K-068.
You are quoting the base specs of the sensor. What you need ot know is how often the sensor is set to transmit data out of its serial port (this is configurable I believe).
For the system to work it needs to be set to output at faster than 20 Hz - perhaps 50 Hz, because otherwise you will risk loosing the occasional set of values due to slight differences in the clocks of the two systems and also you will get poor synchony of the wind data to other measurements as (at 20 Hz) there could be +/-50 ms relative jitter on the time the wind was measured relative to the other sensors.
There is one significant error in the program which could be making your system perform badly anyway and this is you have Serialflush called at the start of every scan. This will be clearing the serial buffer when data could be coming in from the sensor at that exact time. Serialinrecord alone is all you need as it manages the buffer in its own right.
Thank you for your reponse.
When I call instruction serialflush all my recordings of sonic are NAN.
Yes I would expect that but I see it was commented out in the program above - hard to see on my screen in this format.
So I would go back and check how often the sensor has been configured to output data and up the rate to 50 Hz if possible.