i am using a CR3000 with fast ec measurements (50 ms scan) in the main scan and i want to get data from another CR3000 ( with 20 Sec scan). This variable (precipitation) shall be totalized over a 10min period in a data table.
This is the corresponding code (not all) from the CR3000 with fast ec measurements:
GetVariables (status_get_precip,TCPOpen ("192.168.001.102",6785,0),0,2,0000,0,"Public","P_1_1_1",P_1_1_1,1)
precip = P_1_1_1
The problem is after a precipitation event i get only zeros at the variable "precip" (totalized over 10min). The resultcode of the GetVariables parameter (status_get_precip) says ervery time "0". This should mean transmission successfully.
- does the above slowsequence ever work reliably in a program with 50ms main scan?
- is there still a bug I overlook?
- what can I improve so that it reliably stores the precipitation data from the other logger?
Does it compile well? I see the CallTable flux table twice, it would be to verify if this is correct.
However, the slow scan has a lower priority than the main table and therefore will be performed only when there is time.
If the transmission is ok it's good .
I would do something like this :
1) remove the CallTable flux in the slow scan
2) after getvariable instr. in slow scan would do a calculation like tot_precip = tot_precip + precip
3) a sample in the CallTable flux instead of Totalize, for tot_precip variable
4) a reset after CallTable flux instr. , every 10 minutes, for variable tot_precip " if iftime ( 0, 10,min) then tot_precip=0 "
thanks for the quick feedback. Yes the logger compiles well. I have added the changes now. I will compare the data again at the next precipitation event.
Some more questions:
Isn't it allowed to run a calltable multiple times? What happens then?
What happens to the last 20-second value? (exactly at 10:00 minutes)? Or is the last value from 09:40 minutes?
"Isn't it allowed to run a calltable multiple times? What happens then?"
I don't know I have always avoided doing it, logically it doesn't seem correct but maybe it's the case to try or read the manual well. By logic, perhaps asking the table twice for an average does not change much, but a total could be double!
"What happens to the last 20-second value? (exactly at 10:00 minutes)? Or is the last value from 09:40 minutes?"
If the slowscan is executed late, due to the lower priority, compared to 10:00 where the historical data are generated, it is probable that the missing sum is calculated and elaborated at 10:10.
However if you have a remote connection or the station is not far you can do some tests without waiting for the rain. Sorry if this suggestion is trivial!
it's not working yet. I now have the following idea:
The logger (20 seconds main scan) with the tipping bucket should calculate the 10 minutes amount of precipitation. After 10 minutes (600 sec) and 5 seconds it should reset the value:
precip_tot_tr32 = precip_tot_tr32 + P_1_1_1_1
If IfTime(5,600,sec) Then precip_tot_tr32=0
The other logger (50ms main scan) should execute the Getvariables command in the main scan every 10 minutes:
GetVariables (status_get_precip,TCPOpen("192.168.001.102",6785,0),0,2,0000,0, "Public", "precip_tot_tr32",precip_tot,1)
Should that work fine?