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.

Getvariables via TCPopen


dandol Jul 19, 2019 08:19 AM

Hi,

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:

PipelineMode

...

...

...

DataTable (flux,TRUE,FLUX_SIZE_CPU)
DataInterval (0,10,Min,10)
CardOut (0,-1)

...

Totalize (1,precip,FP2,False)

...

Endtable

Scan (SCAN_INTERVAL,mSec,SCAN_BUFFER_SIZE,0)

...

CallTable flux

NextScan

SlowSequence
Scan (20,Sec,3,0)
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
CallTable flux
NextScan

EndProg

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.

Some questions:

- 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?

Best regards

Daniel


smile Jul 20, 2019 12:00 PM

Hi

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 "


dandol Jul 23, 2019 12:09 AM

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?


smile Jul 24, 2019 01:37 AM

Hi

"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!


dandol Aug 8, 2019 06:55 AM

Hi,

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:

If IfTime(0,10,Min)
GetVariables (status_get_precip,TCPOpen("192.168.001.102",6785,0),0,2,0000,0, "Public", "precip_tot_tr32",precip_tot,1)
EndIf

Should that work fine?

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