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.

A 50 minutes average every hour?


MFErwan May 26, 2015 08:06 AM

Hello,

Here is my problem. I a using a CR3000 to measure different kinds of radiation (in visible light and IR), for Météo-France (the french equivalent of the Met Office).

I wrote the program to measure the radiation every 5 seconds.

Now my problem is when I want to calculate the hourly average.

Since the sensors are in the Alps, they are cleaned from the snow every hour thanks to a hot air ventilator.

Therefore the last 10 minutes shouldn't be taken into account when caculating the average.

In short: I want to have a DataTable with a 60 minutes Data interval, but the AverageRadiation data should only be calculate on the 50 first minutes.

Here is my code for now:


DataTable (Donnees,1,1000)
DataInterval (0,60,Min,10)
'Here is where I would like to compute the
'50 minutes average, from minute 0 to 50
EndTable


BeginProg
Scan (5,Sec,0,0)
'Here you have the program that is making
'the measurements, the results are stored
'in the Rayonnement_Vis_Inc,
'Rayonnement_Vis_Ref
'Rayonnement_IR_Inc
'Rayonnement_IR_Ref variables

CallTable Donnees
NextScan
EndProg


The AvgSpa seemed ok for that, (swath would have been 600 (one measurement every 5s during 50 minutes)) but it must appear between the Scan...NextScan instructions...

* Last updated by: MFErwan on 5/26/2015 @ 2:10 AM *


aps May 26, 2015 10:08 AM

Have a look at this bit of code which shows how to use the disable variable to stop values being included in statistical calculations. Note I changed the intervals to sec to allow quicker testing:

Public Radiation, donotprocess As Boolean

DataTable (Donnees,1,1000)
DataInterval (0,60,sec,10)
Average (1,Radiation,IEEE4,donotprocess)
Totalize (1,1,IEEE4,donotprocess)

'Here is where I would like to compute the
'50 minutes average, from minute 0 to 50
EndTable


BeginProg
Scan (1,Sec,0,0)
'..
'With logger firmware version OS28 on
donotprocess=TimeIsBetween (50,60,60,sec)
'Or with older operating systems
' If TimeIntoInterval (50, 60 sec) Then dontoprocess=true
' If TimeIntoInterval (0,60,sec) Then donotprocess=false

CallTable Donnees

NextScan
EndProg

* Last updated by: aps on 5/26/2015 @ 7:20 AM *


MFErwan May 26, 2015 01:13 PM

Thank you vey much, it is working correctly now.

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